28 real(kind=
dp) :: rel_humid
30 real(kind=
dp) :: pressure
32 real(kind=
dp) :: longitude
34 real(kind=
dp) :: latitude
36 real(kind=
dp) :: altitude
38 real(kind=
dp) :: start_time
42 real(kind=
dp) :: elapsed_time
44 real(kind=
dp) :: solar_zenith_angle
46 real(kind=
dp) :: height
78 env_state%temp = env_state%temp + env_state_delta%temp
79 env_state%rel_humid = env_state%rel_humid + env_state_delta%rel_humid
80 env_state%pressure = env_state%pressure + env_state_delta%pressure
81 env_state%longitude = env_state%longitude + env_state_delta%longitude
82 env_state%latitude = env_state%latitude + env_state_delta%latitude
83 env_state%altitude = env_state%altitude + env_state_delta%altitude
84 env_state%start_time = env_state%start_time + env_state_delta%start_time
85 env_state%start_day = env_state%start_day + env_state_delta%start_day
86 env_state%elapsed_time = env_state%elapsed_time &
87 + env_state_delta%elapsed_time
88 env_state%solar_zenith_angle = env_state%solar_zenith_angle &
89 + env_state_delta%solar_zenith_angle
90 env_state%height = env_state%height + env_state_delta%height
102 real(kind=
dp),
intent(in) :: alpha
104 env_state%temp = env_state%temp * alpha
105 env_state%rel_humid = env_state%rel_humid * alpha
106 env_state%pressure = env_state%pressure * alpha
107 env_state%longitude = env_state%longitude * alpha
108 env_state%latitude = env_state%latitude * alpha
109 env_state%altitude = env_state%altitude * alpha
110 env_state%start_time = env_state%start_time * alpha
111 env_state%start_day = nint(real(env_state%start_day, kind=
dp) * alpha)
112 env_state%elapsed_time = env_state%elapsed_time * alpha
113 env_state%solar_zenith_angle = env_state%solar_zenith_angle * alpha
114 env_state%height = env_state%height * alpha
127 real(kind=
dp),
intent(in) :: dv
134 dmv = dv *
const%water_density
136 mv =
const%water_molec_weight / (
const%univ_gas_const*env_state%temp) * pmv
139 call warn_msg(980320483,
"relative humidity tried to go negative")
142 env_state%rel_humid =
const%univ_gas_const * env_state%temp &
143 /
const%water_molec_weight * mv &
157 * 10d0**(7.45d0 * (env_state%temp -
const%water_freeze_temp) &
158 / (env_state%temp - 38d0))
184 / (
const%univ_gas_const * env_state%temp)
197 / (
const%univ_gas_const * env_state%temp *
const%water_density)
209 real(kind=
dp),
intent(in) :: ppb
224 real(kind=
dp),
intent(in) :: conc
245 val%temp = val_avg%temp
246 val%rel_humid = val_avg%rel_humid
247 val%pressure = val_avg%pressure
268 val%temp = val_avg%temp
269 val%rel_humid = val_avg%rel_humid
270 val%pressure = val_avg%pressure
305 character,
intent(inout) :: buffer(:)
307 integer,
intent(inout) :: position
312 integer :: prev_position
314 prev_position = position
338 character,
intent(inout) :: buffer(:)
340 integer,
intent(inout) :: position
345 integer :: prev_position
347 prev_position = position
391 real(kind=
dp),
intent(in) :: temperature
393 this%val%temp = temperature
405 real(kind=
dp),
intent(in) :: pressure
407 this%val%pressure = pressure
integer, parameter dp
Kind of a double precision real number.
type(const_t), save const
Fixed variable for accessing the constant's values.
The env_state_t structure and associated subroutines.
subroutine camp_mpi_pack_env_state(buffer, position, val)
Packs the given value into the buffer, advancing position.
real(kind=dp) function env_state_air_molar_den(env_state)
Air molar density (mol m^{-3}).
real(kind=dp) function env_state_ppb_to_conc(env_state, ppb)
Convert (ppb) to (molecules m^{-3}).
real(kind=dp) function env_state_a(env_state)
Condensation parameter.
real(kind=dp) function env_state_sat_vapor_pressure(env_state)
Computes the current saturation vapor pressure (Pa).
integer function camp_mpi_pack_size_env_state(val)
Determines the number of bytes required to pack the given value.
real(kind=dp) function env_state_conc_to_ppb(env_state, conc)
Convert (molecules m^{-3}) to (ppb).
subroutine camp_mpi_unpack_env_state(buffer, position, val)
Unpacks the given value from the buffer, advancing position.
subroutine env_state_scale(env_state, alpha)
env_state *= alpha
subroutine set_pressure_pa(this, pressure)
Set the pressure (Pa)
subroutine set_temperature_k(this, temperature)
Set the temperature (K)
subroutine env_state_reduce_avg(val)
Average val over all processes, with the result only on the root process.
subroutine env_state_add(env_state, env_state_delta)
env_state += env_state_delta
subroutine env_state_mix(val)
Average val over all processes.
subroutine env_state_change_water_volume(env_state, dv)
Adds the given water volume to the water vapor and updates all environment quantities.
subroutine camp_mpi_reduce_avg_env_state(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on the root process.
real(kind=dp) function env_state_air_den(env_state)
Air density (kg m^{-3}).
Wrapper functions for MPI.
integer function camp_mpi_rank(comm)
Returns the rank of the current process.
subroutine camp_mpi_pack_real(buffer, position, val, comm)
Packs the given value into the buffer, advancing position.
subroutine camp_mpi_unpack_integer(buffer, position, val, comm)
Unpacks the given value from the buffer, advancing position.
subroutine camp_mpi_reduce_avg_real(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on the root process.
subroutine camp_mpi_pack_integer(buffer, position, val, comm)
Packs the given value into the buffer, advancing position.
integer function camp_mpi_pack_size_integer(val, comm)
Determines the number of bytes required to pack the given value.
subroutine camp_mpi_allreduce_average_real(val, val_avg)
Computes the average of val across all processes, storing the result in val_avg on all processes.
subroutine camp_mpi_unpack_real(buffer, position, val, comm)
Unpacks the given value from the buffer, advancing position.
integer function camp_mpi_pack_size_real(val, comm)
Determines the number of bytes required to pack the given value.
Common utility subroutines.
subroutine assert(code, condition_ok)
Errors unless condition_ok is true.
subroutine warn_msg(code, warning_msg, already_warned)
Prints a warning message.
Current environment state.