boundary_half_jump Subroutine

private pure subroutine boundary_half_jump(h_self, h_nbr, dq_up, d)

Linear-exact half-jump across a BOUNDARY cell (k=1 or k=nz), where a centred stencil has no second neighbour.

dq_up is the cell-mean increment toward the SURFACE across the two cell centres (q(2)-q(1) at the bed, q(nz)-q(nz-1) at the surface). The centres are (h_self + h_nbr)/2 apart, so the per-metre slope is dq_up/((h_self+h_nbr)/2) and the half-jump across this cell is

d = dq_up * h_self / (h_self + h_nbr)

giving edges q ± d that reproduce a profile linear in z EXACTLY, for any thickness pair. The default closure — a PCM flatten — does not: it leaves a first-order reconstruction error in the two cells adjacent to the boundary. Same device (and same clamp) as rdb_ocean_pgf_reconstruct :: boundary_edges_linear, which fixed the mirror-image defect in the FV pressure-gradient quadrature.

Clamp |d| <= |dq_up|: since h_self/(h_self+h_nbr) < 1 it never bites on a real thickness pair — it is armour against a degenerate h_nbr <= 0.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: h_self

Thickness of the boundary cell itself.

real(kind=wp), intent(in) :: h_nbr

Thickness of its single interior neighbour.

real(kind=wp), intent(in) :: dq_up

Cell-mean increment toward the surface (neighbour -> self at the surface cell, self -> neighbour at the bed cell).

real(kind=wp), intent(out) :: d

Half-jump across the boundary cell; edges are q ± d.


Called by

proc~~boundary_half_jump~~CalledByGraph proc~boundary_half_jump boundary_half_jump proc~remap_column_plm remap_column_plm proc~remap_column_plm->proc~boundary_half_jump proc~remap_column_ppm remap_column_ppm proc~remap_column_ppm->proc~boundary_half_jump proc~remap_column_ppm->proc~remap_column_plm proc~remap_column_ppm_h4 remap_column_ppm_h4 proc~remap_column_ppm_h4->proc~boundary_half_jump proc~remap_column_ppm_h4->proc~remap_column_plm proc~remap_column_pqm remap_column_pqm proc~remap_column_pqm->proc~boundary_half_jump proc~remap_column_pqm->proc~remap_column_ppm proc~remap_column remap_column proc~remap_column->proc~remap_column_plm proc~remap_column->proc~remap_column_ppm proc~remap_column->proc~remap_column_ppm_h4 proc~remap_column->proc~remap_column_pqm proc~ocean_remap_tracer_column ocean_remap_tracer_column proc~ocean_remap_tracer_column->proc~remap_column proc~ocean_remap_tracer_field ocean_remap_tracer_field proc~ocean_remap_tracer_field->proc~remap_column proc~remap_layer_to_density_impl remap_layer_to_density_impl proc~remap_layer_to_density_impl->proc~remap_column proc~remap_layer_to_vcoord_impl remap_layer_to_vcoord_impl proc~remap_layer_to_vcoord_impl->proc~remap_column proc~remap_tracer_grounded remap_tracer_grounded proc~remap_tracer_grounded->proc~remap_column proc~remap_x_face_grounded remap_x_face_grounded proc~remap_x_face_grounded->proc~remap_column proc~remap_x_face_velocity remap_x_face_velocity proc~remap_x_face_velocity->proc~remap_column proc~remap_y_face_grounded remap_y_face_grounded proc~remap_y_face_grounded->proc~remap_column proc~remap_y_face_velocity remap_y_face_velocity proc~remap_y_face_velocity->proc~remap_column proc~ocean_apply_ale_remap_centres ocean_apply_ale_remap_centres proc~ocean_apply_ale_remap_centres->proc~ocean_remap_tracer_field proc~ocean_apply_ale_remap_faces ocean_apply_ale_remap_faces proc~ocean_apply_ale_remap_faces->proc~remap_x_face_velocity proc~ocean_apply_ale_remap_faces->proc~remap_y_face_velocity proc~ocean_apply_ale_remap_step ocean_apply_ale_remap_step proc~ocean_apply_ale_remap_step->proc~ocean_remap_tracer_field proc~ocean_apply_ale_remap_step->proc~remap_x_face_velocity proc~ocean_apply_ale_remap_step->proc~remap_y_face_velocity proc~ocean_apply_conservative_min_thickness ocean_apply_conservative_min_thickness proc~ocean_apply_conservative_min_thickness->proc~remap_tracer_grounded proc~ocean_apply_conservative_min_thickness->proc~remap_x_face_grounded proc~ocean_apply_conservative_min_thickness->proc~remap_y_face_grounded proc~remap_layer_to_density remap_layer_to_density proc~remap_layer_to_density->proc~remap_layer_to_density_impl proc~remap_layer_to_sigma remap_layer_to_sigma proc~remap_layer_to_sigma->proc~remap_layer_to_vcoord_impl proc~remap_layer_to_z remap_layer_to_z proc~remap_layer_to_z->proc~remap_layer_to_vcoord_impl proc~remap_layer_to_zstar remap_layer_to_zstar proc~remap_layer_to_zstar->proc~remap_layer_to_vcoord_impl proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~ocean_apply_ale_remap_step proc~run_continuity_chain run_continuity_chain proc~run_continuity_chain->proc~ocean_apply_conservative_min_thickness

Source Code

   pure subroutine boundary_half_jump(h_self, h_nbr, dq_up, d)
      !$acc routine seq
      !! Linear-exact half-jump across a BOUNDARY cell (k=1 or k=nz),
      !! where a centred stencil has no second neighbour.
      !!
      !! `dq_up` is the cell-mean increment toward the SURFACE across the
      !! two cell centres (`q(2)-q(1)` at the bed, `q(nz)-q(nz-1)` at the
      !! surface).  The centres are `(h_self + h_nbr)/2` apart, so the
      !! per-metre slope is `dq_up/((h_self+h_nbr)/2)` and the half-jump
      !! across this cell is
      !!
      !!     d = dq_up * h_self / (h_self + h_nbr)
      !!
      !! giving edges `q ± d` that reproduce a profile linear in z EXACTLY,
      !! for any thickness pair.  The default closure — a PCM flatten —
      !! does not: it leaves a first-order reconstruction error in the two
      !! cells adjacent to the boundary.  Same device (and same clamp) as
      !! `rdb_ocean_pgf_reconstruct :: boundary_edges_linear`, which fixed
      !! the mirror-image defect in the FV pressure-gradient quadrature.
      !!
      !! Clamp `|d| <= |dq_up|`: since `h_self/(h_self+h_nbr) < 1` it never
      !! bites on a real thickness pair — it is armour against a degenerate
      !! `h_nbr <= 0`.
      real(wp), intent(in) :: h_self
         !! Thickness of the boundary cell itself.
      real(wp), intent(in) :: h_nbr
         !! Thickness of its single interior neighbour.
      real(wp), intent(in) :: dq_up
         !! Cell-mean increment toward the surface (neighbour -> self at
         !! the surface cell, self -> neighbour at the bed cell).
      real(wp), intent(out) :: d
         !! Half-jump across the boundary cell; edges are `q ± d`.

      d = dq_up*h_self/max(h_self + h_nbr, H_NEGLECT)
      d = sign(min(abs(d), abs(dq_up)), d)
   end subroutine boundary_half_jump