Commit e0fef735 authored by mozul's avatar mozul
Browse files

Squashed 'examples/' changes from 0459b53..a3e112b

a3e112b small fix in Taylor3D mesh example to use mumps
2dec6a7 use new interface or ReadIniDof to write command_post scripts
65dd94d various modif ; add One BARxx example

git-subtree-dir: examples
git-subtree-split: a3e112bc33e04fa2a939134b4925b82a9133c335
parent 7f0ceb89
......@@ -8,38 +8,12 @@ min = 1
max = 30
pas = 2
# fichiers a manipuler
names= ['DOF','Vloc_Rloc']
# space dimension
dim = 2
# un pas de temps bidon ?
dt = 2.e-4
# nom du repertoire ou on va faire le post
tmp='post2'
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'):
# on le vire si il existe
shutil.rmtree(tmp+'DATBOX')
else:
os.mkdir(tmp)
shutil.copytree('./DATBOX',tmp+'DATBOX')
overall_SetWorkingDirectory(tmp)
# on cree les rep manquants de le rep de travail
checkDirectories()
print "C'est partie"
####
######## etat 0 ###########################
......@@ -47,8 +21,8 @@ print "C'est partie"
### computation's parameters definition ###
SetDimension(2,1)
utilities_logMes('INIT TIME STEPPING')
TimeEvolution_SetTimeStep(dt)
#utilities_logMes('INIT TIME STEPPING')
#TimeEvolution_SetTimeStep(dt)
### model reading ###
utilities_logMes('READ BEHAVIOURS')
......@@ -73,16 +47,11 @@ OpenDisplayFiles()
for k in xrange(min,max+1,pas):
#
utilities_logMes('on traite les fichiers : '+str(k))
#
for name in names:
shutil.copy('./OUTBOX/'+name+'.OUT.'+str(k),tmp+'DATBOX/'+name+'.INI')
utilities_logMes('READ INI DOF')
ReadIniDof()
ReadIniDof(k)
utilities_logMes('READ INI Vloc Rloc')
ReadIniVlocRloc()
ReadIniVlocRloc(k)
WriteDisplayFiles(freq=1,ref_radius=0.1e-2)
......
......@@ -9,31 +9,6 @@ max=2
names= ['DOF','GPV']
# 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')
for name in names:
shutil.copy('./DATBOX/'+name+'.INI',tmp+'DATBOX/'+name+'.INI')
overall_SetWorkingDirectory(tmp)
print "C'est partie"
####
checkDirectories()
......@@ -46,7 +21,7 @@ freq_write = 1
######## etat 0 ###########################
### computation's parameters definition ###
overall_DIME(2,1)
SetDimension(2,1)
utilities_logMes('INIT TIME STEPPING')
TimeEvolution_SetTimeStep(dt)
......@@ -73,38 +48,22 @@ mecaMAILx_PushProperties()
models_StoreProperties()
ExternalModels_CheckProperties()
### initial and boundary conditions ###
print 'READ INI DOF'
TimeEvolution_ReadIniDof()
mecaMAILx_ReadIniDof()
TimeEvolution_ReadIniGPV()
mecaMAILx_ReadIniGPV()
fim = startCollection(tmp+'/DISPLAY/mecafe.pvd')
k=0
utilities_logMes('tact')
writeMecafeToVTK(tmp+'/DISPLAY/mecafe'+'_'+str(k)+'.vtu',fim,2)
OpenDisplayFiles()
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()
mecaMAILx_ReadIniDof()
TimeEvolution_ReadIniDof(k)
mecaMAILx_ReadIniDof(k)
TimeEvolution_ReadIniGPV()
mecaMAILx_ReadIniGPV()
TimeEvolution_ReadIniGPV(k)
mecaMAILx_ReadIniGPV(k)
utilities_logMes('tact')
writeMecafeToVTK(tmp+'/DISPLAY/mecafe'+'_'+str(k)+'.vtu',fim,2)
WriteDisplayFiles(1,0.)
stopCollection(fim)
CloseDisplayFiles()
......@@ -101,7 +101,7 @@ mecaMAILx_WriteLastDof()
### parameters setting ###
T0 = 20.
T=[T0]*259
T=[T0]*mecaMAILx_GetNbNodes(1)
mecaMAILx_SetScalarFieldByNode(1,1,T)
timer_StopTimer(idr)
......@@ -131,7 +131,7 @@ for k in xrange(1,nb_steps+1,1):
TimeEvolution_DisplayStep()
T0 = T0+10.
T = [T0]*259
T = [T0]*mecaMAILx_GetNbNodes(1)
mecaMAILx_SetScalarFieldByNode(1,1,T)
utilities_logMes('COMPUTE Fext')
......
import os,sys
import math
from pylmgc90.pre_lmgc import *
if not os.path.isdir('./DATBOX'):
os.mkdir('./DATBOX')
dim = 2
# definition du conteneur de partie ou de pieces, de modeles, de materiaux et de commandes de post-traitement
ps = avatars()
ms = models()
mx = materials()
post = postpro_commands()
# modele utilisateur, hpp
mod = model(name='Q4MLx', type='MECAx', element='Q4xxx', dimension=2,material='elasd',
external_model='yes__', kinematic='small', mass_storage='coher', anisotropy='iso__',
external_fields=['TEMPERATURE'])
ms.addModel(mod)
# Definition des materiaux
acier = material(name='acier', type='ELAS_DILA', density=0., elas='standard', young=0.1e+15, nu=0.2, anisotropy='isotropic',
dilatation=1e-5, T_ref_meca=20. )
mx.addMaterial(acier)
# on genere le maillage de la poutre
beam_mesh=buildMesh2D(type_mesh='Q4', x0=0., y0=0., lx=0.0032, ly=0.0324, nb_elem_x=6, nb_elem_y=36)
# on cosntruit un avatar maille pour la poutre
beam=buildMeshedAvatar(mesh=beam_mesh, model=mod, material=acier)
# Application des conditions aux limites
# * serrage (v_y=0 en haut et en bas)
beam.imposeDrivenDof(group='up', component=2, dofty='vlocy')
beam.imposeDrivenDof(group='down', component=2, dofty='vlocy')
# * blocage de la transaltion suivant x (v_x=0 en un point)
# predicat
def p(x):
return abs(x[0] - 0.0016) < 5.e-4
# creation d'un nouveau groupe
beam.addGroupUsingPredicate(name='amarre', predicate=p, super_group='down')
beam.imposeDrivenDof(group='amarre', component=1, dofty='vlocy')
# Ajout des parties dans le conteneur de parties
ps.addAvatar(beam)
# Ecriture des fichiers pour LMGC
writeBodies(ps,chemin='DATBOX/')
writeModels(ms,chemin='DATBOX/')
writeDrvDof(ps,chemin='DATBOX/')
writeDofIni(ps,chemin='DATBOX/')
writeGPVIni(ps,chemin='DATBOX/')
writeBulkBehav(mx,chemin='DATBOX/', gravy=[0., 0., 0.])
writePostpro(commands=post, parts=ps, path='DATBOX/')
post = postpro_commands()
writePostpro(commands=post, parts=ps, path='DATBOX/')
try:
visuAvatars(ps)
except:
pass
/* Declaration des variables*/
Longueur = 1.0;
L_mesh = 1.0;
/* Declaration de la geometrie */
Point (1) = {0, 0, 0, L_mesh};
Point (2) = {Longueur, 0, 0, L_mesh};
Line(1) = {1, 2};
Physical Line(2) = {1};
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
2
1 0 0 0
2 1 0 0
$EndNodes
$Elements
1
1 1 2 2 1 1 2
$EndElements
from pylmgc90.chipy import *
checkDirectories()
#utilities_DisableLogMes()
####
# info gestion du temps
dt = 1.e-2
theta = 0.50
nb_steps = 500
# bavardage de certaines fonctions
echo = 0
# info generation fichier visu
freq_display = 10
ref_radius = 0.1
freq_write = 10
###
SetDimension(3,0)
### definition des parametres du calcul ###
utilities_logMes('INIT TIME STEPPING')
TimeEvolution_SetTimeStep(dt)
Integrator_InitTheta(theta)
### lecture du modele ###
utilities_logMes('READ BEHAVIOURS')
bulk_behav_ReadBehaviours()
utilities_logMes('READ MODELS')
models_ReadModels()
utilities_logMes('READ BODIES')
MAILx_ReadBodies()
# on dimensionne et on initie la construction des mapping
utilities_logMes('INIT MODELS')
models_InitModels()
ExternalModels_InitModels()
# on charge les choses et on construit les mapping
utilities_logMes('LOADS')
mecaMAILx_LoadModels()
mecaMAILx_LoadBehaviours()
utilities_logMes('PUSH')
mecaMAILx_PushProperties()
# on finalise la construction des mapping
utilities_logMes('STORE')
models_StoreProperties()
utilities_logMes('CHECK')
ExternalModels_CheckProperties()
#
utilities_logMes('READ INI DOF')
TimeEvolution_ReadIniDof()
mecaMAILx_ReadIniDof()
utilities_logMes('READ INI GPV')
TimeEvolution_ReadIniGPV()
mecaMAILx_ReadIniGPV()
#
utilities_logMes('READ DRIVEN DOF')
mecaMAILx_ReadDrivenDof()
### ecriture paranoiaque du modele ###
utilities_logMes('WRITE BODIES')
overall_WriteBodies()
MAILx_WriteBodies()
utilities_logMes('WRITE MODELS')
models_WriteModels()
utilities_logMes('WRITE BEHAVIOURS')
bulk_behav_WriteBehaviours()
utilities_logMes('WRITE DRIVEN DOF')
overall_WriteDrivenDof()
mecaMAILx_WriteDrivenDof()
utilities_logMes('WRITE LAST DOF')
TimeEvolution_WriteLastDof()
mecaMAILx_WriteLastDof()
### post3D ##
OpenDisplayFiles()
#OpenPostproFiles()
A=[1.]
mecaMAILx_SetScalarFieldByElement(1,1,A)
utilities_logMes('COMPUTE MASS')
mecaMAILx_ComputeMass()
for k in xrange(1,nb_steps+1,1):
#
utilities_logMes('INCREMENT STEP')
TimeEvolution_IncrementStep()
mecaMAILx_IncrementStep()
utilities_logMes('DISPLAY TIMES')
TimeEvolution_DisplayStep()
utilities_logMes('COMPUTE Fext')
mecaMAILx_ComputeFext()
utilities_logMes('COMPUTE BULK')
mecaMAILx_ComputeBulk()
utilities_logMes('ASSEMBLAGE')
mecaMAILx_AssembKT()
mecaMAILx_AssembRHS()
utilities_logMes('COMPUTE Free Vlocy')
mecaMAILx_ComputeFreeVelocity()
#
utilities_logMes('COMPUTE DOF, FIELDS, etc.')
mecaMAILx_ComputeDof()
mecaMAILx_ComputeField()
#
utilities_logMes('UPDATE DOF, FIELDS')
TimeEvolution_UpdateStep()
mecaMAILx_UpdateDof()
mecaMAILx_UpdateBulk()
#
utilities_logMes('WRITE out DOF')
TimeEvolution_WriteOutDof(freq_write)
mecaMAILx_WriteOutDof()
#
### post3D ###
WriteDisplayFiles(freq_display,ref_radius)
#WritePostproFiles()
### gestion des writeout ###
overall_CleanWriteOutFlags()
### postpro ###
CloseDisplayFiles()
#ClosePostproFiles()
import os
if not os.path.isdir('./DATBOX'):
os.mkdir('./DATBOX')
# Import python fonction to create LMGC90 model
from pylmgc90.pre_lmgc import *
# ------------------------------------------------------
# To start : Create all pack of components
# Create the pack of bodies
bodies = avatars()
# Create the pack of physical model
mods = models()
# Create the pack of materials behaviours
mats = materials()
# Create the pack of contact visibility
svs = see_tables()
# Create the pack of contact behaviours
tacts = tact_behavs()
# ------------------------------------------------------
# Defined the model dimension of the physical problem
dimension = 3
# ------------------------------------------------------
# Create a thermal model
Model_Meca = model(name='babar', # Key to find the model
type='MECAx', # Type of the model
element='BARxx', # Possible elements S2xth,T3xxx,H8xxx,H20Rx,TE4xx
dimension = dimension,
kinematic = 'large',
formulation='UpdtL',
material='neoh_',
anisotropy='iso__',
external_model='no___',
mass_storage='lump_',
external_fields =['SECTION'])
# And save this model in the pack of physical model
mods.addModel(Model_Meca)
# ------------------------------------------------------
# Create a material
Mat_1 = material(name='Steel',
type='ELAS',
density=7800.0,
elas='standard',
young=210e9,
nu=0.0,
anisotropy='isotropic')
# And save this material in the pack of materials behaviours
mats.addMaterial(Mat_1)
# ------------------------------------------------------
# Import gmsh mesh for LMGC90
Mailx = lecture('MESH/Barre1D.msh', dim=dimension, keep_elements=['S2xxx'])
# Create a geometrical bodies with finite element (RBDY2, RBDY3)
Barre3D = avatar(type='MAILx', dimension = dimension)
# Import element connectivity
Barre3D.addBulks(Mailx.bulks)
# Import node position
Barre3D.addNodes(Mailx.nodes)
# Import physical groups
Barre3D.defineGroups()
# ------------------------------------------------------
# Apply physical model on bodies
Barre3D.defineModel(model=Model_Meca, group = '2')
# Apply material behaviour on physical group 2
Barre3D.defineMaterial(material=Mat_1, group = '2')
# And save this bodies in the pack of bodies
bodies += Barre3D
# ------------------------------------------------------
# Apply the boundary conditions on physical groups
# predicat
def p1(x):
return (abs(x[0]) < 5.e-4) and (abs(x[1]) < 5.e-4) and (abs(x[2]) < 5.e-4)
# creation d'un nouveau groupe
Barre3D.addGroupUsingPredicate(name='N1', predicate=p1)
Barre3D.imposeDrivenDof(group='N1', component = [1,2,3], dofty='vlocy')
# Write all files to compute solution with LMGC90
writeBodies(bodies, chemin='./DATBOX/')
writeDofIni(bodies, chemin='./DATBOX/')
writeDrvDof(bodies, chemin='./DATBOX/')
writeModels(mods,chemin='./DATBOX/')
writeGPVIni(bodies, chemin='./DATBOX/')
writeBulkBehav(mats, chemin='./DATBOX/', dim=dimension, gravy=[0., 0., -9.81])
try:
visuAvatars(bodies)
except:
pass
......@@ -31,6 +31,8 @@ NewtonRaphson_SetIncPatience(999999)
# Initialize theta integrator
Integrator_InitTheta(0.56E0)
mecaMAILx_SparseStorage()
### model reading ###
utilities_logMes('READ BODIES')
MAILx_ReadBodies()
......@@ -173,3 +175,4 @@ MAILx_WriteLastGPV()
CloseDisplayFiles()
### postpro ###
#ClosePostproFiles()
Finalize()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment