relax_toward Function

private pure function relax_toward(cur, tgt, decay) result(res)

Shared core algebra for BOTH sponge paths: cur*decay + tgt*(1-decay) — the exact solution of dphi/dt = -Idamp*(phi - phi_ref) over one step at constant phi_ref, for whatever decay = exp(-rate*dt) the caller derived (relax_one derives it from the legacy edge/band cosine ramp; the map kernels above derive it directly from a per-cell Idamp). “One home” for the algebra per the plan (§3.1 / step 10).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: cur
real(kind=wp), intent(in) :: tgt
real(kind=wp), intent(in) :: decay

Return Value real(kind=wp)


Called by

proc~~relax_toward~~CalledByGraph proc~relax_toward relax_toward proc~relax_map_tracer_impl relax_map_tracer_impl proc~relax_map_tracer_impl->proc~relax_toward proc~relax_map_u_impl relax_map_u_impl proc~relax_map_u_impl->proc~relax_toward proc~relax_map_v_impl relax_map_v_impl proc~relax_map_v_impl->proc~relax_toward proc~relax_one relax_one proc~relax_one->proc~relax_toward proc~ocean_sponge_apply_maps ocean_sponge_apply_maps proc~ocean_sponge_apply_maps->proc~relax_map_tracer_impl proc~ocean_sponge_apply_maps->proc~relax_map_u_impl proc~ocean_sponge_apply_maps->proc~relax_map_v_impl proc~relax_band_x_impl relax_band_x_impl proc~relax_band_x_impl->proc~relax_one proc~relax_band_y_impl relax_band_y_impl proc~relax_band_y_impl->proc~relax_one proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_sponge_apply_maps proc~ocean_sponge_apply_tracers ocean_sponge_apply_tracers proc~run_stage_split->proc~ocean_sponge_apply_tracers proc~sponge_relax_band_x_tracer sponge_relax_band_x_tracer proc~sponge_relax_band_x_tracer->proc~relax_band_x_impl proc~sponge_relax_band_y_tracer sponge_relax_band_y_tracer proc~sponge_relax_band_y_tracer->proc~relax_band_y_impl proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_stage_split proc~ocean_sponge_apply_tracers->proc~sponge_relax_band_x_tracer proc~ocean_sponge_apply_tracers->proc~sponge_relax_band_y_tracer proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step_split

Source Code

   pure real(wp) function relax_toward(cur, tgt, decay) result(res)
      !! Shared core algebra for BOTH sponge paths: `cur*decay +
      !! tgt*(1-decay)` — the exact solution of `dphi/dt = -Idamp*(phi -
      !! phi_ref)` over one step at constant `phi_ref`, for whatever
      !! `decay = exp(-rate*dt)` the caller derived (`relax_one` derives it
      !! from the legacy edge/band cosine ramp; the map kernels above derive
      !! it directly from a per-cell `Idamp`). "One home" for the algebra
      !! per the plan (§3.1 / step 10).
      !$acc routine seq
      real(wp), intent(in) :: cur, tgt, decay
      res = cur*decay + tgt*(1.0_wp - decay)
   end function relax_toward