DISPATCH
boundary_wavekill_mod.f90
1 MODULE boundary_wavekill_mod
2  USE kinds_mod
3  implicit none
4  private
5 
6 PUBLIC wave_killing
7 CONTAINS
8 !===============================================================================
9 !> Following Section 3.2 of de Val-Borro et al. (2006, MNRAS, 370, 529).
10 !> These "wave killing" conditions are designed to reduce wave reflection at
11 !> solid boundaries.
12 !>
13 !> In this approach, the following ODE is applied at each application of the
14 !> boundary conditions:
15 !> dq = - q - q0
16 !> -- ------ * R(x)
17 !> dt tau
18 !> where `q` is the quantity that you wish to damp towards value `q0`, `tau` is
19 !> the timescale over which `q` is damped, `xbndy` is the location of the actual
20 !> boundary, `xkill` is the location at which to begin the damping procedure and
21 !> `x` is the location of the current grid point.
22 !>
23 !> `R(x)` is a simple quadratic weighting function that is 1 at the actual boundary
24 !> (`xbndy`) and 0 at `xkill`.
25 !>
26 !> The function returns the *rate* at which quantity `q` is damped; the quantity
27 !> should then be updated along the lines of:
28 !> qold = qnew + dt * wave_killing(qold, q0, tau, xkill, xbndy, x)
29 !>
30 !===============================================================================
31 FUNCTION wave_killing (q, q0, tau, xkill, xbndy, x) RESULT (rate)
32  real(kind=KindScalarVar), intent(in) :: q, q0
33  real(kind=KindScalarVar), intent(in) :: tau, x, xkill, xbndy
34  real(kind=KindScalarVar) :: rate, quadfunc
35  !-----------------------------------------------------------------------------
36 
37  quadfunc = ((x - xkill) / (xbndy - xkill))**2
38  rate = -(q - q0) * quadfunc / tau
39 
40 END FUNCTION wave_killing
41 
42 END MODULE boundary_wavekill_mod