vulcan.climate
climate
Interface between VULCAN and a climate model that updates the temperature and the eddy diffusion profile during an integration.
A climate hook is any callable hook(pco, Tco, species, ymix) that returns a
ClimateUpdate. VULCAN passes its layer-centre pressures pco [dyn cm-2] from the bottom of
the column up, its temperature Tco [K] on those layers, the list of species names and
their volume mixing ratios ymix, shape (nz, ni). The hook returns the new temperature
profile, and optionally a new eddy diffusion profile, on its own pressure grid; VULCAN maps
them onto its grid with regrid_temperature and regrid_kzz. vulcan.agni.AgniClimate is
the hook for AGNI; a coupled framework can pass its own hook to vulcan.run_vulcan.
All quantities are in cgs units, as everywhere in VULCAN.
ClimateUpdate(p, tmp, p_kzz=None, kzz=None)
dataclass
Profiles returned by a climate hook, each on the hook's own pressure grid.
The arrays are copied, so they do not change with the hook's own arrays.
Attributes:
| Name | Type | Description |
|---|---|---|
p |
ndarray
|
Pressures of |
tmp |
ndarray
|
Temperature [K]. |
p_kzz |
ndarray or None
|
Pressures of |
kzz |
ndarray or None
|
Eddy diffusion coefficient [cm2 s-1], or None to leave VULCAN's profile unchanged. |
kzz = None
class-attribute
instance-attribute
p
instance-attribute
p_kzz = None
class-attribute
instance-attribute
tmp
instance-attribute
interp_logp(p_src, val_src, p_tgt)
Interpolate linearly in log pressure; outside the source range the end values hold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_src
|
array_like
|
Source pressures, in any order and in any one pressure unit shared with |
required |
val_src
|
array_like
|
Values on |
required |
p_tgt
|
array_like
|
Target pressures, in the unit of |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Values on |
Source code in src/vulcan/climate.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
map_composition(p_src, species, ymix, p_tgt, current)
Map VULCAN mixing ratios onto the gases and pressures of a climate model.
A gas of the climate model that VULCAN also has takes VULCAN's profile, interpolated
linearly in log pressure (end values hold outside VULCAN's grid). A gas that VULCAN does
not have keeps its profile from current. The mixing ratios are then divided by their
sum on each level, so that they sum to 1 again: VULCAN species absent from the climate
model, such as radicals and condensates, are left out of that sum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_src
|
ndarray
|
VULCAN pressures of |
required |
species
|
list of str
|
VULCAN species names, the columns of |
required |
ymix
|
ndarray
|
VULCAN volume mixing ratios [dimensionless], shape (nz, ni). |
required |
p_tgt
|
ndarray
|
Pressures of the climate model's layers, in the same unit as |
required |
current
|
dict
|
The climate model's present mixing ratio profile of each of its gases, on |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The new mixing ratio profile of each gas of the climate model, on |
Source code in src/vulcan/climate.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
max_relative_change(t_old, t_new)
Largest relative temperature change over the layers, max |T_new - T_old| / T_old.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t_old
|
ndarray
|
Temperature before the update [K], shape (nz,); must be positive. |
required |
t_new
|
ndarray
|
Temperature after the update [K], same shape. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The largest relative change [dimensionless]. |
Source code in src/vulcan/climate.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
regrid_kzz(update, pico_inner)
Eddy diffusion of a climate update on VULCAN's inner interfaces pico[1:-1].
Linear in log pressure of log Kzz when Kzz is positive everywhere, which reproduces a power law in pressure exactly; linear in Kzz otherwise. The end values hold outside the climate grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update
|
ClimateUpdate
|
Climate result; |
required |
pico_inner
|
ndarray
|
VULCAN interface pressures without the top and bottom ones, |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Kzz on |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the update has no Kzz profile. |
Source code in src/vulcan/climate.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
regrid_temperature(update, pco)
Temperature of a climate update on VULCAN's layer-centre pressures.
Linear in log pressure. Above or below the climate grid the temperature of its top or bottom layer holds, so no value is extrapolated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update
|
ClimateUpdate
|
Climate result; |
required |
pco
|
ndarray
|
VULCAN layer-centre pressures [dyn cm-2], shape (nz,). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Temperature on |
Source code in src/vulcan/climate.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |