use of artisynth.core.materials.FemMaterial in project artisynth_core by artisynth.
the class FemModel3d method updateVolumeAndCheckForInversion.
/**
* Checks for inverted elements. The number of inverted elements is stored in
* myNumInverted. The minimum determinant, and the associated element, is
* stored in myMinDetJ and myMinDetJElement.
*/
private void updateVolumeAndCheckForInversion() {
// special implementation of updateVolume that checks for inverted
// Jacobians
double volume = 0;
myMinDetJ = Double.MAX_VALUE;
myMinDetJElement = null;
myNumInverted = 0;
for (FemElement3d e : getElements()) {
FemMaterial mat = getElementMaterial(e);
double detJ = e.computeVolumes();
e.setInverted(false);
if (!(mat.isLinear())) {
if (detJ < myMinDetJ) {
if (!e.materialsAreInvertible()) {
myMinDetJ = detJ;
myMinDetJElement = e;
}
}
if (detJ <= 0 && myCheckForInvertedElems) {
if (!e.materialsAreInvertible()) {
e.setInverted(true);
myNumInverted++;
}
}
}
volume += e.getVolume();
}
myVolume = volume;
myVolumeValid = true;
}
use of artisynth.core.materials.FemMaterial in project artisynth_core by artisynth.
the class FemModel3d method advanceAuxState.
public void advanceAuxState(double t0, double t1) {
for (int i = 0; i < myElements.size(); i++) {
FemElement3d e = myElements.get(i);
FemMaterial mat = getElementMaterial(e);
if (mat.getViscoBehavior() != null) {
ViscoelasticBehavior veb = mat.getViscoBehavior();
IntegrationData3d[] idata = e.getIntegrationData();
for (int k = 0; k < idata.length; k++) {
ViscoelasticState state = idata[k].getViscoState();
if (state == null) {
state = veb.createState();
idata[k].setViscoState(state);
}
veb.advanceState(state, t0, t1);
}
}
}
}
use of artisynth.core.materials.FemMaterial in project artisynth_core by artisynth.
the class FemModel3d method checkSolveMatrixIsSymmetric.
protected boolean checkSolveMatrixIsSymmetric() {
if (!myMaterial.hasSymmetricTangent()) {
return false;
}
for (int i = 0; i < myElements.size(); i++) {
FemElement3d e = myElements.get(i);
FemMaterial m = e.getMaterial();
if (m != null && !m.hasSymmetricTangent()) {
return false;
}
if (e.numAuxiliaryMaterials() > 0) {
for (AuxiliaryMaterial aux : e.myAuxMaterials) {
if (!aux.hasSymmetricTangent()) {
return false;
}
}
}
}
return true;
}
use of artisynth.core.materials.FemMaterial in project artisynth_core by artisynth.
the class FemModel3d method updateStress.
public void updateStress() {
// clear existing internal forces and maybe stiffnesses
timerStart();
for (FemNode3d n : myNodes) {
n.myInternalForce.setZero();
for (FemNodeNeighbor nbr : getNodeNeighbors(n)) {
nbr.zeroStiffness();
}
// used for soft nodal-based incompressibilty:
for (FemNodeNeighbor nbr : getIndirectNeighbors(n)) {
nbr.zeroStiffness();
}
if (myComputeNodalStress) {
n.zeroStress();
}
if (myComputeNodalStrain) {
n.zeroStrain();
}
}
if (!myVolumeValid) {
updateVolume();
}
IncompMethod softIncomp = getSoftIncompMethod();
if (myMaterial.isIncompressible() && softIncomp == IncompMethod.NODAL) {
updateNodalPressures((IncompressibleMaterial) myMaterial);
}
// myMinDetJ = Double.MAX_VALUE;
for (FemElement3d e : myElements) {
FemMaterial mat = getElementMaterial(e);
computeStressAndStiffness(e, mat, /* D= */
null, softIncomp);
}
myStressesValidP = true;
}
use of artisynth.core.materials.FemMaterial in project artisynth_core by artisynth.
the class FemElement3d method updateWarpingStiffness.
protected void updateWarpingStiffness() {
FemMaterial mat = getEffectiveMaterial();
if (myWarper == null) {
myWarper = createStiffnessWarper();
} else {
myWarper.initialize(this);
}
if (mat.isLinear()) {
myWarper.addInitialStiffness(this, mat);
}
for (AuxiliaryMaterial amat : getAuxiliaryMaterials()) {
if (amat.isLinear()) {
myWarper.addInitialStiffness(this, amat);
}
}
myWarpingStiffnessValidP = true;
}
Aggregations