tides_configure_astronomy Subroutine

public subroutine tides_configure_astronomy(this, cat_idx, nconst, dref, dnodal, add_nodal, nx, ny)

Allocate the active-constituent arrays + 2D fields and fill the catalog copies + astronomy (phase0, nodal f/u) at the reference and nodal reference day numbers. Host-side setup (before enter_data). cat_idx(1:nconst) are catalog indices (1..TIDES_CATALOG_SIZE).

Arguments

Type IntentOptional Attributes Name
class(ocean_tides_t), intent(inout) :: this
integer, intent(in) :: cat_idx(nconst)
integer, intent(in) :: nconst
real(kind=wp), intent(in) :: dref
real(kind=wp), intent(in) :: dnodal
logical, intent(in) :: add_nodal
integer, intent(in) :: nx
integer, intent(in) :: ny

Calls

proc~~tides_configure_astronomy~~CallsGraph proc~tides_configure_astronomy tides_configure_astronomy proc~equilibrium_arguments equilibrium_arguments proc~tides_configure_astronomy->proc~equilibrium_arguments proc~nodal_fu nodal_fu proc~tides_configure_astronomy->proc~nodal_fu proc~mean_longitudes mean_longitudes proc~equilibrium_arguments->proc~mean_longitudes proc~nodal_fu->proc~mean_longitudes proc~wrap360 wrap360 proc~mean_longitudes->proc~wrap360

Called by

proc~~tides_configure_astronomy~~CalledByGraph proc~tides_configure_astronomy tides_configure_astronomy proc~configure_ocean_tides configure_ocean_tides proc~configure_ocean_tides->proc~tides_configure_astronomy proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_tides proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Variables

Type Visibility Attributes Name Initial
integer, private :: c
real(kind=wp), private :: f_all(TIDES_CATALOG_SIZE)
integer, private :: ic
real(kind=wp), private :: u_all(TIDES_CATALOG_SIZE)
real(kind=wp), private :: v_all(TIDES_CATALOG_SIZE)

Source Code

   subroutine tides_configure_astronomy(this, cat_idx, nconst, dref, dnodal, &
                                        add_nodal, nx, ny)
      !! Allocate the active-constituent arrays + 2D fields and fill the
      !! catalog copies + astronomy (phase0, nodal f/u) at the reference
      !! and nodal reference day numbers.  Host-side setup (before
      !! enter_data).  `cat_idx(1:nconst)` are catalog indices
      !! (1..TIDES_CATALOG_SIZE).
      class(ocean_tides_t), intent(inout) :: this
      integer, intent(in) :: nconst
      integer, intent(in) :: cat_idx(nconst)
      real(wp), intent(in) :: dref, dnodal
      logical, intent(in) :: add_nodal
      integer, intent(in) :: nx, ny
      real(wp) :: v_all(TIDES_CATALOG_SIZE)
      real(wp) :: f_all(TIDES_CATALOG_SIZE), u_all(TIDES_CATALOG_SIZE)
      integer :: c, ic

      this%nconst = nconst
      if (allocated(this%species_c)) deallocate (this%species_c)
      allocate (this%species_c(nconst))
      allocate (this%omega_c(nconst), this%amp_c(nconst), this%love_c(nconst))
      allocate (this%phase0(nconst), this%f_nodal(nconst), this%u_nodal(nconst))
      allocate (this%amp_cos(nconst), this%amp_sin(nconst))

      call equilibrium_arguments(dref, v_all)
      call nodal_fu(dnodal, add_nodal, f_all, u_all)

      do c = 1, nconst
         ic = cat_idx(c)
         this%species_c(c) = TIDE_SPECIES(ic)
         this%omega_c(c) = TIDE_OMEGA(ic)
         this%amp_c(c) = TIDE_AMP(ic)
         this%love_c(c) = TIDE_LOVE(ic)
         this%phase0(c) = v_all(ic)
         this%f_nodal(c) = f_all(ic)
         this%u_nodal(c) = u_all(ic)
         this%amp_cos(c) = 0.0_wp
         this%amp_sin(c) = 0.0_wp
      end do

      if (allocated(this%cos_struct)) deallocate (this%cos_struct)
      allocate (this%cos_struct(nx, ny, 3), source=0.0_wp)
      allocate (this%sin_struct(nx, ny, 3), source=0.0_wp)
      allocate (this%eta_eq(nx, ny), source=0.0_wp)
      allocate (this%eta_sal(nx, ny), source=0.0_wp)
      allocate (this%eta_forcing(nx, ny), source=0.0_wp)
   end subroutine tides_configure_astronomy