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, *, mass_term=None, eq_attrs={}, approximation=None, bcs=dict(), quad_degree=None, rescale_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]]
|
List of equation terms contributing to the residual. |
required |
mass_term |
Optional[Callable]
|
Callable returning the equation's mass term. |
None
|
eq_attrs |
InitVar[dict[str, Any]]
|
Dictionary of fields and parameters used in the equation's weak form. |
{}
|
approximation |
Optional[BaseApproximation]
|
G-ADOPT approximation for the system of equations considered. |
None
|
bcs |
dict[int, dict[str, Any]]
|
Dictionary of identifier-value pairs specifying weak boundary conditions. |
dict()
|
quad_degree |
InitVar[Optional[int]]
|
Integer specifying the quadrature degree. If omitted, it is set to |
None
|
rescale_factor |
Number | Constant | Function
|
UFL expression used to rescale mass and residual terms. |
1
|
mass(trial)
Generates the UFL form corresponding to the mass term.
Source code in g-adopt/gadopt/equations.py
114 115 116 117 118 119 |
|
residual(trial)
Generates the UFL form corresponding to the residual terms.
Source code in g-adopt/gadopt/equations.py
121 122 123 124 125 126 127 128 |
|
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
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
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 for internal facets.
Source code in g-adopt/gadopt/equations.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|