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