v0.10.0
domain_length_control_k_3.sh
Go to the documentation of this file.
1 #!/bin/sh
2 BEST_NB_PRC="8"
3 # " chmod -x FILE_NAME " before run the bach script
4 DIR_NAME="error_mesh_file"
5 NB_PROC="8"
6 ERROR_TYPE="l2" #change the error type here to h1
7 WAVE_NUMBER="0"
8 ODISP="1"
9 ORDER="adaptivity"
10 
11 # for WAVE_NUMBER in {3,5,10}
12 # do
13 partition="false"
14 DUFFY="true"
15 LOBATTO="true"
16 ERRORLV="0"
17 PRIORI_TYPE="1"
18 # file1="impinging_cylinder_$ODISP.cub"
19 # file2="analytical_solution.h5m"
20 #ERROR_TYPE="h1"
21 
22 # BIN_PATH="@CMAKE_CURRENT_BINARY_DIR@"
23 # SRC_PATH="@CMAKE_CURRENT_SOURCE_DIR@"
24 # BIN_PATH="./"
25 # SRC_PATH="./src"
26 
27 # MPIRUN="mpirun -np $NB_PROC"
28 
29 # cd $BIN_PATH
30 
31 
32 
33 # echo LOG: plane wave guide P convergence test
34 # echo | tee -a wave_guide_p.txt
35 # echo "Start p convergence test for plane wave guide ..." | tee -a wave_guide_p.txt
36 # $MPIRUN $BIN_PATH/best_approximation \
37 # -my_file plane_wave_cube.cub \
38 # -my_is_partitioned false \
39 # -wave_number $WAVE_NUMBER \
40 # -wave_direction 0.7071,0.7071,0 \
41 # -analytical_solution_type plane_wave \
42 # -save_postproc_mesh false \
43 # -ksp_type fgmres \
44 # -pc_type lu \
45 # -pc_factor_mat_solver_package mumps \
46 # -ksp_monitor \
47 # -my_order 7 \
48 # -my_max_post_proc_ref_level 0 \
49 # -add_incident_wave false \
50 # -wave_guide_angle 45
51 #
52 # for ODISP in {1..3..1};
53 # do
54 # let NB_PROC=${ODISP}+1
55 # #echo $NB_PROC
56 # #BEGIN analytical solution
57 # # $MPIRUN $BIN_PATH/best_approximation \
58 # # -my_file plane_wave_cube.cub \
59 # # -my_is_partitioned false \
60 # # -wave_number $WAVE_NUMBER \
61 # # -wave_direction 0.7071,0.7071,0 \
62 # # -analytical_solution_type plane_wave \
63 # # -save_postproc_mesh false \
64 # # -ksp_type fgmres \
65 # # -pc_type lu \
66 # # -pc_factor_mat_solver_package mumps \
67 # # -ksp_monitor \
68 # # -my_order $ODISP \
69 # # -my_max_post_proc_ref_level 0 \
70 # # -add_incident_wave false \
71 # # -wave_guide_angle 45
72 #
73 # #BEGIN numerical solution
74 # $MPIRUN $BIN_PATH/fe_approximation \
75 # -my_file analytical_solution.h5m \
76 # -my_is_partitioned false \
77 # -wave_number $WAVE_NUMBER \
78 # -wave_direction 0.7071,0.7071,0 \
79 # -analytical_solution_type plane_wave \
80 # -save_postproc_mesh false \
81 # -ksp_type fgmres \
82 # -pc_type lu \
83 # -pc_factor_mat_solver_package mumps \
84 # -ksp_monitor \
85 # -my_order $ODISP \
86 # -my_max_post_proc_ref_level 0 \
87 # -add_incident_wave false \
88 # -wave_guide_angle 45 |
89 # grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =" | tee -a -i wave_guide_p.txt
90 # #BEGIN error calculation
91 #
92 # $MPIRUN $BIN_PATH/error_norm \
93 # -my_file $BIN_PATH/fe_solution.h5m \
94 # -norm_type $ERROR_TYPE \
95 # -relative_error false \
96 # -ksp_type fgmres \
97 # -pc_type lu \
98 # -pc_factor_mat_solver_package mumps \
99 # -ksp_monitor \
100 # -my_order 1 \
101 # -my_max_post_proc_ref_level 0 \
102 # -save_postproc_mesh true \
103 # 2>&1 | grep --line-buffered -i " $ERROR_TYPE realtive error " | tee -a -i wave_guide_p.txt
104 # #RENAME files inot their order and wave number.
105 # mbconvert norm_error.h5m norm_error.vtk
106 # mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ODISP}.vtk
107 # done
108 #
109 # #SAVE the results to different directory
110 # mkdir ${DIR_NAME}_${ERROR_TYPE}_waveguide | mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./${DIR_NAME}_${ERROR_TYPE}_waveguide
111 rm -rf test_best_approximation_k_*_errorlv_*.txt
112 rm -rf ${DIR_NAME}_${ERROR_TYPE}_cylinder_p
113 rm -rf error_hard_cylinder_k_*_lobatto_${LOBATTO}_errorlv_*_type_*.txt
114 rm -rf hard_cylinder_k_*_lobatto_${LOBATTO}_errorlv_*_type_*.txt | rm -rf norm_error_k*_order_*.vtk
115 
116 
117 # for batman in `seq 1 1`;
118 # do
119 
120  #echo $NB_PROC
121  #BEGIN analytical solution
122 # mpirun -np 8 ./best_approximation \
123 # -my_file impinging_cylinder.cub \
124 # -my_is_partitioned false \
125 # -wave_number $WAVE_NUMBER \
126 # -wave_direction 1,0,0 \
127 # -analytical_solution_type hard_cylinder_incident_wave \
128 # -save_postproc_mesh false \
129 # -ksp_type fgmres \
130 # -pc_type lu \
131 # -pc_factor_mat_solver_package mumps \
132 # -ksp_monitor \
133 # -my_order 7 \
134 # -my_max_post_proc_ref_level 0 \
135 # -add_incident_wave false \
136 # -amplitude_of_incident_wave 1
137 # done
138 
139 # for ODISP in `seq 1 4`;
140 
141 #Frequencies : 1 3 5 10 15 20 30 40 50 60 70
142 for ERROR_TYPE in "l2"
143 do
144 
145 if [ $ERROR_TYPE = "h1" ]
146 then PRIORI_TYPE="2"
147 fi
148 
149 # 1 2 3 4 5 6 7 8 10 15 20
150 # for WAVE_NUMBER in "0.3142" "1.5708" "3.1416" "6.2832" "9.4248" "12.5664" "15.7080"
151 # 1 5 10 30 50 70
152 # "3" "6" "8" fails
153 # for WAVE_NUMBER in "2" "4" "5" "7" "10"
154 for WAVE_NUMBER in "3"
155 do
156 
157 
158 if [ "$WAVE_NUMBER" -gt "6" ]
159 then NB_PROC=`expr 8`
160 else NB_PROC=`expr 4`
161 fi
162 # echo NB_PROC = $NB_PROC
163 
164 
165 
166 
167 for ERRORLV in "2"
168 do
169 
170 
171 # echo LOG: sound hard cylinder P convergence test
172 echo | tee -a test_best_approximation_k_${WAVE_NUMBER}_errorlv_${ERRORLV}.txt
173 echo | tee -a hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
174 echo | tee -a error_hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
175 echo " avg nze max min DOFs memory unit time CPUtime "| tee -a hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
176 echo "${ERROR_TYPE}relative error "| tee -a error_hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
177 echo "Start p convergence test for sound hard cylinder ..."
178 
179 # if [ $partition = true ]; then mbpart -t -p PARTKWAY $NB_PROC impinging_cylinder.cub impinging_cylinder_parts$NB_PROC.h5m; fi
180 
181 # if [ $partition = true ]
182 # then file1="impinging_cylinder_parts$NB_PROC.h5m" && file2="best_solution.h5m"
183 # fi
184 
185 for ODISP in "2" "3"
186 do
187 
188 # BEST_NB_PRC=`expr 2 + $ODISP`
189 
190 echo "Start domain length analysis best_approximation calculation with $BEST_NB_PRC processes, mesh h$ODISP and order 8 and wavenumber $WAVE_NUMBER, error level $ERRORLV"
191 
192 #BEGIN analytical solution
193 mpirun -np $BEST_NB_PRC ./best_approximation \
194 -my_file impinging_cylinder_domain_$ODISP.cub \
195 -my_is_partitioned false \
196 -wave_number $WAVE_NUMBER \
197 -wave_direction 1,0,0 \
198 -analytical_solution_type hard_cylinder_scatter_wave \
199 -save_postproc_mesh false \
200 -ksp_type fgmres \
201 -pc_type lu \
202 -pc_factor_mat_solver_package superlu_dist \
203 -ksp_monitor \
204 -my_order 8 \
205 -my_max_post_proc_ref_level 0 \
206 -add_incident_wave false \
207 -lobatto true 2>&1 |
208 echo $(grep --line-buffered -i "Residual norm\|Time =" | sort | uniq) | tee -a -i test_best_approximation_k_${WAVE_NUMBER}_errorlv_${ERRORLV}.txt
209 
210 
211 # for ORDER in {1..7..1};
212 # for ORDER in `seq 1 8`;
213 # do
214  # let NB_PROC+=${ORDER}
215  # NB_PROC=`expr $ORDER + 1`
216 # if [ "$ORDER" -gt "$ODISP" ]
217 # then NB_PROC=`expr $ORDER + 1`
218 # else NB_PROC=`expr $ODISP + 1`
219 # fi
220 # $(echo $(( 2 * $ODISP )))
221  # NB_PROC=`expr $ODISP + $(echo $(( 2 * $ERRORLV )))`
222  MPIRUN="mpirun -np $NB_PROC"
223 
224 
225  #To use partitioned mesh, first mbpart -t -p PARTKWAY 4 cylinder4.cub cylinder4_4parts.h5m,
226 # let NB_PROC=${ORDER}+1
227 # #echo $NB_PROC
228  # #BEGIN analytical solution
229  # $MPIRUN $BIN_PATH/best_approximation \
230  # -my_file $file1 \
231  # -my_is_partitioned $partition \
232  # -wave_number $WAVE_NUMBER \
233  # -wave_direction 1,0,0 \
234  # -analytical_solution_type hard_cylinder_incident_wave \
235  # -save_postproc_mesh false \
236  # -ksp_type fgmres \
237  # -pc_type lu \
238  # -pc_factor_mat_solver_package mumps \
239  # -ksp_monitor \
240  # -my_order $ORDER \
241  # -my_max_post_proc_ref_level 0 \
242  # -add_incident_wave false \
243 
244 #
245 #BEGIN numerical solution
246 #echo " "| tee -a hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
247 #echo "${ERROR_TYPE}relative error "| tee -a error_hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
248 #echo " "| tee -a hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
249 #echo "Start numerical calculation with $NB_PROC processes, mesh h$ODISP and order $ORDER ..." | tee -a hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
250 echo "Start domain length analysis numerical calculation with $NB_PROC processes, mesh h$ODISP and order $ORDER and wavenumber $WAVE_NUMBER, error level $ERRORLV"
251 mpirun -np $NB_PROC ./fe_approximation \
252 -my_file analytical_solution.h5m \
253 -my_is_partitioned false \
254 -wave_number $WAVE_NUMBER \
255 -wave_direction 1,0,0 \
256 -save_postproc_mesh false \
257 -ksp_type fgmres \
258 -pc_type lu \
259 -pc_factor_mat_solver_package superlu_dist \
260 -ksp_monitor \
261 -my_order 1 \
262 -my_max_post_proc_ref_level 0 \
263 -amplitude_of_incident_wave 1 \
264 -duffy $DUFFY \
265 -lobatto $LOBATTO \
266 -adaptivity true \
267 -error_level $ERRORLV \
268 -error_type $PRIORI_TYPE \
269 -add_incident_wave false 2>&1 |
270 echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|max_value_order_p\|min_value_order_p\|avg_value_order_p\|nz_used\|Time =\|Memory usage =" | sort | uniq) | awk '{print $2,$4,$6,$8,$13,$23,$30,$35}' | tee -a -i hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
271 echo " "
272 echo " begin error calculation "
273 echo " "
274 #echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|nz_used\|Time =\|Memory usage =" | sort | uniq) | awk '{print $2,$7,$17,$24,$25,$29,$30}' | tee -a -i hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
275 #echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|nz_used\|Time =\|Memory usage =" | sort | uniq) | tee -a -i hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
276 #BEGIN error calculation awk '{print $6,$12}' grep first 10 lines |head -10|
277 #grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =\|Memory usage =" | tee -a -i hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
278 
279 mpirun -np 2 ./error_norm \
280 -my_file ./fe_solution.h5m \
281 -my_is_partitioned false \
282 -norm_type $ERROR_TYPE \
283 -relative_error false \
284 -ksp_type fgmres \
285 -pc_type lu \
286 -pc_factor_mat_solver_package superlu_dist \
287 -ksp_monitor \
288 -my_order 1 \
289 -my_max_post_proc_ref_level 0 \
290 -save_postproc_mesh true 2>&1 | echo $(grep --line-buffered -i " realtive error ") | awk '{print $6,$12}' | tee -a -i error_hard_cylinder_k_${WAVE_NUMBER}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_type_${ERROR_TYPE}.txt
291 #RENAME files inot their order and wave number.
292 mbconvert norm_error.h5m norm_error.vtk |
293 mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ORDER}.vtk
294 done
295 
296 done
297 
298 done
299 
300 done
301 #SAVE the results to different directory
302 mkdir ${DIR_NAME}_${ERROR_TYPE}_cylinder_p
303 mv norm_error_k*_order_*.vtk ./${DIR_NAME}_${ERROR_TYPE}_cylinder_p
304 
305 
306 # done
307 #foo="Hello"
308 #foo="$foo World"
309 #echo $foo
310 #> Hello World