command.py 5.73 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

from pylmgc90.chipy import *

checkDirectories()

utilities_DisableLogMes()

# Time discretization:
dt = 1.E-5
#t_final = 0.1E0
t_final = 1.E-03
TimeEvolution_SetTimeStep(dt)
NewtonRaphson_SetFinalTime(t_final)
NewtonRaphson_SetMinTimeStep(dt)
NewtonRaphson_SetMaxTimeStep(dt)
16
NR_tol = 1.e-3
17 18 19 20 21 22 23 24 25 26

# Newton loop parameters:
NewtonRaphson_SetMaxIter(20)
NewtonRaphson_SetIncPatience(999999)

# Initialize theta integrator
Integrator_InitTheta(0.5E0)

# info generation fichier visu
freq_display = 10
27
ref_radius   = 1.
28 29 30 31 32 33 34 35

# info generation fichier de sortie
freq_write = 10

# info contact
freq_detect = 1

#       123456789012345678901234567890
36
type = 'Stored_Delassus_Loop          '
37 38
ntype='Quad '
tol  = 0.1666E-04
39 40 41 42 43
relax = 1.E0
gs_it1 = 101
gs_it2 = 201

# 2D PSTRAIN
44
SetDimension(2,1)
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

nlgs_SetWithQuickScramble()

### model reading ###
utilities_logMes('READ BODIES')
MAILx_ReadBodies()
RBDY2_ReadBodies()

utilities_logMes('READ MODELS')
models_ReadModels()

utilities_logMes('READ BEHAVIOURS')
bulk_behav_ReadBehaviours()
tact_behav_ReadBehaviours()

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

utilities_logMes('WRITE MODELS')
models_WriteModels()

utilities_logMes('WRITE BEHAVIOURS')
bulk_behav_WriteBehaviours()
tact_behav_WriteBehaviours()

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

# load the model
mecaMAILx_LoadModels()

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

#LOADS
ALpxx_LoadTactors()
CLxxx_LoadTactors()
JONCx_LoadTactors()

mecaMAILx_LoadBehaviours()
RBDY2_LoadBehaviours()

mecaMAILx_PushProperties()
models_StoreProperties()
ExternalModels_CheckProperties()

utilities_logMes('READ INI Vloc Rloc')
TimeEvolution_ReadIniVlocRloc()
CLALp_ReadIniVlocRloc()
CLJCx_ReadIniVlocRloc()

TimeEvolution_ReadIniGPV()
mecaMAILx_ReadIniGPV()

TimeEvolution_WriteLastDof()
mecaMAILx_WriteLastDof()
RBDY2_WriteLastDof()

utilities_logMes('READ DRIVEN DOF')
mecaMAILx_ReadDrivenDof()
RBDY2_ReadDrivenDof()

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


### post2D ##
121 122
OpenDisplayFiles()
WriteDisplayFiles(1,ref_radius)
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

### postpro ###

CLxxx_SetNbNodesByCLxxx(1)

CLALp_SetNonSymetricDetection()

utilities_logMes('COMPUTE MASS')
mecaMAILx_ComputeMass()
RBDY2_ComputeMass()

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

   #utilities_logMes('DISPLAY TIMES')
   TimeEvolution_DisplayStep()

   #utilities_logMes('COMPUTE Fext')
   mecaMAILx_ComputeFext()
   RBDY2_ComputeFext()

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

151 152
   NewtonRaphson_Initialize(NR_tol)
   k=0
153
   is_converged = 1
154
   # Newton loop
155 156
   while is_converged == 1 : #looping until something changes in CheckNlConvergence
            
157
      k+=1
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
      #utilities_logMes('COMPUTE (gd) NL BULK')
      mecaMAILx_ComputeBulk()
      
      #utilities_logMes('COMPUTE Fint')
      RBDY2_ComputeBulk()

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

      #utilities_logMes('COMPUTE Free Vlocy')
      mecaMAILx_ComputeFreeVelocity()
      #
      #utilities_logMes('SELECT PROX TACTORS')
      overall_SelectProxTactors(freq_detect)
      CLALp_SelectProxTactors()
      CLJCx_SelectProxTactors()
      #
      ### Signorini Coulomb
      CLALp_RecupRloc()
      CLJCx_RecupRloc()
179
      nlgs_ExSolver(type, ntype, tol, relax, gs_it1, gs_it2)
180 181 182 183 184 185 186
      CLALp_StockRloc()
      CLJCx_StockRloc()
      ###

      #utilities_logMes('COMPUTE DOF')
      mecaMAILx_ComputeDof()
      #
187 188 189 190
      if k > 1:
        norm = mecaMAILx_ComputeResidueNorm()
        is_converged = NewtonRaphson_CheckConvergence(norm) 

191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
      if is_converged == 0 or is_converged == 2 :
        break

   ### end while

   #utilities_logMes('COMPUTE DOF')
   RBDY2_ComputeDof()

   #utilities_logMes('COMPUTE TIME STEP')
   istate = NewtonRaphson_ComputeTimeStep()
   if istate == 1 :
     # istate => Redo Step
     continue
   elif istate == 2 :
     # istate => Stop
     break

   #utilities_logMes('UPDATE TACT BEHAV')
   nlgs_UpdateTactBehav()
   CLALp_StockRloc()
   CLJCx_StockRloc()

   #utilities_logMes('UPDATE DOF')
   TimeEvolution_UpdateStep()
215
   mecaMAILx_ComputeField()
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
   mecaMAILx_UpdateDof()
   mecaMAILx_UpdateBulk()
   RBDY2_UpdateDof()
   #
   ### write results ###
   #utilities_logMes('WRITE LAST DOF')
   TimeEvolution_WriteLastDof()
   mecaMAILx_WriteLastDof()
   RBDY2_WriteLastDof()
   #
   #utilities_logMes('WRITE LAST Vloc Rloc')
   TimeEvolution_WriteLastVlocRloc()
   CLALp_WriteLastVlocRloc()
   CLJCx_WriteLastVlocRloc()
   #
   #utilities_logMes('WRITE LAST GPV')
   TimeEvolution_WriteLastGPV()
   MAILx_WriteLastGPV()

   ### post2D ###
   TimeEvolution_WriteOutDof(freq_write)
   mecaMAILx_WriteOutDof()
   TimeEvolution_WriteOutVlocRloc(freq_write)
   CLALp_WriteOutVlocRloc()
   CLJCx_WriteOutVlocRloc()
   TimeEvolution_WriteOutRnod(freq_write)
   mecaMAILx_WriteOutRnod()
   #
244
   WriteDisplayFiles(freq_display,ref_radius)
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
   ### postpro ###
   #postpro_PostproDuringComputation()
   ### writeout handling ###
   overall_CleanWriteOutFlags()

### end of time loop ###

### write results ###
utilities_logMes('WRITE LAST DOF')
TimeEvolution_WriteLastDof()
mecaMAILx_WriteLastDof()
RBDY2_WriteLastDof()
#
utilities_logMes('WRITE LAST Vloc Rloc')
TimeEvolution_WriteLastVlocRloc()
CLALp_WriteLastVlocRloc()
CLJCx_WriteLastVlocRloc()
#
utilities_logMes('WRITE LAST GPV')
TimeEvolution_WriteLastGPV()
MAILx_WriteLastGPV()

267
CloseDisplayFiles()
268 269
### postpro ###
#postpro_ClosePostproFiles()