#ifndef __UT_MHD_H__ #define __UT_MHD_H__ #include "MHDManager.h" #include "DateTime.h" /// Manages UTIO timestep advancement and I/O for MHD /** * UTIO (Universal Time Input/Output) managment for LFM MHD * simulation advances the simulation based on the elapsed simulation * time rather than an integer timestep number. I/O steps expect * files named according to a date & time string in the format * "[Run Name]_mhd_[YYYY-MM-DDTHH-MM-SS].[File Extension]" * * @seealso SimulationManager, MHDManager, TimestepMHD */ class UTMHD : public MHDManager { public: UTMHD(const DateTime &start_dateTime, const DateTime &stop_dateTime, const double & dump_frequency); /// Advance the simulation by one timestep bool advance(void); /// Increment the internal simulation time clock void incrementTime(const FLoaT &dt); /// Are we at a dump frequency to write data? bool atDump(void); //Accessors /// Get the DateTime object for first step to simluate. DateTime getStart(void) { return start; } /// Get the current simulation date/time object DateTime getCurrent(void) { return current; } /// Get the DateTime for the last step to simulate DateTime getStop(void) { return stop; } /// Get the frequency of file dumps (in seconds) double getDumpFrequency(void) { return dumpFrequency; } // I/O /// Write data for a single timestep to file int dump_step(char *base, MHD *mhd, IM_Interface const * const innerMag, const Average &avg); /// Read data for a single timestep from file int read_step(char *base, MHD *mhd); /// Read accumulate & bleed arrays from file into IM_interface object; used for coupling with RCM. int read_accumulate_and_bleed_step(char *base, MHD *mhd, IM_Interface * const innerMag); protected: private: /// Date and time of the first timestep DateTime start; /// Current date & time information DateTime current; /// Date and time of the next step to write data to file DateTime nextDump; /// Date and time of the last time step to compute DateTime stop; /// Frequency of file output (in seconds) double dumpFrequency; /// UTIonIO gets time information from the UTMHD class, so make it a friend: friend class UTIonIO; }; #endif