Skip to content

Commit

Permalink
adding test case for precomputed velocity solutions to the heatf equa…
Browse files Browse the repository at this point in the history
…tion, removing commented lines for testing in heatf.cpp, fixing spelling mistakes in ComMod.h (SimVascular#202)
  • Loading branch information
zasexton committed Mar 28, 2024
1 parent b71169c commit 27fe339
Show file tree
Hide file tree
Showing 14 changed files with 158 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Code/Source/svFSI/ComMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ class ComMod {
/// @brief Time step size
double dt = 0.0;

/// @breif Time step size of the precomputed state-variables
/// @brief Time step size of the precomputed state-variables
double precompDt = 0.0;

/// @brief Time
Expand All @@ -1477,7 +1477,7 @@ class ComMod {
/// @brief Precomputed state-variable file name
std::string precompFileName;

/// @breif Precomputed state-variable field name
/// @brief Precomputed state-variable field name
std::string precompFieldName;
// ALLOCATABLE DATA

Expand Down
4 changes: 1 addition & 3 deletions Code/Source/svFSI/heatf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,7 @@ void heatf_3d(ComMod& com_mod, const int eNoN, const double w, const Vector<doub
u(2) = u(2) - N(a)*yl(6,a);
}
}
//if (u(2) > 0.0) {
// std::cout << "u: " << u(0) << " " << u(1) << " " << u(2) << std::endl;
//}

double kU = u(0)*u(0)*ksix(0,0) + u(1)*u(0)*ksix(1,0) + u(2)*u(0)*ksix(2,0) + u(0)*u(1)*ksix(0,1) +
u(1)*u(1)*ksix(1,1) + u(2)*u(1)*ksix(2,1) + u(0)*u(2)*ksix(0,2) + u(1)*u(2)*ksix(1,2) +
u(2)*u(2)*ksix(2,2);
Expand Down
40 changes: 40 additions & 0 deletions tests/cases/fluid/precomputed_dye_AD/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

# **Problem Description**

Solve dye transportation with fluid flow in a cylindrical tube with zero neumann boundary condition at the outlet and steady flow at the inlet. The dye is passively transported by the flow through advection and diffusion.

The input file `svFSI.inp` follows the master input file [`svFSI_master.inp`](./svFSI_master.inp) as a template. Some specific input options are discussed below:

## Scalar transport equation
Unlike the test case in `04-fluid/02-dye_AD`, the advection-diffusion equation that governs the dye transportation is added to the input file without a proceeding fluid equation.
Here we assume that we already have a velocity field that has been precomputed by some prior physics simulation (denoted `precomputed_velocity.vtu`). The specified velocity field solution
is then taken to advect a scalar field.
This equation is built on top of the heat transfer equation, so some of the terminology in the input file follows those in the heat equation, e.g. "Conductivity", "Temperature".

Some noticeable setting in the input file are:

```
<Use_precomputed_solution> true </Use_precomputed_solution>
<Precomputed_solution_file_path> precomputed_velocity.vtu </Precomputed_solution_file_path>
<Precomputed_solution_field_name> Velocity </Precomputed_solution_field_name>
```

This tell the solver that this is a one-way coupling study, and the dye is passively transported by the flow.

```
<Output type="Alias" >
<Temperature> Concentration </Temperature>
</Output>
```

This renames "Temperature" to "Concentration" for ease of interpretation.

```
<Add_BC name="lumen_inlet" >
<Type> Dirichlet </Type>
<Time_dependence> Steady </Time_dependence>
<Value> 1.0 </Value>
</Add_BC>
```

The dye is constantly released at the inlet.
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
3 changes: 3 additions & 0 deletions tests/cases/fluid/precomputed_dye_AD/mesh/walls_combined.vtp
Git LFS file not shown
3 changes: 3 additions & 0 deletions tests/cases/fluid/precomputed_dye_AD/precomputed_velocity.vtu
Git LFS file not shown
3 changes: 3 additions & 0 deletions tests/cases/fluid/precomputed_dye_AD/result_001.vtu
Git LFS file not shown
87 changes: 87 additions & 0 deletions tests/cases/fluid/precomputed_dye_AD/svFSI.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" ?>
<svFSIFile version="0.1">

<GeneralSimulationParameters>
<Continue_previous_simulation> 0 </Continue_previous_simulation>
<Number_of_spatial_dimensions> 3 </Number_of_spatial_dimensions>
<Number_of_time_steps> 1 </Number_of_time_steps>
<Time_step_size> 0.01 </Time_step_size>
<Use_precomputed_solution> true </Use_precomputed_solution>
<Precomputed_solution_file_path> precomputed_velocity.vtu </Precomputed_solution_file_path>
<Precomputed_solution_field_name> Velocity </Precomputed_solution_field_name>
<Spectral_radius_of_infinite_time_step> 0.50 </Spectral_radius_of_infinite_time_step>
<Searched_file_name_to_trigger_stop> STOP_SIM </Searched_file_name_to_trigger_stop>

<Save_results_to_VTK_format> 1 </Save_results_to_VTK_format>
<Name_prefix_of_saved_VTK_files> result </Name_prefix_of_saved_VTK_files>
<Increment_in_saving_VTK_files> 1 </Increment_in_saving_VTK_files>
<Start_saving_after_time_step> 0 </Start_saving_after_time_step>

<Increment_in_saving_restart_files> 5 </Increment_in_saving_restart_files>
<Convert_BIN_to_VTK_format> 0 </Convert_BIN_to_VTK_format>

<Verbose> 1 </Verbose>
<Warning> 0 </Warning>
<Debug> 1 </Debug>
</GeneralSimulationParameters>

<Add_mesh name="msh" >

<Mesh_file_path> mesh/mesh-complete.mesh.vtu </Mesh_file_path>

<Add_face name="lumen_inlet">
<Face_file_path> mesh/mesh-surfaces/lumen_inlet.vtp </Face_file_path>
</Add_face>

<Add_face name="lumen_outlet">
<Face_file_path> mesh/mesh-surfaces/lumen_outlet.vtp </Face_file_path>
</Add_face>

<Add_face name="lumen_wall">
<Face_file_path> mesh/mesh-surfaces/lumen_wall.vtp </Face_file_path>
</Add_face>

</Add_mesh>


<Add_equation type="scalarTransport" >
<Coupled> false </Coupled>
<Min_iterations> 2 </Min_iterations>
<Max_iterations> 5 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>

<Conductivity> 1e-8 </Conductivity>
<Source_term> 0.0 </Source_term>

<Output type="Spatial">
<Velocity> true </Velocity>
<Temperature> true </Temperature>
</Output>

<Output type="Volume_integral" >
<Temperature> true </Temperature>
</Output>

<Output type="Alias" >
<Temperature> Concentration </Temperature>
</Output>

<LS type="GMRES" >
<Preconditioner> FSILS </Preconditioner>
<Tolerance> 1e-6 </Tolerance>
<Max_iterations> 100 </Max_iterations>
<Krylov_space_dimension> 50 </Krylov_space_dimension>
</LS>

<Add_BC name="lumen_inlet" >
<Type> Dirichlet </Type>
<Time_dependence> Steady </Time_dependence>
<Value> 1.0 </Value>
</Add_BC>

</Add_equation>


</svFSIFile>


1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
RTOL = {
"Action_potential": 1.0e-10,
"Cauchy_stress": 1.0e-4,
"Concentration": 1.0e-10,
"Def_grad": 1.0e-10,
"Divergence": 1.0e-9,
"Displacement": 1.0e-10,
Expand Down
3 changes: 3 additions & 0 deletions tests/test_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def test_dye_AD(n_proc):
test_folder = "dye_AD"
run_with_reference(base_folder, test_folder, fields, n_proc)

def test_precomputed_dye_AD(n_proc):
test_folder = "precomputed_dye_AD"
run_with_reference(base_folder, test_folder, ['Velocity', 'Concentration'], n_proc)

def test_newtonian(n_proc):
test_folder = "newtonian"
Expand Down

0 comments on commit 27fe339

Please sign in to comment.