Skip to content

Commit

Permalink
Repair plotting script of elastic-tube-3d (#450)
Browse files Browse the repository at this point in the history
* Repair plotting script of elastic-tube-3d

* Work with folder name in the script plot-displacements.sh

* Retore plot-all-displacements.sh file

* Clarify how plotting scripts work in the README

* Formatting
  • Loading branch information
IshaanDesai authored Jan 24, 2024
1 parent 59f5356 commit 64f9cf7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion elastic-tube-3d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ You can visualize the results using paraView or `cgx`(for native CalculiX result

![result tube](images/tutorials-elastic-tube-3d-tube-result.png)

You can also plot the displacement of the midpoint of the tube by running `sh plot-displacement.sh <filename>`. The displacement plot for each solver combination looks like:
You can also plot the displacement of the midpoint of the tube for each participant individually by running `sh plot-displacements.sh <filename>`. If you have run all the solver combinations and want to compare the plots, you can run `sh plot-all-displacements.sh` which looks like:

![plot tube](images/tutorials-elastic-tube-3d-plot.png)

Expand Down
2 changes: 1 addition & 1 deletion elastic-tube-3d/plot-all-displacements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

gnuplot -p << EOF
set grid
set title 'displacement at the middle of the tube
set title 'displacement at the middle of the tube'
set xlabel 'time [s]'
set ylabel 'displacement [m]'
set term pngcairo enhanced size 900,654
Expand Down
27 changes: 27 additions & 0 deletions elastic-tube-3d/plot-displacements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

if [ "${1:-}" = "" ]; then
echo "No target directory specified. Please specify the directory of the solid participant containing the watchpoint, e.g. ./plot-displacements.sh solid-calculix."
exit 1
fi

FILE="$1/precice-Solid-watchpoint-Tube-Midpoint.log"

if [ ! -f "$FILE" ]; then
echo "Unable to locate the watchpoint file (precice-Solid-watchpoint-Tube-Midpoint.log) in the specified solid directory '${1}'. Make sure the specified directory matches the solid participant you used for the calculations."
exit 1
fi

gnuplot -p << EOF
set grid
set title 'displacement of the tube midpoint'
set xlabel 'time [s]'
set ylabel 'displacement of the tube midpoint [m]'
set term pngcairo enhanced size 900,654
set output "images/tutorials-elastic-tube-3d-displacement-watchpoints.png"
plot "$1/precice-Solid-watchpoint-Tube-Midpoint.log" using 1:5 with lines title "$1 tube midpoint circumferential", \
"$1/precice-Solid-watchpoint-Tube-Midpoint.log" using 1:6 with lines title "$1 tube midpoint radial", \
"$1/precice-Solid-watchpoint-Tube-Midpoint.log" using 1:7 with lines title "$1 tube midpoint axial"
EOF

echo "Plot saved in images/tutorials-elastic-tube-3d-displacement-watchpoints.png"

0 comments on commit 64f9cf7

Please sign in to comment.