Motion models integrated into geometryMotion, stationaryWall is added

This commit is contained in:
Hamidreza Norouzi
2024-02-05 21:27:24 -08:00
parent 9dfe98eea2
commit 5b4a524afe
39 changed files with 1203 additions and 726 deletions

View File

@ -1,13 +1,16 @@
list(APPEND SourceFiles
entities/timeInterval/timeInterval.cpp
entities/rotatingAxis/rotatingAxis.cpp
rotatingAxisMotion/rotatingAxisMotion.cpp
entities/vibrating/vibrating.cpp
vibratingMotion/vibratingMotion.cpp
#fixedWall/fixedWall.cpp
stationaryWall/stationaryWall.cpp
entities/stationary/stationary.cpp
#entities/multiRotatingAxis/multiRotatingAxis.cpp
#multiRotatingAxisMotion/multiRotatingAxisMotion.cpp

View File

@ -149,7 +149,11 @@ protected:
bool impl_indexToName(uint32 i, word& name)const;
const wordList& impl_componentNames()const
{
return componentNames_;
}
bool impl_isMoving()const
{
return false;
@ -221,6 +225,11 @@ public:
{
return getModel().impl_indexToName(idx, name);
}
const wordList& componentNames()const
{
return getModel().impl_componentNames();
}
/// Are walls moving
bool isMoving()const

View File

@ -75,6 +75,8 @@ public:
// - Constructor
TypeInfoNV("rotatingAxis");
/// Empty constructor
FUNCTION_HD
rotatingAxis()=default;

View File

@ -0,0 +1,57 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#include "stationary.hpp"
FUNCTION_H
pFlow::stationary::stationary(const dictionary& dict)
{
}
FUNCTION_H
bool pFlow::stationary::read(const dictionary& dict)
{
return true;
}
FUNCTION_H
bool pFlow::stationary::write(dictionary& dict) const
{
return true;
}
FUNCTION_H
bool pFlow::stationary::read(iIstream& is)
{
notImplementedFunction;
return true;
}
FUNCTION_H
bool pFlow::stationary::write(iOstream& os)const
{
return true;
}

View File

@ -0,0 +1,104 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#ifndef __stationary_hpp__
#define __stationary_hpp__
#include "types.hpp"
#include "typeInfo.hpp"
#include "streams.hpp"
namespace pFlow
{
// forward
class dictionary;
/**
* stationary model for a wall
*
*/
class stationary
{
public:
TypeInfoNV("stationary");
FUNCTION_HD
stationary()=default;
FUNCTION_H
explicit stationary(const dictionary& dict);
FUNCTION_HD
stationary(const stationary&) = default;
stationary& operator=(const stationary&) = default;
INLINE_FUNCTION_HD
void setTime(real t)
{}
INLINE_FUNCTION_HD
realx3 linTangentialVelocityPoint(const realx3 &)const
{
return zero3;
}
INLINE_FUNCTION_HD
realx3 transferPoint(const realx3& p, real dt)
{
return p;
}
// - IO operation
FUNCTION_H
bool read(const dictionary& dict);
FUNCTION_H
bool write(dictionary& dict) const;
FUNCTION_H
bool read(iIstream& is);
FUNCTION_H
bool write(iOstream& os)const;
};
inline iOstream& operator <<(iOstream& os, const stationary& obj)
{
return os;
}
inline iIstream& operator >>(iIstream& is, stationary& obj)
{
return is;
}
}
#endif

View File

@ -94,6 +94,8 @@ private:
public:
TypeInfoNV("vibrating");
FUNCTION_HD
vibrating()=default;

View File

@ -1,110 +0,0 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#include "fixedWall.hpp"
#include "dictionary.hpp"
#include "vocabs.hpp"
bool pFlow::fixedWall::readDictionary
(
const dictionary& dict
)
{
auto motionModel = dict.getVal<word>("motionModel");
if(motionModel != "fixedWall")
{
fatalErrorInFunction<<
" motionModel should be fixedWall, but found " << motionModel <<endl;
return false;
}
return true;
}
bool pFlow::fixedWall::writeDictionary
(
dictionary& dict
)const
{
dict.add("motionModel", "fixedWall");
auto& motionInfo = dict.subDictOrCreate("fixedWallInfo");
return true;
}
pFlow::fixedWall::fixedWall()
{}
pFlow::fixedWall::fixedWall
(
const dictionary& dict
)
{
if(! readDictionary(dict) )
{
fatalExit;
}
}
bool pFlow::fixedWall::read
(
iIstream& is
)
{
// create an empty file dictionary
dictionary motionInfo(motionModelFile__, true);
// read dictionary from stream
if( !motionInfo.read(is) )
{
ioErrorInFile(is.name(), is.lineNumber()) <<
" error in reading dictionray " << motionModelFile__ <<" from file. \n";
return false;
}
if( !readDictionary(motionInfo) ) return false;
return true;
}
bool pFlow::fixedWall::write
(
iOstream& os
)const
{
// create an empty file dictionary
dictionary motionInfo(motionModelFile__, true);
if( !writeDictionary(motionInfo))
{
return false;
}
if( !motionInfo.write(os) )
{
ioErrorInFile( os.name(), os.lineNumber() )<<
" error in writing dictionray to file. \n";
return false;
}
return true;
}

View File

@ -1,206 +0,0 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#ifndef __fixedWall_hpp__
#define __fixedWall_hpp__
#include "types.hpp"
#include "typeInfo.hpp"
#include "Vectors.hpp"
#include "uniquePtr.hpp"
namespace pFlow
{
class dictionary;
/**
* Fixed wall motion model for walls
*
* This class is used for geometries that are fixed during simulation.
*
*
\verbatim
// In geometryDict file, this will defines fixed walls during simulation
...
motionModel fixedWall;
...
\endverbatim
*/
class fixedWall
{
public:
/** Motion model class to be passed to computational units/kernels for
* transfing points and returning velocities at various positions
*/
class Model
{
public:
INLINE_FUNCTION_HD
Model(){}
INLINE_FUNCTION_HD
Model(const Model&) = default;
INLINE_FUNCTION_HD
Model& operator=(const Model&) = default;
INLINE_FUNCTION_HD
realx3 pointVelocity(int32 n, const realx3 p)const
{
return 0.0;
}
INLINE_FUNCTION_HD
realx3 operator()(int32 n, const realx3& p)const
{
return 0.0;
}
INLINE_FUNCTION_HD
realx3 transferPoint(int32 n, const realx3 p, real dt)const
{
return p;
}
INLINE_FUNCTION_HD int32 numComponents()const
{
return 0;
}
};
protected:
/// Name
const word name_ = "none";
/// Read from a dictionary
bool readDictionary(const dictionary& dict);
/// write to a dictionary
bool writeDictionary(dictionary& dict)const;
public:
/// Type info
TypeInfoNV("fixedWall");
// - Constructors
/// Empty
fixedWall();
/// Constructor with dictionary
fixedWall(const dictionary& dict);
/// Copy constructor
fixedWall(const fixedWall&) = default;
/// Move constructor
fixedWall(fixedWall&&) = default;
/// Copy assignment
fixedWall& operator=(const fixedWall&) = default;
/// Move assignment
fixedWall& operator=(fixedWall&&) = default;
/// Destructor
~fixedWall() = default;
// - Methods
/// Return motion model
/// t is the current simulation time
Model getModel(real t)const
{
return Model();
}
/// Name of the motion component to index
int32 nameToIndex(const word& name)const
{
return 0;
}
/// Index of motion component to name
word indexToName(label i)const
{
return name_;
}
/// Velocity at point p
INLINE_FUNCTION_HD
realx3 pointVelocity(label n, const realx3& p)const
{
return zero3;
}
/// Transfer point p for dt seconds according to motion component n
INLINE_FUNCTION_HD
realx3 transferPoint(label n, const realx3 p, real dt)const
{
return p;
}
/// Transfer a vector of point pVec for dt seconds according to motion
/// component n
INLINE_FUNCTION_HD
bool transferPoint(label n, realx3* pVec, size_t numP, real dt)
{
return true;
}
/// Are walls moving
INLINE_FUNCTION_HD
bool isMoving()const
{
return false;
}
/// Move points
bool move(real t, real dt)
{
return true;
}
// - IO operations
/// Read from input stream is
FUNCTION_H
bool read(iIstream& is);
/// Write to output stream os
FUNCTION_H
bool write(iOstream& os)const;
};
} // pFlow
#endif //__fixed_hpp__

View File

@ -37,6 +37,22 @@ pFlow::rotatingAxisMotion::rotatingAxisMotion
}
}
pFlow::rotatingAxisMotion::rotatingAxisMotion
(
const objectFile &objf,
const dictionary &dict,
repository *owner
)
:
fileDictionary(objf, dict, owner)
{
if(! getModel().impl_readDictionary(*this) )
{
fatalErrorInFunction;
fatalExit;
}
}
bool pFlow::rotatingAxisMotion::write
(
iOstream &os,

View File

@ -70,12 +70,17 @@ protected:
public:
TypeInfo("rotatingAxisMotion");
TypeInfo("rotatingAxisMotion");
rotatingAxisMotion(const objectFile& objf, repository* owner);
rotatingAxisMotion(const objectFile& objf, repository* owner);
rotatingAxisMotion(
const objectFile& objf,
const dictionary& dict,
repository* owner);
bool write(iOstream& os, const IOPattern& iop)const override;
bool write(iOstream& os, const IOPattern& iop)const override;
static
auto noneComponent()

View File

@ -0,0 +1,75 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#include "stationaryWall.hpp"
pFlow::stationaryWall::stationaryWall
(
const objectFile &objf,
repository *owner
)
:
fileDictionary(objf, owner)
{
if(! getModel().impl_readDictionary(*this) )
{
fatalErrorInFunction;
fatalExit;
}
}
pFlow::stationaryWall::stationaryWall
(
const objectFile &objf,
const dictionary &dict,
repository *owner
)
:
fileDictionary(objf, dict, owner)
{
if(! getModel().impl_readDictionary(*this) )
{
fatalErrorInFunction;
fatalExit;
}
}
bool pFlow::stationaryWall::write
(
iOstream &os,
const IOPattern &iop
) const
{
// a global dictionary
dictionary newDict(fileDictionary::dictionary::name(), true);
if( iop.thisProcWriteData() )
{
if( !this->impl_writeDictionary(newDict) ||
!newDict.write(os))
{
fatalErrorInFunction<<
" error in writing to dictionary "<< newDict.globalName()<<endl;
return false;
}
}
return true;
}

View File

@ -0,0 +1,69 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#ifndef __stationaryWall_hpp__
#define __stationaryWall_hpp__
#include "MotionModel.hpp"
#include "stationary.hpp"
#include "fileDictionary.hpp"
namespace pFlow
{
class stationaryWall
:
public fileDictionary,
public MotionModel<stationaryWall, stationary>
{
protected:
bool impl_isMoving()const
{
return false;
}
public:
TypeInfo("stationaryWall");
stationaryWall(const objectFile& objf, repository* owner);
stationaryWall(
const objectFile& objf,
const dictionary& dict,
repository* owner);
bool write(iOstream& os, const IOPattern& iop)const override;
static
auto noneComponent()
{
return stationary();
}
};
} // pFlow
#endif // __stationaryWall_hpp__

View File

@ -14,6 +14,22 @@ pFlow::vibratingMotion::vibratingMotion
}
}
pFlow::vibratingMotion::vibratingMotion
(
const objectFile &objf,
const dictionary &dict,
repository *owner
)
:
fileDictionary(objf,dict,owner)
{
if(! getModel().impl_readDictionary(*this) )
{
fatalErrorInFunction;
fatalExit;
}
}
bool pFlow::vibratingMotion::write(iOstream &os, const IOPattern &iop) const
{
// a global dictionary

View File

@ -81,6 +81,11 @@ public:
vibratingMotion(const objectFile& objf, repository* owner);
vibratingMotion(
const objectFile& objf,
const dictionary& dict,
repository* owner);
/// Destructor
~vibratingMotion()override = default;