You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Anistropic voxels are sometimes used for datasets. It would be useful for OpenImpala to be able to solve on these non-cubic fields. This would require the re-writing part of the cell flux kernal to allow for different sized walls.
Update on Anisotropic Grid Support in TortuosityHypre
(Status as of 2025-04-24)
This update summarizes the current status and required work to fully support non-cubic voxels (anisotropic grids where dx, dy, dz cell dimensions may differ) within the TortuosityHypre class.
Current Status:
✅ Matrix Setup: The C++ code (setupMatrixEquation) correctly retrieves grid spacings (dx, dy, dz) from the amrex::Geometry object. It calculates the necessary dxinv_sq ($[1/dx^2, 1/dy^2, 1/dz^2]$) array and correctly passes it to the Fortran kernel tortuosity_fillmtx. The Fortran kernel, in turn, correctly utilizes dxinv_sq to assemble the anisotropic Laplacian matrix (A) and RHS (b) for the HYPRE solver.
Required Updates / TODO:
The primary remaining task is to modify the post-processing calculations performed after the potential field ($\phi$) is solved by HYPRE. These calculations currently might implicitly assume cubic voxels. They need explicit handling of potentially different dx, dy, dz:
Gradient Calculation ($\nabla \phi$):
Ensure all finite difference formulas for gradient components explicitly use the correct spacing (dx, dy, or dz) in the denominator based on the derivative direction (e.g., (phi[i+1] - phi[i-1]) / (2*dx)).
Flux Calculation & Integration:
Physical flux density calculations ($J = -\sigma \nabla \phi$) rely on the correctly calculated gradient.
Calculating total flux through faces requires multiplying the normal flux density component by the correct face area:
X-face area: dy * dz
Y-face area: dx * dz
Z-face area: dx * dy
This is crucial for functions like global_fluxes().
Averaging / Normalization:
Volume averages or integrations must use the correct voxel volume: V = dx * dy * dz.
Calculations involving the physical length of the domain must use the appropriate dimension multiplied by the number of cells (e.g., total X-length Lx = Nx * dx).
Key Affected Functions:
global_fluxes() (requires correct gradients and face areas).
value() (requires correct normalization, potentially using results from global_fluxes or performing its own averaging).
Any other internal helper functions involved in these post-processing steps.
Next Steps:
Audit the C++ code, focusing on global_fluxes(), value(), and related functions, to identify all locations performing the calculations listed above.
Modify these calculations to explicitly use dx, dy, and dz obtained from the m_geom object.
Develop and add test cases specifically using anisotropic grids to validate the implementation.
Resolved in #304 and shipped in v4.6.0: non-cubic / anisotropic voxel spacing (dx, dy, dz) is now supported end-to-end across C++ (TortuosityHypre, TortuosityMLMG, EffectiveDiffusivityHypre, SpecificSurfaceArea), Python (voxel_size=(dz, dy, dx)), the pure-Python fallback solver, and the CLI (--voxel-size DX DY DZ).
Activity
jameslehoux commentedon Feb 27, 2026
Update on Anisotropic Grid Support in
TortuosityHypre(Status as of 2025-04-24)
This update summarizes the current status and required work to fully support non-cubic voxels (anisotropic grids where
dx,dy,dzcell dimensions may differ) within theTortuosityHypreclass.Current Status:
setupMatrixEquation) correctly retrieves grid spacings (dx,dy,dz) from theamrex::Geometryobject. It calculates the necessarydxinv_sq(tortuosity_fillmtx. The Fortran kernel, in turn, correctly utilizesdxinv_sqto assemble the anisotropic Laplacian matrix (A) and RHS (b) for the HYPRE solver.Required Updates / TODO:
The primary remaining task is to modify the post-processing calculations performed after the potential field ($\phi$ ) is solved by HYPRE. These calculations currently might implicitly assume cubic voxels. They need explicit handling of potentially different
dx,dy,dz:dx,dy, ordz) in the denominator based on the derivative direction (e.g.,(phi[i+1] - phi[i-1]) / (2*dx)).dy * dzdx * dzdx * dyglobal_fluxes().V = dx * dy * dz.Lx = Nx * dx).global_fluxes()(requires correct gradients and face areas).value()(requires correct normalization, potentially using results fromglobal_fluxesor performing its own averaging).Next Steps:
global_fluxes(),value(), and related functions, to identify all locations performing the calculations listed above.dx,dy, anddzobtained from them_geomobject.jameslehoux commentedon Nov 17, 2026
Resolved in #304 and shipped in v4.6.0: non-cubic / anisotropic voxel spacing (
dx, dy, dz) is now supported end-to-end across C++ (TortuosityHypre,TortuosityMLMG,EffectiveDiffusivityHypre,SpecificSurfaceArea), Python (voxel_size=(dz, dy, dx)), the pure-Python fallback solver, and the CLI (--voxel-size DX DY DZ).