# PhasicFlow: src/Geometry/geometry/geometry.hpp Source File

geometry.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 __geometry_hpp__
#define __geometry_hpp__
#include "virtualConstructor.hpp"
#include "demGeometry.hpp"
#include "property.hpp"
#include "Fields.hpp"
#include "Vectors.hpp"
#include "multiTriSurface.hpp"
#include "triSurfaceFields.hpp"
#include "dictionary.hpp"
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
TypeInfo("geometry");
// - 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)
);
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
pFlow::geometry::materialName_
wordField & materialName_
Definition: geometry.hpp:55
pFlow::triSurface::getTriangleAccessor
auto getTriangleAccessor() const
Definition: triSurface.hpp:174
pFlow::geometry::geometryRepository_
repository & geometryRepository_
Definition: geometry.hpp:46
pFlow::geometry::motionComponentName_
wordField & motionComponentName_
Definition: geometry.hpp:52
pFlow::geometry::surface
auto & surface()
Definition: geometry.hpp:160
pFlow::geometry::findPropertyId
bool findPropertyId()
Definition: geometry.cpp:25
triSurfaceFields.hpp
pFlow::geometry::points
const auto & points() const
Definition: geometry.hpp:144
pFlow::demComponent::control
const auto & control() const
Definition: demComponent.hpp:57
pFlow::geometry::contactForceWall
const realx3TriSurfaceField_D & contactForceWall() const
Definition: geometry.hpp:177
pFlow::geometry::create
static uniquePtr< geometry > create(systemControl &control, const property &prop)
Definition: geometry.cpp:229
pFlow::geometry::motionModelTypeName
virtual word motionModelTypeName() const =0
pFlow::geometry::size
auto size() const
Definition: geometry.hpp:126
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::systemControl
Definition: systemControl.hpp:41
pFlow::triSurface::area
const realVector_D & area() const
Definition: triSurface.hpp:194
pFlow::zero3
const realx3 zero3(0.0)
Definition: types.hpp:97
Vectors.hpp
pFlow::geometry::wallProperty_
const property & wallProperty_
Definition: geometry.hpp:43
pFlow::Field< Vector, word, vecAllocator< word > >
pFlow::geometry::stressWall_
realx3TriSurfaceField_D & stressWall_
Definition: geometry.hpp:61
pFlow::geometry::owner
const repository & owner() const
Definition: geometry.hpp:189
pFlow::repository::write
virtual bool write(bool verbose=false) const
Definition: repository.cpp:239
pFlow::triSurface::points
const realx3Vector_D & points() const
Definition: triSurface.hpp:184
pFlow
Definition: demComponent.hpp:28
pFlow::multiTriSurface
Definition: multiTriSurface.hpp:33
pFlow::geometry::afterIteration
bool afterIteration() override
Definition: geometry.hpp:226
pFlow::geometry::create_vCtor
create_vCtor(geometry, systemControl,(systemControl &control, const property &prop),(control, prop))
pFlow::geometry::contactForceWall_
realx3TriSurfaceField_D & contactForceWall_
Definition: geometry.hpp:59
pFlow::geometry::~geometry
virtual ~geometry()=default
pFlow::triSurfaceField
Definition: triSurfaceField.hpp:34
pFlow::geometry::triSurface_
multiTriSurface & triSurface_
Definition: geometry.hpp:49
pFlow::geometry::contactForceWall
realx3TriSurfaceField_D & contactForceWall()
Definition: geometry.hpp:171
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::VectorDual< int8 >
multiTriSurface.hpp
pFlow::geometry::wallProperty
const auto & wallProperty() const
Definition: geometry.hpp:182
Fields.hpp
dictionary.hpp
pFlow::geometry::write
bool write() const
Definition: geometry.hpp:245
pFlow::geometry::vertices
const auto & vertices() const
Definition: geometry.hpp:150
pFlow::geometry::beforeIteration
bool beforeIteration() override
Definition: geometry.hpp:219
virtualConstructor.hpp
pFlow::triSurface::numPoints
size_t numPoints() const
Definition: triSurface.hpp:149
pFlow::geometry::zeroForce
void zeroForce()
Definition: geometry.hpp:65
pFlow::geometry::numPoints
auto numPoints() const
Definition: geometry.hpp:132
pFlow::repository::path
virtual fileSystem path() const
Definition: repository.cpp:61
pFlow::property
property holds the pure properties of materials.
Definition: property.hpp:40
pFlow::geometry::owner
repository & owner()
Definition: geometry.hpp:195
pFlow::geometry::TypeInfo
TypeInfo("geometry")
pFlow::geometry::surface
const auto & surface() const
Definition: geometry.hpp:165
pFlow::uniquePtr
Definition: uniquePtr.hpp:44
pFlow::geometry
Definition: geometry.hpp:37
LAMBDA_HD
#define LAMBDA_HD
Definition: pFlowMacros.hpp:54
pFlow::triSurface::vertices
const int32x3Vector_D & vertices() const
Definition: triSurface.hpp:214
pFlow::demGeometry
Definition: demGeometry.hpp:31
pFlow::geometry::getTriangleAccessor
auto getTriangleAccessor() const
Definition: geometry.hpp:155
pFlow::repository
Definition: repository.hpp:34
property.hpp
pFlow::triSurface
Definition: triSurface.hpp:38
pFlow::geometry::propertyId_
int8TriSurfaceField_D & propertyId_
Definition: geometry.hpp:57
pFlow::VectorSingle::deviceVectorAll
INLINE_FUNCTION_H viewType & deviceVectorAll()
Definition: VectorSingle.hpp:295
pFlow::geometry::numTriangles
auto numTriangles() const
Definition: geometry.hpp:138
pFlow::Vector< word >
pFlow::geometry::path
auto path()
Definition: geometry.hpp:200
pFlow::geometry::propertyId
const int8TriSurfaceField_D & propertyId() const
Definition: geometry.hpp:214
pFlow::geometry::pointMotionIndex
virtual const int8Vector_HD & pointMotionIndex() const =0
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::triSurface::size
size_t size() const
Definition: triSurface.hpp:159
pFlow::geometry::geometry
geometry(systemControl &control, const property &prop)
Definition: geometry.cpp:57
pFlow::geometry::triMotionIndex
virtual const int8Vector_HD & triMotionIndex() const =0
demGeometry.hpp