Merge pull request #157 from PhasicFlow/develop

the need to provide neighborLength in domain dictionary is lifted. No…
This commit is contained in:
PhasicFlow 2025-02-03 23:51:31 +03:30 committed by GitHub
commit 1540321a31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 106 additions and 76 deletions

View File

@ -78,9 +78,14 @@ pFlow::grainDEMSystem::grainDEMSystem(
REPORT(0)<< "\nCreating surface geometry for grainDEMSystem . . . "<<END_REPORT; REPORT(0)<< "\nCreating surface geometry for grainDEMSystem . . . "<<END_REPORT;
geometry_ = geometry::create(Control(), Property()); geometry_ = geometry::create(Control(), Property());
REPORT(0)<<"Reading shape dictionary ..."<<END_REPORT;
grains_ = makeUnique<grainShape>(
pFlow::shapeFile__,
&Control().caseSetup(),
Property() );
REPORT(0)<<"\nReading grain particles . . ."<<END_REPORT; REPORT(0)<<"\nReading grain particles . . ."<<END_REPORT;
particles_ = makeUnique<grainFluidParticles>(Control(), Property()); particles_ = makeUnique<grainFluidParticles>(Control(), grains_());
insertion_ = makeUnique<grainInsertion>( insertion_ = makeUnique<grainInsertion>(

View File

@ -46,6 +46,8 @@ protected:
uniquePtr<geometry> geometry_ = nullptr; uniquePtr<geometry> geometry_ = nullptr;
uniquePtr<grainShape> grains_ = nullptr;
uniquePtr<grainFluidParticles> particles_ = nullptr; uniquePtr<grainFluidParticles> particles_ = nullptr;
uniquePtr<grainInsertion> insertion_ = nullptr; uniquePtr<grainInsertion> insertion_ = nullptr;

View File

@ -35,8 +35,8 @@ void pFlow::grainFluidParticles::checkHostMemory()
pFlow::grainFluidParticles::grainFluidParticles( pFlow::grainFluidParticles::grainFluidParticles(
systemControl &control, systemControl &control,
const property &prop) const grainShape& grains)
: grainParticles(control, prop), : grainParticles(control, grains),
fluidForce_( fluidForce_(
objectFile( objectFile(
"fluidForce", "fluidForce",

View File

@ -59,7 +59,7 @@ protected:
public: public:
/// construct from systemControl and property /// construct from systemControl and property
grainFluidParticles(systemControl &control, const property& prop); grainFluidParticles(systemControl &control, const grainShape& grains);
~grainFluidParticles() override = default; ~grainFluidParticles() override = default;

View File

@ -74,13 +74,19 @@ pFlow::sphereDEMSystem::sphereDEMSystem(
property_ = makeUnique<property>( property_ = makeUnique<property>(
propertyFile__, propertyFile__,
Control().caseSetup().path()); Control().caseSetup().path());
REPORT(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<<END_REPORT; REPORT(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<<END_REPORT;
geometry_ = geometry::create(Control(), Property()); geometry_ = geometry::create(Control(), Property());
REPORT(0)<<"Reading shapes dictionary..."<<END_REPORT;
spheres_ = makeUnique<sphereShape>(
pFlow::shapeFile__,
&Control().caseSetup(),
Property());
REPORT(0)<<"\nReading sphere particles . . ."<<END_REPORT; REPORT(0)<<"\nReading sphere particles . . ."<<END_REPORT;
particles_ = makeUnique<sphereFluidParticles>(Control(), Property()); particles_ = makeUnique<sphereFluidParticles>(Control(), spheres_());
insertion_ = makeUnique<sphereInsertion>( insertion_ = makeUnique<sphereInsertion>(

View File

@ -46,6 +46,8 @@ protected:
uniquePtr<geometry> geometry_ = nullptr; uniquePtr<geometry> geometry_ = nullptr;
uniquePtr<sphereShape> spheres_ = nullptr;
uniquePtr<sphereFluidParticles> particles_ = nullptr; uniquePtr<sphereFluidParticles> particles_ = nullptr;
uniquePtr<sphereInsertion> insertion_ = nullptr; uniquePtr<sphereInsertion> insertion_ = nullptr;

View File

@ -32,8 +32,8 @@ void pFlow::sphereFluidParticles::checkHostMemory()
pFlow::sphereFluidParticles::sphereFluidParticles( pFlow::sphereFluidParticles::sphereFluidParticles(
systemControl &control, systemControl &control,
const property &prop) const sphereShape& shpShape)
: sphereParticles(control, prop), : sphereParticles(control, shpShape),
fluidForce_( fluidForce_(
objectFile( objectFile(
"fluidForce", "fluidForce",

View File

@ -66,7 +66,7 @@ protected:
public: public:
/// construct from systemControl and property /// construct from systemControl and property
sphereFluidParticles(systemControl &control, const property& prop); sphereFluidParticles(systemControl &control, const sphereShape& shpShape);
/// before iteration step /// before iteration step
bool beforeIteration() override; bool beforeIteration() override;

View File

@ -17,10 +17,17 @@ Licence:
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
REPORT(0)<<"Reading shape dictionary ..."<<END_REPORT;
pFlow::grainShape grains
(
pFlow::shapeFile__,
&Control.caseSetup(),
proprties
);
// //
REPORT(0)<<"\nReading sphere particles . . ."<<END_REPORT; REPORT(0)<<"\nReading sphere particles . . ."<<END_REPORT;
pFlow::grainParticles grnParticles(Control, proprties); pFlow::grainParticles grnParticles(Control, grains);
// //
REPORT(0)<<"\nCreating particle insertion object . . ."<<END_REPORT; REPORT(0)<<"\nCreating particle insertion object . . ."<<END_REPORT;

View File

@ -18,8 +18,16 @@ Licence:
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
REPORT(0)<<"Reading shape dictionary ..."<<END_REPORT;
pFlow::sphereShape spheres
(
pFlow::shapeFile__,
&Control.caseSetup(),
proprties
);
// //
REPORT(0)<<"\nReading sphere particles . . ."<<END_REPORT; REPORT(0)<<"\nReading sphere particles . . ."<<END_REPORT;
pFlow::sphereParticles sphParticles(Control, proprties); pFlow::sphereParticles sphParticles(Control, spheres);
WARNING<<"Particle insertion has not been set yet!"<<END_WARNING; WARNING<<"Particle insertion has not been set yet!"<<END_WARNING;

View File

@ -17,10 +17,18 @@ Licence:
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
REPORT(0)<<"Reading shapes dictionary..."<<END_REPORT;
pFlow::sphereShape spheres
(
pFlow::shapeFile__,
&Control.caseSetup(),
proprties
);
// //
REPORT(0)<<"\nReading sphere particles . . ."<<END_REPORT; REPORT(0)<<"\nReading sphere particles . . ."<<END_REPORT;
pFlow::sphereParticles sphParticles(Control, proprties);
pFlow::sphereParticles sphParticles(Control, spheres);
// //
REPORT(0)<<"\nCreating particle insertion object . . ."<<END_REPORT; REPORT(0)<<"\nCreating particle insertion object . . ."<<END_REPORT;

View File

@ -142,16 +142,11 @@ pFlow::grainParticles::getParticlesInfoFromShape(
pFlow::grainParticles::grainParticles( pFlow::grainParticles::grainParticles(
systemControl &control, systemControl &control,
const property& prop const grainShape& gShape
) )
: :
particles(control), particles(control, gShape),
grains_ grains_(gShape),
(
shapeFile__,
&control.caseSetup(),
prop
),
propertyId_ propertyId_
( (
objectFile objectFile

View File

@ -48,7 +48,7 @@ public:
private: private:
/// reference to shapes /// reference to shapes
ShapeType grains_; const ShapeType& grains_;
/// property id on device /// property id on device
uint32PointField_D propertyId_; uint32PointField_D propertyId_;
@ -121,7 +121,7 @@ protected:
public: public:
/// construct from systemControl and property /// construct from systemControl and property
grainParticles(systemControl& control, const property& prop); grainParticles(systemControl& control, const grainShape& gShape);
~grainParticles() override = default; ~grainParticles() override = default;

View File

@ -24,6 +24,7 @@ Licence:
#include "particles.hpp" #include "particles.hpp"
#include "twoPartEntry.hpp" #include "twoPartEntry.hpp"
#include "types.hpp" #include "types.hpp"
#include "shape.hpp"
namespace pFlow namespace pFlow
{ {

View File

@ -307,16 +307,11 @@ pFlow::sphereParticles::getParticlesInfoFromShape(
pFlow::sphereParticles::sphereParticles( pFlow::sphereParticles::sphereParticles(
systemControl &control, systemControl &control,
const property& prop const sphereShape& shpShape
) )
: :
particles(control), particles(control, shpShape),
spheres_ spheres_(shpShape),
(
shapeFile__,
&control.caseSetup(),
prop
),
propertyId_ propertyId_
( (
objectFile objectFile

View File

@ -48,7 +48,7 @@ public:
private: private:
/// reference to shapes /// reference to shapes
ShapeType spheres_; const ShapeType& spheres_;
/// property id on device /// property id on device
uint32PointField_D propertyId_; uint32PointField_D propertyId_;
@ -124,7 +124,7 @@ protected:
public: public:
/// construct from systemControl and property /// construct from systemControl and property
sphereParticles(systemControl& control, const property& prop); sphereParticles(systemControl& control, const sphereShape& shpShape);
~sphereParticles() override = default; ~sphereParticles() override = default;

View File

@ -24,10 +24,11 @@ Licence:
pFlow::dynamicPointStructure::dynamicPointStructure pFlow::dynamicPointStructure::dynamicPointStructure
( (
systemControl& control systemControl& control,
real maxBSphere
) )
: :
pointStructure(control), pointStructure(control, maxBSphere),
velocity_ velocity_
( (
objectFile( objectFile(

View File

@ -57,7 +57,7 @@ public:
TypeInfo("dynamicPointStructure"); TypeInfo("dynamicPointStructure");
explicit dynamicPointStructure(systemControl& control); explicit dynamicPointStructure(systemControl& control, real maxBSphere);
dynamicPointStructure(const dynamicPointStructure& ps) = delete; dynamicPointStructure(const dynamicPointStructure& ps) = delete;

View File

@ -18,22 +18,12 @@ Licence:
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
#include "particles.hpp" #include "particles.hpp"
#include "shape.hpp"
pFlow::particles::particles(systemControl& control) pFlow::particles::particles(systemControl& control, const shape& shapes)
: observer(defaultMessage_), : observer(defaultMessage_),
demComponent("particles", control), demComponent("particles", control),
dynPointStruct_(control), dynPointStruct_(control, shapes.maxBoundingSphere()),
/*id_(
objectFile(
"id",
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
),
dynPointStruct_,
static_cast<uint32>(-1),
static_cast<uint32>(-1)
),*/
shapeIndex_( shapeIndex_(
objectFile( objectFile(
"shapeIndex", "shapeIndex",

View File

@ -25,11 +25,14 @@ PARTICULAR PURPOSE.
#include "demComponent.hpp" #include "demComponent.hpp"
#include "dynamicPointStructure.hpp" #include "dynamicPointStructure.hpp"
#include "particleIdHandler.hpp" #include "particleIdHandler.hpp"
#include "shape.hpp" //#include "shape.hpp"
namespace pFlow namespace pFlow
{ {
class shape;
class particles class particles
: public observer : public observer
, public demComponent , public demComponent
@ -96,7 +99,7 @@ public:
// type info // type info
TypeInfo("particles"); TypeInfo("particles");
explicit particles(systemControl& control); explicit particles(systemControl& control, const shape& shapes);
inline const auto& dynPointStruct() const inline const auto& dynPointStruct() const
{ {

View File

@ -37,7 +37,7 @@ private:
const property& property_; const property& property_;
/// list of property ids of shapes (index) /// list of property ids of shapes (index)
uint32Vector shapePropertyIds_; uint32Vector shapePropertyIds_;
/// list of material names /// list of material names
wordVector materialNames_; wordVector materialNames_;

View File

@ -72,10 +72,11 @@ bool pFlow::regularSimulationDomain::setThisDomain()
pFlow::regularSimulationDomain::regularSimulationDomain pFlow::regularSimulationDomain::regularSimulationDomain
( (
systemControl& control systemControl& control,
real maxBsphere
) )
: :
simulationDomain(control) simulationDomain(control, maxBsphere)
{} {}
bool pFlow::regularSimulationDomain::initialUpdateDomains(span<realx3> pointPos) bool pFlow::regularSimulationDomain::initialUpdateDomains(span<realx3> pointPos)

View File

@ -44,7 +44,7 @@ public:
TypeInfo("simulationDomain<regular>"); TypeInfo("simulationDomain<regular>");
explicit regularSimulationDomain(systemControl& control); explicit regularSimulationDomain(systemControl& control, real maxBsphere);
~regularSimulationDomain() final = default; ~regularSimulationDomain() final = default;

View File

@ -28,12 +28,14 @@ bool pFlow::simulationDomain::prepareBoundaryDicts()
dictionary& boundaries = this->subDict("boundaries"); dictionary& boundaries = this->subDict("boundaries");
real neighborLength = boundaries.getVal<real>("neighborLength");
real boundaryExtntionLengthRatio = real boundaryExtntionLengthRatio =
boundaries.getValOrSetMax("boundaryExtntionLengthRatio", static_cast<real>(0.1)); boundaries.getValOrSetMax("boundaryExtntionLengthRatio", static_cast<real>(0.1));
uint32 updateInterval = real neighborLength = boundaries.getValOrSetMax<real>(
"neighborLength",
(1+boundaryExtntionLengthRatio)*maxBoundingSphere_);
uint32 updateInterval =
boundaries.getValOrSetMax<uint32>("updateInterval", 1u); boundaries.getValOrSetMax<uint32>("updateInterval", 1u);
uint32 neighborListUpdateInterval = uint32 neighborListUpdateInterval =
@ -82,7 +84,7 @@ bool pFlow::simulationDomain::prepareBoundaryDicts()
return true; return true;
} }
pFlow::simulationDomain::simulationDomain(systemControl &control) pFlow::simulationDomain::simulationDomain(systemControl &control, real maxBSphere)
: fileDictionary( : fileDictionary(
objectFile( objectFile(
domainFile__, domainFile__,
@ -90,9 +92,10 @@ pFlow::simulationDomain::simulationDomain(systemControl &control)
objectFile::READ_ALWAYS, objectFile::READ_ALWAYS,
objectFile::WRITE_NEVER), objectFile::WRITE_NEVER),
&control.settings()), &control.settings()),
globalBox_(subDict("globalBox")) globalBox_(subDict("globalBox")),
maxBoundingSphere_(maxBSphere)
{ {
if( !prepareBoundaryDicts() ) if( !prepareBoundaryDicts() )
{ {
fatalErrorInFunction<< fatalErrorInFunction<<
"Error in preparing dictionaries for boundaries"<<endl; "Error in preparing dictionaries for boundaries"<<endl;
@ -118,16 +121,15 @@ pFlow::simulationDomain::boundaryPlane(uint32 i) const
} }
pFlow::uniquePtr<pFlow::simulationDomain> pFlow::uniquePtr<pFlow::simulationDomain>
pFlow::simulationDomain::create(systemControl& control) pFlow::simulationDomain::create(systemControl& control, real maxBSphere)
{ {
word sType = angleBracketsNames( word sType = angleBracketsNames(
"simulationDomain", "simulationDomain",
pFlowProcessors().localRunTypeName()); pFlowProcessors().localRunTypeName());
if( systemControlvCtorSelector_.search(sType) ) if( systemControlvCtorSelector_.search(sType) )
{ {
return systemControlvCtorSelector_[sType] (control); return systemControlvCtorSelector_[sType] (control, maxBSphere);
} }
else else
{ {

View File

@ -44,6 +44,7 @@ private:
/// @brief acutal limits of the global box of simulation /// @brief acutal limits of the global box of simulation
box globalBox_; box globalBox_;
real maxBoundingSphere_;
static constexpr uint32 sizeOfBoundaries_ = 6; static constexpr uint32 sizeOfBoundaries_ = 6;
static static
@ -70,7 +71,7 @@ public:
TypeInfo("simulationDomain"); TypeInfo("simulationDomain");
/// Constrcut from components /// Constrcut from components
explicit simulationDomain(systemControl& control); explicit simulationDomain(systemControl& control, real maxBSphere);
/// Destructor /// Destructor
~simulationDomain() override = default; ~simulationDomain() override = default;
@ -80,8 +81,8 @@ public:
( (
simulationDomain, simulationDomain,
systemControl, systemControl,
(systemControl& control), (systemControl& control, real maxBSphere),
(control) (control, maxBSphere)
); );
const auto& globalBox()const const auto& globalBox()const
@ -189,7 +190,7 @@ public:
const plane& boundaryPlane(uint32 i)const; const plane& boundaryPlane(uint32 i)const;
static static
uniquePtr<simulationDomain> create(systemControl& control); uniquePtr<simulationDomain> create(systemControl& control, real maxBSphere);
/// @brief Boundary name based on boundary index /// @brief Boundary name based on boundary index
/// @param i boundary index (range from 0 to 5) /// @param i boundary index (range from 0 to 5)

View File

@ -92,7 +92,8 @@ bool pFlow::pointStructure::initializePoints(const PointsTypeHost &points)
pFlow::pointStructure::pointStructure pFlow::pointStructure::pointStructure
( (
systemControl& control systemControl& control,
real maxBSphere
) )
: :
IOobject IOobject
@ -111,7 +112,7 @@ pFlow::pointStructure::pointStructure
internalPoints(), internalPoints(),
simulationDomain_ simulationDomain_
( (
simulationDomain::create(control) simulationDomain::create(control, maxBSphere)
), ),
//pointSorting_(simulationDomain_->subDictOrCreate("pointSorting")), //pointSorting_(simulationDomain_->subDictOrCreate("pointSorting")),
boundaries_ boundaries_
@ -137,6 +138,7 @@ pFlow::pointStructure::pointStructure
pFlow::pointStructure::pointStructure( pFlow::pointStructure::pointStructure(
systemControl& control, systemControl& control,
real maxBSphere,
const realx3Vector &posVec) const realx3Vector &posVec)
: :
IOobject IOobject
@ -155,7 +157,7 @@ pFlow::pointStructure::pointStructure(
internalPoints(), internalPoints(),
simulationDomain_ simulationDomain_
( (
simulationDomain::create(control) simulationDomain::create(control, maxBSphere)
), ),
//pointSorting_(simulationDomain_->subDictOrCreate("pointSorting")), //pointSorting_(simulationDomain_->subDictOrCreate("pointSorting")),
boundaries_ boundaries_

View File

@ -80,11 +80,12 @@ public:
//// - Constructors //// - Constructors
/// an empty pointStructure, good for reading from file /// an empty pointStructure, good for reading from file
explicit pointStructure(systemControl& control); explicit pointStructure(systemControl& control, real maxBSphere);
/// construct from point positions, assume all points are active /// construct from point positions, assume all points are active
pointStructure( pointStructure(
systemControl& control, systemControl& control,
real maxBSphere,
const realx3Vector& posVec); const realx3Vector& posVec);
pointStructure(const pointStructure&) = delete; pointStructure(const pointStructure&) = delete;

View File

@ -57,7 +57,7 @@ bool pFlow::PFtoVTK::convertTimeFolderPointFields(
filename = vtk.fileName().wordPath(); filename = vtk.fileName().wordPath();
REPORT(1); REPORT(1);
auto pStruct = pointStructure(control); auto pStruct = pointStructure(control, 0.0005);
// get a list of files in this timeFolder; // get a list of files in this timeFolder;
@ -146,7 +146,7 @@ bool pFlow::PFtoVTK::convertTimeFolderPointFieldsSelected(
filename = vtk.fileName().wordPath(); filename = vtk.fileName().wordPath();
REPORT(1); REPORT(1);
auto pStruct = pointStructure(control); auto pStruct = pointStructure(control, 0.0005);
// get a list of files in this timeFolder; // get a list of files in this timeFolder;

View File

@ -88,7 +88,7 @@ int main( int argc, char* argv[] )
auto finalPos = pointPosition().getFinalPosition(); auto finalPos = pointPosition().getFinalPosition();
pStructPtr = pFlow::makeUnique<pFlow::pointStructure>(Control, finalPos); pStructPtr = pFlow::makeUnique<pFlow::pointStructure>(Control, 0.0005, finalPos);
REPORT(1)<< "Created pStruct with "<< pStructPtr().size() << " points and capacity "<< REPORT(1)<< "Created pStruct with "<< pStructPtr().size() << " points and capacity "<<
@ -98,7 +98,7 @@ int main( int argc, char* argv[] )
else else
{ {
// read the content of pStruct from 0/pStructure // read the content of pStruct from 0/pStructure
pStructPtr = pFlow::makeUnique<pFlow::pointStructure>(Control); pStructPtr = pFlow::makeUnique<pFlow::pointStructure>(Control, 0.0005);
} }

View File

@ -65,7 +65,7 @@ bool pFlow::postprocess::processTimeFolder(real time, const word& tName, const f
control_.time().setTime(time); control_.time().setTime(time);
REPORT(1)<<"Reading pointStructure"<<END_REPORT; REPORT(1)<<"Reading pointStructure"<<END_REPORT;
pointStructure pStruct(control_); pointStructure pStruct(control_, 0.0005);
// first delete the object to remove fields from repository // first delete the object to remove fields from repository
pointToCell_.reset(nullptr); pointToCell_.reset(nullptr);