Welcome to the forums. Please post in English or French.

You are not logged in.

#1 Re: Code_Aster usage » as_run deleted my folder » 2022-08-12 15:33:45

It happend because rep_trav in .export file refers to a temporary folder that is cleaned up after work been done.  I though rep_trav would be the folder where the comm file is located (which I would call a working directory).

Regards,
Matt

#2 Code_Aster usage » as_run deleted my folder » 2022-08-11 10:08:32

Matt141
Replies: 1

Hi everyone,

I installed Aster 15.2 ,and I runned $ASTER/aster/bin/as_run projet.export .
config.txt was not found in  "$ASTER/15.4/" folder, so I created a folder named 15.4 and i copied the config.txt found in the salome-meca at '/media/me/disk/opt/salome_meca/Salome-V2021-s9/tools/Code_aster_stable-1540/share/aster' .
It seems it was running.  I terminated the running process with ctr+C to come back later. Then, my working folder with the comm file (and previous work) was deleted.

(base) mathieu@mathieu:/mnt/0ffe62d5-6917-4600-88a6-f898c5fbbd26/these/cavite_auto/calcul_impedance_sm21$ /home/mathieu/aster/bin/as_run projet.export

<A>_FILE_NOT_FOUND file not found : /home/mathieu/aster/15.4/profile.sh


--------------------------------------------------------------------------------
Code_Aster execution

<INFO> prepare environment in /mnt/0ffe62d5-6917-4600-88a6-f898c5fbbd26/these/cavite_auto/calcul_impedance_sm21/

--------------------------------------------------------------------------------
Copying datas

copying .../calcul_impedance_sm21/calcul_reponse_poursuite_mc.comm...   [  OK  ]
copying .../calcul_impedance_sm21/base_modes_2000Hz_impe1e3_sm21.base...
                                                                        ^C[FAILED]
Exit code : 2

<E>_COPY_ERROR     error during copying /mnt/0ffe62d5-6917-4600-88a6-f898c5fbbd26/these/cavite_auto/calcul_impedance_sm21/base_modes_2000Hz_impe1e3_sm21.base to base_modes_2000Hz_impe1e3_sm21.base
message :

copying .../calcul_impedance_sm21/mesh_auto_2000Hz_V2.med...            [  OK  ]
<INFO> Parameters : memory 15000 MB - time limit 900 s


---------------------------------------------------------------------------------
                                            cpu     system    cpu+sys    elapsed
---------------------------------------------------------------------------------
   Preparation of environment              0.00       0.00       0.00       0.01
   Copying datas                           0.13       6.39       6.52     112.58
---------------------------------------------------------------------------------
   Total                                   0.17       6.42       6.59     112.74
---------------------------------------------------------------------------------

as_run 2020.0

------------------------------------------------------------
--- DIAGNOSTIC JOB : <F>_COPY_ERROR
------------------------------------------------------------


EXIT_CODE=4
(base) mathieu@mathieu:/mnt/0ffe62d5-6917-4600-88a6-f898c5fbbd26/these/cavite_auto/calcul_impedance_sm21$ /home/mathieu/aster/bin/as_run projet.export
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/mathieu/aster/lib/python3.9/site-packages/asrun/main.py", line 109, in main
    start()
  File "/home/mathieu/aster/lib/python3.9/site-packages/asrun/main.py", line 92, in start
    meth(run, *args)
  File "/home/mathieu/aster/lib/python3.9/site-packages/asrun/execute.py", line 133, in RunAster
    prev = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory

#3 Code_Aster usage » How to troncate a modal base ? » 2022-07-29 15:19:18

Matt141
Replies: 0

Hi everyone,

I use DYNA_VIBRA to calculate vibration field on a structure as a response to a nodal force. I'd like to calculate this vibration field for only one mode of a modal base.

So, I selected one mode with EXTR_MODE:

MODE1 = EXTR_MODE ( FILTRE_MODE = _F ( MODE = MODES,
                                       NUME_MODE = (20)),)  

And then I try to project the masse matrix and rigidity matrix to this new mode:

MGENE1=PROJ_MATR_BASE(BASE=MODE1,
                     NUME_DDL_GENE=NUMGEN,
                     MATR_ASSE=M_ASSE,);

in order to be used in DYNA_VIBRA, as below.

## Calcul dynamique par la methode modale ##
	DYNGENE=DYNA_VIBRA(BASE_CALCUL='GENE',
		           TYPE_CALCUL='HARM',
		           MATR_MASS=MGENE1, 
		           MATR_RIGI=KCGENE1, 
		           LIST_FREQ=FREQ,
		           EXCIT=_F(VECT_ASSE_GENE=FGENE,
		                    COEF_MULT=1,),
		           AMOR_MODAL = _F(AMOR_REDUIT=AMOR_REDUIT),  
		           );

But I get the following error on PROJ_MATR_BASE

║ <EXCEPTION> <DVP_1>                                                                            ║
║                                                                                                ║
║ Erreur de programmation.                                                                       ║
║                                                                                                ║
║ Condition non respectée:                                                                       ║
║     nbmodes .le. nbmode

It seems that changing the number of modes is an issue.  Do you know why? You can find the mess file attached to this message.
Regards,
Mathieu

#4 Re: Code_Aster usage » [Solved] Detruire on REST_GENE_PHYS object doesn't release memory » 2022-06-01 11:25:34

The workaround solution is to specify GROUP_NO in REST_GENE_PHYS. In my case, GROUP_NO contains only 3 nodes, while REST_GENE_PHYS is processed on more than 100 000 nodes.

RESPHYS = REST_GENE_PHYS(CRITERE='RELATIF',
		                 INTERPOL='NON',
		                 NOM_CHAM=('VITE','DEPL'),
		                 PRECISION=1e-06,
		                 RESU_GENE=DYNGENE,
		                 GROUP_NO=gno_name)

#5 Code_Aster usage » [Solved] Detruire on REST_GENE_PHYS object doesn't release memory » 2022-05-30 18:00:59

Matt141
Replies: 1

Hello everyone,

I run calculations inside a for loop to perform an optimization. Looking at the mess file, I can notice that REST_GENE_PHYS increases the used RAM size, but it is not released when I call DETRUIRE on the REST_GENE_PHYS object. Which naturally lead to a memory issue.

Here are snippets of the mess file hilighting the issue:
Used RAM size increase (look at Mémoire):

# Mémoire (Mo) :  1482.75 /  1436.63 /   248.91 /   115.91 (VmPeak / VmSize / Optimum / Minimum)
# Fin commande #0015   user+syst:        0.10s (syst:        0.01s, elaps:        0.12s)
# ----------------------------------------------------------------------------------------------

.. _stg1_txt288
# ----------------------------------------------------------------------------------------------
# Commande #0016 de ./calcul_reponse_poursuite_mc.comm.changed.py, ligne 288
RESPHYS = REST_GENE_PHYS(CRITERE='RELATIF',
                         INTERPOL='NON',
                         NOM_CHAM=('VITE', 'DEPL'),
                         PRECISION=1e-06,
                         RESU_GENE=DYNGENE)

#3      Dechargement de la memoire sur disque             CPU (USER+SYST/SYST/ELAPS):      0.02      0.02      0.01
# Résultat commande #0016 (REST_GENE_PHYS): RESPHYS ('<0000003a>') de type <FullHarmonicResult>
# Dépend de :
# - DYNGENE ('<00000039>') de type <HarmoGeneralizedResult>
# Mémoire (Mo) :  3451.64 /  3451.64 /  2255.16 /  2205.97 (VmPeak / VmSize / Optimum / Minimum)
# Fin commande #0016   user+syst:        4.72s (syst:        0.49s, elaps:        5.20s)
# ----------------------------------------------------------------------------------------------

And is not released  (look at Mémoire)::

# Mémoire (Mo) :  3451.64 /  3451.64 /  2261.48 /  2205.97 (VmPeak / VmSize / Optimum / Minimum)
# Fin commande #0025   user+syst:        0.07s (syst:        0.00s, elaps:        0.08s)
# ----------------------------------------------------------------------------------------------

.. _stg1_txt411
# ----------------------------------------------------------------------------------------------
# Commande #0026 de ./calcul_reponse_poursuite_mc.comm.changed.py, ligne 411
DETRUIRE(INFO=2,
         NOM=RESPHYS)

Suppression de la référence : 'RESPHYS'
# Mémoire (Mo) :  3451.64 /  3451.64 /  2261.48 /  2205.97 (VmPeak / VmSize / Optimum / Minimum)
# Fin commande #0026   user+syst:        0.08s (syst:        0.00s, elaps:        0.08s)
# ----------------------------------------------------------------------------------------------
for i in range(N):	

	CHAR=AFFE_CHAR_MECA(MODELE=MODELE, VITE_FACE=(_F(GROUP_MA='hp', VNOR = 1),));  

	CHAR_EL=CALC_VECT_ELEM(OPTION='CHAR_MECA',
		               CHARGE=CHAR,);

	CHAR_AS=ASSE_VECTEUR(VECT_ELEM=CHAR_EL,
		           NUME_DDL=NUMEDDL);

	FGENE=PROJ_VECT_BASE(BASE=MODES,
		             NUME_DDL_GENE=NUMGEN,
		             VECT_ASSE=CHAR_AS,
		             TYPE_VECT ='FORC',);

	## Calcul dynamique par la methode modale ##
	DYNGENE=DYNA_VIBRA(BASE_CALCUL='GENE',
		           TYPE_CALCUL='HARM',
		           MATR_MASS=MGENE, 
		           MATR_RIGI=KCGENE, 
		           LIST_FREQ=FREQ,
		           EXCIT=_F(VECT_ASSE_GENE=FGENE,
		                    COEF_MULT=1,),
		           );

	RESPHYS = REST_GENE_PHYS(CRITERE='RELATIF',
		                 INTERPOL='NON',
		                 NOM_CHAM=('VITE','DEPL'),
		                 PRECISION=1e-06,
		                 RESU_GENE=DYNGENE)		               
		
	DETRUIRE(NOM = CHAR, INFO=2);
	DETRUIRE(NOM = CHAR_EL, INFO=2);
	DETRUIRE(NOM = CHAR_AS, INFO=2);
	DETRUIRE(NOM = FGENE, INFO=2);
	DETRUIRE(NOM = DYNGENE, INFO=2);
	DETRUIRE(NOM = RESPHYS, INFO=2);

Do you know why DETRUIRE doesn't release memory? Or to re-use the memory allocated on the first call.

Regards,
Matt

#7 Code_Aster usage » [Solved] Code_aster version 14.02.00 » 2022-05-23 15:03:44

Matt141
Replies: 2

Hello,
I'd like to find code_aster version 14.02.00, because the modal base was computed on a server that use this version, and the code_aster version difference seem to be an issue as suggested in the mess file:

!-------------------------------------------------------------------------------------------------------!
   ! <A> <JEVEUX_08>                                                                                       !
   !                                                                                                       !
   !  La base  GLOBALE  a été constituée avec la version  14.02.00                                         !
   !  et vous utilisez la version  14.08.00                                                                !
   !                                                                                                       !
   ! Conseil :                                                                                             !
   !  En général, la base ne peut-être utilisée qu'avec la version du code l'ayant construite,             !
   !  les catalogues d'éléments sont stockés dans la base lors de sa création, or certaines structures de  !
   !  données s'appuient sur leur description qui peut varier d'une version à l'autre.                     !

I can't find this version on the website, so where can find previous version of code_aster (version 14.02.00) or Salome-meca ?

If I need to rebuild code_aster, I am not sure if I should access bitbucket or Mercurial, I found different indication of code_aster website.
When I try to access the bitbucket repo, I get the following error message: "Repository not found".
And when I try to access Mercurial with "hg clone http:// aster-repo.der.edf.fr/scm/hg/codeaster/devtools", I get the error 'abort: error: No address associated with hostname'.

If I need to rebuild code_aster, where can I access code_aster repository so that I build code_aster version 14.02.00.

#8 Code_Aster usage » IMPR_RESU with MED format gives invalid values when GROUP_NO is given » 2022-05-16 15:52:11

Matt141
Replies: 0

Hi everyone,

I use IMPR_RESU to save pressure values into a med file which is read with Python.

The following code saves the pressure at every node of the cavity into a MED file, and it works fine.

IMPR_RESU(FORMAT='MED',
          UNITE=80,
          RESU=(
                _F(
                  NOM_CHAM='DEPL',
                  NOM_CHAM_MED='pression_re',
                  RESULTAT=RESPHYS,
                  NOM_CMP='PRES',
                  PARTIE='REEL'),
                _F(
                  NOM_CHAM='DEPL',
                  NOM_CHAM_MED='pression_im',
                  RESULTAT=RESPHYS,
                  NOM_CMP='PRES',
                  PARTIE='IMAG'),
                ),
          );

The MED file is read with the following python code

import numpy as np
import meshio

filepath = "./../data.med"
mesh = meshio.read(filepath)
point_data = mesh.point_data
point_data.pop('point_tags')
values = np.asarray(list(point_data.values()))
p_r = np.array([point_data[i] for i in list(point_data.keys()) if 'pression_re' in i])
p_i = np.array([point_data[i] for i in list(point_data.keys()) if 'pression_im' in i])
p = p_r + 1j * p_i

But when I add a GROUP_NO with one point, the pressure values real and imaginary are all invalid 'inf'.

The code is

MAIL = DEFI_GROUP(reuse = MAIL,
	    MAILLAGE=MAIL,
	    CREA_GROUP_NO=_F(GROUP_NO = 'cavite_points', NUME_INIT = 5000, NUME_FIN = 5000, NOM = 'micro')
	)  

IMPR_RESU(FORMAT='MED',
          UNITE=80,
          RESU=(
                _F(
                  NOM_CHAM='DEPL',
                  NOM_CHAM_MED='pression_re',
                  GROUP_NO= 'micro', 
                  RESULTAT=RESPHYS,
                  NOM_CMP='PRES',
                  PARTIE='REEL'),
                _F(
                  NOM_CHAM='DEPL',
                  NOM_CHAM_MED='pression_im',
                  GROUP_NO= 'micro',
                  RESULTAT=RESPHYS,
                  NOM_CMP='PRES',
                  PARTIE='IMAG'),
                ),
          );

Any idea what is going on ?
Regards

#9 Introduce yourself / Présentez vous » Hi - Paris, France - Vibro-acoustics » 2022-05-16 13:11:25

Matt141
Replies: 1

Hi everyone,

I am pursuing a PhD on vibro-acoustics at Paris, France. I use code_aster to simulate pressure fieds in cavities.

Regards,
Matt

#10 Code_Aster usage » POST_RELEVE_T Computation time » 2022-05-09 14:59:25

Matt141
Replies: 0

Hello everyone,

I use the following code to extract pressure values:

MOD_MIC_R=POST_RELEVE_T(ACTION=_F(OPERATION='EXTRACTION',
		                INTITULE='MODU',
		                RESULTAT=RESPHYS,
		                NOM_CHAM='DEPL',
		                GROUP_NO='cavite_points',
		                NOM_CMP='PRES',
		                FORMAT_C='REEL',),);
		                        
MOD_MIC_I=POST_RELEVE_T(ACTION=_F(OPERATION='EXTRACTION',
	                       INTITULE='MODU',
	                       RESULTAT=RESPHYS,
	                       NOM_CHAM='DEPL',
	                       GROUP_NO='cavite_points',
	                       NOM_CMP='PRES',
	                       FORMAT_C='IMAG',),);

The time of each POST_RELEVE_T is 20s which is huge compared to other functions as depicted bellow

********************************************************************************
* COMMAND                  :       USER :     SYSTEM :   USER+SYS :    ELAPSED *
********************************************************************************
* POURSUITE                    :       1.57 :       0.33 :       1.90 :       2.13 *
* CREA_CHAMP               :       2.16 :       0.01 :       2.17 :       2.20 *
* DEFI_GROUP                 :       1.17 :       0.00 :       1.17 :       1.17 *
* DEFI_GROUP                 :       0.01 :       0.00 :       0.01 :       0.00 *
* DEFI_GROUP                 :       0.01 :       0.00 :       0.01 :       0.02 *
* DEFI_GROUP                 :       0.01 :       0.00 :       0.01 :       0.01 *
* DEFI_GROUP                 :       0.01 :       0.00 :       0.01 :       0.01 *
* DEFI_LIST_REEL           :       0.01 :       0.00 :       0.01 :       0.01 *
* DEFI_GROUP                 :       0.01 :       0.00 :       0.01 :       0.01 *
* DEFI_FONCTION            :       0.01 :       0.00 :       0.01 :       0.00 *
* AFFE_CHAR_MECA       :       0.10 :       0.10 :       0.20 :       0.50 *
* CALC_VECT_ELEM       :       0.01 :       0.01 :       0.02 :       0.04 *
* ASSE_VECTEUR            :       0.01 :       0.01 :       0.02 :       0.04 *
* PROJ_VECT_BASE       :       0.04 :       0.03 :       0.07 :       0.07 *
* DYNA_VIBRA                  :       0.04 :       0.02 :       0.06 :       0.07 *
* REST_GENE_PHYS       :       0.17 :       0.06 :       0.23 :       0.22 *
* POST_RELEVE_T          :      18.94 :       0.19 :      19.13 :      19.15 *
* POST_RELEVE_T          :      20.75 :       0.28 :      21.03 :      21.05 *
* FIN                         :      10.34 :       0.39 :      10.73 :      11.07 *
*  . check syntax          :       0.04 :       0.00 :       0.04 :       0.07 *
*  . fortran                     :      55.13 :       1.43 :      56.56 :      57.50 *
********************************************************************************
* TOTAL_JOB                :      88.96 :       5.01 :      93.97 :      95.94 *
********************************************************************************

I assume POST_RELEVE_T should be faster than DYNA_VIBRA, which actually do the processing. I'd like to iterate many time over POST_RELEVE_T, so if one iteration is POST_RELEVE_T takes 20s, this is an issue.

Why POST_RELEVE_T is taking so much time? And, is there anothere mean to extract results without POST_RELEVE_T?

Regards,
Matt

#11 Re: Code_Aster usage » [Solved] Extract node group coordinates into a python array » 2022-05-09 09:43:52

The code to extract node coordinates from a groupe_ma:

from code_aster.MacroCommands.Utils     import partition
from code_aster.MacroCommands.Utils     import TableReader

mesh1 = partition.MAIL_PY()
mesh1.FromAster(MAIL)

def get_node_coordinates(groupe_ma):

	el_no = mesh1.gma.get(groupe_ma)
	
	node_numbers = []
	node_coordinates = []

	for el in el_no: 
	    for node in mesh1.co[el]:    
	    	node_numbers += [node]	
	    	node_coordinates += [mesh1.cn[node]]

	u, indices = np.unique(node_numbers, return_index=True)
	indices = indices.astype(int)

	node_numbers = np.array(node_numbers)[indices]
	node_coordinates = np.array(node_coordinates)[indices]
	
	return node_numbers, node_coordinates
	
node_numbers, node_coordinates = get_node_coordinates('name_structure')

#13 Code_Aster usage » Node extraction coordinates from groupe_no: spurious points » 2022-05-06 16:54:08

Matt141
Replies: 1

Hi everyone,
I am trying to export node coordinates for nodes belonging to a groupe_no. But there are spurious points located far away from the structure as on the left of the attached picture.

MAIL = DEFI_GROUP(reuse = MAIL,
    MAILLAGE=MAIL,
    CREA_GROUP_NO = _F ( GROUP_MA = 'pdb' , NOM = 'pdb_points' )
)  
groupe_no_name = 'pdb_points'
structure_position_index_list = MAIL.getNodes(groupe_no_name) 
structure_coordinates = mesh_coordinates[structure_position_index_list]

This doesn't happens when the nodes coordinates are extracted from a group_ma, instead of a groupe_no, as follow:

el_no = mesh1.gma.get('pdb')

node_numbers = []
structure_coordinates = []
for el in el_no: 
    for node in mesh1.co[el]:    
    	node_numbers += [node]	
    	structure_coordinates += [mesh1.cn[node]]

u, indices = np.unique(node_numbers, return_index=True)
node_numbers = np.array(node_numbers)[indices]
structure_coordinates = np.array(structure_coordinates)[indices]

The display

x, y, z = structure_coordinates[:, 0], structure_coordinates[:, 1], structure_coordinates[:, 2]
fig, ax = plt.subplots(nrows=1, ncols=1, subplot_kw=dict(projection='3d'))
ax.scatter(x, y, z)
ax.set_title('Structure', fontsize=16)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')

Out of curiosity , i'd like to understand why the first attempt using groupe_no gives those nodes, when it works fine using groupe_ma. The number of nodes are the same with the 2 methods.

Regards,
Matt

#14 Re: Code_Aster usage » import partition fails in 15.2 » 2022-05-06 13:18:00

This work for me:

from code_aster.MacroCommands.Utils     import partition
mesh1 = partition.MAIL_PY()

#15 Re: Code_Aster development » [SOLVED]How can i export nodes or node coordinates? » 2022-05-04 17:23:46

MAIL=LIRE_MAILLAGE(FORMAT='MED',);
xyz = np.asarray(MAIL.sdj.COORDO.VALE.get())
Nc = int(len(xyz)/3)
xyz = xyz.reshape((Nc, 3))

#16 Code_Aster usage » Finding a class definition in code_aster » 2022-05-03 16:24:53

Matt141
Replies: 1

Hello everyone,

I'd like to save the mode shapes calculated with MODES=CALC_MODES into numpy file.

The following informs about the class name of the instance MODES

help(MODES)

which is

class ModeResult(FullResult)
[...]

But when I look for the definition of ModeResult in code_aster 15.2 downloaded from the download page at code-aster.org/V2/spip.php?rubrique21, I can't find the definition of ModeResult.

Where can I find the definition of ModeResult ?

#17 Re: Code_Aster usage » Running code_aster in the pythonic way - No module named 'code_aster' » 2022-05-02 15:25:15

The path was wrong

sys.path.append('/media/my_disk/disk/opt/salome_meca/Salome-V2021-s9/tools/Code_aster_stable-1540/lib/aster/')

and should be

sys.path.append('/opt/salome_meca/Salome-V2021-s9/tools/Code_aster_stable-1540/lib/aster/')

and I have to do "source profile.sh" instead of ./profile.sh.

Also, I had to comment out the folowing lines in profile.sh

#PYTHONHOME=/opt/python/3.6.5
#export PYTHONHOME

Otherwise, I get the following issue:

Fatal Python error: initfsencoding: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

To sum up the commands are:
1) source profile.sh
2) ./salome_meca-lgpl-2021.0.0-2-20211014-scibian-9 -- shell -- python3 test.py

#18 Code_Aster usage » Running code_aster in the pythonic way - No module named 'code_aster' » 2022-04-22 17:04:29

Matt141
Replies: 3

Hi everyone,

I'd like to run code_aster v15 inside a python script.

Using code-aster.org/UPLOAD/DOC/Formations/20-asterxx-inanutshell.pdf "Development in code_aster"  and code-aster.org/forum2/viewtopic.php?id=26101 "How to use Code-Aster in the "pythonic way"?"

I try to run the simple python script called test.py:

import sys
sys.path.append('/media/my_disk/disk/opt/salome_meca/Salome-V2021-s9/tools/Code_aster_stable-1540/lib/aster/')
import code_aster

I do as follow:
1) I run profile.sh inside /media/my_disk/disk/opt/salome_meca/Salome-V2021-s9/tools/Code_aster_stable-1540/share/aster
2) ./salome_meca-lgpl-2021.0.0-2-20211014-scibian-9 -- shell -- python3 test.py

I get the following error message:

not exist: /etc/krb5.conf
WARNING: Could not find any nv files on this host!
*****************************************************
INFO : Running salome_meca in software rendering mode
*****************************************************
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    import code_aster
ModuleNotFoundError: No module named 'code_aster'
Error raised when executing command: python3 test.py
ERROR:salomeContext:SystemExit 1 in method _runSession.
singularity exit code: 1

Python3 path obtained with "which python" from Singularity is

/opt/python/3.6.5/bin/python

Do you have an idea why the module code_aster is not found ?

#19 Re: Code_Aster usage » [Solved] Extract node group coordinates into a python array » 2022-04-22 10:40:52

Thank you for the answer.

It turned out, in my case, the groupe_no contains all the node of the mesh. So, the following line worked for me.

xyz = np.asarray(MAIL.sdj.COORDO.VALE.get())

#20 Code_Aster usage » [Solved] Extract node group coordinates into a python array » 2022-04-08 15:01:13

Matt141
Replies: 3

Hi,

After having created a node group with

MAIL = DEFI_GROUP(reuse = MAIL,
    MAILLAGE=MAIL,
    CREA_GROUP_NO = _F ( GROUP_MA = 'cavity' , NOM = 'cavity_points' )
)    

and after having extracted all the node values.

MOD_MIC_R=POST_RELEVE_T(ACTION=_F(OPERATION='EXTRACTION',
                                INTITULE='MODU',
                                RESULTAT=RESPHYS,
                                NOM_CHAM='DEPL',
                                GROUP_NO='cavity_points',
                                NOM_CMP='PRES',
                                FORMAT_C='REEL',),);

p_r = MOD_MIC_R.EXTR_TABLE()['PRES']
p_r = list(p_r.values().values())
p_r = np.squeeze(np.asarray(p_r))

filename = './'
np.savez(filename, f=f, p_r=p_r)

I'd like to extract the node coordinates of a node group (not the whole mesh) into a python array to save them in a numpy file to use them in an external python program.

Any tips ?

Regards,
Matt

#21 Re: Code_Aster usage » Convert nodes of a "group of volume" to a "group of node" » 2022-04-07 16:29:08

This is the answer

MAIL = DEFI_GROUP(reuse = MAIL,
    MAILLAGE=MAIL,
    CREA_GROUP_NO = _F ( GROUP_MA = 'cavity' , NOM = 'cavite_points' )
)       

#22 Code_Aster usage » Convert nodes of a "group of volume" to a "group of node" » 2022-04-07 15:08:41

Matt141
Replies: 1

Hi everyone,

I'd like to export all the pressure values calculated on a 3D mesh. This mesh is in a "group of volume".

I am trying to use the command which only work on a group of nodes:

MOD_MIC_R=POST_RELEVE_T(ACTION=_F(OPERATION='EXTRACTION',
                                INTITULE='MODU',
                                RESULTAT=RESPHYS,
                                NOM_CHAM='DEPL',
                                GROUP_NO='cavity',
                                NOM_CMP='PRES',
                                FORMAT_C='REEL',),);

How do I convert the nodes in 'cavity' to a group of node?

Regards,
Matt