Search in sources :

Example 1 with Matrix6d

use of maspack.matrix.Matrix6d in project artisynth_core by artisynth.

the class LinearMaterialCache method addInitialStiffness.

/**
 * Computes and stores the initial stiffness K0 and force f0 terms
 * @param e   element
 * @param mat linear material
 */
public void addInitialStiffness(FemElement3d e, FemMaterial mat) {
    SolidDeformation def = new SolidDeformation();
    def.setAveragePressure(0);
    def.setF(Matrix3d.IDENTITY);
    def.setR(Matrix3d.IDENTITY);
    // compute stiffness matrix
    Matrix6d D = new Matrix6d();
    IntegrationPoint3d[] ipnts = e.getIntegrationPoints();
    IntegrationData3d[] idata = e.getIntegrationData();
    for (int k = 0; k < ipnts.length; k++) {
        IntegrationPoint3d pt = ipnts[k];
        IntegrationData3d dt = idata[k];
        double dv0 = dt.myDetJ0 * pt.getWeight();
        if (dt.myScaling != 1) {
            dv0 *= dt.myScaling;
        }
        Matrix3d Q = dt.myFrame == null ? Matrix3d.IDENTITY : dt.myFrame;
        Vector3d[] GNx0 = pt.updateShapeGradient(dt.myInvJ0);
        // compute tangent matrix under zero stress
        mat.computeTangent(D, SymmetricMatrix3d.ZERO, def, Q, null);
        FemNode3d[] nodes = e.getNodes();
        for (int i = 0; i < nodes.length; i++) {
            for (int j = 0; j < nodes.length; j++) {
                FemUtilities.addMaterialStiffness(K0[i][j], GNx0[i], D, GNx0[j], dv0);
            }
        }
    }
    // initial RHS
    Vector3d tmp = new Vector3d();
    FemNode3d[] nodes = e.getNodes();
    for (int i = 0; i < nodes.length; i++) {
        tmp.setZero();
        for (int j = 0; j < nodes.length; j++) {
            K0[i][j].mulAdd(tmp, nodes[j].getRestPosition(), tmp);
        }
        f0[i].set(tmp);
    }
}
Also used : Matrix6d(maspack.matrix.Matrix6d) SolidDeformation(artisynth.core.materials.SolidDeformation) SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) Matrix3d(maspack.matrix.Matrix3d) Vector3d(maspack.matrix.Vector3d)

Example 2 with Matrix6d

use of maspack.matrix.Matrix6d in project artisynth_core by artisynth.

the class LinearMaterialCache method addInitialStiffness.

/**
 * Computes and stores the initial stiffness K0 and force f0 terms
 * @param e   element
 * @param mat linear material
 */
public void addInitialStiffness(FemElement3d e, AuxiliaryMaterial mat) {
    SolidDeformation def = new SolidDeformation();
    def.setAveragePressure(0);
    def.setF(Matrix3d.IDENTITY);
    def.setR(Matrix3d.IDENTITY);
    // compute stiffness matrix
    Matrix6d D = new Matrix6d();
    IntegrationPoint3d[] ipnts = e.getIntegrationPoints();
    IntegrationData3d[] idata = e.getIntegrationData();
    for (int k = 0; k < ipnts.length; k++) {
        IntegrationPoint3d pt = ipnts[k];
        IntegrationData3d dt = idata[k];
        double dv0 = dt.myDetJ0 * pt.getWeight();
        if (dt.myScaling != 1) {
            dv0 *= dt.myScaling;
        }
        Vector3d[] GNx0 = pt.updateShapeGradient(dt.myInvJ0);
        // compute tangent matrix under zero stress
        mat.computeTangent(D, SymmetricMatrix3d.ZERO, def, pt, dt, null);
        FemNode3d[] nodes = e.getNodes();
        for (int i = 0; i < nodes.length; i++) {
            for (int j = 0; j < nodes.length; j++) {
                FemUtilities.addMaterialStiffness(K0[i][j], GNx0[i], D, GNx0[j], dv0);
            }
        }
    }
    // initial RHS
    Vector3d tmp = new Vector3d();
    FemNode3d[] nodes = e.getNodes();
    for (int i = 0; i < nodes.length; i++) {
        tmp.setZero();
        for (int j = 0; j < nodes.length; j++) {
            K0[i][j].mulAdd(tmp, nodes[j].getRestPosition(), tmp);
        }
        f0[i].set(tmp);
    }
}
Also used : SolidDeformation(artisynth.core.materials.SolidDeformation) Vector3d(maspack.matrix.Vector3d) Matrix6d(maspack.matrix.Matrix6d)

Example 3 with Matrix6d

use of maspack.matrix.Matrix6d in project artisynth_core by artisynth.

the class NeoHookeanMaterial method main.

public static void main(String[] args) {
    NeoHookeanMaterial mat = new NeoHookeanMaterial();
    SolidDeformation def = new SolidDeformation();
    Matrix3d Q = new Matrix3d();
    def.setF(new Matrix3d(1, 3, 5, 2, 1, 4, 6, 1, 2));
    Matrix6d D = new Matrix6d();
    SymmetricMatrix3d sig = new SymmetricMatrix3d();
    mat.setYoungsModulus(10);
    mat.computeStress(sig, def, Q, null);
    mat.computeTangent(D, sig, def, Q, null);
    System.out.println("sig=\n" + sig.toString("%12.6f"));
    System.out.println("D=\n" + D.toString("%12.6f"));
}
Also used : SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) Matrix3d(maspack.matrix.Matrix3d) SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) Matrix6d(maspack.matrix.Matrix6d)

Example 4 with Matrix6d

use of maspack.matrix.Matrix6d in project artisynth_core by artisynth.

the class OgdenMaterial method main.

public static void main(String[] args) {
    OgdenMaterial mat = new OgdenMaterial();
    SolidDeformation def = new SolidDeformation();
    Matrix3d Q = new Matrix3d();
    def.setF(new Matrix3d(1.1, 0.1, 0.2, 0.3, 0.8, 0.23, 0.3, 0.1, 1.5));
    Matrix6d D = new Matrix6d();
    SymmetricMatrix3d sig = new SymmetricMatrix3d();
    // double[] alpha = {2.0, 2.0, 2.0, 2.0, 2.0, 2.0};
    // double[] mu = {200.0, 0.0, 0.0, 0.0, 0.0, 0.0};
    mat.computeStress(sig, def, Q, null);
    System.out.println("sig=\n" + sig.toString("%12.6f"));
    mat.computeTangent(D, sig, def, Q, null);
    System.out.println("D=\n" + D.toString("%12.6f"));
}
Also used : SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) Matrix3d(maspack.matrix.Matrix3d) SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) Matrix6d(maspack.matrix.Matrix6d)

Example 5 with Matrix6d

use of maspack.matrix.Matrix6d in project artisynth_core by artisynth.

the class FungMaterial method main.

public static void main(String[] args) {
    FungMaterial mat = new FungMaterial();
    RotationMatrix3d R = new RotationMatrix3d();
    R.setRpy(1, 2, 3);
    SolidDeformation def = new SolidDeformation();
    Matrix3d Q = new Matrix3d();
    def.setF(new Matrix3d(1, 3, 5, 2, 1, 4, 6, 1, 2));
    Q.set(R);
    Matrix6d D = new Matrix6d();
    SymmetricMatrix3d sig = new SymmetricMatrix3d();
    // mat.computeStress (sig, pt, dt, null);
    // System.out.println ("sig=\n" + sig.toString ("%12.6f"));
    // mat.computeTangent (D, sig, pt, dt, null);
    // System.out.println ("D=\n" + D.toString ("%12.6f"));
    mat.computeStress(sig, def, Q, null);
    System.out.println("sig=\n" + sig.toString("%12.6f"));
    mat.computeTangent(D, sig, def, Q, null);
    System.out.println("D=\n" + D.toString("%12.6f"));
}
Also used : SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) RotationMatrix3d(maspack.matrix.RotationMatrix3d) Matrix3d(maspack.matrix.Matrix3d) SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) RotationMatrix3d(maspack.matrix.RotationMatrix3d) Matrix6d(maspack.matrix.Matrix6d)

Aggregations

Matrix6d (maspack.matrix.Matrix6d)23 Matrix3d (maspack.matrix.Matrix3d)15 SymmetricMatrix3d (maspack.matrix.SymmetricMatrix3d)13 Vector3d (maspack.matrix.Vector3d)8 RotationMatrix3d (maspack.matrix.RotationMatrix3d)7 SolidDeformation (artisynth.core.materials.SolidDeformation)4 RigidTransform3d (maspack.matrix.RigidTransform3d)3 FrameMaterial (artisynth.core.materials.FrameMaterial)2 RotAxisFrameMaterial (artisynth.core.materials.RotAxisFrameMaterial)2 Point (artisynth.core.mechmodels.Point)2 Matrix6dBlock (maspack.matrix.Matrix6dBlock)2 VectorNd (maspack.matrix.VectorNd)2 IntegrationData3d (artisynth.core.femmodels.IntegrationData3d)1 IntegrationPoint3d (artisynth.core.femmodels.IntegrationPoint3d)1 FemMaterial (artisynth.core.materials.FemMaterial)1 IncompressibleMaterial (artisynth.core.materials.IncompressibleMaterial)1 ViscoelasticBehavior (artisynth.core.materials.ViscoelasticBehavior)1 ViscoelasticState (artisynth.core.materials.ViscoelasticState)1 StringReader (java.io.StringReader)1 CholeskyDecomposition (maspack.matrix.CholeskyDecomposition)1