v0.10.0
priori_error_bounds_.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"
7 WAVE_NUMBER="0"
8 ODISP="1"
9 ORDER="adaptivity"
10 #Error upper lower bounds switch algorithms
11 BOUNDS="1"
12 # for WAVE_NUMBER in {3,5,10}
13 # do
14 partition="false"
15 DUFFY="true"
16 LOBATTO="true"
17 ERRORLV="0"
18 PRIORI_TYPE="1"
19 # file1="impinging_cylinder_$ODISP.cub"
20 # file2="analytical_solution.h5m"
21 #ERROR_TYPE="h1"
22 
23 # BIN_PATH="@CMAKE_CURRENT_BINARY_DIR@"
24 # SRC_PATH="@CMAKE_CURRENT_SOURCE_DIR@"
25 # BIN_PATH="./"
26 # SRC_PATH="./src"
27 
28 MPIRUN="mpirun -np $NB_PROC"
29 
30 # cd $BIN_PATH
31 
32 
33 
34 # echo LOG: plane wave guide P convergence test
35 # echo | tee -a wave_guide_p.txt
36 # echo "Start p convergence test for plane wave guide ..." | tee -a wave_guide_p.txt
37 # $MPIRUN $BIN_PATH/best_approximation \
38 # -my_file plane_wave_cube.cub \
39 # -my_is_partitioned false \
40 # -wave_number $WAVE_NUMBER \
41 # -wave_direction 0.7071,0.7071,0 \
42 # -analytical_solution_type plane_wave \
43 # -save_postproc_mesh false \
44 # -ksp_type fgmres \
45 # -pc_type lu \
46 # -pc_factor_mat_solver_package mumps \
47 # -ksp_monitor \
48 # -my_order 7 \
49 # -my_max_post_proc_ref_level 0 \
50 # -add_incident_wave false \
51 # -wave_guide_angle 45
52 #
53 # for ODISP in {1..3..1};
54 # do
55 # let NB_PROC=${ODISP}+1
56 # #echo $NB_PROC
57 # #BEGIN analytical solution
58 # # $MPIRUN $BIN_PATH/best_approximation \
59 # # -my_file plane_wave_cube.cub \
60 # # -my_is_partitioned false \
61 # # -wave_number $WAVE_NUMBER \
62 # # -wave_direction 0.7071,0.7071,0 \
63 # # -analytical_solution_type plane_wave \
64 # # -save_postproc_mesh false \
65 # # -ksp_type fgmres \
66 # # -pc_type lu \
67 # # -pc_factor_mat_solver_package mumps \
68 # # -ksp_monitor \
69 # # -my_order $ODISP \
70 # # -my_max_post_proc_ref_level 0 \
71 # # -add_incident_wave false \
72 # # -wave_guide_angle 45
73 #
74 # #BEGIN numerical solution
75 # $MPIRUN $BIN_PATH/fe_approximation \
76 # -my_file analytical_solution.h5m \
77 # -my_is_partitioned false \
78 # -wave_number $WAVE_NUMBER \
79 # -wave_direction 0.7071,0.7071,0 \
80 # -analytical_solution_type plane_wave \
81 # -save_postproc_mesh false \
82 # -ksp_type fgmres \
83 # -pc_type lu \
84 # -pc_factor_mat_solver_package mumps \
85 # -ksp_monitor \
86 # -my_order $ODISP \
87 # -my_max_post_proc_ref_level 0 \
88 # -add_incident_wave false \
89 # -wave_guide_angle 45 |
90 # grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =" | tee -a -i wave_guide_p.txt
91 # #BEGIN error calculation
92 #
93 # $MPIRUN $BIN_PATH/error_norm \
94 # -my_file $BIN_PATH/fe_solution.h5m \
95 # -norm_type $ERROR_TYPE \
96 # -relative_error false \
97 # -ksp_type fgmres \
98 # -pc_type lu \
99 # -pc_factor_mat_solver_package mumps \
100 # -ksp_monitor \
101 # -my_order 1 \
102 # -my_max_post_proc_ref_level 0 \
103 # -save_postproc_mesh true \
104 # 2>&1 | grep --line-buffered -i " $ERROR_TYPE realtive error " | tee -a -i wave_guide_p.txt
105 # #RENAME files inot their order and wave number.
106 # mbconvert norm_error.h5m norm_error.vtk
107 # mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ODISP}.vtk
108 # done
109 #
110 # #SAVE the results to different directory
111 # mkdir ${DIR_NAME}_${ERROR_TYPE}_waveguide | mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./${DIR_NAME}_${ERROR_TYPE}_waveguide
112 rm -rf test_best_approximation.txt
113 rm -rf ${DIR_NAME}_${ERROR_TYPE}_cylinder_p
114 rm -rf error_hard_cylinder_p_meshsize_*_lobatto_${LOBATTO}_errorlv_*_errorbounds_*.txt
115 rm -rf hard_cylinder_p_meshsize_*_lobatto_${LOBATTO}_errorlv_*_errorbounds_*.txt | rm -rf norm_error_k*_order_*.vtk
116 
117 
118 # for batman in `seq 1 1`;
119 # do
120 
121  #echo $NB_PROC
122  #BEGIN analytical solution
123 # mpirun -np 8 ./best_approximation \
124 # -my_file impinging_cylinder.cub \
125 # -my_is_partitioned false \
126 # -wave_number $WAVE_NUMBER \
127 # -wave_direction 1,0,0 \
128 # -analytical_solution_type hard_cylinder_incident_wave \
129 # -save_postproc_mesh false \
130 # -ksp_type fgmres \
131 # -pc_type lu \
132 # -pc_factor_mat_solver_package mumps \
133 # -ksp_monitor \
134 # -my_order 7 \
135 # -my_max_post_proc_ref_level 0 \
136 # -add_incident_wave false \
137 # -amplitude_of_incident_wave 1
138 # done
139 
140 
141 
142 # for ODISP in "2"
143 # for ODISP in `seq 1 4`;
144 for ODISP in "1" "3" "4" "5"
145 do
146 
147 
148 for BOUNDS in "1" "2" "3"
149 do
150 
151 # BEST_NB_PRC=`expr 7 + $ODISP`
152 
153 
154 # for ERRORLV in "0" "1" "2"
155 for ERRORLV in "0" "1" "2"
156 do
157 
158 
159 COUNT="0"
160 
161 
162 # echo LOG: sound hard cylinder P convergence test
163 echo | tee -a test_best_approximation.txt
164 echo | tee -a hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_errorbounds_${BOUNDS}.txt
165 echo | tee -a error_hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_errorbounds_${BOUNDS}.txt
166 echo " avg facm nze max min DOFs memory time CPUtime "| tee -a hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_errorbounds_${BOUNDS}.txt
167 echo "${ERROR_TYPE}relative error "| tee -a error_hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_errorbounds_${BOUNDS}.txt
168 echo "Start p convergence test for sound hard cylinder ..."
169 
170 # if [ $partition = true ]; then mbpart -t -p PARTKWAY $NB_PROC impinging_cylinder.cub impinging_cylinder_parts$NB_PROC.h5m; fi
171 
172 # if [ $partition = true ]
173 # then file1="impinging_cylinder_parts$NB_PROC.h5m" && file2="best_solution.h5m"
174 # fi
175 
176 for WAVE_NUMBER in "0.125663706143592" "0.987976724163411" "1.85028974218323" "2.71260276020305" "3.57491577822287" "4.43722879624269" "5.29954181426251" "6.16185483228233" "7.02416785030214" "7.88648086832196" "8.74879388634178" "9.61110690436160" "10.4734199223814" "11.3357329404012" "12.1980459584211" "13.0603589764409" "13.9226719944607" "14.7849850124805" "15.6472980305003" "16.5096110485202" "17.3719240665400" "18.2342370845598" "19.0965501025796" "19.9588631205994" "20.8211761386193" "21.6834891566391" "22.5458021746589" "23.4081151926787" "24.2704282106985" "25.1327412287183"
177 do
178 
179 
180 echo "Start best_approximation calculation with $BEST_NB_PRC processes, mesh h$ODISP and order 8 and wavenumber $WAVE_NUMBER, error level $ERRORLV"
181 
182 #BEGIN analytical solution
183 mpirun -np $BEST_NB_PRC ./best_approximation \
184 -my_file impinging_cylinder_$ODISP.cub \
185 -my_is_partitioned false \
186 -wave_number $WAVE_NUMBER \
187 -wave_direction 1,0,0 \
188 -analytical_solution_type hard_cylinder_scatter_wave \
189 -save_postproc_mesh false \
190 -ksp_type fgmres \
191 -pc_type lu \
192 -pc_factor_mat_solver_package superlu_dist \
193 -ksp_monitor \
194 -my_order 8 \
195 -my_max_post_proc_ref_level 0 \
196 -add_incident_wave false \
197 -duffy true \
198 -lobatto true 2>&1 |
199 echo $(grep --line-buffered -i "Residual norm\|Time =" | sort | uniq) | tee -a -i test_best_approximation.txt
200 
201 
202 
203 # for ORDER in {1..7..1};
204 # for ORDER in `seq 1 8`;
205 # do
206  # let NB_PROC+=${ORDER}
207  # NB_PROC=`expr $ORDER + 1`
208 # if [ "$ORDER" -gt "$ODISP" ]
209 # then NB_PROC=`expr $ORDER + 1`
210 # else NB_PROC=`expr $ODISP + 1`
211 # fi
212 # $(echo $(( 2 * $ODISP )))
213  # NB_PROC=`expr $ODISP + $(echo $(( 2 * $ERRORLV ))) + 1`
214 
215 
216 COUNT=`expr $COUNT + 1`
217 if [ "$COUNT" -gt "8" ]
218 then NB_PROC=`expr 8`
219 else NB_PROC=`expr 2`
220 fi
221 echo NB_PROC = $NB_PROC
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_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}.txt
247 #echo "${ERROR_TYPE}relative error "| tee -a error_hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}.txt
248 #echo " "| tee -a hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}.txt
249 #echo "Start numerical calculation with $NB_PROC processes, mesh h$ODISP and order $ORDER ..." | tee -a hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}.txt
250 echo "Start priori estimator numerical calculation with $NB_PROC processes, and Error Criterion $BOUNDS, 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 -error_criterion $BOUNDS \
270 -add_incident_wave false 2>&1 |
271 echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|max_value_order_p\|min_value_order_p\|avg_value_order_p\|nz_used\|info.memory\|Time =\|Memory usage =" | sort | uniq) | awk '{print $2,$4,$6,$8,$10,$15,$25,$32,$37}' | tee -a -i hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_errorbounds_${BOUNDS}.txt
272 echo " "
273 echo " begin error calculation "
274 echo " "
275 # echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|max_value_order_p\|min_value_order_p\|avg_value_order_p\|nz_used\|info.memory\|Time =\|Memory usage =" | sort | uniq) | tee -a -i hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}.txt
276 # echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|max_value_order_p\|min_value_order_p\|avg_value_order_p\|nz_used\|info.memory\|Time =\|Memory usage =" | sort | uniq) | awk '{print $2,$4,$6,$8,$10,$15,$25,$32,$37}' | tee -a -i hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}.txt
277 #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_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}.txt
278 #echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|nz_used\|Time =\|Memory usage =" | sort | uniq) | tee -a -i hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}.txt
279 #BEGIN error calculation awk '{print $6,$12}' grep first 10 lines |head -10|
280 #grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =\|Memory usage =" | tee -a -i hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}.txt
281 
282 mpirun -np 2 ./error_norm \
283 -my_file ./fe_solution.h5m \
284 -my_is_partitioned false \
285 -norm_type $ERROR_TYPE \
286 -relative_error false \
287 -ksp_type fgmres \
288 -pc_type lu \
289 -pc_factor_mat_solver_package superlu_dist \
290 -ksp_monitor \
291 -my_order 1 \
292 -my_max_post_proc_ref_level 0 \
293 -save_postproc_mesh true 2>&1 | echo $(grep --line-buffered -i " realtive error ") | awk '{print $6,$12}' | tee -a -i error_hard_cylinder_p_meshsize_${ODISP}_lobatto_${LOBATTO}_errorlv_${ERRORLV}_errorbounds_${BOUNDS}.txt
294 #RENAME files inot their order and wave number.
295 mbconvert norm_error.h5m norm_error.vtk |
296 mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ORDER}.vtk
297 
298 done
299 
300 done
301 
302 done
303 
304 done
305 
306 #SAVE the results to different directory
307 mkdir ${DIR_NAME}_${ERROR_TYPE}_cylinder_p
308 mv norm_error_k*_order_*.vtk ./${DIR_NAME}_${ERROR_TYPE}_cylinder_p
309 
310 
311 # done
312 #foo="Hello"
313 #foo="$foo World"
314 #echo $foo
315 #> Hello World