Skip to content

Nodal Vector Poisson solver with EB - #548

Closed
prkkumar-he wants to merge 17 commits into
AMReX-Codes:developmentfrom
Helion-Energy:nodal_fd_lap
Closed

Nodal Vector Poisson solver with EB#548
prkkumar-he wants to merge 17 commits into
AMReX-Codes:developmentfrom
Helion-Energy:nodal_fd_lap

Conversation

@prkkumar-he

@prkkumar-he prkkumar-he commented Mar 18, 2026

Copy link
Copy Markdown

This PR adds vector Poisson solver in pyamrex. Works with and without EB in 1D, 2D, 3D cartesian as well RZ geometries.

Cell-centered solver uses MLABecLaplacian
Nodal uses MLEBNodeFDLaplacian

Our primary use case is with nodal solver with EB. If it is useful for others, let's consider merging. @atmyers @WeiqunZhang

Tested with manufactured solutions, first without EB: Perfect 2nd order convergence.
Test script: tests/test_vector_poisson_solver_rz.py

image image

Tested with EB: Order of convergence goes below 2 as expected.
Test script: tests/test_vector_poisson_rz_EB.py
image

Prabhat Kumar and others added 10 commits November 6, 2025 13:30
Signed-off-by: S. Eric Clark <25495882+clarkse@users.noreply.github.com>
Signed-off-by: S. Eric Clark <25495882+clarkse@users.noreply.github.com>
Signed-off-by: S. Eric Clark <245461744+clarkse-he@users.noreply.github.com>
Signed-off-by: S. Eric Clark <245461744+clarkse-he@users.noreply.github.com>
@prkkumar-he prkkumar-he changed the title Nodal fd lap Nodal Vector Poisson solver with EB Mar 18, 2026
clarkse-he and others added 2 commits March 23, 2026 18:40
…nitizlize EB.

Signed-off-by: S. Eric Clark <245461744+clarkse-he@users.noreply.github.com>
@prkkumar-he prkkumar-he reopened this Mar 24, 2026
clarkse-he and others added 2 commits March 26, 2026 02:05
Signed-off-by: S. Eric Clark <245461744+clarkse-he@users.noreply.github.com>
@ax3l ax3l added the enhancement New feature or request label Jun 3, 2026
@ax3l

ax3l commented Jun 3, 2026

Copy link
Copy Markdown
Member

@prkkumar-he please excuse the slowness, lots of proposals in the last 2 months...

I tried to help here and push directly to the branch, but it seems I lack permissions.
Since the pre-commit also could not push its correction, I suspect it is a repo setting in the fork.

Will continue the branch in #577 for now :)

Comment on lines +1 to +5
#!/usr/bin/env python3
"""Test VectorPoissonSolverNodal in 2D RZ — A_theta convergence study.

Manufactured solution: A_theta = r * sin(pi*r) * sin(pi*z) on [0,1]^2.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if this was integrated in our pytest suite. Please add a def test_... entry point function.

Comment on lines +1 to +5
#!/usr/bin/env python3

"""
Self-convergence test: VectorPoissonSolverNodal with EB in 2D RZ.
=================================================================

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if this was integrated in our pytest suite. Please add a def test_... entry point function.

Comment on lines +1 to +2
#ifndef VECTOR_POISSON_SOLVER_NODAL_H
#define VECTOR_POISSON_SOLVER_NODAL_H

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would probably prefix with PYAMREX_ to be sure it is long-term stable.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/VectorPoisson/VectorPoissonSolver.H Outdated
Comment on lines +1 to +2
#ifndef VECTOR_POISSON_SOLVER_3D_H
#define VECTOR_POISSON_SOLVER_3D_H

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would probably prefix with PYAMREX_ to be sure it is long-term stable.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/VectorPoisson/PyVectorPoisson.H Outdated
Comment on lines +1 to +2
#ifndef PY_VECTOR_POISSON_H
#define PY_VECTOR_POISSON_H

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would probably prefix with PYAMREX_ to be sure it is long-term stable.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/VectorPoisson/CMakeLists.txt Outdated
Comment on lines +3 to +9
foreach(_dim 1 2 3)
set(_target pyAMReX_${_dim}d)
if(TARGET ${_target})
target_sources(${_target}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/VectorPoissonSolver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/VectorPoissonSolverNodal.cpp

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern we use in all other files is

foreach(D IN LISTS AMReX_SPACEDIM)

and no need to prefix with CMAKE_CURRENT_SOURCE_DIR

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

amrex::Real inv_dr;
amrex::Real inv_dz;

AMREX_GPU_DEVICE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs host-device annotation

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@prkkumar-he

Copy link
Copy Markdown
Author

@prkkumar-he please excuse the slowness, lots of proposals in the last 2 months...

I tried to help here and push directly to the branch, but it seems I lack permissions. Since the pre-commit also could not push its correction, I suspect it is a repo setting in the fork.

Will continue the branch in #577 for now :)

No worries! Thanks for reviewing :) will address your comments shortly

@prkkumar-he

Copy link
Copy Markdown
Author

Update: I went through #577 and see you've already handled all the review points there. So we can close this in favor of #577. Thanks again!

@ax3l ax3l closed this Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants