Search in sources :

Example 1 with FemMaterial

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;
}
Also used : FemMaterial(artisynth.core.materials.FemMaterial)

Example 2 with FemMaterial

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);
            }
        }
    }
}
Also used : ViscoelasticState(artisynth.core.materials.ViscoelasticState) FemMaterial(artisynth.core.materials.FemMaterial) ViscoelasticBehavior(artisynth.core.materials.ViscoelasticBehavior) Point(artisynth.core.mechmodels.Point)

Example 3 with FemMaterial

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;
}
Also used : FemMaterial(artisynth.core.materials.FemMaterial) Point(artisynth.core.mechmodels.Point)

Example 4 with FemMaterial

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;
}
Also used : FemMaterial(artisynth.core.materials.FemMaterial)

Example 5 with FemMaterial

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;
}
Also used : FemMaterial(artisynth.core.materials.FemMaterial)

Aggregations

FemMaterial (artisynth.core.materials.FemMaterial)10 Point (artisynth.core.mechmodels.Point)4 Matrix3d (maspack.matrix.Matrix3d)2 SymmetricMatrix3d (maspack.matrix.SymmetricMatrix3d)2 FemElement3d (artisynth.core.femmodels.FemElement3d)1 FemMeshComp (artisynth.core.femmodels.FemMeshComp)1 FemMuscleModel (artisynth.core.femmodels.FemMuscleModel)1 MuscleBundle (artisynth.core.femmodels.MuscleBundle)1 LinearMaterial (artisynth.core.materials.LinearMaterial)1 MuscleMaterial (artisynth.core.materials.MuscleMaterial)1 SimpleForceMuscle (artisynth.core.materials.SimpleForceMuscle)1 ViscoelasticBehavior (artisynth.core.materials.ViscoelasticBehavior)1 ViscoelasticState (artisynth.core.materials.ViscoelasticState)1 MechModel (artisynth.core.mechmodels.MechModel)1 RigidBody (artisynth.core.mechmodels.RigidBody)1 Color (java.awt.Color)1 File (java.io.File)1 PolygonalMesh (maspack.geometry.PolygonalMesh)1 WavefrontReader (maspack.geometry.io.WavefrontReader)1 Matrix6d (maspack.matrix.Matrix6d)1