the need to provide neighborLength in domain dictionary is lifted. Now it is optional

This commit is contained in:
HRN 2025-02-03 23:49:11 +03:30
parent fac5576df1
commit 63bd9c9993
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;
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;
particles_ = makeUnique<grainFluidParticles>(Control(), Property());
particles_ = makeUnique<grainFluidParticles>(Control(), grains_());
insertion_ = makeUnique<grainInsertion>(

View File

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

View File

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

View File

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

View File

@ -75,12 +75,18 @@ pFlow::sphereDEMSystem::sphereDEMSystem(
propertyFile__,
Control().caseSetup().path());
REPORT(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<<END_REPORT;
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;
particles_ = makeUnique<sphereFluidParticles>(Control(), Property());
particles_ = makeUnique<sphereFluidParticles>(Control(), spheres_());
insertion_ = makeUnique<sphereInsertion>(

View File

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

View File

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

View File

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

View File

@ -17,10 +17,17 @@ Licence:
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;
pFlow::grainParticles grnParticles(Control, proprties);
pFlow::grainParticles grnParticles(Control, grains);
//
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;
pFlow::sphereParticles sphParticles(Control, proprties);
pFlow::sphereParticles sphParticles(Control, spheres);
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.
-----------------------------------------------------------------------------*/
REPORT(0)<<"Reading shapes dictionary..."<<END_REPORT;
pFlow::sphereShape spheres
(
pFlow::shapeFile__,
&Control.caseSetup(),
proprties
);
//
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,6 +44,7 @@ private:
/// @brief acutal limits of the global box of simulation
box globalBox_;
real maxBoundingSphere_;
static constexpr uint32 sizeOfBoundaries_ = 6;
static
@ -70,7 +71,7 @@ public:
TypeInfo("simulationDomain");
/// Constrcut from components
explicit simulationDomain(systemControl& control);
explicit simulationDomain(systemControl& control, real maxBSphere);
/// Destructor
~simulationDomain() override = default;
@ -80,8 +81,8 @@ public:
(
simulationDomain,
systemControl,
(systemControl& control),
(control)
(systemControl& control, real maxBSphere),
(control, maxBSphere)
);
const auto& globalBox()const
@ -189,7 +190,7 @@ public:
const plane& boundaryPlane(uint32 i)const;
static
uniquePtr<simulationDomain> create(systemControl& control);
uniquePtr<simulationDomain> create(systemControl& control, real maxBSphere);
/// @brief Boundary name based on boundary index
/// @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
(
systemControl& control
systemControl& control,
real maxBSphere
)
:
IOobject
@ -111,7 +112,7 @@ pFlow::pointStructure::pointStructure
internalPoints(),
simulationDomain_
(
simulationDomain::create(control)
simulationDomain::create(control, maxBSphere)
),
//pointSorting_(simulationDomain_->subDictOrCreate("pointSorting")),
boundaries_
@ -137,6 +138,7 @@ pFlow::pointStructure::pointStructure
pFlow::pointStructure::pointStructure(
systemControl& control,
real maxBSphere,
const realx3Vector &posVec)
:
IOobject
@ -155,7 +157,7 @@ pFlow::pointStructure::pointStructure(
internalPoints(),
simulationDomain_
(
simulationDomain::create(control)
simulationDomain::create(control, maxBSphere)
),
//pointSorting_(simulationDomain_->subDictOrCreate("pointSorting")),
boundaries_

View File

@ -80,11 +80,12 @@ public:
//// - Constructors
/// 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
pointStructure(
systemControl& control,
real maxBSphere,
const realx3Vector& posVec);
pointStructure(const pointStructure&) = delete;

View File

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

View File

@ -88,7 +88,7 @@ int main( int argc, char* argv[] )
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 "<<
@ -98,7 +98,7 @@ int main( int argc, char* argv[] )
else
{
// 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);
REPORT(1)<<"Reading pointStructure"<<END_REPORT;
pointStructure pStruct(control_);
pointStructure pStruct(control_, 0.0005);
// first delete the object to remove fields from repository
pointToCell_.reset(nullptr);