Skip to content

Commit c24cb2c

Browse files
alxbilgerfredroy
andauthored
[example] Add a demo scene showcasing mesh-induced anisotropy effects (sofa-framework#5982)
Add a demo scene showcasing mesh-induced anisotropy effects Co-authored-by: Frederick Roy <fredroy@users.noreply.github.com>
1 parent 6217252 commit c24cb2c

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0"?>
2+
<Node name="root" dt="0.01" gravity="0 -9.81 0">
3+
<!--
4+
If all tetrahedra in a mesh are oriented in the same way (for example, all diagonals in a structured grid are split
5+
consistently in one direction), the mesh itself introduces a preferred direction.
6+
7+
Even if the material model is isotropic, the numerical solution behaves as if the material were anisotropic.
8+
9+
If the diagonals were alternated or randomized, the effect would largely disappear. The alternation can be
10+
controlled by the Data 'swapping' in the component 'Hexa2TetrahedronTopologicalMapping'.
11+
12+
This scene shows the effect of the mesh-induced anisotropy at equilibrium, compared to a mesh where the diagonals
13+
are alternated.
14+
-->
15+
<Node name="plugins">
16+
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
17+
<RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
18+
<RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
19+
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [DiagonalMass] -->
20+
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [NewtonRaphsonSolver,StaticSolver] -->
21+
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TetrahedronFEMForceField] -->
22+
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
23+
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TetrahedronSetGeometryAlgorithms,TetrahedronSetTopologyContainer,TetrahedronSetTopologyModifier] -->
24+
<RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
25+
<RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Hexa2TetraTopologicalMapping] -->
26+
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualMesh,VisualStyle] -->
27+
</Node>
28+
29+
<DefaultAnimationLoop/>
30+
<VisualStyle displayFlags="showBehaviorModels" />
31+
32+
<!-- Dimensions are in meters -->
33+
<RegularGridTopology name="grid" min="-0.01 -0.01 0" max="0.01 0.01 0.2" n="5 5 30"/>
34+
35+
<Node name="beam_with_anisotropy">
36+
<NewtonRaphsonSolver name="non_linear_solver" maxNbIterationsNewton="100"
37+
maxNbIterationsLineSearch="1" warnWhenLineSearchFails="false"/>
38+
<StaticSolver name="static_solver" newtonSolver="@non_linear_solver"/>
39+
<SparseLDLSolver name="linear_solver" template="CompressedRowSparseMatrixMat3x3d"/>
40+
41+
<MechanicalObject template="Vec3" name="state" position="@/grid.position"/>
42+
43+
<Node name="tetrahedra">
44+
<TetrahedronSetTopologyContainer name="Tetra_topo" position="@/grid.position"/>
45+
<TetrahedronSetTopologyModifier name="Modifier" />
46+
<TetrahedronSetGeometryAlgorithms template="Vec3" name="GeomAlgo" />
47+
<Hexa2TetraTopologicalMapping input="@grid" output="@Tetra_topo" swapping="false"/>
48+
49+
<!-- Density is in kg/m^3 -->
50+
<DiagonalMass massDensity="1100" />
51+
<!-- Young's modulus is in Pa -->
52+
<TetrahedronFEMForceField name="FEM" youngModulus="1e6" poissonRatio="0.48"/>
53+
54+
<VisualMesh position="@state.position" topology="@Tetra_topo"/>
55+
</Node>
56+
57+
<BoxROI template="Vec3" name="box_roi" box="-0.011 -0.011 -0.0001 0.011 0.011 0.0001" drawBoxes="1" />
58+
<FixedProjectiveConstraint template="Vec3" indices="@box_roi.indices" />
59+
</Node>
60+
61+
<Node name="beam_without_anisotropy">
62+
<NewtonRaphsonSolver name="non_linear_solver" maxNbIterationsNewton="100"
63+
maxNbIterationsLineSearch="1" warnWhenLineSearchFails="false"/>
64+
<StaticSolver name="static_solver" newtonSolver="@non_linear_solver"/>
65+
<SparseLDLSolver name="linear_solver" template="CompressedRowSparseMatrixMat3x3d"/>
66+
67+
<MechanicalObject template="Vec3" name="state" position="@/grid.position"/>
68+
69+
<Node name="tetrahedra">
70+
<TetrahedronSetTopologyContainer name="Tetra_topo" position="@/grid.position"/>
71+
<TetrahedronSetTopologyModifier name="Modifier" />
72+
<TetrahedronSetGeometryAlgorithms template="Vec3" name="GeomAlgo" />
73+
<Hexa2TetraTopologicalMapping input="@grid" output="@Tetra_topo" swapping="true"/>
74+
75+
<!-- Density is in kg/m^3 -->
76+
<DiagonalMass massDensity="1100" />
77+
<!-- Young's modulus is in Pa -->
78+
<TetrahedronFEMForceField name="FEM" youngModulus="1e6" poissonRatio="0.48"/>
79+
80+
<VisualMesh position="@state.position" topology="@Tetra_topo"/>
81+
</Node>
82+
83+
<BoxROI template="Vec3" name="box_roi" box="-0.011 -0.011 -0.0001 0.011 0.011 0.0001" drawBoxes="1" />
84+
<FixedProjectiveConstraint template="Vec3" indices="@box_roi.indices" />
85+
</Node>
86+
</Node>

0 commit comments

Comments
 (0)