Files
phasicFlow/src/Geometry/geometry/geometry.hpp

291 lines
6.2 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 __geometry_hpp__
#define __geometry_hpp__
2022-09-05 01:56:29 +04:30
2022-12-10 01:32:54 +03:30
#include "virtualConstructor.hpp"
#include "demGeometry.hpp"
#include "property.hpp"
#include "Fields.hpp"
#include "Vectors.hpp"
#include "multiTriSurface.hpp"
#include "triSurfaceFields.hpp"
#include "dictionary.hpp"
2022-09-05 01:56:29 +04:30
namespace pFlow
{
2023-04-13 11:42:41 -07:00
/**
* Base class for geometry for managing tri-surfaces, geometry motion,
* and surface physical properties.
*
*/
2022-09-05 01:56:29 +04:30
class geometry
:
public demGeometry
{
protected:
2023-04-13 11:42:41 -07:00
// - Protected members
/// Const reference to physical property of materials
const property& wallProperty_;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Repository to store geometry data at each simulation moment
repository& geometryRepository_;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// All triangles in the set of wall surfaces
multiTriSurface& triSurface_;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// The name of motion component of each wall surface
wordField& motionComponentName_;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Material name of each wall surface
wordField& materialName_;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Property id of each triangle in the set of wall surfaces
int8TriSurfaceField_D& propertyId_;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Contact force on each triangle in the set of wall surfaces
realx3TriSurfaceField_D& contactForceWall_;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Stress on ech triangle in the set of wall surfaces
realx3TriSurfaceField_D& stressWall_;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
// - Protected member functions
/// Find property id of each triangle based on the supplied material name
/// and the surface wall that the triangle belongs to.
bool findPropertyId();
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Initialize contact force to zero
void zeroForce()
{
contactForceWall_.fill(zero3);
}
2022-09-05 01:56:29 +04:30
public:
2023-04-13 11:42:41 -07:00
/// Type info
2022-12-10 01:32:54 +03:30
TypeInfo("geometry");
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
// - Constructors
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Construct from controlSystem and property, for reading from file
2022-09-05 01:56:29 +04:30
geometry(systemControl& control, const property& prop);
2023-04-13 11:42:41 -07:00
/// Construct from components
2022-09-05 01:56:29 +04:30
geometry(systemControl& control,
const property& prop,
const multiTriSurface& triSurface,
const wordVector& motionCompName,
const wordVector& propName
);
2023-04-13 11:42:41 -07:00
/// Construct from components and dictionary that contains
/// motionModel
2022-09-05 01:56:29 +04:30
geometry(systemControl& control,
const property& prop,
const dictionary& dict,
const multiTriSurface& triSurface,
const wordVector& motionCompName,
const wordVector& propName);
2023-04-13 11:42:41 -07:00
/// Destructor
2022-09-05 01:56:29 +04:30
virtual ~geometry() = default;
2023-04-13 11:42:41 -07:00
/// Virtual constructor
2022-09-05 01:56:29 +04:30
create_vCtor
(
geometry,
systemControl,
(
systemControl& control,
const property& prop
),
(control, prop)
);
2023-04-13 11:42:41 -07:00
/// Virtual constructor
2022-09-05 01:56:29 +04:30
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)
);
2023-04-13 11:42:41 -07:00
//- Methods
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Size of tri-surface
2022-09-05 01:56:29 +04:30
inline
auto size()const
{
return triSurface_.size();
}
2023-04-13 11:42:41 -07:00
/// Number of points in the set of surface walls
2022-09-05 01:56:29 +04:30
inline
auto numPoints()const
{
return triSurface_.numPoints();
}
2023-04-13 11:42:41 -07:00
/// Number of triangles in the set of surface walls
2022-09-05 01:56:29 +04:30
inline
auto numTriangles()const
{
return size();
}
2023-04-13 11:42:41 -07:00
/// Access to the points
2022-09-05 01:56:29 +04:30
inline
const auto& points()const
{
return triSurface_.points();
}
2023-04-13 11:42:41 -07:00
/// Access to the vertices
2022-09-05 01:56:29 +04:30
inline
const auto& vertices()const
{
return triSurface_.vertices();
}
2023-04-13 11:42:41 -07:00
/// Obtain an object for accessing triangles
2022-09-05 01:56:29 +04:30
inline auto getTriangleAccessor()const
{
return triSurface_.getTriangleAccessor();
}
2023-04-13 11:42:41 -07:00
/// Surface
2022-09-05 01:56:29 +04:30
inline auto& surface()
{
return triSurface_;
}
2023-04-13 11:42:41 -07:00
/// Surface
2022-09-05 01:56:29 +04:30
inline const auto& surface()const
{
return triSurface_;
}
2023-04-13 11:42:41 -07:00
/// Access to contact force
2022-09-05 01:56:29 +04:30
inline
realx3TriSurfaceField_D& contactForceWall()
{
return contactForceWall_;
}
2023-04-13 11:42:41 -07:00
/// Access to contact force
2022-09-05 01:56:29 +04:30
inline
const realx3TriSurfaceField_D& contactForceWall() const
{
return contactForceWall_;
}
2023-04-13 11:42:41 -07:00
/// Access to property
2022-09-05 01:56:29 +04:30
inline const auto& wallProperty()const
{
return wallProperty_;
}
2023-04-13 11:42:41 -07:00
/// Owner repository
2022-09-05 01:56:29 +04:30
inline
const repository& owner()const
{
return geometryRepository_;
}
2023-04-13 11:42:41 -07:00
/// Owner repository
2022-09-05 01:56:29 +04:30
inline
repository& owner()
{
return geometryRepository_;
}
2023-04-13 11:42:41 -07:00
/// Path to the repository folder
2022-09-05 01:56:29 +04:30
inline auto path()
{
return owner().path();
}
2023-04-13 11:42:41 -07:00
/// The name of motion model
2022-09-05 01:56:29 +04:30
virtual
word motionModelTypeName()const = 0;
2023-04-13 11:42:41 -07:00
/// Motion model index of triangles
2022-09-05 01:56:29 +04:30
virtual
const int8Vector_HD& triMotionIndex() const =0;
2023-04-13 11:42:41 -07:00
/// Motion model index of points
2022-09-05 01:56:29 +04:30
virtual
const int8Vector_HD& pointMotionIndex()const = 0;
2023-04-13 11:42:41 -07:00
/// Property ide of triangles
2022-09-05 01:56:29 +04:30
const int8TriSurfaceField_D& propertyId() const
{
return propertyId_;
}
2023-04-13 11:42:41 -07:00
/// Operations before each iteration
bool beforeIteration() override;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Operations after each iteration
bool afterIteration() override;
//- IO
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// write
2022-09-05 01:56:29 +04:30
bool write()const
{
return owner().write();
}
2023-04-13 11:42:41 -07:00
//- Static members
2022-09-05 01:56:29 +04:30
static
2023-04-13 11:42:41 -07:00
uniquePtr<geometry> create(systemControl& control, const property& prop);
2022-09-05 01:56:29 +04:30
static
2023-04-13 11:42:41 -07:00
uniquePtr<geometry> create(
2022-09-05 01:56:29 +04:30
systemControl& control,
const property& prop,
const dictionary& dict,
const multiTriSurface& triSurface,
const wordVector& motionCompName,
const wordVector& propName);
};
}
#endif