From 3f25e5e4c0d426edbdabbe94e783e41e0be09078 Mon Sep 17 00:00:00 2001 From: Christoph Schwarzmeier <christoph.schwarzmeier@fau.de> Date: Thu, 3 Mar 2022 12:50:52 +0100 Subject: [PATCH] Fix bug in hydrostatic pressure [ci skip] --- .../showcases/PhaseFieldAllenCahn/GPU/CMakeLists.txt | 2 +- .../PhaseFieldAllenCahn/GPU/InitializerFunctions.cpp | 12 ++++++------ .../showcases/PhaseFieldAllenCahn/GPU/multiphase.cpp | 2 +- .../PhaseFieldAllenCahn/GPU/multiphase_codegen.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/showcases/PhaseFieldAllenCahn/GPU/CMakeLists.txt b/apps/showcases/PhaseFieldAllenCahn/GPU/CMakeLists.txt index 5e20c669c..ac4feda33 100644 --- a/apps/showcases/PhaseFieldAllenCahn/GPU/CMakeLists.txt +++ b/apps/showcases/PhaseFieldAllenCahn/GPU/CMakeLists.txt @@ -13,7 +13,7 @@ waLBerla_generate_target_from_python(NAME PhaseFieldCodeGenGPU PackInfo_phase_field_distributions.cu PackInfo_phase_field_distributions.h PackInfo_phase_field.cu PackInfo_phase_field.h PackInfo_velocity_based_distributions.cu PackInfo_velocity_based_distributions.h -# ContactAngle.cu ContactAngle.h + ContactAngle.cu ContactAngle.h GenDefines.h) waLBerla_add_executable(NAME multiphaseGPU diff --git a/apps/showcases/PhaseFieldAllenCahn/GPU/InitializerFunctions.cpp b/apps/showcases/PhaseFieldAllenCahn/GPU/InitializerFunctions.cpp index e21df235b..082c047ab 100644 --- a/apps/showcases/PhaseFieldAllenCahn/GPU/InitializerFunctions.cpp +++ b/apps/showcases/PhaseFieldAllenCahn/GPU/InitializerFunctions.cpp @@ -39,12 +39,12 @@ void init_hydrostatic_pressure(const shared_ptr< StructuredBlockStorage >& block for (auto& block : *blocks) { auto densityField = block.getData< PhaseField_T >(densityFieldID); - // clang-format off - WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ(densityField, Cell globalCell; - blocks->transformBlockLocalToGlobalCell(globalCell, block, Cell(x, y, z)); - real_t pressure = 3.0 * GravitationalAcceleration * (globalCell[1] - poolDepth); - densityField->get(x, y, z) += pressure;) - // clang-format on + WALBERLA_FOR_ALL_CELLS_XYZ(densityField, { + Cell globalCell; + blocks->transformBlockLocalToGlobalCell(globalCell, block, Cell(x, y, z)); + real_t pressure = real_c(3.0) * GravitationalAcceleration * (globalCell[1] - poolDepth); + densityField->get(x, y, z) += pressure; + }) // WALBERLA_FOR_ALL_CELLS_XYZ } } diff --git a/apps/showcases/PhaseFieldAllenCahn/GPU/multiphase.cpp b/apps/showcases/PhaseFieldAllenCahn/GPU/multiphase.cpp index 186403db7..64c38159e 100644 --- a/apps/showcases/PhaseFieldAllenCahn/GPU/multiphase.cpp +++ b/apps/showcases/PhaseFieldAllenCahn/GPU/multiphase.cpp @@ -171,7 +171,7 @@ int main(int argc, char** argv) initTaylorBubbleCylindric(blocks, phase_field, BubbleRadius, InitialHeight, Length, real_c(interface_thickness)); init_hydrostatic_pressure(blocks, density_field, gravitational_acceleration, real_c(domainSize[1]) * real_c(0.5)); - cuda::fieldCpy< GPUField, PhaseField_T >(blocks, phase_field_gpu, density_field); + cuda::fieldCpy< GPUField, PhaseField_T >(blocks, density_field_gpu, density_field); } WALBERLA_LOG_INFO_ON_ROOT("initialization of the phase field done") diff --git a/apps/showcases/PhaseFieldAllenCahn/GPU/multiphase_codegen.py b/apps/showcases/PhaseFieldAllenCahn/GPU/multiphase_codegen.py index 0a2b310f2..c211999d4 100644 --- a/apps/showcases/PhaseFieldAllenCahn/GPU/multiphase_codegen.py +++ b/apps/showcases/PhaseFieldAllenCahn/GPU/multiphase_codegen.py @@ -204,8 +204,8 @@ with CodeGeneration() as ctx: generate_pack_info_for_field(ctx, 'PackInfo_phase_field', C, target=Target.GPU) - # pystencils_walberla.boundary.generate_boundary(ctx, 'ContactAngle', contact_angle, - # C.name, stencil_hydro, index_shape=[], target=Target.GPU) + pystencils_walberla.boundary.generate_boundary(ctx, 'ContactAngle', contact_angle, + C.name, stencil_hydro, index_shape=[], target=Target.GPU) generate_info_header(ctx, 'GenDefines', stencil_typedefs=stencil_typedefs, field_typedefs=field_typedefs, additional_code=additional_code) -- GitLab