Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion examples/conduction-snb/conduction-snb.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(int argc, char** argv) {
Options::root()["Div_Q"] = Div_Q;
Options::root()["Div_Q_SH"] = Div_Q_SH;

bout::writeDefaultOutputFile();
bout::writeDefaultOutputFile(opt);

BoutFinalise();
return 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/dalf3/dalf3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ class DALF3 : public PhysicsModel {
//////////////////////////////////////////////////////////////
// Options

auto globalOptions = Options::root();
auto options = globalOptions["dalf3"];
auto& globalOptions = Options::root();
auto& options = globalOptions["dalf3"];

split_n0 = options["split_n0"].withDefault(false);
estatic = options["estatic"].withDefault(false);
Expand Down
24 changes: 15 additions & 9 deletions examples/fci-wave/fci-wave.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#include "bout/parallel_boundary_region.hxx"
#include "bout/physicsmodel.hxx"

class FCIwave : public PhysicsModel {
Expand Down Expand Up @@ -31,9 +32,9 @@ class FCIwave : public PhysicsModel {
const Field3D& B_next = Bxyz.ynext(reg->dir);

for (reg->first(); !reg->isDone(); reg->next()) {
f_B_next(reg->x, reg->y + reg->dir, reg->z) =
f_next(reg->x, reg->y + reg->dir, reg->z)
/ B_next(reg->x, reg->y + reg->dir, reg->z);
f_B_next(reg->ind().x(), reg->ind().y() + reg->dir, reg->ind().z()) =
f_next(reg->ind().x(), reg->ind().y() + reg->dir, reg->ind().z())
/ B_next(reg->ind().x(), reg->ind().y() + reg->dir, reg->ind().z());
}
}

Expand Down Expand Up @@ -131,16 +132,21 @@ class FCIwave : public PhysicsModel {
// Note: If evolving density, this should interpolate logn
// but neumann boundaries are used here anyway.
BoutReal n_b =
0.5 * (n_next(reg->x, reg->y + reg->dir, reg->z) + n(reg->x, reg->y, reg->z));
0.5
* (n_next(reg->ind().x(), reg->ind().y() + reg->dir, reg->ind().z())
+ n(reg->ind().x(), reg->ind().y(), reg->ind().z()));
// Velocity at the boundary
BoutReal v_b =
0.5 * (v_next(reg->x, reg->y + reg->dir, reg->z) + v(reg->x, reg->y, reg->z));
0.5
* (v_next(reg->ind().x(), reg->ind().y() + reg->dir, reg->ind().z())
+ v(reg->ind().x(), reg->ind().y(), reg->ind().z()));

nv_next(reg->x, reg->y + reg->dir, reg->z) =
2. * n_b * v_b - nv(reg->x, reg->y, reg->z);
nv_next(reg->ind().x(), reg->ind().y() + reg->dir, reg->ind().z()) =
2. * n_b * v_b - nv(reg->ind().x(), reg->ind().y(), reg->ind().z());

momflux_next(reg->x, reg->y + reg->dir, reg->z) =
2. * n_b * v_b * v_b - momflux(reg->x, reg->y, reg->z);
momflux_next(reg->ind().x(), reg->ind().y() + reg->dir, reg->ind().z()) =
2. * n_b * v_b * v_b
- momflux(reg->ind().x(), reg->ind().y(), reg->ind().z());
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/laplacexy/alfven-wave/alfven.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Alfven : public PhysicsModel {
int init(bool UNUSED(restarting)) {

// Normalisation
auto opt = Options::root()["alfven"];
auto& opt = Options::root()["alfven"];
Tnorm = opt["Tnorm"].withDefault(100); // Reference temperature [eV]
Nnorm = opt["Nnorm"].withDefault(1e19); // Reference density [m^-3]
Bnorm = opt["Bnorm"].withDefault(1.0); // Reference magnetic field [T]
Expand Down
2 changes: 1 addition & 1 deletion examples/laplacexy/laplace_perp/test.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main(int argc, char** argv) {
Options::root()["input"] = input;
Options::root()["solved"] = solved;

bout::writeDefaultOutputFile();
bout::writeDefaultOutputFile(Options::root());

BoutFinalise();
return 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/performance/bracket/bracket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ int main(int argc, char** argv) {
std::vector<Duration> times;

// Get options root
auto globalOptions = Options::root();
auto modelOpts = globalOptions["performance"];
auto& globalOptions = Options::root();
auto& modelOpts = globalOptions["performance"];
int NUM_LOOPS;
NUM_LOOPS = modelOpts["NUM_LOOPS"].withDefault(100);
bool profileMode, includeHeader, do2D3D, do3D3D;
Expand Down
4 changes: 2 additions & 2 deletions examples/performance/ddx/ddx.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ int main(int argc, char** argv) {
std::vector<Duration> times;

//Get options root
auto globalOptions = Options::root();
auto modelOpts = globalOptions["performanceIterator"];
auto& globalOptions = Options::root();
auto& modelOpts = globalOptions["performanceIterator"];
int NUM_LOOPS;
NUM_LOOPS = modelOpts["NUM_LOOPS"].withDefault(100);
bool profileMode, includeHeader;
Expand Down
4 changes: 2 additions & 2 deletions examples/performance/ddy/ddy.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ int main(int argc, char** argv) {
std::vector<Duration> times;

//Get options root
auto globalOptions = Options::root();
auto modelOpts = globalOptions["performanceIterator"];
auto& globalOptions = Options::root();
auto& modelOpts = globalOptions["performanceIterator"];
int NUM_LOOPS;
NUM_LOOPS = modelOpts["NUM_LOOPS"].withDefault(100);
bool profileMode, includeHeader;
Expand Down
4 changes: 2 additions & 2 deletions examples/performance/ddz/ddz.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ int main(int argc, char** argv) {
std::vector<Duration> times;

//Get options root
auto globalOptions = Options::root();
auto modelOpts = globalOptions["performanceIterator"];
auto& globalOptions = Options::root();
auto& modelOpts = globalOptions["performanceIterator"];
int NUM_LOOPS;
NUM_LOOPS = modelOpts["NUM_LOOPS"].withDefault(100);
bool profileMode, includeHeader;
Expand Down
4 changes: 2 additions & 2 deletions examples/performance/iterator-offsets/iterator-offsets.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ int main(int argc, char** argv) {
std::vector<Duration> times;

//Get options root
auto globalOptions = Options::root();
auto modelOpts = globalOptions["performanceIterator"];
auto& globalOptions = Options::root();
auto& modelOpts = globalOptions["performanceIterator"];
int NUM_LOOPS;
NUM_LOOPS = modelOpts["NUM_LOOPS"].withDefault(100);
bool profileMode, includeHeader;
Expand Down
4 changes: 2 additions & 2 deletions examples/performance/iterator/iterator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ int main(int argc, char** argv) {
std::vector<Duration> times;

//Get options root
auto globalOptions = Options::root();
auto modelOpts = globalOptions["performanceIterator"];
auto& globalOptions = Options::root();
auto& modelOpts = globalOptions["performanceIterator"];
int NUM_LOOPS;
NUM_LOOPS = modelOpts["NUM_LOOPS"].withDefault(100);
bool profileMode, includeHeader;
Expand Down
4 changes: 2 additions & 2 deletions examples/performance/laplace/laplace.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ int main(int argc, char** argv) {
std::vector<Duration> times;

// Get options root
auto globalOptions = Options::root();
auto modelOpts = globalOptions["LaplaceTest"];
auto& globalOptions = Options::root();
auto& modelOpts = globalOptions["LaplaceTest"];
int NUM_LOOPS = modelOpts["NUM_LOOPS"].withDefault(1000);

ConditionalOutput time_output(Output::getInstance());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ int main(int argc, char** argv) {
std::vector<Duration> times;

// Get options root
auto globalOptions = Options::root();
auto modelOpts = globalOptions["tuningRegionBlockSize"];
auto& globalOptions = Options::root();
auto& modelOpts = globalOptions["tuningRegionBlockSize"];
const int NUM_LOOPS = modelOpts["NUM_LOOPS"].withDefault(100);
const int numSteps = modelOpts["numSteps"].withDefault(16);

Expand Down
11 changes: 5 additions & 6 deletions examples/subsampling/monitor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ class Monitor1dDump : public Monitor {
public:
Monitor1dDump(BoutReal timestep, std::string section_name)
: Monitor(timestep),
output_file(getCustomOutputName(Options::root()[section_name]),
Options::root()[section_name]["append"].withDefault(false)
? bout::OptionsNetCDF::FileMode::append
: bout::OptionsNetCDF::FileMode::replace) {}
output_file(bout::OptionsIO::create(
{{"file", getCustomOutputName(Options::root()[section_name])},
{"append", Options::root()[section_name]["append"].withDefault(false)}})) {}

int call(Solver*, BoutReal _time, int, int) override {
// This method writes all the diagnostics to a unique file
Expand All @@ -31,7 +30,7 @@ class Monitor1dDump : public Monitor {
output[item.name].attributes["time_dimension"] = "t";
}
}
output_file.write(output);
output_file->write(output);

return 0;
}
Expand All @@ -48,7 +47,7 @@ class Monitor1dDump : public Monitor {

private:
bout::DataFileFacade dump;
bout::OptionsNetCDF output_file;
std::unique_ptr<bout::OptionsIO> output_file;
};

/// An example of using multiple monitors on different timescales
Expand Down
4 changes: 0 additions & 4 deletions include/options_netcdf.hxx

This file was deleted.

6 changes: 3 additions & 3 deletions manual/sphinx/user_docs/physics_models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ During initialisation (the ``init`` function), the conduction example
first reads an option (lines 21 and 24) from the input settings file
(``data/BOUT.inp`` by default)::

auto options = Options::root()["conduction"];
auto& options = Options::root()["conduction"];

OPTION(options, chi, 1.0);

Expand Down Expand Up @@ -500,8 +500,8 @@ object in the initialisation function::
BoutReal gamma;

int init(bool restarting) override {
auto globalOptions = Options::root();
auto options = globalOptions["mhd"];
auto& globalOptions = Options::root();
auto& options = globalOptions["mhd"];

OPTION(options, g, 5.0 / 3.0);
...
Expand Down
Loading