chgres_cube 1.14.0
Loading...
Searching...
No Matches
chgres.F90
Go to the documentation of this file.
1
5
24 program chgres
25
26 use mpi_f08
27 use esmf
28
30
35
36 use model_grid, only : define_target_grid, &
39
40 use surface, only : surface_driver
41
42 use utilities, only : error_handler
43 implicit none
44
45 integer :: ierr, localpet, npets
46
47 type(esmf_vm) :: vm
48
49!-------------------------------------------------------------------------
50! Initialize mpi and esmf environment.
51!-------------------------------------------------------------------------
52
53 call mpi_init(ierr)
54
55 print*,"- INITIALIZE ESMF"
56 call esmf_initialize(rc=ierr)
57 if(esmf_logfounderror(rctocheck=ierr,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
58 call error_handler("INITIALIZING ESMF", ierr)
59
60 print*,"- CALL VMGetGlobal"
61 call esmf_vmgetglobal(vm, rc=ierr)
62 if(esmf_logfounderror(rctocheck=ierr,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
63 call error_handler("IN VMGetGlobal", ierr)
64
65 print*,"- CALL VMGet"
66 call esmf_vmget(vm, localpet=localpet, petcount=npets, rc=ierr)
67 if(esmf_logfounderror(rctocheck=ierr,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
68 call error_handler("IN VMGet", ierr)
69
70 print*,'- NPETS IS ',npets
71 print*,'- LOCAL PET ',localpet
72
73!-------------------------------------------------------------------------
74! Read program configuration namelist.
75!-------------------------------------------------------------------------
76
78
79!-------------------------------------------------------------------------
80! Read variable mapping file (used for grib2 input data only).
81!-------------------------------------------------------------------------
82
83 call read_varmap
84
85!-------------------------------------------------------------------------
86! Create esmf grid objects for input and target grids.
87!-------------------------------------------------------------------------
88
89 call define_target_grid(localpet, npets)
90
91 call define_input_grid(localpet, npets)
92
93!-------------------------------------------------------------------------
94! Convert atmospheric fields
95!-------------------------------------------------------------------------
96
97 if (convert_atm) then
98
99 call atmosphere_driver(localpet)
100
101 end if
102
103!-------------------------------------------------------------------------
104! Convert surface/nsst fields
105!-------------------------------------------------------------------------
106
107 if (convert_sfc) then
108
109 call surface_driver(localpet)
110
111 end if
112
114
115 print*,"- CALL ESMF_finalize"
116 call esmf_finalize(endflag=esmf_end_keepmpi, rc=ierr)
117
118 call mpi_finalize(ierr)
119
120 print*,"- DONE."
121
122 end program chgres
program chgres
Initialize an FV3 model run.
Definition chgres.F90:24
Process atmospheric fields.
subroutine, public atmosphere_driver(localpet)
Driver routine to process for atmospheric fields.
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
Definition model_grid.F90:9
subroutine, public define_target_grid(localpet, npets)
Setup the esmf grid object for the target grid.
subroutine, public cleanup_input_target_grid_data
Deallocate all esmf grid objects.
subroutine, public define_input_grid(localpet, npets)
Driver routine to setup the esmf grid object for the input grid.
This module contains code to read the setup namelist file, handle the varmap file for GRIB2 data,...
subroutine, public read_setup_namelist(filename)
Reads program configuration namelist.
subroutine, public read_varmap
Reads the variable mapping table, which is required for initializing with GRIB2 data.
logical, public convert_sfc
Convert sfc data when true.
logical, public convert_atm
Convert atmospheric data when true.
Process surface and nst fields.
Definition surface.F90:21
subroutine, public surface_driver(localpet)
Driver routine to process surface/nst data.
Definition surface.F90:115