From 94d3e79a8617f88dc0219cfdeedfa3147833719d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 24 Jun 2019 14:43:36 +0200 Subject: Initialize at openlb-1-3 --- examples/laminar/bstep2d/Makefile | 105 +++ examples/laminar/bstep2d/bstep2d.cpp | 292 +++++++++ examples/laminar/bstep2d/definitions.mk | 30 + examples/laminar/bstep2d/module.mk | 29 + examples/laminar/bstep3d/Makefile | 105 +++ examples/laminar/bstep3d/bstep3d.cpp | 327 ++++++++++ examples/laminar/bstep3d/definitions.mk | 30 + examples/laminar/bstep3d/module.mk | 29 + examples/laminar/cavity2d/parallel/Makefile | 105 +++ examples/laminar/cavity2d/parallel/cavity2d.cpp | 324 ++++++++++ examples/laminar/cavity2d/parallel/cavity2d.xml | 44 ++ examples/laminar/cavity2d/parallel/definitions.mk | 30 + .../cavity2d/parallel/description_cavity2d.xml | 345 ++++++++++ examples/laminar/cavity2d/parallel/module.mk | 29 + examples/laminar/cavity2d/sequential/Makefile | 105 +++ examples/laminar/cavity2d/sequential/cavity2d.cpp | 230 +++++++ examples/laminar/cavity2d/sequential/cavity2d.xml | 44 ++ .../laminar/cavity2d/sequential/definitions.mk | 30 + .../cavity2d/sequential/description_cavity2d.xml | 345 ++++++++++ examples/laminar/cavity2d/sequential/module.mk | 29 + examples/laminar/cavity3d/parallel/Makefile | 105 +++ examples/laminar/cavity3d/parallel/cavity3d.cpp | 277 ++++++++ examples/laminar/cavity3d/parallel/definitions.mk | 30 + examples/laminar/cavity3d/parallel/module.mk | 29 + examples/laminar/cavity3d/sequential/Makefile | 105 +++ examples/laminar/cavity3d/sequential/cavity3d.cpp | 253 ++++++++ .../laminar/cavity3d/sequential/definitions.mk | 30 + examples/laminar/cavity3d/sequential/module.mk | 29 + examples/laminar/cylinder2d/Makefile | 105 +++ examples/laminar/cylinder2d/cylinder2d.cpp | 386 +++++++++++ examples/laminar/cylinder2d/definitions.mk | 30 + examples/laminar/cylinder2d/module.mk | 29 + examples/laminar/cylinder3d/Makefile | 105 +++ examples/laminar/cylinder3d/cylinder3d.cpp | 363 +++++++++++ examples/laminar/cylinder3d/cylinder3d.fcstd | Bin 0 -> 274616 bytes examples/laminar/cylinder3d/cylinder3d.stl | Bin 0 -> 15084 bytes examples/laminar/cylinder3d/definitions.mk | 30 + examples/laminar/cylinder3d/module.mk | 29 + examples/laminar/poiseuille2d/Makefile | 105 +++ examples/laminar/poiseuille2d/definitions.mk | 30 + examples/laminar/poiseuille2d/launcher2d.sh | 2 + examples/laminar/poiseuille2d/module.mk | 29 + examples/laminar/poiseuille2d/poiseuille2d.cpp | 516 +++++++++++++++ examples/laminar/poiseuille3d/Makefile | 105 +++ examples/laminar/poiseuille3d/definitions.mk | 30 + examples/laminar/poiseuille3d/launcher3d.sh | 2 + examples/laminar/poiseuille3d/module.mk | 29 + examples/laminar/poiseuille3d/poiseuille3d.cpp | 613 ++++++++++++++++++ examples/laminar/powerLaw2d/Makefile | 105 +++ examples/laminar/powerLaw2d/definitions.mk | 30 + examples/laminar/powerLaw2d/input-model.xml | 17 + examples/laminar/powerLaw2d/input.xml | 17 + examples/laminar/powerLaw2d/module.mk | 29 + examples/laminar/powerLaw2d/powerLaw2d.cpp | 456 +++++++++++++ examples/laminar/powerLaw2d/run.sh | 29 + examples/multiComponent/contactAngle2d/Makefile | 105 +++ .../contactAngle2d/contactAngle2d.cpp | 389 +++++++++++ .../multiComponent/contactAngle2d/definitions.mk | 30 + examples/multiComponent/contactAngle2d/module.mk | 29 + examples/multiComponent/contactAngle3d/Makefile | 105 +++ .../contactAngle3d/contactAngle3d.cpp | 393 ++++++++++++ .../multiComponent/contactAngle3d/definitions.mk | 30 + examples/multiComponent/contactAngle3d/module.mk | 29 + examples/multiComponent/microFluidics2d/Makefile | 105 +++ .../multiComponent/microFluidics2d/definitions.mk | 30 + .../microFluidics2d/microFluidics2d.cpp | 456 +++++++++++++ examples/multiComponent/microFluidics2d/module.mk | 29 + examples/multiComponent/phaseSeparation2d/Makefile | 105 +++ .../phaseSeparation2d/definitions.mk | 30 + .../multiComponent/phaseSeparation2d/module.mk | 29 + .../phaseSeparation2d/phaseSeparation2d.cpp | 216 +++++++ examples/multiComponent/phaseSeparation3d/Makefile | 105 +++ .../phaseSeparation3d/definitions.mk | 30 + .../multiComponent/phaseSeparation3d/module.mk | 29 + .../phaseSeparation3d/phaseSeparation3d.cpp | 217 +++++++ examples/multiComponent/rayleighTaylor2d/Makefile | 105 +++ .../multiComponent/rayleighTaylor2d/definitions.mk | 30 + examples/multiComponent/rayleighTaylor2d/module.mk | 29 + .../rayleighTaylor2d/rayleighTaylor2d.cpp | 309 +++++++++ examples/multiComponent/rayleighTaylor3d/Makefile | 105 +++ .../multiComponent/rayleighTaylor3d/definitions.mk | 30 + examples/multiComponent/rayleighTaylor3d/module.mk | 29 + .../rayleighTaylor3d/rayleighTaylor3d.cpp | 312 +++++++++ examples/multiComponent/youngLaplace2d/Makefile | 105 +++ .../multiComponent/youngLaplace2d/definitions.mk | 30 + examples/multiComponent/youngLaplace2d/module.mk | 29 + .../youngLaplace2d/youngLaplace2d.cpp | 315 +++++++++ examples/multiComponent/youngLaplace3d/Makefile | 105 +++ .../multiComponent/youngLaplace3d/definitions.mk | 30 + examples/multiComponent/youngLaplace3d/module.mk | 29 + .../youngLaplace3d/youngLaplace3d.cpp | 316 +++++++++ examples/particles/bifurcation3d/bifurcation3d.stl | Bin 0 -> 79184 bytes .../particles/bifurcation3d/eulerEuler/Makefile | 105 +++ .../bifurcation3d/eulerEuler/bifurcation3d.cpp | 420 ++++++++++++ .../bifurcation3d/eulerEuler/definitions.mk | 30 + .../particles/bifurcation3d/eulerEuler/module.mk | 29 + .../particles/bifurcation3d/eulerLagrange/Makefile | 105 +++ .../bifurcation3d/eulerLagrange/bifurcation3d.cpp | 515 +++++++++++++++ .../bifurcation3d/eulerLagrange/definitions.mk | 30 + .../bifurcation3d/eulerLagrange/module.mk | 29 + examples/particles/dkt2d/Makefile | 115 ++++ examples/particles/dkt2d/definitions.mk | 30 + examples/particles/dkt2d/dkt.p | 22 + examples/particles/dkt2d/dkt2d.cpp | 267 ++++++++ examples/particles/dkt2d/module.mk | 29 + examples/particles/magneticParticles3d/Makefile | 105 +++ .../particles/magneticParticles3d/definitions.mk | 30 + .../magneticParticles3d/magneticParticles3d.cpp | 644 +++++++++++++++++++ .../magneticParticles3d/magneticParticles3d.xml | 47 ++ examples/particles/magneticParticles3d/module.mk | 29 + examples/particles/settlingCube3d/Makefile | 105 +++ examples/particles/settlingCube3d/definitions.mk | 30 + examples/particles/settlingCube3d/module.mk | 29 + .../particles/settlingCube3d/settlingCube3D.cpp | 294 +++++++++ examples/porousMedia/porousPoiseuille2d/Makefile | 105 +++ .../porousMedia/porousPoiseuille2d/definitions.mk | 30 + examples/porousMedia/porousPoiseuille2d/input.xml | 21 + examples/porousMedia/porousPoiseuille2d/module.mk | 29 + .../porousPoiseuille2d/porousPoiseuille2d.cpp | 478 ++++++++++++++ examples/porousMedia/porousPoiseuille3d/Makefile | 105 +++ .../porousMedia/porousPoiseuille3d/definitions.mk | 30 + examples/porousMedia/porousPoiseuille3d/module.mk | 29 + .../porousPoiseuille3d/porousPoiseuille3d.cpp | 484 ++++++++++++++ examples/thermal/porousPlate2d/Makefile | 113 ++++ examples/thermal/porousPlate2d/definitions.mk | 30 + examples/thermal/porousPlate2d/module.mk | 29 + .../thermal/porousPlate2d/thermalPorousPlate2d.cpp | 524 +++++++++++++++ examples/thermal/porousPlate3d/Makefile | 113 ++++ examples/thermal/porousPlate3d/definitions.mk | 30 + examples/thermal/porousPlate3d/module.mk | 29 + .../thermal/porousPlate3d/thermalPorousPlate3d.cpp | 494 ++++++++++++++ examples/thermal/rayleighBenard2d/Makefile | 113 ++++ examples/thermal/rayleighBenard2d/definitions.mk | 30 + examples/thermal/rayleighBenard2d/module.mk | 29 + .../thermal/rayleighBenard2d/rayleighBenard2d.cpp | 346 ++++++++++ examples/thermal/rayleighBenard3d/Makefile | 113 ++++ examples/thermal/rayleighBenard3d/definitions.mk | 30 + examples/thermal/rayleighBenard3d/module.mk | 29 + .../thermal/rayleighBenard3d/rayleighBenard3d.cpp | 336 ++++++++++ examples/thermal/squareCavity2d/Makefile | 113 ++++ examples/thermal/squareCavity2d/definitions.mk | 30 + examples/thermal/squareCavity2d/module.mk | 29 + examples/thermal/squareCavity2d/squareCavity2d.cpp | 708 +++++++++++++++++++++ examples/thermal/squareCavity3d/Makefile | 113 ++++ examples/thermal/squareCavity3d/definitions.mk | 30 + examples/thermal/squareCavity3d/module.mk | 29 + examples/thermal/squareCavity3d/squareCavity3d.cpp | 518 +++++++++++++++ examples/turbulence/aorta3d/Makefile | 105 +++ examples/turbulence/aorta3d/aorta3d.cpp | 356 +++++++++++ examples/turbulence/aorta3d/aorta3d.stl | Bin 0 -> 132784 bytes examples/turbulence/aorta3d/definitions.mk | 30 + examples/turbulence/aorta3d/module.mk | 29 + examples/turbulence/nozzle3d/Makefile | 105 +++ examples/turbulence/nozzle3d/definitions.mk | 30 + examples/turbulence/nozzle3d/module.mk | 29 + examples/turbulence/nozzle3d/nozzle3d.cpp | 382 +++++++++++ examples/turbulence/tgv3d/Makefile | 105 +++ examples/turbulence/tgv3d/Re1600_Brachet.inp | 73 +++ examples/turbulence/tgv3d/Re3000_Brachet.inp | 69 ++ examples/turbulence/tgv3d/Re800_Brachet.inp | 64 ++ examples/turbulence/tgv3d/definitions.mk | 30 + examples/turbulence/tgv3d/module.mk | 29 + examples/turbulence/tgv3d/tgv3d.cpp | 421 ++++++++++++ examples/turbulence/venturi3d/Makefile | 105 +++ examples/turbulence/venturi3d/definitions.mk | 30 + examples/turbulence/venturi3d/module.mk | 29 + examples/turbulence/venturi3d/venturi3d.cpp | 284 +++++++++ examples/turbulence/venturi3d/venturi3d.xml | 41 ++ 168 files changed, 21739 insertions(+) create mode 100644 examples/laminar/bstep2d/Makefile create mode 100644 examples/laminar/bstep2d/bstep2d.cpp create mode 100644 examples/laminar/bstep2d/definitions.mk create mode 100644 examples/laminar/bstep2d/module.mk create mode 100644 examples/laminar/bstep3d/Makefile create mode 100644 examples/laminar/bstep3d/bstep3d.cpp create mode 100644 examples/laminar/bstep3d/definitions.mk create mode 100644 examples/laminar/bstep3d/module.mk create mode 100644 examples/laminar/cavity2d/parallel/Makefile create mode 100644 examples/laminar/cavity2d/parallel/cavity2d.cpp create mode 100644 examples/laminar/cavity2d/parallel/cavity2d.xml create mode 100644 examples/laminar/cavity2d/parallel/definitions.mk create mode 100644 examples/laminar/cavity2d/parallel/description_cavity2d.xml create mode 100644 examples/laminar/cavity2d/parallel/module.mk create mode 100644 examples/laminar/cavity2d/sequential/Makefile create mode 100644 examples/laminar/cavity2d/sequential/cavity2d.cpp create mode 100644 examples/laminar/cavity2d/sequential/cavity2d.xml create mode 100644 examples/laminar/cavity2d/sequential/definitions.mk create mode 100644 examples/laminar/cavity2d/sequential/description_cavity2d.xml create mode 100644 examples/laminar/cavity2d/sequential/module.mk create mode 100644 examples/laminar/cavity3d/parallel/Makefile create mode 100644 examples/laminar/cavity3d/parallel/cavity3d.cpp create mode 100644 examples/laminar/cavity3d/parallel/definitions.mk create mode 100644 examples/laminar/cavity3d/parallel/module.mk create mode 100644 examples/laminar/cavity3d/sequential/Makefile create mode 100644 examples/laminar/cavity3d/sequential/cavity3d.cpp create mode 100644 examples/laminar/cavity3d/sequential/definitions.mk create mode 100644 examples/laminar/cavity3d/sequential/module.mk create mode 100644 examples/laminar/cylinder2d/Makefile create mode 100644 examples/laminar/cylinder2d/cylinder2d.cpp create mode 100644 examples/laminar/cylinder2d/definitions.mk create mode 100644 examples/laminar/cylinder2d/module.mk create mode 100644 examples/laminar/cylinder3d/Makefile create mode 100644 examples/laminar/cylinder3d/cylinder3d.cpp create mode 100644 examples/laminar/cylinder3d/cylinder3d.fcstd create mode 100644 examples/laminar/cylinder3d/cylinder3d.stl create mode 100644 examples/laminar/cylinder3d/definitions.mk create mode 100644 examples/laminar/cylinder3d/module.mk create mode 100644 examples/laminar/poiseuille2d/Makefile create mode 100644 examples/laminar/poiseuille2d/definitions.mk create mode 100755 examples/laminar/poiseuille2d/launcher2d.sh create mode 100644 examples/laminar/poiseuille2d/module.mk create mode 100644 examples/laminar/poiseuille2d/poiseuille2d.cpp create mode 100644 examples/laminar/poiseuille3d/Makefile create mode 100644 examples/laminar/poiseuille3d/definitions.mk create mode 100755 examples/laminar/poiseuille3d/launcher3d.sh create mode 100644 examples/laminar/poiseuille3d/module.mk create mode 100755 examples/laminar/poiseuille3d/poiseuille3d.cpp create mode 100644 examples/laminar/powerLaw2d/Makefile create mode 100644 examples/laminar/powerLaw2d/definitions.mk create mode 100644 examples/laminar/powerLaw2d/input-model.xml create mode 100644 examples/laminar/powerLaw2d/input.xml create mode 100644 examples/laminar/powerLaw2d/module.mk create mode 100644 examples/laminar/powerLaw2d/powerLaw2d.cpp create mode 100755 examples/laminar/powerLaw2d/run.sh create mode 100644 examples/multiComponent/contactAngle2d/Makefile create mode 100644 examples/multiComponent/contactAngle2d/contactAngle2d.cpp create mode 100644 examples/multiComponent/contactAngle2d/definitions.mk create mode 100644 examples/multiComponent/contactAngle2d/module.mk create mode 100644 examples/multiComponent/contactAngle3d/Makefile create mode 100644 examples/multiComponent/contactAngle3d/contactAngle3d.cpp create mode 100644 examples/multiComponent/contactAngle3d/definitions.mk create mode 100644 examples/multiComponent/contactAngle3d/module.mk create mode 100644 examples/multiComponent/microFluidics2d/Makefile create mode 100644 examples/multiComponent/microFluidics2d/definitions.mk create mode 100644 examples/multiComponent/microFluidics2d/microFluidics2d.cpp create mode 100644 examples/multiComponent/microFluidics2d/module.mk create mode 100644 examples/multiComponent/phaseSeparation2d/Makefile create mode 100644 examples/multiComponent/phaseSeparation2d/definitions.mk create mode 100644 examples/multiComponent/phaseSeparation2d/module.mk create mode 100644 examples/multiComponent/phaseSeparation2d/phaseSeparation2d.cpp create mode 100644 examples/multiComponent/phaseSeparation3d/Makefile create mode 100644 examples/multiComponent/phaseSeparation3d/definitions.mk create mode 100644 examples/multiComponent/phaseSeparation3d/module.mk create mode 100644 examples/multiComponent/phaseSeparation3d/phaseSeparation3d.cpp create mode 100644 examples/multiComponent/rayleighTaylor2d/Makefile create mode 100644 examples/multiComponent/rayleighTaylor2d/definitions.mk create mode 100644 examples/multiComponent/rayleighTaylor2d/module.mk create mode 100644 examples/multiComponent/rayleighTaylor2d/rayleighTaylor2d.cpp create mode 100644 examples/multiComponent/rayleighTaylor3d/Makefile create mode 100644 examples/multiComponent/rayleighTaylor3d/definitions.mk create mode 100644 examples/multiComponent/rayleighTaylor3d/module.mk create mode 100644 examples/multiComponent/rayleighTaylor3d/rayleighTaylor3d.cpp create mode 100644 examples/multiComponent/youngLaplace2d/Makefile create mode 100644 examples/multiComponent/youngLaplace2d/definitions.mk create mode 100644 examples/multiComponent/youngLaplace2d/module.mk create mode 100644 examples/multiComponent/youngLaplace2d/youngLaplace2d.cpp create mode 100644 examples/multiComponent/youngLaplace3d/Makefile create mode 100644 examples/multiComponent/youngLaplace3d/definitions.mk create mode 100644 examples/multiComponent/youngLaplace3d/module.mk create mode 100644 examples/multiComponent/youngLaplace3d/youngLaplace3d.cpp create mode 100644 examples/particles/bifurcation3d/bifurcation3d.stl create mode 100644 examples/particles/bifurcation3d/eulerEuler/Makefile create mode 100644 examples/particles/bifurcation3d/eulerEuler/bifurcation3d.cpp create mode 100644 examples/particles/bifurcation3d/eulerEuler/definitions.mk create mode 100644 examples/particles/bifurcation3d/eulerEuler/module.mk create mode 100644 examples/particles/bifurcation3d/eulerLagrange/Makefile create mode 100644 examples/particles/bifurcation3d/eulerLagrange/bifurcation3d.cpp create mode 100644 examples/particles/bifurcation3d/eulerLagrange/definitions.mk create mode 100644 examples/particles/bifurcation3d/eulerLagrange/module.mk create mode 100644 examples/particles/dkt2d/Makefile create mode 100644 examples/particles/dkt2d/definitions.mk create mode 100644 examples/particles/dkt2d/dkt.p create mode 100644 examples/particles/dkt2d/dkt2d.cpp create mode 100644 examples/particles/dkt2d/module.mk create mode 100644 examples/particles/magneticParticles3d/Makefile create mode 100644 examples/particles/magneticParticles3d/definitions.mk create mode 100644 examples/particles/magneticParticles3d/magneticParticles3d.cpp create mode 100644 examples/particles/magneticParticles3d/magneticParticles3d.xml create mode 100644 examples/particles/magneticParticles3d/module.mk create mode 100755 examples/particles/settlingCube3d/Makefile create mode 100755 examples/particles/settlingCube3d/definitions.mk create mode 100644 examples/particles/settlingCube3d/module.mk create mode 100644 examples/particles/settlingCube3d/settlingCube3D.cpp create mode 100644 examples/porousMedia/porousPoiseuille2d/Makefile create mode 100644 examples/porousMedia/porousPoiseuille2d/definitions.mk create mode 100644 examples/porousMedia/porousPoiseuille2d/input.xml create mode 100644 examples/porousMedia/porousPoiseuille2d/module.mk create mode 100644 examples/porousMedia/porousPoiseuille2d/porousPoiseuille2d.cpp create mode 100644 examples/porousMedia/porousPoiseuille3d/Makefile create mode 100644 examples/porousMedia/porousPoiseuille3d/definitions.mk create mode 100644 examples/porousMedia/porousPoiseuille3d/module.mk create mode 100644 examples/porousMedia/porousPoiseuille3d/porousPoiseuille3d.cpp create mode 100644 examples/thermal/porousPlate2d/Makefile create mode 100644 examples/thermal/porousPlate2d/definitions.mk create mode 100644 examples/thermal/porousPlate2d/module.mk create mode 100644 examples/thermal/porousPlate2d/thermalPorousPlate2d.cpp create mode 100644 examples/thermal/porousPlate3d/Makefile create mode 100644 examples/thermal/porousPlate3d/definitions.mk create mode 100644 examples/thermal/porousPlate3d/module.mk create mode 100644 examples/thermal/porousPlate3d/thermalPorousPlate3d.cpp create mode 100644 examples/thermal/rayleighBenard2d/Makefile create mode 100644 examples/thermal/rayleighBenard2d/definitions.mk create mode 100644 examples/thermal/rayleighBenard2d/module.mk create mode 100644 examples/thermal/rayleighBenard2d/rayleighBenard2d.cpp create mode 100644 examples/thermal/rayleighBenard3d/Makefile create mode 100644 examples/thermal/rayleighBenard3d/definitions.mk create mode 100644 examples/thermal/rayleighBenard3d/module.mk create mode 100644 examples/thermal/rayleighBenard3d/rayleighBenard3d.cpp create mode 100644 examples/thermal/squareCavity2d/Makefile create mode 100644 examples/thermal/squareCavity2d/definitions.mk create mode 100644 examples/thermal/squareCavity2d/module.mk create mode 100644 examples/thermal/squareCavity2d/squareCavity2d.cpp create mode 100644 examples/thermal/squareCavity3d/Makefile create mode 100644 examples/thermal/squareCavity3d/definitions.mk create mode 100644 examples/thermal/squareCavity3d/module.mk create mode 100644 examples/thermal/squareCavity3d/squareCavity3d.cpp create mode 100644 examples/turbulence/aorta3d/Makefile create mode 100644 examples/turbulence/aorta3d/aorta3d.cpp create mode 100644 examples/turbulence/aorta3d/aorta3d.stl create mode 100644 examples/turbulence/aorta3d/definitions.mk create mode 100644 examples/turbulence/aorta3d/module.mk create mode 100644 examples/turbulence/nozzle3d/Makefile create mode 100644 examples/turbulence/nozzle3d/definitions.mk create mode 100644 examples/turbulence/nozzle3d/module.mk create mode 100644 examples/turbulence/nozzle3d/nozzle3d.cpp create mode 100644 examples/turbulence/tgv3d/Makefile create mode 100644 examples/turbulence/tgv3d/Re1600_Brachet.inp create mode 100644 examples/turbulence/tgv3d/Re3000_Brachet.inp create mode 100644 examples/turbulence/tgv3d/Re800_Brachet.inp create mode 100644 examples/turbulence/tgv3d/definitions.mk create mode 100644 examples/turbulence/tgv3d/module.mk create mode 100644 examples/turbulence/tgv3d/tgv3d.cpp create mode 100644 examples/turbulence/venturi3d/Makefile create mode 100644 examples/turbulence/venturi3d/definitions.mk create mode 100644 examples/turbulence/venturi3d/module.mk create mode 100644 examples/turbulence/venturi3d/venturi3d.cpp create mode 100644 examples/turbulence/venturi3d/venturi3d.xml (limited to 'examples') diff --git a/examples/laminar/bstep2d/Makefile b/examples/laminar/bstep2d/Makefile new file mode 100644 index 0000000..a953954 --- /dev/null +++ b/examples/laminar/bstep2d/Makefile @@ -0,0 +1,105 @@ +# This file is part of the OpenLB library +# +# Copyright (C) 2007 Mathias Krause +# E-mail contact: info@openlb.net +# The most recent release of OpenLB can be downloaded at +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +########################################################################### +## definitions + +include definitions.mk + +include $(ROOT)/global.mk + +OBJECTS := $(foreach file, $(SRC), $(PWD)/$(file:.cpp=.o)) +DEPS := $(foreach file, $(SRC), $(PWD)/$(file:.cpp=.d)) + +########################################################################### +## all + +all : depend compile link + + +########################################################################### +## dependencies + +depend : $(DEPS) + +$(PWD)/%.d : %.cpp + @echo Create dependencies for $< + @$(SHELL) -ec '$(CXX) -M $(CXXFLAGS) $(IDIR) $< \ + | sed -e "s!$*\.o!$(PWD)\/$*\.o!1" > .tmpfile; \ + cp -f .tmpfile $@;' + +########################################################################### +## compile + +compile : $(OBJECTS) + +$(PWD)/%.o: %.cpp + @echo Compile $< + $(CXX) $(CXXFLAGS) $(IDIR) -c $< -o $@ + +########################################################################### +## clean + +clean : cleanrub cleanobj cleandep + +cleanrub: + @echo Clean rubbish files + @rm -f *~ core .tmpfile tmp/*.* $(OUTPUT) + @rm -f tmp/vtkData/*.* tmp/vtkData/data/*.* tmp/imageData/*.* tmp/gnuplotData/*.* tmp/gnuplotData/data/*.* + +cleanobj: + @echo Clean object files + @rm -f $(OBJECTS) + +cleandep: + @echo Clean dependencies files + @rm -f $(DEPS) + +cleanbuild: + @cd $(ROOT); \ + $(MAKE) cleanlib; + +########################################################################### +## update lib + +$(ROOT)/$(LIBDIR)/lib$(LIB).a : + @cd $(ROOT); \ + $(MAKE) all + +########################################################################### +## link + +link: $(OUTPUT) + +$(OUTPUT): $(OBJECTS) $(ROOT)/$(LIBDIR)/lib$(LIB).a + @echo Link $@ + $(CXX) $(foreach file, $(SRC), $(file:.cpp=.o)) $(LDFLAGS) -L$(ROOT)/$(LIBDIR) -l$(LIB) -lz -o $@ + +########################################################################### +## include dependencies + +ifneq "$(strip $(wildcard *.d))" "" + include $(foreach file,$(DEPS),$(file)) +endif + +########################################################################### +########################################################################### diff --git a/examples/laminar/bstep2d/bstep2d.cpp b/examples/laminar/bstep2d/bstep2d.cpp new file mode 100644 index 0000000..89bbcba --- /dev/null +++ b/examples/laminar/bstep2d/bstep2d.cpp @@ -0,0 +1,292 @@ +/* Lattice Boltzmann sample, written in C++, using the OpenLB + * library + * + * Copyright (C) 2006, 2007, 2012 Jonas Latt, Mathias J. Krause + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +/* bstep2d.cpp: + * The implementation of a backward facing step. It is furthermore + * shown how to use checkpointing to save the state of the + * simulation regularly. + */ + + +#include "olb2D.h" +#ifndef OLB_PRECOMPILED // Unless precompiled version is used, +#include "olb2D.hh" // include full template code +#endif + +#include +#include +#include + +using namespace olb; +using namespace olb::descriptors; + + +typedef double T; +#define DESCRIPTOR D2Q9<> + + +// Parameters for the simulation setup +const T lx1 = 5.0; // length of step in meter +const T ly1 = 0.75; // height of step in meter +const T lx0 = 20.0; // length of channel in meter +const T ly0 = 1.5; // height of channel in meter +const int N = 60; // resolution of the model +const int M = 50; // resolution of the model +const T maxPhysT = 40.; // max. simulation time in s, SI unit + + +// Stores geometry information in form of material numbers +SuperGeometry2D prepareGeometry( UnitConverter const& converter ) +{ + OstreamManager clout( std::cout,"prepareGeometry" ); + clout << "Prepare Geometry ..." << std::endl; + + // set number of cuboids/blocks +#ifdef PARALLEL_MODE_MPI + const int noOfCuboids = singleton::mpi().getSize(); +#else + const int noOfCuboids = 6; +#endif + + // setup channel + Vector extendChannel( lx0,ly0 ); + Vector originChannel( 0, 0 ); + std::shared_ptr> channel = std::make_shared>( extendChannel, originChannel ); + + // setup step + Vector extendStep( lx1,ly1 ); + Vector originStep( 0, 0 ); + std::shared_ptr> step = std::make_shared>( extendStep, originStep ); + + CuboidGeometry2D* cuboidGeometry = new CuboidGeometry2D( *(channel-step), converter.getConversionFactorLength(), noOfCuboids ); + HeuristicLoadBalancer* loadBalancer = new HeuristicLoadBalancer( *cuboidGeometry ); + // Instantiation of a superGeometry + SuperGeometry2D superGeometry( *cuboidGeometry, *loadBalancer, 2 ); + + // material numbers from zero to 2 inside geometry defined by indicator + superGeometry.rename( 0,2 ); + superGeometry.rename( 2,1,1,1 ); + + Vector extendBC( 0,ly0 ); + Vector originBC; + IndicatorCuboid2D inflow( extendBC, originBC ); + // Set material number for inflow + superGeometry.rename( 2,3,1,inflow ); + originBC[0] = lx0; + IndicatorCuboid2D outflow( extendBC, originBC ); + // Set material number for outflow + superGeometry.rename( 2,4,1,outflow ); + // Removes all not needed boundary voxels outside the surface + superGeometry.clean(); + // Removes all not needed boundary voxels inside the surface + superGeometry.innerClean(); + superGeometry.checkForErrors(); + superGeometry.getStatistics().print(); + clout << "Prepare Geometry ... OK" << std::endl; + return superGeometry; +} + +// Set up the geometry of the simulation +void prepareLattice( UnitConverter const& converter, + SuperLattice2D& sLattice, + Dynamics& bulkDynamics, + sOnLatticeBoundaryCondition2D& bc, + SuperGeometry2D& superGeometry ) { + OstreamManager clout( std::cout,"prepareLattice" ); + clout << "Prepare Lattice ..." << std::endl; + + auto bulkIndicator = superGeometry.getMaterialIndicator({1, 3, 4}); + + // Material=0 -->do nothing + sLattice.defineDynamics( superGeometry, 0, &instances::getNoDynamics() ); + // Material=1 -->bulk dynamics + // Material=3 -->bulk dynamics (inflow) + // Material=4 -->bulk dynamics (outflow) + sLattice.defineDynamics( bulkIndicator, &bulkDynamics ); + // Material=2 -->bounce back + sLattice.defineDynamics( superGeometry, 2, &instances::getBounceBack() ); + + // Setting of the boundary conditions + bc.addVelocityBoundary( superGeometry, 3, converter.getLatticeRelaxationFrequency() ); + bc.addPressureBoundary( superGeometry, 4, converter.getLatticeRelaxationFrequency() ); + + // Initial conditions + AnalyticalConst2D ux( 0. ); + AnalyticalConst2D uy( 0. ); + AnalyticalConst2D rho( 1. ); + AnalyticalComposed2D u( ux,uy ); + + //Initialize all values of distribution functions to their local equilibrium + sLattice.defineRhoU( bulkIndicator, rho, u ); + sLattice.iniEquilibrium( bulkIndicator, rho, u ); + + // Make the lattice ready for simulation + sLattice.initialize(); + + clout << "Prepare Lattice ... OK" << std::endl; +} + +// Generates a slowly increasing inflow for the first iTMaxStart timesteps +void setBoundaryValues( UnitConverter const& converter, + SuperLattice2D& sLattice, int iT, + SuperGeometry2D& superGeometry ) { + OstreamManager clout( std::cout,"setBoundaryValues" ); + + // time for smooth start-up + int iTmaxStart = converter.getLatticeTime( maxPhysT*0.2 ); + int iTupdate = 5; + + if ( iT%iTupdate == 0 && iT<= iTmaxStart ) { + // Smooth start curve, sinus + // SinusStartScale StartScale(iTmaxStart, T(1)); + // Smooth start curve, polynomial + PolynomialStartScale StartScale( iTmaxStart, T( 1 ) ); + // Creates and sets the Poiseuille inflow profile using functors + int iTvec[1] = {iT}; + T frac[1] = {}; + StartScale( frac,iTvec ); + T maxVelocity = converter.getCharLatticeVelocity()*3./2.*frac[0]; + T distance2Wall = converter.getConversionFactorLength()/2.; + Poiseuille2D poiseuilleU( superGeometry, 3, maxVelocity, distance2Wall ); + // define lattice speed on inflow + sLattice.defineU( superGeometry, 3, poiseuilleU ); + } +} + +// write data to termimal and file system +void getResults( SuperLattice2D& sLattice, + UnitConverter const& converter, int iT, + SuperGeometry2D& superGeometry, Timer& timer, + SuperPlaneIntegralFluxVelocity2D& velocityFlux, + SuperPlaneIntegralFluxPressure2D& pressureFlux ) { + OstreamManager clout( std::cout,"getResults" ); + SuperVTMwriter2D vtmWriter( "bstep2d" ); + + if ( iT==0 ) { + // Writes geometry, cuboid no. and rank no. to file system + SuperLatticeGeometry2D geometry( sLattice, superGeometry ); + SuperLatticeCuboid2D cuboid( sLattice ); + SuperLatticeRank2D rank( sLattice ); + vtmWriter.write( geometry ); + vtmWriter.write( cuboid ); + vtmWriter.write( rank ); + vtmWriter.createMasterFile(); + } + + // Writes every 0.2 seconds + if ( iT%converter.getLatticeTime( 0.2 )==0 ) { + SuperLatticePhysVelocity2D velocity( sLattice, converter ); + SuperLatticePhysPressure2D pressure( sLattice, converter ); + vtmWriter.addFunctor( velocity ); + vtmWriter.addFunctor( pressure ); + // write vtk to file system + vtmWriter.write( iT ); + sLattice.communicate(); + SuperEuklidNorm2D normVel( velocity ); + BlockReduction2D2D planeReduction( normVel, 600, BlockDataSyncMode::ReduceOnly ); + // write output as JPEG + heatmap::write(planeReduction, iT); + } + + // Writes every 0.1 simulated + if ( iT%converter.getLatticeTime( 0.1 )==0 ) { + velocityFlux.print(); + pressureFlux.print(); + + // write to terminal + timer.update( iT ); + timer.printStep(); + // Lattice statistics console output + sLattice.getStatistics().print( iT,converter.getPhysTime( iT ) ); + } + + // Saves lattice data + if ( iT%converter.getLatticeTime( 1 )==0 && iT>0 ) { + clout << "Checkpointing the system at t=" << iT << std::endl; + sLattice.save( "bstep2d.checkpoint" ); + // The data can be reloaded using + // sLattice.load("bstep2d.checkpoint"); + } +} + + +int main( int argc, char* argv[] ) { + // === 1st Step: Initialization === + olbInit( &argc, &argv ); + singleton::directories().setOutputDir( "./tmp/" ); // set output directory + OstreamManager clout( std::cout, "main" ); + + UnitConverter converter( + (T) 1./N, // physDeltaX: spacing between two lattice cells in __m__ + (T) 1./(M*N), // physDeltaT: time step in __s__ + (T) 1., // charPhysLength: reference length of simulation geometry + (T) 1., // charPhysVelocity: maximal/highest expected velocity during simulation in __m / s__ + (T) 1./500., // physViscosity: physical kinematic viscosity in __m^2 / s__ + (T) 1. // physDensity: physical density in __kg / m^3__ + ); + // Prints the converter log as console output + converter.print(); + // Writes the converter log in a file + converter.write("bstep2d"); + + // === 2nd Step: Prepare Geometry === + // Instantiation of a superGeometry + SuperGeometry2D superGeometry( prepareGeometry(converter) ); + + // === 3rd Step: Prepare Lattice === + SuperLattice2D sLattice( superGeometry ); + + BGKdynamics bulkDynamics ( + converter.getLatticeRelaxationFrequency(), + instances::getBulkMomenta() + ); + + // choose between local and non-local boundary condition + sOnLatticeBoundaryCondition2D sBoundaryCondition( sLattice ); + // createInterpBoundaryCondition2D(sBoundaryCondition); + createLocalBoundaryCondition2D( sBoundaryCondition ); + + prepareLattice( converter, sLattice, bulkDynamics, sBoundaryCondition, superGeometry ); + + // instantiate reusable functors + SuperPlaneIntegralFluxVelocity2D velocityFlux( sLattice, converter, superGeometry, {19.,1.}, {0.,1.} ); + SuperPlaneIntegralFluxPressure2D pressureFlux( sLattice, converter, superGeometry, {19.,1.}, {0.,1.} ); + + // === 4th Step: Main Loop with Timer === + clout << "starting simulation..." << std::endl; + Timer timer( converter.getLatticeTime( maxPhysT ), superGeometry.getStatistics().getNvoxel() ); + timer.start(); + + for ( int iT = 0; iT < converter.getLatticeTime( maxPhysT ); ++iT ) { + // === 5th Step: Definition of Initial and Boundary Conditions === + setBoundaryValues( converter, sLattice, iT, superGeometry ); + // === 6th Step: Collide and Stream Execution === + sLattice.collideAndStream(); + // === 7th Step: Computation and Output of the Results === + getResults( sLattice, converter, iT, superGeometry, timer, velocityFlux, pressureFlux ); + } + + timer.stop(); + timer.printSummary(); +} diff --git a/examples/laminar/bstep2d/definitions.mk b/examples/laminar/bstep2d/definitions.mk new file mode 100644 index 0000000..72cc171 --- /dev/null +++ b/examples/laminar/bstep2d/definitions.mk @@ -0,0 +1,30 @@ +# This file is part of the OpenLB library +# +# Copyright (C) 2007 Mathias Krause +# E-mail contact: info@openlb.net +# The most recent release of OpenLB can be downloaded at +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + + +########################################################################### +########################################################################### +## DEFINITIONS TO BE CHANGED + +ROOT := ../../.. +SRC := bstep2d.cpp +OUTPUT := bstep2d diff --git a/examples/laminar/bstep2d/module.mk b/examples/laminar/bstep2d/module.mk new file mode 100644 index 0000000..1190482 --- /dev/null +++ b/examples/laminar/bstep2d/module.mk @@ -0,0 +1,29 @@ +# This file is part of the OpenLB library +# +# Copyright (C) 2017 Markus Mohrhard +# E-mail contact: info@openlb.net +# The most recent release of OpenLB can be downloaded at +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +current_dir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) + +include global.mk +include rules.mk +include $(addsuffix definitions.mk, $(current_dir)) + +$(eval $(call sample,$(current_dir)$(OUTPUT),$(addprefix $(current_dir), $(SRC)))) diff --git a/examples/laminar/bstep3d/Makefile b/examples/laminar/bstep3d/Makefile new file mode 100644 index 0000000..a953954 --- /dev/null +++ b/examples/laminar/bstep3d/Makefile @@ -0,0 +1,105 @@ +# This file is part of the OpenLB library +# +# Copyright (C) 2007 Mathias Krause +# E-mail contact: info@openlb.net +# The most recent release of OpenLB can be downloaded at +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +########################################################################### +## definitions + +include definitions.mk + +include $(ROOT)/global.mk + +OBJECTS := $(foreach file, $(SRC), $(PWD)/$(file:.cpp=.o)) +DEPS := $(foreach file, $(SRC), $(PWD)/$(file:.cpp=.d)) + +########################################################################### +## all + +all : depend compile link + + +########################################################################### +## dependencies + +depend : $(DEPS) + +$(PWD)/%.d : %.cpp + @echo Create dependencies for $< + @$(SHELL) -ec '$(CXX) -M $(CXXFLAGS) $(IDIR) $< \ + | sed -e "s!$*\.o!$(PWD)\/$*\.o!1" > .tmpfile; \ + cp -f .tmpfile $@;' + +########################################################################### +## compile + +compile : $(OBJECTS) + +$(PWD)/%.o: %.cpp + @echo Compile $< + $(CXX) $(CXXFLAGS) $(IDIR) -c $< -o $@ + +########################################################################### +## clean + +clean : cleanrub cleanobj cleandep + +cleanrub: + @echo Clean rubbish files + @rm -f *~ core .tmpfile tmp/*.* $(OUTPUT) + @rm -f tmp/vtkData/*.* tmp/vtkData/data/*.* tmp/imageData/*.* tmp/gnuplotData/*.* tmp/gnuplotData/data/*.* + +cleanobj: + @echo Clean object files + @rm -f $(OBJECTS) + +cleandep: + @echo Clean dependencies files + @rm -f $(DEPS) + +cleanbuild: + @cd $(ROOT); \ + $(MAKE) cleanlib; + +########################################################################### +## update lib + +$(ROOT)/$(LIBDIR)/lib$(LIB).a : + @cd $(ROOT); \ + $(MAKE) all + +########################################################################### +## link + +link: $(OUTPUT) + +$(OUTPUT): $(OBJECTS) $(ROOT)/$(LIBDIR)/lib$(LIB).a + @echo Link $@ + $(CXX) $(foreach file, $(SRC), $(file:.cpp=.o)) $(LDFLAGS) -L$(ROOT)/$(LIBDIR) -l$(LIB) -lz -o $@ + +########################################################################### +## include dependencies + +ifneq "$(strip $(wildcard *.d))" "" + include $(foreach file,$(DEPS),$(file)) +endif + +########################################################################### +########################################################################### diff --git a/examples/laminar/bstep3d/bstep3d.cpp b/examples/laminar/bstep3d/bstep3d.cpp new file mode 100644 index 0000000..fcdb193 --- /dev/null +++ b/examples/laminar/bstep3d/bstep3d.cpp @@ -0,0 +1,327 @@ +/* Lattice Boltzmann sample, written in C++, using the OpenLB + * library + * + * Copyright (C) 2006, 2007, 2012 Jonas Latt, Mathias J. Krause + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +/* bstep3d.cpp: + * The implementation of a backward facing step. It is furthermore + * shown how to use checkpointing to save the state of the + * simulation regularly. + */ + + +#include "olb3D.h" +#ifndef OLB_PRECOMPILED // Unless precompiled version is used, +#include "olb3D.hh" // include full template code +#endif +#include +#include +#include +#include + +using namespace olb; +using namespace olb::descriptors; +using namespace olb::graphics; +using namespace std; + +typedef double T; +#define DESCRIPTOR D3Q19<> + + +// Parameters for the simulation setup +const T lx1 = 5.0; // length of step +const T ly1 = 0.75; // height of step +const T lx0 = 18.0; // length of channel +const T ly0 = 1.5; // height of channel +const T lz0 = 1.5; // width of channel +const int N = 20; // resolution of the model +const int M = 25; // resolution of the model +const T maxPhysT = 40.; // max. simulation time in s, SI unit + + +// Stores geometry information in form of material numbers +void prepareGeometry( UnitConverter const& converter, + SuperGeometry3D& superGeometry ) +{ + + OstreamManager clout( std::cout,"prepareGeometry" ); + clout << "Prepare Geometry ..." << std::endl; + + superGeometry.rename( 0,2 ); + + superGeometry.rename( 2,1,1,1,1 ); + + Vector extend( lx1, ly1, lz0 ); + Vector origin; + IndicatorCuboid3D cuboid2( extend, origin ); + + superGeometry.rename( 1,2,cuboid2 ); + + // Set material number for inflow + extend = {2*converter.getConversionFactorLength(), ly0, lz0}; + origin[0] -= converter.getConversionFactorLength()/2.; + IndicatorCuboid3D inflow( extend, origin ); + superGeometry.rename( 2,3,1,inflow ); + + // Set material number for outflow + origin[0] = lx0 - converter.getConversionFactorLength()*1.5; + IndicatorCuboid3D outflow( extend, origin ); + superGeometry.rename( 2,4,1,outflow ); + + // Removes all not needed boundary voxels outside the surface + superGeometry.clean(); + // Removes all not needed boundary voxels inside the surface + superGeometry.innerClean(); + superGeometry.checkForErrors(); + + superGeometry.print(); + + clout << "Prepare Geometry ... OK" << std::endl; +} + +// Set up the geometry of the simulation +void prepareLattice( UnitConverter const& converter, + SuperLattice3D& sLattice, + Dynamics& bulkDynamics, + sOnLatticeBoundaryCondition3D& bc, + SuperGeometry3D& superGeometry ) +{ + + OstreamManager clout( std::cout,"prepareLattice" ); + clout << "Prepare Lattice ..." << endl; + + const T omega = converter.getLatticeRelaxationFrequency(); + + // Material=0 -->do nothing + sLattice.defineDynamics( superGeometry, 0, &instances::getNoDynamics() ); + + // Material=1 -->bulk dynamics + // Material=3 -->bulk dynamics (inflow) + // Material=4 -->bulk dynamics (outflow) + auto bulkIndicator = superGeometry.getMaterialIndicator({1, 3, 4}); + sLattice.defineDynamics( bulkIndicator, &bulkDynamics ); + + // Material=2 -->bounce back + sLattice.defineDynamics( superGeometry, 2, &instances::getBounceBack() ); + + // Setting of the boundary conditions + bc.addVelocityBoundary( superGeometry, 3, omega ); + bc.addPressureBoundary( superGeometry, 4, omega ); + + // Initial conditions + AnalyticalConst3D ux( 0. ); + AnalyticalConst3D uy( 0. ); + AnalyticalConst3D uz( 0. ); + AnalyticalConst3D rho( 1. ); + AnalyticalComposed3D u( ux,uy,uz ); + + //Initialize all values of distribution functions to their local equilibrium + sLattice.defineRhoU( bulkIndicator, rho, u ); + sLattice.iniEquilibrium( bulkIndicator, rho, u ); + + // Make the lattice ready for simulation + sLattice.initialize(); + + clout << "Prepare Lattice ... OK" << std::endl; +} + +// Generates a slowly increasing inflow for the first iTMaxStart timesteps +void setBoundaryValues( UnitConverter const& converter, + SuperLattice3D& sLattice, int iT, + SuperGeometry3D& superGeometry ) +{ + + OstreamManager clout( std::cout,"setBoundaryValues" ); + + // No of time steps for smooth start-up + int iTmaxStart = converter.getLatticeTime( maxPhysT*0.2 ); + int iTupdate = 5; + + if ( iT%iTupdate==0 && iT<= iTmaxStart ) { + // Smooth start curve, sinus + // SinusStartScale StartScale(iTmaxStart, T(1)); + + // Smooth start curve, polynomial + PolynomialStartScale startScale( iTmaxStart, T( 1 ) ); + + // Creates and sets the Poiseuille inflow profile using functors + int iTvec[1]= {iT}; + T frac[1]= {}; + startScale( frac,iTvec ); + std::vector maxVelocity( 3,0 ); + maxVelocity[0] = 2.25*frac[0]*converter.getCharLatticeVelocity(); + + T distance2Wall = converter.getConversionFactorLength()/2.; + RectanglePoiseuille3D poiseuilleU( superGeometry, 3, maxVelocity, distance2Wall, distance2Wall, distance2Wall ); + sLattice.defineU( superGeometry, 3, poiseuilleU ); + + clout << "step=" << iT << "; maxVel=" << maxVelocity[0] << std::endl; + } +} + +// Output to console and files +void getResults( SuperLattice3D& sLattice, + UnitConverter const& converter, + BlockReduction3D2D& planeReduction, + int iT, + SuperGeometry3D& superGeometry, Timer& timer) +{ + OstreamManager clout( std::cout,"getResults" ); + + SuperVTMwriter3D vtmWriter( "bstep3d" ); + SuperLatticePhysVelocity3D velocity( sLattice, converter ); + SuperLatticePhysPressure3D pressure( sLattice, converter ); + vtmWriter.addFunctor( velocity ); + vtmWriter.addFunctor( pressure ); + + const int vtkIter = converter.getLatticeTime( 0.2 ); + const int statIter = converter.getLatticeTime( 0.1 ); + const int saveIter = converter.getLatticeTime( 1. ); + + if ( iT==0 ) { + // Writes the geometry, cuboid no. and rank no. as vti file for visualization + SuperLatticeGeometry3D geometry( sLattice, superGeometry ); + SuperLatticeCuboid3D cuboid( sLattice ); + SuperLatticeRank3D rank( sLattice ); + vtmWriter.write( geometry ); + vtmWriter.write( cuboid ); + vtmWriter.write( rank ); + vtmWriter.createMasterFile(); + } + + // Writes the ppm files + if ( iT%vtkIter==0 ) { + vtmWriter.write( iT ); + planeReduction.update(); + // write output as JPEG + heatmap::write(planeReduction, iT); + } + + // Writes output on the console + if ( iT%statIter==0 && iT>=0 ) { + // Timer console output + timer.update( iT ); + timer.printStep(); + + // Lattice statistics console output + sLattice.getStatistics().print( iT,converter.getPhysTime( iT ) ); + } + + // Saves lattice data + if ( iT%( saveIter/2 )==0 && iT>0 ) { + clout << "Checkpointing the system at t=" << iT << endl; + sLattice.save( "bstep3d.checkpoint" ); + // The data can be reloaded using + // sLattice.load("bstep3d.checkpoint"); + } +} + +int main( int argc, char* argv[] ) +{ + + // === 1st Step: Initialization === + olbInit( &argc, &argv ); + singleton::directories().setOutputDir( "./tmp/" ); + OstreamManager clout( std::cout,"main" ); + // display messages from every single mpi process + //clout.setMultiOutput(true); + + UnitConverter converter( + (T) 1./N, // physDeltaX: spacing between two lattice cells in __m__ + (T) 1./(M*N), // physDeltaT: time step in __s__ + (T) 1., // charPhysLength: reference length of simulation geometry + (T) 1., // charPhysVelocity: maximal/highest expected velocity during simulation in __m / s__ + (T) 1./100., // physViscosity: physical kinematic viscosity in __m^2 / s__ + (T) 1. // physDensity: physical density in __kg / m^3__ + ); + + // Prints the converter log as console output + converter.print(); + // Writes the converter log in a file + converter.write("bstep3d"); + + // === 2nd Step: Prepare Geometry === + Vector extend( lx0, ly0, lz0 ); + Vector origin; + IndicatorCuboid3D cuboid( extend, origin ); + + // Instantiation of a cuboidGeometry with weights +#ifdef PARALLEL_MODE_MPI + const int noOfCuboids = singleton::mpi().getSize(); +#else + const int noOfCuboids = 7; +#endif + CuboidGeometry3D cuboidGeometry( cuboid, converter.getConversionFactorLength(), noOfCuboids ); + + // Instantiation of a loadBalancer + HeuristicLoadBalancer loadBalancer( cuboidGeometry ); + + // Instantiation of a superGeometry + SuperGeometry3D superGeometry( cuboidGeometry, loadBalancer, 2 ); + + prepareGeometry( converter, superGeometry ); + + // === 3rd Step: Prepare Lattice === + SuperLattice3D sLattice( superGeometry ); + + BGKdynamics bulkDynamics ( + converter.getLatticeRelaxationFrequency(), + instances::getBulkMomenta() + ); + + // choose between local and non-local boundary condition + sOnLatticeBoundaryCondition3D sBoundaryCondition( sLattice ); + // createInterpBoundaryCondition3D(sBoundaryCondition); + createLocalBoundaryCondition3D( sBoundaryCondition ); + + prepareLattice( converter, sLattice, bulkDynamics, sBoundaryCondition, superGeometry ); + + // === 4th Step: Main Loop with Timer === + clout << "starting simulation..." << endl; + Timer timer( converter.getLatticeTime( maxPhysT ), superGeometry.getStatistics().getNvoxel() ); + timer.start(); + + // Set up persistent measuring functors for result extraction + SuperLatticePhysVelocity3D velocity( sLattice, converter ); + SuperEuklidNorm3D normVel( velocity ); + + BlockReduction3D2D planeReduction( + normVel, + Hyperplane3D().centeredIn(cuboidGeometry.getMotherCuboid()).normalTo({0,0,1}), + 600, + BlockDataSyncMode::ReduceOnly); + + for ( int iT = 0; iT < converter.getLatticeTime( maxPhysT ); ++iT ) { + + // === 5th Step: Definition of Initial and Boundary Conditions === + setBoundaryValues( converter, sLattice, iT, superGeometry ); + + // === 6th Step: Collide and Stream Execution === + sLattice.collideAndStream(); + + // === 7th Step: Computation and Output of the Results === + getResults( sLattice, converter, planeReduction, iT, superGeometry, timer ); + } + + timer.stop(); + timer.printSummary(); +} diff --git a/examples/laminar/bstep3d/definitions.mk b/examples/laminar/bstep3d/definitions.mk new file mode 100644 index 0000000..9fc7860 --- /dev/null +++ b/examples/laminar/bstep3d/definitions.mk @@ -0,0 +1,30 @@ +# This file is part of the OpenLB library +# +# Copyright (C) 2007 Mathias Krause +# E-mail contact: info@openlb.net +# The most recent release of OpenLB can be downloaded at +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + + +########################################################################### +########################################################################### +## DEFINITIONS TO BE CHANGED + +ROOT := ../../.. +SRC := bstep3d.cpp +OUTPUT := bstep3d diff --git a/examples/laminar/bstep3d/module.mk b/examples/laminar/bstep3d/module.mk new file mode 100644 index 0000000..1190482 --- /dev/null +++ b/examples/laminar/bstep3d/module.mk @@ -0,0 +1,29 @@ +# This file is part of the OpenLB library +# +# Copyright (C) 2017 Markus Mohrhard +# E-mail contact: info@openlb.net +# The most recent release of OpenLB can be downloaded at +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +current_dir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) + +include global.mk +include rules.mk +include $(addsuffix definitions.mk, $(current_dir)) + +$(eval $(call sample,$(current_dir)$(OUTPUT),$(addprefix $(current_dir), $(SRC)))) diff --git a/examples/laminar/cavity2d/parallel/Makefile b/examples/laminar/cavity2d/parallel/Makefile new file mode 100644 index 0000000..a953954 --- /dev/null +++ b/examples/laminar/cavity2d/parallel/Makefile @@ -0,0 +1,105 @@ +# This file is part of the OpenLB library +# +# Copyright (C) 2007 Mathias Krause +# E-mail contact: info@openlb.net +# The most recent release of OpenLB can be downloaded at +# +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +########################################################################### +## definitions + +include definitions.mk + +include $(ROOT)/global.mk + +OBJECTS := $(foreach file, $(SRC), $(PWD)/$(file:.cpp=.o)) +DEPS := $(foreach file, $(SRC), $(PWD)/$(file:.cpp=.d)) + +########################################################################### +## all + +all : depend compile link + + +########################################################################### +## dependencies + +depend : $(DEPS) + +$(PWD)/%.d : %.cpp + @echo Create dependencies for $< + @$(SHELL) -ec '$(CXX) -M $(CXXFLAGS) $(IDIR) $< \ + | sed -e "s!$*\.o!$(PWD)\/$*\.o!1" > .tmpfile; \ + cp -f .tmpfile $@;' + +########################################################################### +## compile + +compile : $(OBJECTS) + +$(PWD)/%.o: %.cpp + @echo Compile $< + $(CXX) $(CXXFLAGS) $(IDIR) -c $< -o $@ + +########################################################################### +## clean + +clean : cleanrub cleanobj cleandep + +cleanrub: + @echo Clean rubbish files + @rm -f *~ core .tmpfile tmp/*.* $(OUTPUT) + @rm -f tmp/vtkData/*.* tmp/vtkData/data/*.* tmp/imageData/*.* tmp/gnuplotData/*.* tmp/gnuplotData/data/*.* + +cleanobj: + @echo Clean object files + @rm -f $(OBJECTS) + +cleandep: + @echo Clean dependencies files + @rm -f $(DEPS) + +cleanbuild: + @cd $(ROOT); \ + $(MAKE) cleanlib; + +########################################################################### +## update lib + +$(ROOT)/$(LIBDIR)/lib$(LIB).a : + @cd $(ROOT); \ + $(MAKE) all + +########################################################################### +## link + +link: $(OUTPUT) + +$(OUTPUT): $(OBJECTS) $(ROOT)/$(LIBDIR)/lib$(LIB).a + @echo Link $@ + $(CXX) $(foreach file, $(SRC), $(file:.cpp=.o)) $(LDFLAGS) -L$(ROOT)/$(LIBDIR) -l$(LIB) -lz -o $@ + +########################################################################### +## include dependencies + +ifneq "$(strip $(wildcard *.d))" "" + include $(foreach file,$(DEPS),$(file)) +endif + +########################################################################### +########################################################################### diff --git a/examples/laminar/cavity2d/parallel/cavity2d.cpp b/examples/laminar/cavity2d/parallel/cavity2d.cpp new file mode 100644 index 0000000..9fcc143 --- /dev/null +++ b/examples/laminar/cavity2d/parallel/cavity2d.cpp @@ -0,0 +1,324 @@ +/* Lattice Boltzmann sample, written in C++, using the OpenLB + * library + * + * Copyright (C) 2006 - 2012 Mathias J. Krause, Jonas Fietz, + * Jonas Latt, Jonas Kratzke + * E-mail contact: info@openlb.net + * The most recent release of OpenLB can be downloaded at + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +/* cavity2d.cpp: + * This example illustrates a flow in a cuboid, lid-driven cavity. + * It also shows how to use the XML parameter files and has an + * example description file for OpenGPI. This version is for parallel + * use. A version for sequential use is also available. + */ + + +#include "olb2D.h" +#ifndef OLB_PRECOMPILED // Unless precompiled version is used, +#include "olb2D.hh" // include full template code +#endif +#include +#include +#include + +using namespace olb; +using namespace olb::descriptors; +using namespace olb::graphics; +using namespace olb::util; +using namespace std; + +typedef double T; +#define DESCRIPTOR D2Q9<> + +void prepareGeometry( UnitConverter const& converter, + SuperGeometry2D& superGeometry ) { + OstreamManager clout( std::cout,"prepareGeometry" ); + clout << "Prepare Geometry ..." << std::endl; + + + superGeometry.rename( 0,2 ); + superGeometry.rename( 2,1,1,1 ); + superGeometry.clean(); + + T eps = converter.getConversionFactorLength(); + Vector extend( T( 1 ) + 2*eps, 2*eps ); + Vector origin( T() - eps, T( 1 ) - eps ); + IndicatorCuboid2D lid( extend, origin ); + // Set material number for lid + superGeometry.rename( 2,3,1,lid ); + + // Removes all not needed boundary voxels outside the surface + superGeometry.clean(); + // Removes all not needed boundary voxels inside the surface + superGeometry.innerClean(); + superGeometry.checkForErrors(); + superGeometry.getStatistics().print(); + clout << "Prepare Geometry ... OK" << std::endl; +} + +void prepareLattice( UnitConverter const& converter, + SuperLattice2D& sLattice, + Dynamics& bulkDynamics, + sOnLatticeBoundaryCondition2D& sBoundaryCondition, + SuperGeometry2D& superGeometry ) { + + OstreamManager clout( std::cout,"prepareLattice" ); + clout << "Prepare Lattice ..." << std::endl; + + const T omega = converter.getLatticeRelaxationFrequency(); + + // link lattic