File bout.hxx#
Functions
-
int BoutInitialise(int &argc, char **&argv)#
BOUT++ initialisation. This function must be called first, passing command-line arguments.
This will call MPI_Initialize, and if BOUT++ has been configured with external libraries such as PETSc then these will be initialised as well.
Example
A minimal BOUT++ program consists of:
Usually this function is called in a standard main() function, either by including boutmain.hxx or by including bout/physicsmodel.hxx and using the BOUTMAIN macro.int main(int argc, char** argv) { BoutInitialise(argc, argv); BoutFinalise(); }
Outputs
Any non-zero return value should halt the simulation. If the return value is less than zero, the exit status from BOUT++ is 0, otherwise it is the return value of BoutInitialise.
-
int BoutFinalise(bool write_settings = true)#
BOUT++ finalisation. This should be called at the end of the program.
Frees memory, flushes buffers, and closes files. If BOUT++ initialised MPI or external libraries, then these are also finalised.
If
write_settingsis true, output the settings, showing which options were used. This overwrites the file written during initialisation (BOUT.settings by default)
-
class BoutMonitor : public Monitor#
Monitor class for output. Called by the solver every output timestep.
This is added to the solver in bout/physicsmodel.hxx
Public Functions
Private Functions
-
virtual int call(Solver *solver, BoutReal t, int iter, int NOUT) override#
Callback function for the solver, called after timestep_ has passed
- Parameters:
solver – [in] The solver calling this monitor
time – [in] The current simulation time
iter – [in] The current simulation iteration
nout – [in] The total number of iterations for this simulation
- Returns:
non-zero if simulation should be stopped
Private Members
-
RunMetrics run_data#
-
bool stop_check#
Stop if file
stop_check_nameexists.
-
bool first_time = {true}#
Check if this is the first time the monitor is called.
-
virtual int call(Solver *solver, BoutReal t, int iter, int NOUT) override#
-
namespace bout
Information about the version of BOUT++
The build system will update this file on every commit, which may result in files that include it getting rebuilt. Therefore it should be included in as few places as possible
Information about the version of BOUT++
The build system will update this file at configure-time
Explicit inversion of a 3x3 matrix
aIf the matrix is singular (ill conditioned), the determinant is return. Otherwise, an empty
std::optionalis return-
namespace experimental#
Typedefs
-
using SignalHandler = void (*)(int)#
Function type for handling signals.
Functions
-
void setupSignalHandler(SignalHandler signal_handler)#
Set a signal handler for user-requested clean exit, and (optionally) segmentation faults and floating point errors
For segmentation faults, compile with
--enable-signal.For floating point errors, compile with
--enable-sigfpe
-
void defaultSignalHandler(int sig)#
The default BOUT++ signal handler: throw an exception with an appropriate message
-
CommandLineArgs parseCommandLineArgs(int argc, char **argv)#
Parse the “fixed” command line arguments, like —help and -d.
-
void checkDataDirectoryIsAccessible(const std::string &data_dir)#
Throw an exception if
data_diris either not a directory or not accessible. We do not check whether we can write, as it is sufficient that the files we need are writeable
-
void setupOutput(const std::string &data_dir, const std::string &log_file, int verbosity, int MYPE = 0)#
Set up the output: open the log file for each processor, enable or disable the default outputs based on
verbosity, disable writing to stdout forMYPE!= 0
-
void savePIDtoFile(const std::string &data_dir, int MYPE)#
Save the process ID for processor N =
MYPEto file “.BOUT.pid.N” indata_dir, so it can be shut down by user signalThrows if it was not possible to create the file
-
void printStartupHeader(int MYPE, int NPES)#
Print the initial header.
-
void printCompileTimeOptions()#
Print the compile-time options.
-
void printCommandLineArguments(const std::vector<std::string> &original_argv)#
Print the arguments given on the command line.
-
bool setupBoutLogColor(bool color_output, int MYPE)#
Setup the pipe etc and run stdout through bout-log-color. Return true if it was successful
-
void setRunStartInfo(Options &options)#
Set BOUT++ version information, along with current time (as
started), intorunsection ofoptions
-
void setRunFinishInfo(Options &options)#
Set the current time (as
finished) intorunsection ofoptions
-
struct CommandLineArgs#
Results of parsing the command line arguments.
-
using SignalHandler = void (*)(int)#
-
namespace experimental#