FakeDynGridComp.F90 Source File


This file depends on

sourcefile~~fakedyngridcomp.f90~~EfferentGraph sourcefile~fakedyngridcomp.f90 FakeDynGridComp.F90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~fakedyngridcomp.f90->sourcefile~errorhandling.f90 sourcefile~generic3g.f90 Generic3g.F90 sourcefile~fakedyngridcomp.f90->sourcefile~generic3g.f90 sourcefile~mapl.f90 MAPL.F90 sourcefile~fakedyngridcomp.f90->sourcefile~mapl.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~componentdriver.f90 ComponentDriver.F90 sourcefile~generic3g.f90->sourcefile~componentdriver.f90 sourcefile~esmf_hconfigutilities.f90 ESMF_HConfigUtilities.F90 sourcefile~generic3g.f90->sourcefile~esmf_hconfigutilities.f90 sourcefile~esmf_interfaces.f90 ESMF_Interfaces.F90 sourcefile~generic3g.f90->sourcefile~esmf_interfaces.f90 sourcefile~genericgridcomp.f90 GenericGridComp.F90 sourcefile~generic3g.f90->sourcefile~genericgridcomp.f90 sourcefile~griddedcomponentdriver.f90 GriddedComponentDriver.F90 sourcefile~generic3g.f90->sourcefile~griddedcomponentdriver.f90 sourcefile~mapl_generic.f90~2 MAPL_Generic.F90 sourcefile~generic3g.f90->sourcefile~mapl_generic.f90~2 sourcefile~outermetacomponent.f90 OuterMetaComponent.F90 sourcefile~generic3g.f90->sourcefile~outermetacomponent.f90 sourcefile~usersetservices.f90 UserSetServices.F90 sourcefile~generic3g.f90->sourcefile~usersetservices.f90 sourcefile~verticaldimspec.f90 VerticalDimSpec.F90 sourcefile~generic3g.f90->sourcefile~verticaldimspec.f90 sourcefile~verticalgrid.f90 VerticalGrid.F90 sourcefile~generic3g.f90->sourcefile~verticalgrid.f90 sourcefile~base.f90 Base.F90 sourcefile~mapl.f90->sourcefile~base.f90 sourcefile~esmf_cfiomod.f90 ESMF_CFIOMod.F90 sourcefile~mapl.f90->sourcefile~esmf_cfiomod.f90 sourcefile~fieldbundleread.f90 FieldBundleRead.F90 sourcefile~mapl.f90->sourcefile~fieldbundleread.f90 sourcefile~fieldbundlewrite.f90 FieldBundleWrite.F90 sourcefile~mapl.f90->sourcefile~fieldbundlewrite.f90 sourcefile~fieldutils.f90 FieldUtils.F90 sourcefile~mapl.f90->sourcefile~fieldutils.f90 sourcefile~mapl_generic.f90 MAPL_Generic.F90 sourcefile~mapl.f90->sourcefile~mapl_generic.f90 sourcefile~mapl_gridcomps.f90 MAPL_GridComps.F90 sourcefile~mapl.f90->sourcefile~mapl_gridcomps.f90 sourcefile~mapl_profiler.f90 MAPL_Profiler.F90 sourcefile~mapl.f90->sourcefile~mapl_profiler.f90 sourcefile~openmp_support.f90 OpenMP_Support.F90 sourcefile~mapl.f90->sourcefile~openmp_support.f90 sourcefile~pfio.f90 pFIO.F90 sourcefile~mapl.f90->sourcefile~pfio.f90 sourcefile~stubcomponent.f90 StubComponent.F90 sourcefile~mapl.f90->sourcefile~stubcomponent.f90 sourcefile~varspecmiscmod.f90 VarSpecMiscMod.F90 sourcefile~mapl.f90->sourcefile~varspecmiscmod.f90

Source Code

#include "MAPL_Generic.h"

module mapl3g_FakeDynGridComp

   use mapl_ErrorHandling
   use generic3g
   use esmf
   use mapl, only: MAPL_GetPointer

   implicit none
   private

   public :: SetServices

contains

   subroutine SetServices(gridcomp, rc)
      type(ESMF_GridComp) :: gridcomp
      integer, intent(out) :: rc

      integer :: status

      ! Set entry points
      call MAPL_GridCompSetEntryPoint(gridcomp, ESMF_METHOD_INITIALIZE, init, phase_name="GENERIC::INIT_USER", _RC)
      call MAPL_GridCompSetEntryPoint(gridcomp, ESMF_METHOD_RUN, run, phase_name="run", _RC)

      _RETURN(_SUCCESS)
   end subroutine setServices

   subroutine init(gridcomp, importState, exportState, clock, rc)
      type(ESMF_GridComp) :: gridcomp
      type(ESMF_State) :: importState
      type(ESMF_State) :: exportState
      type(ESMF_Clock) :: clock
      integer, intent(out)  :: rc

      integer :: status
      real(kind=ESMF_KIND_R4), pointer :: pl(:, :, :), t_dyn(:, :, :)

      call MAPL_GetPointer(exportState, pl,  "PL", _RC)
      call set_pressure_(pl)

      call MAPL_GetPointer(exportState, t_dyn, "T_DYN", _RC)
      call set_temperature_(t_dyn)

      _RETURN(_SUCCESS)
      _UNUSED_DUMMY(gridcomp)
      _UNUSED_DUMMY(importState)
      _UNUSED_DUMMY(clock)
   end subroutine init

   subroutine run(gridcomp, importState, exportState, clock, rc)
      type(ESMF_GridComp) :: gridcomp
      type(ESMF_State) :: importState
      type(ESMF_State) :: exportState
      type(ESMF_Clock) :: clock
      integer, intent(out) :: rc

      integer :: status

      call MAPL_RunChildren(gridcomp, phase_name="run", _RC)

      _RETURN(_SUCCESS)
      _UNUSED_DUMMY(importState)
      _UNUSED_DUMMY(exportState)
      _UNUSED_DUMMY(clock)
   end subroutine run

   subroutine set_pressure_(pressure)
      real(kind=ESMF_KIND_R4), pointer, intent(inout) :: pressure(:, :, :)

      integer :: shape_(3), i, j, k, num_levels

      shape_ = shape(pressure)
      num_levels = shape_(3)
      do concurrent(i = 1:shape_(1), j = 1:shape_(2))
         do k = 1, num_levels
            pressure(i, j, k) = real((num_levels - k + 1) * 10)
         end do
      end do
   end subroutine set_pressure_

   subroutine set_temperature_(temperature)
      real(kind=ESMF_KIND_R4), pointer, intent(inout) :: temperature(:, :, :)

      integer :: shape_(3), i, j, k, num_levels

      shape_ = shape(temperature)
      num_levels = shape_(3)
      do concurrent(i = 1:shape_(1), j=1:shape_(2))
         do k = 1, num_levels
            temperature(i, j, k) = real(5 * (2 ** (num_levels - k)))
         end do
      end do
   end subroutine set_temperature_

end module mapl3g_FakeDynGridComp

subroutine SetServices(gridcomp, rc)
   use MAPL_ErrorHandlingMod
   use mapl3g_FakeDynGridComp, only: FakeDyn_SetServices => SetServices
   use esmf

   type(ESMF_GridComp), intent(inout)  :: gridcomp
   integer, intent(out) :: rc

   integer :: status

   call FakeDyn_SetServices(gridcomp, _RC)

   _RETURN(_SUCCESS)
end subroutine SetServices