Skip to content

Commit 5371e5a

Browse files
committed
Rename folder names Solid and Fluid with capital letter. Add Allrun, update Allclean. Remove hard-coded path.
1 parent 2c4987a commit 5371e5a

File tree

13 files changed

+151
-39
lines changed

13 files changed

+151
-39
lines changed

cht/adapter.comm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ from adapter import *
1010
# Note: In the OpenFOAM and CalculiX adapters, this is read from a command line argument (--precice-participant),
1111
# but I don't know how to pass my own argument to as_run
1212
participantName = os.environ["PRECICE_PARTICIPANT"]
13+
tutorial_root = os.environ["TUTORIAL_ROOT"]
1314

1415
# ==========================================================================================
1516
# Include file in UNITE 90: PreCICE setup (config.comm)

tutorials/buoyantSimpleFoam-aster/Allclean

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ echo "Cleaning..."
55
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
66

77
# Participant 1: Solid
8-
Participant1="solid"
8+
Participant1="Solid"
99
rm -fv ${Participant1}/solid.mess
1010
rm -fv ${Participant1}/solid.resu
1111
rm -fv ${Participant1}/solid.rmed
12+
rm -fv ${Participant1}.log
13+
rm -fvr ${Participant1}/REPE_OUT
14+
mkdir ${Participant1}/REPE_OUT
1215

1316
# Participant 2: Fluid
14-
Participant2="fluid"
17+
Participant2="Fluid"
1518
cd ${Participant2}
1619
cleanCase
1720
touch Fluid.foam
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/bash
2+
3+
cd ${0%/*} || exit 1 # Run from this directory
4+
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
5+
6+
# This script prepares and runs all the participants in one terminal,
7+
# forwarding the solvers' output to log files.
8+
# Alternatively, you may execute the scripts "runSolid" and "runFluid"
9+
# in separate terminals.
10+
11+
# Run this script with "-parallel" for parallel simulations
12+
13+
# The script "Allclean" cleans-up the result and log files.
14+
# Set up the run parameters:
15+
16+
# 1 for true, 0 for false
17+
parallel=0
18+
if [ "$1" = "-parallel" ]; then
19+
parallel=1
20+
fi
21+
22+
# =============== Participant 1: Fluid ===========================
23+
Participant1="Fluid"
24+
25+
# Prepare
26+
echo "Preparing the ${Participant1} participant..."
27+
28+
cd $Participant1
29+
echo " Restoring 0/ from 0.orig/..."
30+
#rm -rfv 0
31+
#cp -r 0.orig 0
32+
blockMesh > ${Participant1}_blockMesh.log 2>&1
33+
cd ..
34+
35+
# Run and get the process id
36+
if [ $parallel -eq 1 ]; then
37+
echo " Decomposing the case..."
38+
decomposePar -force -case ${Participant1} > ${Participant1}_decomposePar.log 2>&1
39+
cd ${Participant1}
40+
nproc=$(getNumberOfProcessors)
41+
cd ..
42+
echo " Starting the ${Participant1} participant in parallel..."
43+
mpirun -np ${nproc} buoyantSimpleFoam -parallel -case ${Participant1} > ${Participant1}.log 2>&1 &
44+
else
45+
echo " Starting the ${Participant1} participant in serial..."
46+
buoyantSimpleFoam -case ${Participant1} > ${Participant1}.log 2>&1 &
47+
fi
48+
PIDParticipant1=$!
49+
50+
# =============== Participant 2: Solid ===========================
51+
Participant2="Solid"
52+
export PRECICE_PARTICIPANT=${Participant2}
53+
export TUTORIAL_ROOT=${PWD%/*/*}
54+
55+
# Run
56+
echo " Starting the ${Participant2} participant..."
57+
as_run --run ${Participant2}/solid.export > ${Participant2}.log 2>&1 &
58+
PIDParticipant2=$!
59+
60+
61+
# =============== Wait for all the participants to finish =======
62+
echo "Waiting for the participants to exit..., PIDs: ${PIDParticipant1}, ${PIDParticipant2}"
63+
echo "(you may run 'tail -f ${Participant1}.log' in another terminal to check the progress)"
64+
65+
echo "To interrupt the simulation, press 'c'. Ctrl+C will only send the processes to the background."
66+
while [ -e /proc/${PIDParticipant1} ]; do
67+
read -r -t1 -n1 input
68+
if [ "$input" = "c" ]; then
69+
kill ${PIDParticipant1}
70+
kill ${PIDParticipant2}
71+
false
72+
fi
73+
done
74+
75+
if [ $? -ne 0 ] || [ "$(grep -c -E "error:" ${Participant1}.log)" -ne 0 ] || [ "$(grep -c -E "error:" ${Participant2}.log)" -ne 0 ]; then
76+
echo ""
77+
echo "Something went wrong... See the log files for more."
78+
# Precaution
79+
kill ${PIDParticipant1}
80+
kill ${PIDParticipant2}
81+
else
82+
echo ""
83+
echo "The simulation completed! (check for any errors)"
84+
if [ $parallel -eq 1 ]; then
85+
echo "Reconstructing fields..."
86+
reconstructPar -case ${Participant1} > ${Participant1}_reconstructPar.log 2>&1 &
87+
fi
88+
89+
# Workaround for issue #26
90+
echo "Problems with time directories without results? Run the script removeObsoleteFolders.sh and see issue #26 on GitHub."
91+
# ./removeObsoleteFolders.sh
92+
93+
echo "You may now open '${Participant1}/${Participant1}.foam' in ParaView."
94+
# Note: ".foam" triggers the native OpenFOAM reader of ParaView.
95+
# Change to ".OpenFOAM" to use the OpenFOAM reader provided with OpenFOAM.
96+
fi
97+
98+
echo ""
99+
echo "### NOTE ### Make sure to use the correct solver for your OpenFOAM version! (pimpleFoam for OpenFOAM v1806, OpenFOAM 6, or newer, vs pimpleDyMFoam for older) You may change this in your Fluid/system/controlDict file, if needed."
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./Allrun -parallel
File renamed without changes.
Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
etude,fich,3,FR F
22
opt_val,rep_dex _VIDE
3-
etude,fich,3,UL 91
43
etude,fich,2,type libr
4+
etude,fich,3,UL 91
55
option,ORBInitRef 0
66
etude,fich,4,donnee 0
77
option,nbmaxnook 1
88
etude,fich,2,resultat 0
9+
etude,fich,7,serv Local
910
nom_fich_export _VIDE
1011
option,rep_dex 0
1112
etude,fich,4,compress 0
1213
etude oui
1314
debug 0
1415
opt_val,cpresok RESNOOK
15-
etude,fich,4,serv Local
1616
etude,fich,3,donnee 1
17+
etude,fich,4,serv Local
1718
serv_fich_export -1
1819
surcharge,nbfic 0
1920
etude,fich,6,FR F
20-
path_etude /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid
21+
path_etude /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/Solid
2122
option,rep_outils 0
22-
etude,fich,6,UL 8
2323
etude,fich,3,resultat 0
24+
etude,fich,6,UL 8
2425
option,cpresok 1
25-
etude,fich,5,compress 0
26-
etude,fich,1,FR F
26+
etude,fich,7,type repe
2727
etude,fich,1,serv Local
28+
etude,fich,1,FR F
29+
etude,fich,5,compress 0
2830
memoire 512
2931
etude,fich,1,UL 20
3032
onglet_actif etude
@@ -35,77 +37,83 @@ etude,fich,4,type mess
3537
opt_val,exectool _VIDE
3638
etude,fich,4,resultat 1
3739
opt_val,mpi_nbcpu 1
38-
etude,fich,6,compress 0
3940
etude,fich,1,donnee 1
41+
etude,fich,6,compress 0
4042
rex non
43+
etude,fich,1,nom ./solid.mmed
4144
etude,fich,1,type mmed
42-
etude,fich,1,nom /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/solid.mmed
4345
suivi_interactif 0
44-
path_sources /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid
46+
path_sources /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/Solid
4547
pre_eda non
4648
etude,fich,4,FR F
4749
option,multiple 1
4850
opt_val,only_nook _VIDE
51+
etude,fich,3,nom ./def.comm
4952
etude,fich,4,UL 6
50-
etude,fich,3,nom /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/def.comm
5153
option,mpi_nbcpu 1
5254
serv_tests -1
5355
etude,fich,6,serv Local
54-
etude,fich,5,nom /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/solid.rmed
56+
etude,fich,5,nom ./solid.rmed
5557
make_etude run
5658
option,depart 1
5759
option,only_nook 1
5860
opt_val,ORBInitRef _VIDE
59-
nom_profil /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/solid.astk
61+
nom_profil /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/Solid/solid.astk
6062
args _VIDE
61-
etude,fich,5,resultat 1
63+
etude,fich,7,nom /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/Solid/REPE_OUT
6264
etude,fich,0,donnee 1
65+
etude,fich,5,resultat 1
66+
etude,fich,7,compress 0
6367
etude,fich,3,serv Local
6468
etude,fich,0,compress 0
6569
option,corefilesize 1
6670
opt_val,distrib _VIDE
6771
asdeno non
6872
serv_surcharge -1
6973
serv_sources -1
74+
etude,fich,7,FR R
7075
surcharge non
71-
etude,fich,6,type resu
76+
etude,fich,7,UL 0
7277
etude,fich,0,serv Local
78+
etude,fich,6,type resu
7379
M_1 oui
7480
option,distrib 1
7581
serv_etude -1
7682
asdenot non
7783
M_2 non
78-
etude,fich,6,resultat 1
7984
etude,fich,2,FR F
85+
etude,fich,6,resultat 1
8086
opt_val,rep_outils _VIDE
8187
M_3 non
8288
etude,fich,2,UL 90
83-
path_surcharge /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid
89+
path_surcharge /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/Solid
8490
consult non
8591
M_4 non
8692
asno non
87-
etude,fich,3,type libr
8893
etude,fich,1,compress 0
94+
etude,fich,3,type libr
8995
opt_val,ncpus _VIDE
90-
serveur michel-HP-ZBook-Studio-G4
96+
serveur localhost
9197
opt_val,classe _VIDE
98+
etude,fich,7,donnee 1
9299
opt_val,dbgjeveux _VIDE
93100
option,ncpus 1
94101
etude,fich,0,type comm
95102
opt_val,facmtps 1
103+
etude,fich,7,resultat 1
96104
args_fixe _VIDE
97105
etude,fich,0,resultat 0
98106
opt_val,rep_mat _VIDE
99107
special _VIDE
100108
tests,nbfic 0
101109
temps 3600.0
102110
option,dbgjeveux 0
103-
etude,fich,5,FR F
104111
etude,fich,5,serv Local
112+
etude,fich,5,FR F
105113
asrest non
106114
batch 0
107-
etude,fich,5,UL 80
108115
etude,fich,2,compress 0
116+
etude,fich,5,UL 80
109117
option,facmtps 1
110118
serv_profil -1
111119
etude,fich,6,donnee 0
@@ -114,27 +122,27 @@ opt_val,multiple _VIDE
114122
opt_val,after_job _VIDE
115123
option,rep_mat 0
116124
etude,fich,0,UL 1
117-
etude,fich,2,serv Local
118125
etude,fich,0,nom /home/michel/Git/code_aster-adapter/cht/adapter.comm
126+
etude,fich,2,serv Local
119127
option,exectool 1
120128
asverif non
121-
etude,fich,2,nom /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/../config.comm
129+
etude,fich,2,nom ./../config.comm
122130
option,after_job 1
123131
opt_val,depart _VIDE
124132
opt_val,mpi_nbnoeud 1
125133
etude,fich,1,resultat 0
126134
sources,nbfic 0
135+
etude,fich,4,nom ./solid.mess
127136
etude,fich,5,donnee 0
128-
etude,fich,4,nom /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/solid.mess
129137
tests non
130138
noeud localhost
131-
etude,fich,5,type rmed
132139
etude,fich,3,compress 0
133-
etude,fich,6,nom /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid/solid.resu
140+
etude,fich,5,type rmed
141+
etude,fich,6,nom ./solid.resu
134142
option,mpi_nbnoeud 1
135143
opt_val,corefilesize unlimited
136-
etude,nbfic 7
144+
etude,nbfic 8
137145
agla non
138146
opt_val,nbmaxnook 5
139147
version stable
140-
path_tests /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/solid
148+
path_tests /home/michel/Git/code_aster-adapter/tutorials/buoyantSimpleFoam-aster/Solid
File renamed without changes.

tutorials/buoyantSimpleFoam-aster/config.comm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
settings = \
2-
{'base-path': 'path/to/code_aster-adapter/tutorials/buoyantSimpleFoam-aster',
2+
{'base-path': tutorial_root+'/tutorials/buoyantSimpleFoam-aster',
33
'couplings': [['Solid-Interface', 'Fluid-Interface']],
4-
'participants': {'Fluid': {'directory': 'fluid',
4+
'participants': {'Fluid': {'directory': 'Fluid',
55
'domain-decomposed': False,
66
'interfaces': [{'mesh': 'Fluid-Interface',
77
'name': 'Fluid-Interface',
@@ -11,7 +11,7 @@ settings = \
1111
'write-data': ['Sink-Temperature-Fluid',
1212
'Heat-Transfer-Coefficient-Fluid']}],
1313
'solver': 'OpenFOAM'},
14-
'Solid': {'directory': 'solid',
14+
'Solid': {'directory': 'Solid',
1515
'domain-decomposed': False,
1616
'interfaces': [{'material-id': 0,
1717
'name': 'Solid-Interface',

tutorials/buoyantSimpleFoam-aster/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
participants:
22
Solid:
3-
directory: solid
3+
directory: Solid
44
domain-decomposed: false
55
interfaces:
66
- material-id: 0

tutorials/buoyantSimpleFoam-aster/precice-config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<read-data mesh="Fluid-Interface" name="Heat-Transfer-Coefficient-Solid"/>
4242
<mapping:nearest-neighbor constraint="consistent" direction="read" to="Fluid-Interface" from="Solid-Interface-Nodes"/>
4343
</participant>
44-
<m2n:sockets to="Fluid" from="Solid" exchange-directory="/home/michel/Desktop/Code_Aster-Adapter-Dummy/buoyantSimpleFoam-aster" distribution-type="gather-scatter"/>
44+
<m2n:sockets to="Fluid" from="Solid" exchange-directory="/home/michel/Desktop/Code_Aster-Adapter-Dummy/buoyantSimpleFoam-aster"/>
4545
<coupling-scheme:serial-explicit>
4646
<time-window-size value="1"/>
4747
<max-time-windows value="100"/>

0 commit comments

Comments
 (0)