The syntax error in your Code_Aster command file is likely due to the use of DEBUT() and FIN() which are not standard in Code_Aster. Also, there might be some issues with the group names and the way boundary conditions are applied. Here's the corrected version:
# Import mesh (pre-created in Salome with groups: FIXED_TEMP, HEAT_FLUX, END0, END1)
mesh = LIRE_MAILLAGE(UNITE=20, FORMAT='MED')
# Define steel material (SI units: m, Pa, W/m·K)
steel = DEFI_MATERIAU(
ELAS=_F(E=210e9, NU=0.3, ALPHA=1.2e-5, TREF=300),
THER=_F(LAMBDA=50)
)
# Assign material to the mesh
mat = AFFE_MATERIAU(MAILLAGE=mesh, AFFE=_F(TOUT='OUI', MATER=steel))
# Thermal model (3D conduction)
therm_model = AFFE_MODELE(
MAILLAGE=mesh,
AFFE=_F(TOUT='OUI', PHENOMENE='THERMIQUE', MODELISATION='3D')
)
# Mechanical model (3D elasticity)
meca_model = AFFE_MODELE(
MAILLAGE=mesh,
AFFE=_F(TOUT='OUI', PHENOMENE='MECANIQUE', MODELISATION='3D')
)
# Thermal BCs: Fixed temp at x=0, heat flux at x=L
therm_bc = AFFE_CHAR_THER(
MODELE=therm_model,
DDL_IMPO=_F(GROUP_MA='FIXED_TEMP', TEMP=300), # Group at x=0
FLUX_REP=_F(GROUP_MA='HEAT_FLUX', FLUX=1000) # Group at x=L
)
# Solve thermal problem (steady-state)
temp_field = THER_LINEAIRE(
MODELE=therm_model,
CHAM_MATER=mat,
EXCIT=therm_bc
)
# Mechanical BCs: Fix DX at both ends (x=0 and x=L)
meca_bc = AFFE_CHAR_MECA(
MODELE=meca_model,
DDL_IMPO=(
_F(GROUP_MA='END0', DX=0), # Group at x=0
_F(GROUP_MA='END1', DX=0) # Group at x=L
),
TEMP=temp_field # Apply temperature field
)
# Solve mechanical problem
result = MECA_STATIQUE(
MODELE=meca_model,
CHAM_MATER=mat,
EXCIT=meca_bc
)
# Export results to MED for ParaView
IMPR_RESU(FORMAT='MED',
UNITE=80,
RESU=_F(MAILLAGE=mesh,
RESULTAT=result,
NOM_CHAM='TEMP', # For temperature field
NOM_CHAM='DEPL', # For displacement field
NOM_CHAM='SIEQ_NOEU')) # For equivalent stress
Key corrections:
- Removed
DEBUT() and FIN() as they're not needed in Code_Aster command files
- Changed the group names in boundary conditions to match what you mentioned in the comment (FIXED_TEMP, HEAT_FLUX, END0, END1)
- Added more complete output specifications in IMPR_RESU
- Made sure all parentheses and commas are properly placed
Note: Make sure your mesh actually has groups named exactly as specified in the boundary conditions. If your groups have different names, you'll need to adjust them accordingly.
Also, you might want to add:
DEBUT(PAR_LOT='NON')
at the very beginning if you're running this in a standalone command file, but this is optional.