Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions Code/Source/solver/read_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1935,10 +1935,9 @@ void read_fourier_coeff_values_file(const std::string& file_name, bcType& lBc)
values.push_back(value);
}

int num_vals = values.size();
for (int i = 0; i < values.size(); i++) {
lBc.gt.r(i,j) = values[i];
lBc.gt.i(i,j) = values[i+num_vals];
for (int i = 0; i < lBc.gt.d; i++) {
lBc.gt.r(i,j) = values[i];
lBc.gt.i(i,j) = values[i + lBc.gt.d];
}

j += 1;
Expand Down Expand Up @@ -2004,10 +2003,9 @@ void read_fourier_coeff_values_file(const std::string& file_name, bfType& lBf)
values.push_back(value);
}

int num_vals = values.size();
for (int i = 0; i < values.size(); i++) {
lBf.bt.r(i,j) = values[i];
lBf.bt.i(i,j) = values[i+num_vals];
for (int i = 0; i < lBf.bt.d; i++) {
lBf.bt.r(i,j) = values[i];
lBf.bt.i(i,j) = values[i + lBf.bt.d];
}

j += 1;
Expand Down
21 changes: 0 additions & 21 deletions tests/cases/fluid/pipe_RCR_3d/lumen_inlet.fcs

This file was deleted.

19 changes: 19 additions & 0 deletions tests/cases/fluid/pipe_RCR_3d_fourier_coeff/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

# **Problem Description**

Simulate unsteady fluid flow in a pipe. This case is identical to <a href="https://github.com/SimVascular/svFSIplus/tree/main/tests/cases/fluid/pipe_RCR_3d"> Fluid RCR 3D Pipe </a>, except that fourier coefficients are read by the solver (instead of the usual temporal values file). For additional validation, the **results_002.vtu** output file used in this case is the same as the `pipe_RCR_3d` case.

# Inlet flow boundary condition

Interpolated Fourier coefficients are provided for the **lumen_inlet** boundary condition. These coefficients are specified in the **lumen_inlet.fcs** file, which is an alternative to the flow data that is provided in the **lumen_inlet.flow**. Providing the fourier coefficient file skips the fourier interpolation function (**fft.cpp**) in svMultiphysics. Documentation on the file format can be accessed [here](https://simvascular.github.io/documentation/multi_physics.html#data_file_formats_boundary_condition_fourier) and the `lumen_inlet` boundary condition block is provided in the [solver.xml](./solver.xml).

The **lumen_inlet.fcs** file can be generated using the **fft_temporal_values.py** which is available in the `utilities` directory ([here](../../../../utilities/fourier_coefficients/)). This script takes the lumen_inlet.flow file, computes the Fourier coefficients using an identical fft python function, and returns the **.fcs** file ready for simulation. It also provides a visualization of the fourier interpolation, which is shown below:

<p align="center">
<img src="./fft_reconstruction.png" width="600">
</p>


# Outlet RCR boundary condition

An RCR boundary condition is defined for the **lumen_outlet** outlet face.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions tests/cases/fluid/pipe_RCR_3d_fourier_coeff/lumen_inlet.fcs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
0.0 1.0
0.0 0.0
16
-6.2831852968750006e+01 0.0000000000000000e+00
6.2630248089319764e+01 -1.8689837176965406e-07
-1.8510278462895881e-07 1.2598780427743684e-15
-3.2931465665672273e-07 1.8214078224321383e-07
2.9676287399904954e-07 -2.2497822192399436e-16
-7.1346109986563247e-07 -1.7291577648812070e-07
-1.6679265373961399e-07 4.9995160427554296e-16
-1.9207332282283037e-06 1.5978005149412804e-07
5.0660591524529525e-08 -2.5872495521259351e-16
9.3646292551129305e-07 -1.4351166349130110e-07
-1.3449131704204189e-07 3.5996515507839091e-18
-9.4105400926950758e-07 1.2504770956829968e-07
1.9218453262995655e-07 8.7491530748220019e-18
9.5400603135350799e-07 -1.0541065198628774e-07
-9.5475796377833937e-08 -1.1065255404833191e-16
1.0167834071836435e-06 8.5630083711416610e-08
34 changes: 34 additions & 0 deletions tests/cases/fluid/pipe_RCR_3d_fourier_coeff/lumen_inlet.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
33 16
0.000000 0.000000
0.031250 -1.207301
0.062500 -4.782786
0.093750 -10.589077
0.125000 -18.403023
0.156250 -27.924348
0.187500 -38.787146
0.218750 -50.573962
0.250000 -62.83185
0.281250 -75.089744
0.312500 -86.876560
0.343750 -97.739358
0.375000 -107.260684
0.406250 -115.074629
0.437500 -120.880920
0.468750 -124.456405
0.500000 -125.663706
0.531250 -124.456405
0.562500 -120.880920
0.593750 -115.074629
0.625000 -107.260684
0.656250 -97.739358
0.687500 -86.876560
0.718750 -75.089744
0.750000 -62.831853
0.781250 -50.573962
0.812500 -38.787146
0.843750 -27.924348
0.875000 -18.403023
0.906250 -10.589077
0.937500 -4.782786
0.968750 -1.207301
1.000000 0.000000
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/pipe_RCR_3d_fourier_coeff/result_002.vtu
Git LFS file not shown
119 changes: 119 additions & 0 deletions tests/cases/fluid/pipe_RCR_3d_fourier_coeff/solver.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" ?>
<svMultiPhysicsFile version="0.1">

<GeneralSimulationParameters>

<Continue_previous_simulation> false </Continue_previous_simulation>
<Number_of_spatial_dimensions> 3 </Number_of_spatial_dimensions>
<Number_of_time_steps> 2 </Number_of_time_steps>
<Time_step_size> 0.005 </Time_step_size>
<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> 2 </Increment_in_saving_VTK_files>
<Start_saving_after_time_step> 1 </Start_saving_after_time_step>

<Increment_in_saving_restart_files> 100 </Increment_in_saving_restart_files>
<Convert_BIN_to_VTK_format> 0 </Convert_BIN_to_VTK_format>

<Verbose> 1 </Verbose>
<Warning> 0 </Warning>
<Debug> 0 </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="fluid" >
<Coupled> true </Coupled>
<Min_iterations> 3 </Min_iterations>
<Max_iterations> 5</Max_iterations>
<Tolerance> 1e-11 </Tolerance>
<Backflow_stabilization_coefficient> 0.2 </Backflow_stabilization_coefficient>

<Density> 1.06 </Density>
<Viscosity model="Constant" >
<Value> 0.04 </Value>
</Viscosity>

<Output type="Spatial" >
<Velocity> true </Velocity>
<Pressure> true </Pressure>
<Traction> true </Traction>
<Vorticity> true</Vorticity>
<Divergence> true</Divergence>
<WSS> true </WSS>
</Output>

<Output type="B_INT" >
<Pressure> true </Pressure>
<Velocity> true </Velocity>
</Output>

<Output type="V_INT" >
<Pressure> true </Pressure>
</Output>

<LS type="NS" >
<Linear_algebra type="fsils" >
<Preconditioner> fsils </Preconditioner>
</Linear_algebra>
<Max_iterations> 15 </Max_iterations>
<NS_GM_max_iterations> 10 </NS_GM_max_iterations>
<NS_CG_max_iterations> 300 </NS_CG_max_iterations>
<Tolerance> 1e-3 </Tolerance>
<NS_GM_tolerance> 1e-3 </NS_GM_tolerance>
<NS_CG_tolerance> 1e-3 </NS_CG_tolerance>
<Absolute_tolerance> 1e-17 </Absolute_tolerance>
<Krylov_space_dimension> 250 </Krylov_space_dimension>
</LS>

<Add_BC name="lumen_inlet" >
<Type> Dir </Type>
<Time_dependence> Unsteady </Time_dependence>
<Fourier_coefficients_file_path> lumen_inlet.fcs </Fourier_coefficients_file_path>
<Profile> Parabolic </Profile>
<Impose_flux> true </Impose_flux>
</Add_BC>

<Add_BC name="lumen_outlet" >
<Type> Neu </Type>
<Time_dependence> RCR </Time_dependence>
<RCR_values>
<Capacitance> 1.5e-5 </Capacitance>
<Distal_resistance> 1212 </Distal_resistance>
<Proximal_resistance> 121 </Proximal_resistance>
<Distal_pressure> 0 </Distal_pressure>
<Initial_pressure> 0 </Initial_pressure>
</RCR_values>
</Add_BC>

<Add_BC name="lumen_wall" >
<Type> Dir </Type>
<Time_dependence> Steady </Time_dependence>
<Value> 0.0 </Value>
</Add_BC>

</Add_equation>

</svMultiPhysicsFile>


21 changes: 0 additions & 21 deletions tests/cases/fluid/pipe_RCR_3d_petsc/lumen_inlet.fcs

This file was deleted.

21 changes: 0 additions & 21 deletions tests/cases/fluid/pipe_RCR_3d_trilinos_bj/lumen_inlet.fcs

This file was deleted.

21 changes: 0 additions & 21 deletions tests/cases/fluid/pipe_RCR_3d_trilinos_ilut/lumen_inlet.fcs

This file was deleted.

21 changes: 0 additions & 21 deletions tests/cases/fluid/pipe_RCR_weak_dir_3d/lumen_inlet.fcs

This file was deleted.

5 changes: 5 additions & 0 deletions tests/test_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ def test_pipe_RCR_3d(n_proc):
t_max = 2
run_with_reference(base_folder, test_folder, fields, n_proc, t_max)

def test_pipe_RCR_3d_fourier_coeff(n_proc):
test_folder = "pipe_RCR_3d_fourier_coeff"
t_max = 2
run_with_reference(base_folder, test_folder, fields, n_proc, t_max)

def test_pipe_RCR_3d_petsc(n_proc):
test_folder = "pipe_RCR_3d_petsc"
t_max = 2
Expand Down
Loading