Home › Forum › SOFA › Using SOFA › Mapping from Grid to FEM Triangle
Tagged: 64_bits, Forcefield, GridTopology, Linux_ubuntu, mapping, SOFA_1706
- This topic has 6 replies, 2 voices, and was last updated 6 years, 3 months ago by Hugo.
-
AuthorPosts
-
27 August 2018 at 08:17 #11724SeriaBlocked
Dear Friends. Hi.
We have a challenge for Carving in Grid Topology. honestly, we need mapping from Grid to Triangle FEM.
Can we use Carving for “Regular Grid Topology” and in “SPH Fluid Force Field”?
Could you please help us for this type of mapping (Regular Grid to Triangles FEM to work Carving) ?Thank you in advance.
28 August 2018 at 21:21 #11742HugoKeymasterHi @masoud,
It’s possible to compute a triangular topology from a grid topology.
Is this what you want? If so, please find here an example:<?xml version="1.0" ?> <Node name="root" dt="0.05" showBoundingTree="0" gravity="0 -10 0"> <VisualStyle displayFlags="showBehaviorModels showVisual showForceFields" /> <CollisionPipeline verbose="0" /> <BruteForceDetection name="N2" /> <CollisionResponse response="default" /> <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" /> <CollisionGroup /> <Node name="Grid" bbox="-12 0 -3 -4 6 5"> <EulerImplicit rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver iterations="100" tolerance="1e-7" threshold="1e-7"/> <MechanicalObject /> <UniformMass totalMass="100.0" /> <RegularGrid nx="4" ny="3" nz="3" xmin="-10.25" xmax="-3.25" ymin="0.25" ymax="5.25" zmin="-2" zmax="3" /> <BoxConstraint box="-8.5 0 -2.5 -5 3 2" /> <RegularGridSpringForceField name="Springs" stiffness="400" damping="4" /> <Node name="Tetra"> <TetrahedronSetTopologyContainer name="Container" src="@../"/> <TetrahedronSetTopologyModifier name="Modifier" /> <TetrahedronSetTopologyAlgorithms name="TopoAlgo" template="Vec3d" /> <TetrahedronSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" /> <Node name="Triangle"> <TriangleSetTopologyContainer name="Container" src="@../"/> <TriangleSetTopologyModifier name="Modifier" /> <TriangleSetTopologyAlgorithms name="TopoAlgo" template="Vec3d" /> <TriangleSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" /> <Tetra2TriangleTopologicalMapping input="@../Container" output="@Container" /> </Node> </Node> </Node> </Node>
If this isn’t what you want, could you please explain the physics simulation you want to achieve?
Best regards,
Hugo
29 August 2018 at 07:01 #11752SeriaBlockedThank you @Hugo for your patient.
This make me happy working with you.Honestly, i wanna use Carving on a SPHFluidForceField. but carving work only with triangle collision. so i need to mapp grid to triangle.
here is my example of SPHFluid:
<?xml version="1.0"?> <Node name="1" gravity="0 -10 0" dt="0.01" > <VisualStyle name="visualStyle1" displayFlags="showBehaviorModels showForceFields showCollisionModels" /> <RequiredPlugin name="requiredPlugin3" printLog="1" pluginName="SPHFluidSurfaceMapping SPHFluidForceField" /> <Node name="2" > <LightManager name="lightManager2" listening="1" /> <DirectionalLight name="directionalLight1" color="1 1 1 1" modelViewMatrix="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" projectionMatrix="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" /> <CGLinearSolver template="GraphScattered" name="cGLinearSolver7" iterations="12" tolerance="1e-10" threshold="1e-10" /> <EulerImplicitSolver name="eulerImplicitSolver6" rayleighStiffness="0.1" rayleighMass="0.1" /> <MechanicalObject template="Vec3d" name="MModel" position="0 0 0" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" size="1" /> <RegularGridTopology name="regularGridTopology1" n="5 40 5" min="-1.5 -3 -1.5" max="0 12 0" p0="-1.5 -3 -1.5" /> <SpatialGridContainer template="Vec3d" name="spatialGridContainer1" listening="1" cellWidth="0.75" autoUpdate="1" sortPoints="1" /> <SPHFluidForceField template="Vec3d" name="sPHFluidFF1" printLog="0" radius="0.745" pressure="100" density="15" viscosity="40" surfaceTension="-1000" kernelType="1" viscosityType="2" /> <UniformVelocityDampingForceField template="Vec3d" name="uniformVelocityDampingFF1" dampingCoefficient="12" /> <UniformMass template="Vec3d" name="uniformMass8" filename="unused" handleTopoChange="1" /> <PlaneForceField template="Vec3d" name="planeFF1" normal="1 0 0" d="-4" color="0 0.498039 0.2 1" /> <PlaneForceField template="Vec3d" name="planeFF2" normal="-1 0 0" d="-4" /> <PlaneForceField template="Vec3d" name="planeFF3" normal="0.5 1 0.1" d="-4" draw="1" color="0 0.498039 0.2 1" /> <PlaneForceField template="Vec3d" name="planeFF4" normal="0 0 1" d="-4" /> <PlaneForceField template="Vec3d" name="planeFF5" normal="0 0 -1" d="-4" /> <Node name="node7" > <OglModel template="ExtVec3f" name="oglModel0" primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <SPHFluidSurfaceMapping template="Vec3d,ExtVec3f" name="sPHFluidSurfaceMap2" radius="0.745" input="@../" output="@./" /> </Node> </Node> </Node>
29 August 2018 at 07:02 #11753SeriaBlockedThank you for your response. i will check it and make you informed about the result on the project.
29 August 2018 at 07:22 #11754SeriaBlockedDear @Hugo
Actually based on the below code my topology is triangles topology and i dont need mapping tetrahedron to triangle.<?xml version="1.0"?> <Node name="1" gravity="0 -10 0" dt="0.01" > <VisualStyle name="visualStyle1" displayFlags="showVisual showBehavior showCollisionModels hideBoundingCollisionModels hideMapping hideOptions" /> <Gravity name="gravity0" /> <RequiredPlugin name="requiredPlugin3" printLog="1" pluginName="SPHFluidSurfaceMapping SPHFluidForceField" /> <DefaultCollisionGroupManager name="defaultCollisionGroupManager4" /> <BruteForceDetection name="bruteForceDetection3" /> <MinProximityIntersection name="minProximityIntersection11" alarmDistance="0.1" /> <DefaultPipeline name="defaultPipeline2" /> <DefaultContactManager name="Response" response="default" /> <EulerImplicitSolver name="eulerImplicitSolver5" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver template="GraphScattered" name="cGLinearSolver6" /> <CarvingManager name="carvingManager5" listening="1" modelTool="Carv/tSphereModel6" modelSurface="2/child/tTriangleModel5" active="1" /> <SimedixKeyboard name="sk" listening="1" Step="0.6" tool="18 0 0 0 0 0 1" /> <Node name="center" > <MechanicalObject template="Rigid3d" name="m" position="0 0 0 0 0 0 1" velocity="0 0 0 0 0 0" force="0 0 0 0 0 0" externalForce="0 0 0 0 0 0" size="1" /> </Node> <Node name="ref_Point" > <MechanicalObject template="Rigid3d" name="m" position="@sk.tool" velocity="0 0 0 0 0 0" force="0 0 0 0 0 0" externalForce="0 0 0 0 0 0" translation="0 0 0" size="1" /> <PartialFixedConstraint template="Rigid3d" name="partialFixedConstraint23" indices="0" fixedDirections="1 1 1 1 1 1" /> </Node> <Node name="instrument" > <MechanicalObject template="Rigid3d" name="m" position="0 0 0 0 0 0 1" velocity="0 0 0 0 0 0" force="0 0 0 0 0 0" externalForce="0 0 0 0 0 0" translation="20 0 0" size="1" /> <Node name="Vis" gravity="0 0 0" > <MeshObjLoader name="mesh" filename="/home/masoud/Desktop/SiMedix_Scenes (copy)/data/mesh/phaco_col_3.obj" translation="0 0 0" /> <VisualStyle name="visualStyle8" displayFlags="showVisual hideBehavior hideCollision hideMapping hideOptions" /> <MeshTopology name="meshTopology57" position="@mesh.position" triangles="@mesh.triangles" /> <MechanicalObject template="Vec3d" name="m" position="0 0 0" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" size="1" /> <RigidMapping template="Rigid3d,Vec3d" name="mapp" input="@../" output="@./" /> <Node name="vis" > <OglModel template="ExtVec3f" name="oglModel18" primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <IdentityMapping template="Vec3d,ExtVec3f" name="identityMap1" input="@../" output="@./" /> </Node> </Node> <JointSpringForceField template="Rigid3d" name="jointSpringFF16" spring="BEGIN_SPRING 0 0 END_SPRING " object1="@/ref_Point/m" object2="@./" /> </Node> <Node name="Orient" > <MechanicalObject template="Rigid3d" name="m" position="-4 0 0 0 0 0 1" velocity="0 0 0 0 0 0" force="0 0 0 0 0 0" externalForce="0 0 0 0 0 0" size="1" /> <RigidRigidMapping template="Rigid3d,Rigid3d" name="rigidRigidMap1" index="0" input="@/instrument/m" output="@./" /> </Node> <Node name="instrutip" > <MechanicalObject template="Rigid3d" name="m" position="-2 0 0 0 0 0 1" velocity="0 0 0 0 0 0" force="0 0 0 0 0 0" externalForce="0 0 0 0 0 0" size="1" /> <RigidRigidMapping template="Rigid3d,Rigid3d" name="rigidRigidMap1" index="0" input="@/instrument/m" output="@./" /> </Node> <Node name="Carv" > <MechanicalObject template="Rigid3d" name="m" position="-2 0 0 0 0 0 1" velocity="0 0 0 0 0 0" force="0 0 0 0 0 0" externalForce="0 0 0 0 0 0" size="1" /> <TSphereModel template="Rigid3d" name="tSphereModel6" contactStiffness="0" color="1 0 0 1" group="1" radius="1.1" /> <RigidRigidMapping template="Rigid3d,Rigid3d" name="rigidRigidMap1" index="0" input="@/instrument/m" output="@./" /> </Node> <Node name="2" > <LightManager name="lightManager2" listening="1" /> <DirectionalLight name="directionalLight1" color="1 1 1 1" modelViewMatrix="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" projectionMatrix="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" /> <RegularGridTopology name="g" n="5 40 5" min="-1.5 -3 -1.5" max="0 12 0" p0="-1.5 -3 -1.5" /> <MechanicalObject template="Vec3d" name="MModel" position="0 0 0" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" size="1" /> <SpatialGridContainer template="Vec3d" name="spatialGridContainer1" listening="1" cellWidth="0.75" autoUpdate="1" sortPoints="1" /> <SPHFluidForceField template="Vec3d" name="sPHFluidFF1" printLog="0" radius="0.745" pressure="100" density="15" viscosity="40" surfaceTension="-1000" kernelType="1" viscosityType="2" /> <UniformVelocityDampingForceField template="Vec3d" name="uniformVelocityDampingFF1" dampingCoefficient="12" /> <UniformMass template="Vec3d" name="uniformMass8" filename="unused" handleTopoChange="1" /> <SimedixVaccumSphereForceField template="Vec3d" name="simedixVaccumSphereFF4" center="@/instrutip/m.position" radius="3" apply_to_cone="1" orientation="@/Orient/m.position" angle="3" stiffness="-20" damping="0" /> <Node name="node7" > <OglModel template="ExtVec3f" name="oglModel0" primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <SPHFluidSurfaceMapping template="Vec3d,ExtVec3f" name="sPHFluidSurfaceMap2" radius="0.745" input="@../" output="@./" /> </Node> <Node name="child" > <TriangleSetTopologyAlgorithms template="Vec3d" name="triangleSetTopologyAlgorithms8" /> <TriangleSetGeometryAlgorithms template="Vec3d" name="triangleSetGeometryAlgorithms7" /> <TriangleSetTopologyModifier name="triangleSetTopologyModifier6" /> <TriangleSetTopologyContainer name="triangleSetTopologyContainer5" position="@MModel.position" edges="@g.edges" checkConnexity="1" triangles="@g.triangles" /> <TTriangleModel template="Vec3d" name="tTriangleModel5" color="1 0 0 1" group="1" /> </Node> <InteractionEllipsoidForceField template="Vec3d,Rigid3d" name="ellips" center="0 0 0" vradius="10 10 10" stiffness="-10000" damping="1" color="0.909804 0.427451 0.427451 1" object2_forces="0" object1="@./" object2="@center/m" /> </Node> </Node>
So the above example that you mentioned cant work on this type.
Thank you in advance for your responses dear @Hugo .29 August 2018 at 07:26 #117552 September 2018 at 22:21 #11798 -
AuthorPosts
- You must be logged in to reply to this topic.