Geometry Helpers¶
The voids.geom sub-package provides functions for normalizing characteristic pore
and throat sizes and computing hydraulic conductances.
Characteristic Size¶
voids.geom.characteristic
¶
area_equivalent_diameter
¶
Return the circular-equivalent diameter associated with an area array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
area
|
ndarray
|
Cross-sectional area array. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Diameter defined by |
Source code in src/voids/geom/characteristic.py
normalize_characteristic_size
¶
Normalize a size-like field to a characteristic diameter surrogate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
ndarray
|
Raw size-like field values. |
required |
field_name
|
str | None
|
Source field name, used to convert radii and areas to diameters. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Characteristic-size array interpreted as a diameter-like quantity. |
Source code in src/voids/geom/characteristic.py
characteristic_size
¶
Return a preferred characteristic size array from a pore/throat store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store
|
Mapping[str, object]
|
Mapping such as |
required |
expected_shape
|
tuple[int, ...] | None
|
Optional expected array shape. |
None
|
fields
|
tuple[str, ...]
|
Ordered field priority. The default is
|
_CHARACTERISTIC_SIZE_FIELDS
|
Returns:
| Type | Description |
|---|---|
tuple
|
Pair |
Raises:
| Type | Description |
|---|---|
KeyError
|
If none of the requested fields exists. |
ValueError
|
If a selected field does not match |
Source code in src/voids/geom/characteristic.py
Hydraulic Geometry¶
voids.geom.hydraulic
¶
generic_poiseuille_conductance
¶
Compute throat conductance using a circular Poiseuille approximation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
net
|
Network
|
Network containing throat geometry or precomputed hydraulic conductance. |
required |
viscosity
|
float | ndarray | None
|
Dynamic viscosity. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Conductance array for all throats. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If viscosity is non-positive or if precomputed conductance is negative. |
KeyError
|
If required geometry is missing. |
Notes
When no precomputed conductance is supplied, the model uses
g = pi * r**4 / (8 * mu * L)
with radius inferred from either throat.diameter_inscribed or
throat.area.
Source code in src/voids/geom/hydraulic.py
valvatne_blunt_throat_conductance
¶
Compute shape-aware throat conductance using throat geometry only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
net
|
Network
|
Network containing throat length and cross-sectional geometry. |
required |
viscosity
|
float | ndarray | None
|
Dynamic viscosity. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Shape-aware throat conductance array. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If viscosity is not positive. |
KeyError
|
If required throat geometry is unavailable. |
Source code in src/voids/geom/hydraulic.py
valvatne_blunt_conductance
¶
Compute a shape-factor-aware single-phase conductance following Valvatne-Blunt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
net
|
Network
|
Network containing throat and, ideally, pore geometry. |
required |
viscosity
|
float | ndarray | None
|
Dynamic viscosity. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Throat conductance array. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If viscosity is not positive. |
Notes
This implements the single-phase geometric closure used in the Imperial College Valvatne-Blunt style network model:
- segment conductance is evaluated as
g = k * G * A**2 / (mu * L) k = 3/5for triangular ductsk = 0.5623for square ductsk = 1/2for circular ducts
The selection logic is:
- If
throat.hydraulic_conductanceis explicitly present, return it. - Else, if conduit lengths and pore/throat shape data are available, compute a harmonic pore1-core-pore2 conductance.
- Else, if throat-only shape data are available, use a throat-only model.
- Else, warn and fall back to circular Poiseuille conductance.
This is still a single-phase closure; corner films and multiphase occupancy are intentionally out of scope here.
Source code in src/voids/geom/hydraulic.py
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | |
valvatne_blunt_baseline_conductance
¶
valvatne_blunt_baseline_conductance(
net,
viscosity,
*,
pore_viscosity=None,
throat_viscosity=None,
)
Backward-compatible alias for :func:valvatne_blunt_conductance.
Source code in src/voids/geom/hydraulic.py
available_conductance_models
¶
Return the names of built-in hydraulic conductance models.
Returns:
| Type | Description |
|---|---|
tuple of str
|
Available model names. |
Source code in src/voids/geom/hydraulic.py
throat_conductance
¶
throat_conductance(
net,
viscosity,
model="generic_poiseuille",
*,
pore_viscosity=None,
throat_viscosity=None,
)
Dispatch to a throat hydraulic conductance model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
net
|
Network
|
Network containing the required geometry. |
required |
viscosity
|
float | ndarray | None
|
Dynamic viscosity. |
required |
model
|
str
|
Conductance model name. |
'generic_poiseuille'
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Throat conductance array. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/voids/geom/hydraulic.py
throat_conductance_with_sensitivities
¶
throat_conductance_with_sensitivities(
net,
viscosity,
model="generic_poiseuille",
*,
pore_viscosity=None,
throat_viscosity=None,
pore_dviscosity_dpressure=None,
throat_dviscosity_dpressure=None,
)
Return throat conductance and endpoint pressure sensitivities.
Notes
The returned arrays are (g, dg_dpi, dg_dpj) where i and j are
the pore indices in net.throat_conns[:, 0] and net.throat_conns[:, 1].
Source code in src/voids/geom/hydraulic.py
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | |