v0.10.0
error_impinging_sphere_hp.sh
Go to the documentation of this file.
1 #!/bin/sh
2 # " chmod -x FILE_NAME " before run the bach script
3 # DIR_NAME="error_mesh_file"
4 BEST_NB_PRC="8"
5 NB_PROC="8"
6 ERROR_TYPE="l2"
7 WAVE_NUMBER="5"
8 ODISP="1"
9 ORDER="1"
10 
11 # for WAVE_NUMBER in {3,5,10}
12 # do
13 partition="false"
14 DUFFY="true"
15 LOBATTO="true"
16 
17 file1="impinging_sphere_$ODISP.cub"
18 # file2="analytical_solution.h5m"
19 #ERROR_TYPE="h1"
20 
21 # BIN_PATH="@CMAKE_CURRENT_BINARY_DIR@"
22 # SRC_PATH="@CMAKE_CURRENT_SOURCE_DIR@"
23 # BIN_PATH="./"
24 # SRC_PATH="./src"
25 
26 MPIRUN="mpirun -np $NB_PROC"
27 
28 # cd $BIN_PATH
29 
30 # for WAVE_NUMBER in 3 5 10 15
31 # do
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 ${DIR_NAME}_${ERROR_TYPE}_sphere_k${WAVE_NUMBER}_p
112 rm -rf error_hard_sphere_h_*_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt | rm -rf hard_sphere_h_*_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
113 # rm -rf hard_sphere_h_*_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt | rm -rf norm_error_k${WAVE_NUMBER}_order_*.vtk
114 
115 
116 # for batman in `seq 1 1`;
117 # do
118 
119  #echo $NB_PROC
120  #BEGIN analytical solution
121 # mpirun -np 8 ./best_approximation \
122 # -my_file impinging_sphere.cub \
123 # -my_is_partitioned false \
124 # -wave_number $WAVE_NUMBER \
125 # -wave_direction 1,0,0 \
126 # -analytical_solution_type hard_sphere_incident_wave \
127 # -save_postproc_mesh false \
128 # -ksp_type fgmres \
129 # -pc_type lu \
130 # -pc_factor_mat_solver_package mumps \
131 # -ksp_monitor \
132 # -my_order 7 \
133 # -my_max_post_proc_ref_level 0 \
134 # -add_incident_wave false \
135 # -amplitude_of_incident_wave 1
136 # done
137 
138 
139 for ODISP in "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12"
140 do
141 
142 
143 
144 echo "Start P enrichment analytical best_approximation calculation with $BEST_NB_PRC processes, mesh h $ODISP and order 8 and wavenumber $WAVE_NUMBER, error type $ERROR_TYPE"
145 
146 #BEGIN analytical solution
147 mpirun -np $BEST_NB_PRC ./best_approximation \
148 -my_file impinging_sphere_$ODISP.cub \
149 -my_is_partitioned $partition \
150 -wave_number $WAVE_NUMBER \
151 -wave_direction 1,0,0 \
152 -analytical_solution_type hard_sphere_incident_wave \
153 -save_postproc_mesh false \
154 -ksp_type fgmres \
155 -pc_type lu \
156 -pc_factor_mat_solver_package superlu_dist \
157 -ksp_monitor \
158 -my_order 8 \
159 -my_max_post_proc_ref_level 0 \
160 -add_incident_wave false \
161 -lobatto true
162 
163 
164 
165 # echo LOG: sound hard sphere P convergence test
166 echo | tee -a hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
167 echo | tee -a error_hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
168 echo " nze DOFs memory unit time CPUtime "| tee -a hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
169 echo "${ERROR_TYPE}relative error "| tee -a error_hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
170 echo "Start p convergence test for sound hard sphere ..."
171 
172 
173 
174 
175 
176 for ORDER in "1" "2" "3" "4" "5" "6" "7" "8"
177 do
178 
179 
180 
181 
182 
183 
184 
185 
186 
187 # if [ $partition = true ]; then mbpart -t -p PARTKWAY $NB_PROC impinging_sphere.cub impinging_sphere_parts$NB_PROC.h5m; fi
188 #
189 # if [ $partition = true ]
190 # then file1="impinging_sphere_parts$NB_PROC.h5m" && file2="best_solution.h5m"
191 # fi
192 
193 
194 
195 
196 # for ORDER in {1..7..1};
197 # for ORDER in `seq 1 8`;
198 # do
199  # let NB_PROC+=${ORDER}
200  # NB_PROC=`expr $ORDER + 1`
201 
202 NB_PROC=`expr $ORDER`
203  ###########################
204 # if [ "$ORDER" -gt "$ODISP" ]
205 # then NB_PROC=`expr $ORDER + 0`
206 # else NB_PROC=`expr $ODISP`
207 # fi
208 # #NB_PROC=$ORDER
209 # MPIRUN="mpirun -np $NB_PROC"
210 ################################
211 
212  #To use partitioned mesh, first mbpart -t -p PARTKWAY 4 sphere4.cub sphere4_4parts.h5m,
213 # let NB_PROC=${ORDER}+1
214 # #echo $NB_PROC
215  # #BEGIN analytical solution
216  # $MPIRUN $BIN_PATH/best_approximation \
217  # -my_file $file1 \
218  # -my_is_partitioned $partition \
219  # -wave_number $WAVE_NUMBER \
220  # -wave_direction 1,0,0 \
221  # -analytical_solution_type hard_sphere_incident_wave \
222  # -save_postproc_mesh false \
223  # -ksp_type fgmres \
224  # -pc_type lu \
225  # -pc_factor_mat_solver_package mumps \
226  # -ksp_monitor \
227  # -my_order $ORDER \
228  # -my_max_post_proc_ref_level 0 \
229  # -add_incident_wave false \
230 
231 #
232 #BEGIN numerical solution
233 #echo " "| tee -a hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
234 #echo "${ERROR_TYPE}relative error "| tee -a error_hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
235 #echo " "| tee -a hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
236 #echo "Start numerical calculation with $NB_PROC processes, mesh h$ODISP and order $ORDER ..." | tee -a hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
237 echo "Start numerical calculation with $NB_PROC processes, mesh h $ODISP and order p $ORDER ..."
238 mpirun -np $NB_PROC ./fe_approximation \
239 -my_file analytical_solution.h5m \
240 -my_is_partitioned $partition \
241 -wave_number $WAVE_NUMBER \
242 -wave_direction 1,0,0 \
243 -save_postproc_mesh false \
244 -ksp_type fgmres \
245 -pc_type lu \
246 -pc_factor_mat_solver_package superlu_dist \
247 -ksp_monitor \
248 -my_order $ORDER \
249 -my_max_post_proc_ref_level 0 \
250 -amplitude_of_incident_wave 1 \
251 -duffy $DUFFY \
252 -lobatto $LOBATTO \
253 -add_incident_wave false 2>&1 |
254 # 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_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
255 # 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_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
256 # echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|nz_used\|Time =\|Memory usage =" | sort | uniq) | awk '{print $2,$15,$22,$23,$27,$28}' | tee -a -i hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
257 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,$7,$17,$24,$29}' | tee -a -i hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
258 echo " "
259 echo " begin error calculation "
260 echo " "
261 #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_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
262 #echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|nz_used\|Time =\|Memory usage =" | sort | uniq) | tee -a -i hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
263 #BEGIN error calculation awk '{print $6,$12}' grep first 10 lines |head -10|
264 #grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =\|Memory usage =" | tee -a -i hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
265 
266 mpirun -np 2 ./error_norm \
267 -my_file ./fe_solution.h5m \
268 -my_is_partitioned false \
269 -norm_type $ERROR_TYPE \
270 -relative_error false \
271 -ksp_type fgmres \
272 -pc_type lu \
273 -pc_factor_mat_solver_package superlu_dist \
274 -ksp_monitor \
275 -my_order 1 \
276 -my_max_post_proc_ref_level 0 \
277 -save_postproc_mesh false 2>&1 | echo $(grep --line-buffered -i " realtive error ") | awk '{print $6,$12}' | tee -a -i error_hard_sphere_h_${ODISP}_k${WAVE_NUMBER}_lobatto_${LOBATTO}.txt
278 #RENAME files inot their order and wave number.
279 # mbconvert norm_error.h5m norm_error.vtk |
280 # mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ORDER}.vtk
281 done
282 
283 done
284 
285 #SAVE the results to different directory
286 # mkdir ${DIR_NAME}_${ERROR_TYPE}_sphere_k${WAVE_NUMBER}_p
287 # mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./${DIR_NAME}_${ERROR_TYPE}_sphere_k${WAVE_NUMBER}_p
288 
289 # done
290 # done
291 #foo="Hello"
292 #foo="$foo World"
293 #echo $foo
294 #> Hello World