41 type(model_state_type),
target,
intent(inout) :: current_state
45 if (is_component_enabled(current_state%options_database,
"casim"))
then 46 call log_master_log(log_error,
"Casim and Simplecloud are enabled, this does not work yet. Please disable one")
49 iqv=get_q_index(standard_q_names%VAPOUR,
'simplecloud')
50 iql=get_q_index(standard_q_names%CLOUD_LIQUID_MASS,
'simplecloud')
54 if (.not.
allocated(current_state%cq))
then 55 allocate(current_state%cq(current_state%number_q_fields))
56 current_state%cq=0.0_default_precision
58 current_state%cq(
iql) = -1.0
60 max_height_cloud=options_get_real(current_state%options_database,
"max_height_cloud")
61 do k=2, current_state%local_grid%size(z_index)-1
62 if (current_state%global_grid%configuration%vertical%zn(k) >
max_height_cloud)
exit 72 type(model_state_type),
target,
intent(inout) :: current_state
74 real(DEFAULT_PRECISION) :: TdegK
75 real(DEFAULT_PRECISION) :: Pmb
76 real(DEFAULT_PRECISION) :: exner
77 real(DEFAULT_PRECISION) :: one_over_exner
78 real(DEFAULT_PRECISION) :: qv,qc
79 real(DEFAULT_PRECISION) :: qs
80 real(DEFAULT_PRECISION) :: dqsdT
81 real(DEFAULT_PRECISION) :: qsatfac
82 real(DEFAULT_PRECISION) :: dmass
87 real(DEFAULT_PRECISION) :: dtm
89 if (current_state%halo_column)
return 91 dtm = current_state%dtm*2.0
92 if (current_state%field_stepping == forward_stepping) dtm=current_state%dtm
94 icol=current_state%column_local_x
95 jcol=current_state%column_local_y
99 exner = current_state%global_grid%configuration%vertical%rprefrcp(k)
100 one_over_exner = current_state%global_grid%configuration%vertical%prefrcp(k)
101 pmb = (current_state%global_grid%configuration%vertical%prefn(k)/100.)
103 if (current_state%field_stepping == forward_stepping)
then 104 qv = current_state%q(
iqv)%data(k, jcol, icol) + current_state%sq(
iqv)%data(k, jcol, icol)*dtm
105 qc = current_state%q(
iql)%data(k, jcol, icol) + current_state%sq(
iql)%data(k, jcol, icol)*dtm
106 tdegk = (current_state%th%data(k, jcol, icol) + current_state%sth%data(k, jcol, icol)*dtm &
107 + current_state%global_grid%configuration%vertical%thref(k))*exner
109 qv = current_state%zq(
iqv)%data(k, jcol, icol) + current_state%sq(
iqv)%data(k, jcol, icol)*dtm
110 qc = current_state%zq(
iql)%data(k, jcol, icol) + current_state%sq(
iql)%data(k, jcol, icol)*dtm
111 tdegk = (current_state%zth%data(k, jcol, icol) + current_state%sth%data(k, jcol, icol)*dtm &
112 + current_state%global_grid%configuration%vertical%thref(k))*exner
116 qs = qsaturation(tdegk, pmb)
118 if (qv > qs .or. qc >0.0)
then 119 dqsdt = dqwsatdt(qs, tdegk)
121 qsatfac = 1.0/(1.0 + rlvap_over_cp*dqsdt)
123 dmass = max(-qc,(qv-qs)*qsatfac)/dtm
125 current_state%sq(
iqv)%data(k, jcol, icol) = current_state%sq(
iqv)%data(k, jcol, icol) - dmass
126 current_state%sq(
iql)%data(k, jcol, icol) = current_state%sq(
iql)%data(k, jcol, icol) + dmass
128 current_state%sth%data(k, jcol, icol) = current_state%sth%data(k, jcol, icol) &
129 + rlvap_over_cp*dmass*one_over_exner
136 do k=
k_cloudmax+1, current_state%local_grid%size(z_index)
137 if (current_state%scalar_stepping == forward_stepping)
then 138 qv = current_state%q(
iqv)%data(k, jcol, icol) + current_state%sq(
iqv)%data(k, jcol, icol)*dtm
139 qc = current_state%q(
iql)%data(k, jcol, icol) + current_state%sq(
iql)%data(k, jcol, icol)*dtm
140 tdegk = (current_state%th%data(k, jcol, icol) + current_state%sth%data(k, jcol, icol)*dtm &
141 + current_state%global_grid%configuration%vertical%thref(k))*exner
143 qv = current_state%zq(
iqv)%data(k, jcol, icol) + current_state%sq(
iqv)%data(k, jcol, icol)*dtm
144 qc = current_state%zq(
iql)%data(k, jcol, icol) + current_state%sq(
iql)%data(k, jcol, icol)*dtm
145 tdegk = (current_state%zth%data(k, jcol, icol) + current_state%sth%data(k, jcol, icol)*dtm &
146 + current_state%global_grid%configuration%vertical%thref(k))*exner
151 current_state%sq(
iqv)%data(k, jcol, icol) = current_state%sq(
iqv)%data(k, jcol, icol) - dmass
152 current_state%sq(
iql)%data(k, jcol, icol) = current_state%sq(
iql)%data(k, jcol, icol) + dmass
154 current_state%sth%data(k, jcol, icol) = current_state%sth%data(k, jcol, icol) &
155 + rlvap_over_cp*dmass*one_over_exner
integer, parameter, public forward_stepping
type(standard_q_names_type), public standard_q_names
subroutine initialisation_callback(current_state)
The initialisation callback sets up the moisture fields.
real(kind=default_precision) max_height_cloud
real(kind=default_precision), public r_over_cp
integer, parameter, public log_error
Only log ERROR messages.
real(kind=default_precision) function, public dqwsatdt(saturation_mixing_ratio, temperature)
Calculated the rate of change with temperature of saturation mixing ratio over liquid water...
type(component_descriptor_type) function, public simplecloud_get_descriptor()
Provides the descriptor back to the caller and is used in component registration. ...
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
integer, parameter, public z_index
Grid index parameters.
Contains common definitions for the data and datatypes used by MONC.
The ModelState which represents the current state of a run.
logical function, public is_component_enabled(options_database, component_name)
Determines whether or not a specific component is registered and enabled.
subroutine, public log_master_log(level, message)
Will log just from the master process.
subroutine timestep_callback(current_state)
Called for each column per timestep this will apply a forcing term to the aerosol fields...
Description of a component.
Saturation physics functionality which is used throughout the code.
Scientific constant values used throughout simulations. Each has a default value and this can be over...
This manages the Q variables and specifically the mapping between names and the index that they are s...
Interfaces and types that MONC components must specify.
real(kind=default_precision) function, public qsaturation(temperature, pressure)
Function to return the saturation mixing ratio over water based on tetans formular QS=3...
real(kind=default_precision) function, public options_get_real(options_database, key, index)
Retrieves a real value from the database that matches the provided key.
Functionality to support the different types of grid and abstraction between global grids and local o...
A very simple saturation adjustment scheme without any microphysics.
Manages the options database. Contains administration functions and deduce runtime options from the c...
real(kind=default_precision), public rlvap_over_cp
The model state which represents the current state of a run.
integer function, public get_q_index(name, assigning_component)
Add in a new entry into the register if the name does not already exist or return the index of the pr...