You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For this project, I created a FEniCS-features branch where you should be able to checkout and compile (hopefully).
All the concerning files are in the directory /src/SofaCaribou/FEniCS.
As you see, in the file /src/SofaCaribou/FEniCS/Forcefield/HyperelasticForcefield_FEniCS.inl, we use the function
in addForce and assemble_stiffness to generate the residual vector and the stiffness matrix.
The function comes from const ufcx_integral *integral = form_SaintVenantKirchhoff_Hexa_Order2_J->integrals(ufcx_integral_type::cell)[0];
that should be changed manually depending on the chosen element (Hexa of order 2 in this case).
This is quite uncomfortable for the user (myself included). To solve this problem, I thought about doing something similar to what you were doing by creating a material called /src/SofaCaribou/FEniCS/Material/SaintVenantKirchhoffMaterial_FEniCS and calling a function called calculate_nodal_forces instead of the PK2_stress for example.
This calculate_nodal_forces function needs to know the size of the R vector (NumberOfNodePerElement, Dimension) that depends on the element type and the interpolation degree.
I tried to create a HyperelasticMaterial_FEniCS class in /src/SofaCaribou/FEniCS/Material/ to be able to template the Element type and be able to use the NumberOfNodePerElement variable for example. Once done, I am adding it to the factory in /src/SofaCaribou/Material/HyperelasticMaterial.cpp
Once I am running the example ./Validation/fenics/cantilever_beam_SOFA_FENiCS_Hexa_quadratic.py. I obtain the following message: [ERROR] [ObjectFactory] Component already registered: SaintVenantKirchhoffMaterial_FEniCS<Vec3d>
This means that the SaintVenantKirchhoffMaterial_FEniCS is only templated using DataTypes while I wanted to template it with Element, DataTypes.
What did I do wrong?
If you can think about a better solution, do not hesitate !
If the issue is unclear tell me where or we can also have a meeting to discuss it.
Thank you and have a nice day.
The text was updated successfully, but these errors were encountered:
You even created a github project, this is great ! Let's hope it takes more momentum than the last time I tried it :-)
I am super close to have a Windows workflow which will allow us to produce nightly binaries for Windows users. I just want to finish this once and for all, and then I'm 100% with this new project.
For the templated-based material we will have to manage the instantiation of the good template from the scene definition. For example, the following:
I will try to put some time into it next week. Should I push directly in your branch? I can also use pull requests which can be done on any target branch.
Where the HyperelasticForcefield could deduce its template from the material.
If you can make a PR it would be perfect, I will be working in the company for 2 weeks so I will not have too much time to dig into those problems !
Thank you!
Hi @Sidaty1 and @jnbrunet,
For this project, I created a
FEniCS-features
branch where you should be able to checkout and compile (hopefully).All the concerning files are in the directory
/src/SofaCaribou/FEniCS
.As you see, in the file
/src/SofaCaribou/FEniCS/Forcefield/HyperelasticForcefield_FEniCS.inl
, we use the functionin
addForce
andassemble_stiffness
to generate the residual vector and the stiffness matrix.The function comes from
const ufcx_integral *integral = form_SaintVenantKirchhoff_Hexa_Order2_J->integrals(ufcx_integral_type::cell)[0];
that should be changed manually depending on the chosen element (Hexa of order 2 in this case).
This is quite uncomfortable for the user (myself included). To solve this problem, I thought about doing something similar to what you were doing by creating a material called
/src/SofaCaribou/FEniCS/Material/SaintVenantKirchhoffMaterial_FEniCS
and calling a function calledcalculate_nodal_forces
instead of thePK2_stress
for example.This
calculate_nodal_forces
function needs to know the size of the R vector (NumberOfNodePerElement, Dimension) that depends on the element type and the interpolation degree.I tried to create a
HyperelasticMaterial_FEniCS
class in/src/SofaCaribou/FEniCS/Material/
to be able to template the Element type and be able to use the NumberOfNodePerElement variable for example. Once done, I am adding it to the factory in/src/SofaCaribou/Material/HyperelasticMaterial.cpp
Once I am running the example
./Validation/fenics/cantilever_beam_SOFA_FENiCS_Hexa_quadratic.py
. I obtain the following message:[ERROR] [ObjectFactory] Component already registered: SaintVenantKirchhoffMaterial_FEniCS<Vec3d>
This means that the
SaintVenantKirchhoffMaterial_FEniCS
is only templated using DataTypes while I wanted to template it with Element, DataTypes.Thank you and have a nice day.
The text was updated successfully, but these errors were encountered: