FV3 Bundle
fv3jedi_vars_mod.f90
Go to the documentation of this file.
1 !
2 ! (C) Copyright 2017-2018 UCAR.
3 !
4 ! This software is licensed under the terms of the Apache Licence Version 2.0
5 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 !
7 
8 !> Fortran module to handle variables for the FV3JEDI model
9 
11 
12 use iso_c_binding
13 use config_mod
14 
15 implicit none
16 private
18 
19 ! ------------------------------------------------------------------------------
20 !> Fortran derived type to represent fv3jedi model variables
21 
22 type :: fv3jedi_vars
23  integer :: nv
24  character(len=100), allocatable :: fldnames(:) !< Variable identifiers
25 end type fv3jedi_vars
26 
27 ! ------------------------------------------------------------------------------
28 contains
29 ! ------------------------------------------------------------------------------
30 
31 subroutine fv3jedi_vars_create(c_vars,self)
32 implicit none
33 
34 type(c_ptr), intent(in) :: c_vars
35 type(fv3jedi_vars), intent(inout) :: self
36 
37 character(len=1023) :: varlist
38 
39 !Get long comma seperated list of variables
40 varlist = config_get_string(c_vars,len(varlist),"variables")
41 
42 !Count number of commas
43 self%nv = 1 + count(transfer(varlist, 'a', len(varlist)) == ",")
44 
45 !Allocate array to hold variable names
46 allocate(self%fldnames(self%nv))
47 
48 !Place list into the
49 read(varlist,*) self%fldnames
50 
51 end subroutine fv3jedi_vars_create
52 
53 ! ------------------------------------------------------------------------------
54 
55 end module fv3jedi_vars_mod
Fortran module to handle variables for the FV3JEDI model.
subroutine, public fv3jedi_vars_create(c_vars, self)
Fortran derived type to represent fv3jedi model variables.