Skip to content

Commit 58f7497

Browse files
authored
Rework elastic-tube-1d cpp solvers (#197)
Work mostly by @fsimonis, minor changes by me. Co-authored-by Frédéric Simonis <simonisfrederic@gmail.com>
1 parent 42a85c3 commit 58f7497

13 files changed

Lines changed: 254 additions & 623 deletions

File tree

elastic-tube-1d/README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,14 @@ Open two separate terminals and start each participant by calling the respective
6161
```
6262
cd fluid-cpp
6363
./run.sh
64-
# or, in parallel: ./run.sh -parallel
6564
```
6665
and
6766
```
6867
cd solid-cpp
6968
./run.sh
7069
```
7170

72-
The run scripts set the input parameters `N = 100`, `tau = 0.01`, `kappa = 100`.
73-
74-
{% include warning.html content= "Running serial or parallel leads to different results. Please refer to this [open issue](https://github.com/precice/tutorials/issues/194) for more insight. Contributions are particularly welcome here." %}
71+
The solvers use the parameters `N = 100`, `tau = 0.01`, `kappa = 100` by default and can be modified in the solver.
7572

7673
### Python
7774

@@ -114,8 +111,6 @@ python3 plot-vtk.py diameter fluid-python/output/out_fluid_
114111
```
115112
![FSI3 setup](images/tutorials-elastic-tube-1d-diameter.png)
116113

117-
Note that the prefix also contains the rank in the parallel C++ case.
118-
119114
## References
120115

121116
[1] B. Gatzhammer. Efficient and Flexible Partitioned Simulation of Fluid-Structure Interactions. Technische Universitaet Muenchen, Fakultaet fuer Informatik, 2014.
Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required (VERSION 3.5)
1+
cmake_minimum_required (VERSION 3.10)
22

33
project(ElasticTube LANGUAGES CXX)
44
set (CMAKE_CXX_STANDARD 11)
@@ -11,34 +11,17 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
1111
endif()
1212
message(STATUS "Build configuration: " ${CMAKE_BUILD_TYPE})
1313

14-
1514
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
1615
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")
1716
endif()
1817

1918
find_package(precice REQUIRED CONFIG)
20-
21-
find_package(MPI REQUIRED
22-
COMPONENTS CXX)
23-
24-
include_directories(${MPI_CXX_INCLUDE_DIRS})
25-
set(COMPILE_OPTIONS ${COMPILE_FLAGS} ${MPI_CXX_COMPILE_OPTIONS})
26-
set(LINK_FLAGS ${LINK_FLAGS} ${MPI_CXX_LINK_FLAGS})
27-
add_definitions(${MPI_CXX_COMPILE_DEFINTIONS})
28-
29-
message(${MPI_CXX_LIBRARIES})
30-
3119
find_package(LAPACK REQUIRED)
32-
set(LINK_FLAGS ${LINK_FLAGS} ${LAPACK_LINKER_FLAGS})
33-
3420

3521
add_executable(FluidSolver
36-
"src/FluidSolver.cpp"
37-
"src/utilities.cpp"
38-
"src/FluidComputeSolution.cpp")
22+
src/FluidSolver.cpp
23+
src/utilities.cpp
24+
src/FluidComputeSolution.cpp)
3925

4026
target_link_libraries(FluidSolver PRIVATE precice::precice)
41-
target_link_libraries(FluidSolver PUBLIC ${LAPACK_LIBRARIES})
42-
target_link_libraries(FluidSolver PUBLIC ${MPI_CXX_LIBRARIES})
43-
44-
27+
target_link_libraries(FluidSolver PRIVATE ${LAPACK_LIBRARIES} ${LAPACK_LINKER_FLAGS})

elastic-tube-1d/fluid-cpp/run.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
#!/bin/sh
22
set -e -u
33

4-
if [ "${1:-}" = "-parallel" ]; then
5-
mpiexec -np 4 ./build/FluidSolver ../precice-config.xml 100 0.01 100 -parallel
6-
else
7-
./build/FluidSolver ../precice-config.xml 100 0.01 100
8-
fi
4+
./build/FluidSolver ../precice-config.xml

0 commit comments

Comments
 (0)