postprocessPhasicFlow is now updated with new postprocessData auxFunction. It now uses postprocessDataDict.

This commit is contained in:
Hamidreza
2025-04-21 00:13:54 +03:30
parent 40deb1f9c0
commit 9de1fa2dc7
41 changed files with 1000 additions and 2912 deletions

View File

@ -18,103 +18,130 @@ Licence:
-----------------------------------------------------------------------------*/
#include "KokkosUtilities.hpp"
#include "systemControl.hpp"
#include "timeFolder.hpp"
#include "Vectors.hpp"
#include "commandLine.hpp"
#include "ranges.hpp"
#include "readControlDict.hpp"
#include "postprocess.hpp"
using pFlow::word;
using pFlow::wordVector;
using pFlow::wordList;
using pFlow::commandLine;
using pFlow::timeFolder;
using pFlow::output;
using pFlow::endl;
#include "postprocessData.hpp"
#include "postprocessGlobals.hpp"
int main(int argc, char** argv )
{
word outFolder = (pFlow::CWD()/word("VTK/postprocess")).wordPath();
pFlow::word outFolder = (pFlow::CWD()/pFlow::postProcessGlobals::defaultRelDir__).wordPath();
commandLine cmds(
pFlow::commandLine cmds(
"postprocessPhasicFlow",
"post-process fields in time folders based on the input file "
"settings/postprocessDict and convetes the results into vtk file format.");
"settings/postprocessDataDict.");
pFlow::wordVector times;
pFlow::word description = "path to output folder of postprocess data: ./"
+ pFlow::postProcessGlobals::defaultRelDir__;
wordVector times;
cmds.addOption("-o,--out-folder",
outFolder,
"path to output folder of VTK/postprocess",
description,
"path");
cmds.addOption(
"-t,--time",
times.vectorField(),
"a space separated lits of time folders, or a strided range begin:stride:end, or an interval begin:end",
"a SPACE separated lits of time folders, "
"or a strided range <begin>:<stride>:<end>, or an interval <begin>:<end>",
" ");
bool withZeroFolder = false;
cmds.addOption(
cmds.add_flag(
"-z, --zeroFolder",
withZeroFolder,
"Do NOT exclude zero folder from processing time folders");
"include zero folder into processing time folders");
bool isCoupling = false;
if(!cmds.parse(argc, argv)) return 0;
#include "initialize_Control.hpp"
// time folders in case
timeFolder folders(Control);
// time in command line
pFlow::realCombinedRange validRange;
pFlow::combinedRange<pFlow::timeValue> validRange;
if( cmds.count("--time") )
{
if(!validRange.addRanges(times)){
fatalExit; }
if(!validRange.addRanges(times))
{
fatalExit;
}
if(withZeroFolder)
validRange.addIndividual(0.0);
}
else
{
validRange.addIntervalRange(folders.startTime(), folders.endTime());
if(withZeroFolder)
validRange.addIntervalRange(0.0, 1.0e+15);
else
validRange.addIntervalRange(1.0e-7, 1.0e+15);
}
pFlow::fileSystem destFolder = pFlow::fileSystem(outFolder);
pFlow::timeValue nextTime = validRange.minVal();
pFlow::postprocess post(Control);
if(nextTime <0.0)
{
fatalError
<<"Invalid time range in the command line. "
<<"your input range is: "
<<times
<<" which resulted to start time "
<< nextTime<<pFlow::endl;
fatalExit;
}
do
pFlow::postprocessData postprocess(Control, nextTime);
postprocess.setOutputDirectory(pFlow::fileSystem(outFolder+"/").absolute());
bool folderSkipped = false;
pFlow::output<<"\n"<<pFlow::endl;
while(nextTime>=0.0)
{
if( !validRange.isMember( folders.time() ) )
if( !folderSkipped )
{
continue;
}
if( !withZeroFolder && pFlow::equal(folders.time() , pFlow::zero))continue;
if(!postprocess.execute())
{
fatalError
<<"Error occured in executing postprocessing...."<<pFlow::endl;
fatalExit;
}
post.processTimeFolder(folders);
if(!postprocess.write())
{
fatalError
<<"Error occured in writing postprocess results..."<<pFlow::endl;
fatalExit;
}
if(!post.writeToVTK(destFolder, "processed"))
{
fatalExit;
pFlow::output<<"\n"<<pFlow::endl;
}
}while (folders++);
nextTime = postprocess.database().getNextTimeFolder();
if(nextTime <0.0) break;
if(validRange.isMember(nextTime))
{
postprocess.database().setToNextTimeFolder();
folderSkipped = false;
}
else
{
postprocess.database().skipNextTimeFolder();
folderSkipped = true;
}
}
#include "finalize.hpp"