by 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];
}