aragog.solver
solver
Solver
FloatOrArray = float | npt.NDArray
module-attribute
logger = logging.getLogger(__name__)
module-attribute
BoundaryConditions(_parameters, _mesh)
dataclass
Boundary conditions
Args: parameters: Parameters mesh: Mesh
apply_flux_boundary_conditions(state)
Applies the boundary conditions to the state.
Args: state: The state to apply the boundary conditions to
Source code in aragog/core.py
111 112 113 114 115 116 117 118 119 120 | |
apply_flux_inner_boundary_condition(state)
Applies the flux boundary condition to the state at the inner boundary.
Args: state: The state to apply the boundary conditions to
Equivalent to CORE_BC in C code. 1: Simple core cooling 2: Prescribed heat flux 3: Prescribed temperature
Source code in aragog/core.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
apply_flux_outer_boundary_condition(state)
Applies the flux boundary condition to the state at the outer boundary.
Args: state: The state to apply the boundary conditions to
Equivalent to SURFACE_BC in C code. 1: Grey-body atmosphere 2: Zahnle steam atmosphere 3: Couple to atmodeller 4: Prescribed heat flux 5: Prescribed temperature
Source code in aragog/core.py
122 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 | |
apply_temperature_boundary_conditions(temperature, temperature_basic, dTdr)
Conforms the temperature and dTdr at the basic nodes to temperature boundary conditions.
Args: temperature: Temperature at the staggered nodes temperature_basic: Temperature at the basic nodes dTdr: Temperature gradient at the basic nodes
Source code in aragog/core.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
apply_temperature_boundary_conditions_melt(melt_fraction, melt_fraction_basic, dphidr)
Conforms the melt fraction gradient dphidr at the basic nodes to temperature boundary conditions.
Args: melt_fraction: Melt fraction at the staggered nodes melt_fraction_basic: Melt fraction at the basic nodes dphidr: Melt fraction gradient at the basic nodes
Source code in aragog/core.py
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 | |
core_cooling(state)
Applies a core cooling heat flux according to Eq. (37) of Bower et al., 2018
Args: state: The state to apply the boundary condition to
Source code in aragog/core.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
grey_body(state)
Applies a grey body flux at the surface.
Args: state: The state to apply the boundary conditions to
Source code in aragog/core.py
153 154 155 156 157 158 159 160 161 162 163 | |
Evaluator(_parameters)
dataclass
Contains classes that evaluate quantities necessary to compute the interior evolution.
Args: _parameters: Parameters
Attributes: boundary_conditions: Boundary conditions initial_condition: Initial condition mesh: Mesh phases: Evaluators for all phases radionuclides: Radionuclides
InitialCondition(_parameters, _mesh, _phases)
dataclass
Initial condition
Args: parameters: Parameters mesh: Mesh phases: PhaseEvaluatorCollection
get_adiabat(pressure_basic)
Gets an adiabatic temperature profile by integrating the adiatiabatic temperature gradient dTdPs from the surface. Uses the set surface temperature.
Args: Pressure field on the basic nodes
Returns: Adiabatic temperature profile for the staggered nodes
Source code in aragog/core.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
get_linear()
Gets a linear temperature profile
Returns: Linear temperature profile for the staggered nodes Only works for uniform spatial mesh.
Source code in aragog/core.py
253 254 255 256 257 258 259 260 261 262 263 264 265 | |
Mesh(parameters)
A staggered mesh.
The basic mesh is used for the flux calculations and the staggered mesh is used for the volume calculations.
Args: parameters: Parameters
Source code in aragog/mesh.py
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 | |
dxidr
property
dxi/dr at basic nodes
d_dr_at_basic_nodes(staggered_quantity)
Determines d/dr at the basic nodes of a quantity defined at the staggered nodes.
Args: staggered_quantity: A quantity defined at the staggered nodes.
Returns: d/dr at the basic nodes
Source code in aragog/mesh.py
370 371 372 373 374 375 376 377 378 379 380 381 382 | |
get_basic_mass_coordinates_from_spatial_coordinates(basic_coordinates)
Computes the basic mass coordinates from basic spatial coordinates.
Args: Basic spatial coordinates
Returns: Basic mass coordinates
Source code in aragog/mesh.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
get_constant_spacing()
Constant radius spacing across the mantle
Returns: Radii with constant spacing as a column vector
Source code in aragog/mesh.py
320 321 322 323 324 325 326 327 328 329 330 331 | |
get_dxidr_basic()
Computes dxidr at basic nodes.
Source code in aragog/mesh.py
308 309 310 311 312 313 314 315 316 317 318 | |
get_planet_density(basic_coordinates)
Computes the planet density.
Args: Basic spatial coordinates
Returns: Planet effective density
Source code in aragog/mesh.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
get_staggered_spatial_coordinates_from_mass_coordinates(staggered_mass_coordinates)
Computes the staggered spatial coordinates from staggered mass coordinates.
Args: Staggered mass coordinates
Returns: Staggered spatial coordinates
Source code in aragog/mesh.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
quantity_at_basic_nodes(staggered_quantity)
Determines a quantity at the basic nodes that is defined at the staggered nodes.
Uses backward and forward differences at the inner and outer radius, respectively, to obtain the quantity values of the basic nodes at the innermost and outermost nodes. When using temperature boundary conditions, values at outer boundaries will be overwritten. When using flux boundary conditions, values at outer boundaries will be used to provide estimate of individual components of heat fluxes though the total heat flux is imposed.
Args: staggered_quantity: A quantity defined at the staggered nodes
Returns: The quantity at the basic nodes
Source code in aragog/mesh.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
quantity_at_staggered_nodes(basic_quantity)
Determines a quantity at the staggered nodes that is defined at the basic nodes.
Staggered nodes are always located at cell centers, whatever the mesh.
Args: basic_quantity: A quantity defined at the basic nodes
Returns: The quantity at the staggered nodes
Source code in aragog/mesh.py
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
Parameters(*, boundary_conditions, energy, initial_condition, mesh, phase_solid, phase_liquid, phase_mixed, radionuclides, scalings, solver)
dataclass
Assembles all the parameters.
The parameters in each section are scaled here to ensure that all the parameters are scaled (non-dimensionalised) consistently with each other.
from_file(*filenames)
classmethod
Parses the parameters in a configuration file(s)
Args: *filenames: Filenames of the configuration data
Source code in aragog/parser.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | |
radionuclide_sections(parser)
staticmethod
Section names relating to radionuclides
Sections relating to radionuclides must have the prefix radionuclide_
Source code in aragog/parser.py
499 500 501 502 503 504 505 506 507 508 509 | |
PhaseEvaluatorCollection(parameters)
dataclass
A collection of phase evaluators
Creates the phase evaluators and selects the active phase based on configuration data.
Args: parameters: Parameters
Attributes: liquid: Liquid evaluator solid: Solid evaluator mixed: Mixed evaluator composite: Composite evaluator active: The active evaluator, which is defined by configuration data
PhaseEvaluatorProtocol
Solver(param)
Solves the interior dynamics
Args: filename: Filename of a file with configuration settings root: Root path to the flename
Attributes: filename: Filename of a file with configuration settings root: Root path to the filename. Defaults to empty parameters: Parameters evaluator: Evaluator state: State
Source code in aragog/solver.py
486 487 488 489 490 491 | |
solution
property
The solution.
temperature_basic
property
Temperature of the basic mesh in K
temperature_staggered
property
Temperature of the staggered mesh in K
dTdt(time, temperature)
dT/dt at the staggered nodes
Args: time: Time temperature: Temperature at the staggered nodes
Returns: dT/dt at the staggered nodes
Source code in aragog/solver.py
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | |
from_file(filename, root=Path())
classmethod
Parses a configuration file
Args: filename: Filename root: Root of the filename
Returns: Parameters
Source code in aragog/solver.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | |
initialize()
Initializes the model.
Source code in aragog/solver.py
510 511 512 513 514 | |
make_tsurf_event()
Creates a temperature event function for use with an ODE solver to monitor changes in the surface temperature.The event triggers when the change exceeds the threshold, allowing the solver to stop integration.
Returns: The event has the attributes: - terminal = True: Integration stops when the event is triggered. - direction = -1: Only triggers when the function is decreasing through zero.
Source code in aragog/solver.py
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | |
reset()
This function initializes the model, while keeping the previous state of the PhaseEvaluatorCollection object. This avoids multiple loads of lookup table data when running Aragog multiple times.
Source code in aragog/solver.py
516 517 518 519 520 521 522 523 524 525 526 527 | |
State(parameters, _evaluator)
dataclass
Stores and updates the state at temperature and pressure.
Args: parameters: Parameters evaluator: Evaluator
Attributes: evaluator: Evaluator critical_reynolds_number: Critical Reynolds number gravitational_separation_flux: Gravitational separation flux at the basic nodes heating: Total internal heat production at the staggered nodes (power per unit mass) heating_radio: Radiogenic heat production at the staggered nodes (power per unit mass) heating_tidal: Tidal heat production at the staggered nodes (power per unit mass) heat_flux: Heat flux at the basic nodes (power per unit area) inviscid_regime: True if the flow is inviscid and otherwise False, at the basic nodes inviscid_velocity: Inviscid velocity at the basic nodes is_convective: True if the flow is convecting and otherwise False, at the basic nodes reynolds_number: Reynolds number at the basic nodes super_adiabatic_temperature_gradient: Super adiabatic temperature gradient at the basic nod temperature_basic: Temperature at the basic nodes temperature_staggered: Temperature at the staggered nodes bottom_temperature: Temperature at the bottom basic node top_temperature: Temperature at the top basic node viscous_regime: True if the flow is viscous and otherwise False, at the basic nodes viscous_velocity: Viscous velocity at the basic nodes
critical_reynolds_number
property
Critical Reynolds number from Abe (1993)
heat_flux
property
The total heat flux according to the fluxes specified in the configuration.
heating
property
The power generation according to the heat sources specified in the configuration.
heating_dilatation
property
The heat source through dilation/compression.
heating_radio
property
The radiogenic power generation.
heating_tidal
property
The tidal power generation.
mass_flux
property
The total melt mass flux according to the fluxes specified in the configuration.
conductive_heat_flux()
Conductive heat flux:
where \(k\) is thermal conductivity, \(T\) is temperature, and \(r\) is radius.
Source code in aragog/solver.py
114 115 116 117 118 119 120 121 122 123 124 125 | |
convective_heat_flux()
Convective heat flux:
where \(\rho\) is density, \(c_p\) is heat capacity at constant pressure, \(\kappa_h\) is eddy diffusivity, \(T\) is temperature, \(r\) is radius, and \(S\) is entropy.
Source code in aragog/solver.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
dilatation_heating()
Dilatation/compression heating (power per unit mass)
Returns: Dilatation/compression heating (power per unit mass) at each layer of the staggered mesh, at a given point in time.
Source code in aragog/solver.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
gravitational_separation_mass_flux()
Gravitational separation mass flux:
where \(\rho\) is density, \(\phi\) is melt fraction, and \(v_{rel}\) is relative velocity.
Source code in aragog/solver.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
mixing_mass_flux()
Mixing mass flux:
where \(\rho\) is density, \(\kappa_h\) is eddy diffusivity, \(\phi\) is melt mass fraction, and \(r\) is radius.
Source code in aragog/solver.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
radiogenic_heating(time)
Radiogenic heating (constant with radius)
Args: time: Time
Returns: Radiogenic heating (power per unit mass) at each layer of the staggered mesh, at a given point in time.
Source code in aragog/solver.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
tidal_heating()
Tidal heating at each layer of the mantle.
Args: time: Time
Returns: Tidal heating (power per unit mass) at each layer of the staggered mesh, at a given point in time.
Source code in aragog/solver.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
update(temperature, time)
Updates the state.
The evaluation order matters because we want to minimise the number of evaluations.
Args: temperature: Temperature at the staggered nodes pressure: Pressure at the staggered nodes time: Time
Source code in aragog/solver.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
_EnergyParameters(conduction, convection, gravitational_separation, mixing, radionuclides, dilatation, tidal, tidal_array=(lambda: np.array([0.0], dtype=float))())
dataclass
Stores parameters in the energy section
scale_attributes(scalings)
Scales the attributes.
Args: scalings: scalings
Source code in aragog/parser.py
218 219 220 221 222 223 224 225 | |
_Radionuclide(name, t0_years, abundance, concentration, heat_production, half_life_years)
dataclass
Stores the settings in a radionuclide section in the configuration data.
get_heating(time)
Radiogenic heating
Args: time: Time
Returns: Radiogenic heat production (power per unit mass) as a float if time is a float, otherwise a numpy row array where each entry in the row is associated with a single time in the time array.
Source code in aragog/parser.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
scale_attributes(scalings)
Scales the attributes.
Args: scalings: scalings
Source code in aragog/parser.py
391 392 393 394 395 396 397 398 399 400 401 | |