Skip to content

Commit 2a36c2d

Browse files
Glen Hansenrwdlnk
authored andcommitted
Add several tutorial problems
This commit modifies the Flexi source code slightly to add several new tutorial problems. These are the "123" problem, a second version of "sod", the "implode" problem, "LeBlanc", and "Sedov."
1 parent 2ea9edb commit 2a36c2d

80 files changed

Lines changed: 10644 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/equations/navierstokes/idealgas/exactfunc.f90

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ SUBROUTINE DefineParametersExactFunc()
8787
#if PARABOLIC
8888
CALL addStrListEntry('IniExactFunc','blasius' ,1338)
8989
#endif
90+
CALL addStrListEntry('IniExactFunc','sedov' ,1342)
91+
CALL addStrListEntry('IniExactFunc','leblanc' ,1344)
92+
CALL addStrListEntry('IniExactFunc','hui' ,1346)
9093
CALL prms%CreateRealArrayOption( 'AdvVel', "Advection velocity (v1,v2,v3) required for exactfunction CASE(2,21,4,8)")
9194
CALL prms%CreateRealOption( 'MachShock', "Parameter required for CASE(10)", '1.5')
9295
CALL prms%CreateRealOption( 'PreShockDens', "Parameter required for CASE(10)", '1.0')
@@ -96,6 +99,9 @@ SUBROUTINE DefineParametersExactFunc()
9699
CALL prms%CreateRealOption( 'IniHalfwidth', "Shu Vortex CASE(7)", '0.2')
97100
CALL prms%CreateRealOption( 'P_Parameter', "Couette-Poiseuille flow CASE(8)", '0.0')
98101
CALL prms%CreateRealOption( 'U_Parameter', "Couette-Poiseuille flow CASE(8)", '0.01')
102+
CALL prms%CreateRealOption( 'eradius_in', "Radius of high energy area CASE(1342)")
103+
CALL prms%CreateRealOption( 'leblanc_x0', "Location of initial discontinity CASE(1344)")
104+
CALL prms%CreateRealArrayOption( 'Hui_Data', "Orientation and axis intercept data for Hui problem CASE(1346)")
99105
#if PARABOLIC
100106
CALL prms%CreateRealOption( 'delta99_in', "Blasius boundary layer CASE(1338)")
101107
CALL prms%CreateRealArrayOption( 'x_in', "Blasius boundary layer CASE(1338)")
@@ -147,6 +153,18 @@ SUBROUTINE InitExactFunc()
147153
x_in = GETREALARRAY('x_in',2,'(/0.,0./)')
148154
BlasiusInitDone = .TRUE. ! Mark Blasius init as done so we don't read the parameters again in BC init
149155
#endif
156+
CASE(1342) ! Energy radius in for Sedov
157+
SWRITE(UNIT_stdOut,'(A)')' READING ERADIUS!'
158+
eradius_in = GETREAL('eradius_in')
159+
SWRITE(UNIT_stdOut,'(A)')' INIT ERADIUS DONE!'
160+
CASE(1344) ! Discontinuity location for LeBlanc
161+
SWRITE(UNIT_stdOut,'(A)')' READING LEBLANC_X0!'
162+
leblanc_x0 = GETREAL('leblanc_x0')
163+
SWRITE(UNIT_stdOut,'(A)')' INIT LEBLANC_X0 DONE!'
164+
CASE(1346) ! Axis angle (theta in rads) and Interface location (l) for Hui problem
165+
SWRITE(UNIT_stdOut,'(A)')' READING HUI_INTERCEPT!'
166+
Hui_Data = GETREALARRAY('Hui_Data',2,'(/0.,1./)')
167+
SWRITE(UNIT_stdOut,'(A)')' INIT HUI_INTERCEPT DONE!'
150168
CASE DEFAULT
151169
END SELECT ! IniExactFunc
152170

@@ -184,6 +202,9 @@ SUBROUTINE ExactFunc(ExactFunction,tIn,x,resu,RefStateOpt)
184202
USE MOD_Timedisc_Vars ,ONLY: fullBoundaryOrder,CurrentStage,dt,RKb,RKc,t
185203
USE MOD_TestCase ,ONLY: ExactFuncTestcase
186204
USE MOD_EOS ,ONLY: PrimToCons,ConsToPrim
205+
USE MOD_Exactfunc_Vars ,ONLY: eradius_in
206+
USE MOD_Exactfunc_Vars ,ONLY: leblanc_x0
207+
USE MOD_Exactfunc_Vars ,ONLY: Hui_Data
187208
#if PARABOLIC
188209
USE MOD_Eos_Vars ,ONLY: mu0
189210
USE MOD_Exactfunc_Vars ,ONLY: delta99_in,x_in
@@ -616,6 +637,24 @@ SUBROUTINE ExactFunc(ExactFunction,tIn,x,resu,RefStateOpt)
616637
END IF
617638
CALL PrimToCons(prim,resu)
618639
#endif
640+
CASE(1342) ! sedov
641+
IF (X(1)**2.0 + X(2)**2.0.GE.eradius_in**2.0) THEN
642+
Resu = RefStateCons(:,1)
643+
ELSE
644+
Resu = RefStateCons(:,2)
645+
END IF
646+
CASE(1344) ! LeBlanc Shock Tube
647+
IF (X(1).LE.leblanc_x0) THEN
648+
Resu = RefStateCons(:,1)
649+
ELSE
650+
Resu = RefStateCons(:,2)
651+
END IF
652+
CASE(1346) ! Hui Shock 2D
653+
IF (X(2) - ((sin(Hui_Data(1)) + cos(Hui_Data(1)))*X(1) - Hui_Data(2))/(sin(Hui_Data(1)) - cos(Hui_Data(1))) .GT. 0 ) THEN
654+
Resu = RefStateCons(:,1)
655+
ELSE
656+
Resu = RefStateCons(:,2)
657+
END IF
619658
END SELECT ! ExactFunction
620659
#if PP_dim==2
621660
Resu(MOM3)=0.

src/equations/navierstokes/idealgas/exactfunc_vars.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ MODULE MOD_Exactfunc_Vars
3434
REAL :: IniHalfwidth !< parameter used for Shu vortex
3535
REAL :: P_Parameter !< parameter for Couette-Poiseuille flow
3636
REAL :: U_Parameter !< parameter for Couette-Poiseuille flow
37+
REAL :: eradius_in !< radius of high energy area for Sedov
38+
REAL :: leblanc_x0 !< Location of initial discontinuity for LeBlanc
39+
REAL :: Hui_Data(2) !< Orientation and Location of axis intercept for Hui problem
3740
#if PARABOLIC
3841
REAL :: delta99_in !< boundary layer thickness for Blasius solution
3942
REAL :: x_in(2) !< inflow position for Blasius solution
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
#!/bin/bash
2+
#************************************************************************************
3+
#
4+
# Author: Thomas Bolemann
5+
# Institution: Inst. of Aero- and Gasdynamics, University of Stuttgart
6+
# Date: 07.07.2016
7+
#
8+
# Description: This script will generate a userblock file to be appended to
9+
# executables or simulation results enabling the exact rebuilding of
10+
# of the simulation code, which was used to generate those results.
11+
# A patch to the remote Git branch of the current code is generated
12+
# or to the master, if the branch does not exist on the remote.
13+
#
14+
#************************************************************************************
15+
16+
# $1: CMAKE_RUNTIME_OUTPUT_DIRECTORY
17+
# $2: CMAKE_CACHEFILE_DIR
18+
# $3: CMAKE_CACHE_MAJOR_VERSION.CMAKE_CACHE_MINOR_VERSION.CMAKE_CACHE_PATCH_VERSION
19+
20+
if [ ! -d "$1" ]; then
21+
exit 1;
22+
fi
23+
if [ ! -d "$2" ]; then
24+
exit 1;
25+
fi
26+
27+
# GAH: this approach does not work on Mac as we do not have "objcopy"
28+
# Lets make this file a "no-op" on Macs for now.
29+
30+
unamestr=`uname`
31+
echo $unamestr
32+
if [ "$unamestr" = "Darwin" ]; then
33+
34+
cd "$1"
35+
echo "Macs do not have 'objcopy', bypassing 'generateuserblock'"
36+
echo "void userblock_start(){}" > userblock.c
37+
echo "void userblock_end(){}" >> userblock.c
38+
gcc userblock.c -c
39+
40+
exit 0;
41+
42+
fi
43+
44+
# get branch name (only info)
45+
BRANCHNAME=$(git rev-parse --abbrev-ref HEAD)
46+
PARENTNAME=$BRANCHNAME
47+
PARENTCOMMIT=$(git show-ref | grep "origin/$BRANCHNAME$" | cut -b -40)
48+
49+
if [ -z "$PARENTCOMMIT" ]; then
50+
LOCBRANCHNAME=$BRANCHNAME
51+
# recursively search for parent branch
52+
FOUND=0
53+
while [ $FOUND -eq 0 ]; do
54+
# get commit on server, where branch started
55+
COLUMN=$(( $(git show-branch | grep '^[^\[]*\*' | head -1 | cut -d* -f1 | wc -c) - 1 ))
56+
START_ROW=$(( $(git show-branch | grep -n "^[\-]*$" | cut -d: -f1) + 1 ))
57+
PARENTNAME=$( git show-branch | tail -n +$START_ROW | grep -v "^[^\[]*\[$LOCBRANCHNAME" | grep "^.\{$COLUMN\}[^ ]" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
58+
if [ -z "$PARENTNAME" ]; then
59+
break
60+
fi
61+
62+
PARENTCOMMIT=$(git show-ref | grep "origin/$PARENTNAME$" | cut -b -40)
63+
if [ -z "$PARENTCOMMIT" ]; then
64+
LOCBRANCHNAME=$PARENTNAME
65+
else
66+
FOUND=1
67+
break
68+
fi
69+
done
70+
71+
if [ $FOUND -eq 0 ]; then
72+
PARENTNAME='master'
73+
PARENTCOMMIT=$(git rev-parse origin/master)
74+
echo "WARNING: Could not find parent commit, creating userblock diff to master."
75+
fi
76+
fi
77+
78+
cd "$1"
79+
echo "{[( CMAKE )]}" > userblock.txt
80+
cat configuration.cmake >> userblock.txt
81+
echo "{[( GIT BRANCH )]}" >> userblock.txt
82+
echo "$BRANCHNAME" >> userblock.txt
83+
echo $(git rev-parse HEAD) >> userblock.txt
84+
85+
# Reference is the start commit, which is either identical to
86+
# the branch, if it exists on the remote or points to the first
87+
# real parent in branch history available on remote.
88+
echo "{[( GIT REFERENCE )]}" >> userblock.txt
89+
echo "$PARENTNAME" >> userblock.txt
90+
echo $PARENTCOMMIT >> userblock.txt
91+
92+
#echo "{[( GIT FORMAT-PATCH )]}" >> userblock.txt
93+
## create format patch containing log info for commit changes
94+
## PARENT should be identical to origin
95+
#git format-patch $PARENTCOMMIT..HEAD --minimal --stdout >> $1/userblock.txt
96+
97+
# Also store binary changes in diff
98+
echo "{[( GIT DIFF )]}" >> userblock.txt
99+
# commited changes
100+
git diff -p $PARENTCOMMIT..HEAD >> userblock.txt
101+
# uncommited changes
102+
git diff -p >> userblock.txt
103+
104+
echo "{[( GIT URL )]}" >> userblock.txt
105+
git config --get remote.origin.url >> userblock.txt
106+
107+
# change directory to cmake chache dir
108+
cd "$2/CMakeFiles"
109+
# copy compile flags of the flexi(lib) to userblock
110+
echo "{[( libflexistatic.dir/flags.make )]}" >> $1/userblock.txt
111+
cat libflexistatic.dir/flags.make >> $1/userblock.txt
112+
echo "{[( libflexishared.dir/flags.make )]}" >> $1/userblock.txt
113+
cat libflexishared.dir/flags.make >> $1/userblock.txt
114+
echo "{[( flexi.dir/flags.make )]}" >> $1/userblock.txt
115+
cat flexi.dir/flags.make >> $1/userblock.txt
116+
117+
# change directory to actual cmake version
118+
cd "$3"
119+
# copy detection of compiler to userblock
120+
echo "{[( COMPILER VERSIONS )]}" >> $1/userblock.txt
121+
cat CMakeFortranCompiler.cmake >> $1/userblock.txt
122+
123+
cd "$1" # go back to the runtime output directory
124+
# Compress the userblock
125+
tar cJf userblock.tar.xz userblock.txt
126+
127+
# Build the module
128+
objcopy -I binary -O elf64-x86-64 -B i386 --redefine-sym _binary_userblock_tar_xz_start=userblock_start --redefine-sym _binary_userblock_tar_xz_end=userblock_end --redefine-sym _binary_userblock_tar_xz_size=userblock_size userblock.tar.xz userblock.o
129+
rm userblock.tar.xz

tutorials/123/data/EMPTY

Whitespace-only changes.
2.19 MB
Binary file not shown.
2.19 MB
Binary file not shown.
2.19 MB
Binary file not shown.
2.19 MB
Binary file not shown.
1.83 MB
Binary file not shown.
1.88 MB
Binary file not shown.

0 commit comments

Comments
 (0)