command_jacobi.py 6.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

from pylmgc90.chipy import *
from numpy import *
####
# info gestion du temps
dt = 1.e-2
theta = 0.5
nstep = 100

# bavardage de certaines fonctions
echo = 0

# info generation fichier visu
freq_display = 1
freq_write = 1
ref_radius = 5.e-2

# info contact
freq_detect = 1

#       123456789012345678901234567890
22
type = 'Stored_Delassus_Loop          '
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 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 181 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 212 213 214 215 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 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
#type = 'Exchange_Local_Global         '
quad = 'QM/16'
tol = 0.1666e-5

#1./48 = 0.0208
relax = 0.01

# 1/144 = 0.006
#relax = 0.005 

gs_it1 = 2000
gs_it2 = 10

#nlgs_3D_SetWithQuickScramble()
nlgs_3D_DiagonalResolution()

###
checkDirectories()
###
SetDimension(3,0)

utilities_logMes('INIT TIME STEPPING')
TimeEvolution_SetTimeStep(dt)
Integrator_InitTheta(theta)
Integrator_SetContactDetectionConfiguration(1.-theta,0.)

### lecture du modele ###
utilities_logMes('READ BODIES')
MAILx_ReadBodies()
RBDY3_ReadBodies()

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

utilities_logMes('READ MODELS')
models_ReadModels()

utilities_logMes('INIT MODELS')
# on dimensionne et on initie la construction des mapping
models_InitModels()
ExternalModels_InitModels()

utilities_logMes('LOADS')
# on charge les choses et on construit les mapping
mecaMAILx_LoadModels()
mecaMAILx_LoadBehaviours()
RBDY3_LoadBehaviours()

utilities_logMes('PUSH')
mecaMAILx_PushProperties()
#
utilities_logMes('STORE')
# on finalise la construction des mapping
models_StoreProperties()

utilities_logMes('CHECK')
ExternalModels_CheckProperties()

#
POLYR_LoadTactors()
CSxxx_LoadTactors()

#
utilities_logMes('READ INI DOF')
TimeEvolution_ReadIniDof()
mecaMAILx_ReadIniDof()
RBDY3_ReadIniDof()

utilities_logMes('READ INI GPV')
TimeEvolution_ReadIniGPV()
mecaMAILx_ReadIniGPV()

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

#
utilities_logMes('READ DRIVEN DOF')
mecaMAILx_ReadDrivenDof()
RBDY3_ReadDrivenDof()

### ecriture paranoiaque du modele ###
utilities_logMes('WRITE BODIES')
overall_WriteBodies()
MAILx_WriteBodies()
RBDY3_WriteBodies()

utilities_logMes('WRITE MODELS')
models_WriteModels()

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

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

utilities_logMes('WRITE DOF')
TimeEvolution_WriteLastDof()
mecaMAILx_WriteLastDof()
RBDY3_WriteLastDof()

utilities_logMes('WRITE Vloc_Rloc')
TimeEvolution_WriteLastVlocRloc()

CSPRx_WriteLastVlocRloc()

### definition des parametres du calcul ### 

### post3D ##
OpenDisplayFiles()
OpenPostproFiles()

### parameters setting ###

utilities_logMes('COMPUTE MASS')
mecaMAILx_ComputeMass()
RBDY3_ComputeMass()

utilities_logMes('COMPUTE STIFFNESS')
mecaMAILx_ComputeBulk()
mecaMAILx_ComputeRayleighDamping(0.07,0.07)

####
mecaMAILx_SetPreconAllBodies()
CSxxx_PushPreconNodes()
mecaMAILx_ComputePreconW()

mecaMAILx_AssembKT()

for k in xrange(1,nstep+1,1):
   #
   utilities_logMes('increment : '+str(k))
   #
   utilities_logMes('INCREMENT STEP')
   TimeEvolution_IncrementStep()
   mecaMAILx_IncrementStep()
   RBDY3_IncrementStep()
   
   utilities_logMes('DISPLAY TIMES')
   TimeEvolution_DisplayStep()

   mecaMAILx_ComputeContactDetectionConfiguration()
   RBDY3_ComputeContactDetectionConfiguration()

   utilities_logMes('SELECT PROX TACTORS')

   overall_SelectProxTactors(freq_detect)
   CSPRx_SelectProxTactors()

   utilities_logMes('COMPUTE Fext')
   mecaMAILx_ComputeFext()
   RBDY3_ComputeFext()

   CSpxx_ApplyPressure(2,1e+6)

   vector = mecaMAILx_GetBodyVector('Fext_', 1)
   vector.shape=[125,3]

   #utilities_logMes('Pression appliquee')
   #i=1
   #for fx,fy,fz in vector:
   #   if i > 100: 
   #     s=str(i)+' '+str(fx)+' '+str(fy) +' '+str(fz)
   #     utilities_logMes(s)
   #   i+=1

   utilities_logMes('COMPUTE Fint')
   mecaMAILx_ComputeBulk()
   RBDY3_ComputeBulk()

   utilities_logMes('ASSEMBLAGE')
   mecaMAILx_AssembRHS()

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

   utilities_logMes('RESOLUTION') 

   nlgs_3D_SetCheckType(quad, tol, relax)
   nlgs_3D_ExPrep(type)

   for i_block_iter in xrange(1,gs_it2+1):
      utilities_logMes('it block gs: '+str(i_block_iter))
      #nlgs_QuickScrambleContactOrder()
      if (i_block_iter == 1):
        nlgs_3D_ExIterJacobi(2*gs_it1)
        iconv = nlgs_3D_AfterIterCheckJacobi()
        nlgs_3D_DisplayAfterIterCheck()
      else :   
        nlgs_3D_ExIterJacobi(gs_it1)
        iconv = nlgs_3D_AfterIterCheckJacobi()
        nlgs_3D_DisplayAfterIterCheck()
        if (iconv == 0): break

   nlgs_3D_ExPostJacobi()

   nlgs_3D_UpdateTactBehav()
   CSPRx_StockRloc()
   #
   utilities_logMes('COMPUTE DOF, FIELDS, etc.')
   mecaMAILx_ComputeDof()
   RBDY3_ComputeDof()

   vector = mecaMAILx_GetBodyVector('Reac_', 1)
   vector.shape=[125,3]
   coor = mecaMAILx_GetBodyVector('Coor_', 1)
   coor.shape=[125,3]

   utilities_logMes('reaction nodale obtenue')
   i=1
   for fx,fy,fz in vector:
      if i > 25: break
      s=str(i)+' '+str(fx)+' '+str(fy)+' '+str(fz)+' '+str(coor[i-1,2])
      utilities_logMes(s)
      i+=1

   # on initialise raux
   mecaMAILx_NullifyReac('Raux_',1)

   nb_CSPRx = CSPRx_GetNbCSPRx()
   utilities_logMes('nb CSPRx= '+str(nb_CSPRx))
   all = CSPRx_GetAll()
   for i in xrange(nb_CSPRx):
      info = CSPRx_GetInfo(i+1)
      icsxxx= int(info[2])

      #print icsxxx

      # r = fn n + ft t
      r = (all[i,3]*all[i,4:7]) + (all[i,7]*all[i,8:11])

      #print r

      #utilities_logMes(str(info[0])+' '+str(info[2]))
      #utilities_logMes('rn('+str(i)+')= '+str(all[i,3]))

      CSxxx_AddReac('Raux_',icsxxx,r) 

   vector = mecaMAILx_GetBodyVector('Raux_', 1)
   vector.shape=[125,3]

   utilities_logMes('reaction auxiliaire obtenue avec re integration')
   i=1
   for fx,fy,fz in vector:
      if i > 25: break
      s=str(i)+' '+str(fx)+' '+str(fy)+' '+str(fz)
      utilities_logMes(s)
      i+=1

   #
   utilities_logMes('UPDATE DOF, FIELDS')
282
   mecaMAILx_ComputeField()
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
   TimeEvolution_UpdateStep()
   mecaMAILx_UpdateDof()
   mecaMAILx_UpdateBulk()
   RBDY3_UpdateDof()
   #
   utilities_logMes('WRITE LAST DOF')
   TimeEvolution_WriteOutDof(freq_write)
   mecaMAILx_WriteOutDof()
   RBDY3_WriteOutDof(-1,100000)
   #
   utilities_logMes('WRITE Vloc_Rloc')
   TimeEvolution_WriteOutVlocRloc(freq_write)
   CSPRx_WriteOutVlocRloc()

   ### post3D ###
   WriteDisplayFiles(freq_display,ref_radius)
   WritePostproFiles()

   ### gestion des writeout ###
   overall_CleanWriteOutFlags()

### postpro ###
CloseDisplayFiles()
ClosePostproFiles()