PostprocessData update

Modifications on fieldsDataBase to work both during simulation and post-simulation
Some bug fixes and changes to the code based
Correction for region volume
This commit is contained in:
Hamidreza
2025-04-18 15:32:53 +03:30
parent 61be8c60fb
commit d69203168e
44 changed files with 1065 additions and 383 deletions

View File

@ -32,40 +32,25 @@ pFlow::span<T> pFlow::fieldsDataBase::updateField(const word& name, bool forceUp
if(shouldUpdate)
{
if(name == "one")
{
allFields_.emplaceBackOrReplace<FieldTypeHost<T>>
(
"one",
FieldTypeHost<T>
(
"one",
"value",
pointFieldSize(),
T{1}
)
);
}
else if( name == "position")
if(reservedFieldNames_.contains(name))
{
if constexpr( std::same_as<T, realx3>)
return updateReservedField<T>(name, true);
}
else
{
if( loadPointFieldToTime(name) )
{
return updatePoints(true);
const auto& pField = time_.lookupObject<pointField_D<T>>(name);
allFields_.emplaceBackOrReplace<FieldTypeHost<T>>(
name,
pField.activeValuesHost());
}
else
{
fatalErrorInFunction<< "Error in getting the type name of field: "<<
name<<", with type name: "<< getTypeName<T>() <<endl;
fatalErrorInFunction<<"Error in loading the pointField "<<name<<endl;
fatalExit;
return span<T>(nullptr, 0);
}
}
else
{
const auto& pField = time_.lookupObject<pointField_D<T>>(name);
allFields_.emplaceBackOrReplace<FieldTypeHost<T>>(
name,
pField.activeValuesHost());
}
}
@ -77,4 +62,80 @@ pFlow::span<T> pFlow::fieldsDataBase::updateField(const word& name, bool forceUp
}
template<pFlow::ValidFieldType T>
inline
pFlow::span<T> pFlow::fieldsDataBase::updateReservedField
(
const word& name,
bool forceUpdate
)
{
if(name == "one")
{
if constexpr( std::same_as<T,real>)
{
return createOrGetOne(forceUpdate);
}
else
{
fatalErrorInFunction
<< "This type: "
<< getTypeName<T>()
<<" is not supported for field one."<<endl;
fatalExit;
}
}
else if(name == "volume")
{
if constexpr( std::same_as<T,real>)
{
return createOrGetVolume(forceUpdate);
}
else
{
fatalErrorInFunction
<< "This type: "
<< getTypeName<T>()
<<" is not supported for field volume."<<endl;
fatalExit;
}
}
else if( name == "density")
{
if constexpr( std::same_as<T,real>)
{
return createOrGetDensity(forceUpdate);
}
else
{
fatalErrorInFunction
<< "This type: "
<< getTypeName<T>()
<<" is not supported for field density."<<endl;
fatalExit;
}
}
else if( name == "position")
{
if constexpr( std::same_as<T, realx3>)
{
return updatePoints(forceUpdate);
}
else
{
fatalErrorInFunction
<< "This type: "
<< getTypeName<T>()
<<" is not supported for field position."<<endl;
fatalExit;
}
}
fatalErrorInFunction<<"Not supported field name "<<endl;
fatalExit;
return span<T>(nullptr, 0);
}
#endif //__fieldsDataBaseTemplates_hpp__