Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fsgrid testing and restructuring #1062

Open
wants to merge 29 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
67d6776
Update fsgrid submodule
cscjlan Aug 23, 2024
ca755fd
Update fsgrid, change member call to static call
cscjlan Aug 23, 2024
3edea1c
Update submodule
cscjlan Aug 23, 2024
e4b3c5a
Update submodule
cscjlan Aug 23, 2024
66afd7c
Change arrays to const
cscjlan Aug 26, 2024
21793ab
Revert "Change arrays to const"
cscjlan Aug 26, 2024
ba20fbf
Update submodule CI
cscjlan Aug 26, 2024
db70016
Update fsgrid; Change function call
cscjlan Aug 27, 2024
b3dffa9
Update fsgrid submodule; Update function call
cscjlan Aug 27, 2024
13f1d3d
Update submodule
cscjlan Aug 27, 2024
e0be8a4
Update submodule
cscjlan Aug 28, 2024
c0f2221
Update submodule
cscjlan Sep 9, 2024
5e08c69
Fix function calls; Update fsgrid
cscjlan Oct 16, 2024
784c4ad
Fix function calls;
cscjlan Oct 16, 2024
2354f88
Fix index type; Update fsgrid
cscjlan Oct 17, 2024
00c2415
Use a vector for filtering instead of a full grid
cscjlan Oct 17, 2024
6741272
Update fsgrid; Update FsGrid construction: grid spacing and physical …
cscjlan Oct 17, 2024
429b3e4
Change mut refs to const refs
cscjlan Oct 17, 2024
7904883
FsGrid members changed to private: Update vlasiator to use a getter f…
cscjlan Oct 17, 2024
0481020
Rename function; Update fsgrid
cscjlan Oct 17, 2024
0930ff1
Update fsgrid
cscjlan Oct 18, 2024
7676de8
Update fsgrid
cscjlan Oct 21, 2024
dffc399
Fix function call to updated fsgrid; Make const things const
cscjlan Oct 29, 2024
a84dc85
Update submodule
cscjlan Nov 8, 2024
bed9a89
Change filterMoments to index into data vectors instead of using getters
cscjlan Nov 8, 2024
aa27366
Update submodule
cscjlan Nov 8, 2024
a8bc111
Update submodule; Pass fsgrid size to fsgrid
cscjlan Nov 12, 2024
fb33e57
Update submodule
cscjlan Nov 12, 2024
dbe942c
Update fsgrid
cscjlan Nov 18, 2024
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
5 changes: 1 addition & 4 deletions backgroundfield/backgroundfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ void setBackgroundField(
for (FsGridTools::FsIndex_t x = 0; x < localSize[0]; ++x) {
phiprof::Timer loopTopTimer {loopTopId};
std::array<double, 3> start = BgBGrid.getPhysicalCoords(x, y, z);
double dx[3];
dx[0] = BgBGrid.DX;
dx[1] = BgBGrid.DY;
dx[2] = BgBGrid.DZ;
const auto& dx = BgBGrid.getGridSpacing();
double end[3];
end[0]=start[0]+dx[0];
end[1]=start[1]+dx[1];
Expand Down
5 changes: 1 addition & 4 deletions backgroundfield/backgroundfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ template<long unsigned int numFields> void setPerturbedField(
for (FsGridTools::FsIndex_t y = 0; y < localSize[1]; ++y) {
for (FsGridTools::FsIndex_t x = 0; x < localSize[0]; ++x) {
std::array<double, 3> start = BGrid.getPhysicalCoords(x, y, z);
double dx[3];
dx[0] = BGrid.DX;
dx[1] = BGrid.DY;
dx[2] = BGrid.DZ;
const auto dx = BGrid.getGridSpacing();

//Face averages
for(uint fComponent=0; fComponent<3; fComponent++){
Expand Down
4,581 changes: 2,310 additions & 2,271 deletions datareduction/datareducer.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion datareduction/datareductionoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ namespace DRO {
std::vector<double> varBuffer =
lambda(perBGrid,EGrid,EHallGrid,EGradPeGrid,momentsGrid,dPerBGrid,dMomentsGrid,BgBGrid,volGrid,technicalGrid);

std::array<FsGridTools::FsIndex_t,3>& gridSize = technicalGrid.getLocalSize();
const auto& gridSize = technicalGrid.getLocalSize();
int vectorSize;

// Check if there is anything to write (eg, we are a non-FS process)
Expand Down
13 changes: 10 additions & 3 deletions fieldsolver/derivatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,16 @@ void calculateCurvature(
rght_z_by /= rght_z_bnorm;
rght_z_bz /= rght_z_bnorm;

vol->at(fsgrids::volfields::CURVATUREX) = bx * 0.5*(rght_x_bx-left_x_bx) / technicalGrid.DX + by * 0.5*(rght_y_bx-left_y_bx) / technicalGrid.DY + bz * 0.5*(rght_z_bx-left_z_bx) / technicalGrid.DZ;
vol->at(fsgrids::volfields::CURVATUREY) = bx * 0.5*(rght_x_by-left_x_by) / technicalGrid.DX + by * 0.5*(rght_y_by-left_y_by) / technicalGrid.DY + bz * 0.5*(rght_z_by-left_z_by) / technicalGrid.DZ;
vol->at(fsgrids::volfields::CURVATUREZ) = bx * 0.5*(rght_x_bz-left_x_bz) / technicalGrid.DX + by * 0.5*(rght_y_bz-left_y_bz) / technicalGrid.DY + bz * 0.5*(rght_z_bz-left_z_bz) / technicalGrid.DZ;
const auto& gridSpacing = technicalGrid.getGridSpacing();
vol->at(fsgrids::volfields::CURVATUREX) = bx * 0.5 * (rght_x_bx - left_x_bx) / gridSpacing[0] +
by * 0.5 * (rght_y_bx - left_y_bx) / gridSpacing[1] +
bz * 0.5 * (rght_z_bx - left_z_bx) / gridSpacing[2];
vol->at(fsgrids::volfields::CURVATUREY) = bx * 0.5 * (rght_x_by - left_x_by) / gridSpacing[0] +
by * 0.5 * (rght_y_by - left_y_by) / gridSpacing[1] +
bz * 0.5 * (rght_z_by - left_z_by) / gridSpacing[2];
vol->at(fsgrids::volfields::CURVATUREZ) = bx * 0.5 * (rght_x_bz - left_x_bz) / gridSpacing[0] +
by * 0.5 * (rght_y_bz - left_y_bz) / gridSpacing[1] +
bz * 0.5 * (rght_z_bz - left_z_bz) / gridSpacing[2];
}
}

Expand Down
27 changes: 17 additions & 10 deletions fieldsolver/fs_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,10 @@ std::array<Real, 3> interpolateCurlB(
std::array<Real,3> cell;
std::array<int,3> fsc,lfsc;
// Convert physical coordinate to cell index
cell[0] = (x[0] - P::xmin) / technicalGrid.DX;
cell[1] = (x[1] - P::ymin) / technicalGrid.DY;
cell[2] = (x[2] - P::zmin) / technicalGrid.DZ;
const auto& gridSpacing = technicalGrid.getGridSpacing();
cell[0] = (x[0] - P::xmin) / gridSpacing[0];
cell[1] = (x[1] - P::ymin) / gridSpacing[1];
cell[2] = (x[2] - P::zmin) / gridSpacing[2];
for(int c=0; c<3; c++) {
fsc[c] = floor(cell[c]);
}
Expand Down Expand Up @@ -469,13 +470,19 @@ std::array<Real, 3> interpolateCurlB(

// Calc rotB
std::array<Real, 3> rotB;
rotB[0] += (volgrid.get(lfsc[0]+xoffset,lfsc[1]+yoffset,lfsc[2]+zoffset)->at(fsgrids::dPERBZVOLdy)
- volgrid.get(lfsc[0]+xoffset,lfsc[1]+yoffset,lfsc[2]+zoffset)->at(fsgrids::dPERBYVOLdz)) / volgrid.DX;
rotB[1] += (volgrid.get(lfsc[0]+xoffset,lfsc[1]+yoffset,lfsc[2]+zoffset)->at(fsgrids::dPERBXVOLdz)
- volgrid.get(lfsc[0]+xoffset,lfsc[1]+yoffset,lfsc[2]+zoffset)->at(fsgrids::dPERBZVOLdx)) / volgrid.DX;
rotB[2] += (volgrid.get(lfsc[0]+xoffset,lfsc[1]+yoffset,lfsc[2]+zoffset)->at(fsgrids::dPERBYVOLdx)
- volgrid.get(lfsc[0]+xoffset,lfsc[1]+yoffset,lfsc[2]+zoffset)->at(fsgrids::dPERBXVOLdy)) / volgrid.DX;

const auto& gridSpacing = volgrid.getGridSpacing();
rotB[0] +=
(volgrid.get(lfsc[0] + xoffset, lfsc[1] + yoffset, lfsc[2] + zoffset)->at(fsgrids::dPERBZVOLdy) -
volgrid.get(lfsc[0] + xoffset, lfsc[1] + yoffset, lfsc[2] + zoffset)->at(fsgrids::dPERBYVOLdz)) /
gridSpacing[0];
rotB[1] +=
(volgrid.get(lfsc[0] + xoffset, lfsc[1] + yoffset, lfsc[2] + zoffset)->at(fsgrids::dPERBXVOLdz) -
volgrid.get(lfsc[0] + xoffset, lfsc[1] + yoffset, lfsc[2] + zoffset)->at(fsgrids::dPERBZVOLdx)) /
gridSpacing[0];
rotB[2] +=
(volgrid.get(lfsc[0] + xoffset, lfsc[1] + yoffset, lfsc[2] + zoffset)->at(fsgrids::dPERBYVOLdx) -
volgrid.get(lfsc[0] + xoffset, lfsc[1] + yoffset, lfsc[2] + zoffset)->at(fsgrids::dPERBXVOLdy)) /
gridSpacing[0];
}
}
}
Expand Down
Loading
Loading