use of artisynth.core.materials.LinearMaterial in project artisynth_core by artisynth.
the class FemMuscleStiffener method stiffenLinMat.
private void stiffenLinMat(FemElement elem, LinearMaterial restMat, double s) {
LinearMaterial linMat;
if (elem.getMaterial() != null && elem.getMaterial() instanceof LinearMaterial) {
linMat = (LinearMaterial) elem.getMaterial();
} else {
linMat = new LinearMaterial();
elem.setMaterial(linMat);
}
linMat.setYoungsModulus(((LinearMaterial) restMat).getYoungsModulus() * s);
}
use of artisynth.core.materials.LinearMaterial in project artisynth_core by artisynth.
the class LinearAuxiliaryTest method build.
@Override
public void build(String[] args) throws IOException {
super.build(args);
MechModel mech = new MechModel("mech");
addModel(mech);
double h = 0.1;
double r = 0.005;
LinearMaterial lmat = new LinearMaterial(50000, 0.45, true);
FemModel3d fem1 = createCylinder(h, r);
fem1.setName("auxiliary");
mech.addModel(fem1);
fem1.setMaterial(new NullMaterial());
AuxMaterialBundle bundle = new AuxMaterialBundle("mat");
for (FemElement3d elem : fem1.getElements()) {
bundle.addElement(new AuxMaterialElementDesc(elem));
}
fem1.addMaterialBundle(bundle);
bundle.setMaterial(lmat);
FemModel3d fem2 = createCylinder(h, r);
fem2.setName("linear");
fem2.setMaterial(lmat);
mech.addModel(fem2);
RigidTransform3d rot = new RigidTransform3d(Vector3d.ZERO, AxisAngle.ROT_Y_90);
fem1.transformGeometry(rot);
fem2.transformGeometry(rot);
fem2.transformGeometry(new RigidTransform3d(new Vector3d(0, 2 * r, 0), AxisAngle.IDENTITY));
RenderProps.setFaceColor(fem2, Color.MAGENTA);
addMonitor(new StiffnessErrorMonitor(fem1, fem2));
}
use of artisynth.core.materials.LinearMaterial 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.LinearMaterial 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.LinearMaterial in project artisynth_core by artisynth.
the class SelfCollision method build.
public void build(String[] args) {
build("hex", 1.0, 0.1, 10, 2, NO_FIXED_NODES);
try {
myFemMod.addMeshComp(myFemMod.scanMesh(ArtisynthIO.newReaderTokenizer(new StringReader(rightMeshString))));
myFemMod.addMeshComp(myFemMod.scanMesh(ArtisynthIO.newReaderTokenizer(new StringReader(leftMeshString))));
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
myMechMod.setCollisionBehavior(myFemMod, myFemMod, true);
myFemMod.setMaterial(new LinearMaterial(40000, 0.2));
// flair the ends so collision works properly
makeNodesCircularInYZ(-0.5, 0.03);
makeNodesCircularInYZ(-0.4, 0.07);
makeNodesCircularInYZ(-0.3, 0.05);
makeNodesCircularInYZ(0.3, 0.05);
makeNodesCircularInYZ(0.4, 0.07);
makeNodesCircularInYZ(0.5, 0.03);
myFemMod.resetRestPosition();
int[] fixedNodes = new int[] { 5, 38, 71, 82, 93, 60, 27, 16, 49 };
for (int i = 0; i < fixedNodes.length; i++) {
myFemMod.getNodes().getByNumber(fixedNodes[i]).setDynamic(false);
}
myFemMod.updateSlavePos();
}
Aggregations