Limiter
limiter
This module provides a class that implements limiting of functions defined on
discontinuous function spaces. Users instantiate the class by providing relevant
parameters and call the apply
method to update the function.
VertexBasedP1DGLimiter(p1dg_space, clip_min=None, clip_max=None)
Bases: VertexBasedLimiter
Vertex-based limiter for P1DG tracer fields (Kuzmin, 2010).
Kuzmin, D. (2010). A vertex-based hierarchical slope limiter for p-adaptive discontinuous Galerkin methods. Journal of computational and applied mathematics, 233(12), 3077-3085.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p1dg_space |
WithGeometry
|
UFL P1DG function space |
required |
clip_min |
Optional[float]
|
Minimal threshold to apply |
None
|
clip_max |
Optional[float]
|
Maximal threshold to apply |
None
|
Source code in g-adopt/gadopt/limiter.py
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 |
|
compute_bounds(field)
Re-computes min/max values of all neighbouring centroids.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
Function
|
Firedrake function onto which the limiter is applied |
required |
Source code in g-adopt/gadopt/limiter.py
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 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
|
apply(field)
Applies the limiter on the given field (in place).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
Firedrake function onto which the limiter is applied |
required |
Source code in g-adopt/gadopt/limiter.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
assert_function_space(fs, family, degree)
Checks the family and degree of the function space.
If the function space lies on an extruded mesh, checks both spaces of the outer product.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fs |
WithGeometry
|
UFL function space |
required |
family |
str | list[str]
|
Name or names of the expected element families |
required |
degree |
int
|
Expected polynomial degree of the function space |
required |
Raises:
Type | Description |
---|---|
AssertionError
|
The family and/or degree of the function space don't match the expected values |
Source code in g-adopt/gadopt/limiter.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
get_extruded_base_element(ufl_element)
Gets the base element from an extruded element.
In case of a non-extruded mesh, returns the element itself.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ufl_element |
FiniteElement
|
UFL element from which to extract the base element |
required |
Returns:
Type | Description |
---|---|
FiniteElement
|
The base element, or the provided element for a non-extruded mesh. |
Source code in g-adopt/gadopt/limiter.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
get_facet_mask(function_space, facet='bottom')
The meaning of top/bottom depends on the extrusion's direction. Here, we assume that the mesh has been extruded upwards (along the positive z axis).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function_space |
WithGeometry
|
UFL function space |
required |
facet |
str
|
String specifying the facet ("bottom" or "top") |
'bottom'
|
Returns:
Type | Description |
---|---|
ndarray
|
The top/bottom nodes of extruded 3D elements. |
Raises:
Type | Description |
---|---|
AssertionError
|
The function space is not defined on an extruded mesh |
Source code in g-adopt/gadopt/limiter.py
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 |
|