Nullspaces
nullspaces
Helper functions to generate null spaces for Stokes problems
ala_right_nullspace
computes the pressure null space for the Anelastic Liquid
Approximation. create_stokes_nullspace
, automatically generates null spaces
for the mixed velocity-pressure Stokes system. `rigid_body_modes' returns the
translational and rotational null spaces associated with the velocity
(or displacement) field.
ala_right_nullspace(W, approximation, top_subdomain_id)
Compute pressure null space for Anelastic Liquid Approximation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
W
|
WithGeometry
|
pressure function space |
required |
approximation
|
AnelasticLiquidApproximation
|
AnelasticLiquidApproximation with equation parameters |
required |
top_subdomain_id
|
str | int
|
boundary id of top surface |
required |
Returns:
Type | Description |
---|---|
pressure null space solution |
To obtain the pressure null space solution for the Stokes equation in Anelastic Liquid Approximation, which includes a pressure-dependent buoyancy term, we try to solve the equation:
Taking the divergence:
then testing it with q:
followed by integration by parts:
This elliptic equation can be solved with natural boundary conditions by imposing our original equation above, which eliminates all boundary terms:
However, if we do so on all boundaries we end up with a system that has the same null space, as the one we are after (note that we ended up merely testing the original equation with \(nabla q\)). Instead we use the fact that the gradient of the null mode is always vertical, and thus the null mode is constant at any horizontal level (geoid), specifically the top surface. Choosing any nonzero constant for this surface fixes the arbitrary scalar multiplier of the null mode. We choose the value of one and apply it as a Dirichlet boundary condition.
Note that this procedure does not necessarily compute the exact null space of the discretised Stokes system. In particular, since not every test function \(v in V\), the velocity test space, can be written as \(v=nabla q\) with \(q in W\), the pressure test space, the two terms do not necessarily exactly cancel when tested with \(v\) instead of \(nabla q\) as in our final equation. However, in practice the discrete error appears to be small enough, and providing this null space gives an improved convergence of the iterative Stokes solver.
Source code in g-adopt/gadopt/nullspaces.py
15 16 17 18 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 54 55 56 57 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
create_stokes_nullspace(Z, closed=True, rotational=False, translations=None, ala_approximation=None, top_subdomain_id=None)
Create a null space for the mixed Stokes system.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
Z
|
WithGeometry
|
Firedrake mixed function space associated with the Stokes system |
required |
closed
|
bool
|
Whether to include a constant pressure null space |
True
|
rotational
|
bool
|
Whether to include all rotational modes |
False
|
translations
|
list[int] | None
|
List of translations to include i.e for all components in 2D: [0, 1] and 3D: [0, 1, 2]. For example, see 3d_cartesian.py and 3d_spherical.py mantle convection demos. |
None
|
ala_approximation
|
AnelasticLiquidApproximation | None
|
AnelasticLiquidApproximation for calculating (non-constant) right null space |
None
|
top_subdomain_id
|
str | int | None
|
Boundary id of top surface. Required when providing ala_approximation. |
None
|
Returns:
Type | Description |
---|---|
MixedVectorSpaceBasis
|
A Firedrake mixed vector space basis incorporating the null space components |
Source code in g-adopt/gadopt/nullspaces.py
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 |
|
rigid_body_modes(V, rotational=False, translations=None)
Create a null space for the rigid body modes associated with velocity (or displacement) in a Stokes system
Parameters:
Name | Type | Description | Default |
---|---|---|---|
V
|
WithGeometry
|
Firedrake function space associated with the velocity or displacement |
required |
rotational
|
bool
|
Whether to include all rotational modes |
False
|
translations
|
list[int] | None
|
List of translations to include i.e for all components in 2D: [0, 1] and 3D: [0, 1, 2]. For example, see 3d_cartesian.py and 3d_spherical.py mantle convection demos. |
None
|
Returns:
Type | Description |
---|---|
VectorSpaceBasis
|
A Firedrake vector space basis incorporating the null space components |
Source code in g-adopt/gadopt/nullspaces.py
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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|