From 7d20751f31ef5a9782b904bfc6730c2e5f7fd8b0 Mon Sep 17 00:00:00 2001 From: Markus Holzer <markus.holzer@fau.de> Date: Mon, 13 Jan 2025 22:52:36 +0100 Subject: [PATCH] FirstTry --- .../PorousMediaGPU/InitializerFunctions.cpp | 34 +++++++++++++++++-- .../PorousMediaGPU/PorousMediaGPU.cpp | 5 +-- .../PorousMediaGPU/PorousMediaGPU.prm | 4 +-- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/apps/showcases/PorousMediaGPU/InitializerFunctions.cpp b/apps/showcases/PorousMediaGPU/InitializerFunctions.cpp index f3a921e31..fb285f1c0 100644 --- a/apps/showcases/PorousMediaGPU/InitializerFunctions.cpp +++ b/apps/showcases/PorousMediaGPU/InitializerFunctions.cpp @@ -36,6 +36,11 @@ void init_TPMS(const shared_ptr< StructuredBlockStorage >& blocks, const BlockDa const FlagUID boundaryFlagUID, const real_t kx, const real_t ky, const real_t kz) { + const real_t parts = real_c(blocks->getDomainCellBB().xMax()) / real_c(10.0); + const real_t start = parts * real_c(2.0); + const real_t end1 = parts * real_c(5.0); + const real_t end2 = parts * real_c(8.0); + const real_t strut = real_c(0.0); for (auto& block : *blocks) @@ -44,8 +49,33 @@ void init_TPMS(const shared_ptr< StructuredBlockStorage >& blocks, const BlockDa const auto boundaryFlag = flagField->getOrRegisterFlag(boundaryFlagUID); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ(flagField, Cell globalCell; blocks->transformBlockLocalToGlobalCell(globalCell, block, Cell(x, y, z)); - const real_t dist = cos(kx * x) * sin(ky * y) + cos(ky * y) * sin(kz * z) + cos(kz * z) * sin(kx * x); - if (dist >= strut) addFlag(flagField->get(x, y, z), boundaryFlag);) + if (globalCell[0] > start && globalCell[0] <= end1) + { + const real_t kxi = kx; + const real_t kyi = ky; + const real_t kzi = kz; + + const real_t dist = cos(kxi * x) * sin(kyi * y) + cos(kyi * y) * sin(kzi * z) + cos(kzi * z) * sin(kxi * x); + + if (dist >= strut) + { + addFlag(flagField->get(x, y, z), boundaryFlag); + } + } + if (globalCell[0] > end1 && globalCell[0] <= end2) + { + const real_t kxi = kx / real_c(10.0); + const real_t kyi = ky / real_c(10.0); + const real_t kzi = kz / real_c(10.0); + + const real_t dist = cos(kxi * x) * sin(kyi * y) + cos(kyi * y) * sin(kzi * z) + cos(kzi * z) * sin(kxi * x); + + if (dist >= strut) + { + addFlag(flagField->get(x, y, z), boundaryFlag); + } + } + ) } } } // namespace walberla diff --git a/apps/showcases/PorousMediaGPU/PorousMediaGPU.cpp b/apps/showcases/PorousMediaGPU/PorousMediaGPU.cpp index 185a89970..d0d3c0ee0 100644 --- a/apps/showcases/PorousMediaGPU/PorousMediaGPU.cpp +++ b/apps/showcases/PorousMediaGPU/PorousMediaGPU.cpp @@ -28,6 +28,7 @@ #include "core/debug/CheckFunctions.h" #include "core/logging/Logging.h" #include "core/math/Vector3.h" +#include "core/math/Constants.h" #include "core/Environment.h" #include "core/mpi/MPIManager.h" #include "core/MemoryUsage.h" @@ -124,7 +125,7 @@ int main(int argc, char** argv) const real_t machNumber = inflowVelocity / speedOfSound; // TODO define RE const real_t viscosity = real_c((inflowVelocity * 1.0) / reynoldsNumber); - const real_t omega = real_c(real_c(1.0) / (real_c(3.0) * viscosity + real_c(0.5))); + const real_t omega = 1.5; // real_c(real_c(1.0) / (real_c(3.0) * viscosity + real_c(0.5))); IDs ids; @@ -162,7 +163,7 @@ int main(int argc, char** argv) { WALBERLA_LOG_INFO_ON_ROOT("Setting boundary conditions") geometry::initBoundaryHandling< FlagField_T >(*blocks, ids.flagField, boundariesConfig); - const real_t test = 6; + const real_t test = 6.0; // 'math::pi * real_c(1.0); init_TPMS(blocks, ids.flagField, wallFlagUID, test, test, test); geometry::setNonBoundaryCellsToDomain< FlagField_T >(*blocks, ids.flagField, fluidFlagUID); } diff --git a/apps/showcases/PorousMediaGPU/PorousMediaGPU.prm b/apps/showcases/PorousMediaGPU/PorousMediaGPU.prm index 392caccc0..13ae1b72a 100644 --- a/apps/showcases/PorousMediaGPU/PorousMediaGPU.prm +++ b/apps/showcases/PorousMediaGPU/PorousMediaGPU.prm @@ -6,7 +6,7 @@ Parameters latticeVelocity 0.05; initialiseWithInletVelocity true; - timesteps 2; + timesteps 5001; processMemoryLimit 512; // MiB innerOuterSplit <1, 1, 1>; @@ -40,7 +40,7 @@ StabilityChecker VTKWriter { - vtkWriteFrequency 1; + vtkWriteFrequency 1000; vtkGhostLayers 0; velocity true; density true; -- GitLab