Let us look at how to add multiple materials in command file.

Here we will re-use the command file that we created for 3D analysis.

Let us assume that user has made two 3D mesh groups named “Guide” and “Weld” which needs different materials associated with them.  Also let us assume that mesh group “Guide” is made out of Stainless Steel and “Weld” is Carbon Steel (Note: this is not a real life example and it is presented here for understanding of how to add multiple materials to the command file only)

Here we will re-use command file “3D.comm” and make changes.

Click on “Open .comm File” button on the lower left as shown in figure below

TutEF07-01

 In the window that pops up select “3D.comm” and Click “Open” as shown below

TutEF07-02

 File 3D.comm will be opened here.  As we are only interested in adding a second material “Stainless Steel” to the 3D mesh group “Guide” we will Click on Tab “Material” and add “SS” as shown below.

Note that material “CS” which is carbon steel was already added to the command file in the tutorial 3D analysis command file to the entire mesh.  We will edit this material “CS” later, first we will add another material with Name “SS”.

Click on the drop down for Material Database and select “Stainless Steel”, as you do, the fields Young’s Modulus, Poissons Ratio and Density will be automatically populated.  Please note that these values are in MPa, unitless and tonne / mm^3 respectively.

Enter “SS” as the Material Name

Enter “Guide” for Is Assigned to.

Click Add to add Stainless steel material.

TutEF08-03

Now select the Line which shows “CS;2.1e5;0.3;7.8e-9;All” with a left click of the mouse button and Click “Edit”.

When you do that, the material is removed from the analysis and is presented for editing.

The only thing we need to change is the value of “Is Assigned to”, Enter “Weld” for Is Assigned to and click “Add” as shown below.

TutEF08-04

After both materials are added, and that we do not need to change anything else for this tutorial purpose, Click on the button “Save .comm File” and save it with a name “3D-Diff_Material.comm”

TutEF08-08

When Efficient has written this file, it will show a message as below.

TutEF02-09

 

Open your command file and have a look of what is in it.

###############################
#File created by Efficient Software version 0.1.0
#Version of Code_Aster is 11.x
#Author of Efficient is Dhramit Thakore
#https://engineering.moonish.biz
###############################
#U4.11.01
#@Eff@#StartCont#DEBUT
DEBUT();
#U4.21.01
#@Eff@#MeshType#MED
mesh=LIRE_MAILLAGE(FORMAT='MED',);
#U4.41.01
#@Eff@#AnalysisType#Mechanical - 3D
model=AFFE_MODELE(MAILLAGE=mesh, AFFE=_F(TOUT='OUI', PHENOMENE='MECANIQUE', MODELISATION='3D',),);
#U4.43.01
#@Eff@#MaterialList#SS;1.95e5;0.3;7.92e-9;Guide
SS=DEFI_MATERIAU(ELAS=_F(E=1.95e5, NU=0.3, RHO=7.92e-9,),);
#@Eff@#MaterialList#CS;2.1e5;0.3;7.8e-9;Weld
CS=DEFI_MATERIAU(ELAS=_F(E=2.1e5, NU=0.3, RHO=7.8e-9,),);
#U4.43.03
material=AFFE_MATERIAU(MAILLAGE=mesh, AFFE=(_F(GROUP_MA='Guide', MATER=SS,),_F(GROUP_MA='Weld', MATER=CS,),),);
#U4.44.01
#@Eff@#BCList#D.O.F (DDL) on Mesh Group;Fixed;Fix;0;0;0;NA;NA;NA;NA;NA
Fixed=AFFE_CHAR_MECA(MODELE=model, DDL_IMPO=_F(GROUP_MA='Fix',DX=0,DY=0,DZ=0,),);
#U4.44.01
#@Eff@#LoadList#ForceZ;Force on Face;Load;NA;NA;2;NA;NA;NA
ForceZ=AFFE_CHAR_MECA(MODELE=model, FORCE_FACE=(_F(GROUP_MA='Load', FZ = 2,),),);
result=MECA_STATIQUE(MODELE=model, CHAM_MATER=material, EXCIT=(_F(CHARGE=Fixed,),_F(CHARGE=ForceZ,),),);
#U4.81.04
result=CALC_CHAMP(reuse=result, RESULTAT=result, CONTRAINTE=('SIGM_ELNO','SIGM_NOEU',), CRITERES=('SIEQ_ELNO','SIEQ_NOEU',), FORCE=('REAC_NODA',),);
#U4.91.01
#@Eff@#OutputMEDList#SIGM_ELNO
#@Eff@#OutputMEDList#SIGM_NOEU
#@Eff@#OutputMEDList#SIEQ_ELNO
#@Eff@#OutputMEDList#SIEQ_NOEU
#@Eff@#OutputMEDList#REAC_NODA
IMPR_RESU(FORMAT='MED', UNITE=80, RESU=_F(MAILLAGE=mesh, RESULTAT=result, NOM_CHAM=('DEPL', 'SIGM_ELNO', 'SIGM_NOEU', 'SIEQ_ELNO', 'SIEQ_NOEU', 'REAC_NODA',),),);
#U4.11.02
FIN();

Use it in one of your analysis and check results.