use of artisynth.core.materials.IncompNeoHookeanMaterial in project artisynth_core by artisynth.
the class SinglePyramid method build.
public void build(String[] args) {
mod = new FemModel3d();
double[] coords = new double[] { -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, +0, 0, 1 };
FemNode3d[] nodes = new FemNode3d[5];
for (int i = 0; i < 5; i++) {
nodes[i] = new FemNode3d(coords[i * 3], coords[i * 3 + 1], coords[i * 3 + 2]);
mod.addNode(nodes[i]);
}
PyramidElement pyramid = new PyramidElement(nodes[0], nodes[1], nodes[2], nodes[3], nodes[4]);
mod.addElement(pyramid);
// FemNode3d dummy = new FemNode3d(0.0, 0.5, 0.01);
// dummy.setDynamic(false);
// mod.addNode(dummy);
mod.setSurfaceRendering(SurfaceRender.Shaded);
RenderProps.setShading(mod, Renderer.Shading.FLAT);
RenderProps.setFaceColor(mod, Color.PINK);
RenderProps.setShininess(mod, mod.getRenderProps().getShininess() * 10);
RenderProps.setVisible(mod, true);
RenderProps.setFaceStyle(mod, Renderer.FaceStyle.FRONT);
MechModel mechMod = new MechModel("mech");
mechMod.addModel(mod);
addModel(mechMod);
RenderProps.setPointStyle(mod, Renderer.PointStyle.SPHERE);
RenderProps.setPointRadius(mod, 0.05);
mod.setGravity(0, 0, -9.8);
// mod.setGravity (0, 0, 0);
LinearMaterial linMat = new LinearMaterial();
IncompNeoHookeanMaterial inhMat = new IncompNeoHookeanMaterial();
inhMat.setBulkModulus(30000);
inhMat.setShearModulus(3000);
// mod.setMaterial (new StVenantKirchoffMaterial());
// mod.setMaterial (new NeoHookeanMaterial());
mod.setMaterial(inhMat);
// mod.setMaterial (linMat);
mod.setDensity(1000);
// FemMarker mkr = new FemMarker (0, -1, 0);
// mod.addMarker (mkr, mod.findContainingElement (mkr.getPosition()));
nodes[0].setDynamic(false);
nodes[1].setDynamic(false);
nodes[3].setDynamic(false);
createControlPanel(mod);
System.out.println("gravity weights=" + pyramid.computeGravityWeights().toString("%8.3f"));
}
use of artisynth.core.materials.IncompNeoHookeanMaterial in project artisynth_core by artisynth.
the class SingleWedge method build.
public void build(String[] args) {
mod = new FemModel3d();
double[] coords = new double[] { -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1 };
FemNode3d[] nodes = new FemNode3d[6];
for (int i = 0; i < 6; i++) {
nodes[i] = new FemNode3d(coords[i * 3], coords[i * 3 + 1], coords[i * 3 + 2]);
mod.addNode(nodes[i]);
}
WedgeElement wedge = new WedgeElement(nodes[0], nodes[1], nodes[2], nodes[3], nodes[4], nodes[5]);
mod.addElement(wedge);
// FemNode3d dummy = new FemNode3d(0.0, 0.5, 0.01);
// dummy.setDynamic(false);
// mod.addNode(dummy);
mod.setSurfaceRendering(SurfaceRender.Shaded);
RenderProps.setShading(mod, Renderer.Shading.FLAT);
RenderProps.setFaceColor(mod, Color.PINK);
RenderProps.setShininess(mod, mod.getRenderProps().getShininess() * 10);
RenderProps.setVisible(mod, true);
RenderProps.setFaceStyle(mod, Renderer.FaceStyle.FRONT);
MechModel mechMod = new MechModel("mech");
mechMod.addModel(mod);
addModel(mechMod);
RenderProps.setPointStyle(mod, Renderer.PointStyle.SPHERE);
RenderProps.setPointRadius(mod, 0.05);
mod.setGravity(0, 0, -9.8);
// mod.setGravity (0, 0, 0);
LinearMaterial linMat = new LinearMaterial();
IncompNeoHookeanMaterial inhMat = new IncompNeoHookeanMaterial();
inhMat.setBulkModulus(30000);
inhMat.setShearModulus(3000);
// mod.setMaterial (new StVenantKirchoffMaterial());
// mod.setMaterial (new NeoHookeanMaterial());
mod.setMaterial(inhMat);
// mod.setMaterial (linMat);
mod.setDensity(1000);
// FemMarker mkr = new FemMarker (0, -1, 0);
// mod.addMarker (mkr, mod.findContainingElement (mkr.getPosition()));
nodes[0].setDynamic(false);
nodes[1].setDynamic(false);
nodes[3].setDynamic(false);
nodes[4].setDynamic(false);
createControlPanel(mod);
System.out.println("gravity weights=" + wedge.computeGravityWeights().toString("%8.3f"));
}
use of artisynth.core.materials.IncompNeoHookeanMaterial in project artisynth_core by artisynth.
the class SingleHex method build.
public void build(String[] args) {
mod = new FemModel3d();
double[] coords = new double[] { -2, -2, -2, 2, -2, -2, -2, 2, -2, 2, 2, -2, -2, -2, 2, 2, -2, 2, -2, 2, 2, 2, 2, 2 };
FemNode3d[] nodes = new FemNode3d[8];
for (int i = 0; i < 8; i++) {
nodes[i] = new FemNode3d(coords[i * 3], coords[i * 3 + 1], coords[i * 3 + 2]);
mod.addNode(nodes[i]);
}
HexElement hex = new HexElement(nodes[4], nodes[5], nodes[7], nodes[6], nodes[0], nodes[1], nodes[3], nodes[2]);
mod.addElement(hex);
// FemNode3d dummy = new FemNode3d(0.0, 0.5, 0.01);
// dummy.setDynamic(false);
// mod.addNode(dummy);
mod.setSurfaceRendering(SurfaceRender.Shaded);
RenderProps.setShading(mod, Renderer.Shading.FLAT);
RenderProps.setFaceColor(mod, Color.PINK);
RenderProps.setShininess(mod, mod.getRenderProps().getShininess() * 10);
RenderProps.setVisible(mod, true);
RenderProps.setFaceStyle(mod, Renderer.FaceStyle.FRONT);
mechMod = new MechModel("mech");
mechMod.addModel(mod);
mechMod.setIntegrator(MechSystemSolver.Integrator.ConstrainedBackwardEuler);
addModel(mechMod);
// addModel (mod);
RenderProps.setPointStyle(mod, Renderer.PointStyle.SPHERE);
RenderProps.setPointRadius(mod, 0.05);
mod.setGravity(0, 0, -9.8);
mod.setIncompressible(FemModel.IncompMethod.OFF);
// mod.setGravity (0, 0, -1);
LinearMaterial linMat = new LinearMaterial();
linMat.setYoungsModulus(1000);
linMat.setPoissonsRatio(0);
IncompNeoHookeanMaterial inhMat = new IncompNeoHookeanMaterial();
inhMat.setBulkModulus(30000);
inhMat.setShearModulus(3000);
MooneyRivlinMaterial monMat = new MooneyRivlinMaterial();
monMat.setBulkModulus(15000000);
monMat.setC10(150000);
monMat.setJLimit(0.2);
// mod.setMaterial (new StVenantKirchoffMaterial());
// mod.setMaterial (new NeoHookeanMaterial());
mod.setMaterial(monMat);
// mod.setMaterial (linMat);
mod.setDensity(10000);
// nodes[0].setDynamic(false);
// nodes[3].setDynamic(false);
FemMarker mkr = new FemMarker(0, -1, 0);
mod.addMarker(mkr, mod.findContainingElement(mkr.getPosition()));
if (true) {
// fix the top nodes
for (int i = 4; i < 8; i++) {
nodes[i].setDynamic(false);
}
}
if (false) {
// fix the side nodes
nodes[0].setDynamic(false);
nodes[2].setDynamic(false);
nodes[4].setDynamic(false);
nodes[6].setDynamic(false);
}
// nodes[1].setPosition (-0.40, -2.13, -5.86);
// nodes[5].setPosition (3.73, -2.02, -3.56);
// nodes[7].setPosition (3.73, 2.02, -3.56);
// nodes[3].setPosition (-0.40, 2.13, -5.86);
// set to invert elements
// nodes[1].setPosition (-3.001, -2, -2);
// nodes[5].setPosition (-3.001, -2, 2);
// nodes[7].setPosition (-3.001, 2, 2);
// nodes[3].setPosition (-3.001, 2, -2);
createControlPanel(mechMod, mod);
mod.setSoftIncompMethod(IncompMethod.AUTO);
SolveMatrixTest tester = new SolveMatrixTest();
// System.out.println ("error=" + tester.testStiffness (mod, 1e-8));
// System.out.println ("K=\n" + tester.getK().toString ("%10.1f"));
// System.out.println ("N=\n" + tester.getKnumeric().toString ("%10.1f"));
System.out.println("gravity weights=" + hex.computeGravityWeights().toString("%8.3f"));
}
Aggregations