Search in sources :

Example 1 with MooneyRivlinMaterial

use of artisynth.core.materials.MooneyRivlinMaterial in project artisynth_core by artisynth.

the class FemMuscleStiffener method stiffenMRMat.

private void stiffenMRMat(FemElement elem, MooneyRivlinMaterial restMat, double s) {
    MooneyRivlinMaterial elemMat;
    if (elem.getMaterial() != null && elem.getMaterial() instanceof MooneyRivlinMaterial) {
        elemMat = (MooneyRivlinMaterial) elem.getMaterial();
    } else {
        elemMat = new MooneyRivlinMaterial();
        elem.setMaterial(elemMat);
    }
    elemMat.setC10(restMat.getC10() * s);
    elemMat.setC20(restMat.getC20() * s);
    elemMat.setBulkModulus(restMat.getBulkModulus() * s);
}
Also used : MooneyRivlinMaterial(artisynth.core.materials.MooneyRivlinMaterial)

Example 2 with MooneyRivlinMaterial

use of artisynth.core.materials.MooneyRivlinMaterial in project artisynth_core by artisynth.

the class FemMuscleDemo method initializeModel.

protected void initializeModel(int xn) throws IOException {
    double widthX = 0.09;
    double widthY = 0.03;
    double widthZ = 0.03;
    int numX = xn * 9;
    int numY = xn * 3;
    int numZ = xn * 3;
    tissue = new FemMuscleModel("fem");
    FemFactory.createHexGrid(tissue, widthX, widthY, widthZ, numX, numY, numZ);
    tissue.setBounds(new Point3d(-widthX, 0, 0), new Point3d(widthX, 0, 0));
    // XXX fix the leftmost nodes
    double EPS = 1e-9;
    double xmin = Double.POSITIVE_INFINITY;
    for (FemNode3d n : tissue.getNodes()) {
        if (n.getPosition().x < xmin) {
            xmin = n.getPosition().x;
        }
    }
    for (FemNode3d n : tissue.getNodes()) {
        if (Math.abs(n.getPosition().x - xmin) < 1e-10) {
            n.setDynamic(false);
        }
    }
    LinkedList<FemElement3d> topElems = new LinkedList<FemElement3d>();
    LinkedList<FemElement3d> midElems = new LinkedList<FemElement3d>();
    LinkedList<FemElement3d> botElems = new LinkedList<FemElement3d>();
    for (FemElement3d e : tissue.getElements()) {
        if (defaultMidElements == ALL) {
            midElems.add(e);
        }
        for (FemNode3d n : e.getNodes()) {
            if (Math.abs(n.getPosition().z - widthZ / 2) < EPS) {
                topElems.add(e);
                break;
            } else if (Math.abs(n.getPosition().z + widthZ / 2) < EPS) {
                botElems.add(e);
                break;
            } else if (defaultMidElements == MIDDLE && Math.abs(n.getPosition().z - widthZ / (2 * numZ)) < EPS) {
                midElems.add(e);
                break;
            }
        }
    }
    RenderProps.setLineWidth(tissue, 2);
    RenderProps.setLineColor(tissue, Color.PINK);
    RenderProps.setPointStyle(tissue, Renderer.PointStyle.SPHERE);
    RenderProps.setPointRadius(tissue, 0.03);
    RenderProps.setPointColor(tissue, Color.PINK);
    RenderProps.setFaceColor(tissue, Color.PINK.darker());
    GenericMuscle mm = new GenericMuscle();
    mm.setMaxStress(5000);
    BlemkerMuscle bm = new BlemkerMuscle();
    // bm.setMaxStress (5000);
    tissue.setMuscleMaterial(bm);
    MuscleBundle top, mid, bot;
    top = createBundle("top", topElems);
    mid = createBundle("mid", midElems);
    bot = createBundle("bot", botElems);
    int k = 0;
    setBundleRenderProps(top, getMuscleColor(k++));
    if (addMidMuscle) {
        setBundleRenderProps(mid, getMuscleColor(k++));
    }
    setBundleRenderProps(bot, getMuscleColor(k));
    tissue.addMuscleBundle(top);
    if (addMidMuscle) {
        tissue.addMuscleBundle(mid);
    }
    tissue.addMuscleBundle(bot);
    double qt = midQuadTerm;
    addStrand(top, -0.035, -0.005, 0.015, 0.035, -0.005, 0.015, 0, 8);
    addStrand(top, -0.035, 0.005, 0.015, 0.035, 0.005, 0.015, 0, 8);
    if (addMidMuscle) {
        addStrand(mid, -0.035, -0.005, 0.000, 0.035, -0.005, 0.000, qt, 8);
        addStrand(mid, -0.035, 0.005, 0.000, 0.035, 0.005, 0.000, qt, 8);
    }
    addStrand(bot, -0.035, -0.005, -0.015, 0.035, -0.005, -0.015, 0, 8);
    addStrand(bot, -0.035, 0.005, -0.015, 0.035, 0.005, -0.015, 0, 8);
    if (addMidMuscle) {
        if (addMidElementsWithin > 0) {
            mid.addElementsNearFibres(addMidElementsWithin);
        }
        if (autoComputeMidDirections) {
            mid.computeElementDirections();
        }
    }
    tissue.setDirectionRenderLen(0.5);
    RenderProps.setPointRadius(tissue, 0.001);
    tissue.setGravity(0, 0, 0);
    tissue.setDensity(1000);
    tissue.setMaterial(new MooneyRivlinMaterial(1037, 0, 0, 486, 0, 10000));
    // tissue.setPoissonsRatio (0.499);
    // tissue.setYoungsModulus (6912);
    tissue.setParticleDamping(6.22);
    // more stable with 0 stiffness damping ...
    tissue.setStiffnessDamping(0.01);
    // tissue.setMaxStepSize(100*TimeBase.USEC);
    tissue.setMaxStepSize(0.01);
    tissue.setIntegrator(Integrator.ConstrainedBackwardEuler);
    myModel.addModel(tissue);
    addModel(myModel);
    for (MuscleBundle b : tissue.getMuscleBundles()) {
        RenderProps.setVisible(b.getFibres(), false);
    }
    for (FemMarker m : tissue.markers()) {
        RenderProps.setVisible(m, false);
    }
    addProbes(tissue);
    createMusclePanel();
// int numWays = 20;
// double res = 0.1;
// for (int i = 0; i < numWays; i++) {
// addWayPoint (new WayPoint (TimeBase.secondsToTicks ((i + 1) * res)));
// }
}
Also used : FemElement3d(artisynth.core.femmodels.FemElement3d) MooneyRivlinMaterial(artisynth.core.materials.MooneyRivlinMaterial) BlemkerMuscle(artisynth.core.materials.BlemkerMuscle) FemMarker(artisynth.core.femmodels.FemMarker) Point(artisynth.core.mechmodels.Point) LinkedList(java.util.LinkedList) MuscleBundle(artisynth.core.femmodels.MuscleBundle) Point3d(maspack.matrix.Point3d) FemMuscleModel(artisynth.core.femmodels.FemMuscleModel) FemNode3d(artisynth.core.femmodels.FemNode3d) GenericMuscle(artisynth.core.materials.GenericMuscle)

Example 3 with MooneyRivlinMaterial

use of artisynth.core.materials.MooneyRivlinMaterial 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"));
}
Also used : MooneyRivlinMaterial(artisynth.core.materials.MooneyRivlinMaterial) IncompNeoHookeanMaterial(artisynth.core.materials.IncompNeoHookeanMaterial) LinearMaterial(artisynth.core.materials.LinearMaterial) Point(java.awt.Point)

Example 4 with MooneyRivlinMaterial

use of artisynth.core.materials.MooneyRivlinMaterial in project artisynth_core by artisynth.

the class FemBeam3d method build.

public void build(String[] args) {
    // ADD_BLOCKS
    build("hex", 8, 4, /*options=*/
    0);
    // build ("hex", 24, 12, /*options=*/0); // ADD_BLOCKS
    myMechMod.setIntegrator(Integrator.Trapezoidal);
    myFemMod.setMaterial(new MooneyRivlinMaterial());
    myFemMod.setIncompressible(FemModel.IncompMethod.AUTO);
// myMechMod.getSolver().profileKKTSolveTime = true;
// myMechMod.setProfiling (true);
}
Also used : MooneyRivlinMaterial(artisynth.core.materials.MooneyRivlinMaterial)

Example 5 with MooneyRivlinMaterial

use of artisynth.core.materials.MooneyRivlinMaterial in project artisynth_core by artisynth.

the class LockingDemo method setModelProperties.

private void setModelProperties(FemModel3d mod) {
    mod.setDensity(DENSITY);
    setRenderProperties(mod, LENGTH);
    mod.setMaterial(new MooneyRivlinMaterial(2000, 0, 0, 0, 0, 5000000));
    for (FemNode3d n : mod.getNodes()) {
        if (Math.abs(n.getPosition().z - LENGTH / 2) < EPS) {
            n.setDynamic(false);
        }
    }
}
Also used : MooneyRivlinMaterial(artisynth.core.materials.MooneyRivlinMaterial)

Aggregations

MooneyRivlinMaterial (artisynth.core.materials.MooneyRivlinMaterial)6 FemNode3d (artisynth.core.femmodels.FemNode3d)2 FemElement3d (artisynth.core.femmodels.FemElement3d)1 FemMarker (artisynth.core.femmodels.FemMarker)1 FemMuscleModel (artisynth.core.femmodels.FemMuscleModel)1 MuscleBundle (artisynth.core.femmodels.MuscleBundle)1 BlemkerMuscle (artisynth.core.materials.BlemkerMuscle)1 GenericMuscle (artisynth.core.materials.GenericMuscle)1 IncompNeoHookeanMaterial (artisynth.core.materials.IncompNeoHookeanMaterial)1 LinearMaterial (artisynth.core.materials.LinearMaterial)1 Point (artisynth.core.mechmodels.Point)1 Point (java.awt.Point)1 LinkedList (java.util.LinkedList)1 Point3d (maspack.matrix.Point3d)1