Energy solver
energy_solver
This module provides a fine-tuned solver class for the energy conservation equation.
Users instantiate the EnergySolver
class by providing relevant parameters and call
the solve
method to request a solver update.
iterative_energy_solver_parameters: dict[str, Any] = {'mat_type': 'aij', 'snes_type': 'ksponly', 'ksp_type': 'gmres', 'ksp_rtol': 1e-05, 'pc_type': 'sor'}
module-attribute
Default iterative solver parameters for solution of energy equation. Configured to use the GMRES Krylov scheme with Successive Over Relaxation (SOR) preconditioning. Note that default energy solver parameters can be augmented or adjusted by accessing the solver_parameter dictionary, for example: energy_solver.solver_parameters['ksp_converged_reason'] = None energy_solver.solver_parameters['ksp_rtol'] = 1e-4 G-ADOPT defaults to iterative solvers in 3-D.
direct_energy_solver_parameters: dict[str, Any] = {'mat_type': 'aij', 'snes_type': 'ksponly', 'ksp_type': 'preonly', 'pc_type': 'lu', 'pc_factor_mat_solver_type': 'mumps'}
module-attribute
Default direct solver parameters for solution of energy equation. Configured to use LU factorisation, using the MUMPS library. G-ADOPT defaults to direct solvers in 2-D.
EnergySolver(T, u, approximation, delta_t, timestepper, bcs=None, solver_parameters=None, su_advection=False)
Timestepper and solver for the energy equation. The temperature, T, is updated in place.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
T |
Function
|
Firedrake function for temperature |
required |
u |
Function
|
Firedrake function for velocity |
required |
approximation |
BaseApproximation
|
G-ADOPT base approximation describing the system of equations |
required |
delta_t |
Constant
|
Simulation time step |
required |
timestepper |
RungeKuttaTimeIntegrator
|
Runge-Kutta time integrator implementing an explicit or implicit numerical scheme |
required |
bcs |
Optional[dict[int, dict[str, Number]]]
|
Dictionary of identifier-value pairs specifying boundary conditions |
None
|
solver_parameters |
Optional[dict[str, Any]]
|
Solver parameters provided to PETSc |
None
|
su_advection |
bool
|
Boolean specifying whether or not to use the streamline-upwind stabilisation scheme |
False
|
Source code in g-adopt/gadopt/energy_solver.py
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 113 114 115 116 117 118 119 120 121 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 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 |
|
setup_solver()
Sets up timestepper and associated solver, using specified solver parameters
Source code in g-adopt/gadopt/energy_solver.py
178 179 180 181 182 183 184 185 186 187 188 189 |
|
solve(t=0, update_forcings=None)
Advances solver in time.
Source code in g-adopt/gadopt/energy_solver.py
191 192 193 194 195 |
|