Skip to content

Commit 6ae4572

Browse files
Adding test cases for reading of fourier coefficient file (#427)
* fix read io bug and add test for fft * add python script for fft compute * updated .vtu file for test * minor comments * added header file for test_ftt unit test * added copyright * addresses minor comments and changes description * improved .fcs precision and removed files where not needed * updated README for fcs * added utilities directory that contains python script for fcs generation * minor edit to README --------- Co-authored-by: Aaron Brown <[email protected]>
1 parent 045220a commit 6ae4572

File tree

26 files changed

+632
-113
lines changed

26 files changed

+632
-113
lines changed

Code/Source/solver/read_files.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,10 +1935,9 @@ void read_fourier_coeff_values_file(const std::string& file_name, bcType& lBc)
19351935
values.push_back(value);
19361936
}
19371937

1938-
int num_vals = values.size();
1939-
for (int i = 0; i < values.size(); i++) {
1940-
lBc.gt.r(i,j) = values[i];
1941-
lBc.gt.i(i,j) = values[i+num_vals];
1938+
for (int i = 0; i < lBc.gt.d; i++) {
1939+
lBc.gt.r(i,j) = values[i];
1940+
lBc.gt.i(i,j) = values[i + lBc.gt.d];
19421941
}
19431942

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

2007-
int num_vals = values.size();
2008-
for (int i = 0; i < values.size(); i++) {
2009-
lBf.bt.r(i,j) = values[i];
2010-
lBf.bt.i(i,j) = values[i+num_vals];
2006+
for (int i = 0; i < lBf.bt.d; i++) {
2007+
lBf.bt.r(i,j) = values[i];
2008+
lBf.bt.i(i,j) = values[i + lBf.bt.d];
20112009
}
20122010

20132011
j += 1;

tests/cases/fluid/pipe_RCR_3d/lumen_inlet.fcs

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
# **Problem Description**
3+
4+
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.
5+
6+
# Inlet flow boundary condition
7+
8+
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).
9+
10+
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:
11+
12+
<p align="center">
13+
<img src="./fft_reconstruction.png" width="600">
14+
</p>
15+
16+
17+
# Outlet RCR boundary condition
18+
19+
An RCR boundary condition is defined for the **lumen_outlet** outlet face.
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
0.0 1.0
2+
0.0 0.0
3+
16
4+
-6.2831852968750006e+01 0.0000000000000000e+00
5+
6.2630248089319764e+01 -1.8689837176965406e-07
6+
-1.8510278462895881e-07 1.2598780427743684e-15
7+
-3.2931465665672273e-07 1.8214078224321383e-07
8+
2.9676287399904954e-07 -2.2497822192399436e-16
9+
-7.1346109986563247e-07 -1.7291577648812070e-07
10+
-1.6679265373961399e-07 4.9995160427554296e-16
11+
-1.9207332282283037e-06 1.5978005149412804e-07
12+
5.0660591524529525e-08 -2.5872495521259351e-16
13+
9.3646292551129305e-07 -1.4351166349130110e-07
14+
-1.3449131704204189e-07 3.5996515507839091e-18
15+
-9.4105400926950758e-07 1.2504770956829968e-07
16+
1.9218453262995655e-07 8.7491530748220019e-18
17+
9.5400603135350799e-07 -1.0541065198628774e-07
18+
-9.5475796377833937e-08 -1.1065255404833191e-16
19+
1.0167834071836435e-06 8.5630083711416610e-08
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
33 16
2+
0.000000 0.000000
3+
0.031250 -1.207301
4+
0.062500 -4.782786
5+
0.093750 -10.589077
6+
0.125000 -18.403023
7+
0.156250 -27.924348
8+
0.187500 -38.787146
9+
0.218750 -50.573962
10+
0.250000 -62.83185
11+
0.281250 -75.089744
12+
0.312500 -86.876560
13+
0.343750 -97.739358
14+
0.375000 -107.260684
15+
0.406250 -115.074629
16+
0.437500 -120.880920
17+
0.468750 -124.456405
18+
0.500000 -125.663706
19+
0.531250 -124.456405
20+
0.562500 -120.880920
21+
0.593750 -115.074629
22+
0.625000 -107.260684
23+
0.656250 -97.739358
24+
0.687500 -86.876560
25+
0.718750 -75.089744
26+
0.750000 -62.831853
27+
0.781250 -50.573962
28+
0.812500 -38.787146
29+
0.843750 -27.924348
30+
0.875000 -18.403023
31+
0.906250 -10.589077
32+
0.937500 -4.782786
33+
0.968750 -1.207301
34+
1.000000 0.000000
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:75e318c829105bb00e353522f1697361444d6199f92da1dc374927f243ea7632
3+
size 176990
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:b77b872930b3ff01f8bc6e3ea6e061a4df800ba3bc1f4d4bf3a275f863022cea
3+
size 6972
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:c5c16563fee4011b1e89bd3492dd2798de2185dfcfb9b60944a3155a50f13187
3+
size 7070
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:3e3dfb1b920d6ddb3066c84a3564069541a3c8b0c2ebedad2a58625d5369de1b
3+
size 66024

0 commit comments

Comments
 (0)