Skip to content

Commit

Permalink
add afterBfieldpush callback
Browse files Browse the repository at this point in the history
  • Loading branch information
roelof-groenewald committed Dec 6, 2023
1 parent 06839c9 commit 7384c96
Showing 1 changed file with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include "HybridPICModel.H"
#include "Python/callbacks.H"

using namespace amrex;

Expand Down Expand Up @@ -565,13 +566,13 @@ void HybridPICModel::CalculateEquilibCurrent (
}

void HybridPICModel::BfieldEvolveRK (
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Bfield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Efield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& Jfield,
amrex::Vector<std::unique_ptr<amrex::MultiFab>> const& rhofield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& edge_lengths,
amrex::Real const dt, DtType dt_type,
IntVect ng, std::optional<bool> nodal_sync )
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Bfield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Efield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& Jfield,
amrex::Vector<std::unique_ptr<amrex::MultiFab>> const& rhofield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& edge_lengths,
amrex::Real const dt, DtType dt_type,
IntVect ng, std::optional<bool> nodal_sync )
{
auto& warpx = WarpX::GetInstance();
for (int lev = 0; lev <= warpx.finestLevel(); ++lev)
Expand All @@ -584,13 +585,13 @@ void HybridPICModel::BfieldEvolveRK (
}

void HybridPICModel::BfieldEvolveRK (
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Bfield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Efield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& Jfield,
amrex::Vector<std::unique_ptr<amrex::MultiFab>> const& rhofield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& edge_lengths,
amrex::Real const dt, int lev, DtType dt_type,
IntVect ng, std::optional<bool> nodal_sync )
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Bfield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Efield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& Jfield,
amrex::Vector<std::unique_ptr<amrex::MultiFab>> const& rhofield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& edge_lengths,
amrex::Real const dt, int lev, DtType dt_type,
IntVect ng, std::optional<bool> nodal_sync )
{
// Make copies of the B-field multifabs at t = n and create multifabs for
// each direction to store the Runge-Kutta intermediate terms. Each
Expand Down Expand Up @@ -697,13 +698,13 @@ void HybridPICModel::BfieldEvolveRK (
}

void HybridPICModel::BfieldPush (
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Bfield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Efield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& Jfield,
amrex::Vector<std::unique_ptr<amrex::MultiFab>> const& rhofield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& edge_lengths,
amrex::Real const dt, DtType dt_type,
IntVect ng, std::optional<bool> nodal_sync )
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Bfield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>>& Efield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& Jfield,
amrex::Vector<std::unique_ptr<amrex::MultiFab>> const& rhofield,
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3>> const& edge_lengths,
amrex::Real const dt, DtType dt_type,
IntVect ng, std::optional<bool> nodal_sync )
{
auto& warpx = WarpX::GetInstance();

Expand All @@ -715,4 +716,6 @@ void HybridPICModel::BfieldPush (
// Push forward the B-field using Faraday's law
warpx.EvolveB(dt, dt_type);
warpx.FillBoundaryB(ng, nodal_sync);

ExecutePythonCallback("afterBfieldpush");
}

0 comments on commit 7384c96

Please sign in to comment.