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

317 lines
6.8 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 "demComponent.hpp"
2022-12-10 01:32:54 +03:30
#include "property.hpp"
#include "multiTriSurface.hpp"
#include "triSurfaceFields.hpp"
//#include "Fields.hpp"
//#include "Vectors.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 multiTriSurface,
public demComponent
2022-09-05 01:56:29 +04:30
{
private:
2022-09-05 01:56:29 +04:30
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
/// The name of motion component of each wall surface
wordField_H motionComponentName_;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Material name of each wall surface
wordField_H 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
uint32TriSurfaceField_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
/// Stress on each triangle in the set of wall surfaces
realx3TriSurfaceField_D normalStressWall_;
/// Stress on each triangle in the set of wall surfaces
realx3TriSurfaceField_D shearStressWall_;
bool readWholeObject_ = true;
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 createPropertyId();
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Initialize contact force to zero
/*void zeroForce()
2023-04-13 11:42:41 -07:00
{
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);
geometry(systemControl& control,
const property& prop,
multiTriSurface& surf,
const wordVector& motionCompName,
const wordVector& materialName,
const dictionary& motionDict);
2023-04-13 11:42:41 -07:00
/// Construct from components
/*geometry(systemControl& control,
2022-09-05 01:56:29 +04:30
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);*/
2022-09-05 01:56:29 +04:30
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
/*create_vCtor
2022-09-05 01:56:29 +04:30
(
geometry,
systemControl,
(
systemControl& control,
const property& prop
),
(control, prop)
);*/
2022-09-05 01:56:29 +04:30
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,
multiTriSurface& surf,
const wordVector& motionCompName,
const wordVector& materialName,
const dictionary& motionDic),
(control, prop, surf, motionCompName, materialName, motionDic)
2022-09-05 01:56:29 +04:30
);
//- Methods
2022-09-05 01:56:29 +04:30
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
/*inline
2022-09-05 01:56:29 +04:30
const auto& points()const
{
return triSurface_.points();
}*/
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Access to the vertices
/*inline
2022-09-05 01:56:29 +04:30
const auto& vertices()const
{
return triSurface_.vertices();
}*/
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Obtain an object for accessing triangles
/*inline auto getTriangleAccessor()const
2022-09-05 01:56:29 +04:30
{
return triSurface_.getTriangleAccessor();
}*/
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Surface
inline
auto& surface()
2022-09-05 01:56:29 +04:30
{
return static_cast<multiTriSurface&>(*this);
2022-09-05 01:56:29 +04:30
}
2023-04-13 11:42:41 -07:00
/// Surface
inline
const auto& surface()const
2022-09-05 01:56:29 +04:30
{
return static_cast<const multiTriSurface&>(*this);
2022-09-05 01:56:29 +04:30
}
inline
const auto& motionComponentName()const
{
return motionComponentName_;
}
2023-04-13 11:42:41 -07:00
/// Access to contact force
/*inline
2022-09-05 01:56:29 +04:30
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_;
}*/
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Owner repository
/*inline
2022-09-05 01:56:29 +04:30
const repository& owner()const
{
return geometryRepository_;
}*/
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Owner repository
/*inline
2022-09-05 01:56:29 +04:30
repository& owner()
{
return geometryRepository_;
}*/
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Path to the repository folder
/*inline auto path()
2022-09-05 01:56:29 +04:30
{
return owner().path();
}*/
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// The name of motion model
/*virtual
word motionModelTypeName()const = 0;*/
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Motion model index of triangles
/*virtual
2022-09-05 01:56:29 +04:30
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_;
}*/
2022-09-05 01:56:29 +04:30
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;
2023-04-13 11:42:41 -07:00
bool beforeIteration() override
{
notImplementedFunction;
return true;
}
2022-09-05 01:56:29 +04:30
/// This is called in time loop. Perform the main calculations
/// when the component should evolve along time.
bool iterate() override
{
notImplementedFunction;
return true;
}
/// This is called in time loop, after iterate.
bool afterIteration() override
2022-09-05 01:56:29 +04:30
{
notImplementedFunction;
return true;
2022-09-05 01:56:29 +04:30
}
//- IO
bool read(iIstream& is, const IOPattern& iop) override;
/// write
bool write( iOstream& os, const IOPattern& iop )const override;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
//- Static members
2022-09-05 01:56:29 +04:30
/*static
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(
systemControl& control,
const property& prop,
multiTriSurface& surf,
const wordVector& motionCompName,
const wordVector& materialName,
const dictionary& motionDic);
2022-09-05 01:56:29 +04:30
};
}
#endif