command_post.py 2.11 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
103
104
import os,sys,shutil

from pylmgc90.chipy import *
from numpy import *

# plage de fichiers a traiter
min=1
max=21

# nom du repertoire ou on va faire le post
tmp='post'

tmp=os.getcwd()+'/'+tmp+'/'

if os.path.isdir(tmp):
  print "Le repertoire ",tmp," existe deja, ca n'est pas la peine de le creer"
  # on teste la presence de DATBOX
  if os.path.isdir(tmp+'DATBOX'):
    print " on ne copie pas DATBOX"
  else:
    shutil.copytree('./DATBOX',tmp+'DATBOX')
else:
  os.mkdir(tmp)
  shutil.copytree('./DATBOX',tmp+'DATBOX')

overall_SetWorkingDirectory(tmp)

print "C'est partie"

####

checkDirectories()

dt = 5.e-3

freq_display = 1
freq_write = 1

######## etat 0 ###########################

### computation's parameters definition ### 
overall_DIME(2,1)

utilities_logMes('INIT TIME STEPPING')
TimeEvolution_SetTimeStep(dt)
### model reading ###
print 'READ BODIES'
RBDY2_ReadBodies()

print 'READ BEHAVIOURS'
bulk_behav_ReadBehaviours()
tact_behav_ReadBehaviours()

#LOADS
DISKx_LoadTactors()
JONCx_LoadTactors()
RBDY2_LoadBehaviours()

print 'READ INI DOF'
TimeEvolution_ReadIniDof()
RBDY2_ReadIniDof()

print 'READ INI Vloc Rloc'
TimeEvolution_ReadIniVlocRloc()
DKJCx_ReadIniVlocRloc()
DKDKx_ReadIniVlocRloc()

names= ['DOF','Vloc_Rloc']

tacts_dict={}
InitTactorsToVTK(['DISKx','JONCx'],tacts_dict)

inters_dict={}
InitIntersToVTK(['DKDKx','DKJCx'],inters_dict)

fit = startCollection('tacts.pvd')
fii = startCollection('inters.pvd')

for k in xrange(min,max+1,1):
    #
    utilities_logMes('on traite le set : '+str(k))
    #
    for name in names:    
      shutil.copy('./OUTBOX/'+name+'.OUT.'+str(k),tmp+'DATBOX/'+name+'.INI')

    utilities_logMes('READ INI DOF')
    TimeEvolution_ReadIniDof()
    RBDY2_ReadIniDof()

    utilities_logMes('READ INI Vloc Rloc')
    TimeEvolution_ReadIniVlocRloc()
    DKJCx_ReadIniVlocRloc()
    DKDKx_ReadIniVlocRloc()

    utilities_logMes('tact')
    writeTactorsToVTK('./DISPLAY/tacts'+'_'+str(k)+'.vtp',fit,tacts_dict)
    utilities_logMes('inter')
    writeIntersToVTK('./DISPLAY/inters'+'_'+str(k)+'.vtp',fii,inters_dict,1e+0)
    utilities_logMes('---')
  
stopCollection(fit)
stopCollection(fii)