64 FreeLibrary( ( HMODULE ) this->
umatobj);
85 strncpy(this->
cmname, umatname.c_str(), 79);
95 DWORD dlresult = GetLastError();
100 * ( FARPROC * ) ( & this->
umat ) = GetProcAddress( ( HMODULE ) this->
umatobj,
"umat_");
103 DWORD dlresult = GetLastError();
104 OOFEM_ERROR(
"Couldn't load symbol umat,\nerror code: %d\n", dlresult);
108 this->umatobj = dlopen(
filename.c_str(), RTLD_NOW);
109 if ( !this->umatobj ) {
113 * (
void ** ) ( & this->
umat ) = dlsym(this->umatobj,
"umat_");
115 char *dlresult = dlerror();
117 OOFEM_ERROR(
"couldn't load symbol umat,\ndlerror: %s\n", dlresult);
144 return std::make_unique<AbaqusUserMaterialStatus>(gp, this->
numState);
152 if ( !ms->hasTangent() ) {
165 for (
int i = 1; i <= strain.
giveSize(); ++i ) {
170 stressh.
times(1.0 / h);
177 printf(
"Tangent = ");
178 answer.printYourself();
187 if ( !ms->hasTangent() ) {
189 const auto &vF = ms->giveTempFVector();
195 return ms->giveTempTangent();
208 auto const &vF = ms->giveTempFVector();
209 auto const &stress = ms->giveTempPVector();
211 for (
int i = 1; i <= 9; ++i ) {
215 auto ds = ( stressh - stress ) * ( 1. / h );
244 return dPdF3D({ 0, 1, 2, 5, 8 }, { 0, 1, 2, 5, 8 });
261 int ntens = ndi + nshr;
264 auto strainIncrement = strain - old_strain;
265 auto state = ms->giveStateVector();
267 int numProperties = this->
properties.giveSize();
270 double temp = 0.0, dtemp = 0.0;
284 double sse, spd, scd;
336 auto abq_stress = old_stress [
abq2oo6 ];
337 auto abq_old_strain = old_strain [
abq2oo6 ];
338 auto abq_strainIncrement = strainIncrement [
abq2oo6 ];
342 OOFEM_LOG_DEBUG(
"AbaqusUserMaterial :: giveRealStressVector_3d - Calling subroutine");
343 this->
umat(abq_stress.givePointer(),
353 abq_old_strain.givePointer(),
354 abq_strainIncrement.givePointer(),
372 dfgrd0.givePointer(),
373 dfgrd1.givePointer(),
386 ms->letTempStrainVectorBe(strain);
387 ms->letTempStressVectorBe(stress);
388 ms->letTempStateVectorBe(state);
389 ms->letTempTangentBe(jacobian);
408 int ntens = ndi + nshr;
419 int numProperties = this->
properties.giveSize();
422 double temp = 0.0, dtemp = 0.0;
436 double sse, spd, scd;
489 auto abq_strain = strain [
abq2oo6 ];
490 auto abq_strainIncrement = strainIncrement [
abq2oo6 ];
492 OOFEM_LOG_DEBUG(
"AbaqusUserMaterial :: giveRealStressVector - Calling subroutine");
503 abq_strain.givePointer(),
504 abq_strainIncrement.givePointer(),
511 const_cast< char *
>( this->cmname ),
516 const_cast< double *
>(
properties.givePointer() ),
522 dfgrd0.givePointer(),
523 dfgrd1.givePointer(),
536 auto stress = abq_stress [
abq2oo9 ];
540 auto cauchyStress =
dotT(P, F) * ( 1. /
det(F) );
543 ms->letTempStrainVectorBe(strain);
544 ms->letTempStressVectorBe(vCauchyStress);
545 ms->letTempStateVectorBe(state);
546 ms->letTempTangentBe(jacobian);
547 ms->letTempPVectorBe(vP);
548 ms->letTempFVectorBe(vF);
552 auto vsigma = abq_stress [
abq2oo6 ];
555 auto P =
dot(F, sigma);
560 auto S =
dot(F_inv, P);
566 ms->letTempStrainVectorBe(strain);
567 ms->letTempStressVectorBe(vS);
568 ms->letTempStateVectorBe(state);
569 ms->letTempTangentBe(jacobian);
570 ms->letTempPVectorBe(vP);
571 ms->letTempFVectorBe(vF);
581 if ( type == IST_Undefined || type == IST_AbaqusStateVector ) {
583 answer = ms->giveStateVector();
585 }
else if ( type == IST_StressTensor ) {
586 answer = ms->giveStressVector();
620 fprintf(File,
" stateVector ");
622 for (
auto &var : state ) {
623 fprintf(File,
" % .4e", var);
#define _IFT_AbaqusUserMaterial_numericalTangentPerturbation
#define _IFT_AbaqusUserMaterial_properties
#define _IFT_AbaqusUserMaterial_numState
#define _IFT_AbaqusUserMaterial_numericalTangent
#define _IFT_AbaqusUserMaterial_userMaterial
#define _IFT_AbaqusUserMaterial_initialStress
#define _IFT_AbaqusUserMaterial_name
#define REGISTER_Material(class)
const FloatArray & giveStateVector() const
FloatArray stateVector
General state vector.
void initTempStatus() override
AbaqusUserMaterialStatus(GaussPoint *gp, int numState)
Constructor.
int numState
Number of state variables.
void updateYourself(TimeStep *tStep) override
bool hasTangentFlag
Checker to see if tangent has been computed.
const FloatMatrix & giveTempTangent()
FloatArray tempStateVector
Temporary state vector.
void printOutputAt(FILE *file, TimeStep *tStep) const override
Print receiver's output to given stream.
static std::size_t const abq2oo9[9]
void giveInputRecord(DynamicInputRecord &input) override
std::string filename
Name of the file that contains the umat function.
std::unique_ptr< MaterialStatus > CreateStatus(GaussPoint *gp) const override
AbaqusUserMaterial(int n, Domain *d)
Constructor.
void * umatobj
Dynamically loaded umat.
void(* umat)(double *stress, double *statev, double *ddsdde, double *sse, double *spd, double *scd, double *rpl, double *ddsddt, double *drplde, double *drpldt, double *stran, double *dstran, double time[2], double *dtime, double *temp, double *dtemp, double predef[1], double dpred[1], char cmname[80], int *ndi, int *nshr, int *ntens, int *nstatv, double *props, int *nprops, double coords[3], double *drot, double *pnewdt, double *celent, double *dfgrd0, double *dfgrd1, int *noel, int *npt, int *layer, int *kspt, int *kstep, int *kinc)
Pointer to the dynamically loaded umat-function (translated to C).
FloatArrayF< 6 > initialStress
Initial stress.
bool mUseNumericalTangent
char cmname[80]
Name for material routine.
FloatMatrixF< 5, 5 > givePlaneStrainStiffnessMatrix_dPdF(MatResponseMode mmode, GaussPoint *gp, TimeStep *tStep) const override
FloatMatrixF< 9, 9 > give3dMaterialStiffnessMatrix_dPdF(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const override
static std::size_t const abq2oo6[6]
virtual ~AbaqusUserMaterial()
Destructor.
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
int mStressInterpretation
FloatArrayF< 6 > giveRealStressVector_3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) const override
Default implementation relies on giveRealStressVector for second Piola-Kirchoff stress.
FloatArrayF< 9 > giveFirstPKStressVector_3d(const FloatArrayF< 9 > &vF, GaussPoint *gp, TimeStep *tStep) const override
Default implementation relies on giveRealStressVector for second Piola-Kirchoff stress.
FloatArray properties
Material properties.
FloatMatrixF< 6, 6 > give3dMaterialStiffnessMatrix(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const override
void initializeFrom(InputRecord &ir) override
int numState
Size of the state vector.
virtual int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords)
const double * givePointer() const
Index giveSize() const
Returns the size of receiver.
void add(const FloatArray &src)
const double * givePointer() const
void subtract(const FloatArray &src)
void setColumn(const FloatArrayF< N > &src, std::size_t c)
const double * givePointer() const
void setColumn(const FloatArray &src, int c)
*Prints matrix to stdout Useful for debugging void printYourself() const
const FloatArray & giveNaturalCoordinates() const
Returns coordinate array of receiver.
IntegrationPointStatus * giveMaterialStatus(IntegrationPointStatusIDType key=IPSID_Default)
Element * giveElement()
Returns corresponding element to receiver.
GaussPoint * gp
Associated integration point.
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
const FloatArray & giveTempStressVector() const
Returns the const pointer to receiver's temporary stress vector.
void initTempStatus() override
void printOutputAt(FILE *file, TimeStep *tStep) const override
Print receiver's output to given stream.
StructuralMaterialStatus(GaussPoint *g)
Constructor. Creates new StructuralMaterialStatus with IntegrationPoint g.
void updateYourself(TimeStep *tStep) override
const FloatArray & giveTempStrainVector() const
Returns the const pointer to receiver's temporary strain vector.
FloatArray strainVector
Equilibrated strain vector in reduced form.
void giveInputRecord(DynamicInputRecord &input) override
void initializeFrom(InputRecord &ir) override
StructuralMaterial(int n, Domain *d)
int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override
int giveMetaStepNumber()
Returns receiver's meta step number.
double giveTimeIncrement()
Returns solution step associated time increment.
double giveTargetTime()
Returns target time.
#define OOFEM_LOG_DEBUG(...)
FloatArrayF< 6 > to_voigt_stress_33(const FloatMatrixF< 3, 3 > &t)
FloatArrayF< 6 > to_voigt_strain_33(const FloatMatrixF< 3, 3 > &t)
FloatMatrixF< N, P > Tdot(const FloatMatrixF< M, N > &a, const FloatMatrixF< M, P > &b)
Computes .
FloatMatrixF< 3, 3 > from_voigt_form_9(const FloatArrayF< 9 > &v)
FloatMatrixF< N, P > dotT(const FloatMatrixF< N, M > &a, const FloatMatrixF< P, M > &b)
Computes .
FloatMatrixF< 3, 3 > from_voigt_stress_6(const FloatArrayF< 6 > &v)
double det(const FloatMatrixF< 2, 2 > &mat)
Computes the determinant.
FloatArrayF< 9 > to_voigt_form_33(const FloatMatrixF< 3, 3 > &t)
double dot(const FloatArray &x, const FloatArray &y)
FloatMatrixF< N, N > inv(const FloatMatrixF< N, N > &mat, double zeropiv=1e-24)
Computes the inverse.
FloatArrayF< N > zeros()
For more readable code.
FloatMatrixF< N, N > eye()
Constructs an identity matrix.