command.py 3.76 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
import os,sys

# importing chipy module
from pylmgc90.chipy import *

# Initializing
Initialize()

# checking/creating mandatory subfolders
checkDirectories()

# logMes
# utilities_DisableLogMes()

#
# defining some variables
#

# space dimension
dim = 3
# modeling hypothesis ( 1 = plain strain, 2 = plain stress, 3 = axi-symmetry)
mhyp = 1

# time evolution parameters
dt = 1e-3
nb_steps = 1

# theta integrator parameter
theta = 0.5

# deformable  yes=1, no=0
deformable = 0

POLYR_SkipAutomaticReorientation()
POLYR_FlatnessAngle(10.)
POLYR_TopologyAngle(3.)

PRPRx_ShrinkPolyrFaces(1e-3)
#PRPRx_UseCpF2fExplicitDetection(1e-1)
PRPRx_UseNcF2fExplicitDetection(5e-1,1e-1)
PRPRx_LowSizeArrayPolyr(100)

# interaction parameters
freq_detect = 1
Rloc_tol = 5.e-2

# nlgs parameters
tol = 0.1666e-3
relax = 0.3
norm = 'Quad '
gs_it1 = 1000
gs_it2 = 500
53
type='Stored_Delassus_Loop          '
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

nlgs_3D_DiagonalResolution()

macro=1

# write parameter
freq_write   = 10

# display parameters
freq_display = 1
ref_radius = 2.5e-2

#
# read and load
#

# Set space dimension
SetDimension(dim,mhyp)
#
utilities_logMes('INIT TIME STEPPING')
TimeEvolution_SetTimeStep(dt)
Integrator_InitTheta(theta)
#
utilities_logMes('READ BEHAVIOURS')
ReadBehaviours()
if deformable: ReadModels()
#
utilities_logMes('READ BODIES')
ReadBodies()
#
utilities_logMes('LOAD BEHAVIOURS')
LoadBehaviours()
if deformable: LoadModels()
#
utilities_logMes('READ INI DOF')
ReadIniDof()
#
if deformable:
  utilities_logMes('READ INI GPV')
  ReadIniGPV()
#
utilities_logMes('READ DRIVEN DOF')
ReadDrivenDof()
#
utilities_logMes('LOAD TACTORS')
LoadTactors()
#
utilities_logMes('READ INI Vloc Rloc')
ReadIniVlocRloc()

#
# paranoid writes
#
utilities_logMes('WRITE BODIES')
WriteBodies()
utilities_logMes('WRITE BEHAVIOURS')
WriteBehaviours()
utilities_logMes('WRITE DRIVEN DOF')
WriteDrivenDof()

#
# open display & postpro
#

utilities_logMes('DISPLAY & WRITE')
OpenDisplayFiles()
#OpenPostproFiles()

### compute masses ###
utilities_logMes('COMPUTE MASS')
RBDY3_ComputeMass()

for k in xrange(1,nb_steps+1,1):
    #
    utilities_logMes('itere : '+str(k))
    #
    utilities_logMes('INCREMENT STEP')
    TimeEvolution_IncrementStep()
    RBDY3_IncrementStep()
    #
    utilities_logMes('COMPUTE Fext')
    RBDY3_ComputeFext()
    #
    utilities_logMes('COMPUTE Fint')
    RBDY3_ComputeBulk()
    # 
    utilities_logMes('COMPUTE Free Vlocy')
    RBDY3_ComputeFreeVelocity()
    #
    utilities_logMes('SELECT PROX TACTORS')
    overall_SelectProxTactors(freq_detect)
    PRPRx_SelectProxTactors()
    
    PRPRx_RecupRloc()

    if macro :

      print 'macro'
      #nlgs_3D_ExSolver(type, norm, tol, relax, gs_it1, gs_it2)

    else:

      print 'flat'
      nlgs_3D_SetCheckType(norm, tol, relax)
      nlgs_3D_ExPrep(type)

      for i_block_iter in xrange(1,gs_it2+1):
         nlgs_3D_QuickScrambleContactOrder()
         nlgs_3D_ExIter(gs_it1)
         iconv = nlgs_3D_AfterIterCheck()
         nlgs_3D_DisplayAfterIterCheck()
         if (i_block_iter < 2): 
           nlgs_3D_SetCheckType(norm, tol, 1.0)                    
         else:
           if (iconv == 0): break

      utilities_logMes('it block gs: '+str(i_block_iter))
      nlgs_3D_ExPost()
      nlgs_3D_UpdateTactBehav()

    PRPRx_StockRloc()
    #
    utilities_logMes('COMPUTE DOF')
    RBDY3_ComputeDof()
    #
    ### postpro ###
    #WritePostproFiles()
    #
    utilities_logMes('UPDATE DOF')
    TimeEvolution_UpdateStep()
    RBDY3_UpdateDof()

    ### display ###

    WriteDisplayFiles(freq_display)
    if k % freq_display == 0:
      PRPRx_VisavisVTKDrawAll()

    WriteOutDof(freq_write)

    WriteOutVlocRloc(freq_write)

    ### writeout handling ###
    overall_CleanWriteOutFlags()

#
# close display & postpro
#
CloseDisplayFiles()
#ClosePostproFiles()

# this is the end
Finalize()