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);
}
}
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);
}
}
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"));
}
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"));
}
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"));
}
Aggregations