Repository navigation
Predeform: take the material models and parameters from the main problem file - #245
Open
simonecap00 wants to merge 1 commit into
Open
simonecap00 wants to merge 1 commit into
simonecap00 wants to merge 1 commit into
Conversation
…lem file The predeform takes the solid and fluid properties, the Robin boundary condition, the load (P_final, v_max_final), the boundary IDs and the mesh function from the main problem file given with --main_problem, and stops with an explicit error if required parameters are missing or inconsistent. Related to #241
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #241
Summary
predeform.pydefined its own solid model, Robin boundary condition, fluid, load and boundary IDs in its code(currently MooneyRivlin + Robin). The pre-deformation and the main simulation could therefore use different material
models without any warning: for example MooneyRivlin in the predeform and StVenantKirchoff in
aneurysm.py, whichdoes not set
material_modeland falls back to the turtleFSI default.This is the inconsistency reported in #241. Instead of copying the MooneyRivlin parameters into
aneurysm.py, this PRlets the predeform take the model from the main problem file, so the two are consistent by construction for any
model.
aneurysm.pykeeps StVenantKirchoff, now written explicitly, sotest_aneurysm_problemis unchanged.With this PR the predeform takes these parameters from the problem file of the main simulation, given with
--main_problem:turtleFSI -p predeform --main_problem=aneurysm--main_problemis the name of the main problem file (looked up in the current directory, then invasp.simulationsand
turtleFSI.problems) or a path to it. Arguments given on the command line still override the values of the mainproblem file.
What the predeform takes from the main problem file
material_model(mandatory),solid_propertiesorrho_s/mu_s/lambda_s,dx_s_idfluid_propertiesorrho_f/mu_f,dx_f_id, andnonnewtonian/cross_paramsfor a non-Newtonianfluid
robin_bc,k_s,c_s,ds_s_idP_finalandv_max_final(mandatory)inlet_idandfsi_id(mandatory),rigid_idandinlet_outlet_s_id(optional), each as aninteger or a list
get_mesh_domain_and_boundaries, if the main problem file defines it, together with the parameters it takes(e.g.
mesh_path,fsi_region). Regions created in the code are then the same in both simulations, e.g. thefluid region 1001 of
offset_stenosis.py.folder: the results are stored in<folder>/predeform_resultsThe time stepping, solver settings and load ramps stay in
predeform.py, with the same values as before.Explicit errors instead of silent defaults
The predeform stops before loading the mesh if the main problem file has any of these problems. All problems are
reported together.
material_modelis not definedrho_s,mu_s,lambda_s, plusC01/C10/C11forMooneyRivlin,
Jmfor Gent,mu_visc_s/lambda_visc_sfor viscoelasticity)solid_propertiesdoes not matchdx_s_idin length or order (turtleFSI pairs them by position)robin_bc=Truewithoutds_s_id, which would otherwise apply the Robin condition on the whole exterior boundary,or with
k_s/c_sthat are not lists with one value per boundaryP_final,v_max_final,inlet_idorfsi_idis missing, orv_max_finaldoes not match the number of inletsThe main problem files call the same solid and Robin checks (
check_material_parametersinsimulation_common.py)from their
initiate().Log
The predeform prints which parameters were taken from which problem file, which function reads the mesh, and where
the results are stored. The material models and parameters of each region are printed by turtleFSI in both
simulations; see the companion PR KVSlab/turtleFSI#118. This PR also works without it: turtleFSI then prints the
regions as before.
Other changes
v_max_finalcan be one value or one value per inlet.mu_eff.update()at each time step when the fluid is non-Newtonian(Add non-Newtonian (modified Cross) viscosity model for the fluid turtleFSI#115). It works with or without that PR.
aneurysm.py,cylinder.py,offset_stenosis.py: explicitmaterial_model="StVenantKirchoff", the same modelas before.
aneurysm.py,offset_stenosis.py,avf.py:P_finalandv_max_finalwith example values, to be adapted toeach case.
avf.py:inlet_id=[3, 2](PA, DA), used by itscreate_bcsand by the predeform. Theformer
inlet_id1/inlet_id2are left commented with a note.k_s/c_sare lists, as required by the current turtleFSI.docs/prestress.md,docs/avf.md,src/vasp/simulations/README.mdtest_predeform_problemuses--main_problem=cylinderPossible follow-up (not in this PR)
The pre-deformed mesh is still generated in a separate step with
vasp-predeform-mesh. A possible automation is togenerate it at the end of the predeform run (e.g. in
finished(), from the final displacement in memory), so thatthe whole pre-deformation is a single command. Both results would be kept: the predeform results in
<folder>/predeform_resultsand the pre-deformed mesh next to them.vasp-predeform-meshwould remain available,e.g. for a different
--scale-factor.Breaking changes
turtleFSI -p predeformrequires--main_problem.material_model,P_final,v_max_final,inlet_idandfsi_id.avf.py:inlet_id1/inlet_id2are replaced by the listinlet_id.Verification
Tests were run locally on macOS arm64 (conda-forge FEniCS 2019.1.0) and on a Linux workstation
(FEniCS 2019.1.0, NumPy 1.26). The predeform runs below used turtleFSI from the branch of KVSlab/turtleFSI#115
(non-Newtonian fluid), so they also cover the non-Newtonian changes.
hard-coded in
predeform.py, gives the same final displacement as the predeform on master (relative difference~5e-16, cylinder test mesh, 4 MPI processes). The mesh and the domain/boundary markers are identical.
cylinder,offset_stenosis(fluid region 1001 present),aneurysm(Robin taken from the problem file), a Robin case, and a non-Newtonian fluid (modified Cross model ofAdd non-Newtonian (modified Cross) viscosity model for the fluid turtleFSI#115, with the effective viscosity updated at each time step).
offset_stenosisgives the same values at probe point 5 astest_offset_stenosis_problem;cylinderandaneurysmrun as before.test_predeform_problem,test_cylinder_problemandtests/test_predeform.pypass with turtleFSImaster and with the branch of Add non-Newtonian (modified Cross) viscosity model for the fluid turtleFSI#115, both with and without the companion PR.
flake8is clean;mypyreports no new errors.avf.py, because there is no AVF mesh or patient data in the test data.