r_of_s Function

public pure elemental function r_of_s(s) result(r)

Uses

  • proc~~r_of_s~~UsesGraph proc~r_of_s r_of_s module~mod_global_parameters mod_global_parameters proc~r_of_s->module~mod_global_parameters module~mod_basic_types mod_basic_types module~mod_global_parameters->module~mod_basic_types module~mod_connectivity mod_connectivity module~mod_global_parameters->module~mod_connectivity module~mod_constants mod_constants module~mod_global_parameters->module~mod_constants module~mod_physicaldata mod_physicaldata module~mod_global_parameters->module~mod_physicaldata module~mod_variables mod_variables module~mod_global_parameters->module~mod_variables mpi mpi module~mod_global_parameters->mpi module~mod_variables->module~mod_basic_types

The radial coordinate map, from the logical coordinate s to the physical radius r, and its inverse.

These are the host-side definition of the map a LOG_RADIUS build uses, and the one place it is written down:

log_r0 == 0 : r = exp(s) (s = ln(r)) log_r0 > 0 : r = sign(s)r0(exp(|s|) - 1) (s = ln(1 + r/r0))

The offset form is the one that reaches the axis. Its pivot is deliberate: s = 0 corresponds to r = 0 exactly, so the map is odd, and the mesh in the ghost layer beyond a cylindrical axis is the exact mirror of the mesh inside it. That is what the pole copy in getbc assumes when it fills ghost cell j from interior cell j of the block half a revolution away - the two have to occupy mirrored volumes, or the copied cell average belongs to a cell of a different size. The naive map r = exp(s) - r0 is not odd: its ghost cells shrink outward while the cells they mirror grow, and the first ghost cell is then misplaced by several percent of a cell width.

The odd branch is only ever taken in that ghost layer; s >= 0 everywhere in the physical domain of an offset build. Device code that only ever sees the domain therefore uses the cheaper equivalent r = log_ra*exp(s) + log_rb instead of calling these.

A case's mod_usr should use these rather than writing exp/log by hand: xprobmin1 and xprobmax1 hold the logical radial bounds in a LOG_RADIUS build, so r_of_s is how a case recovers a physical radius from them.

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: s

Return Value double precision


Calls

proc~~r_of_s~~CallsGraph proc~r_of_s r_of_s dexp dexp proc~r_of_s->dexp dsign dsign proc~r_of_s->dsign

Source Code

  pure elemental function r_of_s(s) result(r)
    use mod_global_parameters
    double precision, intent(in) :: s
    double precision             :: r

    if (log_r0 > zero) then
      r = dsign(one,s)*log_r0*(dexp(dabs(s)) - one)
    else
      r = dexp(s)
    end if
  end function r_of_s