v0.10.0
error_estimation_sphere_p.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 NB_PROC=1
5 ERROR_TYPE="l2"
6 WAVE_NUMBER="3"
7 
8 # for WAVE_NUMBER in {3,5,10}
9 # do
10 partition="false"
11 DUFFY="true"
12 LABATTO="false"
13 
14 file1="impinging_sphere.cub"
15 file2="analytical_solution.h5m"
16 #ERROR_TYPE="h1"
17 
18 # BIN_PATH="@CMAKE_CURRENT_BINARY_DIR@"
19 # SRC_PATH="@CMAKE_CURRENT_SOURCE_DIR@"
20 BIN_PATH="./"
21 SRC_PATH="./src"
22 
23 MPIRUN="mpirun -np $NB_PROC"
24 
25 cd $BIN_PATH
26 
27 for WAVE_NUMBER in 3 5 10
28 do
29 
30 # echo LOG: plane wave guide P convergence test
31 # echo | tee -a wave_guide_p.txt
32 # echo "Start p convergence test for plane wave guide ..." | tee -a wave_guide_p.txt
33 # $MPIRUN $BIN_PATH/best_approximation \
34 # -my_file plane_wave_cube.cub \
35 # -my_is_partitioned false \
36 # -wave_number $WAVE_NUMBER \
37 # -wave_direction 0.7071,0.7071,0 \
38 # -analytical_solution_type plane_wave \
39 # -save_postproc_mesh false \
40 # -ksp_type fgmres \
41 # -pc_type lu \
42 # -pc_factor_mat_solver_package superlu_dist \
43 # -ksp_monitor \
44 # -my_order 7 \
45 # -my_max_post_proc_ref_level 0 \
46 # -add_incident_wave false \
47 # -wave_guide_angle 45
48 #
49 # for ODISP in {1..3..1};
50 # do
51 # let NB_PROC=${ODISP}+1
52 # #echo $NB_PROC
53 # #BEGIN analytical solution
54 # # $MPIRUN $BIN_PATH/best_approximation \
55 # # -my_file plane_wave_cube.cub \
56 # # -my_is_partitioned false \
57 # # -wave_number $WAVE_NUMBER \
58 # # -wave_direction 0.7071,0.7071,0 \
59 # # -analytical_solution_type plane_wave \
60 # # -save_postproc_mesh false \
61 # # -ksp_type fgmres \
62 # # -pc_type lu \
63 # # -pc_factor_mat_solver_package superlu_dist \
64 # # -ksp_monitor \
65 # # -my_order $ODISP \
66 # # -my_max_post_proc_ref_level 0 \
67 # # -add_incident_wave false \
68 # # -wave_guide_angle 45
69 #
70 # #BEGIN numerical solution
71 # $MPIRUN $BIN_PATH/fe_approximation \
72 # -my_file analytical_solution.h5m \
73 # -my_is_partitioned false \
74 # -wave_number $WAVE_NUMBER \
75 # -wave_direction 0.7071,0.7071,0 \
76 # -analytical_solution_type plane_wave \
77 # -save_postproc_mesh false \
78 # -ksp_type fgmres \
79 # -pc_type lu \
80 # -pc_factor_mat_solver_package mumps \
81 # -ksp_monitor \
82 # -my_order $ODISP \
83 # -my_max_post_proc_ref_level 0 \
84 # -add_incident_wave false \
85 # -wave_guide_angle 45 |
86 # grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =" | tee -a -i wave_guide_p.txt
87 # #BEGIN error calculation
88 #
89 # $MPIRUN $BIN_PATH/error_norm \
90 # -my_file $BIN_PATH/fe_solution.h5m \
91 # -norm_type $ERROR_TYPE \
92 # -relative_error false \
93 # -ksp_type fgmres \
94 # -pc_type lu \
95 # -pc_factor_mat_solver_package superlu_dist \
96 # -ksp_monitor \
97 # -my_order 1 \
98 # -my_max_post_proc_ref_level 0 \
99 # -save_postproc_mesh true \
100 # 2>&1 | grep --line-buffered -i " $ERROR_TYPE realtive error " | tee -a -i wave_guide_p.txt
101 # #RENAME files inot their order and wave number.
102 # mbconvert norm_error.h5m norm_error.vtk
103 # mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ODISP}.vtk
104 # done
105 #
106 # #SAVE the results to different directory
107 # mkdir ${DIR_NAME}_${ERROR_TYPE}_waveguide | mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./${DIR_NAME}_${ERROR_TYPE}_waveguide
108 rm -rf ${DIR_NAME}_${ERROR_TYPE}_sphere_k${WAVE_NUMBER}_p
109 rm -rf hard_sphere_p_${WAVE_NUMBER}_labatto_${LABATTO}.txt | rm -rf norm_error_k${WAVE_NUMBER}_order_*.vtk
110 echo LOG: sound hard sphere P convergence test
111 echo | tee -a hard_sphere_p_${WAVE_NUMBER}_labatto_${LABATTO}.txt
112 echo "Start p convergence test for sound hard sphere ..." | tee -a hard_sphere_p_${WAVE_NUMBER}_labatto_${LABATTO}.txt
113 
114 # for batman in `seq 1 1`;
115 # do
116 
117  #echo $NB_PROC
118  #BEGIN analytical solution
119 # mpirun -np 8 ./best_approximation \
120 # -my_file impinging_sphere.cub \
121 # -my_is_partitioned false \
122 # -wave_number $WAVE_NUMBER \
123 # -wave_direction 1,0,0 \
124 # -analytical_solution_type hard_sphere_incident_wave \
125 # -save_postproc_mesh false \
126 # -ksp_type fgmres \
127 # -pc_type lu \
128 # -pc_factor_mat_solver_package superlu_dist \
129 # -ksp_monitor \
130 # -my_order 7 \
131 # -my_max_post_proc_ref_level 0 \
132 # -add_incident_wave false \
133 # -amplitude_of_incident_wave 1
134 # done
135 
136 #BEGIN analytical solution
137 mpirun -np 6 $BIN_PATH/best_approximation \
138 -my_file $file1 \
139 -my_is_partitioned $partition \
140 -wave_number $WAVE_NUMBER \
141 -wave_direction 1,0,0 \
142 -analytical_solution_type hard_sphere_incident_wave \
143 -save_postproc_mesh false \
144 -ksp_type fgmres \
145 -pc_type lu \
146 -pc_factor_mat_solver_package superlu_dist \
147 -ksp_monitor \
148 -my_order 6 \
149 -my_max_post_proc_ref_level 0 \
150 -add_incident_wave false \
151 -labatto true \
152 
153 # for ODISP in {1..7..1};
154 for ODISP in `seq 1 6`;
155 do
156  # let NB_PROC+=${ODISP}
157  # NB_PROC=`expr $ODISP + 1`
158  #NB_PROC=`expr $ODISP + 1`
159  NB_PROC=$ODISP
160  MPIRUN="mpirun -np $NB_PROC"
161  if [ $partition = true ]; then mbpart -t -p PARTKWAY $NB_PROC impinging_sphere.cub impinging_sphere_parts$NB_PROC.h5m; fi
162 
163 if [ $partition = true ]
164 then file1="impinging_sphere_parts$NB_PROC.h5m" && file2="best_solution.h5m"
165 fi
166 
167  #To use partitioned mesh, first mbpart -t -p PARTKWAY 4 sphere4.cub sphere4_4parts.h5m,
168 # let NB_PROC=${ODISP}+1
169 # #echo $NB_PROC
170  # #BEGIN analytical solution
171  # $MPIRUN $BIN_PATH/best_approximation \
172  # -my_file $file1 \
173  # -my_is_partitioned $partition \
174  # -wave_number $WAVE_NUMBER \
175  # -wave_direction 1,0,0 \
176  # -analytical_solution_type hard_sphere_incident_wave \
177  # -save_postproc_mesh false \
178  # -ksp_type fgmres \
179  # -pc_type lu \
180  # -pc_factor_mat_solver_package superlu_dist \
181  # -ksp_monitor \
182  # -my_order $ODISP \
183  # -my_max_post_proc_ref_level 0 \
184  # -add_incident_wave false \
185 
186 #
187 #BEGIN numerical solution
188 echo " "| tee -a hard_sphere_p_${WAVE_NUMBER}_labatto_${LABATTO}.txt
189 echo " "| tee -a hard_sphere_p_${WAVE_NUMBER}_labatto_${LABATTO}.txt
190 echo "Start numerical calculation with $NB_PROC processes, and order $ODISP ..." | tee -a hard_sphere_p_${WAVE_NUMBER}_labatto_${LABATTO}.txt
191 
192 $MPIRUN $BIN_PATH/fe_approximation \
193 -my_file $file2 \
194 -my_is_partitioned $partition \
195 -wave_number $WAVE_NUMBER \
196 -wave_direction 1,0,0 \
197 -save_postproc_mesh false \
198 -ksp_type fgmres \
199 -pc_type lu \
200 -pc_factor_mat_solver_package superlu_dist \
201 -ksp_monitor \
202 -my_order $ODISP \
203 -my_max_post_proc_ref_level 0 \
204 -amplitude_of_incident_wave 1 \
205 -duffy $DUFFY \
206 -labatto $LABATTO \
207 -add_incident_wave false 2>&1 |
208 grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =\|Memory usage =" | tee -a -i hard_sphere_p_${WAVE_NUMBER}_labatto_${LABATTO}.txt
209 echo " "
210 echo " begin error calculation "
211 echo " "
212 #BEGIN error calculation
213 mpirun -np 2 $BIN_PATH/error_norm \
214 -my_file $BIN_PATH/fe_solution.h5m \
215 -my_is_partitioned $partition \
216 -norm_type $ERROR_TYPE \
217 -relative_error false \
218 -ksp_type fgmres \
219 -pc_type lu \
220 -pc_factor_mat_solver_package superlu_dist \
221 -ksp_monitor \
222 -my_order 1 \
223 -my_max_post_proc_ref_level 0 \
224 -save_postproc_mesh true 2>&1 | grep --line-buffered -i " realtive error " | tee -a -i hard_sphere_p_${WAVE_NUMBER}_labatto_${LABATTO}.txt
225 #RENAME files inot their order and wave number.
226 mbconvert norm_error.h5m norm_error.vtk |
227 mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ODISP}.vtk
228 done
229 
230 #SAVE the results to different directory
231 mkdir ${DIR_NAME}_${ERROR_TYPE}_sphere_k${WAVE_NUMBER}_p
232 mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./${DIR_NAME}_${ERROR_TYPE}_sphere_k${WAVE_NUMBER}_p
233 
234 done
235 # done
236 #foo="Hello"
237 #foo="$foo World"
238 #echo $foo
239 #> Hello World