# PhasicFlow: src/MotionModel/rotatingAxisMotion/rotatingAxisMotion.hpp Source File

rotatingAxisMotion.hpp
Go to the documentation of this file.
/*------------------------------- 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 __rotatingAxisMotion_hpp__
#define __rotatingAxisMotion_hpp__
#include "types.hpp"
#include "typeInfo.hpp"
#include "VectorDual.hpp"
#include "Vectors.hpp"
#include "List.hpp"
#include "rotatingAxis.hpp"
namespace pFlow
{
class dictionary;
class rotatingAxisMotion
{
public:
class Model
{
protected:
deviceViewType1D<rotatingAxis> axis_;
int32 numAxis_=0;
public:
INLINE_FUNCTION_HD
Model(deviceViewType1D<rotatingAxis> axis, int32 numAxis):
axis_(axis),
numAxis_(numAxis)
{}
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 axis_[n].linTangentialVelocityPoint(p);
}
INLINE_FUNCTION_HD
realx3 operator()(int32 n, const realx3& p)const
{
return pointVelocity(n,p);
}
INLINE_FUNCTION_HD
realx3 transferPoint(int32 n, const realx3 p, real dt)const
{
return rotate(p, axis_[n], dt);
}
INLINE_FUNCTION_HD int32 numComponents()const
{
return numAxis_;
}
};
protected:
using axisVector_HD = VectorDual<rotatingAxis>;
axisVector_HD axis_;
wordList axisName_;
label numAxis_= 0;
bool readDictionary(const dictionary& dict);
bool writeDictionary(dictionary& dict)const;
public:
TypeInfoNV("rotatingAxisMotion");
// - Constructors
FUNCTION_H
rotatingAxisMotion();
FUNCTION_H
rotatingAxisMotion(const dictionary& dict);
FUNCTION_H
rotatingAxisMotion(const rotatingAxisMotion&) = default;
rotatingAxisMotion(rotatingAxisMotion&&) = delete;
FUNCTION_H
rotatingAxisMotion& operator=(const rotatingAxisMotion&) = default;
rotatingAxisMotion& operator=(rotatingAxisMotion&&) = delete;
FUNCTION_H
~rotatingAxisMotion() = default;
// - Methods
Model getModel(real t)
{
for(int32 i= 0; i<numAxis_; i++ )
{
axis_[i].setTime(t);
}
axis_.modifyOnHost();
axis_.syncViews();
return Model(axis_.deviceVector(), numAxis_);
}
INLINE_FUNCTION_H
int32 nameToIndex(const word& name)const
{
if( auto i = axisName_.findi(name); i == -1)
{
fatalErrorInFunction<<
"axis name " << name << " does not exist. \n";
fatalExit;
return i;
}
else
{
return i;
}
}
INLINE_FUNCTION_H
word indexToName(label i)const
{
if(i < numAxis_ )
return axisName_[i];
else
{
fatalErrorInFunction<<
"out of range access to the list of axes " << i <<endl<<
" size of axes_ is "<<numAxis_<<endl;
fatalExit;
return "";
}
}
INLINE_FUNCTION_HD
bool isMoving()const
{
return true;
}
INLINE_FUNCTION_H
bool move(real t, real dt)
{
return true;
}
// - IO operation
FUNCTION_H
bool read(iIstream& is);
FUNCTION_H
bool write(iOstream& os)const;
};
} // pFlow
#endif //__rotatingAxisMotion_hpp__
pFlow::List< word >
pFlow::rotatingAxisMotion::move
INLINE_FUNCTION_H bool move(real t, real dt)
Move.
Definition: rotatingAxisMotion.hpp:229
pFlow::VectorDual::syncViews
INLINE_FUNCTION_H void syncViews()
Definition: VectorDual.hpp:875
pFlow::rotatingAxisMotion::Model::operator()
INLINE_FUNCTION_HD realx3 operator()(int32 n, const realx3 &p) const
Definition: rotatingAxisMotion.hpp:102
pFlow::real
float real
Definition: builtinTypes.hpp:46
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::rotatingAxisMotion::write
FUNCTION_H bool write(iOstream &os) const
Write to output stream os.
Definition: rotatingAxisMotion.cpp:151
pFlow::rotatingAxisMotion
Rotating axis motion model for walls.
Definition: rotatingAxisMotion.hpp:65
types.hpp
pFlow::rotatingAxisMotion::Model::operator=
INLINE_FUNCTION_HD Model & operator=(const Model &)=default
pFlow::rotatingAxisMotion::rotatingAxisMotion
FUNCTION_H rotatingAxisMotion()
Empty.
Definition: rotatingAxisMotion.cpp:115
List.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::rotatingAxisMotion::nameToIndex
INLINE_FUNCTION_H int32 nameToIndex(const word &name) const
Motion component name to index.
Definition: rotatingAxisMotion.hpp:187
pFlow::rotatingAxisMotion::numAxis_
label numAxis_
Number of axes components.
Definition: rotatingAxisMotion.hpp:130
Vectors.hpp
rotatingAxis.hpp
pFlow::rotatingAxisMotion::TypeInfoNV
TypeInfoNV("rotatingAxisMotion")
Type info.
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow::rotatingAxisMotion::writeDictionary
bool writeDictionary(dictionary &dict) const
Write to dictionary.
Definition: rotatingAxisMotion.cpp:91
pFlow::VectorDual::modifyOnHost
INLINE_FUNCTION_H void modifyOnHost()
Definition: VectorDual.hpp:796
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
Definition: KokkosTypes.hpp:93
VectorDual.hpp
pFlow
Definition: demComponent.hpp:28
pFlow::rotatingAxisMotion::operator=
FUNCTION_H rotatingAxisMotion & operator=(const rotatingAxisMotion &)=default
Copy assignment.
FUNCTION_H
#define FUNCTION_H
Definition: pFlowMacros.hpp:58
pFlow::rotatingAxisMotion::~rotatingAxisMotion
FUNCTION_H ~rotatingAxisMotion()=default
Destructor.
pFlow::List::findi
int32 findi(const T &val) const
Definition: ListI.hpp:109
n
int32 n
Definition: NBSCrossLoop.hpp:24
pFlow::iIstream
Definition: iIstream.hpp:33
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::VectorDual< rotatingAxis >
pFlow::rotatingAxisMotion::Model::transferPoint
INLINE_FUNCTION_HD realx3 transferPoint(int32 n, const realx3 p, real dt) const
Definition: rotatingAxisMotion.hpp:108
pFlow::rotatingAxisMotion::Model::numAxis_
int32 numAxis_
Definition: rotatingAxisMotion.hpp:77
INLINE_FUNCTION_H
#define INLINE_FUNCTION_H
Definition: pFlowMacros.hpp:53
pFlow::rotatingAxisMotion::isMoving
INLINE_FUNCTION_HD bool isMoving() const
Are walls moving.
Definition: rotatingAxisMotion.hpp:222
pFlow::rotatingAxisMotion::read
FUNCTION_H bool read(iIstream &is)
Read from input stream is.
Definition: rotatingAxisMotion.cpp:130
pFlow::rotatingAxisMotion::Model::pointVelocity
INLINE_FUNCTION_HD realx3 pointVelocity(int32 n, const realx3 &p) const
Definition: rotatingAxisMotion.hpp:96
pFlow::rotatingAxisMotion::axis_
axisVector_HD axis_
Vector to store axes.
Definition: rotatingAxisMotion.hpp:124
rotate
INLINE_FUNCTION_HD realx3 rotate(const realx3 &p, const line &ln, real theta)
pFlow::rotatingAxisMotion::Model::Model
INLINE_FUNCTION_HD Model(deviceViewType1D< rotatingAxis > axis, int32 numAxis)
Definition: rotatingAxisMotion.hpp:82
pFlow::rotatingAxisMotion::readDictionary
bool readDictionary(const dictionary &dict)
Read from dictionary.
Definition: rotatingAxisMotion.cpp:27
pFlow::rotatingAxisMotion::Model
Motion model class to be passed to computational units/kernels for transfing points and returning vel...
Definition: rotatingAxisMotion.hpp:72
pFlow::rotatingAxisMotion::axisName_
wordList axisName_
Names of axes.
Definition: rotatingAxisMotion.hpp:127
pFlow::rotatingAxisMotion::getModel
Model getModel(real t)
Return the motion model at time t.
Definition: rotatingAxisMotion.hpp:173
pFlow::VectorDual::deviceVector
INLINE_FUNCTION_H deviceViewType & deviceVector()
Definition: VectorDual.hpp:354
pFlow::rotatingAxisMotion::Model::axis_
deviceViewType1D< rotatingAxis > axis_
Definition: rotatingAxisMotion.hpp:76
typeInfo.hpp
pFlow::label
std::size_t label
Definition: builtinTypes.hpp:61
pFlow::rotatingAxisMotion::Model::numComponents
INLINE_FUNCTION_HD int32 numComponents() const
Definition: rotatingAxisMotion.hpp:113
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:51
pFlow::triple< real >
pFlow::rotatingAxisMotion::indexToName
INLINE_FUNCTION_H word indexToName(label i) const
Motion index to motion component name.
Definition: rotatingAxisMotion.hpp:205
pFlow::iOstream
Definition: iOstream.hpp:53
pFlow::dictionary
Definition: dictionary.hpp:38