command.py 3.64 KB
Newer Older
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import numpy
import os,sys

from pylmgc90.chipy import *

checkDirectories()

timer_InitializeTimers()
overall_Initialize()

#utilities_DisableLogMes()

# Time discretization:
dt = 1.e-7

theta=0.56

# driving time subdivision scheme
dt_max=1e-8
dt_min=1e-7
t_final = 2.e-4

# driving Newton Raphson
nb_NR_iter_max = 20
tol_NR=1e-10

freq_display = 10
ref_size=2.e-5
freq_write = 10

################################
checkDirectories()
################################
# 2D AXISym
SetDimension(dim=2,mod=3)

TimeEvolution_SetTimeStep(dt)

# Newton loop parameters:
NewtonRaphson_SetFinalTime(t_final)
NewtonRaphson_SetMinTimeStep(dt)
NewtonRaphson_SetMaxTimeStep(dt)
NewtonRaphson_SetMaxIter(nb_NR_iter_max)
NewtonRaphson_SetIncPatience(999999)

# Initialize theta integrator
Integrator_InitTheta(theta)

### model reading ###
utilities_logMes('READ MODELS')
models_ReadModels()

utilities_logMes('READ BEHAVIOURS')
bulk_behav_ReadBehaviours()

utilities_logMes('READ BODIES')
MAILx_ReadBodies()

### models initialization ###
utilities_logMes('INIT MODELS')
models_InitModels()
ExternalModels_InitModels()

mecaMAILx_LoadModels()

mecaMAILx_LoadBehaviours()

mecaMAILx_PushProperties()
models_StoreProperties()
ExternalModels_CheckProperties()

### initial and boundary conditions ###
utilities_logMes('READ INI DOF')
TimeEvolution_ReadIniDof()
mecaMAILx_ReadIniDof()

TimeEvolution_ReadIniGPV()
mecaMAILx_ReadIniGPV()

utilities_logMes('READ DRIVEN DOF')
mecaMAILx_ReadDrivenDof()

### paranoide model writing ###
utilities_logMes('WRITE BODIES')
overall_WriteBodies()
MAILx_WriteBodies()

utilities_logMes('WRITE MODELS')
models_WriteModels()

utilities_logMes('WRITE BEHAVIOURS')
bulk_behav_WriteBehaviours()

TimeEvolution_WriteLastDof()
mecaMAILx_WriteLastDof()

utilities_logMes('WRITE DRIVEN DOF')
overall_WriteDrivenDof()
mecaMAILx_WriteDrivenDof()

utilities_logMes('INIT VISU ET POSTPRO')
OpenDisplayFiles()
103
#OpenPostproFiles()
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

utilities_logMes('COMPUTE MASS')
mecaMAILx_ComputeMass()

while TimeEvolution_GetTime() < t_final :
   #
   #utilities_logMes('INCREMENT STEP')
   TimeEvolution_IncrementStep()
   mecaMAILx_IncrementStep()

   #utilities_logMes('DISPLAY TIMES')
   TimeEvolution_DisplayStep()

   #utilities_logMes('COMPUTE Fext')
   mecaMAILx_ComputeFext()

   # Newton loop
   #looping until something changes in CheckNlConvergence
   NewtonRaphson_Initialize(tol_NR)
   k=0
   is_converged = 1
   while is_converged == 1 : 
            
      k+=1

      #utilities_logMes('COMPUTE (gd) NL BULK')
      mecaMAILx_ComputeBulk()

      #utilities_logMes('ASSEMB NL RHS/KT')
      mecaMAILx_AssembRHS()
      mecaMAILx_AssembKT()

      #utilities_logMes('COMPUTE Free Vlocy')
      mecaMAILx_ComputeFreeVelocity()

      #utilities_logMes('COMPUTE DOF')
      mecaMAILx_ComputeDof()
      #
      if k > 1 :
        norm = mecaMAILx_ComputeResidueNorm()
        ### 0=cv  2=dv
        is_converged = NewtonRaphson_CheckConvergence(norm)

   ### end while

   #utilities_logMes('COMPUTE TIME STEP')
   ### istate = 1 redo, istate = 2 stop 
   istate = NewtonRaphson_ComputeTimeStep()

   if not istate == 1 :

155
156
     mecaMAILx_ComputeField()

157
158
159
160
161
162
163
164
165
166
167
168
     #utilities_logMes('UPDATE DOF')
     TimeEvolution_UpdateStep()
     mecaMAILx_UpdateDof()
     mecaMAILx_UpdateBulk()
     #
     TimeEvolution_WriteOutDof(freq_write)
     mecaMAILx_WriteOutDof()

     TimeEvolution_WriteOutGPV(freq_write)
     MAILx_WriteOutGPV()

     WriteDisplayFiles(freq=freq_display,ref_radius=ref_size)
169
     #WritePostproFiles()
170
171
172
173
174
175
176
177
178

     overall_CleanWriteOutFlags()

     if istate == 2 :
       break
### end of time loop ###

### visu & postpro ###
CloseDisplayFiles()
179
#ClosePostproFiles()
180
181
182

overall_Finalize()
timer_WriteOutTimers()