command.py 4.61 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
import sys

from pylmgc90.chipy import *

checkDirectories()

#utilities_DisableLogMes()

# Time discretization:
dt = 5.e-3
t_final = 1.

# Initialize theta integrator
theta = 0.5

# info ecriture fichier de sortie
freq_write = 5

# info contact
freq_detect = 1

#       123456789012345678901234567890
23
type = 'Stored_Delassus_Loop          '
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 103 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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
norm = 'Quad '
tol = 0.1666E-05
relax = 0.1
gs_it1 = 200
gs_it2 = 50

# 2D PSTRAIN
overall_DIME(2, 1)

nlgs_SetWithQuickScramble()

# Newton loop parameters:
NR_tol=1e-6
NewtonRaphson_SetFinalTime(t_final)
NewtonRaphson_SetMinTimeStep(dt)
NewtonRaphson_SetMaxTimeStep(dt)
NewtonRaphson_SetMaxIter(20)
NewtonRaphson_SetIncPatience(999999)

NewtonRaphson_CheckConvergence(NR_tol)

TimeEvolution_SetTimeStep(dt)
Integrator_InitTheta(theta)
Integrator_SetContactDetectionConfiguration(1.-theta,0.)
#Integrator_SetContactDetectionConfiguration(theta*(1.-theta),theta*theta)
### model reading ###
utilities_logMes('READ BODIES')
MAILx_ReadBodies()

utilities_logMes('READ MODELS')
models_ReadModels()

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

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

#LOADS
mecaMAILx_LoadModels()
ALpxx_LoadTactors()
CLxxx_LoadTactors()

mecaMAILx_LoadBehaviours()

mecaMAILx_PushProperties()
models_StoreProperties()
ExternalModels_CheckProperties()

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

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

TimeEvolution_ReadIniGPV()
mecaMAILx_ReadIniGPV()

utilities_logMes('READ DRIVEN DOF')
mecaMAILx_ReadDrivenDof()

### paranoiac writing ###

utilities_logMes('WRITE BODIES')
overall_WriteBodies()
MAILx_WriteBodies()

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

utilities_logMes('WRITE MODELS')
models_WriteModels()

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

### postpro ###
postpro_PostproBeforeComputation()

CLxxx_SetNbNodesByCLxxx(2)

### initializing box detection algorithm ###
#CLALp_SetNonSymetricDetection()

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
   NewtonRaphson_Initialize(NR_tol)
   is_converged = 1
   k=0
   while is_converged == 1 : #looping until something changes in CheckNlConvergence

      k+=1
            
      #utilities_logMes('COMPUTE (gd) NL BULK')
      mecaMAILx_ComputeBulk()
      #mecaMAILx_ComputeRayleighDamping(0.05,0.05)      

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

      #utilities_logMes('COMPUTE Free Vlocy')
      mecaMAILx_ComputeFreeVelocity()
      #
      #utilities_logMes('SELECT PROX TACTORS')
      mecaMAILx_ComputeContactDetectionConfiguration()
      overall_SelectProxTactors(freq_detect)
      CLALp_SelectProxTactors()
      #
      ### Signorini Coulomb
      CLALp_RecupRloc()
      nlgs_ExSolver(type, norm, tol, relax, gs_it1, gs_it2)
      CLALp_StockRloc()
      ###

      #utilities_logMes('COMPUTE DOF')
      mecaMAILx_ComputeDof()
      #
      if k > 1:
        NR_norm = mecaMAILx_ComputeResidueNorm()
        is_converged = NewtonRaphson_CheckConvergence(NR_norm)

   ### end while

   #utilities_logMes('COMPUTE TIME STEP')
   istate = NewtonRaphson_ComputeTimeStep()
   if not istate == 1 :

     #utilities_logMes('UPDATE TACT BEHAV')
     nlgs_UpdateTactBehav()
     CLALp_StockRloc()
     ### postpro ###
     postpro_PostproDuringComputation()
     #utilities_logMes('UPDATE DOF')
181
     mecaMAILx_ComputeField()
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
     TimeEvolution_UpdateStep()
     mecaMAILx_UpdateDof()
     mecaMAILx_UpdateBulk()
     #
     ### write results ###
     #utilities_logMes('WRITE LAST DOF')
     TimeEvolution_WriteOutDof(freq_write)
     mecaMAILx_WriteOutDof()
     #
     #utilities_logMes('WRITE LAST Vloc Rloc')
     TimeEvolution_WriteOutVlocRloc(freq_write)
     CLALp_WriteOutVlocRloc()
     #
     #utilities_logMes('WRITE LAST GPV')
     TimeEvolution_WriteOutGPV(freq_write)
     MAILx_WriteOutGPV()
     #
     ### writeout handling ###
     overall_CleanWriteOutFlags()

   if istate == 2 :
     # istate => Stop
     break

### end of time loop ###

### write results ###

### postpro ###
postpro_ClosePostproFiles()