Particle insertion (domain check)

- Domain check is added to prevent points that are outside of internalDomainBox
This commit is contained in:
Hamidreza Norouzi
2024-04-13 01:41:11 -07:00
parent 9c2a9a81b0
commit 89d7e1f0ba
16 changed files with 109 additions and 27 deletions

View File

@ -68,6 +68,16 @@ bool pFlow::InsertionRegion<ShapeType>::insertParticles
if(newNum == 0) return true;
auto internalBox = pStruct().internalDomainBox();
if( !(internalBox.minPoint() < internalBox.maxPoint()))
{
WARNING<<"Minimum point of internal point is not lower than "<<
"the maximum point \n"<<
"minimum point: "<< internalBox.minPoint()<<
"\nmaximum point:"<<internalBox.maxPoint()<<END_WARNING;
}
names.reserve(max(newNum,names.capacity()));
pos.reserve(max(newNum,pos.capacity()));
names.clear();
@ -75,13 +85,7 @@ bool pFlow::InsertionRegion<ShapeType>::insertParticles
realVector diams("diams", newNum, 0, RESERVE());
for(uint32 i=0; i<newNum; i++)
{
uint32 idx;
shapes_.shapeNameToIndex(names[i], idx);
diams[i] = shapes_.boundingDiameter(idx);
}
size_t n = 0;
uint32 idx;
auto& mix = mixture();
@ -94,6 +98,10 @@ bool pFlow::InsertionRegion<ShapeType>::insertParticles
{
realx3 p = pReg.peek();
// check if point is inside internal box
if(!internalBox.isInside(p))continue;
if( !checkForContact(pos, diams, p, d) )
{
names.push_back(name);

View File

@ -22,6 +22,7 @@ Licence:
#define __InsertionRegion_hpp__
#include "dictionary.hpp"
#include "pointStructure.hpp"
#include "insertionRegion.hpp"
namespace pFlow

View File

@ -39,6 +39,12 @@ pFlow::insertion::insertion(particles& prtcl)
readInsertionDict(*this);
}
const pFlow::pointStructure&
pFlow::insertion::pStruct() const
{
return particles_.pStruct();
}
bool
pFlow::insertion::read(iIstream& is, const IOPattern& iop)
{

View File

@ -27,6 +27,7 @@ namespace pFlow
// forward
class particles;
class pointStructure;
/**
* Base class for particle insertion
@ -88,6 +89,8 @@ public:
return particles_;
}
const pointStructure& pStruct()const;
inline bool readFromFile() const
{
return readFromFile_;

View File

@ -158,6 +158,12 @@ pFlow::insertionRegion::insertionRegion(
}
}
const pFlow::pointStructure&
pFlow::insertionRegion::pStruct() const
{
return Insertion().pStruct();
}
pFlow::uint32
pFlow::insertionRegion::numberToBeInserted(uint32 iter, real t, real dt)
{

View File

@ -31,6 +31,7 @@ namespace pFlow
class dictionary;
class insertion;
class pointStructure;
/**
* This class defines all the necessary enteties for defining an insertion
@ -92,7 +93,7 @@ private:
/// insertion region dictionary
const dictionary& dict_;
/// ref to pointStructure
/// ref to insertion
const insertion& insertion_;
/// @brief time control for insertion events
@ -163,6 +164,8 @@ public:
return insertion_;
}
const pointStructure& pStruct()const;
inline bool insertionTime(uint32 iter, real t, real dt) const
{
return tControl_.timeEvent(iter, t, dt);