mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
src folder
This commit is contained in:
12
src/Geometry/CMakeLists.txt
Normal file
12
src/Geometry/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
list(APPEND SourceFiles
|
||||
geometry/geometry.C
|
||||
geometryMotion/geometryMotions.C
|
||||
)
|
||||
|
||||
set(link_libs Kokkos::kokkos phasicFlow MotionModel Property)
|
||||
|
||||
pFlow_add_library_install(Geometry SourceFiles link_libs)
|
||||
|
||||
|
||||
|
47
src/Geometry/geometry/demGeometry.H
Normal file
47
src/Geometry/geometry/demGeometry.H
Normal file
@ -0,0 +1,47 @@
|
||||
/*------------------------------- 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 __demGeometry_H__
|
||||
#define __demGeometry_H__
|
||||
|
||||
#include "demComponent.H"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
class demGeometry
|
||||
:
|
||||
public demComponent
|
||||
{
|
||||
|
||||
public:
|
||||
demGeometry(systemControl& control)
|
||||
:
|
||||
demComponent("geometry", control)
|
||||
{}
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
316
src/Geometry/geometry/geometry.C
Normal file
316
src/Geometry/geometry/geometry.C
Normal file
@ -0,0 +1,316 @@
|
||||
/*------------------------------- 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 "geometry.H"
|
||||
#include "vocabs.H"
|
||||
|
||||
|
||||
bool pFlow::geometry::findPropertyId()
|
||||
{
|
||||
|
||||
int8Vector propId(0, surface().capacity(),RESERVE());
|
||||
propId.clear();
|
||||
|
||||
uint32 pId;
|
||||
forAll(matI, materialName_)
|
||||
{
|
||||
|
||||
if( !wallProperty_.nameToIndex( materialName_[matI], pId ) )
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"material name for the geometry is invalid: "<< materialName_[matI]<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 surfSize = surface().surfNumTriangles(matI);
|
||||
|
||||
for(int32 i=0; i<surfSize; i++)
|
||||
{
|
||||
propId.push_back(pId);
|
||||
}
|
||||
}
|
||||
|
||||
propertyId_.assign(propId);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
pFlow::geometry::geometry
|
||||
(
|
||||
systemControl& control,
|
||||
const property& prop
|
||||
)
|
||||
:
|
||||
demGeometry(control),
|
||||
wallProperty_(prop),
|
||||
geometryRepository_(control.geometry()),
|
||||
triSurface_(
|
||||
control.geometry().emplaceObject<multiTriSurface>(
|
||||
objectFile(
|
||||
"triSurface",
|
||||
"",
|
||||
objectFile::READ_ALWAYS,
|
||||
objectFile::WRITE_ALWAYS
|
||||
)
|
||||
)
|
||||
),
|
||||
motionComponentName_(
|
||||
control.geometry().emplaceObject<wordField>(
|
||||
objectFile(
|
||||
"motionComponentName",
|
||||
"",
|
||||
objectFile::READ_ALWAYS,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
"motionNamesList"
|
||||
)
|
||||
),
|
||||
materialName_(
|
||||
control.geometry().emplaceObject<wordField>(
|
||||
objectFile(
|
||||
"materialName",
|
||||
"",
|
||||
objectFile::READ_ALWAYS,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
"materialNamesList"
|
||||
)
|
||||
),
|
||||
propertyId_(
|
||||
control.geometry().emplaceObject<int8TriSurfaceField_D>(
|
||||
objectFile(
|
||||
"propertyId",
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_NEVER),
|
||||
surface(),
|
||||
0 ) ),
|
||||
contactForceWall_(
|
||||
control.geometry().emplaceObject<realx3TriSurfaceField_D>(
|
||||
objectFile(
|
||||
"contactForceWall",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS),
|
||||
surface(),
|
||||
zero3) ),
|
||||
stressWall_(
|
||||
control.geometry().emplaceObject<realx3TriSurfaceField_D>(
|
||||
objectFile(
|
||||
"stressWall",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS),
|
||||
surface(),
|
||||
zero3) )
|
||||
{
|
||||
|
||||
if(!findPropertyId())
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
||||
|
||||
pFlow::geometry::geometry
|
||||
(
|
||||
systemControl& control,
|
||||
const property& prop,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& matName
|
||||
)
|
||||
:
|
||||
demGeometry(control),
|
||||
wallProperty_(prop),
|
||||
geometryRepository_(control.geometry()),
|
||||
triSurface_(
|
||||
control.geometry().emplaceObject<multiTriSurface>(
|
||||
objectFile(
|
||||
"triSurface",
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
triSurface
|
||||
)
|
||||
),
|
||||
motionComponentName_(
|
||||
control.geometry().emplaceObject<wordField>(
|
||||
objectFile(
|
||||
"motionComponentName",
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
"motionNamesList",
|
||||
motionCompName
|
||||
)
|
||||
),
|
||||
materialName_(
|
||||
control.geometry().emplaceObject<wordField>(
|
||||
objectFile(
|
||||
"materialName",
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
"materialNamesList",
|
||||
matName
|
||||
)
|
||||
),
|
||||
propertyId_(
|
||||
control.geometry().emplaceObject<int8TriSurfaceField_D>(
|
||||
objectFile(
|
||||
"propertyId",
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_NEVER),
|
||||
surface(),
|
||||
0 ) ),
|
||||
contactForceWall_(
|
||||
control.geometry().emplaceObject<realx3TriSurfaceField_D>(
|
||||
objectFile(
|
||||
"contactForceWall",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS),
|
||||
surface(),
|
||||
zero3) ),
|
||||
stressWall_(
|
||||
control.geometry().emplaceObject<realx3TriSurfaceField_D>(
|
||||
objectFile(
|
||||
"stressWall",
|
||||
"",
|
||||
objectFile::READ_IF_PRESENT,
|
||||
objectFile::WRITE_ALWAYS),
|
||||
surface(),
|
||||
zero3) )
|
||||
{
|
||||
if(!findPropertyId())
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
||||
|
||||
pFlow::geometry::geometry
|
||||
(
|
||||
systemControl& control,
|
||||
const property& prop,
|
||||
const dictionary& dict,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& matName
|
||||
)
|
||||
:
|
||||
geometry(control, prop, triSurface, motionCompName, matName)
|
||||
{}
|
||||
|
||||
|
||||
pFlow::uniquePtr<pFlow::geometry>
|
||||
pFlow::geometry::create
|
||||
(
|
||||
systemControl& control,
|
||||
const property& prop
|
||||
)
|
||||
{
|
||||
//motionModelFile__
|
||||
auto motionDictPtr = IOobject::make<dictionary>
|
||||
(
|
||||
objectFile
|
||||
(
|
||||
motionModelFile__,
|
||||
control.geometry().path(),
|
||||
objectFile::READ_ALWAYS,
|
||||
objectFile::WRITE_NEVER
|
||||
),
|
||||
motionModelFile__,
|
||||
true
|
||||
);
|
||||
|
||||
word model = motionDictPtr().getObject<dictionary>().getVal<word>("motionModel");
|
||||
|
||||
auto geomModel = angleBracketsNames("geometry", model);
|
||||
|
||||
Report(1)<< "Selecting geometry model . . ."<<endReport;
|
||||
if( systemControlvCtorSelector_.search(geomModel) )
|
||||
{
|
||||
auto objPtr = systemControlvCtorSelector_[geomModel] (control, prop);
|
||||
Report(2)<<"Model "<< greenText(geomModel)<<" is created.\n"<<endReport;
|
||||
return objPtr;
|
||||
}
|
||||
else
|
||||
{
|
||||
printKeys
|
||||
(
|
||||
fatalError << "Ctor Selector "<< yellowText(geomModel) << " dose not exist. \n"
|
||||
<<"Avaiable ones are: \n\n"
|
||||
,
|
||||
systemControlvCtorSelector_
|
||||
);
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pFlow::uniquePtr<pFlow::geometry>
|
||||
pFlow::geometry::create(
|
||||
systemControl& control,
|
||||
const property& prop,
|
||||
const dictionary& dict,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& propName)
|
||||
{
|
||||
|
||||
word model = dict.getVal<word>("motionModel");
|
||||
|
||||
auto geomModel = angleBracketsNames("geometry", model);
|
||||
|
||||
Report(1)<< "Selecting geometry model . . ."<<endReport;
|
||||
|
||||
if( dictionaryvCtorSelector_.search(geomModel) )
|
||||
{
|
||||
auto objPtr = dictionaryvCtorSelector_[geomModel]
|
||||
(
|
||||
control,
|
||||
prop,
|
||||
dict,
|
||||
triSurface,
|
||||
motionCompName,
|
||||
propName
|
||||
);
|
||||
Report(2)<<"Model "<< greenText(geomModel)<<" is created.\n"<<endReport;
|
||||
return objPtr;
|
||||
}
|
||||
else
|
||||
{
|
||||
printKeys
|
||||
(
|
||||
fatalError << "Ctor Selector "<< yellowText(geomModel) << " dose not exist. \n"
|
||||
<<"Avaiable ones are: \n\n"
|
||||
,
|
||||
dictionaryvCtorSelector_
|
||||
);
|
||||
fatalExit;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
268
src/Geometry/geometry/geometry.H
Normal file
268
src/Geometry/geometry/geometry.H
Normal file
@ -0,0 +1,268 @@
|
||||
/*------------------------------- 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 __geometry_H__
|
||||
#define __geometry_H__
|
||||
|
||||
|
||||
#include "virtualConstructor.H"
|
||||
#include "demGeometry.H"
|
||||
#include "property.H"
|
||||
#include "Fields.H"
|
||||
#include "Vectors.H"
|
||||
#include "multiTriSurface.H"
|
||||
#include "triSurfaceFields.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
class geometry
|
||||
:
|
||||
public demGeometry
|
||||
{
|
||||
protected:
|
||||
|
||||
const property& wallProperty_;
|
||||
|
||||
// - this object is owned by geometryRepository_
|
||||
repository& geometryRepository_;
|
||||
|
||||
// all triangles of walls
|
||||
multiTriSurface& triSurface_;
|
||||
|
||||
//
|
||||
wordField& motionComponentName_;
|
||||
|
||||
//
|
||||
wordField& materialName_;
|
||||
|
||||
int8TriSurfaceField_D& propertyId_;
|
||||
|
||||
realx3TriSurfaceField_D& contactForceWall_;
|
||||
|
||||
realx3TriSurfaceField_D& stressWall_;
|
||||
|
||||
bool findPropertyId();
|
||||
|
||||
void zeroForce()
|
||||
{
|
||||
contactForceWall_.fill(zero3);
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// - type info
|
||||
TypeName("geometry");
|
||||
|
||||
//// - Constructors
|
||||
|
||||
// - empty
|
||||
geometry(systemControl& control, const property& prop);
|
||||
|
||||
// - from components
|
||||
geometry(systemControl& control,
|
||||
const property& prop,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& propName
|
||||
);
|
||||
|
||||
geometry(systemControl& control,
|
||||
const property& prop,
|
||||
const dictionary& dict,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& propName);
|
||||
|
||||
|
||||
virtual ~geometry() = default;
|
||||
|
||||
create_vCtor
|
||||
(
|
||||
geometry,
|
||||
systemControl,
|
||||
(
|
||||
systemControl& control,
|
||||
const property& prop
|
||||
),
|
||||
(control, prop)
|
||||
);
|
||||
|
||||
create_vCtor
|
||||
(
|
||||
geometry,
|
||||
dictionary,
|
||||
(systemControl& control,
|
||||
const property& prop,
|
||||
const dictionary& dict,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& propName),
|
||||
(control, prop, dict, triSurface, motionCompName, propName)
|
||||
);
|
||||
|
||||
////- Methods
|
||||
|
||||
inline
|
||||
auto size()const
|
||||
{
|
||||
return triSurface_.size();
|
||||
}
|
||||
|
||||
inline
|
||||
auto numPoints()const
|
||||
{
|
||||
return triSurface_.numPoints();
|
||||
}
|
||||
|
||||
inline
|
||||
auto numTriangles()const
|
||||
{
|
||||
return size();
|
||||
}
|
||||
|
||||
inline
|
||||
const auto& points()const
|
||||
{
|
||||
return triSurface_.points();
|
||||
}
|
||||
|
||||
inline
|
||||
const auto& vertices()const
|
||||
{
|
||||
return triSurface_.vertices();
|
||||
}
|
||||
|
||||
inline auto getTriangleAccessor()const
|
||||
{
|
||||
return triSurface_.getTriangleAccessor();
|
||||
}
|
||||
|
||||
inline auto& surface()
|
||||
{
|
||||
return triSurface_;
|
||||
}
|
||||
|
||||
inline const auto& surface()const
|
||||
{
|
||||
return triSurface_;
|
||||
}
|
||||
|
||||
inline
|
||||
realx3TriSurfaceField_D& contactForceWall()
|
||||
{
|
||||
return contactForceWall_;
|
||||
}
|
||||
|
||||
inline
|
||||
const realx3TriSurfaceField_D& contactForceWall() const
|
||||
{
|
||||
return contactForceWall_;
|
||||
}
|
||||
|
||||
inline const auto& wallProperty()const
|
||||
{
|
||||
return wallProperty_;
|
||||
}
|
||||
|
||||
// owner repository
|
||||
inline
|
||||
const repository& owner()const
|
||||
{
|
||||
return geometryRepository_;
|
||||
}
|
||||
|
||||
inline
|
||||
repository& owner()
|
||||
{
|
||||
return geometryRepository_;
|
||||
}
|
||||
|
||||
inline auto path()
|
||||
{
|
||||
return owner().path();
|
||||
}
|
||||
|
||||
virtual
|
||||
word motionModelTypeName()const = 0;
|
||||
|
||||
virtual
|
||||
const int8Vector_HD& triMotionIndex() const =0;
|
||||
|
||||
virtual
|
||||
const int8Vector_HD& pointMotionIndex()const = 0;
|
||||
|
||||
const int8TriSurfaceField_D& propertyId() const
|
||||
{
|
||||
return propertyId_;
|
||||
}
|
||||
|
||||
bool beforeIteration() override {
|
||||
|
||||
this->zeroForce();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool afterIteration() override {
|
||||
|
||||
auto Force = contactForceWall_.deviceVectorAll();
|
||||
auto area = triSurface_.area().deviceVectorAll();
|
||||
auto stress = stressWall_.deviceVectorAll();
|
||||
auto numTri =triSurface_.size();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"geometry::calculateStress",
|
||||
numTri,
|
||||
LAMBDA_HD(int32 i){
|
||||
stress[i] = Force[i]/area[i];
|
||||
});
|
||||
Kokkos::fence();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool write()const
|
||||
{
|
||||
return owner().write();
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
|
||||
static
|
||||
uniquePtr<geometry> create(systemControl& control, const property& prop);
|
||||
|
||||
static
|
||||
uniquePtr<geometry> create(
|
||||
systemControl& control,
|
||||
const property& prop,
|
||||
const dictionary& dict,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& propName);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
189
src/Geometry/geometryMotion/geometryMotion.C
Normal file
189
src/Geometry/geometryMotion/geometryMotion.C
Normal file
@ -0,0 +1,189 @@
|
||||
/*------------------------------- 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.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
template<typename MotionModel>
|
||||
bool pFlow::geometryMotion<MotionModel>::moveGeometry()
|
||||
{
|
||||
|
||||
real dt = this->dt();
|
||||
|
||||
auto pointMIndex= pointMotionIndex_.deviceVector();
|
||||
auto mModel = motionModel_.getModel();
|
||||
realx3* points = triSurface_.pointsData_D();
|
||||
auto numPoints = triSurface_.numPoints();
|
||||
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"geometryMotion<MotionModel>::movePoints",
|
||||
numPoints,
|
||||
LAMBDA_HD(int32 i){
|
||||
auto newPos = mModel.transferPoint(pointMIndex[i], points[i], dt);
|
||||
points[i] = newPos;
|
||||
});
|
||||
|
||||
Kokkos::fence();
|
||||
|
||||
// end of calculations
|
||||
moveGeomTimer_.end();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename MotionModel>
|
||||
bool pFlow::geometryMotion<MotionModel>::findMotionIndex()
|
||||
{
|
||||
motionIndex_.clear();
|
||||
triMotionIndex_.reserve( this->surface().capacity() );
|
||||
triMotionIndex_.clear();
|
||||
|
||||
forAll( surfI, motionComponentName_)
|
||||
{
|
||||
auto mName = motionComponentName_[surfI];
|
||||
auto mInd = motionModel_.nameToIndex(mName);
|
||||
motionIndex_.push_back(mInd);
|
||||
// fill motionIndex for triangles of the surface
|
||||
int32 surfSize = this->surface().surfNumTriangles(surfI);
|
||||
for(int32 i=0; i<surfSize; i++)
|
||||
{
|
||||
triMotionIndex_.push_back(mInd);
|
||||
}
|
||||
}
|
||||
motionIndex_.syncViews();
|
||||
triMotionIndex_.syncViews();
|
||||
|
||||
pointMotionIndex_.reserve(triSurface_.numPoints());
|
||||
pointMotionIndex_.clear();
|
||||
|
||||
forAll(surfI, motionIndex_)
|
||||
{
|
||||
auto nP = triSurface_.surfNumPoints(surfI);
|
||||
for(int32 i=0; i<nP; i++)
|
||||
{
|
||||
pointMotionIndex_.push_back(motionIndex_[surfI]);
|
||||
}
|
||||
}
|
||||
pointMotionIndex_.syncViews();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename MotionModel>
|
||||
pFlow::geometryMotion<MotionModel>::geometryMotion
|
||||
(
|
||||
systemControl& control,
|
||||
const property& prop
|
||||
)
|
||||
:
|
||||
geometry(control, prop),
|
||||
motionModel_(
|
||||
this->owner().template emplaceObject<MotionModel>(
|
||||
objectFile(
|
||||
motionModelFile__,
|
||||
"",
|
||||
objectFile::READ_ALWAYS,
|
||||
objectFile::WRITE_ALWAYS
|
||||
)
|
||||
)
|
||||
),
|
||||
moveGeomTimer_("move geometry", &this->timers())
|
||||
{
|
||||
findMotionIndex();
|
||||
}
|
||||
|
||||
template<typename MotionModel>
|
||||
pFlow::geometryMotion<MotionModel>::geometryMotion
|
||||
(
|
||||
systemControl& control,
|
||||
const property& prop,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& propName,
|
||||
const MotionModel& motionModel
|
||||
)
|
||||
:
|
||||
geometry(
|
||||
control,
|
||||
prop,
|
||||
triSurface,
|
||||
motionCompName,
|
||||
propName
|
||||
),
|
||||
motionModel_(
|
||||
this->owner().template emplaceObject<MotionModel>(
|
||||
objectFile(
|
||||
motionModelFile__,
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
motionModel
|
||||
)
|
||||
),
|
||||
moveGeomTimer_("move geometry", &this->timers())
|
||||
{
|
||||
findMotionIndex();
|
||||
}
|
||||
|
||||
template<typename MotionModel>
|
||||
pFlow::geometryMotion<MotionModel>::geometryMotion
|
||||
(
|
||||
systemControl& control,
|
||||
const property& prop,
|
||||
const dictionary& dict,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& propName
|
||||
)
|
||||
:
|
||||
geometry(
|
||||
control,
|
||||
prop,
|
||||
dict,
|
||||
triSurface,
|
||||
motionCompName,
|
||||
propName
|
||||
),
|
||||
motionModel_(
|
||||
this->owner().template emplaceObject<MotionModel>(
|
||||
objectFile(
|
||||
motionModelFile__,
|
||||
"",
|
||||
objectFile::READ_NEVER,
|
||||
objectFile::WRITE_ALWAYS
|
||||
),
|
||||
dict
|
||||
)
|
||||
),
|
||||
moveGeomTimer_("move geometry", &this->timers())
|
||||
{
|
||||
findMotionIndex();
|
||||
}
|
||||
|
||||
template<typename MotionModel>
|
||||
bool pFlow::geometryMotion<MotionModel>::iterate()
|
||||
{
|
||||
if( motionModel_.isMoving() )
|
||||
{
|
||||
moveGeomTimer_.start();
|
||||
moveGeometry();
|
||||
moveGeomTimer_.end();
|
||||
}
|
||||
return true;
|
||||
}
|
155
src/Geometry/geometryMotion/geometryMotion.H
Normal file
155
src/Geometry/geometryMotion/geometryMotion.H
Normal file
@ -0,0 +1,155 @@
|
||||
/*------------------------------- 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 __geometryMotion_H__
|
||||
#define __geometryMotion_H__
|
||||
|
||||
|
||||
#include "geometry.H"
|
||||
#include "VectorDuals.H"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
template<typename MotionModelType>
|
||||
class geometryMotion
|
||||
:
|
||||
public geometry
|
||||
{
|
||||
public:
|
||||
|
||||
using MotionModel = MotionModelType;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
MotionModel& motionModel_;
|
||||
|
||||
// motion indext mapped on each surface
|
||||
int32Vector_HD motionIndex_;
|
||||
|
||||
// motion index mapped on each triangle
|
||||
int8Vector_HD triMotionIndex_;
|
||||
|
||||
/// motion index mapped on each point
|
||||
int8Vector_HD pointMotionIndex_;
|
||||
|
||||
// timer for moveGeometry
|
||||
Timer moveGeomTimer_;
|
||||
|
||||
|
||||
bool findMotionIndex();
|
||||
|
||||
public:
|
||||
|
||||
// type info
|
||||
TypeNameTemplate("geometry", MotionModel);
|
||||
|
||||
//// - Constructors
|
||||
|
||||
geometryMotion(systemControl& control, const property& prop);
|
||||
|
||||
// construct from components
|
||||
geometryMotion(
|
||||
systemControl& control,
|
||||
const property& prop,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& propName,
|
||||
const MotionModel& motionModel);
|
||||
|
||||
// - construct from components and dictionary that contains
|
||||
// motionModel
|
||||
geometryMotion(systemControl& control,
|
||||
const property& prop,
|
||||
const dictionary& dict,
|
||||
const multiTriSurface& triSurface,
|
||||
const wordVector& motionCompName,
|
||||
const wordVector& propName);
|
||||
|
||||
|
||||
|
||||
add_vCtor
|
||||
(
|
||||
geometry,
|
||||
geometryMotion,
|
||||
systemControl
|
||||
);
|
||||
|
||||
add_vCtor
|
||||
(
|
||||
geometry,
|
||||
geometryMotion,
|
||||
dictionary
|
||||
);
|
||||
|
||||
//// - Methods
|
||||
|
||||
auto getModel()const
|
||||
{
|
||||
return motionModel_.getModel();
|
||||
}
|
||||
|
||||
word motionModelTypeName()const override
|
||||
{
|
||||
return motionModel_.typeName();
|
||||
}
|
||||
|
||||
const int8Vector_HD& triMotionIndex()const override
|
||||
{
|
||||
return triMotionIndex_;
|
||||
}
|
||||
|
||||
const int8Vector_HD& pointMotionIndex()const override
|
||||
{
|
||||
return pointMotionIndex_;
|
||||
}
|
||||
|
||||
// - iterate
|
||||
bool beforeIteration() override {
|
||||
geometry::beforeIteration();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool iterate() override ;
|
||||
|
||||
bool afterIteration() override {
|
||||
geometry::afterIteration();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool moveGeometry();
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#include "geometryMotion.C"
|
||||
|
||||
#ifndef BUILD_SHARED_LIBS
|
||||
#include "geometryMotionsInstantiate.C"
|
||||
#endif
|
||||
|
||||
|
||||
#endif //__geometryMotion_H__
|
25
src/Geometry/geometryMotion/geometryMotions.C
Normal file
25
src/Geometry/geometryMotion/geometryMotions.C
Normal file
@ -0,0 +1,25 @@
|
||||
/*------------------------------- 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 "geometryMotions.H"
|
||||
|
||||
#ifdef BUILD_SHARED_LIBS
|
||||
#include "geometryMotionsInstantiate.C"
|
||||
#endif
|
40
src/Geometry/geometryMotion/geometryMotions.H
Normal file
40
src/Geometry/geometryMotion/geometryMotions.H
Normal file
@ -0,0 +1,40 @@
|
||||
/*------------------------------- 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 __geometryMotions_H__
|
||||
#define __geometryMotions_H__
|
||||
|
||||
#include "geometryMotion.H"
|
||||
#include "fixedWall.H"
|
||||
#include "rotatingAxisMotion.H"
|
||||
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
typedef geometryMotion<rotatingAxisMotion> rotationAxisMotionGeometry;
|
||||
|
||||
typedef geometryMotion<fixedWall> fixedGeometry;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
28
src/Geometry/geometryMotion/geometryMotionsInstantiate.C
Normal file
28
src/Geometry/geometryMotion/geometryMotionsInstantiate.C
Normal file
@ -0,0 +1,28 @@
|
||||
/*------------------------------- 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.H"
|
||||
#include "rotatingAxisMotion.H"
|
||||
|
||||
template class pFlow::geometryMotion<pFlow::fixedWall>;
|
||||
|
||||
template class pFlow::geometryMotion<pFlow::rotatingAxisMotion>;
|
||||
|
||||
|
Reference in New Issue
Block a user