FV3-JEDI
fv3jedi_pseudo_mod.f90
Go to the documentation of this file.
1 ! (C) Copyright 2019-2020 UCAR
2 !
3 ! This software is licensed under the terms of the Apache Licence Version 2.0
4 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5 
7 
8 ! iso
9 use iso_c_binding
10 
11 ! fckit
12 use fckit_configuration_module, only: fckit_configuration
13 
14 ! oops
15 use datetime_mod
16 use duration_mod
17 
18 ! fv3-jedi
24 
25 implicit none
26 private
27 public :: pseudo_model
28 
29 ! --------------------------------------------------------------------------------------------------
30 
31 !> Fortran derived type to hold model definition
32 type :: pseudo_model
33  character(len=255) :: pseudo_type !geos of gfs
34  type(fv3jedi_io_gfs) :: gfs
35  type(fv3jedi_io_geos) :: geos
36  contains
37  procedure :: create
38  procedure :: delete
39  procedure :: initialize
40  procedure :: step
41  procedure :: finalize
42 end type pseudo_model
43 
44 ! --------------------------------------------------------------------------------------------------
45 
46 contains
47 
48 ! --------------------------------------------------------------------------------------------------
49 
50 subroutine create(self, geom, conf)
51 
52 implicit none
53 class(pseudo_model), intent(inout) :: self
54 type(fv3jedi_geom), intent(in) :: geom
55 type(fckit_configuration), intent(in) :: conf
56 
57 character(len=:), allocatable :: str
58 
59 ! Get IO type to use
60 call conf%get_or_die("pseudo_type",str)
61 self%pseudo_type = str
62 
63 ! Setup IO from config
64 if (trim(self%pseudo_type) == "geos") then
65  call self%geos%setup_conf(geom, conf)
66 elseif (trim(self%pseudo_type) == "gfs") then
67  call self%gfs%setup_conf(conf)
68 else
69  call abor1_ftn("fv3jedi_pseudo_mod: pseudo_type must be geos or gfs")
70 endif
71 
72 end subroutine create
73 
74 ! --------------------------------------------------------------------------------------------------
75 
76 subroutine delete(self)
77 
78 implicit none
79 class(pseudo_model), intent(inout) :: self
80 
81 if (trim(self%pseudo_type) == "geos") call self%geos%delete()
82 
83 end subroutine delete
84 
85 ! --------------------------------------------------------------------------------------------------
86 
87 subroutine initialize(self, state)
88 
89 implicit none
90 class(pseudo_model), intent(inout) :: self
91 type(fv3jedi_state), intent(in) :: state
92 
93 end subroutine initialize
94 
95 ! --------------------------------------------------------------------------------------------------
96 
97 subroutine step(self, state, geom, vdate)
98 
99 implicit none
100 class(pseudo_model), intent(inout) :: self
101 type(fv3jedi_state), intent(inout) :: state
102 type(fv3jedi_geom), intent(inout) :: geom
103 type(datetime), intent(inout) :: vdate !< Valid datetime after step
104 
105 if (trim(self%pseudo_type) == "gfs") then
106  call self%gfs%setup_date(vdate)
107  call self%gfs%read_fields(geom, state%fields)
108 elseif (trim(self%pseudo_type) == "geos") then
109  call self%geos%setup_date(vdate)
110  call self%geos%read_fields(geom, state%fields)
111 else
112  call abor1_ftn("fv3jedi_pseudo_mod: pseudo_model, model choice must be geos or gfs")
113 endif
114 
115 end subroutine step
116 
117 ! --------------------------------------------------------------------------------------------------
118 
119 subroutine finalize(self, state)
120 
121 implicit none
122 class(pseudo_model) :: self
123 type(fv3jedi_state) :: state
124 
125 end subroutine finalize
126 
127 ! --------------------------------------------------------------------------------------------------
128 
129 end module fv3jedi_pseudo_mod
fv3jedi_state_mod::fv3jedi_state
Fortran derived type to hold FV3JEDI state.
Definition: fv3jedi_state_mod.F90:30
fv3jedi_state_mod
Definition: fv3jedi_state_mod.F90:6
fv3jedi_pseudo_mod
Definition: fv3jedi_pseudo_mod.f90:6
fv3jedi_geom_mod
Fortran module handling geometry for the FV3 model.
Definition: fv3jedi_geom_mod.f90:8
fv3jedi_pseudo_mod::step
subroutine step(self, state, geom, vdate)
Definition: fv3jedi_pseudo_mod.f90:98
fv3jedi_io_gfs_mod
Definition: fv3jedi_io_gfs_mod.f90:1
fv3jedi_pseudo_mod::delete
subroutine delete(self)
Definition: fv3jedi_pseudo_mod.f90:77
fv3jedi_geom_mod::fv3jedi_geom
Fortran derived type to hold geometry data for the FV3JEDI model.
Definition: fv3jedi_geom_mod.f90:46
fv3jedi_pseudo_mod::initialize
subroutine initialize(self, state)
Definition: fv3jedi_pseudo_mod.f90:88
fv3jedi_io_gfs_mod::fv3jedi_io_gfs
Definition: fv3jedi_io_gfs_mod.f90:35
fv3jedi_pseudo_mod::pseudo_model
Fortran derived type to hold model definition.
Definition: fv3jedi_pseudo_mod.f90:32
fv3jedi_kinds_mod::kind_real
integer, parameter, public kind_real
Definition: fv3jedi_kinds_mod.f90:14
fv3jedi_io_geos_mod
Definition: fv3jedi_io_geos_mod.f90:6
fv3jedi_pseudo_mod::finalize
subroutine finalize(self, state)
Definition: fv3jedi_pseudo_mod.f90:120
fv3jedi_io_geos_mod::fv3jedi_io_geos
Definition: fv3jedi_io_geos_mod.f90:36
fv3jedi_kinds_mod
Definition: fv3jedi_kinds_mod.f90:6
fv3jedi_pseudo_mod::create
subroutine create(self, geom, conf)
Definition: fv3jedi_pseudo_mod.f90:51