Skip to content

Commit 551fc29

Browse files
authored
Merge pull request boutproject#3085 from boutproject/fci-io
Small updates for FCI output
2 parents e8e5845 + 91ddbfd commit 551fc29

5 files changed

Lines changed: 24 additions & 16 deletions

File tree

include/bout/coordinates.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
*
1010
*
1111
**************************************************************************
12-
* Copyright 2014 B.D.Dudson
12+
* Copyright 2014-2025 BOUT++ contributors
1313
*
14-
* Contact: Ben Dudson, bd512@york.ac.uk
14+
* Contact: Ben Dudson, dudson2@llnl.gov
1515
*
1616
* This file is part of BOUT++.
1717
*

include/bout/mesh.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
* * Incorporates code from topology.cpp and Communicator
1818
*
1919
**************************************************************************
20-
* Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu
20+
* Copyright 2010-2025 BOUT++ contributors
2121
*
22-
* Contact: Ben Dudson, bd512@york.ac.uk
22+
* Contact: Ben Dudson, dudson2@llnl.gov
2323
*
2424
* This file is part of BOUT++.
2525
*

src/mesh/impls/bout/boutmesh.cxx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22
* Implementation of the Mesh class, handling input files compatible with
33
* BOUT / BOUT-06.
44
*
5-
* Changelog
6-
* ---------
7-
*
8-
* 2015-01 Ben Dudson <benjamin.dudson@york.ac.uk>
9-
* *
10-
*
11-
* 2010-05 Ben Dudson <bd512@york.ac.uk>
12-
* * Initial version, adapted from grid.cpp and topology.cpp
13-
*
145
**************************************************************************
15-
* Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu
6+
* Copyright 2010-2025 BOUT++ contributors
167
*
17-
* Contact: Ben Dudson, bd512@york.ac.uk
8+
* Contact: Ben Dudson, dudson2@llnl.gov
189
*
1910
* This file is part of BOUT++.
2011
*

src/mesh/parallel/fci.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,9 @@ void FCITransform::integrateParallelSlices(Field3D& f) {
346346
f.ynext(map.offset) = map.integrate(f);
347347
}
348348
}
349+
350+
void FCITransform::outputVars(Options& output_options) {
351+
// Real-space coordinates of grid points
352+
output_options["R"].force(R, "FCI");
353+
output_options["Z"].force(Z, "FCI");
354+
}

src/mesh/parallel/fci.hxx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,15 @@ public:
7373
FCITransform() = delete;
7474
FCITransform(Mesh& mesh, const Coordinates::FieldMetric& dy, bool zperiodic = true,
7575
Options* opt = nullptr)
76-
: ParallelTransform(mesh, opt) {
76+
: ParallelTransform(mesh, opt), R{&mesh}, Z{&mesh} {
7777

7878
// check the coordinate system used for the grid data source
7979
FCITransform::checkInputGrid();
8080

81+
// Real-space coordinates of grid cells
82+
mesh.get(R, "R", 0.0, false);
83+
mesh.get(Z, "Z", 0.0, false);
84+
8185
auto forward_boundary_xin =
8286
std::make_shared<BoundaryRegionPar>("FCI_forward", BNDRY_PAR_FWD_XIN, +1, &mesh);
8387
auto backward_boundary_xin = std::make_shared<BoundaryRegionPar>(
@@ -142,6 +146,10 @@ public:
142146

143147
bool canToFromFieldAligned() const override { return false; }
144148

149+
/// Save mesh variables to output
150+
/// If R and Z(x,y,z) coordinates are in the input then these are saved to output.
151+
void outputVars(Options& output_options) override;
152+
145153
bool requiresTwistShift(bool UNUSED(twist_shift_enabled),
146154
[[maybe_unused]] YDirectionType ytype) override {
147155
// No Field3Ds require twist-shift, because they cannot be field-aligned
@@ -156,6 +164,9 @@ protected:
156164
private:
157165
/// FCI maps for each of the parallel slices
158166
std::vector<FCIMap> field_line_maps;
167+
168+
/// Real-space coordinates of grid points
169+
Field3D R, Z;
159170
};
160171

161172
#endif // BOUT_FCITRANSFORM_H

0 commit comments

Comments
 (0)