Soil Water Balance (SWB2)
Toggle main menu visibility
Loading...
Searching...
No Matches
fog__monthly_grid.F90
Go to the documentation of this file.
1
!> @file
2
!! Contains the module \ref fog__monthly_grid.
3
4
!>
5
!! Module \ref fog__monthly_grid
6
!! provides support for estimating fog drip given a gridded map
7
!! of FOG_RATIO and FOG_CAPTURE_EFFICIENCY.
8
9
module
fog__monthly_grid
10
11
use
iso_c_binding
12
use
constants_and_conversions
13
use
data_catalog
14
use
data_catalog_entry
15
use
dictionary
16
use
exceptions
17
use
file_operations
18
use
logfiles
,
only
:
logs
,
log_all
19
use
parameters
,
only
:
params
20
use
simulation_datetime
21
use
fstring
22
use
fstring_list
23
24
implicit none
25
26
private
27
28
public
::
fog_monthly_grid_initialize
,
fog_monthly_grid_calculate
,
pfog_ratio
29
30
type
(
data_catalog_entry_t
),
pointer
::
pfog_ratio
31
real
(c_float),
allocatable
::
ffog_catch_efficiency
(:)
32
33
contains
34
35
!> Initialize the fog drip algorithm.
36
!!
37
!! Read in a fog ratio grid.
38
!! Open a NetCDF output file to hold fog variable output.
39
!!
40
!! @param[in] lActive 2-D array of active cells within the model domain.
41
subroutine
fog_monthly_grid_initialize
( lActive )
42
43
logical (c_bool)
,
intent(in)
:: lactive(:,:)
44
45
! [ LOCALS ]
46
type
(
fstring_list_t
) :: slstring
47
integer (c_int)
,
allocatable
:: ilandusecodes(:)
48
integer (c_int)
:: inumberoflanduses
49
logical (c_bool)
:: larelengthsequal
50
51
! locate the data structure associated with the gridded fog ratio entries
52
pfog_ratio
=>
dat
%find(
"FOG_RATIO"
)
53
if
( .not.
associated
(
pfog_ratio
) ) &
54
call
die
(
"A FOG_RATIO grid must be supplied in order to make use of this option."
, __file__, __line__)
55
56
!> Determine how many landuse codes are present
57
call
slstring%append(
"LU_Code"
)
58
call
slstring%append(
"Landuse_Code"
)
59
60
call
params
%get_parameters( slkeys=slstring, ivalues=ilandusecodes )
61
inumberoflanduses = count( ilandusecodes > 0 )
62
63
call
slstring%clear()
64
65
call
slstring%append(
"Fog_catch_eff"
)
66
call
slstring%append(
"Fog_catch_efficiency"
)
67
68
call
params
%get_parameters( slkeys=slstring , fvalues=
ffog_catch_efficiency
)
69
70
if
(
ffog_catch_efficiency
(1) <=
ftinyval
) &
71
call
warn
(
"Failed to find a data column containing fog catch efficiency values."
, lfatal=
true
, &
72
iloglevel=
log_all
)
73
74
larelengthsequal = ( ( ubound(
ffog_catch_efficiency
,1) == ubound(ilandusecodes,1) ) )
75
76
if
( .not. larelengthsequal ) &
77
call
warn
( smessage=
"The number of landuses does not match the number of fog catch efficiency values."
, &
78
smodule=__file__, iline=__line__, lfatal=.
true
._c_bool )
79
80
end subroutine
fog_monthly_grid_initialize
81
82
!--------------------------------------------------------------------------------------------------
83
84
subroutine
fog_monthly_grid_calculate
( fRainfall, fFog, iLanduse_Index, lActive, nodata_fill_value )
85
86
real
(c_float),
intent(in)
:: frainfall(:)
87
real
(c_float),
intent(inout)
:: ffog(:)
88
integer (c_int)
,
intent(in)
:: ilanduse_index(:)
89
logical (c_bool)
,
intent(in)
:: lactive(:,:)
90
real
(c_float),
intent(in)
:: nodata_fill_value(:,:)
91
92
! [ LOCALS ]
93
94
associate( dt =>
sim_dt
%curr )
95
96
if
( .not.
associated
(
pfog_ratio
) ) &
97
call
die
(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer"
, __file__, __line__)
98
99
if
( .not.
allocated
(
pfog_ratio
%pGrdBase%rData) ) &
100
call
die
(
"INTERNAL PROGRAMMING ERROR: attempted use of unallocated variable"
, __file__, __line__)
101
102
call
pfog_ratio
%getvalues( dt )
103
104
ffog = frainfall * pack(
pfog_ratio
%pGrdBase%rData, lactive ) &
105
*
ffog_catch_efficiency
( ilanduse_index )
106
107
end
associate
108
109
end subroutine
fog_monthly_grid_calculate
110
111
end module
fog__monthly_grid
constants_and_conversions
This module contains physical constants and convenience functions aimed at performing unit conversion...
Definition
constants_and_conversions.F90:8
constants_and_conversions::true
logical(c_bool), parameter, public true
Definition
constants_and_conversions.F90:38
constants_and_conversions::ftinyval
real(c_float), parameter ftinyval
Definition
constants_and_conversions.F90:47
data_catalog
Defines the DATA_CATALOG_T data type, which contains type-bound procedures to add,...
Definition
data_catalog.F90:10
data_catalog::dat
type(data_catalog_t), public dat
DAT is a global to hold data catalog entries.
Definition
data_catalog.F90:65
data_catalog_entry
Definition
data_catalog_entry.F90:8
dictionary
Definition
dictionary.F90:1
exceptions
Definition
exceptions.F90:1
exceptions::warn
subroutine, public warn(smessage, smodule, iline, shints, lfatal, iloglevel, lecho)
Definition
exceptions.F90:245
exceptions::die
subroutine, public die(smessage, smodule, iline, shints, scalledby, icalledbyline)
Definition
exceptions.F90:140
file_operations
Definition
file_operations.F90:1
fog__monthly_grid
Module fog__monthly_grid provides support for estimating fog drip given a gridded map of FOG_RATIO an...
Definition
fog__monthly_grid.F90:9
fog__monthly_grid::ffog_catch_efficiency
real(c_float), dimension(:), allocatable ffog_catch_efficiency
Definition
fog__monthly_grid.F90:31
fog__monthly_grid::fog_monthly_grid_initialize
subroutine, public fog_monthly_grid_initialize(lactive)
Initialize the fog drip algorithm.
Definition
fog__monthly_grid.F90:42
fog__monthly_grid::pfog_ratio
type(data_catalog_entry_t), pointer, public pfog_ratio
Definition
fog__monthly_grid.F90:30
fog__monthly_grid::fog_monthly_grid_calculate
subroutine, public fog_monthly_grid_calculate(frainfall, ffog, ilanduse_index, lactive, nodata_fill_value)
Definition
fog__monthly_grid.F90:85
fstring
Definition
fstring.F90:1
fstring_list
Definition
fstring_list.F90:1
logfiles
Definition
logfiles.F90:1
logfiles::logs
type(logfile_t), public logs
Definition
logfiles.F90:62
logfiles::log_all
@ log_all
Definition
logfiles.F90:22
parameters
Definition
parameters.F90:1
parameters::params
type(parameters_t), public params
Definition
parameters.F90:68
simulation_datetime
Definition
simulation_datetime.F90:1
simulation_datetime::sim_dt
type(date_range_t), public sim_dt
Definition
simulation_datetime.F90:45
data_catalog_entry::data_catalog_entry_t
Definition
data_catalog_entry.F90:46
fstring_list::fstring_list_t
Definition
fstring_list.F90:21
src
fog__monthly_grid.F90
Generated on
for Soil Water Balance (SWB2) by
1.17.0