getStatevariable

Thermal, Aging, ASR, Creep and more.

getStatevariable

Postby rwendner » Fri Jul 29, 2016 10:44 am

How can we get the Statevariableindex inside the material subroutine of MFEM materials?
Is there a method like mat->getHexStateVariableIndex("Imposed Volumetric Strain Increment")?
rwendner
 
Posts: 154
Joined: Wed Jul 15, 2015 4:35 pm

Re: getStatevariable

Postby zhouxinwei » Fri Jul 29, 2016 4:37 pm

Yes.

getHexStateVariableIndex() is method of Material class. All MFEM materials are derived from Material class, so they can use a method from their parent class.
zhouxinwei
 
Posts: 208
Joined: Thu Jul 09, 2015 7:12 pm

Re: getStatevariable

Postby rwendner » Sat Jul 30, 2016 11:25 am

I tried using getHexStateVariableIndex("Imposed Volumetric Strain Increment") in the subroutine that evaluates the stresses instead of hardcoding the index but got error messages.
Can you please put a working example in the new mfem elastic material?
rwendner
 
Posts: 154
Joined: Wed Jul 15, 2015 4:35 pm

Re: getStatevariable

Postby zhouxinwei » Mon Aug 01, 2016 8:47 pm

Please post the code so we can see how it was used.
zhouxinwei
 
Posts: 208
Joined: Thu Jul 09, 2015 7:12 pm

Re: getStatevariable

Postby rwendner » Tue Aug 02, 2016 7:31 am

In the following script we need to extract the imposed volumetric strain increment for the stress analysis.
Since all SVs have labels anyway I would like to avoid hardcoding the indices.
This way we optimise the subroutine and only allocate the SVs we actually need, giving them a dynamic index based on the problem at hand.

void mtMElasticUD::calcStrsHx (real *hxv, real *stv) const {
//int iEVSI = type->getHexStateVariableIndex("Imposed Volumetric Strain Increment");
int iEVSI = 13; // in previous version: 7
real hin = lmbDt * (hxv[0] + hxv[1] + hxv[2]) - lmb * stv[iEVSI];
stv[0] += hin + twgDt*hxv[0] - twg * stv[iEVSI] / 3;
stv[1] += hin + twgDt*hxv[1] - twg * stv[iEVSI] / 3;
stv[2] += hin + twgDt*hxv[2] - twg * stv[iEVSI] / 3;
stv[3] += twgDt*hxv[3];
stv[4] += twgDt*hxv[4];
stv[5] += twgDt*hxv[5];
}
rwendner
 
Posts: 154
Joined: Wed Jul 15, 2015 4:35 pm

Re: getStatevariable

Postby zhouxinwei » Tue Aug 02, 2016 2:38 pm

Instead of calling getHexStateVariableIndex() repeatedly, it's better to declare iEVSI as a class member variable, and do "iEVSI = getHexStateVariableIndex("Imposed Volumetric Strain Increment");" in mtMElasticUD::init() to set its value and do some checks. This will also solve the compilation error regarding const method calling a non-const method.
zhouxinwei
 
Posts: 208
Joined: Thu Jul 09, 2015 7:12 pm

Re: getStatevariable

Postby rwendner » Tue Aug 02, 2016 2:42 pm

thanks for the confirmation!
that's what we meanwhile implemented, see gitlab
rwendner
 
Posts: 154
Joined: Wed Jul 15, 2015 4:35 pm


Return to Multiphysics FEM (M-FEM)

Who is online

Users browsing this forum: No registered users and 1 guest

cron