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

102 lines
2.3 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
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
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
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 __timeFlowControl_hpp__
#define __timeFlowControl_hpp__
2022-09-05 01:56:29 +04:30
2022-12-10 01:32:54 +03:30
#include "types.hpp"
#include "streams.hpp"
2022-09-05 01:56:29 +04:30
namespace pFlow
{
class dictionary;
2023-06-07 05:40:43 -07:00
/**
* Time control for particle insertion
*/
2022-09-05 01:56:29 +04:30
class timeFlowControl
{
protected:
2023-06-07 05:40:43 -07:00
/// start time of insertion
2022-09-05 01:56:29 +04:30
real startTime_;
2023-06-07 05:40:43 -07:00
/// end time of insertion
2022-09-05 01:56:29 +04:30
real endTime_;
2023-06-07 05:40:43 -07:00
/// time interval between each insertion
2022-09-05 01:56:29 +04:30
real interval_;
2023-06-07 05:40:43 -07:00
/// rate of insertion
2022-09-05 01:56:29 +04:30
real rate_;
2023-06-07 05:40:43 -07:00
/// number of inserted particles
size_t numInserted_ = 0;
2022-09-05 01:56:29 +04:30
2023-06-07 05:40:43 -07:00
/// Read dictionary
2022-09-05 01:56:29 +04:30
bool readTimeFlowControl(const dictionary& dict);
2023-06-07 05:40:43 -07:00
/// Write to dictionary
2022-09-05 01:56:29 +04:30
bool writeTimeFlowControl(dictionary& dict) const;
2023-06-07 05:40:43 -07:00
/// Return number of particles to be inserted at time currentTime
size_t numberToBeInserted(real currentTime);
/// Add to numInserted
inline
2022-09-05 01:56:29 +04:30
size_t addToNumInserted(size_t newInserted)
{
return numInserted_ += newInserted;
}
public:
2023-06-07 05:40:43 -07:00
/// Construct from dictionary
2022-09-05 01:56:29 +04:30
timeFlowControl(const dictionary& dict);
2023-06-07 05:40:43 -07:00
/// Is currentTime the insertion moment?
bool insertionTime( real currentTime, real dt);
/// Total number inserted so far
2022-09-05 01:56:29 +04:30
size_t totalInserted()const
{
return numInserted_;
}
2023-06-07 05:40:43 -07:00
/// Read from dictionary
2022-09-05 01:56:29 +04:30
bool read(const dictionary& dict)
{
return readTimeFlowControl(dict);
}
2023-06-07 05:40:43 -07:00
/// Write to dictionary
2022-09-05 01:56:29 +04:30
bool write(dictionary& dict)const
{
return writeTimeFlowControl(dict);
}
};
}
2022-12-10 01:32:54 +03:30
#endif //__timeFlowControl_hpp__