Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MFront and ElmerFEM: trying to get advance material behaviour the easy way in Elmer #528

Open
Irvise opened this issue Aug 15, 2024 · 5 comments

Comments

@Irvise
Copy link
Contributor

Irvise commented Aug 15, 2024

Hi all,

I think this could be a forum post, but since this requires somewhat non-trivial programming knowledge, I will write it here.

MFront/TFEL is a wonderful utility to create advance material behaviours which then can be used in a variety of other mechanical simulation programs, such as Abaqus, ANSYS, Code_Aster, etc. MFront allows for quite complex behaviours and data transfer/parameter dependency between the material behaviour and the simulation data too. Since ElmerFEM has some support for Abaqus' UMAT subroutine, I wanted to see if MFront's Abaqus support could be used directly on Elmer. This would open the possibility to doing quite complex mechanical simulations with Elmer (both in small strain and finite strain), specially when coupled with other solvers.

Anyhow, here is what I have found:

Setup

  • I am using an ElmerFEM version that I compiled earlier this year from the develop branch.
  • I am using MFront 5.0 (still under development), which I also compiled with support for the Abaqus interface.
  • I used the files from the test UMAT_linear_isotropic_2D as the baseline. I ran the test as is and it works.
  • I used the elasticity.mfront file (taken from the MFront examples) as the target behaviour. This file mimics what is found in the linear_isotropic behaviour law that is called from the .sif file. Here are its contents:
@Behaviour Elasticity;
@Author Helfer Thomas;
@Date 23/11/06;
@Description{
 A very first test 
 (the most simple one in fact).
}

@UseQt true;
@ProvidesSymmetricTangentOperator;

@MaterialProperty stress young;
young.setGlossaryName("YoungModulus");
@MaterialProperty real   nu;
nu.setGlossaryName("PoissonRatio");

@LocalVariable stress lambda;
@LocalVariable stress mu;

@Includes{
#include"TFEL/Material/Lame.hxx"
}

@Integrator{
  using namespace tfel::material::lame;
  lambda = computeLambda(young,nu);
  mu = computeMu(young,nu);
  sig = lambda*trace(eto+deto)*StrainStensor::Id()+2*mu*(eto+deto);
  if(computeTangentOperator_){
    Dt = lambda*Stensor4::IxI()+2*mu*Stensor4::Id();
  }
}
  • I modified the .sif file so that the material would only have 2 properties defined, the Young Modulus and Poissons' coefficient (I basically took out the density).
  • I compiled the .mfront behaviour targeting Abaqus: mfront --obuild --interface=abaqus elasticity.mfront
  • I modified the .sif file to point to the correct behaviour and function, basically I modified the line: UMAT Subroutine = File "UMATLib" "linear_isotropic" for UMAT Subroutine = File "./src/libABAQUSBEHAVIOUR.so" "ELASTICITY_PSTRAIN"
  • I tried running the modified .sif file, this is what I got:
Apptainer> ElmerSolver elasticity_mfront.sif 
ELMER SOLVER (v 9.0) STARTED AT: 2024/08/15 18:20:22
Authorization required, but no authorization protocol specified

ParCommInit:  Initialize #PEs:            1
MAIN: OMP_NUM_THREADS not set. Using only 1 thread per task.
MAIN: 
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email [email protected]
MAIN: Version: 9.0 (Rev: c14381c, Compiled: 2023-10-28)
MAIN:  Running one task without MPI parallelization.
MAIN:  Running with just one thread per task.
MAIN:  HYPRE library linked in.
MAIN:  Trilinos library linked in.
MAIN:  MUMPS library linked in.
MAIN:  MMG library linked in.
MAIN:  Lua interpreter linked in.
MAIN: =============================================================
MAIN: 
MAIN: 
MAIN: -------------------------------------
MAIN: Reading Model: elasticity_mfront.sif
LoadInputFile: Scanning input file: elasticity_mfront.sif
LoadInputFile: Scanning only size info
LoadInputFile: First time visiting
LoadInputFile: Reading base load of sif file
LoadInputFile: Loading input file: elasticity_mfront.sif
LoadInputFile: Reading base load of sif file
LoadInputFile: Number of BCs: 2
LoadInputFile: Number of Body Forces: 1
LoadInputFile: Number of Initial Conditions: 0
LoadInputFile: Number of Materials: 1
LoadInputFile: Number of Equations: 1
LoadInputFile: Number of Solvers: 1
LoadInputFile: Number of Bodies: 1
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by area
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by volume
ElmerAsciiMesh: Base mesh name: ./beam
LoadMesh: Elapsed REAL time:     0.0013 (s)
MAIN: -------------------------------------
OptimizeBandwidth: Initial bandwidth for elasticity solver: 21
OptimizeBandwidth: Optimized bandwidth for elasticity solver: 33
OptimizeBandwidth: Bandwidth optimization rejected, using original ordering.
MAIN: Number of timesteps to be saved: 2
MAIN: 
MAIN: -------------------------------------
MAIN: Time: 1/2:   1.000E+00
MAIN: -------------------------------------
MAIN: 
ElasticSolver: ----------------------------------
ElasticSolver: Starting Elasticity Solver
ElasticSolver: Could not find variable "UmatState", assuming no state variable!
ElasticSolver: -------------------------------------
ElasticSolver: ELASTICITY ITERATION 1
ElasticSolver: -------------------------------------
Load: FATAL: Can't find procedure [elasticity_pstrain_]

Results

Well, as it was somewhat expected, the simulation did not run... Why is it failing?

  • ElmerFEM expects the name of the function to be lowercase with a final underscore: elasticity_pstrain_
  • MFront/Abaqus generally name the functions/procedures in capital letters... So MFront generated the ELASTICITY_PSTRAIN behaviour (along with ELASTICITY_3D and ELASTICITY_AXIS), which is not what ElmerFEM wants.
    • I want to note that I am fully aware that the UMAT subroutine that ElmerFEM expects should be compiled with elmerf90, which probably has all the naming/linking setup required for the use of Fortran code within the solvers.
  • I forcibly renamed the expected function name using: objcopy --redefine-sym ELASTICITY_PSTRAIN=elasticity_pstrain_ libABAQUSBEHAVIOUR.so which works and was verified with objdump -x.
  • After renaming the procedure, sadly, ElmerSolver still generated the error Load: FATAL: Can't find procedure [elasticity_pstrain_]...
  • The error is generated in /fem/src/Load.c:
    403 #ifdef HAVE_DLOPEN_API
    404 
    405    if ( (Function = (void(*)())dlsym( Handle,NewName)) == NULL && *abort_not_found )
    406    {
    407       fprintf( stderr, "Load: FATAL: Can't find procedure [%s]\n", NewName );
    408       exit(0);
    409    }
    410 
    411 #elif defined(HAVE_LOADLIBRARY_API)
    412 
    413    if ( (Function = (void *)GetProcAddress(Handle,NewName)) == NULL && *abort_not_found )
    414    {
    415      fprintf( stderr,"Load: FATAL: Can't find procedure [%s]\n", NewName );
    416      exit(0);
    417    }
    418 
    419 #endif
  • I am not sure if the issue is created/generated by the LIBRARY loading mechanism or if there is something weird going on..,

Conclusion

I do not know if this is interesting to anybody here, but MFront would allow easy, advance and complex material behaviours in ElmerFEM. This could be a very appealing addition to the simulation capabilities of Elmer... And once again, specially when multiphysics are involved (thermo-mechanical or electro-mechanical for example). MFront, as said in the introduction, has several interfaces, one of them, is the generic interface in case this interface, instead of Abaqus' is preferred.
Though I am aware that the mechanical computations that ElmerFEM can do are quite limited (no transients!), but it would be a nice step forward IMHO :)

If you need more info or would like to help with ideas, please, say so!

Best regards,
Fer

@mmalinen
Copy link
Contributor

Hi,

This would certainly be a nice feature!

I think the linking of a material model should be possible without compiling with the utility elmerf90. The following check may not be useful in any way, but how is the subroutine name mangled after compiling libABAQUSBEHAVIOUR.so with mfront? What does the command nm libABAQUSBEHAVIOUR.sodisplay about this symbol name?

@Irvise
Copy link
Contributor Author

Irvise commented Aug 21, 2024

Here is a clean build of everything:

Apptainer> mfront --obuild --interface=abaqus elasticity.mfront 
Treating target : all
The following library has been built :
- libABAQUSBEHAVIOUR.so :  ELASTICITY_AXIS ELASTICITY_PSTRAIN ELASTICITY_3D

The library defines ELASTICITY_AXIS ELASTICITY_PSTRAIN ELASTICITY_3D functions.

The Abaqus generated file which would be a valid Abaqus .inp file as a example is:

Apptainer> cat abaqus/Elasticity.inp 
** 
** File generated by MFront from the elasticity.mfront source
** Example of how to use the Elasticity behaviour law
** Author Helfer Thomas
** Date   23 / 11 / 06
**

** Example for the 'Axisymmetrical' modelling hypothesis
** This behaviour requires 1 field variables to be defined:
*Material, name=ABAQUSBEHAVIOUR_ELASTICITY_AXIS
** The material properties are given as if we used parameters to explicitly
** display their names. Users shall replace those declaration by
** theirs values and/or declare those parameters in the appropriate *parameters
** section of the input file
*User Material, constants=2
<YoungModulus>, <PoissonRatio>

** Example for the 'PlaneStrain' modelling hypothesis
** This behaviour requires 1 field variables to be defined:
*Material, name=ABAQUSBEHAVIOUR_ELASTICITY_PSTRAIN
** The material properties are given as if we used parameters to explicitly
** display their names. Users shall replace those declaration by
** theirs values and/or declare those parameters in the appropriate *parameters
** section of the input file
*User Material, constants=2
<YoungModulus>, <PoissonRatio>

** Example for the 'Tridimensional' modelling hypothesis
** This behaviour requires 1 field variables to be defined:
*Material, name=ABAQUSBEHAVIOUR_ELASTICITY_3D
** The material properties are given as if we used parameters to explicitly
** display their names. Users shall replace those declaration by
** theirs values and/or declare those parameters in the appropriate *parameters
** section of the input file
*User Material, constants=2
<YoungModulus>, <PoissonRatio>

As can be seen, the functions are the functions in capital letters with ABAQUSBEHAVIOUR_ prefixed to them.

MFront also generates a abaqus/umat.cpp file for the user in case it is preferred. Notice that it is a C++ file! But it generates an executable UMAT that should just work. I am attaching it here in case it helps.

Running nm on the newly created library generates:

Apptainer> nm src/libABAQUSBEHAVIOUR.so 
00000000000102b8 d DW.ref._ZTIN4tfel8material17MaterialExceptionE
00000000000102c0 d DW.ref._ZTIN4tfel8material19DivergenceExceptionE
00000000000102c8 d DW.ref._ZTIN4tfel8material20OutOfBoundsExceptionE
00000000000102d0 d DW.ref._ZTIN4tfel9exception13TFELExceptionE
00000000000102d8 d DW.ref._ZTIN6abaqus15AbaqusExceptionE
00000000000102e0 d DW.ref._ZTISt13runtime_error
00000000000102e8 d DW.ref._ZTISt9exception
00000000000102f0 d DW.ref.__gxx_personality_v0
0000000000004d40 T ELASTICITY_3D
0000000000004ac0 T ELASTICITY_AXIS
00000000000101f0 D ELASTICITY_BehaviourKinematic
00000000000101f2 D ELASTICITY_BehaviourType
0000000000010308 B ELASTICITY_ComputesDissipatedEnergy
000000000001030a B ELASTICITY_ComputesInternalEnergy
0000000000010342 B ELASTICITY_ElasticSymmetryType
0000000000010320 B ELASTICITY_ExternalStateVariables
0000000000010318 B ELASTICITY_ExternalStateVariablesTypes
0000000000010248 D ELASTICITY_Gradients
0000000000010200 D ELASTICITY_GradientsTypes
0000000000010338 B ELASTICITY_InternalStateVariables
0000000000010330 B ELASTICITY_InternalStateVariablesTypes
0000000000010220 D ELASTICITY_MaterialProperties
0000000000010250 D ELASTICITY_ModellingHypotheses
0000000000004c00 T ELASTICITY_PSTRAIN
0000000000010210 D ELASTICITY_Parameters
0000000000010310 B ELASTICITY_ParametersTypes
0000000000010344 B ELASTICITY_SymmetryType
0000000000010230 D ELASTICITY_TangentOperatorBlocks
00000000000101ee D ELASTICITY_TemperatureRemovedFromExternalStateVariables
0000000000010240 D ELASTICITY_ThermodynamicForces
00000000000101f8 D ELASTICITY_ThermodynamicForcesTypes
00000000000101ec D ELASTICITY_UsableInPurelyImplicitResolution
00000000000102b0 D ELASTICITY_author
0000000000010290 D ELASTICITY_build_id
00000000000102a8 D ELASTICITY_date
00000000000102a0 D ELASTICITY_description
00000000000101d8 D ELASTICITY_maximal_time_step_scaling_factor_ParameterDefaultValue
0000000000010288 D ELASTICITY_mfront_ept
0000000000010270 D ELASTICITY_mfront_interface
000000000001020a D ELASTICITY_mfront_mkt
00000000000101e0 D ELASTICITY_minimal_time_step_scaling_factor_ParameterDefaultValue
0000000000010328 B ELASTICITY_nExternalStateVariables
0000000000010204 D ELASTICITY_nGradients
0000000000010340 B ELASTICITY_nInternalStateVariables
0000000000010206 D ELASTICITY_nMainVariables
00000000000101ea D ELASTICITY_nMaterialProperties
0000000000010208 D ELASTICITY_nModellingHypotheses
00000000000101e8 D ELASTICITY_nParameters
00000000000101f4 D ELASTICITY_nTangentOperatorBlocks
00000000000101fc D ELASTICITY_nThermodynamicForces
000000000001030e B ELASTICITY_requiresStiffnessTensor
000000000001030c B ELASTICITY_requiresThermalExpansionCoefficientTensor
0000000000004a60 T ELASTICITY_setOutOfBoundsPolicy
0000000000004a20 T ELASTICITY_setParameter
00000000000043d0 t ELASTICITY_setParameter.cold
0000000000010268 D ELASTICITY_src
0000000000010280 D ELASTICITY_tfel_version
0000000000010278 D ELASTICITY_unit_system
0000000000010298 D ELASTICITY_validator
000000000000fd48 d _DYNAMIC
000000000000ffe8 d _GLOBAL_OFFSET_TABLE_
0000000000004840 t _GLOBAL__sub_I_Elasticity.cxx
0000000000004810 t _GLOBAL__sub_I_abaqusElasticity.cxx
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U _Unwind_Resume@GCC_3.0
0000000000010350 b _ZGVZN4tfel8material31ElasticityParametersInitializer3getEvE1i
0000000000004fb0 t _ZN4tfel4math8st2tost2ILt3EdE3IxIEv
00000000000099b0 t _ZN4tfel5raiseISt13runtime_errorJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEvDpOT0_
0000000000005000 t _ZN4tfel5raiseISt13runtime_errorJRA30_KcEEEvDpOT0_
0000000000006d60 t _ZN4tfel5raiseISt13runtime_errorJRA76_KcEEEvDpOT0_
0000000000006dc0 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EE25computePredictionOperatorENS0_21TangentOperatorTraitsILNS0_23MechanicalBehaviourBase13BehaviourTypeE1EE6SMFlagENS6_6SMTypeE
0000000000005060 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EE9integrateENS0_21TangentOperatorTraitsILNS0_23MechanicalBehaviourBase13BehaviourTypeE1EE6SMFlagENS6_6SMTypeE
0000000000004f50 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EED0Ev
0000000000004e90 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EED1Ev
0000000000004e90 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EED2Ev
0000000000006dd0 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EE25computePredictionOperatorENS0_21TangentOperatorTraitsILNS0_23MechanicalBehaviourBase13BehaviourTypeE1EE6SMFlagENS6_6SMTypeE
0000000000005920 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EE9integrateENS0_21TangentOperatorTraitsILNS0_23MechanicalBehaviourBase13BehaviourTypeE1EE6SMFlagENS6_6SMTypeE
0000000000004f60 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EED0Ev
0000000000004ea0 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EED1Ev
0000000000004ea0 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EED2Ev
0000000000006de0 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EE25computePredictionOperatorENS0_21TangentOperatorTraitsILNS0_23MechanicalBehaviourBase13BehaviourTypeE1EE6SMFlagENS6_6SMTypeE
00000000000061e0 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EE9integrateENS0_21TangentOperatorTraitsILNS0_23MechanicalBehaviourBase13BehaviourTypeE1EE6SMFlagENS6_6SMTypeE
0000000000004f70 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EED0Ev
0000000000004eb0 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EED1Ev
0000000000004eb0 t _ZN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EED2Ev
0000000000008540 t _ZN4tfel8material31ElasticityParametersInitializer14readParametersERS1_PKc
0000000000004606 t _ZN4tfel8material31ElasticityParametersInitializer14readParametersERS1_PKc.cold
0000000000009880 t _ZN4tfel8material31ElasticityParametersInitializer3getEv
00000000000047fc t _ZN4tfel8material31ElasticityParametersInitializer3getEv.cold
00000000000076a0 t _ZN4tfel8material31ElasticityParametersInitializer3setEPKcd
0000000000004550 t _ZN4tfel8material31ElasticityParametersInitializer3setEPKcd.cold
0000000000006df0 t _ZN4tfel8material31ElasticityParametersInitializer9getDoubleERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_
0000000000004484 t _ZN4tfel8material31ElasticityParametersInitializer9getDoubleERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_.cold
0000000000009860 t _ZN4tfel8material31ElasticityParametersInitializerC1Ev
0000000000009860 t _ZN4tfel8material31ElasticityParametersInitializerC2Ev
0000000000005460 t _ZN6abaqus15AbaqusInterfaceILN4tfel8material19ModellingHypothesis10HypothesisE2ENS2_10ElasticityEE13CallBehaviour3exeERKNS_10AbaqusDataE
00000000000056c0 t _ZN6abaqus15AbaqusInterfaceILN4tfel8material19ModellingHypothesis10HypothesisE2ENS2_10ElasticityEE3exeERKNS_10AbaqusDataE
0000000000005d20 t _ZN6abaqus15AbaqusInterfaceILN4tfel8material19ModellingHypothesis10HypothesisE4ENS2_10ElasticityEE13CallBehaviour3exeERKNS_10AbaqusDataE
0000000000005f80 t _ZN6abaqus15AbaqusInterfaceILN4tfel8material19ModellingHypothesis10HypothesisE4ENS2_10ElasticityEE3exeERKNS_10AbaqusDataE
0000000000006810 t _ZN6abaqus15AbaqusInterfaceILN4tfel8material19ModellingHypothesis10HypothesisE6ENS2_10ElasticityEE13CallBehaviour3exeERKNS_10AbaqusDataE
0000000000006b00 t _ZN6abaqus15AbaqusInterfaceILN4tfel8material19ModellingHypothesis10HypothesisE6ENS2_10ElasticityEE3exeERKNS_10AbaqusDataE
0000000000004930 t _ZN6abaqus21AbaqusTangentOperatorIdE9normalizeERN4tfel4math4ViewINS3_8st2tost2ILt2EdEENS3_37FixedSizeRowMajorMatrixIndexingPolicyItLt4ELt4ELt4EEEEE.isra.0
00000000000052f0 t _ZN6abaqus22AbaqusBehaviourHandlerILN4tfel8material19ModellingHypothesis10HypothesisE2ENS2_10ElasticityEE10Integrator3exeERKNS_10AbaqusDataE
0000000000005bb0 t _ZN6abaqus22AbaqusBehaviourHandlerILN4tfel8material19ModellingHypothesis10HypothesisE4ENS2_10ElasticityEE10Integrator3exeERKNS_10AbaqusDataE
00000000000065d0 t _ZN6abaqus22AbaqusBehaviourHandlerILN4tfel8material19ModellingHypothesis10HypothesisE6ENS2_10ElasticityEE10Integrator3exeERKNS_10AbaqusDataE
                 U _ZN6abaqus25AbaqusInterfaceExceptions18treatTFELExceptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN4tfel9exception13TFELExceptionE
                 U _ZN6abaqus25AbaqusInterfaceExceptions20treatAbaqusExceptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_15AbaqusExceptionE
                 U _ZN6abaqus25AbaqusInterfaceExceptions21treatUnknownExceptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
                 U _ZN6abaqus25AbaqusInterfaceExceptions22throwInvalidTensorSizeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEti
                 U _ZN6abaqus25AbaqusInterfaceExceptions22treatMaterialExceptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN4tfel8material17MaterialExceptionE
                 U _ZN6abaqus25AbaqusInterfaceExceptions22treatStandardExceptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt9exception
                 U _ZN6abaqus25AbaqusInterfaceExceptions30throwNegativeTimeStepExceptionERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
                 U _ZN6abaqus25AbaqusInterfaceExceptions36throwUnMatchedNumberOfStateVariablesERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEti
                 U _ZN6abaqus25AbaqusInterfaceExceptions40throwUnMatchedNumberOfMaterialPropertiesERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEti
                 U _ZN6abaqus51AbaqusStandardSmallStrainStressFreeExpansionHandlerEPdS0_PKdS2_i
0000000000004ec0 t _ZNK4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EE31getMinimalTimeStepScalingFactorEv
0000000000004ed0 t _ZNK4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EE35computeAPrioriTimeStepScalingFactorEd
0000000000004ee0 t _ZNK4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EE39computeAPosterioriTimeStepScalingFactorEd
0000000000004ef0 t _ZNK4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EE31getMinimalTimeStepScalingFactorEv
0000000000004f00 t _ZNK4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EE35computeAPrioriTimeStepScalingFactorEd
0000000000004f10 t _ZNK4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EE39computeAPosterioriTimeStepScalingFactorEd
0000000000004f20 t _ZNK4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EE31getMinimalTimeStepScalingFactorEv
0000000000004f30 t _ZNK4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EE35computeAPrioriTimeStepScalingFactorEd
0000000000004f40 t _ZNK4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EE39computeAPosterioriTimeStepScalingFactorEd
                 U _ZNKSt5ctypeIcE13_M_widen_initEv@GLIBCXX_3.4.11
0000000000004e80 t _ZNKSt5ctypeIcE8do_widenEc
                 U _ZNSi10_M_extractIdEERSiRT_@GLIBCXX_3.4.9
                 U _ZNSo3putEc@GLIBCXX_3.4
                 U _ZNSo5flushEv@GLIBCXX_3.4
                 U _ZNSt12__basic_fileIcED1Ev@GLIBCXX_3.4
                 U _ZNSt13basic_filebufIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@GLIBCXX_3.4
                 U _ZNSt13basic_filebufIcSt11char_traitsIcEE5closeEv@GLIBCXX_3.4
                 U _ZNSt13basic_filebufIcSt11char_traitsIcEEC1Ev@GLIBCXX_3.4
                 U _ZNSt13basic_filebufIcSt11char_traitsIcEED1Ev@GLIBCXX_3.4
                 U _ZNSt13runtime_errorC1EOS_@GLIBCXX_3.4.26
                 U _ZNSt13runtime_errorC1EPKc@GLIBCXX_3.4.21
                 U _ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@GLIBCXX_3.4.21
                 U _ZNSt13runtime_errorD1Ev@GLIBCXX_3.4
                 U _ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@GLIBCXX_3.4
                 U _ZNSt6localeC1Ev@GLIBCXX_3.4
                 U _ZNSt6localeD1Ev@GLIBCXX_3.4
000000000000a4c0 t _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_M_realloc_insertIJRKS5_EEEvN9__gnu_cxx17__normal_iteratorIPS5_S7_EEDpOT_
0000000000009ac0 t _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED1Ev
0000000000009ac0 t _ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED2Ev
0000000000004f80 t _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv
000000000000a150 t _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm
0000000000009b30 t _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_mutateEmmPKcm
0000000000009910 t _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
0000000000009910 t _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
0000000000004980 t _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.constprop.0
                 U _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEE7_M_syncEPcmm@GLIBCXX_3.4.21
0000000000009a60 t _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED0Ev
0000000000009a10 t _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED1Ev
0000000000009a10 t _ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED2Ev
                 U _ZNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEED1Ev@GLIBCXX_3.4.21
                 U _ZNSt8ios_base4InitC1Ev@GLIBCXX_3.4
                 U _ZNSt8ios_base4InitD1Ev@GLIBCXX_3.4
                 U _ZNSt8ios_baseC2Ev@GLIBCXX_3.4
                 U _ZNSt8ios_baseD2Ev@GLIBCXX_3.4
                 U _ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E@GLIBCXX_3.4
                 U _ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate@GLIBCXX_3.4
000000000000a810 t _ZSt13__copy_move_aILb0ESt16istream_iteratorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcS4_lESt20back_insert_iteratorISt6vectorIS6_SaIS6_EEEET1_T0_SE_SD_
                 U _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@GLIBCXX_3.4.9
                 U _ZSt16__throw_bad_castv@GLIBCXX_3.4
                 U _ZSt17__throw_bad_allocv@GLIBCXX_3.4
                 U _ZSt19__throw_logic_errorPKc@GLIBCXX_3.4
                 U _ZSt20__throw_length_errorPKc@GLIBCXX_3.4
                 U _ZSt4cerr@GLIBCXX_3.4
                 U _ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_@GLIBCXX_3.4.21
0000000000010346 b _ZStL8__ioinit
0000000000010370 b _ZStL8__ioinit
                 U _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@GLIBCXX_3.4
0000000000009d20 t _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_PKS5_
000000000000a430 t _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_OS8_
0000000000009e50 t _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_RKS8_
                 U _ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@GLIBCXX_3.4.21
000000000000fc00 d _ZTIN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EEE
000000000000fc80 d _ZTIN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EEE
000000000000fd00 d _ZTIN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EEE
                 U _ZTIN4tfel8material17MaterialExceptionE
                 U _ZTIN4tfel8material19DivergenceExceptionE
000000000000fbc8 d _ZTIN4tfel8material19MechanicalBehaviourILNS0_23MechanicalBehaviourBase13BehaviourTypeE1ELNS0_19ModellingHypothesis10HypothesisE2EdLb0EEE
000000000000fc48 d _ZTIN4tfel8material19MechanicalBehaviourILNS0_23MechanicalBehaviourBase13BehaviourTypeE1ELNS0_19ModellingHypothesis10HypothesisE4EdLb0EEE
000000000000fcc8 d _ZTIN4tfel8material19MechanicalBehaviourILNS0_23MechanicalBehaviourBase13BehaviourTypeE1ELNS0_19ModellingHypothesis10HypothesisE6EdLb0EEE
                 U _ZTIN4tfel8material20OutOfBoundsExceptionE
000000000000fb88 d _ZTIN4tfel8material21TangentOperatorTraitsILNS0_23MechanicalBehaviourBase13BehaviourTypeE1EEE
000000000000fb58 d _ZTIN4tfel8material23ElasticityBehaviourDataILNS0_19ModellingHypothesis10HypothesisE2EdLb0EEE
000000000000fb78 d _ZTIN4tfel8material23ElasticityBehaviourDataILNS0_19ModellingHypothesis10HypothesisE4EdLb0EEE
000000000000fb98 d _ZTIN4tfel8material23ElasticityBehaviourDataILNS0_19ModellingHypothesis10HypothesisE6EdLb0EEE
000000000000fbb8 d _ZTIN4tfel8material23MechanicalBehaviourBaseE
000000000000fb48 d _ZTIN4tfel8material25ElasticityIntegrationDataILNS0_19ModellingHypothesis10HypothesisE2EdLb0EEE
000000000000fb68 d _ZTIN4tfel8material25ElasticityIntegrationDataILNS0_19ModellingHypothesis10HypothesisE4EdLb0EEE
000000000000fba8 d _ZTIN4tfel8material25ElasticityIntegrationDataILNS0_19ModellingHypothesis10HypothesisE6EdLb0EEE
                 U _ZTIN4tfel9exception13TFELExceptionE
                 U _ZTIN6abaqus15AbaqusExceptionE
                 U _ZTISt13runtime_error@GLIBCXX_3.4
                 U _ZTISt9exception@GLIBCXX_3.4
000000000000c540 r _ZTSN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EEE
000000000000c640 r _ZTSN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EEE
000000000000c740 r _ZTSN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EEE
000000000000c4a0 r _ZTSN4tfel8material19MechanicalBehaviourILNS0_23MechanicalBehaviourBase13BehaviourTypeE1ELNS0_19ModellingHypothesis10HypothesisE2EdLb0EEE
000000000000c5a0 r _ZTSN4tfel8material19MechanicalBehaviourILNS0_23MechanicalBehaviourBase13BehaviourTypeE1ELNS0_19ModellingHypothesis10HypothesisE4EdLb0EEE
000000000000c6a0 r _ZTSN4tfel8material19MechanicalBehaviourILNS0_23MechanicalBehaviourBase13BehaviourTypeE1ELNS0_19ModellingHypothesis10HypothesisE6EdLb0EEE
000000000000c340 r _ZTSN4tfel8material21TangentOperatorTraitsILNS0_23MechanicalBehaviourBase13BehaviourTypeE1EEE
000000000000c220 r _ZTSN4tfel8material23ElasticityBehaviourDataILNS0_19ModellingHypothesis10HypothesisE2EdLb0EEE
000000000000c2e0 r _ZTSN4tfel8material23ElasticityBehaviourDataILNS0_19ModellingHypothesis10HypothesisE4EdLb0EEE
000000000000c3a0 r _ZTSN4tfel8material23ElasticityBehaviourDataILNS0_19ModellingHypothesis10HypothesisE6EdLb0EEE
000000000000c460 r _ZTSN4tfel8material23MechanicalBehaviourBaseE
000000000000c1c0 r _ZTSN4tfel8material25ElasticityIntegrationDataILNS0_19ModellingHypothesis10HypothesisE2EdLb0EEE
000000000000c280 r _ZTSN4tfel8material25ElasticityIntegrationDataILNS0_19ModellingHypothesis10HypothesisE4EdLb0EEE
000000000000c400 r _ZTSN4tfel8material25ElasticityIntegrationDataILNS0_19ModellingHypothesis10HypothesisE6EdLb0EEE
                 U _ZTTNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEE@GLIBCXX_3.4.21
                 U _ZTTSt14basic_ifstreamIcSt11char_traitsIcEE@GLIBCXX_3.4
                 U _ZTVN10__cxxabiv117__class_type_infoE@CXXABI_1.3
                 U _ZTVN10__cxxabiv121__vmi_class_type_infoE@CXXABI_1.3
000000000000fa70 d _ZTVN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE2EdLb0EEE
000000000000fab8 d _ZTVN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE4EdLb0EEE
000000000000fb00 d _ZTVN4tfel8material10ElasticityILNS0_19ModellingHypothesis10HypothesisE6EdLb0EEE
                 U _ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE@GLIBCXX_3.4.21
                 U _ZTVNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEE@GLIBCXX_3.4.21
                 U _ZTVSt13basic_filebufIcSt11char_traitsIcEE@GLIBCXX_3.4
                 U _ZTVSt14basic_ifstreamIcSt11char_traitsIcEE@GLIBCXX_3.4
                 U _ZTVSt15basic_streambufIcSt11char_traitsIcEE@GLIBCXX_3.4
                 U _ZTVSt9basic_iosIcSt11char_traitsIcEE@GLIBCXX_3.4
000000000001020c d _ZZL31ELASTICITY_getOutOfBoundsPolicyvE6policy
0000000000007770 t _ZZN4tfel8material31ElasticityParametersInitializer14readParametersERS1_PKcENKUlbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE0_clEbSC_
0000000000004574 t _ZZN4tfel8material31ElasticityParametersInitializer14readParametersERS1_PKcENKUlbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE0_clEbSC_.cold
0000000000010360 b _ZZN4tfel8material31ElasticityParametersInitializer3getEvE1i
000000000000cbe0 u _ZZNSt8__detail18__to_chars_10_implImEEvPcjT_E8__digits
                 U _ZdlPvm@CXXABI_1.3.9
                 U _Znwm@GLIBCXX_3.4
000000000000da20 r __FRAME_END__
000000000000cd20 r __GNU_EH_FRAME_HDR
00000000000102f8 d __TMC_END__
                 U __cxa_allocate_exception@CXXABI_1.3
                 U __cxa_atexit@GLIBC_2.2.5
                 U __cxa_begin_catch@CXXABI_1.3
                 U __cxa_end_catch@CXXABI_1.3
                 w __cxa_finalize@GLIBC_2.2.5
                 U __cxa_guard_abort@CXXABI_1.3
                 U __cxa_guard_acquire@CXXABI_1.3
                 U __cxa_guard_release@CXXABI_1.3
                 U __cxa_rethrow@CXXABI_1.3
                 U __cxa_throw@CXXABI_1.3
00000000000048e0 t __do_global_dtors_aux
000000000000fa68 d __do_global_dtors_aux_fini_array_entry
00000000000101d0 d __dso_handle
000000000000fa50 d __frame_dummy_init_array_entry
                 w __gmon_start__
                 U __gxx_personality_v0@CXXABI_1.3
000000000000b25c t _fini
0000000000004000 t _init
0000000000010300 b completed.0
0000000000004870 t deregister_tm_clones
0000000000004920 t frame_dummy
                 U memcmp@GLIBC_2.2.5
                 U memcpy@GLIBC_2.14
                 U memmove@GLIBC_2.2.5
                 U memset@GLIBC_2.2.5
00000000000048a0 t register_tm_clones
                 U strcmp@GLIBC_2.2.5
                 U strlen@GLIBC_2.2.5

As can be seen, the names of the functions (at the top of the output) are those indicated by MFront.

With the method of renaming functions that I indicated in my first message, the output is:

[...]
000000000000b25c t _fini
0000000000004000 t _init
0000000000010300 b completed.0
0000000000004870 t deregister_tm_clones
0000000000004c00 T elasticity_pstrain
0000000000004920 t frame_dummy
                 U memcmp@GLIBC_2.2.5
                 U memcpy@GLIBC_2.14
                 U memmove@GLIBC_2.2.5
                 U memset@GLIBC_2.2.5
00000000000048a0 t register_tm_clones
                 U strcmp@GLIBC_2.2.5
                 U strlen@GLIBC_2.2.5

So elasticity_pstrain was indeed renamed (here it does not have the underscore as I did some more testing).

Do you have any idea of what could be happening? I am using the Abaqus/Standard UMAT interface...
If you want to test things locally, I can gladly lend you a hand with MFront :)

@Irvise
Copy link
Contributor Author

Irvise commented Aug 28, 2024

Just as a quick update. I wanted to see what a compiled UMAT would generate, so I checked one out from when I ran the tests:

Apptainer> pwd
/home/fernando/Build/Apptainer/Testing-no-account/home/ElmerFEM/tests/UMAT_StVenant_2D
Apptainer> nm MyUMAT.so
0000000000005df8 d _DYNAMIC
0000000000005fe8 d _GLOBAL_OFFSET_TABLE_
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
0000000000004120 r __FRAME_END__
0000000000004050 r __GNU_EH_FRAME_HDR
0000000000006020 d __TMC_END__
                 w __cxa_finalize@GLIBC_2.2.5
00000000000010e0 t __do_global_dtors_aux
0000000000005df0 d __do_global_dtors_aux_fini_array_entry
0000000000006018 d __dso_handle
0000000000005de8 d __frame_dummy_init_array_entry
                 w __gmon_start__
0000000000004050 r __offload_func_table
0000000000004050 r __offload_funcs_end
0000000000004050 r __offload_var_table
0000000000004050 r __offload_vars_end
0000000000003bc0 t _fini
0000000000001000 t _init
0000000000006020 b completed.0
0000000000001070 t deregister_tm_clones
0000000000001120 t frame_dummy
                 U free@GLIBC_2.2.5
                 U malloc@GLIBC_2.2.5
                 U memset@GLIBC_2.2.5
00000000000010a0 t register_tm_clones
0000000000001130 T stvenant_kirchhoff_

As it can be seen, the stvenant_kirchoff_ function is present there. A couple of things that may be relevant:

  1. It is in lowercase letters
  2. It does have a trailing underscore
  3. It is the only T procedure in the entire binary (I believe this is important)
  4. It is at the end of the binary (highest address space)

The combination of points 3. and 4. make me think that the loading mechanism in ElmerFEM may be expecting the procedure to be the only one in the file or for it to be at the end. This is not true with MFront and it was not true even when I renamed the material law to be the symbol that ElmerFEM wanted. That would explain why, even with the name corrected, it could still not "find" the material law that I had created.

Any opinion on this? @mmalinen

@mmalinen
Copy link
Contributor

When seeking for procedures, Elmer has used Fortran mangling so that a symbol name has been expected to be in lower case letters and to be appended with one underscore. If you update the Elmer code to get a fresh devel version, Elmer should also perform another attempt to locate the subroutine so that no name mangling is applied in the second try. That is, the symbol name sought should then be as given in the sif file.

I think that having several symbols as defined in the code section doesn't cause a trouble. If I add another subroutine (test_add) so that nm says

...
0000000000000747 T stvenant_kirchhoff_
0000000000000729 T test_add_
...

loading stvenant_kirchhoff is still successful. On the other hand it seems that applying renaming as

objcopy --redefine-sym stvenant_kirchhoff_=stvenant_kirchhoff2_ testobj.so

is somehow problematic. If I apply this and then change the sif file so that stvenant_kirchhoff2 is sought instead, Elmer halts with

Load: FATAL: Can't find procedure [stvenant_kirchhoff2]

Actually Elmer can still find the procedure with its original name, although nm displays

0000000000000747 T stvenant_kirchhoff2_
0000000000000729 T test_add_

Anyhow I suggest that you try to use the new devel version so that no attempt to rename might be needed.

@Irvise
Copy link
Contributor Author

Irvise commented Aug 31, 2024

I have just rebuilt ElmerFEM. It is still not working...
Here is what I get:

000000000000d330 b completed.0
0000000000004890 t deregister_tm_clones
0000000000004c40 T elasticity_pstrain_
0000000000004940 t frame_dummy
                 U memcpy@GLIBC_2.14
00000000000048c0 t register_tm_clones
                 U strcmp@GLIBC_2.2.5
                 U strlen@GLIBC_2.2.5
Apptainer> ElmerSolver
ELMER SOLVER (v 9.0) STARTED AT: 2024/08/31 20:04:41
Authorization required, but no authorization protocol specified

ParCommInit:  Initialize #PEs:            1
MAIN: OMP_NUM_THREADS not set. Using only 1 thread per task.
MAIN: 
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email [email protected]
MAIN: Version: 9.0 (Rev: 681cf81, Compiled: 2024-08-31)
MAIN:  Running one task without MPI parallelization.
MAIN:  Running with just one thread per task.
MAIN:  HYPRE library linked in.
MAIN:  Trilinos library linked in.
MAIN:  MUMPS library linked in.
MAIN:  MMG library linked in.
MAIN:  Lua interpreter linked in.
MAIN: =============================================================
MAIN: 
MAIN: 
MAIN: -------------------------------------
MAIN: Reading Model: elasticity.sif
LoadInputFile: Scanning input file: elasticity.sif
LoadInputFile: Scanning only size info
LoadInputFile: First time visiting
LoadInputFile: Reading base load of sif file
LoadInputFile: Loading input file: elasticity.sif
LoadInputFile: Reading base load of sif file
LoadInputFile: Number of BCs: 2
LoadInputFile: Number of Body Forces: 1
LoadInputFile: Number of Initial Conditions: 0
LoadInputFile: Number of Materials: 1
LoadInputFile: Number of Equations: 1
LoadInputFile: Number of Solvers: 1
LoadInputFile: Number of Bodies: 1
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by area
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by volume
ElmerAsciiMesh: Base mesh name: ./beam
LoadMesh: Elapsed REAL time:     0.0009 (s)
MAIN: -------------------------------------
OptimizeBandwidth: Initial bandwidth for elasticity solver: 21
OptimizeBandwidth: Optimized bandwidth for elasticity solver: 33
OptimizeBandwidth: Bandwidth optimization rejected, using original ordering.
MAIN: Number of timesteps to be saved: 2
MAIN: 
MAIN: -------------------------------------
MAIN: Time: 1/2:   1.000E+00
MAIN: -------------------------------------
MAIN: 
ElasticSolver: ----------------------------------
ElasticSolver: Starting Elasticity Solver
ElasticSolver: Could not find variable "UmatState", assuming no state variable!
ElasticSolver: -------------------------------------
ElasticSolver: ELASTICITY ITERATION 1
ElasticSolver: -------------------------------------
Load: FATAL: Can't find procedure [elasticity_pstrain_]
Apptainer> 

The first bit is just the output of nm libABAQUSBEHAVIOUR.so which had the procedure renamed to what Elmer's input expects. I checked that Elmer is indeed using/finding the correct library file by passing it an incorrect library name, which proceeded to generate

ElasticSolver: -------------------------------------
libABAQUSBEHAVIOURsosos: cannot open shared object file: No such file or directory
libABAQUSBEHAVIOURsosos.so: cannot open shared object file: No such file or directory
./libABAQUSBEHAVIOURsosos: cannot open shared object file: No such file or directory
./libABAQUSBEHAVIOURsosos.so: cannot open shared object file: No such file or directory
/opt/elmer/lib/libABAQUSBEHAVIOURsosos: cannot open shared object file: No such file or directory
/opt/elmer/lib/libABAQUSBEHAVIOURsosos.so: cannot open shared object file: No such file or directory

I have also seen that elmerf90 is broken... Here is the output when I run it without any input:

Apptainer> elmerf90
with elmerice
with MMG
/opt/elmer/bin/elmerf90: 42: test: =: unexpected operator
/usr/bin/f95 -fopenmp -fallow-argument-mismatch -DHAVE_TRILINOS -DHAVE_NETCDF -DHAVE_MMG -DHAVE_PARMETIS -DCONTIG= -DHAVE_EXECUTECOMMANDLINE -DUSE_ISO_C_BINDINGS -DUSE_ARPACK -O3 -DNDEBUG -O3 -fPIC -shared -I/opt/elmer/lib/../include -L/opt/elmer/lib -Xlinker -rpath=/opt/elmer/lib/../../share/elmersolver/lib /opt/elmer/lib/../../share/elmersolver/lib/ElmerIceSolvers.so /opt/elmer/lib/../../share/elmersolver/lib/ElmerIceUSF.so -I/usr/local/include -L/usr/local/lib -shared -lelmersolver 
/usr/bin/ld: cannot find /opt/elmer/lib/../../share/elmersolver/lib/ElmerIceSolvers.so: No such file or directory
/usr/bin/ld: cannot find /opt/elmer/lib/../../share/elmersolver/lib/ElmerIceUSF.so: No such file or directory
/usr/bin/ld: cannot find -lelmersolver: No such file or directory
collect2: error: ld returned 1 exit status
Apptainer>

It seems the library paths are all messed up! Maybe this is an indication of another issue... Probably in the configuration/CMake step...

The Apptainer file I used to build the entire setup:

BootStrap: docker
From: debian:12

%environment
   export LC_ALL=C
   export PATH=/opt/elmer/bin:$PATH
   export ELMER_HOME=/opt/elmer
   export ELMER_LIB=/opt/elmer/lib
   export ELMER_SOLVER_LIB=/opt/elmer/share/elmersolver/lib/
   export MFRONT_LIB=/usr/local/lib
   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ELMER_LIB:$ELMER_SOLVER_LIB:$MFRONT_LIB

%post
   # Install only what is asked
   export APT_OPTIONS="-y --no-install-recommends"
   apt $APT_OPTIONS update

   # Install build tools
   apt $APT_OPTIONS install build-essential gfortran cmake g++ python3 
   # Install download tools
   apt $APT_OPTIONS install git wget
   # Install general set of requirements
   apt $APT_OPTIONS install zlib1g zlib1g-dev libxml2 libxml2-dev python3-scipy python3-pip python3-numpy python3-setuptools

   # Install parallel processing libraries
   apt $APT_OPTIONS install libopenmpi-dev python3-mpi4py openmpi-bin
   # Install required scientific libraries
   apt $APT_OPTIONS install libopenblas64-openmp-dev liblapack64-dev libnetcdff-dev libnetcdf-dev netcdf-bin libnetcdf-c++4-dev libcgns-dev libhdf5-openmpi-dev libscotchparmetis-dev libptscotch-dev libmumps64-ptscotch-dev petsc64-dev libhypre64-dev trilinos-all-dev libsuitesparse-dev libumfpack5 libparpack2-dev metis libmetis-dev
   # Install graphical libraries
   apt $APT_OPTIONS install libqwt-qt5-dev libqt5opengl5-dev qtscript5-dev libqt5svg5-dev occt-misc libocct-data-exchange-dev libocct-draw-dev
   # libvtk9-qt-dev should be added for VTK support, but for whatever reason, during build time, ld cannot find the symbols and fails...
   # Install extra tools
   apt $APT_OPTIONS install lua5.3
   # Install general tools
   apt $APT_OPTIONS install vim less

   # Install build dependencies for MFront
   apt $APT_OPTIONS install libboost-all-dev

   #TODO CHECK WHY ELMERFEM IS NOT INSTALLING THE /INCLUDE/ LIBRARIES! (REQUIRED BY ELMERF90)
   # ALSO, HDF5 AND NETCDF ARE NOT BEING PROPERLY PICKED UP BY THE PROGRAM. I NEED TO MAKE THEIR VARIABLES EXPLICIT...

   #################################################
   # Start build
   #################################################

   export BASE_PREFIX=/opt/elmer
   export ELMER_HOME=$BASE_PREFIX
   
   mkdir -p $BASE_PREFIX

   cd $HOME

   ## Build MMG
   git clone --depth=1 https://github.com/MmgTools/mmg
   cd mmg
   mkdir build
   cd build
   # Fix -fPIC behaviour
   export CFLAGS=-fPIC
   export CXXFLAGS=-fPIC
   cmake -DUSE_SCOTCH=ON \
   -DLIBMMG3D_SHARED=ON \
   ..
   make -j$(nproc)
   make install -j$(nproc)
   # Clean flags
   export CFLAGS=""
   export CXXFLAGS=""
   
   ## Build MFront

   cd $HOME
   # Clone
   git clone https://github.com/thelfer/tfel --depth=1 --branch TFEL-4.2.1
   cd tfel
   mkdir build
   cd build
   cmake .. -DCMAKE_BUILD_TYPE=Release \
   -Denable-fortran=ON \
   -Denable-aster=ON \
   -Denable-abaqus=ON \
   -Denable-lsdyna=ON \
   -Denable-python=ON \
   -Denable-testing=ON \
   -Denable-python-bindings=ON \
   -Denable-numpy-support=ON \
   -Denable-calculix=ON \
   -DCMAKE_INSTALL_PREFIX=/usr/local

   make -j$(nproc)
#   make -j$(nproc) check || true
   make -j$(nproc) install

   ## Build ElmerFEM

   cd $HOME
   # Clone
   git clone https://github.com/ElmerCSC/elmerfem.git --depth=1

   # Configure step
   mkdir build
   cd build
   cmake -Wno-dev \
   -DCREATE_PKGCONFIG_FILE=ON \
   -DWITH_QT5=TRUE -DWITH_ELMERGUI=TRUE -DWITH_QWT=TRUE \
   -DWITH_ElmerIce=TRUE \
   -DWITH_MPI=TRUE \
   -DMPI_TEST_MAXPROC=$(nproc) \
   -DMPIEXEC_PREFLAGS="--allow-run-as-root" \
   -DWITH_OpenMP=TRUE \
   -DParMetis_INCLUDE_DIR=/usr/include/parmetis \
   -DWITH_Mumps=TRUE \
   -DMumps_LIBRARIES=/usr/lib/x86_64-linux-gnu/libmumps_common_64.so \
   -DWITH_Hypre=TRUE \
   -DHypre_INCLUDE_DIR=/usr/include/hypre64 \
   -DHypre_LIBRARIES=/usr/lib/x86_64-linux-gnu/libHYPRE64.so \
   -DWITH_Trilinos=TRUE \
   -DWITH_MATC=TRUE \
   -DWITH_LUA=TRUE \
   -DWITH_Zoltan=OFF \
   -DWITH_MMG=TRUE \
   -DEXTERNAL_UMFPACK=ON \
   -DUMFPACK_INCLUDE_DIR=/usr/include/suitesparse \
   -DUMFPACK_LIBRARIES=/usr/lib/x86_64-linux-gnu/libumfpack.so.5 \
   -DWITH_PARAVIEW=ON \
   -DWITH_VTK=OFF \
   -DWITH_NETCDF=ON \
   -DNetCDF_DIR=/usr/lib/x86_64-linux-gnu/cmake/netCDF \
   -DNetCDF_INCLUDE_DIR=/usr/include/ \
   -DNetCDF_LIBRARY= /usr/lib/x86_64-linux-gnu/libnetcdf.so.19 \
   -DNetCDFF_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdff.so.7 \
   -DWITH_HDF5=ON \
   -DHDF5_INCLUDE_DIR=/usr/include/hdf5/openmpi \
   -DHDF5_LIBRARY=/usr/lib/x86_64-linux-gnu/libhdf5_openmpi.so.103 \
   -DHDF5F_LIBRARY=/usr/lib/x86_64-linux-gnu/libhdf5_openmpi_fortran.so.102 \
   -DCMAKE_INSTALL_PREFIX="$BASE_PREFIX" \
   -DCMAKE_BUILD_TYPE=Release \
   ../elmerfem

   # Build and Install
   cmake --build . -j$(nproc)
   cmake --install .
   ctest . -j$(nproc) || true

%runscript
   /opt/elmer/bin/ElmerGUI

%labels
   Author Fernando Oleo Blanco

%help
   This file was created with the help of http://www.elmerfem.org/forum/viewtopic.php?p=28018#p28018

Do you have any ideas/input on what may be wrong here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants