init_theta_grid_eik Subroutine

public subroutine init_theta_grid_eik(theta_grid_eik_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(theta_grid_eik_config_type), intent(in), optional :: theta_grid_eik_config_in

Contents

Source Code


Source Code

  subroutine init_theta_grid_eik(theta_grid_eik_config_in)
    use geometry, only: eikcoefs, surf, use_large_aspect, verb_geo => verb
    use geometry, only: run_eikcoefs_and_resample
    use unit_tests, only: job_id
    use theta_grid_params, only: init_theta_grid_params, ntheta, nperiod
    use runtime_tests, only: verbosity
    use unit_tests, only: debug_message
    use mp, only: proc0
    implicit none
    type(theta_grid_eik_config_type), intent(in), optional :: theta_grid_eik_config_in
    real :: rhoc_save
    integer, parameter :: verb = 3
    character(4) :: ntheta_char
    verb_geo = verbosity()

    if (initialized) return
    initialized = .true.
    write(ntheta_char, "(I4)") ntheta
    call debug_message(verb, "init_theta_grid_eik: call init_theta_grid_params, ntheta="//ntheta_char)
    ! After this call, would think you have ntheta from input file
    ! stored in theta_grid_params data structure.
    ! but when running from numerical equilibrium, this is not right
    ! Instead, get it stored via the eikcoefs call below.
    call init_theta_grid_params

    write(ntheta_char, "(I4)") ntheta
    call debug_message(verb, "init_theta_grid_eik: call read_parameters, ntheta="//ntheta_char)
    call read_parameters(theta_grid_eik_config_in)

    rhoc_save = surf%r
    if (use_large_aspect) surf%r = 1.5 * surf%dr

    if(proc0) then
       if (ntheta_geometry == -1) then
          write(ntheta_char, "(I4)") ntheta
          call debug_message(verb, "init_theta_grid_eik: call eikcoefs, ntheta="//ntheta_char)
          call eikcoefs(ntheta, nperiod, eikcoefs_results, job_id)
       else
          write(ntheta_char, "(I4)") ntheta_geometry
          call debug_message(verb, "init_theta_grid_eik: call run_eikcoefs_and_resample, ntheta_geometry="//ntheta_char)
          call run_eikcoefs_and_resample (ntheta_geometry, ntheta, nperiod, eikcoefs_results, job_id)
       end if
    end if

    write(ntheta_char, "(I4)") ntheta
    call debug_message(verb, "init_theta_grid_eik: done, ntheta="//ntheta_char)

    surf%r = rhoc_save
  end subroutine init_theta_grid_eik