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