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

240 lines
5.5 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
2024-03-20 00:50:58 -07:00
wordField_H motionComponentName_{
"motionComponentName",
"motionComponentName"};
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Material name of each wall surface
2024-03-20 00:50:58 -07:00
wordField_H materialName_{
"materialName",
"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
2024-03-20 00:50:58 -07:00
void zeroForce();
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
2024-03-20 00:50:58 -07:00
~geometry()override = default;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Virtual constructor
2024-03-20 00:50:58 -07:00
create_vCtor
2022-09-05 01:56:29 +04:30
(
geometry,
systemControl,
(
systemControl& control,
const property& prop
),
(control, prop)
2024-03-20 00:50:58 -07:00
);
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
inline
const auto& motionComponentName()const
{
return motionComponentName_;
}
2023-04-13 11:42:41 -07:00
/// Access to contact force
2024-03-20 00:50:58 -07:00
inline
auto& contactForceWall()
2022-09-05 01:56:29 +04:30
{
return contactForceWall_;
}
2023-04-13 11:42:41 -07:00
/// Access to contact force
2022-09-05 01:56:29 +04:30
inline
2024-03-20 00:50:58 -07:00
const auto& contactForceWall() const
2022-09-05 01:56:29 +04:30
{
return contactForceWall_;
}
2024-03-20 00:50:58 -07:00
/// Property ide of triangles
inline
const auto& propertyId()const
{
return propertyId_;
}
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_;
2024-03-20 00:50:58 -07:00
}
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// The name of motion model
2024-03-20 00:50:58 -07:00
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
2024-03-20 00:50:58 -07:00
virtual
const uint32Field_D& triMotionIndex() const =0;
2022-09-05 01:56:29 +04:30
2023-04-13 11:42:41 -07:00
/// Motion model index of points
2022-09-05 01:56:29 +04:30
virtual
2024-03-20 00:50:58 -07:00
const uint32Field_D& pointMotionIndex()const = 0;
2023-04-13 11:42:41 -07:00
2024-03-20 00:50:58 -07:00
bool beforeIteration() override;
/// This is called in time loop. Perform the main calculations
/// when the component should evolve along time.
2024-03-20 00:50:58 -07:00
bool iterate() override;
/// This is called in time loop, after iterate.
2024-03-20 00:50:58 -07:00
bool afterIteration() override;
//- 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
2024-03-20 00:50:58 -07:00
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