Equations
equations
Generates the UFL form for an equation consisting of individual terms.
This module contains a dataclass to define the structure of mathematical equations within the G-ADOPT library. It provides a convenient way to generate the UFL form required by Firedrake solvers.
Equation(test, trial_space, residual_terms, *, eq_attrs={}, approximation=None, bcs=dict(), quad_degree=None, scaling_factor=1)
dataclass
Generates the UFL form for the sum of terms constituting an equation.
The generated UFL form corresponds to a sum of implemented term forms contributing to the equation's residual in the finite element discretisation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test
|
Argument | Indexed
|
Firedrake test function. |
required |
trial_space
|
WithGeometry
|
Firedrake function space of the trial function. |
required |
residual_terms
|
InitVar[Callable | list[Callable]]
|
Equation term or a list thereof contributing to the residual. |
required |
eq_attrs
|
InitVar[dict[str, Any]]
|
Dictionary of fields and parameters used in the equation's weak form. |
{}
|
approximation
|
BaseApproximation | BaseGIAApproximation | None
|
G-ADOPT approximation for the system of equations considered. |
None
|
bcs
|
dict[int, dict[str, Any]]
|
Dictionary specifying weak boundary conditions (identifier, type, and value). |
dict()
|
quad_degree
|
InitVar[int | None]
|
Integer specifying the quadrature degree. If omitted, it is set to |
None
|
scaling_factor
|
Number | Constant
|
A constant factor used to rescale residual terms. |
1
|
residual(trial)
Generates the UFL form corresponding to the residual terms.
Source code in g-adopt/gadopt/equations.py
113 114 115 116 117 | |
cell_edge_integral_ratio(mesh, p)
Ratio C such that \int_f u^2 <= C Area(f)/Volume(e) \int_e u^2 for facets f, elements e, and polynomials u of degree p.
See Equation (3.7), Table 3.1, and Appendix C from Hillewaert's thesis: https://www.researchgate.net/publication/260085826
Source code in g-adopt/gadopt/equations.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
interior_penalty_factor(eq, *, shift=0)
Interior Penalty method
For details on the choice of sigma, see https://www.researchgate.net/publication/260085826
We use Equations (3.20) and (3.23). Instead of getting the maximum over two adjacent cells (+ and -), we just sum (i.e. 2 * avg) and have an extra 0.5 for internal facets.
Source code in g-adopt/gadopt/equations.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |