Files
phasicFlow/src/Particles/Insertion/insertionRegion/insertionRegion.hpp

226 lines
5.1 KiB
C++
Raw Normal View History

2022-09-05 01:56:29 +04:30
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
2022-09-05 01:56:29 +04:30
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
2022-09-05 01:56:29 +04:30
Licence:
This file is part of phasicFlow code. It is a free software for simulating
2022-09-05 01:56:29 +04:30
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
2022-09-05 01:56:29 +04:30
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
2022-12-10 01:32:54 +03:30
#ifndef __insertionRegion_hpp__
#define __insertionRegion_hpp__
2022-09-05 01:56:29 +04:30
#include "anyList.hpp"
#include "baseTimeControl.hpp"
#include "peakableRegion.hpp"
2022-12-10 01:32:54 +03:30
#include "shapeMixture.hpp"
2022-09-05 01:56:29 +04:30
namespace pFlow
{
class dictionary;
class insertion;
class pointStructure;
2022-09-05 01:56:29 +04:30
2023-06-07 05:40:43 -07:00
/**
* This class defines all the necessary enteties for defining an insertion
* region.
*
* Insertion region information are supplied through a dictionary in a file.
2023-06-07 05:40:43 -07:00
* For example:
\verbatim
{
type cylinderRegion; // type of insertion region
rate 15000; // insertion rate (particles/s)
startTime 0; // (s)
endTime 0.5; // (s)
interval 0.025; // (s)
cylinderRegionInfo
{
radius 0.09; // radius of cylinder (m)
p1 (0.0 0.0 0.10); // (m,m,m)
p2 (0.0 0.0 0.11); // (m,m,m)
}
setFields
{
velocity realx3 (0.0 0.0 -0.6); // initial velocity of inserted
particles
}
mixture
{
lightSphere 1; // mixture composition of inserted particles
}
2023-06-07 05:40:43 -07:00
} \endverbatim
*
2023-06-07 05:40:43 -07:00
* More information on the above dictionary entries can be found in
* the table below.
*
*
2023-06-07 05:40:43 -07:00
* | Parameter | Type | Description | Optional [default value] |
* |----| :---: | ---- | ---- |
* | type | word | type of the insertion region with name ### | No |
* | rate | real | rate of insertion (particle/s) | No |
* | startTime | real | start of insertion (s) | No |
* | endTime | real | end of insertion (s) | No |
* | interval | real | time interval between successive insertions (s) | No |
* | ###Info | dictionary | data for insertion region | No |
* | setFields | dictionary | set field for inserted particles (s) | Yes [empty
dictionray] |
2023-06-07 05:40:43 -07:00
* | mixture | dictionary | mixture of particles to be inserted (s) | No |
*
2023-06-07 05:40:43 -07:00
*/
2022-09-05 01:56:29 +04:30
class insertionRegion
{
private:
/// name of this region
const word name_;
/// insertion region dictionary
const dictionary& dict_;
2022-09-05 01:56:29 +04:30
/// ref to insertion
const insertion& insertion_;
/// @brief time control for insertion events
baseTimeControl tControl_;
/// rate of insertion
real rate_;
/// number of inserted particles
uint32 numInserted_ = 0;
2022-09-05 01:56:29 +04:30
2023-06-07 05:40:43 -07:00
/// type of insertion region
word type_;
2022-09-05 01:56:29 +04:30
2023-06-07 05:40:43 -07:00
/// peakable region of points
uniquePtr<peakableRegion> pRegion_ = nullptr;
/// mixture of shapes
uniquePtr<shapeMixture> mixture_ = nullptr;
/// @brief dictionary for set field
uniquePtr<dictionary> setFieldDict_ = nullptr;
2022-09-05 01:56:29 +04:30
/// list of (filedName type value) for the fields
anyList setFieldList_;
2022-09-05 01:56:29 +04:30
private:
2022-09-05 01:56:29 +04:30
// - private methods
2022-09-05 01:56:29 +04:30
2023-06-07 05:40:43 -07:00
/// read from dictionary
2022-09-05 01:56:29 +04:30
bool readInsertionRegion(const dictionary& dict);
2023-06-07 05:40:43 -07:00
/// write to dictionary
2022-09-05 01:56:29 +04:30
bool writeInsertionRegion(dictionary& dict) const;
bool readSetFieldDict();
2022-09-05 01:56:29 +04:30
public:
2023-06-07 05:40:43 -07:00
/// Type info
2022-12-10 01:32:54 +03:30
TypeInfoNV("insertionRegion");
2022-09-05 01:56:29 +04:30
2023-06-07 05:40:43 -07:00
// - Constructors
2022-09-05 01:56:29 +04:30
/// Construct from a dictionary
insertionRegion(const word& name, const insertion& instn);
2022-09-05 01:56:29 +04:30
/// Destructor
~insertionRegion() = default;
2022-09-05 01:56:29 +04:30
// - Methods
2022-09-05 01:56:29 +04:30
/// Const ref to name of the region
const auto& name() const
{
return name_;
}
2022-09-05 01:56:29 +04:30
/// return type of insertion region
const auto& type() const
{
return type_;
}
2022-09-05 01:56:29 +04:30
const auto& dict()const
{
return dict_;
}
const auto& Insertion() const
{
return insertion_;
}
const pointStructure& pStruct()const;
inline bool insertionTime(uint32 iter, real t, real dt) const
{
return tControl_.timeEvent(iter, t, dt);
}
uint32 numberToBeInserted(uint32 iter, real t, real dt);
2022-09-05 01:56:29 +04:30
inline uint32 addToNumInserted(uint32 newInserted)
{
return numInserted_ += newInserted;
}
2022-09-05 01:56:29 +04:30
inline uint32 totalInserted() const
{
return numInserted_;
}
2023-06-07 05:40:43 -07:00
auto& mixture()
{
return mixture_();
}
2022-09-05 01:56:29 +04:30
auto& pRegion()
{
return pRegion_();
}
2022-09-05 01:56:29 +04:30
const auto& setFieldList() const
{
return setFieldList_;
}
2023-06-07 05:40:43 -07:00
// - IO operation
2022-09-05 01:56:29 +04:30
/// read from dictionary
/*bool read(const dictionary& dict)
{
if (!timeFlowControl::read(dict))
return false;
2022-09-05 01:56:29 +04:30
return readInsertionRegion(dict);
}*/
2022-09-05 01:56:29 +04:30
/// write to dictionary
bool write(dictionary& dict) const
{
return writeInsertionRegion(dict);
}
2022-09-05 01:56:29 +04:30
};
} // pFlow
2022-09-05 01:56:29 +04:30
2022-12-10 01:32:54 +03:30
#endif //__insertionRegion_hpp__