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