adjust_time_norm Subroutine

private subroutine adjust_time_norm()

FIXME : Add documentation

Arguments

None

Contents

Source Code


Source Code

  subroutine adjust_time_norm
    use file_utils, only: error_unit
    use mp, only: proc0
    use kt_grids, only: aky, naky
    use run_parameters, only: wstar_units
    implicit none

    if(.not. allocated(wunits)) allocate (wunits(naky))
    if(.not. allocated(woutunits)) allocate (woutunits(naky))
    if(.not. allocated(tunits)) allocate (tunits(naky))

    !CMR: Sep 2010
    ! Attempt to understand time normalisation variables, which are arrays(naky)
    !    TUNITS: DT(KY)=TUNITS(KY).CODE_DT
    !            This is a generally very useful variable to store ky dependent
    !            timestep in the code time normalisation.
    !            Used to multiply ky independent source terms on RHS of GKE.
    !    WUNITS: WUNITS(KY)=AKY(KY)*TUNITS(KY)/2
    !            Auxiliary variable.  Used to save compute operations when
    !            evaluating source terms on RHS of GKE that are proportional to ky.
    !            !! The Mysterious factor 1/2 Explained !!
    !            The factor of 1/2 arises because those source terms were first
    !            specified using the normalisation Tref=mref vtref^2
    ! [R Numata et al, "AstroGK: Astrophysical gyrokinetics code", JCP, 2010].
    !CMRend
    if (wstar_units) then
       wunits = 1.0
       where (aky /= 0.0)
          tunits = 2.0/aky
       elsewhere
          tunits = 0.0
       end where
       if (any(tunits == 0.0) .and. proc0) then
          write (error_unit(), *) &
               "WARNING: wstar_units=.true. and aky=0.0: garbage results"
          print *, &
               "WARNING: wstar_units=.true. and aky=0.0: garbage results"
       end if
    else
       tunits = 1.0
       wunits = aky/2.0
    end if
    woutunits = 1.0/tunits
  end subroutine adjust_time_norm