Skip to content

Add an absorbing layer ​

An absorbing layer (a perfectly matched layer's auxiliary fields, a sponge) carries a field ψ′=g−λψ whose decay rate λ is large inside the layer and 0 outside. Advance ψ as a companion of the field stepper and pass decay=lambda: the stepper integrates the decay exactly, and λΔt no longer limits the step. Tutorial 14 is the long form, with the explicit run that blows up; the method: Stepper.

The recipe on a 1-D pulse, ut+ux=−ψ, periodic, with the layer in x>3/4 where ψ′=σu−λψ, λΔt=50 and σ=κ(x)λ graded from 0 at the layer's edge:

fortran
allocate(u(0:NC+1), psi(0:NC+1), lam(0:NC+1), sig(0:NC+1))     ! a scalar field, one ghost cell each side
bx = box_interior(lb=[0], ub=[NC+1], ngc=1, components=.false.)
lo = bx%lo(box_dim(bx, 1_I4P)) ; hi = bx%hi(box_dim(bx, 1_I4P))   ! the interior of the field's dimension 1
lam = 0._R_P ; sig = 0._R_P                                      ! outside the layer: no decay, no source
do i=3*NC/4+1, NC                                                 ! the layer, x in (3/4, 1)
   lam(i) = LAMBDA_DT / DT                                        ! lambda dt = 50
   sig(i) = KAPPA * ((i - 0.5_R_P - 3*NC/4) / (NC/4))**2 * lam(i) ! psi relaxes to kappa(x) u: a graded damping
enddo
call st%initialize(SCHEME_SSP_33, FORM_BUTCHER, lb=[0], ub=[NC+1], components=.false.)
call sp%initialize_companion(st, lb=[0], ub=[NC+1], components=.false.)
print '(A,F7.4,A,F5.1)', 'ssp-33: real-axis bound', st%real_axis_bound(), ', lambda dt in the layer', LAMBDA_DT
print '(A,ES9.2,A,ES9.2)', 'explicit stages of the decay need dt <= ', st%real_axis_bound() / maxval(lam), &
      '; dt = ', DT
fortran
call st%begin_step(bx, u) ; call sp%begin_step(bx, psi)
do k=1, st%stages()
   call st%begin_stage(k, bx, DT, u) ; call sp%begin_stage(k, bx, DT, psi, decay=lam)  ! psi's decay: exact
   call st%stage_state_view(us) ; call sp%stage_state_view(ps)
   call st%rhs_register_view(ru) ; call sp%rhs_register_view(rp)
   us(lo-1) = us(hi) ; us(hi+1) = us(lo)                           ! periodic ghost cells of the stage state
   do i=lo, hi
      call gideon_fd_d1_c2([us(i-1), us(i), us(i+1)], DX, d)
      ru(i) = -d - ps(i)                                            ! central advection, damped by psi
      rp(i) = sig(i) * us(i)                                        ! psi's source alone: no -lambda psi
   enddo
   call st%end_stage(k, bx, DT, u) ; call sp%end_stage(k, bx, DT, psi)
enddo
call st%finish_step(bx, DT, u) ; call sp%finish_step(bx, DT, psi, decay=lam)
text
$ cookbook_absorbing_layer
ssp-33: real-axis bound 2.5127, lambda dt in the layer 50.0
explicit stages of the decay need dt <=  1.96E-04; dt =  3.91E-03
    t   energy / energy(0)
0.125       9.998E-01
0.250       9.996E-01
0.375       9.944E-01
0.500       6.004E-01
0.625       5.182E-02
0.750       7.987E-03
0.875       3.012E-03
1.000       1.931E-03
absorbed, less than 1 % of the energy left at t = 1: T
[exit status 0]

The pulse keeps its energy until it reaches the layer (its centre at t=0.375), then loses 99 % of it by t=0.75; the step is λΔt=50 inside the layer throughout.

  1. A companion. sp%initialize_companion(st, ...) gives ψ the field's scheme and form; drive it through the same calls in the same stage window. decay= needs the Butcher form.
  2. The rate. lam has ψ's shape: λ in the layer, 0 elsewhere, where the step is bitwise the explicit one.
  3. decay=lam at every begin_stage of ψ and at its finish_step (end_stage takes none).
  4. The source alone. ψ's residual is g=σu; the stepper applies −λψ.

The explicit stages of the decay would need dt below real_axis_bound() / maxval(lam), the second line of the output: twenty times smaller here. The step is still the coupled system's: the source σu is stiff too, and inside a stiff layer the coupled field–ψ system has a smaller stable step than either part alone, so take dt from the coupled limit (Stepper).

box_dim(bx, 1) is the dimension of the box's rank-5 view that holds the field's dimension 1 (2 for a scalar field): bx%lo and bx%hi of it are the interior's range, the loop of the residual.