Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
f3cb3c4
Update arch_dt.cpp
MaxenceAnt Apr 13, 2026
e97658c
Update vlasovmover.cpp
MaxenceAnt Apr 13, 2026
5e0feb9
Merge pull request #1 from MaxenceAnt/MaxenceAnt-patch-2
MaxenceAnt Apr 13, 2026
fba1247
Merge pull request #2 from MaxenceAnt/MaxenceAnt-patch-1
MaxenceAnt Apr 13, 2026
5cd2b9e
Add files via upload
MaxenceAnt Apr 20, 2026
219510d
Add files via upload
MaxenceAnt Apr 21, 2026
a16d12f
Add files via upload
MaxenceAnt Apr 21, 2026
e489f9f
Add files via upload
MaxenceAnt Apr 21, 2026
57c7e1b
Add files via upload
MaxenceAnt Apr 21, 2026
a73394c
Add files via upload
MaxenceAnt Apr 21, 2026
2ac96f7
Update vlasovmover.cpp
MaxenceAnt Apr 22, 2026
cdc5628
Merge pull request #3 from MaxenceAnt/Multipop-Modification
MaxenceAnt Apr 22, 2026
f5b8bdc
Update datareducer.cpp
MaxenceAnt Apr 23, 2026
ae75667
Update datareductionoperator.cpp
MaxenceAnt Apr 23, 2026
d24ae22
Update iowrite.cpp
MaxenceAnt Apr 23, 2026
c2b73bb
Update object_wrapper.cpp
MaxenceAnt Apr 23, 2026
5a09a22
Add files via upload
MaxenceAnt Apr 23, 2026
7e5eddf
Update arch_moments.cpp
MaxenceAnt Apr 23, 2026
8be6182
Update velocity_block_container.h
MaxenceAnt Apr 23, 2026
65c5090
Merge branch 'vamr_dev' into master
MaxenceAnt Apr 23, 2026
fbeacb4
Merge pull request #4 from MaxenceAnt/master
MaxenceAnt Apr 23, 2026
e65666e
Add files via upload
MaxenceAnt Apr 23, 2026
e687a4d
Merge pull request #5 from MaxenceAnt/vamr-dev
MaxenceAnt Apr 24, 2026
d2ce8a0
Merge pull request #6 from fmihpc/dev
MaxenceAnt Apr 24, 2026
ecccf84
Update object_wrapper.cpp
MaxenceAnt Apr 24, 2026
2182c50
Update parameters.cpp
MaxenceAnt Apr 24, 2026
f6ed0a8
Update parameters.h
MaxenceAnt Apr 24, 2026
9cc8d97
Update arch_moments.cpp
MaxenceAnt Apr 24, 2026
9277e68
Update vlasovmover.cpp
MaxenceAnt Apr 24, 2026
8683469
Update vlasovmover.cpp
MaxenceAnt Apr 24, 2026
b06d351
Update vlasovmover.cpp
MaxenceAnt Apr 24, 2026
cf24a06
Update vlasovmover.cpp
MaxenceAnt Apr 24, 2026
fe6727f
Update vlasovmover.cpp
MaxenceAnt May 4, 2026
8a6df43
Update object_wrapper.cpp
MaxenceAnt May 4, 2026
a6a6047
Update arch_moments.cpp
MaxenceAnt May 4, 2026
efb55d9
Update vlasovmover.cpp
MaxenceAnt May 7, 2026
9ca60ab
Merge pull request #10 from MaxenceAnt/Acceleration-update
MaxenceAnt May 7, 2026
7ea7695
Update vlasovmover.cpp
MaxenceAnt May 7, 2026
2a12664
Update arch_moments.cpp
MaxenceAnt May 7, 2026
35a875a
Update arch_moments.cpp
MaxenceAnt May 8, 2026
b9effaa
Update arch_moments.cpp
MaxenceAnt May 8, 2026
430fcff
Update object_wrapper.cpp
MaxenceAnt May 20, 2026
f5818a5
Update arch_moments.cpp
MaxenceAnt May 20, 2026
7608a45
Update arch_moments.cpp
MaxenceAnt May 21, 2026
6fa1581
Update arch_moments.h
MaxenceAnt May 21, 2026
d84500a
Update vlasovmover.h
MaxenceAnt May 21, 2026
19667c5
Update vlasovmover.cpp
MaxenceAnt May 21, 2026
667d6c1
Update vlasiator.cpp
MaxenceAnt May 21, 2026
17c46ef
Update arch_moments.cpp
MaxenceAnt May 22, 2026
4adb580
Update arch_moments.h
MaxenceAnt May 22, 2026
5525f7c
Update arch_moments.cpp
MaxenceAnt May 25, 2026
87e096f
Update arch_moments.cpp
MaxenceAnt May 29, 2026
73df887
Update arch_moments.h
MaxenceAnt May 29, 2026
b3cf9fd
Update vlasovmover.cpp
MaxenceAnt May 29, 2026
41f3749
Add files via upload
MaxenceAnt May 29, 2026
ea8ec44
Update vlasiator.cpp
MaxenceAnt May 29, 2026
88a64ae
Update object_wrapper.cpp
MaxenceAnt Jun 3, 2026
5403f1c
Update arch_moments.cpp
MaxenceAnt Jun 3, 2026
9a5d7dc
Update vlasovmover.cpp
MaxenceAnt Jun 3, 2026
4777b61
Add files via upload
MaxenceAnt Jun 3, 2026
2f25549
Update arch_moments.cpp
MaxenceAnt Jun 4, 2026
d36abc6
Update arch_moments.cpp
MaxenceAnt Jun 4, 2026
5935682
Update arch_moments.h
MaxenceAnt Jun 4, 2026
30d043c
Update vlasovmover.cpp
MaxenceAnt Jun 4, 2026
0c35cb0
Update arch_moments.cpp
MaxenceAnt Jun 4, 2026
b16ee10
Add files via upload
MaxenceAnt Jun 8, 2026
b1a5a60
Update vlasovmover.cpp
MaxenceAnt Jun 8, 2026
4ec2f49
Update arch_moments.cpp
MaxenceAnt Jun 9, 2026
7d27ea0
Update arch_moments.cpp
MaxenceAnt Jun 9, 2026
1bd784f
Update object_wrapper.cpp
MaxenceAnt Jun 9, 2026
a03a9ce
Update arch_moments.cpp
MaxenceAnt Jun 9, 2026
0fc45cb
Add files via upload
MaxenceAnt Jun 9, 2026
2f877df
Update arch_moments.cpp
MaxenceAnt Jun 24, 2026
37514f6
Add files via upload
MaxenceAnt Jun 24, 2026
4804b3e
Add files via upload
MaxenceAnt Jun 24, 2026
9178795
Add files via upload
MaxenceAnt Jun 24, 2026
a9e0179
Update spatial_cell_cpu.cpp
MaxenceAnt Jul 13, 2026
e229d20
Add files via upload
MaxenceAnt Jul 13, 2026
197537c
Add files via upload
MaxenceAnt Jul 13, 2026
b043af5
Update arch_moments.cpp
MaxenceAnt Jul 16, 2026
6599861
Update parameters.h
MaxenceAnt Jul 16, 2026
5db619b
Update object_wrapper.cpp
MaxenceAnt Jul 17, 2026
35db5b5
Update parameters.cpp
MaxenceAnt Jul 17, 2026
46cea0e
Update object_wrapper.cpp
MaxenceAnt Jul 17, 2026
97429bd
Update arch_moments.cpp
MaxenceAnt Jul 20, 2026
332c61a
Update vlasovmover.cpp
MaxenceAnt Jul 20, 2026
9b67377
Update vlasovmover.cpp
MaxenceAnt Jul 20, 2026
e7c171c
Update grid.cpp
MaxenceAnt Jul 21, 2026
b6b94f1
Update grid.h
MaxenceAnt Jul 21, 2026
7831708
Update Makefile.local_maxence
MaxenceAnt Jul 21, 2026
c2bc912
Update ioread.cpp
MaxenceAnt Jul 21, 2026
369597c
Update iowrite.cpp
MaxenceAnt Jul 21, 2026
efcc7dc
Update object_wrapper.cpp
MaxenceAnt Jul 21, 2026
dfe63a3
Update parameters.cpp
MaxenceAnt Jul 21, 2026
7e6694e
Update spatial_cell_cpu.cpp
MaxenceAnt Jul 21, 2026
44935e3
Update spatial_cell_cpu.hpp
MaxenceAnt Jul 21, 2026
a09be20
Update velocity_block_container.h
MaxenceAnt Jul 21, 2026
a4d4081
Update velocity_block_container.h
MaxenceAnt Jul 21, 2026
a3bf13a
Update arch_moments.h
MaxenceAnt Jul 21, 2026
81f65fb
Update vlasovmover.cpp
MaxenceAnt Jul 21, 2026
bc38a43
Update arch_moments.cpp
MaxenceAnt Jul 21, 2026
a5a3a5f
Update arch_moments.cpp
MaxenceAnt Jul 22, 2026
5ebf7c7
Update arch_moments.cpp
MaxenceAnt Jul 22, 2026
2ac3b54
Merge branch 'vamr-final' into Flag_new_criteria_fast_vamr
MaxenceAnt Jul 22, 2026
5791cd9
Merge pull request #12 from MaxenceAnt/Flag_new_criteria_fast_vamr
MaxenceAnt Jul 22, 2026
62698fb
Update arch_moments.cpp
MaxenceAnt Jul 22, 2026
ac9deb3
Update vlasiator.cpp
MaxenceAnt Jul 23, 2026
ba997f0
Update arch_moments.cpp
MaxenceAnt Jul 24, 2026
a44b035
Update object_wrapper.cpp
MaxenceAnt Jul 24, 2026
77e17ef
Update arch_moments.cpp
MaxenceAnt Jul 29, 2026
8ca3799
Update arch_moments.cpp
MaxenceAnt Jul 29, 2026
ec81d22
Update arch_moments.cpp
MaxenceAnt Jul 29, 2026
d12f3ea
Update arch_moments.cpp
MaxenceAnt Jul 29, 2026
1c94bd0
Update arch_moments.cpp
MaxenceAnt Jul 29, 2026
b4db97d
Update arch_moments.cpp
MaxenceAnt Jul 29, 2026
cc4103d
Update object_wrapper.cpp
MaxenceAnt Jul 30, 2026
8d63754
Update object_wrapper.cpp
MaxenceAnt Jul 30, 2026
c2b645f
Update spatial_cell_cpu.cpp
MaxenceAnt Jul 30, 2026
91d7d8f
Update spatial_cell_wrapper.hpp
MaxenceAnt Jul 30, 2026
926ce35
Update spatial_cell_cpu.cpp
MaxenceAnt Jul 30, 2026
0de6b7c
Update grid.cpp
MaxenceAnt Jul 30, 2026
0cf0a1f
Update vlasovmover.cpp
MaxenceAnt Jul 30, 2026
d3a19c5
Update arch_moments.cpp
MaxenceAnt Jul 30, 2026
88016a7
Update arch_moments.cpp
MaxenceAnt Jul 30, 2026
3d65915
Update arch_moments.h
MaxenceAnt Jul 30, 2026
56c594a
Update arch_moments.cpp
MaxenceAnt Jul 30, 2026
d06768c
Update arch_moments.cpp
MaxenceAnt Jul 30, 2026
104f288
Update arch_moments.cpp
MaxenceAnt Jul 30, 2026
5a3a63c
Update velocity_block_container.h
MaxenceAnt Jul 31, 2026
4d87c04
Update vlasovmover.cpp
MaxenceAnt Aug 3, 2026
4421af4
Delete MAKE/Makefile.lumi_maxence
MaxenceAnt Aug 3, 2026
6d47f41
Delete MAKE/Makefile.local_maxence
MaxenceAnt Aug 3, 2026
b4b2e92
Update ioread.cpp
MaxenceAnt Aug 3, 2026
6bb5256
Update datareductionoperator.cpp
MaxenceAnt Aug 3, 2026
f25eb6b
Update grid.cpp
MaxenceAnt Aug 3, 2026
af32be4
Update iowrite.cpp
MaxenceAnt Aug 3, 2026
a5bfeb4
Update particle_species.cpp
MaxenceAnt Aug 3, 2026
a565b5b
Update spatial_cell_cpu.cpp
MaxenceAnt Aug 3, 2026
a88964a
Update vlasiator.cpp
MaxenceAnt Aug 3, 2026
7b7941b
Update vlasiator.cpp
MaxenceAnt Aug 3, 2026
854a6ef
Update arch_moments.h
MaxenceAnt Aug 3, 2026
d2a312e
Update arch_moments.h
MaxenceAnt Aug 3, 2026
fcbe382
Update vlasovmover.cpp
MaxenceAnt Aug 3, 2026
078f138
Update arch_moments.cpp
MaxenceAnt Aug 3, 2026
0f8f879
Update arch_moments.cpp
MaxenceAnt Aug 3, 2026
dcca89c
Additional comment
MaxenceAnt Aug 5, 2026
fc12834
Update object_wrapper.cpp
MaxenceAnt Aug 10, 2026
55da077
Update arch_moments.cpp
MaxenceAnt Aug 10, 2026
9a98ba8
Update arch_moments.cpp
MaxenceAnt Aug 10, 2026
a6c25ab
Update arch_moments.cpp
MaxenceAnt Aug 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 80 additions & 20 deletions datareduction/datareducer.cpp

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions datareduction/datareductionoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ namespace DRO {
// Blocks
Blocks::Blocks(cuint _popID): DataReductionOperator(),popID(_popID) {
popName=getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
}
Blocks::~Blocks() { }

Expand Down Expand Up @@ -633,6 +636,9 @@ namespace DRO {
// and VariablePTensorOffDiagonal (23, 13, 12)
VariablePTensorDiagonal::VariablePTensorDiagonal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
}
VariablePTensorDiagonal::~VariablePTensorDiagonal() { }

Expand Down Expand Up @@ -697,6 +703,9 @@ namespace DRO {

VariablePTensorOffDiagonal::VariablePTensorOffDiagonal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
}
VariablePTensorOffDiagonal::~VariablePTensorOffDiagonal() { }

Expand Down Expand Up @@ -1030,6 +1039,9 @@ namespace DRO {
// Rho nonthermal:
VariableRhoNonthermal::VariableRhoNonthermal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
doSkip = (getObjectWrapper().particleSpecies[popID].thermalRadius == 0.0) ? true : false;
}
VariableRhoNonthermal::~VariableRhoNonthermal() { }
Expand Down Expand Up @@ -1059,6 +1071,9 @@ namespace DRO {
// Rho thermal:
VariableRhoThermal::VariableRhoThermal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
doSkip = (getObjectWrapper().particleSpecies[popID].thermalRadius == 0.0) ? true : false;
}
VariableRhoThermal::~VariableRhoThermal() { }
Expand Down Expand Up @@ -1088,6 +1103,9 @@ namespace DRO {
// v nonthermal:
VariableVNonthermal::VariableVNonthermal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
doSkip = (getObjectWrapper().particleSpecies[popID].thermalRadius == 0.0) ? true : false;
}
VariableVNonthermal::~VariableVNonthermal() { }
Expand Down Expand Up @@ -1122,6 +1140,9 @@ namespace DRO {
//v thermal:
VariableVThermal::VariableVThermal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
doSkip = (getObjectWrapper().particleSpecies[popID].thermalRadius == 0.0) ? true : false;
}
VariableVThermal::~VariableVThermal() { }
Expand Down Expand Up @@ -1161,6 +1182,9 @@ namespace DRO {
// and VariablePTensorNonthermalOffDiagonal (23, 13, 12)
VariablePTensorNonthermalDiagonal::VariablePTensorNonthermalDiagonal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
doSkip = (getObjectWrapper().particleSpecies[popID].thermalRadius == 0.0) ? true : false;
}
VariablePTensorNonthermalDiagonal::~VariablePTensorNonthermalDiagonal() { }
Expand Down Expand Up @@ -1209,6 +1233,9 @@ namespace DRO {
// and VariablePTensorThermalOffDiagonal (23, 13, 12)
VariablePTensorThermalDiagonal::VariablePTensorThermalDiagonal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
doSkip = (getObjectWrapper().particleSpecies[popID].thermalRadius == 0.0) ? true : false;
}
VariablePTensorThermalDiagonal::~VariablePTensorThermalDiagonal() { }
Expand Down Expand Up @@ -1251,6 +1278,9 @@ namespace DRO {

VariablePTensorNonthermalOffDiagonal::VariablePTensorNonthermalOffDiagonal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
doSkip = (getObjectWrapper().particleSpecies[popID].thermalRadius == 0.0) ? true : false;
}
VariablePTensorNonthermalOffDiagonal::~VariablePTensorNonthermalOffDiagonal() { }
Expand Down Expand Up @@ -1295,6 +1325,9 @@ namespace DRO {

VariablePTensorThermalOffDiagonal::VariablePTensorThermalOffDiagonal(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
doSkip = (getObjectWrapper().particleSpecies[popID].thermalRadius == 0.0) ? true : false;
}
VariablePTensorThermalOffDiagonal::~VariablePTensorThermalOffDiagonal() { }
Expand Down Expand Up @@ -1340,6 +1373,9 @@ namespace DRO {

VariableEffectiveSparsityThreshold::VariableEffectiveSparsityThreshold(cuint _popID): DataReductionOperator(),popID(_popID) {
popName=getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
}
VariableEffectiveSparsityThreshold::~VariableEffectiveSparsityThreshold() { }

Expand Down Expand Up @@ -1380,6 +1416,9 @@ namespace DRO {
*/
VariablePrecipitationDiffFlux::VariablePrecipitationDiffFlux(cuint _popID): DataReductionOperatorHasParameters(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
lossConeAngle = getObjectWrapper().particleSpecies[popID].precipitationLossConeAngle; // deg
emin = getObjectWrapper().particleSpecies[popID].precipitationEmin; // already converted to SI
emax = getObjectWrapper().particleSpecies[popID].precipitationEmax; // already converted to SI
Expand Down Expand Up @@ -1505,6 +1544,9 @@ namespace DRO {
*/
VariableMuSpace::VariableMuSpace(cuint _popID): DataReductionOperatorHasParameters(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
nBins = Parameters::PADmubins; //Number of bins to build muSpace
}
VariableMuSpace::~VariableMuSpace() { }
Expand Down Expand Up @@ -1594,6 +1636,9 @@ namespace DRO {
*/
VariablePrecipitationLineDiffFlux::VariablePrecipitationLineDiffFlux(cuint _popID): DataReductionOperatorHasParameters(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
emin = getObjectWrapper().particleSpecies[popID].precipitationEmin; // already converted to SI
emax = getObjectWrapper().particleSpecies[popID].precipitationEmax; // already converted to SI
nChannels = getObjectWrapper().particleSpecies[popID].precipitationNChannels; // number of energy channels, logarithmically spaced between emin and emax
Expand Down Expand Up @@ -1737,6 +1782,9 @@ namespace DRO {
*/
VariableEnergyDensity::VariableEnergyDensity(cuint _popID): DataReductionOperatorHasParameters(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
// Store internally in SI units
solarwindenergy = getObjectWrapper().particleSpecies[popID].SolarWindEnergy;
E1limit = solarwindenergy * getObjectWrapper().particleSpecies[popID].EnergyDensityLimit1;
Expand Down Expand Up @@ -1828,6 +1876,9 @@ namespace DRO {
// q_i = m/2 * integral((v - <V>)^2 (v - <V>)_i * f(r,v) dV)
VariableHeatFluxVector::VariableHeatFluxVector(cuint _popID): DataReductionOperator(),popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
}
VariableHeatFluxVector::~VariableHeatFluxVector() { }

Expand Down Expand Up @@ -1913,6 +1964,9 @@ namespace DRO {
*/
VariableNonMaxwellianity::VariableNonMaxwellianity(cuint _popID) : DataReductionOperator(), popID(_popID) {
popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
}
VariableNonMaxwellianity::~VariableNonMaxwellianity() {}

Expand Down
12 changes: 9 additions & 3 deletions grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,13 @@ void initializeGrids(
mpiGrid[cells[i]]->parameters[CellParams::LBWEIGHTCOUNTER] = 0;
}

if (P::activateVamr){
//Fixed ghost to 1 for all the initial velocity cells to avoid destruction
FixedGhost(mpiGrid,cells);
}

for (uint popID = 0; popID < getObjectWrapper().particleSpecies.size(); ++popID) {
adjustVelocityBlocks(mpiGrid, cells, true, popID);
adjustVelocityBlocks(mpiGrid,cells,true,popID,true);
// set initial LB metric based on number of blocks
#pragma omp parallel for schedule(static)
for (size_t i = 0; i < cells.size(); ++i) {
Expand Down Expand Up @@ -830,7 +835,8 @@ void prepareAMRLists(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGr
bool adjustVelocityBlocks(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
const vector<CellID>& cellsToAdjust,
bool doPrepareToReceiveBlocks,
const uint popID) {
const uint popID,
bool useGhost) {
phiprof::Timer readjustBlocksTimer {"re-adjust blocks", {"Block adjustment"}};
SpatialCell::setCommunicatedSpecies(popID);

Expand All @@ -844,7 +850,7 @@ bool adjustVelocityBlocks(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>&
}

// Batch call
update_velocity_block_content_lists(mpiGrid,validCells, popID);
update_velocity_block_content_lists(mpiGrid,validCells,useGhost,popID);

// Get updated lists for blocks with content in spatial neighbours
phiprof::Timer transferTimer {"Transfer with_content_list", {"MPI"}};
Expand Down
3 changes: 2 additions & 1 deletion grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ void deallocateRemoteCellBlocks(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geomet
bool adjustVelocityBlocks(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
const std::vector<CellID>& cellsToAdjust,
bool doPrepareToReceiveBlocks,
const uint popID);
const uint popID,
bool useGhost);

/*! Shrink to fit velocity space data to save memory.
* \param mpiGrid Spatial grid
Expand Down
10 changes: 8 additions & 2 deletions ioread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ bool _readBlockDataCompressionNone(vlsv::ParallelReader & file,
uint64_t byteSize;
list<pair<string, string>> avgAttribs;
bool success = true;
const string popName = getObjectWrapper().particleSpecies[popID].name;
string popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
const string tagName = "BLOCKIDS";

avgAttribs.push_back(make_pair("mesh", spatMeshName));
Expand Down Expand Up @@ -1028,7 +1031,10 @@ bool readBlockData(vlsv::ParallelReader& file, const string& meshName, const vec
uint64_t* offsetArray = new uint64_t[N_processes];

for (uint popID = 0; popID < getObjectWrapper().particleSpecies.size(); ++popID) {
const string& popName = getObjectWrapper().particleSpecies[popID].name;
string popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}

// Create a cellID remapping lambda that can renumber our velocity space, should its size have changed.
// By default, this is a no-op that keeps the blockIDs untouched.
Expand Down
8 changes: 5 additions & 3 deletions iowrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ bool writeVelocityDistributionData(const uint popID, Writer& vlsvWriter,
// In restart we just write velocity grids for all cells.
// First write global Ids of those cells which write velocity blocks (here: all cells):
map<string, string> attribs;
const string popName = getObjectWrapper().particleSpecies[popID].name;
string popName = getObjectWrapper().particleSpecies[popID].name;
if (P::activateVamr) {
popName += std::to_string(getObjectWrapper().particleSpecies[popID].RefinementLevel);
}
const string spatMeshName = "SpatialGrid";
attribs["name"] = popName;
bool success = true;
Expand All @@ -177,7 +180,6 @@ bool writeVelocityDistributionData(const uint popID, Writer& vlsvWriter,
totalBlocks += mpiGrid[cells[i]]->get_number_of_velocity_blocks(popID);
blocksPerCell.push_back(mpiGrid[cells[i]]->get_number_of_velocity_blocks(popID));
}

// The name of the mesh is "SpatialGrid"
attribs["mesh"] = spatMeshName;

Expand All @@ -203,7 +205,7 @@ bool writeVelocityDistributionData(const uint popID, Writer& vlsvWriter,
bbox[5] = vmesh::getMeshWrapper()->velocityMeshes->at(meshID).blockLength[2];

attribs.clear();
attribs["mesh"] = getObjectWrapper().particleSpecies[popID].name;
attribs["mesh"] = popName;
attribs["type"] = vlsv::mesh::STRING_UCD_AMR;

// stringstream is necessary here to correctly convert refLevelMaxAllowed (hardcoded to zero now) into a string
Expand Down
57 changes: 56 additions & 1 deletion object_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ bool ObjectWrapper::addPopulationParameters() {
RP::add(pop + "_vspace.vx_length","Initial number of velocity blocks in vx-direction.",1);
RP::add(pop + "_vspace.vy_length","Initial number of velocity blocks in vy-direction.",1);
RP::add(pop + "_vspace.vz_length","Initial number of velocity blocks in vz-direction.",1);
RP::add(pop + "_vspace.max_refinement_level","Maximum allowed mesh refinement level.", 1);
RP::add(pop + "_vspace.max_refinement_level","Old maximum allowed mesh refinement level.", 1);
RP::add(pop + "_vspace.vamr_refinement_level","New maximum allowed mesh refinement level. 0 is an homogenous grid, X will give X+1 grids.", 0);
RP::add(pop + "_vspace.vamr_criteria_method","Choice of the method for the vamr criteria. 0 : d><population>_sparse.minValue , 1 : d > eps , 2 : d > eps 2^-R . Eitheir 0 will be taken.", 0);
RP::add(pop + "_vspace.vamr_criteria_value","Value of epsilon (eps) for the vamr refinement criteria. Used only if vamr_criteria_method is 1 or 2.", 1e-15);

// Thermal / suprathermal parameters
Readparameters::add(pop + "_thermal.vx", "Center coordinate for the maxwellian distribution. Used for calculating the suprathermal moments.", -500000.0);
Expand Down Expand Up @@ -93,6 +96,44 @@ bool ObjectWrapper::addPopulationParameters() {
bool ObjectWrapper::getPopulationParameters() {
typedef Readparameters RP;

//Creation of the new species for each vAMR level
if(P::activateVamr) {
const int nbpopinit = getObjectWrapper().particleSpecies.size();
int shift=0;

for(int popID=0; popID < nbpopinit; popID++) {
species::Species& species=getObjectWrapper().particleSpecies[popID+shift];
vmesh::MeshParameters& vMesh=vmesh::getMeshWrapper()->velocityMeshesCreation->at(popID+shift);
const std::string& pop = species.name;
RP::get(pop + "_vspace.vamr_refinement_level", species.MaxRefinementLevel);
species.velocityMesh=popID+shift;
if ( species.MaxRefinementLevel > 0) {
species.RefinementLevel=0;
for (int R=0; R< species.MaxRefinementLevel; ++R) {
species::Species newSpecies;
vmesh::MeshParameters newVMesh;

newSpecies.name = newVMesh.name = pop; // + std::to_string(R+1); Will only be done for the output files
newSpecies.velocityMesh = popID+shift+1;
//Insertion of the new level in order to have continuity for the same population in the future popID loop
getObjectWrapper().particleSpecies.insert(getObjectWrapper().particleSpecies.begin()+popID+shift+1, newSpecies);
vmesh::getMeshWrapper()->velocityMeshesCreation->insert(vmesh::getMeshWrapper()->velocityMeshesCreation->begin() +popID+shift+1,newVMesh);

species::Species& species2=getObjectWrapper().particleSpecies[popID+shift+1];
vmesh::MeshParameters& vMesh2=vmesh::getMeshWrapper()->velocityMeshesCreation->at(popID+shift+1);

species2.RefinementLevel=R+1;
species2.MaxRefinementLevel= species.MaxRefinementLevel;

shift+=1;
}
}else {
species.MaxRefinementLevel=0;
species.RefinementLevel=0;
}
}
}

// Particle population parameters
for(unsigned int i =0; i < getObjectWrapper().particleSpecies.size(); i++) {

Expand Down Expand Up @@ -144,6 +185,20 @@ bool ObjectWrapper::getPopulationParameters() {
RP::get(pop + "_vspace.vx_length",vMesh.gridLength[0]);
RP::get(pop + "_vspace.vy_length",vMesh.gridLength[1]);
RP::get(pop + "_vspace.vz_length",vMesh.gridLength[2]);

// Vamr parameters that are saved in species
RP::get(pop + "_vspace.vamr_criteria_method", species.CriteriaMethod);
RP::get(pop + "_vspace.vamr_criteria_value", species.CriteriaValue);

if(P::activateVamr && species.RefinementLevel>0) {
//Nv(R)=Nv(R=0)*2^R
vMesh.gridLength[0] *= (1u << species.RefinementLevel);
vMesh.gridLength[1] *= (1u << species.RefinementLevel);
vMesh.gridLength[2] *= (1u << species.RefinementLevel);
//species.sparseMinValue *= std::pow(species.minValueRefinementShift, species.RefinementLevel);
species.sparseBlockAddWidthV=0;
}

if(vMesh.gridLength[0] > MAX_BLOCKS_PER_DIM ||
vMesh.gridLength[1] > MAX_BLOCKS_PER_DIM ||
vMesh.gridLength[2] > MAX_BLOCKS_PER_DIM ) {
Expand Down
9 changes: 9 additions & 0 deletions parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ bool P::propagateVlasovTranslation = true;
bool P::propagateField = true;

bool P::dynamicTimestep = true;
bool P::activateVamr = false;
uint P::vAMRorder = 1;
uint P::vAMRrefineStep = 5;

Real P::maxWaveVelocity = 0.0;
uint P::maxFieldSolverSubcycles = 0.0;
Expand Down Expand Up @@ -325,6 +328,9 @@ bool P::addParameters() {
"zero length timesteps.",
true);
RP::add("dynamic_timestep", "If true, timestep is set based on CFL limits (default on)", true);
RP::add("activate_vamr","Activate the velocity mesh refinement. If 1 it is activated. ", false);
RP::add("vamr_refineStep","Number of steps between each velocity refinement check.", 5);
RP::add("vamr_order","Select the numerical order for the creation of cells in the vamr. Existing orders :1, 3 and 5 , either 1 will be taken.", 1);
RP::add("hallMinimumRho",
"Minimum rho value used for the Hall and electron pressure gradient terms in the Lorentz force and in the "
"field solver. Default is very low and has no effect in practice.",
Expand Down Expand Up @@ -825,6 +831,9 @@ void Parameters::getParameters() {
RP::get("propagate_vlasov_acceleration", P::propagateVlasovAcceleration);
RP::get("propagate_vlasov_translation", P::propagateVlasovTranslation);
RP::get("dynamic_timestep", P::dynamicTimestep);
RP::get("activate_vamr", P::activateVamr);
RP::get("vamr_order", P::vAMRorder);
RP::get("vamr_refineStep", P::vAMRrefineStep);
Real hallRho;
RP::get("hallMinimumRho", hallRho);
P::hallMinimumRhom = hallRho * physicalconstants::MASS_PROTON;
Expand Down
Loading
Loading