1212#include " synchronizer_pool.hpp"
1313#include " amr/data/field/coarsening/field_coarsen_operator.hpp"
1414#include " amr/data/field/coarsening/default_field_coarsener.hpp"
15- #include " amr/data/field/coarsening/magnetic_field_coarsener.hpp"
1615#include " amr/data/field/coarsening/electric_field_coarsener.hpp"
1716#include " amr/data/field/refine/field_refiner.hpp"
1817#include " amr/data/field/refine/magnetic_field_refiner.hpp"
@@ -100,7 +99,6 @@ namespace amr
10099
101100 template <typename Policy>
102101 using BaseCoarsenOp = FieldCoarsenOperator<GridLayoutT, GridT, Policy>;
103- using MagneticCoarsenOp = BaseCoarsenOp<MagneticFieldCoarsener<dimension>>;
104102 using DefaultCoarsenOp = BaseCoarsenOp<DefaultFieldCoarsener<dimension>>;
105103 using ElectricFieldCoarsenOp = BaseCoarsenOp<ElectricFieldCoarsener<dimension>>;
106104
@@ -118,6 +116,7 @@ namespace amr
118116 resourcesManager_->registerResources (Jold_);
119117 resourcesManager_->registerResources (NiOld_);
120118 resourcesManager_->registerResources (ViOld_);
119+ resourcesManager_->registerResources (Eold_);
121120 }
122121
123122 virtual ~HybridHybridMessengerStrategy () = default ;
@@ -138,6 +137,7 @@ namespace amr
138137 resourcesManager_->allocate (Jold_, patch, allocateTime);
139138 resourcesManager_->allocate (NiOld_, patch, allocateTime);
140139 resourcesManager_->allocate (ViOld_, patch, allocateTime);
140+ resourcesManager_->allocate (Eold_, patch, allocateTime);
141141 }
142142
143143
@@ -328,21 +328,6 @@ namespace amr
328328 patchGhostPartRefiners_.fill (levelNumber, initDataTime);
329329
330330
331- // regriding will fill the new level wherever it has points that overlap
332- // old level. This will include its level border points.
333- // These new level border points will thus take values that where previous
334- // domain values. Magnetic flux is thus not necessarily consistent with
335- // the Loring et al. method to sync the induction between coarse and fine faces.
336- // Specifically, we need all fine faces to have equal magnetic field and also
337- // equal to that of the shared coarse face.
338- // This means that we now need to fill ghosts and border included
339-
340- if (!isRegriddingL0)
341- {
342- auto & E = hybridModel.state .electromag .E ;
343- elecGhostsRefiners_.fill (E, levelNumber, initDataTime);
344- }
345-
346331 // we now call only levelGhostParticlesOld.fill() and not .regrid()
347332 // regrid() would refine from next coarser in regions of level not overlaping
348333 // oldLevel, but copy from domain particles of oldLevel where there is an
@@ -638,19 +623,23 @@ namespace amr
638623 for (auto & patch : level)
639624 {
640625 auto dataOnPatch = resourcesManager_->setOnPatch (
641- *patch, hybridModel.state .J , hybridModel.state .ions , Jold_, NiOld_, ViOld_);
626+ *patch, hybridModel.state .electromag , hybridModel.state .J ,
627+ hybridModel.state .ions , Jold_, NiOld_, ViOld_, Eold_);
642628
643629 resourcesManager_->setTime (Jold_, *patch, currentTime);
644630 resourcesManager_->setTime (NiOld_, *patch, currentTime);
645631 resourcesManager_->setTime (ViOld_, *patch, currentTime);
632+ resourcesManager_->setTime (Eold_, *patch, currentTime);
646633
647634 auto & J = hybridModel.state .J ;
648635 auto & Vi = hybridModel.state .ions .velocity ();
649636 auto & Ni = hybridModel.state .ions .chargeDensity ();
637+ auto & E = hybridModel.state .electromag .E ;
650638
651639 Jold_.copyData (J);
652640 ViOld_.copyData (Vi);
653641 NiOld_.copyData (Ni);
642+ Eold_.copyData (E);
654643 }
655644 }
656645
@@ -707,7 +696,7 @@ namespace amr
707696 double const syncTime) override
708697 {
709698 refluxSchedules[fineLevelNumber]->coarsenData ();
710- ghostRefluxedSchedules [coarserLevelNumber]->fillData (syncTime);
699+ patchGhostRefluxedSchedules [coarserLevelNumber]->fillData (syncTime);
711700 }
712701
713702 // after coarsening, domain nodes have been updated and therefore patch ghost nodes
@@ -751,11 +740,13 @@ namespace amr
751740 return keys;
752741 };
753742
754- elecSharedNodesRefiners_.addStaticRefiners (info->ghostElectric , EfieldNodeRefineOp_,
755- makeKeys (info->ghostElectric ));
743+ elecSharedNodesRefiners_.addTimeRefiners (info->ghostElectric , info->ghostElectric ,
744+ core::VecFieldNames{Eold_},
745+ EfieldNodeRefineOp_, fieldTimeOp_);
756746
757- elecGhostsRefiners_.addStaticRefiners (info->ghostElectric , EfieldRefineOp_,
758- makeKeys (info->ghostElectric ));
747+ elecGhostsRefiners_.addTimeRefiners (info->ghostElectric , info->ghostElectric ,
748+ core::VecFieldNames{Eold_}, EfieldRefineOp_,
749+ fieldTimeOp_);
759750
760751 currentSharedNodesRefiners_.addTimeRefiners (info->ghostCurrent , info->modelCurrent ,
761752 core::VecFieldNames{Jold_},
@@ -814,9 +805,6 @@ namespace amr
814805
815806 void registerSyncComms (std::unique_ptr<HybridMessengerInfo> const & info)
816807 {
817- magnetoSynchronizers_.add (info->modelMagnetic , magneticCoarseningOp_,
818- info->modelMagnetic .vecName );
819-
820808 electroSynchronizers_.add (info->modelElectric , electricFieldCoarseningOp_,
821809 info->modelElectric .vecName );
822810
@@ -1057,6 +1045,7 @@ namespace amr
10571045 VecFieldT Jold_{stratName + " _Jold" , core::HybridQuantity::Vector::J};
10581046 VecFieldT ViOld_{stratName + " _VBulkOld" , core::HybridQuantity::Vector::V};
10591047 FieldT NiOld_{stratName + " _NiOld" , core::HybridQuantity::Scalar::rho};
1048+ VecFieldT Eold_{stratName + " _Eold" , core::HybridQuantity::Vector::E};
10601049
10611050
10621051 // ! ResourceManager shared with other objects (like the HybridModel)
@@ -1154,7 +1143,6 @@ namespace amr
11541143
11551144 using CoarsenOperator_ptr = std::shared_ptr<SAMRAI::hier::CoarsenOperator>;
11561145 CoarsenOperator_ptr fieldCoarseningOp_{std::make_shared<DefaultCoarsenOp>()};
1157- CoarsenOperator_ptr magneticCoarseningOp_{std::make_shared<MagneticCoarsenOp>()};
11581146 CoarsenOperator_ptr electricFieldCoarseningOp_{std::make_shared<ElectricFieldCoarsenOp>()};
11591147
11601148 MagneticRefinePatchStrategy<ResourcesManagerT, FieldDataT> magneticRefinePatchStrategy_{
0 commit comments