Examples¶
The voids.examples sub-package provides deterministic synthetic networks and
images intended for testing, documentation, and reproducible demonstrations.
Demo Networks¶
voids.examples.demo
¶
make_linear_chain_network
¶
make_linear_chain_network(
num_pores=3,
*,
axis="x",
length=1.0,
cross_section=1.0,
bulk_volume=10.0,
pore_volume=1.0,
throat_volume=0.5,
throat_length=1.0,
hydraulic_conductance=1.0,
)
Build a deterministic one-dimensional pore-throat chain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_pores
|
int
|
Number of pores in the chain. The number of throats is
|
3
|
axis
|
str
|
Axis along which the chain is embedded. |
'x'
|
length
|
float
|
Sample length along the chosen axis. |
1.0
|
cross_section
|
float
|
Cross-sectional area normal to the flow axis. |
1.0
|
bulk_volume
|
float
|
Bulk sample volume associated with the toy problem. |
10.0
|
pore_volume
|
float
|
Synthetic pore and throat void volumes. |
1.0
|
throat_volume
|
float
|
Synthetic pore and throat void volumes. |
1.0
|
throat_length
|
float
|
Length assigned to each throat. |
1.0
|
hydraulic_conductance
|
float
|
Precomputed throat hydraulic conductance. |
1.0
|
Returns:
| Type | Description |
|---|---|
Network
|
Synthetic line network with canonical inlet and outlet labels. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the number of pores, axis, or geometric parameters are invalid. |
Notes
The pore coordinates are uniformly spaced so that the pore positions satisfy
x_k = k * length / (num_pores - 1)
along the selected axis. The function is intended for solver smoke tests, tutorials, and regression examples rather than realistic porous-media reconstruction.
Source code in src/voids/examples/demo.py
13 14 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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
Manufactured Void Images¶
voids.examples.manufactured
¶
make_manufactured_void_image
¶
Create a deterministic synthetic 3-D void-space image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
tuple[int, int, int]
|
Output image shape in voxels. |
(48, 48, 48)
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Boolean array with shape |
Notes
The construction is intentionally simple: a chain of overlapping spheres
spans the x-direction, while a few side branches create off-axis
connectivity. The result is not intended as a geological model. It is a
manufactured test image for extraction workflows such as porespy.snow2.
Source code in src/voids/examples/manufactured.py
save_default_manufactured_void_image
¶
Write the manufactured void image to a NumPy .npy file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Destination file path. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Resolved path that was written. |
Source code in src/voids/examples/manufactured.py
Mesh Networks¶
voids.examples.mesh
¶
make_cartesian_mesh_network
¶
make_cartesian_mesh_network(
shape,
*,
spacing=1.0,
pore_radius=None,
throat_radius=None,
thickness=None,
units=None,
)
Build a regular mesh-like pore network with one pore per mesh node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
Number of pores along each active axis. Typical examples are |
required |
spacing
|
float
|
Center-to-center pore spacing. |
1.0
|
pore_radius
|
float | None
|
Synthetic geometric radii used to construct pore and throat attributes. |
None
|
throat_radius
|
float | None
|
Synthetic geometric radii used to construct pore and throat attributes. |
None
|
thickness
|
float | None
|
Extrusion thickness for 2-D meshes. Ignored for 3-D meshes. |
None
|
units
|
dict[str, str] | None
|
Optional unit metadata stored in :class: |
None
|
Returns:
| Type | Description |
|---|---|
Network
|
Synthetic Cartesian lattice network with geometry, labels, and sample metadata. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the shape, spacing, or geometric radii are invalid. |
Notes
Each mesh node becomes one pore, and each nearest-neighbor pair becomes one throat. The resulting graph is a regular square or cubic lattice. For the current synthetic geometry model, the throat core length is
L_core = spacing - 2 * pore_radius
and the throat volume is approximated as
V_throat = A_throat * L_core.
This makes the example useful for solver verification and scaling studies, while remaining intentionally simpler than an image-derived pore network.
Source code in src/voids/examples/mesh.py
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 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 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 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
FEM Manufactured Solutions¶
The mathematical definitions, convergence procedure, and interpretation caveats are documented in FEM Manufactured-Solution Verification.
voids.examples.mms
¶
Manufactured Brinkman solutions and finite-element convergence studies.
BrinkmanMMSCase
dataclass
¶
Exact solution data for a manufactured Brinkman problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Stable case identifier. |
required |
dimension
|
Literal[2, 3]
|
Spatial dimension, either 2 or 3. |
required |
viscosity
|
float
|
Constant Brinkman diffusion coefficient :math: |
required |
reaction
|
float
|
Constant Darcy reaction coefficient :math: |
required |
exact_solution_factory
|
MMSExactSolutionFactory
|
Callable receiving the imported |
required |
point_evaluator
|
MMSPointEvaluator | None
|
Optional NumPy evaluator for plotting. It receives coordinates with
shape |
None
|
description
|
str
|
Concise provenance suitable for notebook and metadata reporting. |
''
|
reference
|
str
|
Concise provenance suitable for notebook and metadata reporting. |
''
|
Notes
The convergence runner imposes the exact velocity on the complete boundary and compares pressure modulo an additive constant.
Source code in src/voids/examples/mms/_core.py
ufl_solution
¶
Return exact velocity and pressure UFL expressions on domain.
evaluate
¶
Evaluate the exact fields at NumPy coordinates for plotting.
Source code in src/voids/examples/mms/_core.py
ConvergenceExpectation
dataclass
¶
Nominal smooth-solution orders used by an MMS method check.
Source code in src/voids/examples/mms/_core.py
as_dict
¶
Return expected orders keyed by error metric.
MMSConvergenceLevel
dataclass
¶
Errors and observed pairwise rates for one structured mesh level.
Source code in src/voids/examples/mms/_core.py
errors
¶
Return the four reported errors as a metric mapping.
Source code in src/voids/examples/mms/_core.py
as_dict
¶
Return a row suitable for a table or CSV writer.
Source code in src/voids/examples/mms/_core.py
MMSConvergenceResult
dataclass
¶
Complete manufactured-solution refinement study.
Source code in src/voids/examples/mms/_core.py
as_dicts
¶
assert_expected_rates
¶
Raise if a finest-pair rate is below its nominal smooth rate.
This is an asymptotic diagnostic, not a proof of convergence. Coarse meshes, boundary layers, algebraic solver error, or insufficient quadrature can all make a correct discretization fail this check.
Source code in src/voids/examples/mms/_core.py
MMSDiscreteSolution
dataclass
¶
MMSPresentationReference
dataclass
¶
Exact configuration and reported values for one MMS presentation row.
Source code in src/voids/examples/mms/replication.py
MMSPresentationRun
dataclass
¶
Live MMS refinement result paired with its baseline comparison.
Source code in src/voids/examples/mms/replication.py
PresentationComparison
dataclass
¶
Comparison of one live solve with a supplied presentation baseline.
Source code in src/voids/examples/mms/replication.py
as_dicts
¶
assert_matches
¶
Raise when any reported scalar falls outside its tolerance.
Source code in src/voids/examples/mms/replication.py
ReferenceComparison
dataclass
¶
Observed-versus-reported comparison for one scalar quantity.
Source code in src/voids/examples/mms/replication.py
as_dict
¶
Return a table-ready representation.
Source code in src/voids/examples/mms/replication.py
ReferenceQuantity
dataclass
¶
One reported scalar value and its replication tolerance.
Source code in src/voids/examples/mms/replication.py
VugPresentationReference
dataclass
¶
Configuration and reported flux for a centered-vug presentation row.
Source code in src/voids/examples/mms/replication.py
VugPresentationRun
dataclass
¶
Live centered-vug result paired with its baseline comparison.
Source code in src/voids/examples/mms/replication.py
BodyFittedVugMesh
dataclass
¶
DOLFINx mesh and physical tags generated for a centered vug.
Source code in src/voids/examples/mms/vug.py
CenteredVugBenchmark
dataclass
¶
Centered circular/spherical vug benchmark on the unit domain.
The defaults reproduce the documented physical configuration: radius
0.25, matrix drag 1e7, vug drag 1, viscosity 1e-2, and
pressure values 1 and -1. mesh_representation="body_fitted"
uses Gmsh physical cell tags. The "structured" option classifies
coefficient-map cells by their centers and is useful as a portable
representation-sensitivity comparison.
resolution is the number of nominal elements per coordinate direction.
For body-fitted meshes, the Gmsh target size is
sqrt(dimension) / resolution, matching the mesh-size convention used in
the reference vug studies.
Source code in src/voids/examples/mms/vug.py
75 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 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 | |
matrix_nu
property
¶
Return the matrix coefficient multiplying the Brinkman gradient term.
represented_fraction
property
¶
Return the structured cell-volume fraction classified as vug.
analytic_fraction
property
¶
Return the exact circular area or spherical volume fraction.
vug_mask
¶
Return the structured cell-center classification of the vug.
Source code in src/voids/examples/mms/vug.py
make_problem
¶
Build the structured constant-porosity coefficient-map problem.
Source code in src/voids/examples/mms/vug.py
CenteredVugFlowCase2D
dataclass
¶
Physical 2D centered-vug case solved on a body-fitted unit-square mesh.
The continuum domain size is derived from image_shape and
voxel_size_m. Gmsh coordinates are normalized to the unit square for
numerical conditioning; the solver nondimensionalizes the equations and
converts velocity, pressure, flux, and permeability back to SI units.
The Darcy--Brinkman branch follows the layered-domain model: its reaction
coefficient is mu / K_matrix in the matrix and exactly zero in the
vug. vug_permeability_m2 is used only by the Darcy--Darcy branch as a
finite high-permeability closure. It is not an intrinsic permeability
measurement of an open cavity.
Source code in src/voids/examples/mms/vug_flow.py
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 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 | |
side_length_m
property
¶
Return the square side length derived from the image metadata.
radius_fraction
property
¶
Return the circle radius divided by the square side length.
matrix_permeability_m2
property
¶
Return the matrix permeability converted from mD to square metres.
matrix_screening_length_m
property
¶
Return the matrix Brinkman screening length sqrt(K / phi).
permeability_contrast
property
¶
Return the Darcy--Darcy closure contrast K_vug / K_matrix.
base_target_mesh_size_fraction
property
¶
Return the far-field target diameter divided by the side length.
make_benchmark
¶
Return the model-specific nondimensional mesh/coefficient definition.
Source code in src/voids/examples/mms/vug_flow.py
available_mms_methods
¶
face3d_pressure_jump_coefficient
¶
Compute the scalar triangular-face subscale coefficient.
The reference problem is solved with continuous piecewise-linear finite
elements on a uniformly refined right triangle. resolution is the
unit-cube subdivision count, giving representative physical face diameter
sqrt(2) / resolution.
Source code in src/voids/examples/mms/_runner.py
observed_rate
¶
Return the two-level observed order log(e0/e1) / log(h0/h1).
Source code in src/voids/examples/mms/_runner.py
run_mms_convergence
¶
run_mms_convergence(
case,
*,
method="taylor_hood",
resolutions=(4, 8, 16),
options=None,
tau_factor=1.0,
tau_gamma_cap=None,
m_t=1.0 / 3.0,
alpha_edge=1.0,
facet_law="auto",
facet_size_mode="cell_diameter",
face_refinement=24,
keep_solution=True,
callback=None,
)
Run a structured-mesh Brinkman MMS refinement study.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
BrinkmanMMSCase
|
Exact Brinkman solution. The body force is derived automatically. |
required |
method
|
MMSMethod
|
|
'taylor_hood'
|
resolutions
|
Sequence[int]
|
Strictly increasing numbers of subdivisions per coordinate direction.
The reported refinement parameter is |
(4, 8, 16)
|
options
|
FEniCSSolverOptions | None
|
Linear solver controls shared by all levels. |
None
|
tau_factor
|
float
|
USFEM stabilization controls. |
1.0
|
tau_gamma_cap
|
float
|
USFEM stabilization controls. |
1.0
|
m_t
|
float
|
USFEM stabilization controls. |
1.0
|
alpha_edge
|
float
|
USFEM stabilization controls. |
1.0
|
facet_law
|
float
|
USFEM stabilization controls. |
1.0
|
facet_size_mode
|
float
|
USFEM stabilization controls. |
1.0
|
face_refinement
|
float
|
USFEM stabilization controls. |
1.0
|
keep_solution
|
bool
|
Retain the finest DOLFINx velocity and pressure fields for plotting. |
True
|
callback
|
Callable[[MMSConvergenceLevel], None] | None
|
Optional callable invoked after each completed level. |
None
|
Returns:
| Type | Description |
|---|---|
MMSConvergenceResult
|
Errors, pairwise observed rates, nominal expected rates, solver metadata, and optionally the finest fields. |
Source code in src/voids/examples/mms/_runner.py
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | |
boundary_layer_case_2d
¶
Return the two-dimensional Brinkman boundary-layer MMS case.
The unit-square exact solution is
.. math::
u_1 &= y - \frac{\exp((y-1)/\nu)-\exp(-1/\nu)} {1-\exp(-1/\nu)},\\ u_2 &= x - \frac{\exp((x-1)/\nu)-\exp(-1/\nu)} {1-\exp(-1/\nu)},\\ p &= x-y.
It is exactly divergence-free and develops boundary layers at the top and
right boundaries as viscosity decreases.
Source code in src/voids/examples/mms/cases_2d.py
bubble_case_3d
¶
Return a smooth divergence-free three-dimensional Brinkman MMS case.
The velocity is constructed from mixed first derivatives of a polynomial
boundary bubble. It therefore vanishes on the unit-cube boundary and is
divergence-free by cancellation of mixed derivatives. The pressure is
sin(2*pi*x) * sin(pi*y) * sin(pi*z).
Source code in src/voids/examples/mms/cases_3d.py
compare_mms_with_presentation
¶
Compare a live MMS result with the exact supplied configuration and values.
Source code in src/voids/examples/mms/replication.py
compare_vug_with_presentation
¶
Compare a live centered-vug result with the supplied report-scale values.
Source code in src/voids/examples/mms/replication.py
presentation_mms_references
¶
presentation_vug_references
¶
Return the shipped centered-vug presentation-replication profiles.
run_presentation_mms
¶
Run a full supplied MMS mesh sequence and compare its reported values.
Source code in src/voids/examples/mms/replication.py
run_presentation_vug
¶
Run a report-scale body-fitted vug case and compare its reported values.
Source code in src/voids/examples/mms/replication.py
make_body_fitted_centered_vug_mesh
¶
Generate a tagged body-fitted centered-vug mesh with Gmsh.
Source code in src/voids/examples/mms/vug.py
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 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
run_centered_vug_benchmark
¶
run_centered_vug_benchmark(
benchmark,
*,
method="taylor_hood",
options=None,
tau_factor=1.0,
tau_gamma_cap=None,
m_t=1.0 / 3.0,
alpha_edge=1.0,
facet_law=None,
facet_size_mode="facet_measure",
)
Run the pressure-driven centered-vug FEM benchmark.
Body-fitted USFEM defaults to the reaction-diffusion facet law in 2D and
the shifted law in 3D, matching the documented benchmark choices. Pass
facet_law explicitly whenever method-to-method comparisons need one
common stabilization. The default facet size is the physical edge length
in 2D and the square root of facet area in 3D, matching the body-fitted
benchmark implementation. The latter is only a measure-based length, not
an exact triangular-face diameter.
Source code in src/voids/examples/mms/vug.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | |
run_centered_vug_flow_case
¶
Solve one physical centered-vug case with Taylor--Hood P2/P1 fields.
model="darcy_brinkman" uses piecewise Brinkman viscosity
mu/phi_matrix in the matrix and mu in the vug, with reaction
mu/K_matrix in the matrix and zero in the vug.
model="darcy_darcy" omits viscous diffusion, uses the configured finite
vug permeability, and applies residual-based VMS stabilization with
continuous P2 velocity and P1 pressure.
Source code in src/voids/examples/mms/vug_flow.py
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 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 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
Two-dimensional cases¶
voids.examples.mms.cases_2d
¶
boundary_layer_case_2d
¶
Return the two-dimensional Brinkman boundary-layer MMS case.
The unit-square exact solution is
.. math::
u_1 &= y - \frac{\exp((y-1)/\nu)-\exp(-1/\nu)} {1-\exp(-1/\nu)},\\ u_2 &= x - \frac{\exp((x-1)/\nu)-\exp(-1/\nu)} {1-\exp(-1/\nu)},\\ p &= x-y.
It is exactly divergence-free and develops boundary layers at the top and
right boundaries as viscosity decreases.
Source code in src/voids/examples/mms/cases_2d.py
Three-dimensional cases¶
voids.examples.mms.cases_3d
¶
bubble_case_3d
¶
Return a smooth divergence-free three-dimensional Brinkman MMS case.
The velocity is constructed from mixed first derivatives of a polynomial
boundary bubble. It therefore vanishes on the unit-cube boundary and is
divergence-free by cancellation of mixed derivatives. The pressure is
sin(2*pi*x) * sin(pi*y) * sin(pi*z).
Source code in src/voids/examples/mms/cases_3d.py
Centered-vug benchmark¶
voids.examples.mms.vug
¶
CenteredVugBenchmark
dataclass
¶
Centered circular/spherical vug benchmark on the unit domain.
The defaults reproduce the documented physical configuration: radius
0.25, matrix drag 1e7, vug drag 1, viscosity 1e-2, and
pressure values 1 and -1. mesh_representation="body_fitted"
uses Gmsh physical cell tags. The "structured" option classifies
coefficient-map cells by their centers and is useful as a portable
representation-sensitivity comparison.
resolution is the number of nominal elements per coordinate direction.
For body-fitted meshes, the Gmsh target size is
sqrt(dimension) / resolution, matching the mesh-size convention used in
the reference vug studies.
Source code in src/voids/examples/mms/vug.py
75 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 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 | |
matrix_nu
property
¶
Return the matrix coefficient multiplying the Brinkman gradient term.
represented_fraction
property
¶
Return the structured cell-volume fraction classified as vug.
analytic_fraction
property
¶
Return the exact circular area or spherical volume fraction.
vug_mask
¶
Return the structured cell-center classification of the vug.
Source code in src/voids/examples/mms/vug.py
make_problem
¶
Build the structured constant-porosity coefficient-map problem.
Source code in src/voids/examples/mms/vug.py
BodyFittedVugMesh
dataclass
¶
DOLFINx mesh and physical tags generated for a centered vug.
Source code in src/voids/examples/mms/vug.py
make_body_fitted_centered_vug_mesh
¶
Generate a tagged body-fitted centered-vug mesh with Gmsh.
Source code in src/voids/examples/mms/vug.py
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 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
run_centered_vug_benchmark
¶
run_centered_vug_benchmark(
benchmark,
*,
method="taylor_hood",
options=None,
tau_factor=1.0,
tau_gamma_cap=None,
m_t=1.0 / 3.0,
alpha_edge=1.0,
facet_law=None,
facet_size_mode="facet_measure",
)
Run the pressure-driven centered-vug FEM benchmark.
Body-fitted USFEM defaults to the reaction-diffusion facet law in 2D and
the shifted law in 3D, matching the documented benchmark choices. Pass
facet_law explicitly whenever method-to-method comparisons need one
common stabilization. The default facet size is the physical edge length
in 2D and the square root of facet area in 3D, matching the body-fitted
benchmark implementation. The latter is only a measure-based length, not
an exact triangular-face diameter.
Source code in src/voids/examples/mms/vug.py
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | |
Physical centered-vug flow family¶
voids.examples.mms.vug_flow
¶
CenteredVugFlowCase2D
dataclass
¶
Physical 2D centered-vug case solved on a body-fitted unit-square mesh.
The continuum domain size is derived from image_shape and
voxel_size_m. Gmsh coordinates are normalized to the unit square for
numerical conditioning; the solver nondimensionalizes the equations and
converts velocity, pressure, flux, and permeability back to SI units.
The Darcy--Brinkman branch follows the layered-domain model: its reaction
coefficient is mu / K_matrix in the matrix and exactly zero in the
vug. vug_permeability_m2 is used only by the Darcy--Darcy branch as a
finite high-permeability closure. It is not an intrinsic permeability
measurement of an open cavity.
Source code in src/voids/examples/mms/vug_flow.py
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 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 | |
side_length_m
property
¶
Return the square side length derived from the image metadata.
radius_fraction
property
¶
Return the circle radius divided by the square side length.
matrix_permeability_m2
property
¶
Return the matrix permeability converted from mD to square metres.
matrix_screening_length_m
property
¶
Return the matrix Brinkman screening length sqrt(K / phi).
permeability_contrast
property
¶
Return the Darcy--Darcy closure contrast K_vug / K_matrix.
base_target_mesh_size_fraction
property
¶
Return the far-field target diameter divided by the side length.
make_benchmark
¶
Return the model-specific nondimensional mesh/coefficient definition.
Source code in src/voids/examples/mms/vug_flow.py
run_centered_vug_flow_case
¶
Solve one physical centered-vug case with Taylor--Hood P2/P1 fields.
model="darcy_brinkman" uses piecewise Brinkman viscosity
mu/phi_matrix in the matrix and mu in the vug, with reaction
mu/K_matrix in the matrix and zero in the vug.
model="darcy_darcy" omits viscous diffusion, uses the configured finite
vug permeability, and applies residual-based VMS stabilization with
continuous P2 velocity and P1 pressure.
Source code in src/voids/examples/mms/vug_flow.py
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 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 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
Presentation-replication profiles¶
voids.examples.mms.replication
¶
ReferenceQuantity
dataclass
¶
One reported scalar value and its replication tolerance.
Source code in src/voids/examples/mms/replication.py
ReferenceComparison
dataclass
¶
Observed-versus-reported comparison for one scalar quantity.
Source code in src/voids/examples/mms/replication.py
as_dict
¶
Return a table-ready representation.
Source code in src/voids/examples/mms/replication.py
PresentationComparison
dataclass
¶
Comparison of one live solve with a supplied presentation baseline.
Source code in src/voids/examples/mms/replication.py
as_dicts
¶
assert_matches
¶
Raise when any reported scalar falls outside its tolerance.
Source code in src/voids/examples/mms/replication.py
MMSPresentationReference
dataclass
¶
Exact configuration and reported values for one MMS presentation row.
Source code in src/voids/examples/mms/replication.py
VugPresentationReference
dataclass
¶
Configuration and reported flux for a centered-vug presentation row.
Source code in src/voids/examples/mms/replication.py
MMSPresentationRun
dataclass
¶
Live MMS refinement result paired with its baseline comparison.
Source code in src/voids/examples/mms/replication.py
VugPresentationRun
dataclass
¶
Live centered-vug result paired with its baseline comparison.
Source code in src/voids/examples/mms/replication.py
presentation_mms_references
¶
presentation_vug_references
¶
Return the shipped centered-vug presentation-replication profiles.
compare_mms_with_presentation
¶
Compare a live MMS result with the exact supplied configuration and values.
Source code in src/voids/examples/mms/replication.py
compare_vug_with_presentation
¶
Compare a live centered-vug result with the supplied report-scale values.
Source code in src/voids/examples/mms/replication.py
run_presentation_mms
¶
Run a full supplied MMS mesh sequence and compare its reported values.
Source code in src/voids/examples/mms/replication.py
run_presentation_vug
¶
Run a report-scale body-fitted vug case and compare its reported values.