-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSectionAuto.comm
62 lines (56 loc) · 3.06 KB
/
SectionAuto.comm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
DEBUT(PAR_LOT='NON'); # Setting to use python
###### ######## ######## ## ## ########
## ## ## ## ## ## ## ##
## ## ## ## ## ## ##
###### ###### ## ## ## ########
## ## ## ## ## ##
## ## ## ## ## ## ##
###### ######## ## ####### ##
import numpy as np
import os
WORKING_DIR='/media/Calculs/aster-calc-section/' # Working directory
OUTPUT_FILE='SectionAuto.output' # Filename of the output file
fileOutput = WORKING_DIR + OUTPUT_FILE # Define output file
## ## ######## ###### ## ##
### ### ## ## ## ## ##
#### #### ## ## ## ##
## ### ## ###### ###### #########
## ## ## ## ## ##
## ## ## ## ## ## ##
## ## ######## ###### ## ##
mesh=LIRE_MAILLAGE(UNITE=20,
INFO_MED=1,
INFO=1,
FORMAT='MED',);
###### ### ## ###### ## ## ##
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ##
## ######### ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
###### ## ## ######## ###### ####### ########
section=MACR_CARA_POUTRE(MAILLAGE=mesh,
GROUP_MA_BORD='MyBorder',
GROUP_NO='MyPoint',
INFO=1,
ORIG_INER=(0,0),
);
######## ## ## ######## ####### ######## ########
## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ##
###### ### ######## ## ## ######## ##
## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ##
######## ## ## ## ####### ## ## ##
f = open(fileOutput,"a") # Open output file
sect = section.EXTR_TABLE() # Extract aster object
# Processing of the results
output='%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f'
nameOutput=[('A_M',float),('CDG_Y_M',float),('CDG_Z_M',float),('IY_G_M',float),('IZ_G_M',float),('IYZ_G_M',float),('A',float),('CDG_Y',float),('CDG_Z',float),('IY_G',float),('IZ_G',float),('IYZ_G',float),('IY',float),('IZ',float),('ALPHA',float),('Y_MAX',float),('Y_MIN',float),('Z_MAX',float),('Z_MIN',float),('R_MAX',float),('RY',float),('RZ',float),('Y_P',float),('Z_P',float),('IY_P',float),('IZ_P',float),('IYZ_P',float),('IYR2_G',float),('IZR2_G',float),('IYR2',float),('IZR2',float),('IYR2_P',float),('IZR2_P',float),('JX',float),('RT',float),('PCTY',float),('PCTZ',float),('EY',float),('EZ',float),('JG',float),('AY',float),('AZ',float)]
n=len(sect.values()[nameOutput[0][0]])
dataOutput = np.zeros(n,dtype=nameOutput)
for str in [y[0] for y in nameOutput]:
dataOutput[str] = sect.values()[str]
np.savetxt(f,dataOutput,fmt=output,comments='') # Write results in output file
f.close() # Close output file
FIN();