From a9097ad286fe5c2b0cd594dce9948cd56f31b7c6 Mon Sep 17 00:00:00 2001 From: hamidrezanorouzi Date: Fri, 25 Nov 2022 11:13:29 +0330 Subject: [PATCH] cuboidWall --- utilities/geometryPhasicFlow/CMakeLists.txt | 1 + .../cuboidWall/cuboidWall.C | 136 ++++++++++++++++++ .../cuboidWall/cuboidWall.H | 60 ++++++++ .../geometryPhasicFlow/planeWall/planeWall.C | 29 ++++ .../geometryPhasicFlow/planeWall/planeWall.H | 6 + 5 files changed, 232 insertions(+) create mode 100755 utilities/geometryPhasicFlow/cuboidWall/cuboidWall.C create mode 100755 utilities/geometryPhasicFlow/cuboidWall/cuboidWall.H diff --git a/utilities/geometryPhasicFlow/CMakeLists.txt b/utilities/geometryPhasicFlow/CMakeLists.txt index 54fc654f..d82f8cd2 100644 --- a/utilities/geometryPhasicFlow/CMakeLists.txt +++ b/utilities/geometryPhasicFlow/CMakeLists.txt @@ -5,6 +5,7 @@ Wall/Wall.C planeWall/planeWall.C stlWall/stlWall.C cylinderWall/cylinderWall.C +cuboidWall/cuboidWall.C ) set(link_lib phasicFlow Geometry Kokkos::kokkos) diff --git a/utilities/geometryPhasicFlow/cuboidWall/cuboidWall.C b/utilities/geometryPhasicFlow/cuboidWall/cuboidWall.C new file mode 100755 index 00000000..8183e5a8 --- /dev/null +++ b/utilities/geometryPhasicFlow/cuboidWall/cuboidWall.C @@ -0,0 +1,136 @@ +/*------------------------------- 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.H" +#include "planeWall.H" + + + +bool pFlow::cuboidWall::readcuboidWall +( + const dictionary& dict +) +{ + + auto center = dict.getVal("center"); + auto edgeLength= dict.getVal("edgeLength"); + + 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); + + 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); + + 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); + + 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); + + 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); + + 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); + + 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; + } +} diff --git a/utilities/geometryPhasicFlow/cuboidWall/cuboidWall.H b/utilities/geometryPhasicFlow/cuboidWall/cuboidWall.H new file mode 100755 index 00000000..bc0e8f32 --- /dev/null +++ b/utilities/geometryPhasicFlow/cuboidWall/cuboidWall.H @@ -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_H__ +#define __cuboidWall_H__ + + +#include "Wall.H" +#include "types.H" + +namespace pFlow +{ + +class cuboidWall +: + public Wall +{ +protected: + + bool readcuboidWall(const dictionary& dict); + +public: + + TypeName("cuboidWall"); + + cuboidWall(); + + cuboidWall(const dictionary& dict); + + add_vCtor + ( + Wall, + cuboidWall, + dictionary + ); + +}; + +} // pFlow + + +#endif diff --git a/utilities/geometryPhasicFlow/planeWall/planeWall.C b/utilities/geometryPhasicFlow/planeWall/planeWall.C index 64064b8f..97988793 100755 --- a/utilities/geometryPhasicFlow/planeWall/planeWall.C +++ b/utilities/geometryPhasicFlow/planeWall/planeWall.C @@ -58,6 +58,7 @@ bool pFlow::planeWall::readPlaneWall } + pFlow::planeWall::planeWall() {} @@ -73,3 +74,31 @@ pFlow::planeWall::planeWall fatalExit; } } + +pFlow::planeWall::planeWall( + const realx3& p1, + const realx3& p2, + const realx3& p3, + const realx3& p4) +{ + + if( Wall::checkTrianlge(p1,p2,p3) ) + { + triangles_.push_back(realx3x3(p1,p2,p3)); + }else + { + fatalErrorInFunction << + "points p1, p2 and p3 do not form a plane wall "<