v0.10.0
compare_solver_cylinder.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="1"
8 ORDER="1"
9 ############## Change Solver and Lobatto to run analysis KSP can be fixed###################
10 KSP="fgmres"
11 PC="lu"
12 SOLVER="mumps"
13 #-ksp_rtol 1.0e-06
14 # for WAVE_NUMBER in {3,5,10}
15 # do
16 partition="false"
17 DUFFY="true"
18 LOBATTO="true"
19 
20 file1="impinging_cylinder_$ODISP.cub"
21 file2="analytical_solution.h5m"
22 #ERROR_TYPE="h1"
23 
24 # BIN_PATH="@CMAKE_CURRENT_BINARY_DIR@"
25 # SRC_PATH="@CMAKE_CURRENT_SOURCE_DIR@"
26 BIN_PATH="./"
27 SRC_PATH="./src"
28 
29 MPIRUN="mpirun -np $NB_PROC"
30 
31 # parms + fgmres + superlu
32 #cd $BIN_PATH
33 # "sor" "jacobi" "pbjacobi" "asm" "gasm" "parms"
34 # "tfqmr" "bcgsl" "cg" "cgs" "bcgs" "tcqmr" "minres" "lsqr" "nash" "gcr" "fgmres" "chebyshev"
35 rm -rf ${DIR_NAME}_${ERROR_TYPE}_cylinder_k*_p
36 rm -rf *_*_*_error_hard_cylinder_p_*_meshsize_*_lobatto_${LOBATTO}.txt
37 rm -rf *_*_*_hard_cylinder_p_*_meshsize_*_lobatto_${LOBATTO}.txt | rm -rf norm_error_k*_order_*.vt
38 
39 for WAVE_NUMBER in "3" "5" "10"
40 do
41 
42 for SOLVER in "superlu_dist"
43 do
44 
45 for KSP in "tfqmr" "bcgsl" "cg" "cgs" "bcgs" "tcqmr" "minres" "lsqr" "nash" "gcr" "fgmres" "chebyshev"
46 do
47 
48 for PC in "lu"
49 do
50 
51 # echo LOG: plane wave guide P convergence test
52 # echo | tee -a wave_guide_p.txt
53 # echo "Start p convergence test for plane wave guide ..." | tee -a wave_guide_p.txt
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 mumps \
64 # -ksp_monitor \
65 # -my_order 7 \
66 # -my_max_post_proc_ref_level 0 \
67 # -add_incident_wave false \
68 # -wave_guide_angle 45
69 #
70 # for ODISP in {1..3..1};
71 # do
72 # let NB_PROC=${ODISP}+1
73 # #echo $NB_PROC
74 # #BEGIN analytical solution
75 # # $MPIRUN $BIN_PATH/best_approximation \
76 # # -my_file plane_wave_cube.cub \
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 #
91 # #BEGIN numerical solution
92 # $MPIRUN $BIN_PATH/fe_approximation \
93 # -my_file analytical_solution.h5m \
94 # -my_is_partitioned false \
95 # -wave_number $WAVE_NUMBER \
96 # -wave_direction 0.7071,0.7071,0 \
97 # -analytical_solution_type plane_wave \
98 # -save_postproc_mesh false \
99 # -ksp_type fgmres \
100 # -pc_type lu \
101 # -pc_factor_mat_solver_package mumps \
102 # -ksp_monitor \
103 # -my_order $ODISP \
104 # -my_max_post_proc_ref_level 0 \
105 # -add_incident_wave false \
106 # -wave_guide_angle 45 |
107 # grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =" | tee -a -i wave_guide_p.txt
108 # #BEGIN error calculation
109 #
110 # $MPIRUN $BIN_PATH/error_norm \
111 # -my_file $BIN_PATH/fe_solution.h5m \
112 # -norm_type $ERROR_TYPE \
113 # -relative_error false \
114 # -ksp_type fgmres \
115 # -pc_type lu \
116 # -pc_factor_mat_solver_package mumps \
117 # -ksp_monitor \
118 # -my_order 1 \
119 # -my_max_post_proc_ref_level 0 \
120 # -save_postproc_mesh true \
121 # 2>&1 | grep --line-buffered -i " $ERROR_TYPE realtive error " | tee -a -i wave_guide_p.txt
122 # #RENAME files inot their order and wave number.
123 # mbconvert norm_error.h5m norm_error.vtk
124 # mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ODISP}.vtk
125 # done
126 #
127 # #SAVE the results to different directory
128 # mkdir ${DIR_NAME}_${ERROR_TYPE}_waveguide | mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./${DIR_NAME}_${ERROR_TYPE}_waveguide
129 
130 
131 # for batman in `seq 1 1`;
132 # do
133 
134  #echo $NB_PROC
135  #BEGIN analytical solution
136 # mpirun -np 8 ./best_approximation \
137 # -my_file impinging_cylinder.cub \
138 # -my_is_partitioned false \
139 # -wave_number $WAVE_NUMBER \
140 # -wave_direction 1,0,0 \
141 # -analytical_solution_type hard_cylinder_incident_wave \
142 # -save_postproc_mesh false \
143 # -ksp_type fgmres \
144 # -pc_type lu \
145 # -pc_factor_mat_solver_package mumps \
146 # -ksp_monitor \
147 # -my_order 7 \
148 # -my_max_post_proc_ref_level 0 \
149 # -add_incident_wave false \
150 # -amplitude_of_incident_wave 1
151 # done
152 
153 for ODISP in "3"
154 do
155 
156 echo LOG: sound hard cylinder P convergence test
157 echo | tee -a ${SOLVER}_${PC}_${KSP}_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
158 echo | tee -a ${SOLVER}_${PC}_${KSP}_error_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
159 echo " DOFs memory unit time unit CPUtime unit "| tee -a ${SOLVER}_${PC}_${KSP}_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
160 echo "${ERROR_TYPE}relative error "| tee -a ${SOLVER}_${PC}_${KSP}_error_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
161 echo "Start p convergence test for sound hard cylinder ..."
162 
163 
164 #BEGIN analytical solution
165 mpirun -np 8 ./best_approximation \
166 -my_file impinging_cylinder_${ODISP}.cub \
167 -my_is_partitioned false \
168 -wave_number $WAVE_NUMBER \
169 -wave_direction 1,0,0 \
170 -analytical_solution_type hard_cylinder_scatter_wave \
171 -save_postproc_mesh false \
172 -ksp_type fgmres \
173 -pc_type lu \
174 -pc_factor_mat_solver_package superlu_dist \
175 -ksp_monitor \
176 -my_order 8 \
177 -my_max_post_proc_ref_level 0 \
178 -add_incident_wave false \
179 -lobatto true \
180 
181 # for ORDER in {1..7..1};
182 for ORDER in `seq 1 8`;
183 do
184  # let NB_PROC+=${ORDER}
185  # NB_PROC=`expr $ORDER + 1`
186 if [ "$ORDER" -gt "$ODISP" ]
187 then NB_PROC=`expr $ORDER + 1`
188 else NB_PROC=`expr $ODISP + 1`
189 fi
190  #NB_PROC=$ORDER
191  MPIRUN="mpirun -np $NB_PROC"
192  if [ $partition = true ]; then mbpart -t -p PARTKWAY $NB_PROC impinging_cylinder.cub impinging_cylinder_parts$NB_PROC.h5m; fi
193 
194 if [ $partition = true ]
195 then file1="impinging_cylinder_parts$NB_PROC.h5m" && file2="best_solution.h5m"
196 fi
197 
198  #To use partitioned mesh, first mbpart -t -p PARTKWAY 4 cylinder4.cub cylinder4_4parts.h5m,
199 # let NB_PROC=${ORDER}+1
200 # #echo $NB_PROC
201  # #BEGIN analytical solution
202  # $MPIRUN $BIN_PATH/best_approximation \
203  # -my_file $file1 \
204  # -my_is_partitioned $partition \
205  # -wave_number $WAVE_NUMBER \
206  # -wave_direction 1,0,0 \
207  # -analytical_solution_type hard_cylinder_incident_wave \
208  # -save_postproc_mesh false \
209  # -ksp_type fgmres \
210  # -pc_type lu \
211  # -pc_factor_mat_solver_package mumps \
212  # -ksp_monitor \
213  # -my_order $ORDER \
214  # -my_max_post_proc_ref_level 0 \
215  # -add_incident_wave false \
216 
217 #-ksp_monitor_true_residual
218 #BEGIN numerical solution
219 #echo " "| tee -a ${SOLVER}_${PC}_${KSP}_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
220 #echo "${ERROR_TYPE}relative error "| tee -a ${SOLVER}_${PC}_${KSP}_error_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
221 #echo " "| tee -a ${SOLVER}_${PC}_${KSP}_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
222 #echo "Start numerical calculation with $NB_PROC processes, mesh h$ODISP and order $ORDER ..." | tee -a ${SOLVER}_${PC}_${KSP}_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
223 echo "Start numerical calculation with $NB_PROC processes, solver : ${SOLVER} Preconditioner : ${PC} KSP : ${KSP}, and mesh h$ODISP and order $ORDER ..."
224 mpirun -np $NB_PROC ./fe_approximation \
225 -my_file analytical_solution.h5m \
226 -my_is_partitioned false \
227 -wave_number $WAVE_NUMBER \
228 -wave_direction 1,0,0 \
229 -save_postproc_mesh false \
230 -ksp_type $KSP \
231 -pc_type $PC \
232 -pc_factor_mat_solver_package $SOLVER \
233 -ksp_monitor \
234 -my_order $ORDER \
235 -my_max_post_proc_ref_level 0 \
236 -amplitude_of_incident_wave 1 \
237 -duffy $DUFFY \
238 -lobatto $LOBATTO \
239 -ksp_rtol 1.e-06 \
240 -add_incident_wave false |
241 echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|nz_used\|Time =\|Memory usage =" | sort | uniq) | awk '{print $2,$7,$17,$24,$29}' | tee -a -i ${SOLVER}_${PC}_${KSP}_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
242 echo " "
243 echo " begin error calculation "
244 echo " "
245 #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 ${SOLVER}_${PC}_${KSP}_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
246 #echo $(grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|nz_used\|Time =\|Memory usage =" | sort | uniq) | tee -a -i ${SOLVER}_${PC}_${KSP}_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
247 #BEGIN error calculation awk '{print $6,$12}' grep first 10 lines |head -10|
248 #grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =\|Memory usage =" | tee -a -i ${SOLVER}_${PC}_${KSP}_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
249 
250 mpirun -np 2 ./error_norm \
251 -my_file ./fe_solution.h5m \
252 -my_is_partitioned false \
253 -norm_type $ERROR_TYPE \
254 -relative_error false \
255 -ksp_type fgmres \
256 -pc_type lu \
257 -pc_factor_mat_solver_package superlu_dist \
258 -ksp_monitor \
259 -my_order 1 \
260 -my_max_post_proc_ref_level 0 \
261 -save_postproc_mesh true 2>&1 | echo $(grep --line-buffered -i " realtive error ") | awk '{print $6,$12}' | tee -a -i ${SOLVER}_${PC}_${KSP}_error_hard_cylinder_p_${WAVE_NUMBER}_meshsize_${ODISP}_lobatto_${LOBATTO}.txt
262 #RENAME files inot their order and wave number.
263 mbconvert norm_error.h5m norm_error.vtk |
264 mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ORDER}.vtk
265 done
266 
267 done
268 
269 #SAVE the results to different directory
270 mkdir ${DIR_NAME}_${ERROR_TYPE}_cylinder_k${WAVE_NUMBER}_p
271 mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./${DIR_NAME}_${ERROR_TYPE}_cylinder_k${WAVE_NUMBER}_p
272 
273 done
274 done
275 done
276 done
277 
278 # done
279 #foo="Hello"
280 #foo="$foo World"
281 #echo $foo
282 #> Hello World