Commit c635574a authored by mark's avatar mark

ENH: upgrade adios write to use newer OpenFOAM functionality

- first support for using adiosWrite to terminate the simulation.

  The idea is to adjust normal controlDict entries so that they
  almost never write, and perhaps only terminate after a fixed time
  (eg, cpuTime 1 day) and use the adiosWrite function object to do
  the writing as well as terminating the simulation.

  Needs some refinement and testing.
parent c60e773d
......@@ -253,11 +253,11 @@ Foam::Ostream& Foam::adiosReader::VarInfo::info(Ostream& os) const
{
os.beginBlock();
os.writeEntry("name", name_);
os.writeEntry("varid", varid_);
os.writeEntry("adiosType", label(type_));
os.writeEntry("count", nElem_);
os.writeEntry("sizeof", nBytes_);
os.writeEntry("name", name_);
os.writeEntry("varid", varid_);
os.writeEntry("adiosType", label(type_));
os.writeEntry("count", nElem_);
os.writeEntry("sizeof", nBytes_);
os.endBlock();
......
......@@ -64,17 +64,18 @@ private:
public:
// Time-attribute names
enum attrType
{
INDEX = 0,
VALUE = 1,
DT = 2,
DT0 = 3
};
// Static data
//- Time-attribute names
enum attrType
{
INDEX = 0,
VALUE = 1,
DT = 2,
DT0 = 3
};
//- General time variables within ADIOS file
static const NamedEnum<attrType, 4> attr;
......@@ -85,10 +86,10 @@ public:
adiosTime();
//- Copy values from TimeState
adiosTime(const TimeState&);
adiosTime(const TimeState& t);
//- Construct by extracting values from adios reader
adiosTime(const adiosReader& reader);
adiosTime(const adiosReader& r);
// Member Functions
......
......@@ -234,7 +234,6 @@ Foam::label Foam::adiosWrite::writeCloud
const string localDims3 = localDims + ",3";
const string globalDims3 = globalDims + ",3";
// expand parcel contents into separate fields - runtime selectable
// mostly useful for debugging and as a general example
......
......@@ -54,7 +54,7 @@ Foam::adiosTime Foam::adiosWrite::readData(const fileName& bpFile)
forAll(meshNames, regI)
{
const word& regName = meshNames[regI];
fvMesh& mesh = const_cast<fvMesh&>(time().lookupObject<fvMesh>(regName));
fvMesh& mesh = time().lookupObjectRef<fvMesh>(regName);
HashTable<adiosReader::fieldInfo> readerFields = reader.getFieldInfo(regName);
HashTable<adiosReader::cloudInfo> readerClouds = reader.getCloudInfo(regName);
......
This diff is collapsed.
......@@ -27,6 +27,13 @@ Class
Description
Writes fields and parcel clouds to an ADIOS file.
restartFrom (none | restartTime | latestTime);
restartTime float;
stopAt (none | now | stopTime);
stopTime float;
SourceFiles
adiosCloudTemplates.C
adiosRestart.C
......@@ -81,27 +88,45 @@ class adiosWrite
// Private data
enum restartStatus
//- Requested or current restart state
enum restartState
{
restartNone, //!< No restart, or not initialized
restartDone, //!< Restart already executed
restartTime, //!< Restart based on specified time
restartLatest //!< Restart from latest file available
restartLatest, //!< Restart from latest file available
restartDisabled //!< Restart disabled or already executed
};
//- Requested or current restart state
enum stopState
{
stopNone, //!< No stopping control
stopNow, //!< Manual stop immediately (after ADIOS write)
stopTime, //!< Stop if the time at or exceeds stopTime
stopDisabled //!< Stopping disabled or already triggered
};
//- Reference to the time database
const Time& time_;
//- Track restart status
restartStatus restartStatus_;
//- The restart state (requested or current)
restartState restartFrom_;
//- Restart time requested
//- The restart time requested
scalar restartTime_;
//- Track time index from restart (avoid write immediately after restart)
//- The time index for restart
// Also avoids write immediately after restart.
int restartIndex_;
//- The stopAt state (requested or current)
stopState stopAt_;
//- Stop time requested
scalar stopTime_;
//- List of region information
typedef SLList<regionInfo> RegionInfoContainer;
......
......@@ -112,9 +112,7 @@ Foam::label Foam::adiosWrite::writeFields
HashTable<word> wroteFields;
HashTable<word> badFields;
wordList sortedNames = mesh.names();
sort(sortedNames);
wordList sortedNames = mesh.sortedNames();
forAll(sortedNames, i)
{
const regIOobject& obj = *(mesh.find(sortedNames[i])());
......@@ -178,8 +176,7 @@ Foam::label Foam::adiosWrite::writeClouds(const regionInfo& rInfo)
Info<< " adiosWrite::writeClouds: " << rInfo.info() << endl;
}
wordList sortedNames = mesh.names<cloud>();
sort(sortedNames);
wordList sortedNames = mesh.sortedNames<cloud>();
HashTable<word> badClouds;
DynamicList<word> cloudNames(allClouds.size());
......
......@@ -15,7 +15,7 @@ functions
// can also have options here:
stopAt stopTime;
stopTime 0.01;
stopTime 0.5;
ignore
{
......@@ -28,5 +28,12 @@ functions
}
}
// overwrite top-level controls
// overwrite top-level controls (without change dictionary?)
// #inputMode overwrite
// .startFrom startTime;
// .startTime 0;
// .stopAt endTime;
// .endTime 10000;
//
// .writeControl cpuTime;
// .writeInterval 86400;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment