jeanpierreaubry
To facilitate the communication, I am sharing the codes below (dump.py of salome, *.comm and *.export from code_Aster).
In salome, save the mesh as "assembly.med" to be run in code_aster. Polishing the code, the issue is between 5 and 6 cycles on this simplified case study (line 24 in the *.comm).
Code salome (save the mesh as "assembly.med" to be run in code_aster, see *.export):
`
#!/usr/bin/env python
###
This file is generated automatically by SALOME v9.13.0 with dump python functionality
###
import sys
import salome
salome.salome_init()
import salome_notebook
notebook = salome_notebook.NoteBook()
sys.path.insert(0, r'/home/students/Documents/scolungag/comm')
###
GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New()
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
Vertex_1 = geompy.MakeVertex(0, 0, 0)
Vector_1 = geompy.MakeVectorDXDYDZ(0, 0, 0.001)
Plane_1 = geompy.MakePlane(Vertex_1, Vector_1, 0.0015)
Disk_1 = geompy.MakeDiskR(0.0005, 1)
Cut_1 = geompy.MakeCutList(Plane_1, [Disk_1], True)
Partition_1 = geompy.MakePartition([Disk_1, Cut_1], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
plastic = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(plastic, [6])
Cu = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(Cu, [2])
load = geompy.CreateGroup(Partition_1, geompy.ShapeType["EDGE"])
geompy.UnionIDs(load, [13])
DX0 = geompy.CreateGroup(Partition_1, geompy.ShapeType["EDGE"])
geompy.UnionIDs(DX0, [15, 8])
ground = geompy.CreateGroup(Partition_1, geompy.ShapeType["EDGE"])
geompy.UnionIDs(ground, [11])
[plastic, Cu, load, DX0, ground] = geompy.GetExistingSubObjects(Partition_1, False)
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Vertex_1, 'Vertex_1' )
geompy.addToStudy( Vector_1, 'Vector_1' )
geompy.addToStudy( Plane_1, 'Plane_1' )
geompy.addToStudy( Disk_1, 'Disk_1' )
geompy.addToStudy( Cut_1, 'Cut_1' )
geompy.addToStudy( Partition_1, 'Partition_1' )
geompy.addToStudyInFather( Partition_1, plastic, 'plastic' )
geompy.addToStudyInFather( Partition_1, Cu, 'Cu' )
geompy.addToStudyInFather( Partition_1, load, 'load' )
geompy.addToStudyInFather( Partition_1, DX0, 'DX0' )
geompy.addToStudyInFather( Partition_1, ground, 'ground' )
###
SMESH component
###
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New()
#smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations:
multiples meshes built in parallel, complex and numerous mesh edition (performance)
Mesh_1 = smesh.Mesh(Partition_1,'Mesh_1')
NETGEN_1D_2D = Mesh_1.Triangle(algo=smeshBuilder.NETGEN_1D2D)
NETGEN_2D_Parameters_1 = NETGEN_1D_2D.Parameters()
NETGEN_2D_Parameters_1.SetMaxSize( 0.0001 )
NETGEN_2D_Parameters_1.SetMinSize( 0.0001 )
NETGEN_2D_Parameters_1.SetSecondOrder( 0 )
NETGEN_2D_Parameters_1.SetOptimize( 1 )
NETGEN_2D_Parameters_1.SetFineness( 2 )
NETGEN_2D_Parameters_1.SetChordalError( -1 )
NETGEN_2D_Parameters_1.SetChordalErrorEnabled( 0 )
NETGEN_2D_Parameters_1.SetUseSurfaceCurvature( 1 )
NETGEN_2D_Parameters_1.SetFuseEdges( 1 )
NETGEN_2D_Parameters_1.SetWorstElemMeasure( 0 )
NETGEN_2D_Parameters_1.SetUseDelauney( 0 )
NETGEN_2D_Parameters_1.SetQuadAllowed( 0 )
plastic_1 = Mesh_1.GroupOnGeom(plastic,'plastic',SMESH.FACE)
cu = Mesh_1.GroupOnGeom(Cu,'Cu',SMESH.FACE)
load_1 = Mesh_1.GroupOnGeom(load,'load',SMESH.EDGE)
DX0_1 = Mesh_1.GroupOnGeom(DX0,'DX0',SMESH.EDGE)
ground_1 = Mesh_1.GroupOnGeom(ground,'ground',SMESH.EDGE)
isDone = Mesh_1.Compute()
Mesh_1.CheckCompute()
[ plastic_1, cu, load_1, DX0_1, ground_1 ] = Mesh_1.GetGroups()
smesh.SetName(Mesh_1, 'Mesh_1')
try:
Mesh_1.ExportMED( r'/home/students/Documents/scolungag/comm/assembly.med', 0, 41, 1, Mesh_1, 1, [], '',-1, 1 )
pass
except:
print('ExportPartToMED() failed. Invalid file name?')
cu.SetName( 'cu' )
Set names of Mesh objects
smesh.SetName(DX0_1, 'DX0')
smesh.SetName(ground_1, 'ground')
smesh.SetName(NETGEN_2D_Parameters_1, 'NETGEN 2D Parameters_1')
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
smesh.SetName(plastic_1, 'plastic')
smesh.SetName(cu, 'cu')
smesh.SetName(load_1, 'load')
smesh.SetName(NETGEN_1D_2D.GetAlgorithm(), 'NETGEN 1D-2D')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser()
`
Code of Code_aster:
`
from math import *
import code_aster
from code_aster.Commands import *
DEBUT( PAR_LOT = 'OUI', );
MESH
ma = LIRE_MAILLAGE( UNITE = 20, FORMAT = 'MED', );
MODEL
mo = AFFE_MODELE(
MAILLAGE = ma,
AFFE = _F(
TOUT = 'OUI',
PHENOMENE = 'MECANIQUE',
MODELISATION = 'C_PLAN',
),
VERI_JACOBIEN = 'OUI',
);
TIME
fc = 15.0;
t_final = 6.0/fc;
t_inc = 1/fc/80.0;
omega = ((2.0 * pi) * fc);
list_inst = DEFI_LIST_REEL(
DEBUT = 0.0,
INTERVALLE = ( _F( JUSQU_A = t_final, PAS = t_inc, ), ),
);
Materials
Copper
E_cu = 86.2e6/0.0007;
v_cu = 0.35;
rho_cu = 8960.;
sy_sc = 86.2e6;
Et_cu = 50.772e6;
c_cu = ((2.0/3.0)(E_cuEt_cu)/(E_cu-Et_cu));
trac_cu = DEFI_FONCTION(
NOM_PARA='EPSI',
VALE = (
0.0007, 86.2E+06,
0.0360, 89.2E+06,
0.0694, 91.9E+06,
0.0994, 94.3E+06,
0.1371, 97.1E+06,
0.1706, 99.4E+06,
0.2066, 101.6E+06,
0.2340, 103.4E+06,
0.2700, 105.2E+06,
0.3008, 106.7E+06,
0.3282, 108.1E+06,
0.3634, 109.9E+06,
0.3942, 111.2E+06,
0.4268, 112.6E+06,
0.4585, 113.9E+06,
0.4927, 115.2E+06,
0.5227, 116.4E+06,
0.5578, 117.8E+06,
0.5964, 119.1E+06,
0.6264, 120.4E+06,
0.6580, 121.3E+06,
0.6897, 122.4E+06,
0.7214, 123.3E+06,
0.7454, 124.0E+06,
),
INTERPOL='LIN',
PROL_DROITE='LINEAIRE',
PROL_GAUCHE='EXCLU',
);
mat_cu = DEFI_MATERIAU(
ELAS = F(
E = E_cu,
NU = v_cu,
RHO = rho_cu,
),
TRACTION =F( SIGM = trac_cu, ),
PRAGER = _F( C = c_cu, ),
);
Epoxy (E range 1 to 40 GPa)
E_epoxy = 5.30e6/0.0007; #8e9;
v_epoxy = 0.30;
rho_epoxy = 1500.;
Et_epoxy = 5.30e6;
c_epoxy = ((2.0/3.0)(E_epoxyEt_epoxy)/(E_epoxy-Et_epoxy));
trac_epoxy = DEFI_FONCTION(
NOM_PARA='EPSI',
VALE = (
0.0007, 5.30E+06,
5.600E-03, 3.158E+07,
8.200E-03, 4.388E+07,
1.140E-02, 5.823E+07,
1.510E-02, 7.355E+07,
1.860E-02, 8.691E+07,
2.080E-02, 9.324E+07,
),
INTERPOL='LIN',
PROL_DROITE='LINEAIRE',
PROL_GAUCHE='EXCLU',
);
mat_epoxy = DEFI_MATERIAU(
ELAS = F(
E = E_epoxy,
NU = v_epoxy,
RHO = rho_epoxy,
),
TRACTION =F( SIGM = trac_epoxy, ),
PRAGER = _F( C = c_epoxy, ),
);
chmat = AFFE_MATERIAU(
MAILLAGE = ma,
AFFE = (
_F( GROUP_MA = ('cu', ), MATER = mat_cu, ),
_F( GROUP_MA = ('plastic',), MATER = mat_epoxy,),
),
);
BOUNDARIES
fix = AFFE_CHAR_MECA(
MODELE = mo,
FACE_IMPO = (
_F(
GROUP_MA = 'ground',
DX = 0.0, DY = 0.0,
),
_F(
GROUP_MA = 'DX0',
DX = 0.0,
),
),
);
LOADS
The FORCE_FACE is actually a pressure N/m²
pres_y = - (17e3 / ((1.15100)1e-6));
pres_y_func = FORMULE(
NOM_PARA = 'INST',
VALE = 'sin(omega*INST)',
omega = omega
);
ch1 = AFFE_CHAR_MECA(
MODELE = mo,
FORCE_CONTOUR = _F(
GROUP_MA = 'load',
FX = 0.0,
FY = pres_y,
),
);
SOLVER
MECA_RES = DYNA_NON_LINE(
MODELE = mo,
CHAM_MATER = chmat,
COMPORTEMENT = (
_F(RELATION = 'ELAS'),
_F(RELATION = 'VMIS_ECMI_TRAC', GROUP_MA = ('cu', 'plastic'), ITER_CPLAN_MAXI = 50,),
),
INCREMENT = _F( LIST_INST = list_inst, ),
SCHEMA_TEMPS = _F(
SCHEMA = 'NEWMARK',
FORMULATION = 'DEPLACEMENT',
),
ARCHIVAGE = _F( LIST_INST = list_inst, ),
EXCIT = (
_F( CHARGE = ch1, FONC_MULT = pres_y_func, ),
_F( CHARGE = fix, ),
),
CONVERGENCE = _F(
RESI_GLOB_RELA = 1.E-6,
ITER_GLOB_MAXI = 250,
),
NEWTON = _F(
PREDICTION = 'TANGENTE',
MATRICE = 'TANGENTE',
REAC_ITER = 1,
MATR_RIGI_SYME = 'NON',
),
RECH_LINEAIRE = _F( METHODE = 'MIXTE', ),
SOLVEUR = _F(
STOP_SINGULIER='OUI',
ELIM_LAGR = 'NON',
METHODE = 'MUMPS',
NPREC = 11,
TYPE_RESOL = 'AUTO',
),
);
FIELDS
Calculate the stress:
MECA_RES = CALC_CHAMP(
reuse = MECA_RES,
RESULTAT = MECA_RES,
MODELE = mo,
CHAM_MATER = chmat,
CONTRAINTE = ('SIGM_ELGA', 'SIGM_ELNO', 'SIGM_NOEU'),
ENERGIE = ('ENEL_ELEM',),
CRITERES = ('SIEQ_ELGA', 'SIEQ_ELNO', 'SIEQ_NOEU'),
);
#####################
PRINT RESULTS
#####################
IMPR_RESU(
UNITE = 80,
FORMAT = 'MED',
RESU = _F(
MAILLAGE = ma,
RESULTAT = MECA_RES,
NOM_CHAM = ('DEPL', 'SIGM_ELGA', 'ENEL_ELEM', 'SIEQ_ELGA'),
),
);
FIN();
`
Export file:
P actions make_etude
P aster_root /opt/salome_meca/2023.1.0_scibian_univ/tools/Code_aster_frontend-202310
P consbtc oui
P corefilesize unlimited
P cpresok RESNOOK
P debug nodebug
P display ELC121P000A138U:2
P facmtps 1
P lang en
P mclient ELC121P000A138U
P memjob 7372800
P memory_limit 7200.0
P mode interactif
P mpi_nbcpu 1
P mpi_nbnoeud 2
P nbmaxnook 5
P noeud localhost
P nomjob elastoplastic
P origine ASTK 2023.0.final
P platform ?IFDEF?
P profastk students@ELC121P000A138U:/home/students/Documents/scolungag/elastoplastic/elastoplastic.astk
P protocol_copyfrom asrun.plugins.server.SCPServer
P protocol_copyto asrun.plugins.server.SCPServer
P protocol_exec asrun.plugins.server.SSHServer
P proxy_dir /local00/tmp
P rep_trav /local00/tmp/students-ELC121P000A138U-interactif_24809
P serveur localhost
P soumbtc oui
P time_limit 70020.0
P tpsjob 1168
P uclient students
P username students
P version stable
A args
A memjeveux 900.0
A tpmax 70020.0
F mmed /home/students/Documents/scolungag/comm/assembly.med D 20
F comm /home/students/Documents/scolungag/comm/elastoplastic.comm D 1
F rmed /home/students/Documents/scolungag/comm/elastoplastic.rmed R 80
F mess /home/students/Documents/scolungag/comm/log.mess R 6
Best,
Frederic