vulcan.agni
agni
Climate hook that couples VULCAN to the AGNI radiative-convective model.
AgniClimate sets up an AGNI atmosphere on VULCAN's pressure range and, at each climate
update, hands it VULCAN's mixing ratios, solves for the temperature profile (or, with
solve_rce = False, keeps VULCAN's temperature) and returns the temperature and AGNI's eddy
diffusion profile as a vulcan.climate.ClimateUpdate. set_composition and
climate_update work on any AGNI atmosphere, so a coupled framework that builds its own
AGNI atmosphere can use them in its own hook.
AGNI works in SI units and VULCAN in cgs: pressures are converted with PA_TO_DYN and
diffusion coefficients with M2_TO_CM2 at this boundary.
Imports
vulcan.climate: the climate-hook interface.vulcan.config:Configclass for handling configuration settings.vulcan.paths: Paths to various files and directories used in VULCAN.
AgniClimate(vulcan_cfg, atm, var)
Climate hook that solves the temperature profile with AGNI (see vulcan.climate).
With solve_rce = True AGNI solves for radiative-convective equilibrium with the
surface condition agni_sol_type. With solve_rce = False VULCAN's temperature is
returned unchanged, on VULCAN's own grid, and AGNI only computes the convective fluxes
and the eddy diffusion profile from it.
vulcan_cfg : Config
Run configuration.
atm : store.AtmData
Atmosphere data, passed to init_agni_atmos.
var : store.Variables
Model variables, passed to init_agni_atmos.
Source code in src/vulcan/agni.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
atmos = init_agni_atmos(vulcan_cfg, atm, var)
instance-attribute
cfg = vulcan_cfg
instance-attribute
close()
Deallocate the AGNI atmosphere.
Source code in src/vulcan/agni.py
424 425 426 | |
activate_julia(vulcan_cfg)
Load AGNI into Julia, unless a caller (such as PROTEUS) has loaded it already.
When AGNI is already loaded, its Julia environment and logger are left as they are.
Otherwise the Julia environment in agni_dir is activated, AGNI is imported and its
log goes to agni_recent.log in Config.output_dir.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vulcan_cfg
|
Config
|
Run configuration; |
required |
Returns:
| Type | Description |
|---|---|
juliacall module
|
The Julia |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If AGNI is not loaded yet and |
Source code in src/vulcan/agni.py
68 69 70 71 72 73 74 75 76 77 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 103 104 105 106 107 108 109 110 111 112 | |
agni_dir(vulcan_cfg)
AGNI folder: agni_dir from the config, or VULCAN/AGNI when that is empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vulcan_cfg
|
Config
|
Run configuration; |
required |
Returns:
| Type | Description |
|---|---|
str
|
Path to the AGNI folder. |
Source code in src/vulcan/agni.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
climate_update(atmos)
The temperature and eddy diffusion of an AGNI atmosphere, in VULCAN's cgs units.
Temperature is on AGNI's layer centres and Kzz on its level edges. Pressures are converted from Pa to dyn cm-2 and Kzz from m2 s-1 to cm2 s-1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atmos
|
Atmos_t
|
AGNI atmosphere. |
required |
Returns:
| Type | Description |
|---|---|
ClimateUpdate
|
|
Source code in src/vulcan/agni.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
deallocate_atmos(atmos)
Deallocate an AGNI atmosphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atmos
|
Atmos_t
|
The atmosphere to deallocate. |
required |
Source code in src/vulcan/agni.py
226 227 228 229 230 231 232 233 234 235 | |
init_agni_atmos(vulcan_cfg, atm, var)
Set up and allocate an AGNI atmosphere on VULCAN's pressure range.
The composition starts from VULCAN's column-median mixing ratios, leaving out species
with '_' in their name (condensates and excited states), and the temperature from
VULCAN's profile (set_temperature). The instellation comes from _instellation
[W m-2]. AGNI gets the boundary pressures atm.pico[0] and atm.pico[-1] in bar,
gravity and planet radius in SI, and Config.sl_angle in degrees.
A runtime.sf spectral file in Config.output_dir is used unchanged when it exists;
otherwise AGNI makes it from Config.spectral_file in agni_dir and the stellar
spectrum. With spectral_file = 'greygas', AGNI uses its grey-gas scheme instead of
a spectral file. FastChem files go to agni_fastchem in Config.output_dir.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vulcan_cfg
|
Config
|
Run configuration. |
required |
atm
|
AtmData
|
Atmosphere data; reads |
required |
var
|
Variables
|
Model variables; reads |
required |
Returns:
| Type | Description |
|---|---|
Atmos_t
|
The allocated AGNI atmosphere. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
RuntimeError
|
If AGNI fails to set up or allocate the atmosphere. |
Source code in src/vulcan/agni.py
123 124 125 126 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 159 160 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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
set_composition(atmos, pco, species, ymix)
Give an AGNI atmosphere VULCAN's mixing ratio profiles (see map_composition).
A gas that VULCAN lacks keeps its profile from before condensation (gas_ovmr).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atmos
|
Atmos_t
|
AGNI atmosphere; |
required |
pco
|
ndarray
|
VULCAN layer-centre pressures [dyn cm-2]. |
required |
species
|
list of str
|
VULCAN species names, the columns of |
required |
ymix
|
ndarray
|
VULCAN volume mixing ratios, [dimensionless], shape (nz, ni). |
required |
Source code in src/vulcan/agni.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
set_temperature(atmos, pco, tco)
Set the AGNI temperature profile from VULCAN's.
The temperature is interpolated in log pressure onto AGNI's layers and levels (see
vulcan.climate.interp_logp); the surface temperature is that of the last AGNI
level. AGNI's layer properties are then recomputed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
atmos
|
Atmos_t
|
AGNI atmosphere, updated in place. |
required |
pco
|
ndarray
|
VULCAN layer-centre pressures [dyn cm-2]. |
required |
tco
|
ndarray
|
VULCAN temperatures on |
required |
Source code in src/vulcan/agni.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |