mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
runtime dynamic link library and geometryPhasicFlow modification
This commit is contained in:
103
utilities/Utilities/geometryPhasicFlow/Wall/Wall.cpp
Executable file
103
utilities/Utilities/geometryPhasicFlow/Wall/Wall.cpp
Executable file
@ -0,0 +1,103 @@
|
||||
/*------------------------------- 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 "Wall.hpp"
|
||||
|
||||
bool pFlow::Wall::readCommon(const dictionary& dict)
|
||||
{
|
||||
materialName_ = dict.getVal<word>("material");
|
||||
|
||||
motionName_ = dict.getValOrSet("motion", word("none"));
|
||||
|
||||
name_ = dict.name();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
pFlow::Wall::Wall(const dictionary& dict)
|
||||
{
|
||||
if(!readCommon(dict))
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool pFlow::Wall::checkTrianlge
|
||||
(
|
||||
const realx3 &p1,
|
||||
const realx3 &p2,
|
||||
const realx3 &p3
|
||||
)
|
||||
{
|
||||
realx3 ln = cross(p2 - p1, p3 - p1);
|
||||
|
||||
if (ln.length() < smallValue) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pFlow::uniquePtr<pFlow::Wall>
|
||||
pFlow::Wall::create
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
word type = dict.getVal<word>("type");
|
||||
|
||||
if( dictionaryvCtorSelector_.search(type) )
|
||||
{
|
||||
return dictionaryvCtorSelector_[type] (dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
printKeys
|
||||
(
|
||||
fatalError << "Ctor Selector "<< type << " dose not exist. \n"
|
||||
<<"Avaiable ones are: \n\n"
|
||||
,
|
||||
dictionaryvCtorSelector_
|
||||
);
|
||||
fatalExit;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
bool checkNormalVec(
|
||||
const realx3 &p1,
|
||||
const realx3 &p2,
|
||||
const realx3 &p3,
|
||||
realx3& norm )
|
||||
{
|
||||
realx3 ln = cross(p2 - p1, p3 - p1);
|
||||
real len = length(ln);
|
||||
if (len < smallValue) return false;
|
||||
|
||||
norm = ln/len;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
113
utilities/Utilities/geometryPhasicFlow/Wall/Wall.hpp
Executable file
113
utilities/Utilities/geometryPhasicFlow/Wall/Wall.hpp
Executable file
@ -0,0 +1,113 @@
|
||||
/*------------------------------- 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 __Wall_hpp__
|
||||
#define __Wall_hpp__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "virtualConstructor.hpp"
|
||||
#include "dictionary.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
|
||||
bool checkNormalVec(
|
||||
const realx3 &p1,
|
||||
const realx3 &p2,
|
||||
const realx3 &p3,
|
||||
realx3& norm );
|
||||
|
||||
|
||||
class Wall
|
||||
{
|
||||
protected:
|
||||
|
||||
std::vector<realx3x3> triangles_;
|
||||
|
||||
word name_;
|
||||
|
||||
word materialName_;
|
||||
|
||||
word motionName_;
|
||||
|
||||
bool readCommon(const dictionary& ditc);
|
||||
|
||||
public:
|
||||
|
||||
// - type info
|
||||
TypeInfo("Wall");
|
||||
|
||||
//// - Constructors
|
||||
|
||||
// - empty
|
||||
Wall(){}
|
||||
|
||||
// - from dictionary
|
||||
Wall(const dictionary& dict);
|
||||
|
||||
|
||||
virtual ~Wall()=default;
|
||||
|
||||
create_vCtor
|
||||
(
|
||||
Wall,
|
||||
dictionary,
|
||||
(const dictionary& dict),
|
||||
(dict)
|
||||
);
|
||||
|
||||
//// - Methods
|
||||
|
||||
// -
|
||||
const auto& triangles()const
|
||||
{
|
||||
return triangles_;
|
||||
}
|
||||
|
||||
word name()const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
word materialName()const
|
||||
{
|
||||
return materialName_;
|
||||
}
|
||||
|
||||
word motionName()const
|
||||
{
|
||||
return motionName_;
|
||||
}
|
||||
|
||||
static
|
||||
bool checkTrianlge(const realx3& p1, const realx3& p2, const realx3& p3);
|
||||
|
||||
static
|
||||
uniquePtr<Wall> create(const dictionary& dict);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
140
utilities/Utilities/geometryPhasicFlow/cuboidWall/cuboidWall.cpp
Executable file
140
utilities/Utilities/geometryPhasicFlow/cuboidWall/cuboidWall.cpp
Executable file
@ -0,0 +1,140 @@
|
||||
/*------------------------------- 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 "cuboidWall.hpp"
|
||||
#include "planeWall.hpp"
|
||||
|
||||
|
||||
|
||||
bool pFlow::cuboidWall::readcuboidWall
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
|
||||
auto center = dict.getVal<realx3>("center");
|
||||
auto edgeLength= dict.getVal<realx3>("edgeLength");
|
||||
auto numDivs = dict.getValOrSet<int32x3>("numDivs", int32x3(1,1,1));
|
||||
|
||||
numDivs = max(numDivs, int32x3(1,1,1));
|
||||
|
||||
realx3 p1,p2,p3,p4;
|
||||
|
||||
// left plane
|
||||
p1 = center + edgeLength*realx3(-0.5,-0.5,-0.5);
|
||||
p2 = center + edgeLength*realx3(-0.5, 0.5,-0.5);
|
||||
p3 = center + edgeLength*realx3(-0.5, 0.5, 0.5);
|
||||
p4 = center + edgeLength*realx3(-0.5,-0.5, 0.5);
|
||||
|
||||
planeWall left(p1,p2,p3,p4, numDivs.y(), numDivs.z());
|
||||
|
||||
for(const auto& t:left.triangles())
|
||||
{
|
||||
triangles_.push_back(t);
|
||||
}
|
||||
|
||||
// right plane
|
||||
p1 = center + edgeLength*realx3( 0.5,-0.5,-0.5);
|
||||
p2 = center + edgeLength*realx3( 0.5,-0.5, 0.5);
|
||||
p3 = center + edgeLength*realx3( 0.5, 0.5, 0.5);
|
||||
p4 = center + edgeLength*realx3( 0.5, 0.5,-0.5);
|
||||
|
||||
planeWall right(p1,p2,p3,p4, numDivs.z(), numDivs.y());
|
||||
|
||||
for(const auto& t:right.triangles())
|
||||
{
|
||||
triangles_.push_back(t);
|
||||
}
|
||||
|
||||
// bottom plane
|
||||
p1 = center + edgeLength*realx3(-0.5,-0.5,-0.5);
|
||||
p2 = center + edgeLength*realx3(-0.5,-0.5, 0.5);
|
||||
p3 = center + edgeLength*realx3( 0.5,-0.5, 0.5);
|
||||
p4 = center + edgeLength*realx3( 0.5,-0.5,-0.5);
|
||||
|
||||
planeWall bottom(p1,p2,p3,p4, numDivs.z(), numDivs.x());
|
||||
|
||||
for(const auto& t:bottom.triangles())
|
||||
{
|
||||
triangles_.push_back(t);
|
||||
}
|
||||
|
||||
// top plane
|
||||
p1 = center + edgeLength*realx3(-0.5, 0.5,-0.5);
|
||||
p2 = center + edgeLength*realx3( 0.5, 0.5,-0.5);
|
||||
p3 = center + edgeLength*realx3( 0.5, 0.5, 0.5);
|
||||
p4 = center + edgeLength*realx3(-0.5, 0.5, 0.5);
|
||||
|
||||
planeWall top(p1,p2,p3,p4, numDivs.x(), numDivs.z());
|
||||
|
||||
for(const auto& t:top.triangles())
|
||||
{
|
||||
triangles_.push_back(t);
|
||||
}
|
||||
|
||||
// back plane
|
||||
p1 = center + edgeLength*realx3(-0.5,-0.5,-0.5);
|
||||
p2 = center + edgeLength*realx3( 0.5,-0.5,-0.5);
|
||||
p3 = center + edgeLength*realx3( 0.5, 0.5,-0.5);
|
||||
p4 = center + edgeLength*realx3(-0.5, 0.5,-0.5);
|
||||
|
||||
|
||||
planeWall back(p1,p2,p3,p4, numDivs.x(), numDivs.y());
|
||||
|
||||
for(const auto& t:back.triangles())
|
||||
{
|
||||
triangles_.push_back(t);
|
||||
}
|
||||
|
||||
|
||||
// fron plane
|
||||
p1 = center + edgeLength*realx3(-0.5,-0.5, 0.5);
|
||||
p2 = center + edgeLength*realx3(-0.5, 0.5, 0.5);
|
||||
p3 = center + edgeLength*realx3( 0.5, 0.5, 0.5);
|
||||
p4 = center + edgeLength*realx3( 0.5,-0.5, 0.5);
|
||||
|
||||
planeWall front(p1,p2,p3,p4, numDivs.y(), numDivs.x());
|
||||
|
||||
for(const auto& t:front.triangles())
|
||||
{
|
||||
triangles_.push_back(t);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
pFlow::cuboidWall::cuboidWall()
|
||||
{}
|
||||
|
||||
pFlow::cuboidWall::cuboidWall
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
Wall(dict)
|
||||
{
|
||||
if(!readcuboidWall(dict))
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
60
utilities/Utilities/geometryPhasicFlow/cuboidWall/cuboidWall.hpp
Executable file
60
utilities/Utilities/geometryPhasicFlow/cuboidWall/cuboidWall.hpp
Executable file
@ -0,0 +1,60 @@
|
||||
/*------------------------------- 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 __cuboidWall_hpp__
|
||||
#define __cuboidWall_hpp__
|
||||
|
||||
|
||||
#include "Wall.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
class cuboidWall
|
||||
:
|
||||
public Wall
|
||||
{
|
||||
protected:
|
||||
|
||||
bool readcuboidWall(const dictionary& dict);
|
||||
|
||||
public:
|
||||
|
||||
TypeInfo("cuboidWall");
|
||||
|
||||
cuboidWall();
|
||||
|
||||
cuboidWall(const dictionary& dict);
|
||||
|
||||
add_vCtor
|
||||
(
|
||||
Wall,
|
||||
cuboidWall,
|
||||
dictionary
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
} // pFlow
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,120 @@
|
||||
#include "cylinderWall.hpp"
|
||||
#include "Vectors.hpp"
|
||||
#include "line.hpp"
|
||||
|
||||
|
||||
bool pFlow::cylinderWall::readCylinderWall(const dictionary& dict)
|
||||
{
|
||||
auto p1 = dict.getVal<realx3>("p1");
|
||||
auto p2 = dict.getVal<realx3>("p2");
|
||||
auto radius1 = dict.getVal<real>("radius1");
|
||||
auto radius2 = dict.getVal<real>("radius2") ;
|
||||
|
||||
int32 resolution = dict.getValOrSet("resolution", 24 );
|
||||
int32 zResolution = dict.getValOrSet("zResolution", 1);
|
||||
|
||||
|
||||
triangles_.clear();
|
||||
triangles_.reserve(2*resolution*zResolution);
|
||||
|
||||
|
||||
line cylAxis(p1, p2);
|
||||
auto lp1 = p1;
|
||||
|
||||
auto dt = static_cast<real>(1.0/zResolution);
|
||||
real t = 0;
|
||||
for(int32 i=0; i<zResolution; i++)
|
||||
{
|
||||
t += dt;
|
||||
auto lp2 = cylAxis.point(t);
|
||||
if(!createCylinder(lp1, lp2, radius1, radius2, resolution))
|
||||
return false;
|
||||
|
||||
lp1 = lp2;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pFlow::cylinderWall::createCylinder(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
real rad1,
|
||||
real rad2,
|
||||
int32 numDiv)
|
||||
{
|
||||
|
||||
zAxis zAx(p1, p2);
|
||||
|
||||
real L = zAx.length();
|
||||
|
||||
|
||||
realx3Vector r1P(numDiv + 1), r2P(numDiv + 1);
|
||||
real dTheta = 2 * Pi / numDiv;
|
||||
real theta = 0;
|
||||
|
||||
for (int32 i = 0; i < numDiv + 1; i++)
|
||||
{
|
||||
r1P[i] = realx3(rad1*cos(theta), rad1*sin(theta), 0);
|
||||
r2P[i] = realx3(rad2*cos(theta), rad2*sin(theta), L);
|
||||
theta += dTheta;
|
||||
}
|
||||
|
||||
// transferring back all points to the original axis of cylinder
|
||||
for (int32 i = 0; i < numDiv + 1; i++)
|
||||
{
|
||||
r1P[i] = zAx.transferBackZ(r1P[i]);
|
||||
r2P[i] = zAx.transferBackZ(r2P[i]);
|
||||
}
|
||||
|
||||
realx3 norm;
|
||||
for (int32 i = 0; i < numDiv; i++)
|
||||
{
|
||||
realx3 p1 = r1P[i];
|
||||
realx3 p2 = r2P[i];
|
||||
realx3 p3 = r2P[i + 1];
|
||||
realx3 p4 = r1P[i + 1];
|
||||
|
||||
if(checkNormalVec(p1, p2, p3, norm))
|
||||
{
|
||||
triangles_.push_back(realx3x3(p1, p2, p3));
|
||||
}
|
||||
else
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"planner input triangle: "<<realx3x3(p1, p2, p3)<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkNormalVec(p3, p4, p1, norm))
|
||||
{
|
||||
triangles_.push_back(realx3x3(p3, p4, p1));
|
||||
}
|
||||
else
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"planner input triangle: "<<realx3x3(p3, p4, p1)<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
pFlow::cylinderWall::cylinderWall()
|
||||
{}
|
||||
|
||||
|
||||
pFlow::cylinderWall::cylinderWall(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
Wall(dict)
|
||||
{
|
||||
if( !readCylinderWall(dict) )
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*------------------------------- 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 __cylinderWall_hpp__
|
||||
#define __cylinderWall_hpp__
|
||||
|
||||
#include "Wall.hpp"
|
||||
#include "zAxis.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
class cylinderWall
|
||||
:
|
||||
public Wall
|
||||
{
|
||||
protected:
|
||||
|
||||
bool readCylinderWall(const dictionary& dict);
|
||||
|
||||
bool createCylinder(const realx3& p1, const realx3& p2, real rad1, real rad2, int32 numDiv);
|
||||
|
||||
public:
|
||||
|
||||
TypeInfo("cylinderWall");
|
||||
|
||||
cylinderWall();
|
||||
|
||||
cylinderWall(const dictionary& dict);
|
||||
|
||||
add_vCtor
|
||||
(
|
||||
Wall,
|
||||
cylinderWall,
|
||||
dictionary
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
} // pFlow
|
||||
|
||||
|
||||
|
||||
|
||||
#endif //__cylinderWall_hpp__
|
173
utilities/Utilities/geometryPhasicFlow/planeWall/planeWall.cpp
Executable file
173
utilities/Utilities/geometryPhasicFlow/planeWall/planeWall.cpp
Executable file
@ -0,0 +1,173 @@
|
||||
/*------------------------------- 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 "planeWall.hpp"
|
||||
#include "line.hpp"
|
||||
|
||||
bool pFlow::planeWall::readPlaneWall
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
auto p1 = dict.getVal<realx3>("p1");
|
||||
auto p2 = dict.getVal<realx3>("p2");
|
||||
auto p3 = dict.getVal<realx3>("p3");
|
||||
auto p4 = dict.getVal<realx3>("p4");
|
||||
|
||||
auto numDiv12 = max(dict.getValOrSet<int32>("numDiv12",1),1);
|
||||
auto numDiv23 = max(dict.getValOrSet<int32>("numDiv23",1),1);
|
||||
|
||||
|
||||
if(!checkFlatness(p1,p2,p3,p4))
|
||||
{
|
||||
fatalErrorInFunction <<
|
||||
"points p1, p2, p3 and p4 do not form a plane wall in dictionary " << dict.globalName()<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!addPlaneWall(p1,p2,p3,p4,numDiv12,numDiv23))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"could not create plane wall from dictionary "<< dict.globalName()<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool pFlow::planeWall::addWall4(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
const realx3& p3,
|
||||
const realx3& p4)
|
||||
{
|
||||
|
||||
if(!checkFlatness(p1,p2,p3,p4))return false;
|
||||
|
||||
triangles_.push_back(realx3x3(p1,p2,p3));
|
||||
triangles_.push_back(realx3x3(p3,p4,p1));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pFlow::planeWall::checkFlatness(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
const realx3& p3,
|
||||
const realx3& p4)
|
||||
{
|
||||
if( !Wall::checkTrianlge(p1,p2,p3) ) return false;
|
||||
if( !Wall::checkTrianlge(p3,p4,p1) ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pFlow::planeWall::addPlaneWall(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
const realx3& p3,
|
||||
const realx3& p4,
|
||||
int32 numDiv12,
|
||||
int32 numDiv23 )
|
||||
{
|
||||
real dt12 = 1.0/numDiv12;
|
||||
real dt23 = 1.0/numDiv23;
|
||||
|
||||
real t12 = 0;
|
||||
|
||||
|
||||
line line12(p1,p2);
|
||||
line line43(p4,p3);
|
||||
|
||||
for(int32 i=0; i<numDiv12; i++)
|
||||
{
|
||||
|
||||
auto lp1 = line12.point(t12);
|
||||
auto lp4 = line43.point(t12);
|
||||
auto lp2 = line12.point(t12+dt12);
|
||||
auto lp3 = line43.point(t12+dt12);
|
||||
|
||||
line line14(lp1,lp4);
|
||||
line line23(lp2,lp3);
|
||||
real t23 = 0;
|
||||
for(int32 j=0; j<numDiv23; j++)
|
||||
{
|
||||
if(
|
||||
!addWall4(
|
||||
line14.point(t23),
|
||||
line23.point(t23),
|
||||
line23.point(t23+dt23),
|
||||
line14.point(t23+dt23) )
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
t23+=dt23;
|
||||
}
|
||||
t12+=dt12;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pFlow::planeWall::planeWall()
|
||||
{}
|
||||
|
||||
pFlow::planeWall::planeWall
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
Wall(dict)
|
||||
{
|
||||
if(!readPlaneWall(dict))
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
||||
|
||||
pFlow::planeWall::planeWall(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
const realx3& p3,
|
||||
const realx3& p4,
|
||||
int32 numDiv12,
|
||||
int32 numDiv23 )
|
||||
{
|
||||
|
||||
if(!checkFlatness(p1,p2,p3,p4))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"the input points p1, p2, p3, and p4 are not in the same plane "<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
if(!addPlaneWall(p1,p2,p3,p4, numDiv12, numDiv23))
|
||||
{
|
||||
fatalErrorInFunction<<
|
||||
"could not create plane wall from input points "<<endl;
|
||||
fatalExit;
|
||||
}
|
||||
|
||||
}
|
||||
|
89
utilities/Utilities/geometryPhasicFlow/planeWall/planeWall.hpp
Executable file
89
utilities/Utilities/geometryPhasicFlow/planeWall/planeWall.hpp
Executable file
@ -0,0 +1,89 @@
|
||||
/*------------------------------- 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 __planeWall_hpp__
|
||||
#define __planeWall_hpp__
|
||||
|
||||
|
||||
#include "Wall.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
class planeWall
|
||||
:
|
||||
public Wall
|
||||
{
|
||||
protected:
|
||||
|
||||
bool readPlaneWall(const dictionary& dict);
|
||||
|
||||
bool addWall4(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
const realx3& p3,
|
||||
const realx3& p4);
|
||||
|
||||
bool checkFlatness(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
const realx3& p3,
|
||||
const realx3& p4);
|
||||
|
||||
bool addPlaneWall(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
const realx3& p3,
|
||||
const realx3& p4,
|
||||
int32 numDiv12 = 1,
|
||||
int32 numDiv23 = 1);
|
||||
|
||||
public:
|
||||
|
||||
TypeInfo("planeWall");
|
||||
|
||||
planeWall();
|
||||
|
||||
planeWall(const dictionary& dict);
|
||||
|
||||
planeWall(
|
||||
const realx3& p1,
|
||||
const realx3& p2,
|
||||
const realx3& p3,
|
||||
const realx3& p4,
|
||||
int32 numDiv12 = 1,
|
||||
int32 numDiv23 = 1);
|
||||
|
||||
add_vCtor
|
||||
(
|
||||
Wall,
|
||||
planeWall,
|
||||
dictionary
|
||||
);
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // pFlow
|
||||
|
||||
|
||||
#endif
|
71
utilities/Utilities/geometryPhasicFlow/stlWall/stlWall.cpp
Executable file
71
utilities/Utilities/geometryPhasicFlow/stlWall/stlWall.cpp
Executable file
@ -0,0 +1,71 @@
|
||||
/*------------------------------- 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 "stlWall.hpp"
|
||||
#include "stlFile.hpp"
|
||||
|
||||
#include "streams.hpp"
|
||||
|
||||
bool pFlow::stlWall::readSTLWall
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
auto fileName = dict.getVal<word>("file");
|
||||
|
||||
|
||||
fileSystem file("./stl",fileName);
|
||||
|
||||
stlFile stl(file);
|
||||
if(!stl.read())
|
||||
{
|
||||
fatalErrorInFunction <<
|
||||
" error in reading stl file "<< file <<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
for(label i=0; i<stl.size(); i++)
|
||||
{
|
||||
auto it = triangles_.end();
|
||||
triangles_.insert(it, stl.solid(i).begin(), stl.solid(i).end());
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
pFlow::stlWall::stlWall()
|
||||
{}
|
||||
|
||||
pFlow::stlWall::stlWall
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
Wall(dict)
|
||||
{
|
||||
if(!readSTLWall(dict))
|
||||
{
|
||||
fatalExit;
|
||||
}
|
||||
}
|
60
utilities/Utilities/geometryPhasicFlow/stlWall/stlWall.hpp
Executable file
60
utilities/Utilities/geometryPhasicFlow/stlWall/stlWall.hpp
Executable file
@ -0,0 +1,60 @@
|
||||
/*------------------------------- 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 __stlWall_hpp__
|
||||
#define __stlWall_hpp__
|
||||
|
||||
|
||||
#include "Wall.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
class stlWall
|
||||
:
|
||||
public Wall
|
||||
{
|
||||
protected:
|
||||
|
||||
bool readSTLWall(const dictionary& dict);
|
||||
|
||||
public:
|
||||
|
||||
TypeInfo("stlWall");
|
||||
|
||||
stlWall();
|
||||
|
||||
stlWall(const dictionary& dict);
|
||||
|
||||
add_vCtor
|
||||
(
|
||||
Wall,
|
||||
stlWall,
|
||||
dictionary
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
} // pFlow
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user