@@ -187,7 +187,24 @@ def damping_alpha(self):
187187 try :
188188 return self ._damping_alpha
189189 except AttributeError :
190- return 0.001
190+ if self .dimension == 2 :
191+ # 2 dimension
192+ z_min , z_max , x_min , x_max = self .bounding_box
193+ z_top_damp , z_bottom_damp , x_left_damp , x_right_damp = self .damping_length
194+ nz = z_max - z_min + z_top_damp + z_bottom_damp
195+ nx = x_max - x_min + x_left_damp + x_right_damp
196+ # get the maximum domain length in one of 2 dimensions (meters)
197+ max_length = max (nz , nx )
198+ else :
199+ # 3 dimension
200+ z_min , z_max , x_min , x_max , y_min , y_max = self .bounding_box
201+ z_top_damp , z_bottom_damp , x_left_damp , x_right_damp , y_front_damp , y_back_damp = self .damping_length
202+ nz = z_max - z_min + z_top_damp + z_bottom_damp
203+ nx = x_max - x_min + x_left_damp + x_right_damp
204+ ny = y_max - y_min + y_front_damp + y_back_damp
205+ # get the maximum domain length in one of 3 dimensions (meters)
206+ max_length = max (nz , nx , ny )
207+ return np .log (1 / 10 ** - 3 ) * (self .dimension * np .max (self .velocity_model ) / (2 * max_length ) ) / max_length ** 2
191208
192209 def fd_coefficients (self , derivative_order ):
193210 """
@@ -269,7 +286,7 @@ def halo_size(self):
269286 return (space_order_radius , ) * self .dimension * 2
270287
271288 def config_boundary (self , damping_length = 0.0 , boundary_condition = "none" ,
272- damping_polynomial_degree = 3 , damping_alpha = 0.001 ):
289+ damping_polynomial_degree = 2 , damping_alpha = None ):
273290 """
274291 Applies the domain extension (for absorbing layers with damping)
275292 and boundary conditions.
@@ -296,7 +313,8 @@ def config_boundary(self, damping_length=0.0, boundary_condition="none",
296313 """
297314
298315 self ._damping_polynomial_degree = damping_polynomial_degree
299- self ._damping_alpha = damping_alpha
316+ if damping_alpha is not None :
317+ self ._damping_alpha = damping_alpha
300318
301319 # if it is not, convert damping_length to tuple
302320 if isinstance (damping_length , (float , int )):
@@ -394,11 +412,9 @@ def damping_mask(self):
394412 mode = "linear_ramp" ,
395413 end_values = self .nbl_pad_width
396414 )
397-
398415 # change the damping values (coefficients) according to a function
399416 degree = self .damping_polynomial_degree
400417 damp_mask = (damp_mask ** degree ) * self .damping_alpha
401-
402418 # damp mask in the halo region
403419 # The values in this extended region is zero
404420 damp_mask = np .pad (array = damp_mask , pad_width = self .halo_pad_width )
0 commit comments