111 const auto& gridSpacing,
SysBoundary& sysBoundaries) {
113 if (stencil.ooo() >= moments.size()) {
114 cerr <<
"Out-of-bounds access in " << __FILE__ <<
":" << __LINE__ << endl;
118 auto& egradpe = egradpes[stencil.ooo()];
119 const auto& moment = moments[stencil.ooo()];
120 const auto& dmoment = dmoments[stencil.ooo()];
121 const auto& tech = technical[stencil.ooo()];
123 cuint cellSysBoundaryFlag = tech.sysBoundaryFlag;
124 cuint cellSysBoundaryLayer = tech.sysBoundaryLayer;
137 cerr << __FILE__ << __LINE__
138 <<
"You shouldn't be in a electron pressure gradient term function if Parameters::ohmGradPeTerm == 0."
141 auto calculateEdgeGradPeTermComponent = [&egradpe, &moment, &dmoment](
size_t i,
size_t j,
Real spacing) {
144 const Real max = std::numeric_limits<Real>::max();
145 const Real hallRhoq = std::clamp(rhoq,
min,
max);
146 egradpe[
i] = -dmoment[
j] / (hallRhoq * spacing);
152 cerr << __FILE__ <<
":" << __LINE__ <<
"You are welcome to code higher-order Hall term correction terms." << endl;
165 phiprof::Timer gradPeTimer{
"Calculate GradPe term"};
167 const size_t numCells =
fsgrid.getNumCells();
170 egradpe = egradpedt2;
171 moments = momentsdt2;
172 dmoments = dmomentsdt2;
175 phiprof::Timer mpiTimer{
"EgradPe field update ghosts MPI", {
"MPI"}};
176 fsgrid.updateGhostCells(dmoments);
180 fsgrid.parallel_for([](
int timerId) -> phiprof::Timer {
return phiprof::Timer{timerId}; },
181 phiprof::initializeTimer(
"EgradPe compute cells"), technical,
182 [=, &sysBoundaries](
const fsgrid::Coordinates &coordinates,
const fsgrid::FsStencil& stencil,
cuint sysBoundaryFlag,
cuint sysBoundaryLayer) {
183 calculateGradPeTerm(egradpe, moments, dmoments, technical, stencil, coordinates.physicalGridSpacing, sysBoundaries);
186 gradPeTimer.stop(numCells,
"Spatial Cells");
virtual void fieldSolverBoundaryCondGradPeElectricField(fsgrids::egradpespan EGradPe, const fsgrid::FsStencil &stencil, cuint component)=0
SysBoundary contains the SysBoundaryConditions used in the simulation.
SBC::SysBoundaryCondition * getSysBoundary(cuint sysBoundaryType) const
fsgrid::FsGrid< FS_STENCIL_WIDTH > FieldSolverGrid
void calculateGradPeTerm(fsgrids::egradpespan egradpes, fsgrids::constmomentsspan moments, fsgrids::constdmomentsspan dmoments, fsgrids::consttechnicalspan technical, const fsgrid::FsStencil &stencil, const auto &gridSpacing, SysBoundary &sysBoundaries)
void calculateGradPeTermSimple(fsgrids::egradpespan egradpe, fsgrids::egradpespan egradpedt2, fsgrids::momentsspan moments, fsgrids::momentsspan momentsdt2, fsgrids::dmomentsspan dmoments, fsgrids::dmomentsspan dmomentsdt2, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, SysBoundary &sysBoundaries, cint &RKCase)
std::span< const std::array< Real, fsgrids::dmoments::N_DMOMENTS > > constdmomentsspan
std::span< const std::array< Real, fsgrids::moments::N_MOMENTS > > constmomentsspan
std::span< std::array< Real, fsgrids::moments::N_MOMENTS > > momentsspan
std::span< std::array< Real, fsgrids::egradpe::N_EGRADPE > > egradpespan
std::span< std::array< Real, fsgrids::dmoments::N_DMOMENTS > > dmomentsspan
std::span< technical > technicalspan
std::span< const technical > consttechnicalspan
static uint ohmGradPeTerm
static Real hallMinimumRhoq
static ARCH_HOSTDEV VecSimple< T > min(VecSimple< T > const &l, VecSimple< T > const &r)
static ARCH_HOSTDEV VecSimple< T > max(VecSimple< T > const &l, VecSimple< T > const &r)