55 cerr <<
"ERROR: DataReductionOperator::reduceData called instead of derived class function! (variable" <<
57 cerr <<
" Did you use a diagnostic reducer for writing bulk data?" << endl;
69 cerr <<
"ERROR: DataReductionOperator::reduceData called instead of derived class function! (variable " <<
71 cerr <<
" Did you use a bulk reducer for writing diagnostic data?" << endl;
81 dataSize =
sizeof(
Real);
89 const char* ptr =
reinterpret_cast<const char*
>(
data);
104 string message =
"The DataReductionOperator " + this->
getName() +
" returned a nan or an inf in its " + std::to_string(
i) +
"-component.";
105 bailout(
true, message, __FILE__, __LINE__);
116 dataSize =
sizeof(double);
132 const std::string& meshName, vlsv::Writer& vlsvWriter,
133 const bool writeAsFloat) {
134 const std::map<std::string, std::string> attribs = {
143 std::vector<float> varBufferFloat;
144 const std::vector<double> varBuffer =
lambda(fieldSolverData);
145 const auto* localSize = &fieldSolverData.
fsgrid.getLocalSize()[0];
146 const auto totalSize = localSize[0] * localSize[1] * localSize[2];
147 const auto vectorSize = totalSize == 0 ? 0 : varBuffer.size() / totalSize;
149 auto writeArray = [&attribs, &totalSize, &vectorSize, &vlsvWriter](
const auto& buf) ->
bool {
150 return vlsvWriter.writeArray(
"VARIABLE", attribs,
"float", totalSize, vectorSize,
sizeof(buf[0]),
151 reinterpret_cast<const char*
>(buf.data()));
156 varBufferFloat.resize(varBuffer.size());
157 std::transform(varBuffer.cbegin(), varBuffer.cend(), varBufferFloat.begin(),
158 [](
double v) { return static_cast<float>(v); });
161 const bool success = writeAsFloat ? writeArray(varBufferFloat) : writeArray(varBuffer);
163 string message =
"The DataReductionOperator " + this->
getName() +
" failed to write its data.";
164 bailout(
true, message, __FILE__, __LINE__);
173 dataSize =
sizeof(double);
188 grid, vlsv::Writer& vlsvWriter) {
191 if(grid.elements.size() == 0) {
196 std::map<std::string,std::string> attribs;
197 attribs[
"mesh"]=
"ionosphere";
199 attribs[
"unit"]=
unit;
207 if(grid.isCouplingInwards || grid.isCouplingOutwards) {
208 MPI_Comm_rank(grid.communicator,&rank);
210 MPI_Comm_rank(MPI_COMM_WORLD,&worldRank);
213 std::vector<Real> varBuffer =
lambda(grid);
215 int vectorSize = varBuffer.size() / grid.elements.size();
218 MPI_Bcast(&vectorSize, 1, MPI_INT, grid.writingRank, MPI_COMM_WORLD);
220 if(vlsvWriter.writeArray(
"VARIABLE", attribs,
"float", grid.elements.size(), vectorSize,
sizeof(
Real),
reinterpret_cast<const char*
>(varBuffer.data())) ==
false) {
221 string message =
"The DataReductionOperator " + this->
getName() +
" failed to write its data.";
222 bailout(
true, message, __FILE__, __LINE__);
226 MPI_Bcast(&vectorSize, 1, MPI_INT, grid.writingRank, MPI_COMM_WORLD);
229 vlsvWriter.writeArray(
"VARIABLE", attribs,
"float", 0, vectorSize,
sizeof(
Real),
nullptr);
239 dataSize =
sizeof(double);
245 dataSize =
sizeof(int);
270 grid, vlsv::Writer& vlsvWriter) {
278 if(grid.nodes.size() == 0) {
282 std::map<std::string,std::string> attribs;
283 attribs[
"mesh"]=
"ionosphere";
285 attribs[
"centering"]=
"node";
286 attribs[
"unit"]=
unit;
294 if(grid.isCouplingInwards || grid.isCouplingOutwards) {
295 MPI_Comm_rank(grid.communicator,&rank);
297 MPI_Comm_rank(MPI_COMM_WORLD,&worldRank);
300 std::vector<Real> varBuffer =
lambda(grid);
302 vectorSize = varBuffer.size() / grid.nodes.size();
305 MPI_Bcast(&vectorSize, 1, MPI_INT, grid.writingRank, MPI_COMM_WORLD);
307 if(vlsvWriter.writeArray(
"VARIABLE", attribs,
"float", grid.nodes.size(), vectorSize,
sizeof(
Real),
reinterpret_cast<const char*
>(varBuffer.data())) ==
false) {
308 string message =
"The DataReductionOperator " + this->
getName() +
" failed to write its data.";
309 bailout(
true, message, __FILE__, __LINE__);
313 MPI_Bcast(&vectorSize, 1, MPI_INT, grid.writingRank, MPI_COMM_WORLD);
316 vlsvWriter.writeArray(
"VARIABLE", attribs,
"float", 0, vectorSize,
sizeof(
Real),
nullptr);
330 if(grid.nodes.size() == 0) {
334 std::map<std::string,std::string> attribs;
335 attribs[
"mesh"]=
"ionosphere";
337 attribs[
"centering"]=
"node";
338 attribs[
"unit"]=
unit;
346 if(grid.isCouplingInwards || grid.isCouplingOutwards) {
347 MPI_Comm_rank(grid.communicator,&rank);
349 MPI_Comm_rank(MPI_COMM_WORLD,&worldRank);
352 std::vector<int> varBuffer =
lambda(grid);
354 vectorSize = varBuffer.size() / grid.nodes.size();
357 MPI_Bcast(&vectorSize, 1, MPI_INT, grid.writingRank, MPI_COMM_WORLD);
359 if(vlsvWriter.writeArray(
"VARIABLE", attribs,
"int", grid.nodes.size(), vectorSize,
sizeof(
int),
reinterpret_cast<const char*
>(varBuffer.data())) ==
false) {
360 string message =
"The DataReductionOperator " + this->
getName() +
" failed to write its data.";
361 bailout(
true, message, __FILE__, __LINE__);
365 MPI_Bcast(&vectorSize, 1, MPI_INT, grid.writingRank, MPI_COMM_WORLD);
368 vlsvWriter.writeArray(
"VARIABLE", attribs,
"int", 0, vectorSize,
sizeof(
int),
nullptr);
377 dataSize =
sizeof(
Real);
382 std::vector<Real> varBuffer =
lambda(cell);
384 assert(varBuffer.size() == (
unsigned int)
numFloats);
387 buffer[
i] = varBuffer[
i];
411 dataSize =
sizeof(
Real);
419 const char* ptr =
reinterpret_cast<const char*
>(
B);
420 for (uint
i = 0;
i < 3*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
428 if(!(std::isfinite(
B[0]) && std::isfinite(
B[1]) && std::isfinite(
B[2]))) {
429 string message =
"The DataReductionOperator " + this->
getName() +
" returned a nan or an inf.";
430 bailout(
true, message, __FILE__, __LINE__);
441 dataSize =
sizeof(int);
449 const char* ptr =
reinterpret_cast<const char*
>(&
mpiRank);
450 for (uint
i = 0;
i <
sizeof(int); ++
i) buffer[
i] = ptr[
i];
456 MPI_Comm_rank(MPI_COMM_WORLD,&intRank);
468 dataSize =
sizeof(int);
476 const char* ptr =
reinterpret_cast<const char*
>(&
boundaryType);
477 for (uint
i = 0;
i <
sizeof(int); ++
i) buffer[
i] = ptr[
i];
493 dataSize =
sizeof(int);
501 const char* ptr =
reinterpret_cast<const char*
>(&
boundaryLayer);
502 for (uint
i = 0;
i <
sizeof(int); ++
i) buffer[
i] = ptr[
i];
520 const char* ptr =
reinterpret_cast<const char*
>(&
epochs);
521 for (uint
i = 0;
i <
sizeof(int); ++
i) buffer[
i] = ptr[
i];
527 dataSize =
sizeof(uint32_t);
552 dataSize =
sizeof(float);
558 const char* ptr =
reinterpret_cast<const char*
>(&
error);
559 for (uint
i = 0;
i <
sizeof(int); ++
i) buffer[
i] = ptr[
i];
564 *buffer = 1.0 *
error;
581 dataSize =
sizeof(int);
589 const char* ptr =
reinterpret_cast<const char*
>(&
nBlocks);
590 for (uint
i = 0;
i <
sizeof(int); ++
i) buffer[
i] = ptr[
i];
612 dataSize =
sizeof(
Real);
618 const char* ptr =
reinterpret_cast<const char*
>(&
Pressure);
619 for (uint
i = 0;
i <
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
643 dataSize =
sizeof(
Real);
658 Real sum[3] = {0.0, 0.0, 0.0};
683 const char* ptr =
reinterpret_cast<const char*
>(&
PTensor);
684 for (uint
i = 0;
i < 3*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
692 for(
int i = 0;
i < 3;
i++) {
707 dataSize =
sizeof(
Real);
721 Real sum[3] = {0.0, 0.0, 0.0};
746 const char* ptr =
reinterpret_cast<const char*
>(&
PTensor);
747 for (uint
i = 0;
i < 3*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
755 for(
int i = 0;
i < 3;
i++) {
780 Real thread_n_sum = 0.0;
781 Real thermalV0 = thermalV[0];
782 Real thermalV1 = thermalV[1];
783 Real thermalV2 = thermalV[2];
800 if (((calculateNonthermal ==
true) &&
801 (( (thermalV0 -
VX) * (thermalV0 -
VX)
802 + (thermalV1 -
VY) * (thermalV1 -
VY)
803 + (thermalV2 -
VZ) * (thermalV2 -
VZ) )
804 > thermalRadius*thermalRadius))
806 ((calculateNonthermal ==
false) &&
807 (( (thermalV0 -
VX) * (thermalV0 -
VX)
808 + (thermalV1 -
VY) * (thermalV1 -
VY)
809 + (thermalV2 -
VZ) * (thermalV2 -
VZ) )
810 <= thermalRadius*thermalRadius) )) {
842 Real thermalV0 = thermalV[0];
843 Real thermalV1 = thermalV[1];
844 Real thermalV2 = thermalV[2];
862 if (((calculateNonthermal ==
true) &&
863 (( (thermalV0 -
VX) * (thermalV0 -
VX)
864 + (thermalV1 -
VY) * (thermalV1 -
VY)
865 + (thermalV2 -
VZ) * (thermalV2 -
VZ) )
866 > thermalRadius*thermalRadius))
868 ((calculateNonthermal ==
false) &&
869 (( (thermalV0 -
VX) * (thermalV0 -
VX)
870 + (thermalV1 -
VY) * (thermalV1 -
VY)
871 + (thermalV2 -
VZ) * (thermalV2 -
VZ) )
872 <= thermalRadius*thermalRadius) )) {
897 const bool calculateNonthermal,
898 const Real averageVX,
899 const Real averageVY,
900 const Real averageVZ,
916 Real thermalV0 = thermalV[0];
917 Real thermalV1 = thermalV[1];
918 Real thermalV2 = thermalV[2];
935 if (((calculateNonthermal ==
true) &&
936 (( (thermalV0 -
VX) * (thermalV0 -
VX)
937 + (thermalV1 -
VY) * (thermalV1 -
VY)
938 + (thermalV2 -
VZ) * (thermalV2 -
VZ) )
939 > thermalRadius*thermalRadius))
941 ((calculateNonthermal ==
false) &&
942 (( (thermalV0 -
VX) * (thermalV0 -
VX)
943 + (thermalV1 -
VY) * (thermalV1 -
VY)
944 + (thermalV2 -
VZ) * (thermalV2 -
VZ) )
945 <= thermalRadius*thermalRadius ))) {
946 lsum[0] += block_data[
cellIndex(
i,
j,
k)] * (
VX - averageVX) * (
VX - averageVX) * DV3;
947 lsum[1] += block_data[
cellIndex(
i,
j,
k)] * (
VY - averageVY) * (
VY - averageVY) * DV3;
948 lsum[2] += block_data[
cellIndex(
i,
j,
k)] * (
VZ - averageVZ) * (
VZ - averageVZ) * DV3;
962 const bool calculateNonthermal,
963 const Real averageVX,
964 const Real averageVY,
965 const Real averageVZ,
981 Real thermalVX = thermalV[0];
982 Real thermalVY = thermalV[1];
983 Real thermalVZ = thermalV[2];
1000 if (((calculateNonthermal ==
true) &&
1001 (( (thermalVX -
VX) * (thermalVX -
VX)
1002 + (thermalVY -
VY) * (thermalVY -
VY)
1003 + (thermalVZ -
VZ) * (thermalVZ -
VZ) )
1004 > thermalRadius*thermalRadius))
1006 ((calculateNonthermal ==
false) &&
1007 (( (thermalVX -
VX) * (thermalVX -
VX)
1008 + (thermalVY -
VY) * (thermalVY -
VY)
1009 + (thermalVZ -
VZ) * (thermalVZ -
VZ) )
1010 <= thermalRadius*thermalRadius ))) {
1011 lsum[0] += block_data[
cellIndex(
i,
j,
k)] * (
VX - averageVX) * (
VY - averageVY) * DV3;
1012 lsum[1] += block_data[
cellIndex(
i,
j,
k)] * (
VZ - averageVZ) * (
VX - averageVX) * DV3;
1013 lsum[2] += block_data[
cellIndex(
i,
j,
k)] * (
VY - averageVY) * (
VZ - averageVZ) * DV3;
1041 dataSize =
sizeof(
Real);
1042 vectorSize = (
doSkip ==
true) ? 0 : 1;
1047 const bool calculateNonthermal =
true;
1049 const char* ptr =
reinterpret_cast<const char*
>(&
RhoNonthermal);
1050 for (uint
i = 0;
i <
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1070 dataSize =
sizeof(
Real);
1071 vectorSize = (
doSkip ==
true) ? 0 : 1;
1076 const bool calculateNonthermal =
false;
1078 const char* ptr =
reinterpret_cast<const char*
>(&
RhoThermal);
1079 for (uint
i = 0;
i <
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1099 dataSize =
sizeof(
Real);
1100 vectorSize = (
doSkip ==
true) ? 0 : 3;
1105 const bool calculateNonthermal =
true;
1108 const uint VNonthermalSize = 3;
1109 const char* ptr =
reinterpret_cast<const char*
>(&
VNonthermal);
1110 for (uint
i = 0;
i < VNonthermalSize*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1116 for( uint
i = 0;
i < 3; ++
i ) {
1133 dataSize =
sizeof(
Real);
1134 vectorSize = (
doSkip ==
true) ? 0 : 3;
1139 const bool calculateNonthermal =
false;
1142 const uint vectorSize = 3;
1143 const char* ptr =
reinterpret_cast<const char*
>(&
VThermal);
1144 for (uint
i = 0;
i < vectorSize*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1150 for( uint
i = 0;
i < 3; ++
i ) {
1172 dataSize =
sizeof(
Real);
1173 vectorSize = (
doSkip ==
true) ? 0 : 3;
1178 const bool calculateNonthermal =
true;
1181 const uint vectorSize = 3;
1183 const char* ptr =
reinterpret_cast<const char*
>(&
PTensor);
1184 for (uint
i = 0;
i < vectorSize*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1191 const bool calculateNonthermal =
true;
1197 const uint vectorSize = 3;
1198 for(uint
i = 0;
i < vectorSize;
i++) {
1220 dataSize =
sizeof(
Real);
1221 vectorSize = (
doSkip ==
true) ? 0 : 3;
1226 const bool calculateNonthermal =
false;
1229 const uint vectorSize = 3;
1231 const char* ptr =
reinterpret_cast<const char*
>(&
PTensor);
1232 for (uint
i = 0;
i < vectorSize*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1239 const bool calculateNonthermal =
false;
1245 const uint vectorSize = 3;
1246 for(uint
i = 0;
i < vectorSize;
i++) {
1262 dataSize =
sizeof(
Real);
1263 vectorSize = (
doSkip ==
true) ? 0 : 3;
1269 const bool calculateNonthermal =
true;
1272 const uint vectorSize = 3;
1274 const char* ptr =
reinterpret_cast<const char*
>(&
PTensor);
1275 for (uint
i = 0;
i < vectorSize*
sizeof(
Real); ++
i) {
1284 const bool calculateNonthermal =
true;
1290 for(
int i = 0;
i < 3;
i++) {
1306 dataSize =
sizeof(
Real);
1307 vectorSize = (
doSkip ==
true) ? 0 : 3;
1313 const bool calculateNonthermal =
false;
1316 const uint vectorSize = 3;
1318 const char* ptr =
reinterpret_cast<const char*
>(&
PTensor);
1319 for (uint
i = 0;
i < vectorSize*
sizeof(
Real); ++
i) {
1328 const bool calculateNonthermal =
false;
1334 for(
int i = 0;
i < 3;
i++) {
1348 dataSize =
sizeof(
Real);
1358 const char* ptr =
reinterpret_cast<const char*
>(&dummy);
1359 for (uint
i = 0;
i <
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1397 dataSize =
sizeof(
Real);
1406 std::vector<Real> sumWeights(
nChannels,0.0);
1408 std::array<Real,3> B;
1416 creal normB =
sqrt(B[0]*B[0] + B[1]*B[1] + B[2]*B[2]);
1417 for (uint
i=0;
i<3;
i++){
1423 for (uint
i=0;
i<3;
i++){
1436 std::vector<Real> sum(2 *
nChannels,0.0);
1459 Real countAndGate =
floor(VdotB_norm/cosAngle);
1460 countAndGate =
max(0.,countAndGate);
1464 int binNumber = round((log(energy) - log(eminLocal)) / log(emaxLocal/eminLocal) * (nChannelsLocal-1));
1465 binNumber =
max(binNumber,0);
1466 binNumber =
min(binNumber,nChannelsLocal-1);
1469 lsum[nChannelsLocal + binNumber] += countAndGate * DV3;
1481 if (sumWeights[
i] != 0) {
1486 const char* ptr =
reinterpret_cast<const char*
>(
dataDiffFlux.data());
1498 if( vlsvWriter.writeParameter(
popName+
"_PrecipitationCentreEnergy"+std::to_string(
i), &channelev) ==
false ) {
return false; }
1500 if( vlsvWriter.writeParameter(
popName+
"_LossConeAngle", &
lossConeAngle) ==
false ) {
return false; }
1516 dataSize =
sizeof(
Real);
1524 std::vector<Real> fmu(
nBins,0.0);
1542 const Real b0 =
B0/Bnorm;
1543 const Real b1 = B1/Bnorm;
1544 const Real b2 = B2/Bnorm;
1545 const int nBins_lambda =
nBins;
1573 const char* ptr =
reinterpret_cast<const char*
>(fmu.data());
1574 for (uint
i = 0;
i <
nBins*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1610 dataSize =
sizeof(
Real);
1619 std::vector<Real> sumWeights(
nChannels,0.0);
1621 std::array<Real,3> B;
1627 creal normB =
sqrt(B[0]*B[0] + B[1]*B[1] + B[2]*B[2]);
1628 for (uint
i=0;
i<3;
i++){
1634 for (uint
i=0;
i<3;
i++){
1647 std::vector<Real> sum(2 *
nChannels,0.0);
1670 BnormV[1] = B1 *
normV;
1671 BnormV[2] = B2 *
normV;
1674 bool xGateCrit, yGateCrit, zGateCrit;
1678 xGateCrit = (BnormV[0] - (
VX -
HALF*_DVX)) * (BnormV[0] - (
VX +
HALF*_DVX)) <= 0;
1679 yGateCrit = (BnormV[1] - (
VY -
HALF*_DVY)) * (BnormV[1] - (
VY +
HALF*_DVY)) <= 0;
1680 zGateCrit = (BnormV[2] - (
VZ -
HALF*_DVZ)) * (BnormV[2] - (
VZ +
HALF*_DVZ)) <= 0;
1681 bool xyzGateCrit = xGateCrit && yGateCrit && zGateCrit;
1682 Real countAndGate = (
Real) xyzGateCrit;
1686 int binNumber = round((log(energy) - log(eminLocal)) / log(emaxLocal/eminLocal) * (nChannelsLocal-1));
1687 binNumber =
max(binNumber,0);
1688 binNumber =
min(binNumber,nChannelsLocal-1);
1691 lsum[nChannelsLocal + binNumber] += countAndGate * DV3;
1703 if (sumWeights[
i] != 0) {
1720 if( vlsvWriter.writeParameter(
popName+
"_PrecipitationCentreEnergyLine"+std::to_string(
i), &channelev) ==
false ) {
return false; }
1751 dataSize =
sizeof(
Real);
1766 Real sum[3] = {0.0, 0.0, 0.0};
1785 lsum[0] += block_data[
cellIndex(
i,
j,
k)] * ENERGY * DV3;
1786 if (ENERGY > E1limitLocal) lsum[1] += block_data[
cellIndex(
i,
j,
k)] * ENERGY * DV3;
1787 if (ENERGY > E2limitLocal) lsum[2] += block_data[
cellIndex(
i,
j,
k)] * ENERGY * DV3;
1802 const char* ptr =
reinterpret_cast<const char*
>(&
EDensity);
1803 for (uint
i = 0;
i < 3*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1808 for(
int i = 0;
i < 3;
i++) {
1821 if( vlsvWriter.writeParameter(
popName+
"_EnergyDensityESW", &swe) ==
false ) {
return false; }
1822 if( vlsvWriter.writeParameter(
popName+
"_EnergyDensityELimit1", &e1l) ==
false ) {
return false; }
1823 if( vlsvWriter.writeParameter(
popName+
"_EnergyDensityELimit2", &e2l) ==
false ) {
return false; }
1838 dataSize =
sizeof(
Real);
1855 Real sum[3] = {0.0, 0.0, 0.0};
1881 const char* ptr =
reinterpret_cast<const char*
>(&
HeatFlux);
1882 for (uint
i = 0;
i < 3*
sizeof(
Real); ++
i) buffer[
i] = ptr[
i];
1890 for(
int i = 0;
i < 3;
i++) {
1922 unsigned int& vectorSize)
const {
1924 dataSize =
sizeof(
Real);
1944 Real thread_epsilon_sum = 0.0;
1973 const Real V_par = (
VX - VX0) * b_parX + (
VY - VY0) * b_parY + (
VZ - VZ0) * b_parZ;
1974 const Real V_perp1 = (
VX - VX0) * b_perp1X + (
VY - VY0) * b_perp1Y + (
VZ - VZ0) * b_perp1Z;
1975 const Real V_perp2 = (
VX - VX0) * b_perp2X + (
VY - VY0) * b_perp2Y + (
VZ - VZ0) * b_perp2Z;
1977 const Real bimaxwellian = rho_local /
sqrt(M_PI * M_PI * M_PI * V_par_th_sq * V_par_th_sq * V_par_th_sq) *
1978 (T_par_local / T_perp_local) *
1979 exp(-(V_par * V_par) / V_par_th_sq -
1980 (V_perp1 * V_perp1 + V_perp2 * V_perp2) / (V_par_th_sq * T_perp_local / T_par_local));
1982 lthread_epsilon_sum[0] +=
1983 (
abs(block_data[
cellIndex(
i,
j,
k)] - bimaxwellian) - bimaxwellian) * DV3;
1984 }, thread_epsilon_sum);
1993 const char* ptr =
reinterpret_cast<const char*
>(&
epsilon);
1994 for (uint
i = 0;
i <
sizeof(
Real); ++
i)
2013 Real PTensor[3] = {};
2019 Real norm_par =
sqrt(BX * BX + BY * BY + BZ * BZ);
2020 b_par[0] = BX / norm_par;
2021 b_par[1] = BY / norm_par;
2022 b_par[2] = BZ / norm_par;
2030 if (!(norm_perp1 > 0.0)) {
2061 Real sum[3] = {0.0, 0.0, 0.0};
2087 const Real V_par = (
VX - VX0) * b_parX + (
VY - VY0) * b_parY + (
VZ - VZ0) * b_parZ;
2088 const Real V_perp1 = (
VX - VX0) * b_perp1X + (
VY - VY0) * b_perp1Y + (
VZ - VZ0) * b_perp1Z;
2089 const Real V_perp2 = (
VX - VX0) * b_perp2X + (
VY - VY0) * b_perp2Y + (
VZ - VZ0) * b_perp2Z;
2091 lsum[0] += block_data[
cellIndex(
i,
j,
k)] * V_par * V_par * DV3;
2092 lsum[1] += block_data[
cellIndex(
i,
j,
k)] * V_perp1 * V_perp1 * DV3;
2093 lsum[2] += block_data[
cellIndex(
i,
j,
k)] * V_perp2 * V_perp2 * DV3;
sqrt(1.0+vA *vA/(c *c))) % Ion-acoustic wave cS
#define ARCH_INNER_BODY(...)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual std::string getName() const
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceDiagnostic(const SpatialCell *cell, Real *buffer)
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual std::string getName() const
virtual bool setSpatialCell(const SpatialCell *cell)
DataReductionOperatorBVOLDerivatives(const std::string &name, const unsigned int parameterIndex, const unsigned int vectorSize)
virtual bool setSpatialCell(const SpatialCell *cell)
DataReductionOperatorCellParams(const std::string &name, const unsigned int parameterIndex, const unsigned int vectorSize)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual std::string getName() const
virtual ~DataReductionOperatorCellParams()
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceDiagnostic(const SpatialCell *cell, Real *result)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceDiagnostic(const SpatialCell *cell, Real *result)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool writeFsGridData(const FieldSolverData &fieldSolverData, const std::string &meshName, vlsv::Writer &vlsvWriter, const bool writeAsFloat=false)
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
DataReductionOperatorHasParameters()
virtual bool reduceDiagnostic(const SpatialCell *cell, Real *result)
virtual std::string getName() const =0
std::string variableLaTeX
virtual ~DataReductionOperator()
std::string unitConversion
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool writeIonosphereData(SBC::SphericalTriGrid &grid, vlsv::Writer &vlsvWriter)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual std::string getName() const
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceDiagnostic(const SpatialCell *cell, Real *result)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual std::string getName() const
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceDiagnostic(const SpatialCell *cell, Real *result)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool writeIonosphereData(SBC::SphericalTriGrid &grid, vlsv::Writer &vlsvWriter)
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool reduceDiagnostic(const SpatialCell *cell, Real *result)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool writeIonosphereData(SBC::SphericalTriGrid &grid, vlsv::Writer &vlsvWriter)
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceDiagnostic(const SpatialCell *cell, Real *buffer)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool reduceDiagnostic(const SpatialCell *cell, Real *buffer)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual std::string getName() const
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual std::string getName() const
virtual bool reduceDiagnostic(const spatial_cell::SpatialCell *cell, Real *result)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual ~VariableEffectiveSparsityThreshold()
VariableEffectiveSparsityThreshold(cuint popID)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual std::string getName() const
virtual std::string getName() const
virtual bool writeParameters(vlsv::Writer &vlsvWriter)
virtual bool setSpatialCell(const SpatialCell *cell)
VariableEnergyDensity(cuint popID)
Energy density Calculates the energy density of particles in three bins: total energy density,...
virtual ~VariableEnergyDensity()
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual ~VariableHeatFluxVector()
VariableHeatFluxVector(cuint popID)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual std::string getName() const
VariableMuSpace(cuint popID)
V-space flatten into 1D mu distribution.
virtual bool setSpatialCell(const SpatialCell *cell)
virtual ~VariableMuSpace()
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool writeParameters(vlsv::Writer &vlsvWriter)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool setSpatialCell(const SpatialCell *cell)
virtual ~VariableNonMaxwellianity()
virtual std::string getName() const
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
VariableNonMaxwellianity(cuint popID)
Non-Maxwellianity Calculates for a population the dimensionless parameter defined by Graham et al....
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual std::string getName() const
virtual ~VariablePTensorDiagonal()
virtual bool reduceData(const SpatialCell *cell, char *buffer)
VariablePTensorDiagonal(cuint popID)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual std::string getName() const
VariablePTensorNonthermalDiagonal(cuint popID)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual ~VariablePTensorNonthermalDiagonal()
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual std::string getName() const
VariablePTensorNonthermalOffDiagonal(cuint popID)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual ~VariablePTensorNonthermalOffDiagonal()
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
VariablePTensorOffDiagonal(cuint popID)
virtual ~VariablePTensorOffDiagonal()
virtual bool setSpatialCell(const SpatialCell *cell)
virtual std::string getName() const
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual std::string getName() const
VariablePTensorThermalDiagonal(cuint popID)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual ~VariablePTensorThermalDiagonal()
virtual ~VariablePTensorThermalOffDiagonal()
virtual bool setSpatialCell(const SpatialCell *cell)
VariablePTensorThermalOffDiagonal(cuint popID)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool writeParameters(vlsv::Writer &vlsvWriter)
std::vector< Real > channels
std::vector< Real > dataDiffFlux
virtual bool setSpatialCell(const SpatialCell *cell)
VariablePrecipitationDiffFlux(cuint popID)
Precipitation directional differential number flux (within loss cone) Evaluation of the precipitating...
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual ~VariablePrecipitationDiffFlux()
virtual std::string getName() const
std::vector< Real > channels
virtual ~VariablePrecipitationLineDiffFlux()
virtual bool setSpatialCell(const SpatialCell *cell)
std::vector< Real > dataLineDiffFlux
VariablePrecipitationLineDiffFlux(cuint popID)
Precipitation directional differential number flux (along line) Evaluation of the precipitating diffe...
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool writeParameters(vlsv::Writer &vlsvWriter)
virtual std::string getName() const
virtual ~VariablePressureSolver()
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
VariableRhoNonthermal(cuint popID)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual std::string getName() const
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual ~VariableRhoNonthermal()
virtual bool setSpatialCell(const SpatialCell *cell)
virtual std::string getName() const
virtual ~VariableRhoThermal()
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
VariableRhoThermal(cuint popID)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual bool setSpatialCell(const SpatialCell *cell)
virtual ~VariableVNonthermal()
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
VariableVNonthermal(cuint popID)
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual std::string getName() const
virtual bool getDataVectorInfo(std::string &dataType, unsigned int &dataSize, unsigned int &vectorSize) const
virtual std::string getName() const
virtual bool reduceData(const SpatialCell *cell, char *buffer)
virtual ~VariableVThermal()
virtual bool setSpatialCell(const SpatialCell *cell)
VariableVThermal(cuint popID)
vmesh::LocalID get_number_of_velocity_blocks(const uint popID) const
vmesh::VelocityBlockContainer * get_velocity_blocks(const size_t &popID)
Real getVelocityBlockMinValue(const uint popID) const
std::array< Real, bvolderivatives::N_BVOL_DERIVATIVES > derivativesBVOL
Population & get_population(const uint popID)
std::array< Real, CellParams::N_SPATIAL_CELL_PARAMS > parameters
vmesh::VelocityBlockContainer * dev_get_velocity_blocks(const size_t &popID)
ARCH_HOSTDEV Real * getParameters()
ARCH_HOSTDEV Realf * getData()
void bailout(const bool condition, const std::string &message, const char *const file, const int line)
A function to stop the simulation if the boolean condition is true. Raises a flag which gets MPI_Redu...
__global__ void size_t const vmesh::VelocityBlockContainer *__restrict__ const Real Real Real Real Realf int Real const Real dmubins
ObjectWrapper & getObjectWrapper()
static void VNonthermalCalculation(const SpatialCell *cell, const bool calculateNonthermal, cuint popID, Real *V)
static void PTensorOffDiagonalNonthermalCalculations(const SpatialCell *cell, const bool calculateNonthermal, const Real averageVX, const Real averageVY, const Real averageVZ, cuint popID, Real *PTensor)
static void PTensorDiagonalNonthermalCalculations(const SpatialCell *cell, const bool calculateNonthermal, const Real averageVX, const Real averageVY, const Real averageVZ, cuint popID, Real *PTensor)
static void rhoNonthermalCalculation(const SpatialCell *cell, const bool calculateNonthermal, cuint popID, Real &rho)
static void parallel_reduce(const uint(&limits)[NDim], Lambda loop_body, T &sum)
std::vector< species::Species > particleSpecies
static std::vector< std::string > systemWriteName
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)
static ARCH_HOSTDEV VecSimple< T > abs(const VecSimple< T > &l)
static ARCH_HOSTDEV VecSimple< T > floor(VecSimple< T > const &a)