keepHistory for integration to automatically remove the fields related to integration. The default is no save on the disk

This commit is contained in:
Hamidreza 2025-04-17 02:41:36 +03:30
parent 077f25842a
commit 98a30bc98c
16 changed files with 69 additions and 33 deletions

View File

@ -97,10 +97,11 @@ pFlow::AdamsBashforth2::AdamsBashforth2
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField const realx3Field_D& initialValField,
bool keepHistory
) )
: :
integration(baseName, pStruct, method, initialValField), integration(baseName, pStruct, method, initialValField, keepHistory),
realx3PointField_D realx3PointField_D
( (
objectFile objectFile
@ -108,7 +109,7 @@ pFlow::AdamsBashforth2::AdamsBashforth2
groupNames(baseName,"dy1"), groupNames(baseName,"dy1"),
pStruct.time().integrationFolder(), pStruct.time().integrationFolder(),
objectFile::READ_IF_PRESENT, objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS keepHistory?objectFile::WRITE_ALWAYS:objectFile::WRITE_NEVER
), ),
pStruct, pStruct,
zero3, zero3,

View File

@ -81,7 +81,8 @@ public:
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField); const realx3Field_D& initialValField,
bool keepHistory);
/// Destructor /// Destructor
~AdamsBashforth2()override = default; ~AdamsBashforth2()override = default;

View File

@ -109,10 +109,11 @@ pFlow::AdamsBashforth3::AdamsBashforth3
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField const realx3Field_D& initialValField,
bool keepHistory
) )
: :
AdamsBashforth2(baseName, pStruct, method, initialValField), AdamsBashforth2(baseName, pStruct, method, initialValField, keepHistory),
dy2_ dy2_
( (
objectFile objectFile
@ -120,7 +121,7 @@ pFlow::AdamsBashforth3::AdamsBashforth3
groupNames(baseName,"dy2"), groupNames(baseName,"dy2"),
pStruct.time().integrationFolder(), pStruct.time().integrationFolder(),
objectFile::READ_IF_PRESENT, objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS keepHistory ? objectFile::WRITE_ALWAYS : objectFile::WRITE_NEVER
), ),
pStruct, pStruct,
zero3, zero3,

View File

@ -71,7 +71,8 @@ public:
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField); const realx3Field_D& initialValField,
bool keepHistory);
/// Destructor /// Destructor

View File

@ -115,10 +115,11 @@ pFlow::AdamsBashforth4::AdamsBashforth4
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField const realx3Field_D& initialValField,
bool keepHistory
) )
: :
AdamsBashforth3(baseName, pStruct, method, initialValField), AdamsBashforth3(baseName, pStruct, method, initialValField, keepHistory),
dy3_ dy3_
( (
objectFile objectFile
@ -126,7 +127,7 @@ pFlow::AdamsBashforth4::AdamsBashforth4
groupNames(baseName,"dy3"), groupNames(baseName,"dy3"),
pStruct.time().integrationFolder(), pStruct.time().integrationFolder(),
objectFile::READ_IF_PRESENT, objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS keepHistory?objectFile::WRITE_ALWAYS:objectFile::WRITE_NEVER
), ),
pStruct, pStruct,
zero3, zero3,

View File

@ -69,7 +69,8 @@ public:
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField); const realx3Field_D& initialValField,
bool keepHistory);

View File

@ -123,10 +123,11 @@ pFlow::AdamsBashforth5::AdamsBashforth5
const word &baseName, const word &baseName,
pointStructure &pStruct, pointStructure &pStruct,
const word &method, const word &method,
const realx3Field_D &initialValField const realx3Field_D &initialValField,
bool keepHistory
) )
: :
AdamsBashforth4(baseName, pStruct, method, initialValField), AdamsBashforth4(baseName, pStruct, method, initialValField, keepHistory),
dy4_ dy4_
( (
objectFile objectFile
@ -134,7 +135,7 @@ pFlow::AdamsBashforth5::AdamsBashforth5
groupNames(baseName,"dy4"), groupNames(baseName,"dy4"),
pStruct.time().integrationFolder(), pStruct.time().integrationFolder(),
objectFile::READ_IF_PRESENT, objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS keepHistory?objectFile::WRITE_ALWAYS:objectFile::WRITE_NEVER
), ),
pStruct, pStruct,
zero3, zero3,

View File

@ -68,7 +68,8 @@ public:
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField); const realx3Field_D& initialValField,
bool keepHistory);

View File

@ -51,10 +51,12 @@ pFlow::integration::integration(
const word &baseName, const word &baseName,
pointStructure &pStruct, pointStructure &pStruct,
const word &, const word &,
const realx3Field_D &) const realx3Field_D &,
bool keepHistory)
: owner_(*pStruct.owner()), : owner_(*pStruct.owner()),
pStruct_(pStruct), pStruct_(pStruct),
baseName_(baseName) baseName_(baseName),
keepHistory_(keepHistory)
{} {}
@ -64,12 +66,13 @@ pFlow::uniquePtr<pFlow::integration>
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField const realx3Field_D& initialValField,
bool keepHistory
) )
{ {
if( wordvCtorSelector_.search(method) ) if( wordvCtorSelector_.search(method) )
{ {
return wordvCtorSelector_[method] (baseName, pStruct, method, initialValField); return wordvCtorSelector_[method] (baseName, pStruct, method, initialValField, keepHistory);
} }
else else
{ {

View File

@ -24,6 +24,7 @@ Licence:
#include "virtualConstructor.hpp" #include "virtualConstructor.hpp"
#include "pointFields.hpp" #include "pointFields.hpp"
#include "Logical.hpp"
namespace pFlow namespace pFlow
@ -63,6 +64,8 @@ private:
/// The base name for integration /// The base name for integration
const word baseName_; const word baseName_;
bool keepHistory_;
protected: protected:
bool insertValues( bool insertValues(
@ -83,7 +86,8 @@ public:
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField); const realx3Field_D& initialValField,
bool keepHistory);
/// Copy constructor /// Copy constructor
integration(const integration&) = default; integration(const integration&) = default;
@ -109,9 +113,10 @@ public:
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField const realx3Field_D& initialValField,
bool keepHistory
), ),
(baseName, pStruct, method, initialValField) (baseName, pStruct, method, initialValField, keepHistory)
); );
@ -138,6 +143,11 @@ public:
return owner_; return owner_;
} }
bool keepHistory()const
{
return keepHistory_;
}
virtual virtual
void updateBoundariesSlaveToMasterIfRequested() = 0; void updateBoundariesSlaveToMasterIfRequested() = 0;
/// return integration method /// return integration method
@ -164,7 +174,8 @@ public:
const word& baseName, const word& baseName,
pointStructure& pStruct, pointStructure& pStruct,
const word& method, const word& method,
const realx3Field_D& initialValField); const realx3Field_D& initialValField,
bool keepHistory);
}; // integration }; // integration

View File

@ -248,7 +248,8 @@ pFlow::grainParticles::grainParticles(
"rVelocity", "rVelocity",
dynPointStruct(), dynPointStruct(),
intMethod, intMethod,
rAcceleration_.field() rAcceleration_.field(),
control.keepIntegrationHistory()
); );
if( !rVelIntegration_ ) if( !rVelIntegration_ )

View File

@ -229,7 +229,8 @@ pFlow::sphereParticles::sphereParticles(
"rVelocity", "rVelocity",
dynPointStruct(), dynPointStruct(),
intMethod, intMethod,
rAcceleration_.field() rAcceleration_.field(),
control.keepIntegrationHistory()
); );
if( !rVelIntegration_ ) if( !rVelIntegration_ )

View File

@ -64,7 +64,8 @@ pFlow::dynamicPointStructure::dynamicPointStructure
"pStructPosition", "pStructPosition",
*this, *this,
integrationMethod_, integrationMethod_,
velocity_.field() velocity_.field(),
control.keepIntegrationHistory()
); );
if( !integrationPos_ ) if( !integrationPos_ )
@ -79,7 +80,8 @@ pFlow::dynamicPointStructure::dynamicPointStructure
"pStructVelocity", "pStructVelocity",
*this, *this,
integrationMethod_, integrationMethod_,
acceleration_.field() acceleration_.field(),
control.keepIntegrationHistory()
); );
if( !integrationVel_ ) if( !integrationVel_ )

View File

@ -24,6 +24,8 @@ Licence:
#include "iOstream.hpp" #include "iOstream.hpp"
#include "types.hpp" #include "types.hpp"
#include "vocabs.hpp" #include "vocabs.hpp"
#include "Logical.hpp"
inline static bool axuFunctionsInitialized__ = false; inline static bool axuFunctionsInitialized__ = false;
@ -187,7 +189,6 @@ pFlow::systemControl::systemControl(
bool pFlow::systemControl::operator++(int) bool pFlow::systemControl::operator++(int)
{ {
auto toContinue = time()++;
if(!axuFunctionsInitialized__) if(!axuFunctionsInitialized__)
{ {
@ -201,6 +202,8 @@ bool pFlow::systemControl::operator++(int)
auxFunctions_().write(); auxFunctions_().write();
} }
auto toContinue = time()++;
if (toContinue) if (toContinue)
{ {
writeToFileTimer_.start(); writeToFileTimer_.start();
@ -236,4 +239,10 @@ bool pFlow::systemControl::operator++(int)
return toContinue; return toContinue;
} }
bool pFlow::systemControl::keepIntegrationHistory()const
{
auto keepHistory = settingsDict_().getValOrSet(
"integrationHistory",
Logical{false});
return keepHistory();
}

View File

@ -193,6 +193,7 @@ public:
return outFilePrecision_; return outFilePrecision_;
} }
bool keepIntegrationHistory()const;
bool isIncluded(const word& objName)const final bool isIncluded(const word& objName)const final
{ {

View File

@ -278,6 +278,6 @@ struct quadruple
} // pFlow } // pFlow
#include "quadrupleI.hpp" #include "quadrupleI.hpp"
// #include "quadrupleMath.hpp" #include "quadrupleMath.hpp"
#endif #endif