From d370dac2b095ae89db18bea8378e852004842a90 Mon Sep 17 00:00:00 2001 From: Christian Godenschwager <christian.godenschwager@fau.de> Date: Mon, 27 Aug 2018 14:08:26 +0200 Subject: [PATCH] Use _r for all real_t literals --- .../ComplexGeometry/ComplexGeometry.cpp | 4 +- apps/benchmarks/CouetteFlow/CouetteFlow.cpp | 48 +- .../ForcesOnSphereNearPlaneInShearFlow.cpp | 98 +-- .../MotionSingleHeavySphere.cpp | 132 ++-- .../NonUniformGrid/NonUniformGrid.cpp | 18 +- .../PoiseuilleChannel/PoiseuilleChannel.cpp | 90 +-- .../SchaeferTurek/SchaeferTurek.cpp | 174 ++--- apps/benchmarks/UniformGrid/UniformGrid.cpp | 18 +- .../BidisperseFluidizedBedDPM.cpp | 130 ++-- apps/tools/povrayFileCompressor/main.cpp | 11 +- apps/tutorials/cuda/01_GameOfLife_cuda.cpp | 2 +- apps/tutorials/lbm/01_BasicLBM.cpp | 2 +- .../lbm/02_BasicLBM_ExemplaryExtensions.cpp | 2 +- apps/tutorials/pe/01_ConfinedGas.cpp | 2 +- apps/tutorials/pe/02_ConfinedGasExtended.cpp | 2 +- src/blockforest/BlockForestEvaluation.cpp | 2 +- src/blockforest/GlobalLoadBalancing.h | 4 +- src/blockforest/Initialization.cpp | 2 +- src/blockforest/SetupBlockForest.cpp | 26 +- src/blockforest/SetupBlockForest.h | 2 +- .../loadbalancing/DynamicParMetis.h | 2 +- src/core/EndianIndependentSerialization.h | 6 +- src/core/math/DistributedSample.cpp | 24 +- src/core/math/DistributedSample.h | 4 +- src/core/math/Plane.h | 2 +- src/core/math/Quaternion.h | 4 +- src/core/math/Random.h | 2 +- src/core/math/Sample.cpp | 6 +- src/core/math/Utility.h | 2 +- src/core/timing/Time.h | 2 +- .../MapPointToPeriodicDomain.cpp | 12 +- .../PeriodicIntersectionVolume.cpp | 2 +- src/field/AccuracyEvaluation.h | 14 +- src/field/AccuracyEvaluationLinePlot.h | 6 +- src/field/MassEvaluation.h | 6 +- src/field/VolumetricFlowRateEvaluation.h | 16 +- src/field/blockforest/GradientRefinement.h | 4 +- src/field/distributors/KernelDistributor.h | 14 +- .../interpolators/KernelFieldInterpolator.h | 54 +- .../NearestNeighborInterpolator.h | 6 +- .../TrilinearFieldInterpolator.h | 2 +- .../interpolators/TrilinearInterpolator.h | 2 +- src/geometry/GeometricalFunctions.cpp | 24 +- src/geometry/bodies/AABBBody.h | 4 +- src/geometry/bodies/BodyFromConfig.cpp | 4 +- .../bodies/BodyOverlapFunctions.impl.h | 34 +- src/geometry/bodies/Cylinder.cpp | 6 +- src/geometry/bodies/Ellipsoid.cpp | 12 +- src/geometry/bodies/Sphere.cpp | 4 +- src/geometry/bodies/Torus.cpp | 6 +- .../initializer/BoundaryFromBody.impl.h | 2 +- .../initializer/OverlapFieldFromBody.cpp | 4 +- .../initializer/OverlapFieldFromBody.h | 6 +- .../initializer/ScalarFieldFromBody.impl.h | 4 +- src/geometry/mesh/TriangleMesh.cpp | 2 +- src/geometry/mesh/TriangleMesh.h | 2 +- src/geometry/structured/GrayScaleImage.cpp | 4 +- src/geometry/structured/RGBAImage.cpp | 4 +- src/lbm/BlockForestEvaluation.h | 4 +- src/lbm/blockforest/PostProcessing.h | 16 +- src/lbm/boundary/DiffusionDirichlet.h | 4 +- src/lbm/boundary/DynamicUBB.h | 4 +- src/lbm/boundary/ParserUBB.h | 4 +- src/lbm/boundary/Pressure.h | 2 +- src/lbm/boundary/SimpleDiffusionDirichlet.h | 8 +- src/lbm/boundary/SimplePAB.h | 20 +- src/lbm/boundary/SimplePressure.h | 2 +- src/lbm/boundary/SimpleUBB.h | 2 +- src/lbm/boundary/SimpleVelocityBoundary.h | 4 +- src/lbm/boundary/UBB.h | 2 +- src/lbm/boundary/VelocityBoundary.h | 6 +- src/lbm/cumulant/CellwiseSweep.impl.h | 618 ++++++++-------- src/lbm/evaluations/Permeability.h | 4 +- src/lbm/evaluations/Permeability.impl.h | 10 +- src/lbm/field/AddToStorage.h | 8 +- src/lbm/field/Density.h | 8 +- src/lbm/field/DensityAndMomentumDensity.h | 8 +- src/lbm/field/DensityAndVelocity.h | 24 +- src/lbm/field/DensityVelocityCallback.h | 40 +- src/lbm/field/Equilibrium.h | 172 ++--- src/lbm/field/MacroscopicValueCalculation.h | 12 +- src/lbm/field/MomentumDensity.h | 16 +- src/lbm/field/PdfField.h | 26 +- src/lbm/field/ShearRate.h | 14 +- src/lbm/geometry/IntersectionRatio.h | 2 +- .../initializer/PoiseuilleInitializer.impl.h | 16 +- src/lbm/lattice_model/CollisionModel.cpp | 4 +- src/lbm/lattice_model/CollisionModel.h | 70 +- src/lbm/lattice_model/D2Q9.h | 34 +- src/lbm/lattice_model/D3Q15.h | 52 +- src/lbm/lattice_model/D3Q19.h | 80 +-- src/lbm/lattice_model/D3Q27.h | 92 +-- .../lattice_model/EquilibriumDistribution.h | 74 +- src/lbm/lattice_model/ForceModel.h | 42 +- src/lbm/lattice_model/SmagorinskyLES.h | 14 +- src/lbm/mrt/CellwiseSweep.impl.h | 132 ++-- src/lbm/python/ExportBasic.cpp | 2 +- src/lbm/python/ExportBasic.impl.h | 2 +- src/lbm/refinement/LinearExplosion.h | 8 +- src/lbm/srt/CellwiseSweep.impl.h | 664 +++++++++--------- src/lbm/srt/SplitPureSweep.impl.h | 48 +- src/lbm/srt/SplitSweep.impl.h | 208 +++--- src/lbm/srt/bluegeneq/SplitPureSweep.impl.h | 48 +- .../AdvectionDiffusionCellOperation.impl.h | 16 +- .../DefaultCellOperation.impl.h | 124 ++-- src/lbm/sweeps/CellwiseSweep.h | 6 +- src/lbm/trt/CellwiseSweep.impl.h | 556 +++++++-------- src/lbm/trt/SplitPureSweep.impl.h | 232 +++--- src/lbm/trt/SplitSweep.impl.h | 232 +++--- src/lbm/trt/bluegeneq/SplitPureSweep.impl.h | 232 +++--- .../DefaultCellOperation.impl.h | 102 +-- src/mesh/DistanceComputations.h | 10 +- .../blockforest/BlockForestInitialization.cpp | 28 +- src/mesh/boundary/BoundarySetup.cpp | 6 +- src/mesh/pe/raytracing/Intersects.h | 8 +- src/mesh/pe/rigid_body/ConvexPolyhedron.cpp | 20 +- src/mesh/pe/tesselation/Box.h | 2 +- src/pde/ConditionalResidualNorm.h | 4 +- src/pde/ResidualNorm.h | 4 +- src/pde/ResidualNormStencilField.h | 4 +- src/pde/boundary/Neumann.h | 10 +- src/pde/iterations/CGFixedStencilIteration.h | 10 +- src/pde/iterations/CGIteration.h | 10 +- src/pde/iterations/JacobiIteration.cpp | 2 +- src/pde/iterations/JacobiIteration.h | 2 +- src/pde/iterations/RBGSIteration.cpp | 2 +- src/pde/iterations/RBGSIteration.h | 2 +- src/pde/iterations/VCycles.h | 4 +- src/pde/iterations/VCycles.impl.h | 44 +- src/pde/sweeps/JacobiFixedStencil.h | 2 +- src/pde/sweeps/Multigrid.h | 4 +- src/pde/sweeps/Multigrid.impl.h | 18 +- src/pde/sweeps/RBGS.h | 2 +- src/pde/sweeps/RBGSFixedStencil.h | 4 +- src/pde/sweeps/SOR.h | 4 +- src/pde/sweeps/SORFixedStencil.h | 6 +- .../MetisAssignmentFunctor.h | 2 +- .../WeightAssignmentFunctor.h | 4 +- src/pe/ccd/HashGrids.h | 8 +- src/pe/collision/EPA.cpp | 4 +- src/pe/collision/EPA.h | 10 +- src/pe/collision/GJK.cpp | 20 +- src/pe/collision/GJK.h | 6 +- src/pe/contact/ContactFunctions.impl.h | 2 +- src/pe/cr/HCSITS.h | 2 +- src/pe/cr/HCSITS.impl.h | 6 +- src/pe/fcd/AnalyticCollisionDetection.h | 128 ++-- src/pe/fcd/GJKEPACollideFunctor.h | 4 +- src/pe/raytracing/Color.cpp | 26 +- src/pe/raytracing/Color.h | 6 +- src/pe/raytracing/Intersects.h | 48 +- src/pe/raytracing/Ray.h | 2 +- src/pe/raytracing/Raytracer.cpp | 8 +- src/pe/raytracing/ShadingFunctions.h | 88 +-- src/pe/raytracing/ShadingParameters.h | 4 +- src/pe/rigidbody/Box.cpp | 56 +- src/pe/rigidbody/Box.h | 10 +- src/pe/rigidbody/BoxFactory.cpp | 2 +- src/pe/rigidbody/Capsule.cpp | 8 +- src/pe/rigidbody/Capsule.h | 4 +- src/pe/rigidbody/CapsuleFactory.cpp | 4 +- src/pe/rigidbody/CylindricalBoundary.cpp | 2 +- src/pe/rigidbody/Ellipsoid.cpp | 4 +- src/pe/rigidbody/Ellipsoid.h | 4 +- src/pe/rigidbody/Sphere.cpp | 2 +- src/pe/rigidbody/Sphere.h | 8 +- src/pe/rigidbody/Union.h | 30 +- src/pe/rigidbody/UnionFactory.h | 2 +- src/pe/synchronization/SyncNextNeighbors.h | 2 +- src/pe/synchronization/SyncShadowOwners.h | 2 +- src/pe/utility/CreateWorld.cpp | 2 +- .../correlations/AddedMassForceCorrelations.h | 4 +- .../correlations/DragForceCorrelations.h | 86 +-- .../correlations/LiftForceCorrelations.h | 8 +- .../evaluators/AddedMassForceEvaluator.h | 8 +- .../BodyVelocityTimeDerivativeEvaluator.h | 6 +- .../EffectiveViscosityFieldEvaluator.h | 10 +- .../evaluators/InteractionForceEvaluator.h | 12 +- .../evaluators/LiftForceEvaluator.h | 8 +- .../evaluators/LubricationForceEvaluator.h | 38 +- .../evaluators/PressureFieldEvaluator.h | 2 +- .../PressureGradientFieldEvaluator.h | 2 +- .../StressTensorGradientFieldEvaluator.h | 6 +- .../evaluators/VelocityCurlFieldEvaluator.h | 6 +- .../VelocityGradientFieldEvaluator.h | 8 +- ...elocityTotalTimeDerivativeFieldEvaluator.h | 6 +- .../gns_lbm/GNSSweep.h | 28 +- .../GNSExternalForceToForceFieldAdder.h | 2 +- .../utility/GNSPressureFieldEvaluator.h | 4 +- .../gns_lbm/utility/GNSSmagorinskyLESField.h | 22 +- .../utility/GNSVelocityFieldEvaluator.h | 2 +- ...edInteractionForceFieldToForceFieldAdder.h | 2 +- .../utility/BodyVelocityInitializer.h | 4 +- .../geometry/PeBodyOverlapFunctions.h | 12 +- .../geometry/PeIntersectionRatio.cpp | 16 +- .../geometry/PeIntersectionRatio.h | 2 +- .../geometry/SphereEquivalentDiameter.h | 4 +- .../boundary/CurvedLinear.h | 8 +- .../boundary/CurvedQuadratic.h | 4 +- .../ExtrapolationDirectionFinder.h | 2 +- .../restoration/Reconstructor.h | 50 +- .../BodyAndVolumeFractionMapping.cpp | 6 +- .../BodyAndVolumeFractionMapping.h | 4 +- .../PSMSweep.h | 8 +- .../PSMUtility.h | 12 +- .../utility/ForceTorqueOnBodiesScaler.cpp | 4 +- .../utility/LubricationCorrection.cpp | 8 +- .../utility/LubricationCorrection.h | 2 +- src/pe_coupling/utility/TimeStep.h | 2 +- src/postprocessing/MarchingCubes.h | 4 +- src/postprocessing/MarchingCubes.impl.h | 6 +- src/stencil/Directions.h | 66 +- src/timeloop/PerformanceMeter.cpp | 4 +- src/vtk/VTKOutput.cpp | 24 +- src/vtk/VTKOutput.h | 2 +- tests/blockforest/BlockDataIOTest.cpp | 4 +- .../blockforest/StructuredBlockForestTest.cpp | 2 +- .../DirectionBasedReduceCommTest.cpp | 12 +- tests/core/GridGeneratorTest.cpp | 42 +- tests/core/load_balancing/MetisTest.cpp | 2 +- tests/core/load_balancing/ParMetisTest.cpp | 2 +- tests/core/math/Matrix3Test.cpp | 2 +- tests/core/math/PlaneTest.cpp | 36 +- tests/core/math/SampleTest.cpp | 6 +- tests/cuda/SimpleKernelTest.cpp | 2 +- tests/cuda/codegen/CodegenJacobiGPU.cpp | 4 +- .../MapPointToPeriodicDomain.cpp | 10 +- .../PeriodicIntersect.cpp | 12 +- .../PeriodicIntersectionVolume.cpp | 18 +- tests/fft/FftTest.cpp | 2 +- tests/fft/GreensTest.cpp | 4 +- tests/field/AccuracyEvaluationTest.cpp | 2 +- tests/field/adaptors/AdaptorTest.cpp | 2 +- tests/field/codegen/CodegenJacobiCPU.cpp | 8 +- tests/field/distributors/DistributionTest.cpp | 130 ++-- .../interpolators/FieldInterpolationTest.cpp | 138 ++-- tests/gather/CurveGatherTest.cpp | 4 +- tests/geometry/ScalarFieldFromBodyTest.cpp | 18 +- tests/geometry/Statistics.impl.h | 2 +- tests/gui/SimpleGuiRun.cpp | 4 +- tests/lbm/BoundaryHandlingCommunication.cpp | 8 +- tests/lbm/DiffusionTest.cpp | 22 +- tests/lbm/Poiseuille.cpp | 10 +- tests/lbm/SweepEquivalenceTest.cpp | 10 +- tests/lbm/boundary/DiffusionDirichlet.cpp | 24 +- .../lbm/boundary/SimpleDiffusionDirichlet.cpp | 48 +- tests/lbm/boundary/SimplePABTest.cpp | 4 +- tests/lbm/codegen/SrtWithForceField.cpp | 4 +- tests/lbm/evaluations/PermeabilityTest.cpp | 12 +- tests/lbm/geometry/IntersectionRatioTest.cpp | 4 +- .../refinement/CommunicationEquivalence.cpp | 32 +- tests/lbm/refinement/NonConstantDiffusion.cpp | 6 +- tests/lbm/refinement/Uniformity.cpp | 26 +- tests/mesh/MatrixVectorOperationsTest.cpp | 10 +- tests/mesh/MeshAABBIntersectionTest.cpp | 6 +- tests/mesh/MeshBlockExclusionTest.cpp | 2 +- tests/mesh/MeshContainmentOctreeTest.cpp | 2 +- tests/mesh/MeshDistanceCompareTest.cpp | 8 +- tests/mesh/MeshDistancePlausibilityTest.cpp | 8 +- tests/mesh/MeshInitilizationTest.cpp | 14 +- tests/mesh/MeshOperationsTest.cpp | 12 +- tests/mesh/MeshPeRaytracing.cpp | 32 +- tests/mesh/NumericIntegrationTest.cpp | 34 +- tests/mesh/PeVTKMeshWriterTest.cpp | 24 +- tests/mesh/QHullTest.cpp | 38 +- tests/pde/CGTest.cpp | 32 +- tests/pde/JacobiTest.cpp | 30 +- tests/pde/MGConvergenceTest.cpp | 28 +- tests/pde/MGTest.cpp | 34 +- tests/pde/RBGSTest.cpp | 26 +- tests/pde/SORTest.cpp | 28 +- tests/pe/BodyIterators.cpp | 8 +- tests/pe/Collision.cpp | 52 +- tests/pe/CollisionTobiasGJK.cpp | 160 ++--- tests/pe/DynamicRefinement.cpp | 2 +- tests/pe/GJK_EPA.cpp | 12 +- tests/pe/HCSITS.cpp | 98 +-- tests/pe/LoadFromConfig.cpp | 4 +- tests/pe/MinMaxRefinement.cpp | 2 +- tests/pe/ParallelEquivalence.cpp | 2 +- tests/pe/PeDocumentationSnippets.cpp | 12 +- tests/pe/Raytracing.cpp | 308 ++++---- tests/pe/RigidBody.cpp | 36 +- tests/pe/ShadowCopy.cpp | 34 +- tests/pe/SimpleCCD.cpp | 6 +- tests/pe/Union.cpp | 28 +- tests/pe/VolumeInertia.cpp | 64 +- .../HinderedSettlingDynamicsDPM.cpp | 206 +++--- .../SphereWallCollisionBehaviorDPM.cpp | 104 +-- .../geometry/PeIntersectionRatioTest.cpp | 64 +- .../BodyAtBlockBoarderCheck.cpp | 2 +- .../BodyMappingTest.cpp | 24 +- .../DragForceSphereMEM.cpp | 2 +- .../DragForceSphereMEMRefinement.cpp | 4 +- ...lobalBodyAsBoundaryMEMStaticRefinement.cpp | 20 +- .../LubricationCorrectionMEM.cpp | 34 +- .../PeriodicParticleChannelMEM.cpp | 52 +- .../SettlingSphereMEM.cpp | 82 +-- .../SettlingSphereMEMDynamicRefinement.cpp | 102 +-- .../SettlingSphereMEMStaticRefinement.cpp | 92 +-- .../momentum_exchange_method/SquirmerTest.cpp | 4 +- .../TaylorCouetteFlowMEM.cpp | 24 +- .../DragForceSpherePSM.cpp | 2 +- .../DragForceSpherePSMRefinement.cpp | 4 +- .../SegreSilberbergPSM.cpp | 6 +- .../BodiesForceTorqueContainerTest.cpp | 36 +- .../pe_coupling/utility/PeSubCyclingTest.cpp | 50 +- tests/postprocessing/SphereTriangulate.cpp | 8 +- .../python_coupling/ConfigFromPythonTest.cpp | 2 +- tests/python_coupling/FieldExportTest.cpp | 2 +- 310 files changed, 4636 insertions(+), 4633 deletions(-) diff --git a/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp b/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp index 8a18cbcc..4cf5769b 100644 --- a/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp +++ b/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp @@ -211,7 +211,7 @@ int main( int argc, char * argv[] ) meshWorkloadMemory.setOutsideCellWorkload(1); bfc.setWorkloadMemorySUIDAssignmentFunction( meshWorkloadMemory ); bfc.setPeriodicity( Vector3<bool>(true) ); - bfc.setRefinementSelectionFunction( makeRefinementSelection( distanceOctree, numLevels - uint_t(1), dx, dx * real_t(1) ) ); + bfc.setRefinementSelectionFunction( makeRefinementSelection( distanceOctree, numLevels - uint_t(1), dx, dx * 1_r ) ); auto structuredBlockforest = bfc.createStructuredBlockForest( blockSize ); @@ -225,7 +225,7 @@ int main( int argc, char * argv[] ) static const uint_t NUM_GHOSTLAYERS = 4; - BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( structuredBlockforest, "pdf field", latticeModel, Vector3<real_t>(0), real_t(1), NUM_GHOSTLAYERS, field::fzyx ); + BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( structuredBlockforest, "pdf field", latticeModel, Vector3<real_t>(0), 1_r, NUM_GHOSTLAYERS, field::fzyx ); BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( structuredBlockforest, "flag field", NUM_GHOSTLAYERS ); const FlagUID fluidFlagUID( "Fluid" ); diff --git a/apps/benchmarks/CouetteFlow/CouetteFlow.cpp b/apps/benchmarks/CouetteFlow/CouetteFlow.cpp index 84ccd95c..f9c0e3c5 100644 --- a/apps/benchmarks/CouetteFlow/CouetteFlow.cpp +++ b/apps/benchmarks/CouetteFlow/CouetteFlow.cpp @@ -307,7 +307,7 @@ static shared_ptr< SetupBlockForest > createSetupBlockForest( const blockforest: if( blocksPerProcess != 0 ) numberOfProcesses = uint_c( std::ceil( real_c( forest->getNumberOfBlocks() ) / real_c( blocksPerProcess ) ) ); - forest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, real_t(0), processMemoryLimit, true ); + forest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, 0_r, processMemoryLimit, true ); if( outputSetupForest ) { @@ -408,7 +408,7 @@ MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block ) const return new BoundaryHandling_T( "boundary handling", flagField, fluid, boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), - UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, real_t(0), real_t(0) ) ) ); + UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, 0_r, 0_r ) ) ); } @@ -570,7 +570,7 @@ real_t exactFlowRate( const real_t flowRate ) Vector3< real_t > exactVelocity( const Vector3< real_t > & p, const math::AABB & domain, const real_t maxLatticeVelocity ) { - return Vector3< real_t >( maxLatticeVelocity * ( p[1] - domain.yMin() ) / domain.ySize(), real_t(0), real_t(0) ); + return Vector3< real_t >( maxLatticeVelocity * ( p[1] - domain.yMin() ) / domain.ySize(), 0_r, 0_r ); } @@ -667,8 +667,8 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod setup.viscosity_L = latticeModel.collisionModel().viscosity( uint_t(0) ); setup.meanVelocity_L = ( setup.Re * setup.viscosity_L ) / real_c( setup.yBlocks * setup.yCells ); - setup.maxVelocity_L = real_t(2) * setup.meanVelocity_L; - setup.flowRate_L = ( setup.maxVelocity_L * real_c( setup.yBlocks * setup.yCells ) * real_c( setup.zBlocks * setup.zCells ) ) / real_t(2); + setup.maxVelocity_L = 2_r * setup.meanVelocity_L; + setup.flowRate_L = ( setup.maxVelocity_L * real_c( setup.yBlocks * setup.yCells ) * real_c( setup.zBlocks * setup.zCells ) ) / 2_r; // creating the block structure @@ -676,13 +676,13 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod // add pdf field to blocks - const real_t initVelocity = ( configBlock.getParameter< bool >( "initWithMeanVelocity", false ) ) ? setup.meanVelocity_L : real_t(0); + const real_t initVelocity = ( configBlock.getParameter< bool >( "initWithMeanVelocity", false ) ) ? setup.meanVelocity_L : 0_r; BlockDataID pdfFieldId = fzyx ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel, - Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::fzyx ) : lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::zyxf ); using VelocityAdaptor_T = typename lbm::Adaptor< LatticeModel_T >::VelocityVector; @@ -743,18 +743,18 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod flagFieldId, Fluid_Flag, std::bind( exactFlowRate, setup.flowRate_L ), exactSolutionFunction ); - volumetricFlowRate->setNormalizationFactor( real_t(1) / setup.maxVelocity_L ); - volumetricFlowRate->setDomainNormalization( Vector3<real_t>( real_t(1) ) ); + volumetricFlowRate->setNormalizationFactor( 1_r / setup.maxVelocity_L ); + volumetricFlowRate->setDomainNormalization( Vector3<real_t>( 1_r ) ); timeloop.addFuncBeforeTimeStep( makeSharedFunctor( volumetricFlowRate ), "volumetric flow rate evaluation" ); auto accuracyEvaluation = field::makeAccuracyEvaluation< VelocityAdaptor_T >( configBlock, blocks, velocityAdaptorId, exactSolutionFunction ); - accuracyEvaluation->setNormalizationFactor( real_t(1) / setup.maxVelocity_L ); + accuracyEvaluation->setNormalizationFactor( 1_r / setup.maxVelocity_L ); timeloop.addFuncBeforeTimeStep( makeSharedFunctor( accuracyEvaluation ), "accuracy evaluation" ); auto linePlot = field::makeAccuracyEvaluationLinePlot< VelocityAdaptor_T >( configBlock, blocks, velocityAdaptorId, exactSolutionFunction ); - linePlot->setNormalizationFactor( real_t(1) / setup.maxVelocity_L ); + linePlot->setNormalizationFactor( 1_r / setup.maxVelocity_L ); timeloop.addFuncBeforeTimeStep( makeSharedFunctor( field::makeAccuracyEvaluationLinePlotter( configBlock, linePlot ) ), "accuracy evaluation (line plot)" ); @@ -1024,7 +1024,7 @@ int main( int argc, char **argv ) setup.yCells = configBlock.getParameter< uint_t >( "yCells", uint_t(50) ); setup.zCells = configBlock.getParameter< uint_t >( "zCells", uint_t(10) ); - setup.Re = configBlock.getParameter< real_t >( "Re", real_t(10) ); + setup.Re = configBlock.getParameter< real_t >( "Re", 10_r ); // ... in bytes const memory_t memoryPerCell = configBlock.getParameter< memory_t >( "memoryPerCell", memory_t( 19 * 8 + 1 ) ); @@ -1047,7 +1047,7 @@ int main( int argc, char **argv ) if( !configBlock.isDefined("borderRefinementLevel") ) WALBERLA_ABORT( "You have to specify \'borderRefinementLevel\' in the \"CouetteFlow\" block of the configuration file (" << argv[1] << ")" ); - const real_t borderRefinementBuffer = configBlock.getParameter< real_t >( "borderRefinementBuffer", real_t(0) ); + const real_t borderRefinementBuffer = configBlock.getParameter< real_t >( "borderRefinementBuffer", 0_r ); BorderRefinementSelection borderRefinementSelection( setup, configBlock.getParameter< uint_t >( "borderRefinementLevel" ), borderRefinementBuffer ); @@ -1144,19 +1144,19 @@ int main( int argc, char **argv ) // executing benchmark - const real_t omega = configBlock.getParameter< real_t >( "omega", real_t(1.4) ); + const real_t omega = configBlock.getParameter< real_t >( "omega", 1.4_r ); - const real_t magicNumber = configBlock.getParameter< real_t >( "magicNumber", real_t(3) / real_t(16) ); + const real_t magicNumber = configBlock.getParameter< real_t >( "magicNumber", 3_r / 16_r ); - const real_t lambda_e = configBlock.getParameter< real_t >( "lambda_e", real_t(1.4) ); - const real_t lambda_d = configBlock.getParameter< real_t >( "lambda_d", real_t(1.4) ); + const real_t lambda_e = configBlock.getParameter< real_t >( "lambda_e", 1.4_r ); + const real_t lambda_d = configBlock.getParameter< real_t >( "lambda_d", 1.4_r ); - const real_t s1 = configBlock.getParameter< real_t >( "s1", real_t(1.4) ); - const real_t s2 = configBlock.getParameter< real_t >( "s2", real_t(1.4) ); - const real_t s4 = configBlock.getParameter< real_t >( "s4", real_t(1.4) ); - const real_t s9 = configBlock.getParameter< real_t >( "s9", real_t(1.4) ); - const real_t s10 = configBlock.getParameter< real_t >( "s10", real_t(1.4) ); - const real_t s16 = configBlock.getParameter< real_t >( "s16", real_t(1.4) ); + const real_t s1 = configBlock.getParameter< real_t >( "s1", 1.4_r ); + const real_t s2 = configBlock.getParameter< real_t >( "s2", 1.4_r ); + const real_t s4 = configBlock.getParameter< real_t >( "s4", 1.4_r ); + const real_t s9 = configBlock.getParameter< real_t >( "s9", 1.4_r ); + const real_t s10 = configBlock.getParameter< real_t >( "s10", 1.4_r ); + const real_t s16 = configBlock.getParameter< real_t >( "s16", 1.4_r ); const uint_t relaxationParametersLevel = configBlock.getParameter< uint_t >( "relaxationParametersLevel", uint_t(0) ); diff --git a/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp b/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp index de8dd9d3..724bf650 100644 --- a/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp +++ b/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp @@ -115,7 +115,7 @@ const FlagUID MO_CLI_Flag( "moving obstacle CLI" ); static void refinementSelection( SetupBlockForest& forest, uint_t levels, const AABB& refinementBox ) { - real_t dx = real_t(1); // dx on finest level + real_t dx = 1_r; // dx on finest level for( auto block = forest.begin(); block != forest.end(); ++block ) { uint_t blockLevel = block->getLevel(); @@ -172,11 +172,11 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const AABB & do // refinement area is the complete area along the bottom plane, containing the sphere // this avoids refinement borders in flow direction refinementBox = AABB(domainAABB.xMin(), domainAABB.yMin(), domainAABB.zMin(), - domainAABB.xMax(), domainAABB.yMax(), initialPosition[2] + real_t(0.5) * diameter); + domainAABB.xMax(), domainAABB.yMax(), initialPosition[2] + 0.5_r * diameter); } else{ // refinement area is just around the sphere - refinementBox = AABB(initialPosition[0] - real_t(0.5) * diameter, initialPosition[1] - real_t(0.5) * diameter, domainAABB.zMin(), - initialPosition[0] + real_t(0.5) * diameter, initialPosition[1] + real_t(0.5) * diameter, initialPosition[2] + real_t(0.5) * diameter); + refinementBox = AABB(initialPosition[0] - 0.5_r * diameter, initialPosition[1] - 0.5_r * diameter, domainAABB.zMin(), + initialPosition[0] + 0.5_r * diameter, initialPosition[1] + 0.5_r * diameter, initialPosition[2] + 0.5_r * diameter); } WALBERLA_LOG_INFO_ON_ROOT(" - refinement box: " << refinementBox); @@ -189,7 +189,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const AABB & do // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); @@ -278,8 +278,8 @@ public: void operator()() { - Vector3<real_t> force(real_t(0)); - Vector3<real_t> torque(real_t(0)); + Vector3<real_t> force(0_r); + Vector3<real_t> torque(0_r); for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { @@ -446,15 +446,15 @@ int main( int argc, char **argv ) std::string baseFolderLogging = "."; // physical setup - real_t diameter = real_t(20); // cells per diameter -> determines overall resolution - real_t normalizedWallDistance = real_t(1); // distance of the sphere center to the bottom wall, normalized by the diameter - real_t ReynoldsNumberShear = real_t(1); // = shearRate * wallDistance * diameter / viscosity + real_t diameter = 20_r; // cells per diameter -> determines overall resolution + real_t normalizedWallDistance = 1_r; // distance of the sphere center to the bottom wall, normalized by the diameter + real_t ReynoldsNumberShear = 1_r; // = shearRate * wallDistance * diameter / viscosity //numerical parameters - real_t minimumNonDimTimesteps = real_t(100); // minimum number of non-dimensional time steps before simulation can be terminated by convergence + real_t minimumNonDimTimesteps = 100_r; // minimum number of non-dimensional time steps before simulation can be terminated by convergence uint_t numberOfLevels = uint_t(4); // number of grid levels for static refinement ( 1 = no refinement) - real_t xOffsetOfSpherePosition = real_t(0); // offset in x-direction of sphere position - real_t yOffsetOfSpherePosition = real_t(0); // offset in y-direction of sphere position + real_t xOffsetOfSpherePosition = 0_r; // offset in x-direction of sphere position + real_t yOffsetOfSpherePosition = 0_r; // offset in y-direction of sphere position bool useSBB = false; // use simple bounce-back boundary condition for sphere bool useLargeRefinementRegion = false; // uses the whole area near the bottom plane as the finest grid, else refinement is only applied around the sphere @@ -479,41 +479,41 @@ int main( int argc, char **argv ) WALBERLA_ABORT("Unrecognized command line argument found: " << argv[i]); } - WALBERLA_CHECK_GREATER_EQUAL(normalizedWallDistance, real_t(0.5)); - WALBERLA_CHECK_GREATER_EQUAL(ReynoldsNumberShear, real_t(0)); - WALBERLA_CHECK_GREATER_EQUAL(diameter, real_t(0)); + WALBERLA_CHECK_GREATER_EQUAL(normalizedWallDistance, 0.5_r); + WALBERLA_CHECK_GREATER_EQUAL(ReynoldsNumberShear, 0_r); + WALBERLA_CHECK_GREATER_EQUAL(diameter, 0_r); ////////////////////////// // NUMERICAL PARAMETERS // ////////////////////////// - const real_t domainLength = real_t(48) * diameter; //x - const real_t domainWidth = real_t(16) * diameter; //y + const real_t domainLength = 48_r * diameter; //x + const real_t domainWidth = 16_r * diameter; //y const real_t domainHeight = real_t( 8) * diameter; //z Vector3<uint_t> domainSize( uint_c( std::ceil(domainLength)), uint_c( std::ceil(domainWidth)), uint_c( std::ceil(domainHeight)) ); - real_t wallVelocity = real_t(0.01); - if( zeroShearTest ) wallVelocity = real_t(0); + real_t wallVelocity = 0.01_r; + if( zeroShearTest ) wallVelocity = 0_r; const real_t wallDistance = diameter * normalizedWallDistance; const real_t shearRate = wallVelocity / domainHeight; const real_t velAtSpherePosition = shearRate * wallDistance; - const real_t viscosity = ( zeroShearTest ) ? real_t(0.015) : ( velAtSpherePosition * diameter / ReynoldsNumberShear ); + const real_t viscosity = ( zeroShearTest ) ? 0.015_r : ( velAtSpherePosition * diameter / ReynoldsNumberShear ); - const real_t relaxationTime = real_t(1) / lbm::collision_model::omegaFromViscosity(viscosity); + const real_t relaxationTime = 1_r / lbm::collision_model::omegaFromViscosity(viscosity); - const real_t densityFluid = real_t(1); + const real_t densityFluid = 1_r; - const real_t dx = real_t(1); + const real_t dx = 1_r; - const real_t physicalTimeScale = ( zeroShearTest ) ? real_t(10) : (diameter / velAtSpherePosition); + const real_t physicalTimeScale = ( zeroShearTest ) ? 10_r : (diameter / velAtSpherePosition); const uint_t minimumLBMtimesteps = uint_c(minimumNonDimTimesteps * physicalTimeScale); - const real_t omega = real_t(1) / relaxationTime; + const real_t omega = 1_r / relaxationTime; const uint_t finestLevel = numberOfLevels - uint_t(1); - Vector3<real_t> initialPosition( domainLength * real_t(0.5) + xOffsetOfSpherePosition, - domainWidth * real_t(0.5) + yOffsetOfSpherePosition, + Vector3<real_t> initialPosition( domainLength * 0.5_r + xOffsetOfSpherePosition, + domainWidth * 0.5_r + yOffsetOfSpherePosition, wallDistance ); WALBERLA_LOG_INFO_ON_ROOT("Setup:"); @@ -556,7 +556,7 @@ int main( int argc, char **argv ) domainSize[1] / ( coarseBlocksPerDirection[1] * levelScalingFactor ), domainSize[2] / ( coarseBlocksPerDirection[2] * levelScalingFactor ) ); - AABB simulationDomain( real_t(0), real_t(0), real_t(0), real_c(domainSize[0]), real_c(domainSize[1]), real_c(domainSize[2]) ); + AABB simulationDomain( 0_r, 0_r, 0_r, real_c(domainSize[0]), real_c(domainSize[1]), real_c(domainSize[2]) ); auto blocks = createBlockStructure( simulationDomain, blockSizeInCells, numberOfLevels, diameter, initialPosition, useLargeRefinementRegion ); //write domain decomposition to file @@ -583,13 +583,13 @@ int main( int argc, char **argv ) // create pe bodies // bounding planes (global) - const auto planeMaterial = pe::createMaterial( "myPlaneMat", real_t(8920), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(0) ); + const auto planeMaterial = pe::createMaterial( "myPlaneMat", 8920_r, 0_r, 1_r, 1_r, 0_r, 1_r, 1_r, 0_r, 0_r ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,0,1), Vector3<real_t>(0,0,0), planeMaterial ); auto topPlane = pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,0,-1), Vector3<real_t>(0,0,domainHeight), planeMaterial ); - topPlane->setLinearVel(wallVelocity, real_t(0), real_t(0)); + topPlane->setLinearVel(wallVelocity, 0_r, 0_r); // add the sphere - pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, initialPosition, real_t(0.5) * diameter, planeMaterial ); + pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, initialPosition, 0.5_r * diameter, planeMaterial ); uint_t minBlockSizeInCells = blockSizeInCells.min(); for( uint_t i = 0; i < uint_c(diameter / real_c(minBlockSizeInCells)) + 1; ++i) @@ -604,7 +604,7 @@ int main( int argc, char **argv ) // add PDF field BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( real_t(0) ), real_t(1), + Vector3< real_t >( 0_r ), 1_r, FieldGhostLayers, field::zyxf ); // add flag field BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); @@ -669,12 +669,12 @@ int main( int argc, char **argv ) auto refinementTimestep = lbm::refinement::makeTimeStep< LatticeModel_T, BoundaryHandling_T >( blocks, sweep, pdfFieldID, boundaryHandlingID ); // add force evaluation and logging - real_t normalizationFactor = ( zeroShearTest ) ? real_t(1) : ( math::M_PI / real_t(8) * densityFluid * shearRate * shearRate * wallDistance * wallDistance * diameter * diameter ); + real_t normalizationFactor = ( zeroShearTest ) ? 1_r : ( math::M_PI / 8_r * densityFluid * shearRate * shearRate * wallDistance * wallDistance * diameter * diameter ); std::string loggingFileName( baseFolderLogging + "/LoggingForcesNearPlane"); loggingFileName += "_lvl" + std::to_string(numberOfLevels); loggingFileName += "_D" + std::to_string(uint_c(diameter)); loggingFileName += "_Re" + std::to_string(uint_c(ReynoldsNumberShear)); - loggingFileName += "_WD" + std::to_string(uint_c(normalizedWallDistance * real_t(1000))); + loggingFileName += "_WD" + std::to_string(uint_c(normalizedWallDistance * 1000_r)); loggingFileName += ".txt"; shared_ptr< SpherePropertyLogger > logger = walberla::make_shared< SpherePropertyLogger >( blocks, bodyStorageID, loggingFileName, fileIO, @@ -693,22 +693,22 @@ int main( int argc, char **argv ) // compute reference values from literature - const real_t normalizedGapSize = normalizedWallDistance - real_t(0.5); + const real_t normalizedGapSize = normalizedWallDistance - 0.5_r; // drag correlation for the drag coefficient - const real_t standardDragCorrelation = real_t(24) / ReynoldsNumberShear * (real_t(1) + real_t(0.15) * std::pow(ReynoldsNumberShear, real_t(0.687))); // Schiller-Naumann correlation - const real_t dragCorrelationWithGapSizeStokes = real_t(24) / ReynoldsNumberShear * (real_t(1) + real_t(0.138) * std::exp(real_t(-2) * normalizedGapSize) + real_t(9)/( real_t(16) * (real_t(1) + real_t(2) * normalizedGapSize) ) ); // Goldman et al. (1967) - const real_t alphaDragS = real_t(0.15) - real_t(0.046) * ( real_t(1) - real_t(0.16) * normalizedGapSize * normalizedGapSize ) * std::exp( -real_t(0.7) * normalizedGapSize); - const real_t betaDragS = real_t(0.687) + real_t(0.066)*(real_t(1) - real_t(0.76) * normalizedGapSize * normalizedGapSize) * std::exp( - std::pow( normalizedGapSize, real_t(0.9) ) ); - const real_t dragCorrelationZeng = dragCorrelationWithGapSizeStokes * ( real_t(1) + alphaDragS * std::pow( ReynoldsNumberShear, betaDragS ) ); // Zeng et al. (2009) - Eqs. (13) and (14) + const real_t standardDragCorrelation = 24_r / ReynoldsNumberShear * (1_r + 0.15_r * std::pow(ReynoldsNumberShear, 0.687_r)); // Schiller-Naumann correlation + const real_t dragCorrelationWithGapSizeStokes = 24_r / ReynoldsNumberShear * (1_r + 0.138_r * std::exp(-2_r * normalizedGapSize) + 9_r/( 16_r * (1_r + 2_r * normalizedGapSize) ) ); // Goldman et al. (1967) + const real_t alphaDragS = 0.15_r - 0.046_r * ( 1_r - 0.16_r * normalizedGapSize * normalizedGapSize ) * std::exp( -0.7_r * normalizedGapSize); + const real_t betaDragS = 0.687_r + 0.066_r*(1_r - 0.76_r * normalizedGapSize * normalizedGapSize) * std::exp( - std::pow( normalizedGapSize, 0.9_r ) ); + const real_t dragCorrelationZeng = dragCorrelationWithGapSizeStokes * ( 1_r + alphaDragS * std::pow( ReynoldsNumberShear, betaDragS ) ); // Zeng et al. (2009) - Eqs. (13) and (14) // lift correlations for the lift coefficient - const real_t liftCorrelationZeroGapStokes = real_t(5.87); // Leighton, Acrivos (1985) - const real_t liftCorrelationZeroGap = real_t(3.663) / std::pow( ReynoldsNumberShear * ReynoldsNumberShear + real_t(0.1173), real_t(0.22) ); // Zeng et al. (2009) - Eq. (19) - const real_t alphaLiftS = - std::exp( -real_t(0.3) + real_t(0.025) * ReynoldsNumberShear); - const real_t betaLiftS = real_t(0.8) + real_t(0.01) * ReynoldsNumberShear; - const real_t lambdaLiftS = ( real_t(1) - std::exp(-normalizedGapSize)) * std::pow( ReynoldsNumberShear / real_t(250), real_t(5) / real_t(2) ); - const real_t liftCorrelationZeng = liftCorrelationZeroGap * std::exp( - real_t(0.5) * normalizedGapSize * std::pow( ReynoldsNumberShear / real_t(250), real_t(4)/real_t(3))) * + const real_t liftCorrelationZeroGapStokes = 5.87_r; // Leighton, Acrivos (1985) + const real_t liftCorrelationZeroGap = 3.663_r / std::pow( ReynoldsNumberShear * ReynoldsNumberShear + 0.1173_r, 0.22_r ); // Zeng et al. (2009) - Eq. (19) + const real_t alphaLiftS = - std::exp( -0.3_r + 0.025_r * ReynoldsNumberShear); + const real_t betaLiftS = 0.8_r + 0.01_r * ReynoldsNumberShear; + const real_t lambdaLiftS = ( 1_r - std::exp(-normalizedGapSize)) * std::pow( ReynoldsNumberShear / 250_r, 5_r / 2_r ); + const real_t liftCorrelationZeng = liftCorrelationZeroGap * std::exp( - 0.5_r * normalizedGapSize * std::pow( ReynoldsNumberShear / 250_r, 4_r/3_r)) * ( std::exp( alphaLiftS * std::pow( normalizedGapSize, betaLiftS ) ) - lambdaLiftS ); // Zeng et al. (2009) - Eqs. (28) and (29) //////////////////////// @@ -717,8 +717,8 @@ int main( int argc, char **argv ) WcTimingPool timeloopTiming; - const real_t relativeChangeConvergenceEps = real_t(1e-3); - const real_t physicalCheckingFrequency = real_t(0.00625); + const real_t relativeChangeConvergenceEps = 1e-3_r; + const real_t physicalCheckingFrequency = 0.00625_r; const uint_t checkingFrequency = (zeroShearTest) ? uint_t(1) : uint_c( physicalCheckingFrequency * physicalTimeScale ); WALBERLA_LOG_INFO_ON_ROOT("Starting simulation with at least " << timesteps << " (coarse) time steps"); diff --git a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp index 2e6f5af9..54f75095 100644 --- a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp +++ b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp @@ -200,7 +200,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, boost::tuples::make_tuple( UBB_T( "UBB", UBB_Flag, pdfField, velocity_), - Outlet_T( "Outlet", Outlet_Flag, pdfField, real_t(1) ), + Outlet_T( "Outlet", Outlet_Flag, pdfField, 1_r ), MEM_BB_T ( "MEM_BB", MEM_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), MEM_CLI_T( "MEM_CLI", MEM_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), MEM_MR_T ( "MEM_MR", MEM_MR_Flag, pdfField, flagField, bodyField, fluid, *storage, *block, pdfFieldPreCol ) ) ); @@ -279,7 +279,7 @@ public: dragForceOld_ = dragForceNew_; dragForceNew_ = currentAverage_ / real_c( averageFrequency_ ); - currentAverage_ = real_t(0); + currentAverage_ = 0_r; } @@ -319,11 +319,11 @@ private: shared_ptr< StructuredBlockStorage > blocks_; const BlockDataID bodyStorageID_; - real_t currentAverage_ = real_t(0); + real_t currentAverage_ = 0_r; uint_t averageFrequency_; std::string filename_; - real_t dragForceOld_ = real_t(0); - real_t dragForceNew_ = real_t(0); + real_t dragForceOld_ = 0_r; + real_t dragForceNew_ = 0_r; }; @@ -358,7 +358,7 @@ public: fileSetup << "viscosity = " << viscosity << "\n"; fileSetup << "diameter = " << diameter << "\n"; fileSetup << "uInfty = " << u_infty_[2] << "\n"; - real_t u_ref = std::sqrt( std::fabs(densityRatio - real_t(1)) * gravity * diameter ); + real_t u_ref = std::sqrt( std::fabs(densityRatio - 1_r) * gravity * diameter ); fileSetup << "u_{ref} = " << u_ref << "\n"; fileSetup << "numLBMSubCycles = " << numLBMSubCycles << "\n"; fileSetup.close(); @@ -392,12 +392,12 @@ public: { const uint_t timestep ( timeloop_->getCurrentTimeStep() * numLBMSubCycles_ + 1 ); - Vector3<real_t> transVel( real_t(0) ); - Vector3<real_t> angularVel( real_t(0) ); - Vector3<real_t> pos( real_t(0) ); + Vector3<real_t> transVel( 0_r ); + Vector3<real_t> angularVel( 0_r ); + Vector3<real_t> pos( 0_r ); - Vector3<real_t> force( real_t(0) ); - Vector3<real_t> torque( real_t(0) ); + Vector3<real_t> force( 0_r ); + Vector3<real_t> torque( 0_r ); for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { @@ -450,7 +450,7 @@ public: real_t omega_p_H = std::sqrt( particleAngularVel[0] * particleAngularVel[0] + particleAngularVel[1] * particleAngularVel[1] ); real_t omega_p_V = particleAngularVel[2]; - real_t u_ref = std::sqrt( std::fabs(densityRatio_ - real_t(1)) * gravity_ * diameter_ ); + real_t u_ref = std::sqrt( std::fabs(densityRatio_ - 1_r) * gravity_ * diameter_ ); real_t Reynolds = u_p_r.length() * diameter_ / viscosity_; // results @@ -528,7 +528,7 @@ public: void operator()() { - Vector3<real_t> u_p( real_t(0) ); + Vector3<real_t> u_p( 0_r ); for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { for( auto bodyIt = pe::LocalBodyIterator::begin<pe::Sphere>(*blockIt, bodyStorageID_ ); bodyIt != pe::LocalBodyIterator::end<pe::Sphere>(); ++bodyIt ) @@ -550,9 +550,9 @@ public: real_t u_p_H = std::sqrt( u_p_r[0] * u_p_r[0] + u_p_r[1] * u_p_r[1]); - Vector3<real_t> e_p_H (u_p_r[0], u_p_r[1], real_t(0)); + Vector3<real_t> e_p_H (u_p_r[0], u_p_r[1], 0_r); e_p_H /= u_p_H; - Vector3<real_t> e_p_Hz_perp (-u_p_r[1], u_p_r[0], real_t(0)); + Vector3<real_t> e_p_Hz_perp (-u_p_r[1], u_p_r[0], 0_r); e_p_Hz_perp /= u_p_H; Vector3<real_t> e_p_parallel = u_p_r / u_p_r.length(); @@ -669,8 +669,8 @@ int main( int argc, char **argv ) bool usePSM = false; PSMVariant psmVariant = PSMVariant::SC3W2; - real_t Galileo = real_t(144); - real_t diameter = real_t(18); + real_t Galileo = 144_r; + real_t diameter = 18_r; //////////////////////////// // COMMAND LINE ARGUMENTS // @@ -695,39 +695,39 @@ int main( int argc, char **argv ) // SIMULATION PROPERTIES // /////////////////////////// - const real_t radius = real_t(0.5) * diameter; - const uint_t xlength = uint_c( diameter * real_t(5.34) ); + const real_t radius = 0.5_r * diameter; + const uint_t xlength = uint_c( diameter * 5.34_r ); const uint_t ylength = xlength; - uint_t zlength = uint_c( diameter * real_t(16) ); + uint_t zlength = uint_c( diameter * 16_r ); if (longDom) { zlength *= uint_t(3); } - real_t viscosity = real_t(0.01); - real_t Re_target = real_t(1); - real_t timestepsNonDim = real_t(1); + real_t viscosity = 0.01_r; + real_t Re_target = 1_r; + real_t timestepsNonDim = 1_r; // estimate Reynolds number (i.e. inflow velocity) based on Galileo number // values are taken from the original simulation of Uhlmann, Dusek switch( int(Galileo) ) { case 144: - Re_target = real_t(185.08); - timestepsNonDim = real_t(100); + Re_target = 185.08_r; + timestepsNonDim = 100_r; break; case 178: - Re_target = real_t(243.01); - timestepsNonDim = real_t(250); + Re_target = 243.01_r; + timestepsNonDim = 250_r; break; case 190: - Re_target = real_t(262.71); - timestepsNonDim = real_t(250); + Re_target = 262.71_r; + timestepsNonDim = 250_r; break; case 250: - Re_target = real_t(365.10); - timestepsNonDim = real_t(510); + Re_target = 365.10_r; + timestepsNonDim = 510_r; break; default: WALBERLA_ABORT("Galileo number is different from the usual ones (144, 178, 190, or 250). No estimate of the Reynolds number available. Add this case manually!"); @@ -738,20 +738,20 @@ int main( int argc, char **argv ) real_t omega = lbm::collision_model::omegaFromViscosity(viscosity); - Vector3<real_t> uInfty = Vector3<real_t>( real_t(0), real_t(0), uIn ); + Vector3<real_t> uInfty = Vector3<real_t>( 0_r, 0_r, uIn ); - const real_t densityRatio = real_t(1.5); + const real_t densityRatio = 1.5_r; - const uint_t averageFrequency = uint_c( ( ( uint_c(Galileo) >= 200) ? real_t(500) : real_t(2) ) * diameter / uIn ); // for initial simulation - const real_t convergenceLimit = real_t(1e-4); - const real_t convergenceLimitGalileo = real_t(1e-4); - const real_t dx = real_t(1); + const uint_t averageFrequency = uint_c( ( ( uint_c(Galileo) >= 200) ? 500_r : 2_r ) * diameter / uIn ); // for initial simulation + const real_t convergenceLimit = 1e-4_r; + const real_t convergenceLimitGalileo = 1e-4_r; + const real_t dx = 1_r; const real_t magicNumberTRT = lbm::collision_model::TRT::threeSixteenth; const uint_t numLBMSubCycles = ( useMEM ) ? 2 : 1; const uint_t numPeSubCycles = uint_c(numLBMSubCycles); // dtPE = dtLBM - const uint_t timestepsInit = uint_c( ( ( uint_c(Galileo) >= 200) ? real_t(3000) : real_t(100) ) * diameter / uIn ); // maximum number of time steps for the initial simulation + const uint_t timestepsInit = uint_c( ( ( uint_c(Galileo) >= 200) ? 3000_r : 100_r ) * diameter / uIn ); // maximum number of time steps for the initial simulation const uint_t writeFrequencyInit = uint_t(1000); // vtk write frequency init /////////////////////////// @@ -785,7 +785,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT("Domain: " << xlength << " x " << ylength << " x " << zlength); WALBERLA_LOG_INFO_ON_ROOT("Processes: " << XBlocks << " x " << YBlocks << " x " << ZBlocks); WALBERLA_LOG_INFO_ON_ROOT("Subdomains: " << XCells << " x " << YCells << " x " << ZCells); - WALBERLA_LOG_INFO_ON_ROOT("Tau: " << real_t(1)/omega); + WALBERLA_LOG_INFO_ON_ROOT("Tau: " << 1_r/omega); WALBERLA_LOG_INFO_ON_ROOT("Viscosity: " << viscosity); WALBERLA_LOG_INFO_ON_ROOT("uIn: " << uIn); WALBERLA_LOG_INFO_ON_ROOT("Re_infty: " << uIn * diameter / viscosity); @@ -817,36 +817,36 @@ int main( int argc, char **argv ) syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); - real_t xParticle = real_t(0); - real_t yParticle = real_t(0); - real_t zParticle = real_t(0); + real_t xParticle = 0_r; + real_t yParticle = 0_r; + real_t zParticle = 0_r; // root determines particle position, then broadcasts it WALBERLA_ROOT_SECTION() { if( int(Galileo) == 144 ) { - xParticle = real_c( xlength ) * real_t(0.5); - yParticle = real_c( ylength ) * real_t(0.5); + xParticle = real_c( xlength ) * 0.5_r; + yParticle = real_c( ylength ) * 0.5_r; } else if( int(Galileo) == 250 ) { // add random perturbance for chaotic regime walberla::math::seedRandomGenerator( std::mt19937::result_type(std::time(nullptr)) ); - xParticle = real_c( xlength ) * real_t(0.5) + walberla::math::realRandom( real_t(-0.5), real_t(0.5) ); - yParticle = real_c( ylength ) * real_t(0.5) + walberla::math::realRandom( real_t(-0.5), real_t(0.5) ); + xParticle = real_c( xlength ) * 0.5_r + walberla::math::realRandom( -0.5_r, 0.5_r ); + yParticle = real_c( ylength ) * 0.5_r + walberla::math::realRandom( -0.5_r, 0.5_r ); } else { //add small perturbance to sphere position to break stability due to numerical symmetry - real_t perturbance = real_t(0.35); + real_t perturbance = 0.35_r; - xParticle = real_c( xlength ) * real_t(0.5) + perturbance; - yParticle = real_c( ylength ) * real_t(0.5); + xParticle = real_c( xlength ) * 0.5_r + perturbance; + yParticle = real_c( ylength ) * 0.5_r; } - zParticle = (longDom) ? ( diameter * real_t(16) + real_c( xlength ) ) : real_c( xlength ); + zParticle = (longDom) ? ( diameter * 16_r + real_c( xlength ) ) : real_c( xlength ); } // broadcast to other ranks @@ -858,7 +858,7 @@ int main( int argc, char **argv ) } // add sphere - const auto sphereMaterial = pe::createMaterial( "mySphereMat", densityRatio , real_t(0.5), real_t(0.1), real_t(0.1), real_t(0.24), real_t(200), real_t(200), real_t(0), real_t(0) ); + const auto sphereMaterial = pe::createMaterial( "mySphereMat", densityRatio , 0.5_r, 0.1_r, 0.1_r, 0.24_r, 200_r, 200_r, 0_r, 0_r ); Vector3<real_t> position( xParticle, yParticle, zParticle ); pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, position, radius, sphereMaterial ); syncCall(); @@ -874,10 +874,10 @@ int main( int argc, char **argv ) // add PDF field // initial velocity in domain = inflow velocity - BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, uInfty, real_t(1), uint_t(1), field::zyxf ); + BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, uInfty, 1_r, uint_t(1), field::zyxf ); // add PDF field (needed to store pre collision values for MEM_MR scheme) - BlockDataID pdfFieldPreColID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "nqOdd field (zyxf)", latticeModel, uInfty, real_t(1), uint_t(1), field::zyxf ); + BlockDataID pdfFieldPreColID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "nqOdd field (zyxf)", latticeModel, uInfty, 1_r, uint_t(1), field::zyxf ); // add flag field BlockDataID flagFieldID = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" ); @@ -1040,16 +1040,16 @@ int main( int argc, char **argv ) timeloopInit.addFuncAfterTimeStep( vtk::writeFiles( pdfFieldVTKInit ), "VTK (fluid field data)" ); } - timeloopInit.addFuncAfterTimeStep( RemainingTimeLogger( timeloopInit.getNrOfTimeSteps(), real_t(120) ), "Remaining Time Logger" ); + timeloopInit.addFuncAfterTimeStep( RemainingTimeLogger( timeloopInit.getNrOfTimeSteps(), 120_r ), "Remaining Time Logger" ); //////////////////////////////// // EXECUTE INITIAL SIMULATION // //////////////////////////////// - real_t gravity = real_t(1); - real_t GalileoSim = real_t(1); - real_t ReynoldsSim = real_t(1); - real_t u_ref = real_t(1); + real_t gravity = 1_r; + real_t GalileoSim = 1_r; + real_t ReynoldsSim = 1_r; + real_t u_ref = 1_r; WALBERLA_LOG_INFO_ON_ROOT("Starting initialization phase (sphere is kept fixed)."); WALBERLA_LOG_INFO_ON_ROOT("Iterating, and adapting the viscosity, until the targeted Galileo number is set."); @@ -1081,10 +1081,10 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT("Initial simulation has ended.") //evaluate the gravitational force necessary to keep the sphere at a approximately fixed position - gravity = forceEval->getForce() / ( (densityRatio - real_t(1) ) * diameter * diameter * diameter * math::PI / real_t(6) ); - GalileoSim = std::sqrt( ( densityRatio - real_t(1) ) * gravity * diameter * diameter * diameter ) / viscosity; + gravity = forceEval->getForce() / ( (densityRatio - 1_r ) * diameter * diameter * diameter * math::PI / 6_r ); + GalileoSim = std::sqrt( ( densityRatio - 1_r ) * gravity * diameter * diameter * diameter ) / viscosity; ReynoldsSim = uIn * diameter / viscosity; - u_ref = std::sqrt( std::fabs(densityRatio - real_t(1)) * gravity * diameter ); + u_ref = std::sqrt( std::fabs(densityRatio - 1_r) * gravity * diameter ); WALBERLA_LOG_INFO_ON_ROOT("Acting gravity (= interaction force) = " << gravity ); WALBERLA_LOG_INFO_ON_ROOT("Simulated Galileo number = " << GalileoSim ); @@ -1139,7 +1139,7 @@ int main( int argc, char **argv ) const uint_t timesteps = timestepsLBM / numLBMSubCycles + 1; // total number of time steps for the whole simulation // set vtk write frequency accordingly - const real_t dtWriteNonDim = real_t(3); // write every 3 non-dim timesteps + const real_t dtWriteNonDim = 3_r; // write every 3 non-dim timesteps const uint_t nVTK = ( int(Galileo) != 178 ) ? 2 : 10; // write only 10 vtk files: the 10 final ones const uint_t writeFrequency = uint_c( dtWriteNonDim * t_ref ) / numLBMSubCycles; // vtk write frequency @@ -1190,7 +1190,7 @@ int main( int argc, char **argv ) } if( numLBMSubCycles != uint_t(1) ) - timeloop.addFuncAfterTimeStep( pe_coupling::ForceTorqueOnBodiesScaler( blocks, bodyStorageID, real_t(1) / real_c(numLBMSubCycles) ), "Force averaging for several LBM steps" ); + timeloop.addFuncAfterTimeStep( pe_coupling::ForceTorqueOnBodiesScaler( blocks, bodyStorageID, 1_r / real_c(numLBMSubCycles) ), "Force averaging for several LBM steps" ); }else{ @@ -1230,12 +1230,12 @@ int main( int argc, char **argv ) } if( numLBMSubCycles != uint_t(1) ) - timeloop.addFuncAfterTimeStep( pe_coupling::ForceTorqueOnBodiesScaler( blocks, bodyStorageID, real_t(1) / real_c(numLBMSubCycles) ), "Force averaging for several LBM steps" ); + timeloop.addFuncAfterTimeStep( pe_coupling::ForceTorqueOnBodiesScaler( blocks, bodyStorageID, 1_r / real_c(numLBMSubCycles) ), "Force averaging for several LBM steps" ); } // add gravity - Vector3<real_t> extForcesOnSphere( real_t(0), real_t(0), - gravity * ( densityRatio - real_t(1) ) * diameter * diameter * diameter * math::PI / real_t(6)); + Vector3<real_t> extForcesOnSphere( 0_r, 0_r, - gravity * ( densityRatio - 1_r ) * diameter * diameter * diameter * math::PI / 6_r); timeloop.addFuncAfterTimeStep( pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, extForcesOnSphere ), "Add external forces (gravity and buoyancy)" ); // evaluate the sphere properties @@ -1271,7 +1271,7 @@ int main( int argc, char **argv ) timeloop.addFuncAfterTimeStep( vtk::writeFiles( pdfFieldVTK ), "VTK (fluid field data)" ); - timeloop.addFuncAfterTimeStep( RemainingTimeLogger( timeloop.getNrOfTimeSteps(), real_t(120) ), "Remaining Time Logger" ); + timeloop.addFuncAfterTimeStep( RemainingTimeLogger( timeloop.getNrOfTimeSteps(), 120_r ), "Remaining Time Logger" ); //////////////////////// // EXECUTE SIMULATION // diff --git a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp index 68f90a8c..96418c70 100644 --- a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp +++ b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp @@ -233,8 +233,8 @@ static void refinementSelection( SetupBlockForest& forest ) { const AABB & domain = forest.getDomain(); - real_t xSize = ( domain.xSize() / real_t(12) ) * real_c( 0.99 ); - real_t zSize = ( domain.zSize() / real_t(12) ) * real_c( 0.99 ); + real_t xSize = ( domain.xSize() / 12_r ) * real_c( 0.99 ); + real_t zSize = ( domain.zSize() / 12_r ) * real_c( 0.99 ); AABB leftCorner( domain.xMin(), domain.yMin(), domain.zMax() - zSize, domain.xMin() + xSize, domain.yMax(), domain.zMax() ); @@ -283,7 +283,7 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf sforest.addRefinementSelectionFunction( refinementSelection ); sforest.addWorkloadMemorySUIDAssignmentFunction( std::bind( workloadAndMemoryAssignment, std::placeholders::_1, memoryPerBlock ) ); - sforest.init( AABB( real_t(0), real_t(0), real_t(0), real_c( numberOfXBlocks * numberOfXCellsPerBlock ), + sforest.init( AABB( 0_r, 0_r, 0_r, real_c( numberOfXBlocks * numberOfXCellsPerBlock ), real_c( numberOfYBlocks * numberOfYCellsPerBlock ), real_c( numberOfZBlocks * numberOfZCellsPerBlock ) ), numberOfXBlocks, numberOfYBlocks, numberOfZBlocks, false, false, false ); @@ -387,8 +387,8 @@ void ReGrid::operator()( std::vector< std::pair< const Block *, uint_t > > & min { const AABB & domain = forest.getDomain(); - const real_t xSize = domain.xSize() / real_t(12); - const real_t zSize = domain.zSize() / real_t(12); + const real_t xSize = domain.xSize() / 12_r; + const real_t zSize = domain.zSize() / 12_r; AABB left; AABB right; @@ -677,10 +677,10 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod // add pdf field to blocks BlockDataID pdfFieldId = fzyx ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel, - Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::fzyx ) : lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::zyxf ); // add flag field to blocks @@ -689,7 +689,7 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod // add LB boundary handling to blocks - const real_t velocity = configBlock.getParameter< real_t >( "velocity", real_t(0.05) ); + const real_t velocity = configBlock.getParameter< real_t >( "velocity", 0.05_r ); BlockDataID boundaryHandlingId = blocks->addBlockData( make_shared< MyBoundaryHandling< LatticeModel_T > >( blocks, flagFieldId, pdfFieldId, velocity ), "boundary handling" ); @@ -1264,7 +1264,7 @@ int main( int argc, char **argv ) pure = false; } - const real_t omega = configBlock.getParameter< real_t >( "omega", real_t(1.4) ); // on the coarsest grid! + const real_t omega = configBlock.getParameter< real_t >( "omega", 1.4_r ); // on the coarsest grid! // executing benchmark diff --git a/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp b/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp index dfb8eefd..9e91e4ee 100644 --- a/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp +++ b/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp @@ -315,7 +315,7 @@ static shared_ptr< SetupBlockForest > createSetupBlockForest( const blockforest: if( blocksPerProcess != 0 ) numberOfProcesses = uint_c( std::ceil( real_c( forest->getNumberOfBlocks() ) / real_c( blocksPerProcess ) ) ); - forest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, real_t(0), processMemoryLimit, true ); + forest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, 0_r, processMemoryLimit, true ); if( outputSetupForest ) { @@ -412,27 +412,27 @@ public: // http://devmag.org.za/2009/04/17/basic-collision-detection-in-2d-part-2/ - const Vector3< real_t > circle( real_t(0), py, pz ); + const Vector3< real_t > circle( 0_r, py, pz ); const Vector3< real_t > f = fluid - circle; const Vector3< real_t > d = ( boundary - circle ) - f; const real_t a = d[1] * d[1] + d[2] * d[2]; - const real_t b = real_t(2) * ( d[1] * f[1] + d[2] * f[2] ); + const real_t b = 2_r * ( d[1] * f[1] + d[2] * f[2] ); const real_t c = f[1] * f[1] + f[2] * f[2] - r * r; - const real_t bb4ac = b * b - ( real_t(4) * a * c ); - WALBERLA_CHECK_GREATER_EQUAL( bb4ac, real_t(0) ); + const real_t bb4ac = b * b - ( 4_r * a * c ); + WALBERLA_CHECK_GREATER_EQUAL( bb4ac, 0_r ); const real_t sqrtbb4ac = std::sqrt( bb4ac ); - real_t alpha = ( -b + sqrtbb4ac ) / ( real_t(2) * a ); - const real_t beta = ( -b - sqrtbb4ac ) / ( real_t(2) * a ); - if( alpha < real_t(0) || ( beta >= real_t(0) && beta < alpha ) ) + real_t alpha = ( -b + sqrtbb4ac ) / ( 2_r * a ); + const real_t beta = ( -b - sqrtbb4ac ) / ( 2_r * a ); + if( alpha < 0_r || ( beta >= 0_r && beta < alpha ) ) alpha = beta; - WALBERLA_CHECK_GREATER_EQUAL( alpha, real_t(0) ); - WALBERLA_CHECK_LESS_EQUAL( alpha, real_t(1) ); + WALBERLA_CHECK_GREATER_EQUAL( alpha, 0_r ); + WALBERLA_CHECK_LESS_EQUAL( alpha, 1_r ); return alpha; } @@ -614,18 +614,18 @@ protected: const real_t viscosity_L = pdf_->latticeModel().collisionModel().viscosity(); // in lattice units on the current level const real_t radius_L = channelRadius / dy; // in lattice units on the current level - real_t refVelocity_x( real_t(0) ); // in lattice units on the current level + real_t refVelocity_x( 0_r ); // in lattice units on the current level if( setup_.circularProfile ) { const real_t middleDistanceY_L = ( center[1] - channelMiddle[1] ) / dy; const real_t middleDistanceZ_L = ( center[2] - channelMiddle[2] ) / dy; const real_t middleDistance_L_2 = middleDistanceY_L * middleDistanceY_L + middleDistanceZ_L * middleDistanceZ_L; - refVelocity_x = ( acceleration_L / ( real_t(4) * viscosity_L ) ) * ( radius_L * radius_L - middleDistance_L_2 ); + refVelocity_x = ( acceleration_L / ( 4_r * viscosity_L ) ) * ( radius_L * radius_L - middleDistance_L_2 ); } else { const real_t middleDistance_L = ( center[1] - channelMiddle[1] ) / dy; - refVelocity_x = ( acceleration_L / ( real_t(2) * viscosity_L ) ) * ( radius_L * radius_L - middleDistance_L * middleDistance_L ); + refVelocity_x = ( acceleration_L / ( 2_r * viscosity_L ) ) * ( radius_L * radius_L - middleDistance_L * middleDistance_L ); } const auto velocity = pdf_->getVelocity(x,y,z); @@ -724,8 +724,8 @@ Vector3< real_t > exactPlatesVelocity( const Vector3< real_t > & p, const shared { const real_t middleDistance_L = ( p[1] - blocks->getDomain().center()[1] ) / blocks->dy(); - return Vector3< real_t >( ( setup.acceleration_L / ( real_t(2) * setup.viscosity_L ) ) * ( setup.radius_L * setup.radius_L - middleDistance_L * middleDistance_L ), - real_t(0), real_t(0) ); + return Vector3< real_t >( ( setup.acceleration_L / ( 2_r * setup.viscosity_L ) ) * ( setup.radius_L * setup.radius_L - middleDistance_L * middleDistance_L ), + 0_r, 0_r ); } Vector3< real_t > exactPipeVelocity( const Vector3< real_t > & p, const shared_ptr< StructuredBlockStorage > & blocks, const Setup & setup ) @@ -737,8 +737,8 @@ Vector3< real_t > exactPipeVelocity( const Vector3< real_t > & p, const shared_p const real_t middleDistanceZ_L = ( p[2] - channelMiddle[2] ) / blocks->dz(); const real_t middleDistance_L_2 = middleDistanceY_L * middleDistanceY_L + middleDistanceZ_L * middleDistanceZ_L; - return Vector3< real_t >( ( setup.acceleration_L / ( real_t(4) * setup.viscosity_L ) ) * ( setup.radius_L * setup.radius_L - middleDistance_L_2 ), - real_t(0), real_t(0) ); + return Vector3< real_t >( ( setup.acceleration_L / ( 4_r * setup.viscosity_L ) ) * ( setup.radius_L * setup.radius_L - middleDistance_L_2 ), + 0_r, 0_r ); } @@ -760,14 +760,14 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod if( setup.circularProfile ) { - setup.maxVelocity_L = ( setup.acceleration_L * setup.radius_L * setup.radius_L ) / ( real_t(4) * setup.viscosity_L ); - setup.meanVelocity_L = ( setup.acceleration_L * setup.radius_L * setup.radius_L ) / ( real_t(8) * setup.viscosity_L ); + setup.maxVelocity_L = ( setup.acceleration_L * setup.radius_L * setup.radius_L ) / ( 4_r * setup.viscosity_L ); + setup.meanVelocity_L = ( setup.acceleration_L * setup.radius_L * setup.radius_L ) / ( 8_r * setup.viscosity_L ); setup.flowRate_L = setup.meanVelocity_L * math::PI * setup.radius_L * setup.radius_L; } else { - setup.maxVelocity_L = ( setup.acceleration_L * setup.radius_L * setup.radius_L ) / ( real_t(2) * setup.viscosity_L ); - setup.meanVelocity_L = ( setup.acceleration_L * setup.radius_L * setup.radius_L ) / ( real_t(3) * setup.viscosity_L ); + setup.maxVelocity_L = ( setup.acceleration_L * setup.radius_L * setup.radius_L ) / ( 2_r * setup.viscosity_L ); + setup.meanVelocity_L = ( setup.acceleration_L * setup.radius_L * setup.radius_L ) / ( 3_r * setup.viscosity_L ); setup.flowRate_L = setup.meanVelocity_L * real_c( setup.yBlocks * setup.yCells * setup.zBlocks * setup.zCells ); } @@ -777,13 +777,13 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod // add pdf field to blocks - const real_t initVelocity = ( configBlock.getParameter< bool >( "initWithMeanVelocity", false ) ) ? setup.meanVelocity_L : real_t(0); + const real_t initVelocity = ( configBlock.getParameter< bool >( "initWithMeanVelocity", false ) ) ? setup.meanVelocity_L : 0_r; BlockDataID pdfFieldId = fzyx ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel, - Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::fzyx ) : lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::zyxf ); using VelocityAdaptor_T = typename lbm::Adaptor< LatticeModel_T >::VelocityVector; @@ -854,20 +854,20 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod flagFieldId, Fluid_Flag, std::bind( exactFlowRate, setup.flowRate_L ), exactSolutionFunction ); - volumetricFlowRate->setNormalizationFactor( real_t(1) / setup.maxVelocity_L ); - volumetricFlowRate->setDomainNormalization( Vector3<real_t>( real_t(1) ) ); + volumetricFlowRate->setNormalizationFactor( 1_r / setup.maxVelocity_L ); + volumetricFlowRate->setDomainNormalization( Vector3<real_t>( 1_r ) ); timeloop.addFuncBeforeTimeStep( makeSharedFunctor( volumetricFlowRate ), "volumetric flow rate evaluation" ); auto accuracyEvaluation = field::makeAccuracyEvaluation< VelocityAdaptor_T, FlagField_T >( configBlock, blocks, velocityAdaptorId, flagFieldId, Fluid_Flag, exactSolutionFunction ); - accuracyEvaluation->setNormalizationFactor( real_t(1) / setup.maxVelocity_L ); + accuracyEvaluation->setNormalizationFactor( 1_r / setup.maxVelocity_L ); timeloop.addFuncBeforeTimeStep( makeSharedFunctor( accuracyEvaluation ), "accuracy evaluation" ); auto linePlot = field::makeAccuracyEvaluationLinePlot< VelocityAdaptor_T, FlagField_T >( configBlock, blocks, velocityAdaptorId, flagFieldId, Fluid_Flag, exactSolutionFunction ); - linePlot->setNormalizationFactor( real_t(1) / setup.maxVelocity_L ); + linePlot->setNormalizationFactor( 1_r / setup.maxVelocity_L ); timeloop.addFuncBeforeTimeStep( makeSharedFunctor( field::makeAccuracyEvaluationLinePlotter( configBlock, linePlot ) ), "accuracy evaluation (line plot)" ); @@ -1136,7 +1136,7 @@ int main( int argc, char **argv ) setup.yCells = configBlock.getParameter< uint_t >( "yCells", uint_t(50) ); setup.zCells = configBlock.getParameter< uint_t >( "zCells", uint_t(10) ); - setup.Re = configBlock.getParameter< real_t >( "Re", real_t(10) ); + setup.Re = configBlock.getParameter< real_t >( "Re", 10_r ); // http://www.ae.metu.edu.tr/~ae244/docs/FluidMechanics-by-JamesFay/2003/Textbook/Nodes/chap06/node9.html // http://farside.ph.utexas.edu/teaching/336L/Fluidhtml/node106.html @@ -1175,7 +1175,7 @@ int main( int argc, char **argv ) if( !configBlock.isDefined("borderRefinementLevel") ) WALBERLA_ABORT( "You have to specify \'borderRefinementLevel\' in the \"PoiseuilleChannel\" block of the configuration file (" << argv[1] << ")" ); - const real_t borderRefinementBuffer = configBlock.getParameter< real_t >( "borderRefinementBuffer", real_t(0) ); + const real_t borderRefinementBuffer = configBlock.getParameter< real_t >( "borderRefinementBuffer", 0_r ); BorderRefinementSelection borderRefinementSelection( setup, configBlock.getParameter< uint_t >( "borderRefinementLevel" ), borderRefinementBuffer ); @@ -1242,12 +1242,12 @@ int main( int argc, char **argv ) // executing benchmark - const real_t omega = configBlock.getParameter< real_t >( "omega", real_t(1.4) ); + const real_t omega = configBlock.getParameter< real_t >( "omega", 1.4_r ); - const real_t magicNumber = configBlock.getParameter< real_t >( "magicNumber", real_t(3) / real_t(16) ); + const real_t magicNumber = configBlock.getParameter< real_t >( "magicNumber", 3_r / 16_r ); - const real_t lambda_e = configBlock.getParameter< real_t >( "lambda_e", real_t(1.4) ); - const real_t lambda_d = configBlock.getParameter< real_t >( "lambda_d", real_t(1.4) ); + const real_t lambda_e = configBlock.getParameter< real_t >( "lambda_e", 1.4_r ); + const real_t lambda_d = configBlock.getParameter< real_t >( "lambda_d", 1.4_r ); const uint_t relaxationParametersLevel = configBlock.getParameter< uint_t >( "relaxationParametersLevel", uint_t(0) ); @@ -1257,20 +1257,20 @@ int main( int argc, char **argv ) setup.viscosity_L = cm.viscosity( uint_t(0) ); if( setup.circularProfile ) - setup.acceleration_L = ( real_t(4) * setup.viscosity_L * setup.viscosity_L * setup.Re ) / ( setup.radius_L * setup.radius_L * setup.radius_L ); + setup.acceleration_L = ( 4_r * setup.viscosity_L * setup.viscosity_L * setup.Re ) / ( setup.radius_L * setup.radius_L * setup.radius_L ); else - setup.acceleration_L = ( real_t(3) * setup.viscosity_L * setup.viscosity_L * setup.Re ) / ( real_t(2) * setup.radius_L * setup.radius_L * setup.radius_L ); + setup.acceleration_L = ( 3_r * setup.viscosity_L * setup.viscosity_L * setup.Re ) / ( 2_r * setup.radius_L * setup.radius_L * setup.radius_L ); if( lm == LMD3Q19 ) { if( compressible ) { - D3Q19_SRT_COMP latticeModel = D3Q19_SRT_COMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, real_t(0), real_t(0) ) ); + D3Q19_SRT_COMP latticeModel = D3Q19_SRT_COMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, 0_r, 0_r ) ); run( config, latticeModel, fzyx, syncComm, fullComm, linearExplosion, refinementSelectionFunctions, setup, memoryPerCell, processMemoryLimit ); } else { - D3Q19_SRT_INCOMP latticeModel = D3Q19_SRT_INCOMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, real_t(0), real_t(0) ) ); + D3Q19_SRT_INCOMP latticeModel = D3Q19_SRT_INCOMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, 0_r, 0_r ) ); run( config, latticeModel, fzyx, syncComm, fullComm, linearExplosion, refinementSelectionFunctions, setup, memoryPerCell, processMemoryLimit ); } } @@ -1278,12 +1278,12 @@ int main( int argc, char **argv ) { if( compressible ) { - D3Q27_SRT_COMP latticeModel = D3Q27_SRT_COMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, real_t(0), real_t(0) ) ); + D3Q27_SRT_COMP latticeModel = D3Q27_SRT_COMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, 0_r, 0_r ) ); run( config, latticeModel, fzyx, syncComm, fullComm, linearExplosion, refinementSelectionFunctions, setup, memoryPerCell, processMemoryLimit ); } else { - D3Q27_SRT_INCOMP latticeModel = D3Q27_SRT_INCOMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, real_t(0), real_t(0) ) ); + D3Q27_SRT_INCOMP latticeModel = D3Q27_SRT_INCOMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, 0_r, 0_r ) ); run( config, latticeModel, fzyx, syncComm, fullComm, linearExplosion, refinementSelectionFunctions, setup, memoryPerCell, processMemoryLimit ); } } @@ -1299,27 +1299,27 @@ int main( int argc, char **argv ) setup.viscosity_L = cm.viscosity( uint_t(0) ); if( setup.circularProfile ) - setup.acceleration_L = ( real_t(4) * setup.viscosity_L * setup.viscosity_L * setup.Re ) / ( setup.radius_L * setup.radius_L * setup.radius_L ); + setup.acceleration_L = ( 4_r * setup.viscosity_L * setup.viscosity_L * setup.Re ) / ( setup.radius_L * setup.radius_L * setup.radius_L ); else - setup.acceleration_L = ( real_t(3) * setup.viscosity_L * setup.viscosity_L * setup.Re ) / ( real_t(2) * setup.radius_L * setup.radius_L * setup.radius_L ); + setup.acceleration_L = ( 3_r * setup.viscosity_L * setup.viscosity_L * setup.Re ) / ( 2_r * setup.radius_L * setup.radius_L * setup.radius_L ); if( lm == LMD3Q19 ) { WALBERLA_CHECK( !compressible ); - D3Q19_TRT_INCOMP latticeModel = D3Q19_TRT_INCOMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, real_t(0), real_t(0) ) ); + D3Q19_TRT_INCOMP latticeModel = D3Q19_TRT_INCOMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, 0_r, 0_r ) ); run( config, latticeModel, fzyx, syncComm, fullComm, linearExplosion, refinementSelectionFunctions, setup, memoryPerCell, processMemoryLimit ); } else { if( compressible ) { - D3Q27_TRT_COMP latticeModel = D3Q27_TRT_COMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, real_t(0), real_t(0) ) ); + D3Q27_TRT_COMP latticeModel = D3Q27_TRT_COMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, 0_r, 0_r ) ); run( config, latticeModel, fzyx, syncComm, fullComm, linearExplosion, refinementSelectionFunctions, setup, memoryPerCell, processMemoryLimit ); } else { - D3Q27_TRT_INCOMP latticeModel = D3Q27_TRT_INCOMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, real_t(0), real_t(0) ) ); + D3Q27_TRT_INCOMP latticeModel = D3Q27_TRT_INCOMP( cm, lbm::force_model::SimpleConstant( setup.acceleration_L, 0_r, 0_r ) ); run( config, latticeModel, fzyx, syncComm, fullComm, linearExplosion, refinementSelectionFunctions, setup, memoryPerCell, processMemoryLimit ); } } diff --git a/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp b/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp index d62fac03..84f8ef3e 100644 --- a/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp +++ b/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp @@ -322,7 +322,7 @@ public: bool contains( const Vector3< real_t > & point ) const; bool contains( const AABB & aabb ) const; - bool intersects( const AABB & aabb, const real_t bufferDistance = real_t(0) ) const; + bool intersects( const AABB & aabb, const real_t bufferDistance = 0_r ) const; real_t delta( const Vector3< real_t > & fluid, const Vector3< real_t > & boundary ) const; @@ -344,11 +344,11 @@ bool Cylinder::contains( const Vector3< real_t > & point ) const const real_t xd = point[0] - px; const real_t yd = point[1] - py; const real_t d = xd * xd + yd * yd; - return point[2] > real_t(0) && point[2] < H && d <= ( r * r ); + return point[2] > 0_r && point[2] < H && d <= ( r * r ); } else { - const AABB cylinder( px - r, py - r, real_t(0), px + r, py + r, H ); + const AABB cylinder( px - r, py - r, 0_r, px + r, py + r, H ); return cylinder.contains( point ); } } @@ -383,7 +383,7 @@ bool Cylinder::intersects( const AABB & aabb, const real_t bufferDistance ) cons if( setup_.circularCrossSection ) { - Vector3< real_t > p( px, py, real_t(0) ); + Vector3< real_t > p( px, py, 0_r ); if( p[0] < aabb.xMin() ) p[0] = aabb.xMin(); else if( p[0] > aabb.xMax() ) p[0] = aabb.xMax(); @@ -398,7 +398,7 @@ bool Cylinder::intersects( const AABB & aabb, const real_t bufferDistance ) cons } else { - const AABB cylinder( px - r, py - r, real_t(0), px + r, py + r, setup_.H ); + const AABB cylinder( px - r, py - r, 0_r, px + r, py + r, setup_.H ); return cylinder.intersects( aabb, bufferDistance ); } } @@ -416,29 +416,29 @@ real_t Cylinder::delta( const Vector3< real_t > & fluid, const Vector3< real_t > { // http://devmag.org.za/2009/04/17/basic-collision-detection-in-2d-part-2/ - const Vector3< real_t > circle( px, py, real_t(0) ); + const Vector3< real_t > circle( px, py, 0_r ); const Vector3< real_t > f = fluid - circle; const Vector3< real_t > d = ( boundary - circle ) - f; const real_t a = d[0] * d[0] + d[1] * d[1]; - const real_t b = real_t(2) * ( d[0] * f[0] + d[1] * f[1] ); + const real_t b = 2_r * ( d[0] * f[0] + d[1] * f[1] ); const real_t c = f[0] * f[0] + f[1] * f[1] - r * r; - const real_t bb4ac = b * b - ( real_t(4) * a * c ); - WALBERLA_CHECK_GREATER_EQUAL( bb4ac, real_t(0) ); + const real_t bb4ac = b * b - ( 4_r * a * c ); + WALBERLA_CHECK_GREATER_EQUAL( bb4ac, 0_r ); const real_t sqrtbb4ac = std::sqrt( bb4ac ); - const real_t alpha = std::min( ( -b + sqrtbb4ac ) / ( real_t(2) * a ), ( -b - sqrtbb4ac ) / ( real_t(2) * a ) ); + const real_t alpha = std::min( ( -b + sqrtbb4ac ) / ( 2_r * a ), ( -b - sqrtbb4ac ) / ( 2_r * a ) ); - WALBERLA_CHECK_GREATER_EQUAL( alpha, real_t(0) ); - WALBERLA_CHECK_LESS_EQUAL( alpha, real_t(1) ); + WALBERLA_CHECK_GREATER_EQUAL( alpha, 0_r ); + WALBERLA_CHECK_LESS_EQUAL( alpha, 1_r ); return alpha; } - const AABB cylinder( px - r, py - r, real_t(0), px + r, py + r, setup_.H ); + const AABB cylinder( px - r, py - r, 0_r, px + r, py + r, setup_.H ); if( fluid[0] <= cylinder.xMin() ) { @@ -669,7 +669,7 @@ static shared_ptr< SetupBlockForest > createSetupBlockForest( const blockforest: if( blocksPerProcess != 0 ) numberOfProcesses = uint_c( std::ceil( real_c( forest->getNumberOfBlocks() ) / real_c( blocksPerProcess ) ) ); - forest->balanceLoad( blockforest::StaticLevelwiseCurveBalanceWeighted(true), numberOfProcesses, real_t(0), processMemoryLimit, true, false ); + forest->balanceLoad( blockforest::StaticLevelwiseCurveBalanceWeighted(true), numberOfProcesses, 0_r, processMemoryLimit, true, false ); if( outputSetupForest ) { @@ -739,23 +739,23 @@ public: SinusInflowVelocity( const real_t velocity, const real_t raisingTime, const real_t sinPeriod, const real_t H ) : raisingTime_( raisingTime ), sinPeriod_( sinPeriod ), H_( H ) { - uTerm_ = Pseudo2D ? ( real_t(4) * velocity ) : ( real_t(16) * velocity ); - HTerm_ = Pseudo2D ? ( real_t(1) / ( H * H ) ) : ( real_t(1) / ( H * H * H * H ) ); + uTerm_ = Pseudo2D ? ( 4_r * velocity ) : ( 16_r * velocity ); + HTerm_ = Pseudo2D ? ( 1_r / ( H * H ) ) : ( 1_r / ( H * H * H * H ) ); tConstTerm_ = uTerm_ * HTerm_; } void operator()( const real_t t ) { const real_t PI = real_t( 3.141592653589793238462643383279502884 ); - tConstTerm_ = ( sinPeriod_ > real_t(0) ) ? ( std::abs( std::sin( PI * t / sinPeriod_ ) ) ) : real_t(1); + tConstTerm_ = ( sinPeriod_ > 0_r ) ? ( std::abs( std::sin( PI * t / sinPeriod_ ) ) ) : 1_r; tConstTerm_ *= uTerm_ * HTerm_; - tConstTerm_ *= ( raisingTime_ > real_t(0) ) ? std::min( t / raisingTime_, real_t(1) ) : real_t(1); + tConstTerm_ *= ( raisingTime_ > 0_r ) ? std::min( t / raisingTime_, 1_r ) : 1_r; } Vector3< real_t > operator()( const Vector3< real_t > & x, const real_t ) { return Vector3< real_t >( Pseudo2D ? ( tConstTerm_ * x[1] * ( H_ - x[1] ) ) : - ( tConstTerm_ * x[1] * x[2] * ( H_ - x[1] ) * ( H_ - x[2] ) ), real_t(0), real_t(0) ); + ( tConstTerm_ * x[1] * x[2] * ( H_ - x[1] ) * ( H_ - x[2] ) ), 0_r, 0_r ); } private: @@ -857,7 +857,7 @@ MyBoundaryHandling<LatticeModel_T>::initialize( IBlock * const block ) DynamicUBB_T( "velocity bounce back", UBB_Flag, pdfField, timeTracker_, blocks->getLevel(*block), velocity, block->getAABB() ), Outlet21_T( "outlet (2/1)", Outlet21_Flag, pdfField, flagField, fluid ), Outlet43_T( "outlet (4/3)", Outlet43_Flag, pdfField, flagField, fluid ), - PressureOutlet_T( "pressure outlet", PressureOutlet_Flag, pdfField, real_t(1) ) ) ); + PressureOutlet_T( "pressure outlet", PressureOutlet_Flag, pdfField, 1_r ) ) ); } @@ -954,7 +954,7 @@ void BoundarySetter< LatticeModel_T >::operator()() if( setup_.strictlyObeyL ) { CellInterval tempBB; - blocks->getCellBBFromAABB( tempBB, AABB( real_t(0), real_t(0), real_t(0), setup_.L, setup_.H, setup_.H ), uint_t(0) ); + blocks->getCellBBFromAABB( tempBB, AABB( 0_r, 0_r, 0_r, setup_.L, setup_.H, setup_.H ), uint_t(0) ); domainBB.xMax() = std::min( ( tempBB.xMax() + cell_idx_t(1) ) << level, domainBB.xMax() ); } blocks->transformGlobalToBlockLocalCellInterval( domainBB, *block ); @@ -1308,8 +1308,8 @@ public: const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : initialized_( false ), blocks_( blocks ), executionCounter_( uint_t(0) ), checkFrequency_( checkFrequency ), pdfFieldId_( pdfFieldId ), flagFieldId_( flagFieldId ), - fluid_( fluid ), obstacle_( obstacle ), setup_( setup ), D_( uint_t(0) ), AD_( real_t(0) ), AL_( real_t(0) ), forceEvaluationExecutionCount_( uint_t(0) ), - strouhalRising_( false ), strouhalNumberRealD_( real_t(0) ), strouhalNumberDiscreteD_( real_t(0) ), strouhalEvaluationExecutionCount_( uint_t(0) ), + fluid_( fluid ), obstacle_( obstacle ), setup_( setup ), D_( uint_t(0) ), AD_( 0_r ), AL_( 0_r ), forceEvaluationExecutionCount_( uint_t(0) ), + strouhalRising_( false ), strouhalNumberRealD_( 0_r ), strouhalNumberDiscreteD_( 0_r ), strouhalEvaluationExecutionCount_( uint_t(0) ), logToStream_( logToStream ), logToFile_( logToFile ), filename_( filename ), requiredSelectors_( requiredSelectors ), incompatibleSelectors_( incompatibleSelectors ) { @@ -1411,13 +1411,13 @@ void Evaluation< LatticeModel_T >::operator()() if( ( executionCounter_ - uint_c(1) ) % checkFrequency_ != 0 ) return; - real_t cDRealArea( real_t(0) ); - real_t cLRealArea( real_t(0) ); - real_t cDDiscreteArea( real_t(0) ); - real_t cLDiscreteArea( real_t(0) ); + real_t cDRealArea( 0_r ); + real_t cLRealArea( 0_r ); + real_t cDDiscreteArea( 0_r ); + real_t cLDiscreteArea( 0_r ); - real_t pressureDifference_L( real_t(0) ); - real_t pressureDifference( real_t(0) ); + real_t pressureDifference_L( 0_r ); + real_t pressureDifference( 0_r ); evaluate( cDRealArea, cLRealArea, cDDiscreteArea, cLDiscreteArea, pressureDifference_L, pressureDifference ); @@ -1426,7 +1426,7 @@ void Evaluation< LatticeModel_T >::operator()() // Strouhal number (needs vortex shedding frequency) - real_t vortexVelocity( real_t(0) ); + real_t vortexVelocity( 0_r ); if( setup_.evaluateStrouhal ) { @@ -1519,9 +1519,9 @@ void Evaluation< LatticeModel_T >::operator()() const real_t diff = ( real_c(322) * f1 + real_c(256) * f2 + real_c(39) * f3 - real_c(32) * f4 - real_c(11) * f5 ) / real_c(1536); - if( ( diff > real_t(0) ) != strouhalRising_ ) + if( ( diff > 0_r ) != strouhalRising_ ) { - strouhalRising_ = ( diff > real_t(0) ); + strouhalRising_ = ( diff > 0_r ); if( strouhalTimeStep_.size() < uint_t(3) ) { @@ -1540,7 +1540,7 @@ void Evaluation< LatticeModel_T >::operator()() { const real_t uMean = Is2D< LatticeModel_T >::value ? ( real_c(2) * setup_.inflowVelocity_L / real_c(3) ) : ( real_c(4) * setup_.inflowVelocity_L / real_c(9) ); - const real_t D = real_t(2) * setup_.cylinderRadius / setup_.dx; + const real_t D = 2_r * setup_.cylinderRadius / setup_.dx; strouhalNumberRealD_ = D / ( uMean * real_c( strouhalTimeStep_[2] - strouhalTimeStep_[0] ) ); strouhalNumberDiscreteD_ = real_c(D_) / ( uMean * real_c( strouhalTimeStep_[2] - strouhalTimeStep_[0] ) ); @@ -1553,8 +1553,8 @@ void Evaluation< LatticeModel_T >::operator()() "\n D/U (in lattice units): " << ( D / uMean ) << " (\"real\" D), " << ( real_c(D_) / uMean ) << " (discrete D)" "\n T: " << ( real_c( strouhalTimeStep_[2] - strouhalTimeStep_[0] ) * setup_.dt ) << " s (" << real_c( strouhalTimeStep_[2] - strouhalTimeStep_[0] ) << ")" - "\n f: " << ( real_t(1) / ( real_c( strouhalTimeStep_[2] - strouhalTimeStep_[0] ) * setup_.dt ) ) << " Hz (" - << ( real_t(1) / real_c( strouhalTimeStep_[2] - strouhalTimeStep_[0] ) ) << ")" + "\n f: " << ( 1_r / ( real_c( strouhalTimeStep_[2] - strouhalTimeStep_[0] ) * setup_.dt ) ) << " Hz (" + << ( 1_r / real_c( strouhalTimeStep_[2] - strouhalTimeStep_[0] ) ) << ")" "\n St (\"real\" D): " << strouhalNumberRealD_ << "\n St (discrete D): " << strouhalNumberDiscreteD_ ); } @@ -1588,9 +1588,9 @@ void Evaluation< LatticeModel_T >::operator()( const uint_t level, const uint_t if( !initialized_ ) refresh(); - force_[0] = real_t(0); - force_[1] = real_t(0); - force_[2] = real_t(0); + force_[0] = 0_r; + force_[1] = 0_r; + force_[2] = 0_r; forceSample_[0].clear(); forceSample_[1].clear(); @@ -1618,7 +1618,7 @@ void Evaluation< LatticeModel_T >::operator()( IBlock * block, const uint_t leve const Cell cell( pair->first ); const stencil::Direction direction( pair->second ); - const real_t scaleFactor = real_t(1) / real_c( uint_t(1) << ( (Is2D< LatticeModel_T >::value ? uint_t(1) : uint_t(2)) * level ) ); + const real_t scaleFactor = 1_r / real_c( uint_t(1) << ( (Is2D< LatticeModel_T >::value ? uint_t(1) : uint_t(2)) * level ) ); const real_t boundaryValue = pdfField->get( cell.x() + stencil::cx[direction], cell.y() + stencil::cy[direction], @@ -1646,13 +1646,13 @@ void Evaluation< LatticeModel_T >::operator()( IBlock * block, const uint_t leve template< typename LatticeModel_T > void Evaluation< LatticeModel_T >::prepareResultsForSQL() { - real_t cDRealArea( real_t(0) ); - real_t cLRealArea( real_t(0) ); - real_t cDDiscreteArea( real_t(0) ); - real_t cLDiscreteArea( real_t(0) ); + real_t cDRealArea( 0_r ); + real_t cLRealArea( 0_r ); + real_t cDDiscreteArea( 0_r ); + real_t cLDiscreteArea( 0_r ); - real_t pressureDifference_L( real_t(0) ); - real_t pressureDifference( real_t(0) ); + real_t pressureDifference_L( 0_r ); + real_t pressureDifference( 0_r ); evaluate( cDRealArea, cLRealArea, cDDiscreteArea, cLDiscreteArea, pressureDifference_L, pressureDifference ); @@ -1734,13 +1734,13 @@ void Evaluation< LatticeModel_T >::getResultsForSQLOnRoot( std::map< std::string template< typename LatticeModel_T > void Evaluation< LatticeModel_T >::check( const shared_ptr< Config > & config ) { - real_t cDRealArea( real_t(0) ); - real_t cLRealArea( real_t(0) ); - real_t cDDiscreteArea( real_t(0) ); - real_t cLDiscreteArea( real_t(0) ); + real_t cDRealArea( 0_r ); + real_t cLRealArea( 0_r ); + real_t cDDiscreteArea( 0_r ); + real_t cLDiscreteArea( 0_r ); - real_t pressureDifference_L( real_t(0) ); - real_t pressureDifference( real_t(0) ); + real_t pressureDifference_L( 0_r ); + real_t pressureDifference( 0_r ); evaluate( cDRealArea, cLRealArea, cDDiscreteArea, cLDiscreteArea, pressureDifference_L, pressureDifference ); @@ -1817,10 +1817,10 @@ void Evaluation< LatticeModel_T >::refresh() // Calculate obstacle surface areas required for evaluating drag and lift force real_t yMin( setup_.H ); - real_t yMax( real_t(0) ); + real_t yMax( 0_r ); - real_t AD( real_t(0) ); - real_t AL( real_t(0) ); + real_t AD( 0_r ); + real_t AL( 0_r ); directions_.clear(); @@ -1832,7 +1832,7 @@ void Evaluation< LatticeModel_T >::refresh() auto obstacle = flagField->getFlag( obstacle_ ); const uint_t level = blocks->getLevel(*block); - const real_t area = real_t(1) / real_c( uint_t(1) << ( (Is2D< LatticeModel_T >::value ? uint_t(1) : uint_t(2)) * level ) ); + const real_t area = 1_r / real_c( uint_t(1) << ( (Is2D< LatticeModel_T >::value ? uint_t(1) : uint_t(2)) * level ) ); auto xyzSize = flagField->xyzSize(); @@ -1894,8 +1894,8 @@ void Evaluation< LatticeModel_T >::refresh() WALBERLA_ROOT_SECTION() { - const Cell yMinCell = blocks->getCell( real_t(0), yMin, real_t(0) ); - const Cell yMaxCell = blocks->getCell( real_t(0), yMax, real_t(0) ); + const Cell yMinCell = blocks->getCell( 0_r, yMin, 0_r ); + const Cell yMaxCell = blocks->getCell( 0_r, yMax, 0_r ); D_ = uint_c( yMaxCell[1] - yMinCell[1] ) + uint_t(1); @@ -1924,7 +1924,7 @@ void Evaluation< LatticeModel_T >::refresh() { const auto aabb = blocks->getBlockLocalCellAABB( *block, cell ); const Vector3< real_t > pAlpha = setup_.pAlpha; - setup_.pAlpha[0] = aabb.xMin() - aabb.xSize() / real_t(2); + setup_.pAlpha[0] = aabb.xMin() - aabb.xSize() / 2_r; WALBERLA_LOG_WARNING( "Cell for evaluating pressure difference at point alpha " << pAlpha << " is not a fluid cell!" "\nChanging point alpha to " << setup_.pAlpha << " ..." ); } @@ -1948,7 +1948,7 @@ void Evaluation< LatticeModel_T >::refresh() { const auto aabb = blocks->getBlockLocalCellAABB( *block, cell ); const Vector3< real_t > pOmega = setup_.pOmega; - setup_.pOmega[0] = aabb.xMax() + aabb.xSize() / real_t(2); + setup_.pOmega[0] = aabb.xMax() + aabb.xSize() / 2_r; WALBERLA_LOG_WARNING( "Cell for evaluating pressure difference at point omega " << pOmega << " is not a fluid cell!" "\nChanging point omega to " << setup_.pOmega << " ..." ); } @@ -2071,8 +2071,8 @@ void Evaluation< LatticeModel_T >::evaluate( real_t & cDRealArea, real_t & cLRea // pressure difference - real_t pAlpha( real_t(0) ); - real_t pOmega( real_t(0) ); + real_t pAlpha( 0_r ); + real_t pOmega( 0_r ); auto blocks = blocks_.lock(); WALBERLA_CHECK_NOT_NULLPTR( blocks ); @@ -2106,14 +2106,14 @@ void Evaluation< LatticeModel_T >::evaluate( real_t & cDRealArea, real_t & cLRea const real_t uMean = Is2D< LatticeModel_T >::value ? ( real_c(2) * setup_.inflowVelocity_L / real_c(3) ) : ( real_c(4) * setup_.inflowVelocity_L / real_c(9) ); - const real_t D = real_t(2) * setup_.cylinderRadius / setup_.dx; + const real_t D = 2_r * setup_.cylinderRadius / setup_.dx; const real_t H = setup_.H / setup_.dx; - cDRealArea = ( real_t(2) * force_[0] ) / ( uMean * uMean * D * (Is2D< LatticeModel_T >::value ? real_t(1) : H) ); - cLRealArea = ( real_t(2) * force_[1] ) / ( uMean * uMean * D * (Is2D< LatticeModel_T >::value ? real_t(1) : H) ); + cDRealArea = ( 2_r * force_[0] ) / ( uMean * uMean * D * (Is2D< LatticeModel_T >::value ? 1_r : H) ); + cLRealArea = ( 2_r * force_[1] ) / ( uMean * uMean * D * (Is2D< LatticeModel_T >::value ? 1_r : H) ); - cDDiscreteArea = ( real_t(2) * force_[0] ) / ( uMean * uMean * AD_ ); - cLDiscreteArea = ( real_t(2) * force_[1] ) / ( uMean * uMean * AL_ ); + cDDiscreteArea = ( 2_r * force_[0] ) / ( uMean * uMean * AD_ ); + cLDiscreteArea = ( 2_r * force_[1] ) / ( uMean * uMean * AL_ ); pressureDifference_L = pAlpha - pOmega; pressureDifference = ( pressureDifference_L * setup_.rho * setup_.dx * setup_.dx ) / ( setup_.dt * setup_.dt ); @@ -2357,13 +2357,13 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod // add pdf field to blocks const real_t initVelocity = ( configBlock.getParameter< bool >( "initWithVelocity", false ) ) ? - ( Is2D< LatticeModel_T >::value ? ( real_t(2) * setup.inflowVelocity_L / real_c(3) ) : ( real_t(4) * setup.inflowVelocity_L / real_c(9) ) ) : real_t(0); + ( Is2D< LatticeModel_T >::value ? ( 2_r * setup.inflowVelocity_L / real_c(3) ) : ( 4_r * setup.inflowVelocity_L / real_c(9) ) ) : 0_r; BlockDataID pdfFieldId = fzyx ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel, - Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::fzyx, None, Empty ) : lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::zyxf, None, Empty ); // add density adaptor @@ -2678,7 +2678,7 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod "\n + Reynolds number: " << Re << "\n + dx (coarsest grid): " << setup.dx << " [m]" << "\n + dt (coarsest grid): " << setup.dt << " [s]" << - "\n + #time steps: " << timeloop.getNrOfTimeSteps() << " (on the coarsest grid, " << ( real_t(1) / setup.dt ) << " for 1s of real time)" + "\n + #time steps: " << timeloop.getNrOfTimeSteps() << " (on the coarsest grid, " << ( 1_r / setup.dt ) << " for 1s of real time)" "\n + simulation time: " << ( real_c( timeloop.getNrOfTimeSteps() ) * setup.dt ) << " [s]" "\n + adaptive refinement: " << ( dynamicBlockStructure ? "yes" : "no" ) << adaptiveRefinementLog ); @@ -2845,7 +2845,7 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod "\n + Reynolds number: " << Re << "\n + dx (coarsest grid): " << setup.dx << " [m]" << "\n + dt (coarsest grid): " << setup.dt << " [s]" << - "\n + #time steps: " << timeloop.getNrOfTimeSteps() << " (on the coarsest grid, " << ( real_t(1) / setup.dt ) << " for 1s of real time)" + "\n + #time steps: " << timeloop.getNrOfTimeSteps() << " (on the coarsest grid, " << ( 1_r / setup.dt ) << " for 1s of real time)" "\n + simulation time: " << ( real_c( timeloop.getNrOfTimeSteps() ) * setup.dt ) << " [s]" "\n + adaptive refinement: " << ( dynamicBlockStructure ? "yes" : "no" ) << adaptiveRefinementLog ); @@ -3024,10 +3024,10 @@ int main( int argc, char **argv ) setup.circularCrossSection = configBlock.getParameter< bool >( "circularCrossSection", true ); setup.viscosity = configBlock.getParameter< real_t >( "kinViscosity", real_c(0.001) ); // [m^2 / s] - setup.rho = configBlock.getParameter< real_t >( "rho", real_t(1) ); // [kg / m^3] - setup.inflowVelocity = configBlock.getParameter< real_t >( "inflowVelocity", real_t(0.45) ); // [m/s] - setup.raisingTime = configBlock.getParameter< real_t >( "raisingTime", real_t(0) ); // [s] - setup.sinPeriod = configBlock.getParameter< real_t >( "sinPeriod", real_t(0) ); // [s] + setup.rho = configBlock.getParameter< real_t >( "rho", 1_r ); // [kg / m^3] + setup.inflowVelocity = configBlock.getParameter< real_t >( "inflowVelocity", 0.45_r ); // [m/s] + setup.raisingTime = configBlock.getParameter< real_t >( "raisingTime", 0_r ); // [s] + setup.sinPeriod = configBlock.getParameter< real_t >( "sinPeriod", 0_r ); // [s] setup.dx = setup.H / real_c( setup.yzBlocks * setup.yzCells ); setup.evaluateForceComponents = configBlock.getParameter< bool >( "evaluateForceComponents", false ); @@ -3062,7 +3062,7 @@ int main( int argc, char **argv ) if( !configBlock.isDefined("cylinderRefinementLevel") ) WALBERLA_ABORT( "You have to specify \'cylinderRefinementLevel\' in the \"SchaeferTurek\" block of the configuration file (" << argv[1] << ")" ); - const real_t cylinderRefinementBuffer = configBlock.getParameter< real_t >( "cylinderRefinementBuffer", real_t(0) ); + const real_t cylinderRefinementBuffer = configBlock.getParameter< real_t >( "cylinderRefinementBuffer", 0_r ); Cylinder cylinder( setup ); CylinderRefinementSelection cylinderRefinementSelection( cylinder, configBlock.getParameter< uint_t >( "cylinderRefinementLevel" ), @@ -3107,19 +3107,19 @@ int main( int argc, char **argv ) // executing benchmark - real_t omega = configBlock.getParameter< real_t >( "omega", real_t(1.4) ); + real_t omega = configBlock.getParameter< real_t >( "omega", 1.4_r ); - const real_t magicNumber = configBlock.getParameter< real_t >( "magicNumber", real_t(3) / real_t(16) ); + const real_t magicNumber = configBlock.getParameter< real_t >( "magicNumber", 3_r / 16_r ); - const real_t lambda_e = configBlock.getParameter< real_t >( "lambda_e", real_t(1.4) ); - const real_t lambda_d = configBlock.getParameter< real_t >( "lambda_d", real_t(1.4) ); + const real_t lambda_e = configBlock.getParameter< real_t >( "lambda_e", 1.4_r ); + const real_t lambda_d = configBlock.getParameter< real_t >( "lambda_d", 1.4_r ); - const real_t s1 = configBlock.getParameter< real_t >( "s1", real_t(1.4) ); - const real_t s2 = configBlock.getParameter< real_t >( "s2", real_t(1.4) ); - const real_t s4 = configBlock.getParameter< real_t >( "s4", real_t(1.4) ); - const real_t s9 = configBlock.getParameter< real_t >( "s9", real_t(1.4) ); - const real_t s10 = configBlock.getParameter< real_t >( "s10", real_t(1.4) ); - const real_t s16 = configBlock.getParameter< real_t >( "s16", real_t(1.4) ); + const real_t s1 = configBlock.getParameter< real_t >( "s1", 1.4_r ); + const real_t s2 = configBlock.getParameter< real_t >( "s2", 1.4_r ); + const real_t s4 = configBlock.getParameter< real_t >( "s4", 1.4_r ); + const real_t s9 = configBlock.getParameter< real_t >( "s9", 1.4_r ); + const real_t s10 = configBlock.getParameter< real_t >( "s10", 1.4_r ); + const real_t s16 = configBlock.getParameter< real_t >( "s16", 1.4_r ); uint_t relaxationParametersLevel = configBlock.getParameter< uint_t >( "relaxationParametersLevel", uint_t(0) ); @@ -3127,7 +3127,7 @@ int main( int argc, char **argv ) { const real_t latticeInflowVelocity = configBlock.getParameter< real_t >( "latticeInflowVelocity" ); const real_t dt = latticeInflowVelocity * setup.dx / setup.inflowVelocity; - omega = real_t(1) / ( ( real_c(3) * dt * setup.viscosity ) / ( setup.dx * setup.dx ) + real_c(0.5) ); + omega = 1_r / ( ( real_c(3) * dt * setup.viscosity ) / ( setup.dx * setup.dx ) + real_c(0.5) ); relaxationParametersLevel = uint_t(0); } diff --git a/apps/benchmarks/UniformGrid/UniformGrid.cpp b/apps/benchmarks/UniformGrid/UniformGrid.cpp index 0324c719..cd8abaf2 100644 --- a/apps/benchmarks/UniformGrid/UniformGrid.cpp +++ b/apps/benchmarks/UniformGrid/UniformGrid.cpp @@ -210,9 +210,9 @@ static inline void getCellsAndProcesses( const Config::BlockHandle & configBlock getCells( configBlock, xCells, yCells, zCells ); std::vector< real_t > weighting; - weighting.push_back( configBlock.getParameter< real_t >( "xWeight", real_t(1) ) / real_c(xCells) ); - weighting.push_back( configBlock.getParameter< real_t >( "yWeight", real_t(1) ) / real_c(yCells) ); - weighting.push_back( configBlock.getParameter< real_t >( "zWeight", real_t(1) ) / real_c(zCells) ); + weighting.push_back( configBlock.getParameter< real_t >( "xWeight", 1_r ) / real_c(xCells) ); + weighting.push_back( configBlock.getParameter< real_t >( "yWeight", 1_r ) / real_c(yCells) ); + weighting.push_back( configBlock.getParameter< real_t >( "zWeight", 1_r ) / real_c(zCells) ); std::vector< uint_t > processes = math::getFactors( numberOfProcesses, 3, weighting ); @@ -252,7 +252,7 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf sforest.addWorkloadMemorySUIDAssignmentFunction( blockforest::uniformWorkloadAndMemoryAssignment ); - sforest.init( AABB( real_t(0), real_t(0), real_t(0), real_c( numberOfXBlocks * numberOfXCellsPerBlock ), + sforest.init( AABB( 0_r, 0_r, 0_r, real_c( numberOfXBlocks * numberOfXCellsPerBlock ), real_c( numberOfYBlocks * numberOfYCellsPerBlock ), real_c( numberOfZBlocks * numberOfZCellsPerBlock ) ), numberOfXBlocks, numberOfYBlocks, numberOfZBlocks, false, false, false ); @@ -297,7 +297,7 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf MPIManager::instance()->useWorldComm(); sforest.balanceLoad( blockforest::CartesianDistribution( numberOfXProcesses, numberOfYProcesses, numberOfZProcesses, nullptr ), - numberOfXProcesses * numberOfYProcesses * numberOfZProcesses, real_t(0), 0, true ); + numberOfXProcesses * numberOfYProcesses * numberOfZProcesses, 0_r, 0, true ); } WALBERLA_LOG_INFO_ON_ROOT( "SetupBlockForest created successfully:\n" << sforest ); @@ -679,10 +679,10 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod // add pdf field to blocks BlockDataID pdfFieldId = fzyx ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel, - Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::fzyx ) : lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), real_t(1), + Vector3< real_t >( real_c(0), real_c(0), real_c(0) ), 1_r, FieldGhostLayers, field::zyxf ); // add flag field to blocks @@ -691,7 +691,7 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod // add LB boundary handling to blocks - const real_t velocity = configBlock.getParameter< real_t >( "velocity", real_t(0.05) ); + const real_t velocity = configBlock.getParameter< real_t >( "velocity", 0.05_r ); BlockDataID boundaryHandlingId = blocks->template addStructuredBlockData< typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T >( MyBoundaryHandling< LatticeModel_T >( flagFieldId, pdfFieldId, velocity ), "boundary handling" ); @@ -959,7 +959,7 @@ int main( int argc, char **argv ) directComm = false; } - const real_t omega = configBlock.getParameter< real_t >( "omega", real_t(1.4) ); // on the coarsest grid! + const real_t omega = configBlock.getParameter< real_t >( "omega", 1.4_r ); // on the coarsest grid! // executing benchmark diff --git a/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp b/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp index c2f3e7a1..06d65960 100644 --- a/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp +++ b/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp @@ -166,13 +166,13 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const #ifdef OutletBC BoundaryHandling_T * handling = new BoundaryHandling_T( "Boundary handling", flagField, fluid, boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), - Inflow_T( "Inflow", Inflow_Flag, pdfField, Vector3<real_t>(real_t(0),real_t(0),uInflow_) ), + Inflow_T( "Inflow", Inflow_Flag, pdfField, Vector3<real_t>(0_r,0_r,uInflow_) ), Outflow_T( "Outflow", Outflow_Flag, pdfField, flagField, fluid ) ) ); #else BoundaryHandling_T * handling = new BoundaryHandling_T( "Boundary handling", flagField, fluid, boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), - Inflow_T( "Inflow", Inflow_Flag, pdfField, Vector3<real_t>(real_t(0),real_t(0),uInflow_) ), - Outflow_T( "Outflow", Outflow_Flag, pdfField, real_t(1) ) ) ); + Inflow_T( "Inflow", Inflow_Flag, pdfField, Vector3<real_t>(0_r,0_r,uInflow_) ), + Outflow_T( "Outflow", Outflow_Flag, pdfField, 1_r ) ) ); #endif const auto noslip = flagField->getFlag( NoSlip_Flag ); @@ -320,7 +320,7 @@ uint_t createSpheresRandomly( StructuredBlockForest & forest, pe::BodyStorage & real_t domainVolume = generationDomain.volume(); real_t totalSphereVolume = domainVolume * solidVolumeFraction; - real_t percentageOfSpecies1 = real_t(1); + real_t percentageOfSpecies1 = 1_r; if( diameter1 < diameter2 || diameter1 > diameter2 ) { real_t effectiveMass1 = diameter1 * diameter1 * diameter1; @@ -330,15 +330,15 @@ uint_t createSpheresRandomly( StructuredBlockForest & forest, pe::BodyStorage & percentageOfSpecies1 = (effectiveMassAvg - effectiveMass2) / (effectiveMass1 - effectiveMass2); } - WALBERLA_LOG_INFO_ON_ROOT("Creating "<< percentageOfSpecies1 * real_t(100) << "% of sphere type 1 with diameter = " << diameter1 << - " and " << (real_t(1) - percentageOfSpecies1) * real_t(100) << "% of sphere type 2 with diameter = " << diameter2); + WALBERLA_LOG_INFO_ON_ROOT("Creating "<< percentageOfSpecies1 * 100_r << "% of sphere type 1 with diameter = " << diameter1 << + " and " << (1_r - percentageOfSpecies1) * 100_r << "% of sphere type 2 with diameter = " << diameter2); - real_t xParticle = real_t(0); - real_t yParticle = real_t(0); - real_t zParticle = real_t(0); - real_t creationDiameter = real_t(0); + real_t xParticle = 0_r; + real_t yParticle = 0_r; + real_t zParticle = 0_r; + real_t creationDiameter = 0_r; - real_t currentSphereVolume = real_t(0); + real_t currentSphereVolume = 0_r; uint_t numberOfSpheres = uint_t(0); while( currentSphereVolume < totalSphereVolume ) @@ -350,7 +350,7 @@ uint_t createSpheresRandomly( StructuredBlockForest & forest, pe::BodyStorage & yParticle = math::realRandom<real_t>(generationDomain.yMin(), generationDomain.yMax()); zParticle = math::realRandom<real_t>(generationDomain.zMin(), generationDomain.zMax()); - real_t speciesDecider = math::realRandom<real_t>(real_t(0), real_t(1)); + real_t speciesDecider = math::realRandom<real_t>(0_r, 1_r); // if decider is in [0,...,percentageOfSpecies1], then species 1 is created, else species 2 if( percentageOfSpecies1 > speciesDecider ) { @@ -370,9 +370,9 @@ uint_t createSpheresRandomly( StructuredBlockForest & forest, pe::BodyStorage & mpi::broadcastObject( creationDiameter ); } - pe::createSphere( globalBodyStorage, forest.getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( xParticle, yParticle, zParticle ), creationDiameter * real_t(0.5), material ); + pe::createSphere( globalBodyStorage, forest.getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( xParticle, yParticle, zParticle ), creationDiameter * 0.5_r, material ); - currentSphereVolume += math::M_PI / real_t(6) * creationDiameter * creationDiameter * creationDiameter; + currentSphereVolume += math::M_PI / 6_r * creationDiameter * creationDiameter * creationDiameter; ++numberOfSpheres; } @@ -527,7 +527,7 @@ private: class CollisionPropertiesEvaluator { public: - CollisionPropertiesEvaluator( pe::cr::ICR & collisionResponse ) : collisionResponse_( collisionResponse ), maximumPenetration_(real_t(0)) + CollisionPropertiesEvaluator( pe::cr::ICR & collisionResponse ) : collisionResponse_( collisionResponse ), maximumPenetration_(0_r) {} void operator()() @@ -545,7 +545,7 @@ public: } void resetMaximumPenetration() { - maximumPenetration_ = real_t(0); + maximumPenetration_ = 0_r; } private: pe::cr::ICR & collisionResponse_; @@ -671,17 +671,17 @@ int main( int argc, char **argv ) { uint_t numberOfInitialTimeSteps = uint_t(0); std::string vtkBaseFolder = "vtk_out_BiDisperseFluidizedBedDPM"; - real_t densityRatio = real_t(2500) / real_t(1000); - real_t ReynoldsNumber = real_t(10); // = rho_f * diameterAvg * uInflow / visc_f - real_t GalileoNumber = real_t(28); // = sqrt((densityRatio - 1) * g * diameterAvg ) * diameterAvg / visc_f + real_t densityRatio = 2500_r / 1000_r; + real_t ReynoldsNumber = 10_r; // = rho_f * diameterAvg * uInflow / visc_f + real_t GalileoNumber = 28_r; // = sqrt((densityRatio - 1) * g * diameterAvg ) * diameterAvg / visc_f - real_t diameter1 = real_t(0.7); // diameter of species 1 - real_t diameter2 = real_t(0.8); // diameter of species 2 - real_t diameterAvg = real_t(0.75); // (mass) average diameter of all particles + real_t diameter1 = 0.7_r; // diameter of species 1 + real_t diameter2 = 0.8_r; // diameter of species 2 + real_t diameterAvg = 0.75_r; // (mass) average diameter of all particles uint_t interactionSubCycles = uint_t(2); // number of subcycles that involve evaluation of the interaction force uint_t peSubSteps = uint_t(10); // number of pe only calls in each subcycle - real_t solidVolumeFraction = real_t(0.2); // in the generation domain (fraction of the whole domain) + real_t solidVolumeFraction = 0.2_r; // in the generation domain (fraction of the whole domain) DPMethod dpm = DPMethod::GNS; Interpolation interpol = Interpolation::IKernel; @@ -692,7 +692,7 @@ int main( int argc, char **argv ) { EffectiveViscosity effVisc = EffectiveViscosity::Eilers; bool useTurbulenceModel = true; - const real_t smagorinskyConstant = real_t(0.1); //for turbulence model + const real_t smagorinskyConstant = 0.1_r; //for turbulence model real_t lubricationCutOffDistance = diameterAvg; //0 switches it off @@ -725,16 +725,16 @@ int main( int argc, char **argv ) { if (vtkWriteFrequency > 0) vtkIO = true; - WALBERLA_CHECK(diameter1 <= real_t(1), "Diameter is not allowed to be > 1!"); - WALBERLA_CHECK(diameter2 <= real_t(1), "Diameter is not allowed to be > 1!"); + WALBERLA_CHECK(diameter1 <= 1_r, "Diameter is not allowed to be > 1!"); + WALBERLA_CHECK(diameter2 <= 1_r, "Diameter is not allowed to be > 1!"); WALBERLA_CHECK((diameter1 <= diameterAvg && diameterAvg <= diameter2) || (diameter2 <= diameterAvg && diameterAvg <= diameter1), "Average diameter has to be between diameter 1 and 2!"); - WALBERLA_CHECK(solidVolumeFraction > real_t(0), "Solid volume fraction has to be > 0!"); - WALBERLA_CHECK(solidVolumeFraction <= real_t(0.65), "Solid volume fraction is not allowed to be > 0.65!"); + WALBERLA_CHECK(solidVolumeFraction > 0_r, "Solid volume fraction has to be > 0!"); + WALBERLA_CHECK(solidVolumeFraction <= 0.65_r, "Solid volume fraction is not allowed to be > 0.65!"); WALBERLA_CHECK(interactionSubCycles > uint_t(0), "Number of interaction sub cycles has to be at least 1!"); WALBERLA_CHECK(peSubSteps > uint_t(0), "Number of pe sub steps has to be at least 1!"); - WALBERLA_CHECK(lubricationCutOffDistance >= real_t(0), "Lubrication cut off distance has to be non-negative!"); + WALBERLA_CHECK(lubricationCutOffDistance >= 0_r, "Lubrication cut off distance has to be non-negative!"); if (funcTest) { walberla::logging::Logging::instance()->setLogLevel(logging::Logging::LogLevel::WARNING); @@ -754,24 +754,24 @@ int main( int argc, char **argv ) { // // /////////////////////////////// - const uint_t xlength = uint_c(real_t(32) * diameterAvg); - const uint_t ylength = uint_c(real_t(16) * diameterAvg); - const uint_t zlength = uint_c(real_t(256) * diameterAvg); + const uint_t xlength = uint_c(32_r * diameterAvg); + const uint_t ylength = uint_c(16_r * diameterAvg); + const uint_t zlength = uint_c(256_r * diameterAvg); - const real_t uInflow = real_t(0.01); + const real_t uInflow = 0.01_r; const real_t viscosity = diameterAvg * uInflow / ReynoldsNumber; const real_t ug = GalileoNumber * viscosity / diameterAvg; - const real_t gravitationalAcc = ug * ug / ((densityRatio - real_t(1)) * diameterAvg); + const real_t gravitationalAcc = ug * ug / ((densityRatio - 1_r) * diameterAvg); const real_t omega = lbm::collision_model::omegaFromViscosity(viscosity); - const real_t tau = real_t(1) / omega; + const real_t tau = 1_r / omega; - const real_t dx = real_t(1); + const real_t dx = 1_r; - const real_t dt_DEM = real_t(1) / real_c(interactionSubCycles * peSubSteps); + const real_t dt_DEM = 1_r / real_c(interactionSubCycles * peSubSteps); - const real_t dt = real_t(1); + const real_t dt = 1_r; const real_t dtInteractionSubCycle = dt / real_c(interactionSubCycles); const real_t dtBodyVelocityTimeDerivativeEvaluation = dtInteractionSubCycle; @@ -781,7 +781,7 @@ int main( int argc, char **argv ) { const uint_t initialTimesteps = (funcTest) ? uint_t(0) : numberOfInitialTimeSteps; // total number of time steps for the initial simulation - const Vector3<real_t> initialFluidVelocity(real_t(0), real_t(0), uInflow); + const Vector3<real_t> initialFluidVelocity(0_r, 0_r, uInflow); if (!funcTest) { @@ -849,19 +849,19 @@ int main( int argc, char **argv ) { pe::cr::DEM cr_dem(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID); cr = &cr_dem; - const real_t restitutionCoeff = real_t(0.88); - const real_t frictionCoeff = real_t(0.25); + const real_t restitutionCoeff = 0.88_r; + const real_t frictionCoeff = 0.25_r; - real_t sphereVolume = diameterAvg * diameterAvg * diameterAvg * math::M_PI / real_t(6); // based on avg. diameter + real_t sphereVolume = diameterAvg * diameterAvg * diameterAvg * math::M_PI / 6_r; // based on avg. diameter const real_t particleMass = densityRatio * sphereVolume; - const real_t Mij = particleMass * particleMass / (real_t(2) * particleMass); + const real_t Mij = particleMass * particleMass / (2_r * particleMass); const real_t lnDryResCoeff = std::log(restitutionCoeff); - const real_t collisionTime = real_t(0.5); + const real_t collisionTime = 0.5_r; const real_t stiffnessCoeff = math::M_PI * math::M_PI * Mij / (collisionTime * collisionTime * - (real_t(1) - lnDryResCoeff * lnDryResCoeff / (math::M_PI * math::M_PI + lnDryResCoeff * lnDryResCoeff))); - const real_t dampingCoeff = -real_t(2) * std::sqrt(Mij * stiffnessCoeff) * + (1_r - lnDryResCoeff * lnDryResCoeff / (math::M_PI * math::M_PI + lnDryResCoeff * lnDryResCoeff))); + const real_t dampingCoeff = -2_r * std::sqrt(Mij * stiffnessCoeff) * (std::log(restitutionCoeff) / std::sqrt(math::M_PI * math::M_PI + (std::log(restitutionCoeff) * std::log(restitutionCoeff)))); - const real_t contactDuration = real_t(2) * math::M_PI * Mij / (std::sqrt(real_t(4) * Mij * stiffnessCoeff - dampingCoeff * dampingCoeff)); //formula from Uhlman + const real_t contactDuration = 2_r * math::M_PI * Mij / (std::sqrt(4_r * Mij * stiffnessCoeff - dampingCoeff * dampingCoeff)); //formula from Uhlman WALBERLA_LOG_INFO_ON_ROOT("Created particle material with:\n" << " - coefficient of restitution = " << restitutionCoeff << "\n" @@ -871,7 +871,7 @@ int main( int argc, char **argv ) { << " - contact time Tc = " << contactDuration); auto peMaterial = pe::createMaterial("particleMat", densityRatio, restitutionCoeff, frictionCoeff, frictionCoeff, - real_t(0), real_t(200), stiffnessCoeff, dampingCoeff, dampingCoeff); + 0_r, 200_r, stiffnessCoeff, dampingCoeff, dampingCoeff); // create bounding planes pe::createPlane(*globalBodyStorage, 0, Vector3<real_t>(1, 0, 0), Vector3<real_t>(0, 0, 0), peMaterial); @@ -880,7 +880,7 @@ int main( int argc, char **argv ) { pe::createPlane(*globalBodyStorage, 0, Vector3<real_t>(0, -1, 0), Vector3<real_t>(0, real_c(ylength), 0), peMaterial); // set the planes in z-direction slightly inwards the simulation domain to avoid direct interaction of the spheres with the in- and outflow BC - real_t zOffset = real_t(4); + real_t zOffset = 4_r; pe::createPlane(*globalBodyStorage, 0, Vector3<real_t>(0, 0, 1), Vector3<real_t>(0, 0, zOffset), peMaterial); pe::createPlane(*globalBodyStorage, 0, Vector3<real_t>(0, 0, -1), Vector3<real_t>(0, 0, real_c(zlength) - zOffset), peMaterial); @@ -890,7 +890,7 @@ int main( int argc, char **argv ) { ///////////////// // connect to pe - const real_t overlap = real_t(1.5) * dx; + const real_t overlap = 1.5_r * dx; auto syncCall = std::bind(pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); shared_ptr<CollisionPropertiesEvaluator> collisionPropertiesEvaluator = walberla::make_shared<CollisionPropertiesEvaluator>(*cr); @@ -898,20 +898,20 @@ int main( int argc, char **argv ) { // create the spheres uint_t numSpheres = 0; { - real_t radiusMax = real_t(0.5) * std::max(diameter1, diameter2); + real_t radiusMax = 0.5_r * std::max(diameter1, diameter2); AABB generationDomain(radiusMax, radiusMax, radiusMax + zOffset, - real_c(xlength) - radiusMax, real_c(ylength) - radiusMax, real_t(64) * diameterAvg + zOffset); + real_c(xlength) - radiusMax, real_c(ylength) - radiusMax, 64_r * diameterAvg + zOffset); numSpheres = createSpheresRandomly(*blocks, *globalBodyStorage, bodyStorageID, generationDomain, diameter1, diameter2, diameterAvg, solidVolumeFraction, peMaterial); syncCall(); const uint_t initialPeSteps = uint_t(50000); const real_t dt_DEM_init = collisionTime / real_t(uint_t(10) * peSubSteps); - const real_t overlapLimit = real_t(0.05) * diameterAvg; + const real_t overlapLimit = 0.05_r * diameterAvg; WALBERLA_LOG_INFO_ON_ROOT("Sphere creation done -- " << numSpheres << " spheres created"); WALBERLA_LOG_INFO_ON_ROOT( - "resolving overlaps with goal all < " << overlapLimit / diameterAvg * real_t(100) << "%"); + "resolving overlaps with goal all < " << overlapLimit / diameterAvg * 100_r << "%"); auto boundingPlaneForInit = pe::createPlane(*globalBodyStorage, 0, Vector3<real_t>(0, 0, -1), Vector3<real_t>(0, 0, generationDomain.zMax() + radiusMax), @@ -928,7 +928,7 @@ int main( int argc, char **argv ) { } else { if (pet % uint_t(200) == uint_t(0)) { WALBERLA_LOG_INFO_ON_ROOT( - pet << " - current max overlap = " << maxPen / diameterAvg * real_t(100) << "%"); + pet << " - current max overlap = " << maxPen / diameterAvg * 100_r << "%"); } } collisionPropertiesEvaluator->resetMaximumPenetration(); @@ -937,7 +937,7 @@ int main( int argc, char **argv ) { boundingPlaneForInit->getSystemID()); // set body velocities to zero - setBodyVelocities(blocks, bodyStorageID, Vector3<real_t>(real_t(0))); + setBodyVelocities(blocks, bodyStorageID, Vector3<real_t>(0_r)); // some spheres might have gone lost due to unfortunate random generation SphereCounter sphereNumberChecker(blocks, bodyStorageID, numSpheres); @@ -993,11 +993,11 @@ int main( int argc, char **argv ) { ////////////////////// // create force field - BlockDataID forceFieldID = field::addToStorage< Vec3Field_T >( blocks, "force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); + BlockDataID forceFieldID = field::addToStorage< Vec3Field_T >( blocks, "force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); - BlockDataID dragForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "drag force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); - BlockDataID amForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "am force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); - BlockDataID liftForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "lift force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); + BlockDataID dragForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "drag force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); + BlockDataID amForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "am force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); + BlockDataID liftForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "lift force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); // create omega field BlockDataID omegaFieldID = field::addToStorage< ScalarField_T >( blocks, "omega field", omega, field::zyxf, FieldGhostLayers ); @@ -1006,7 +1006,7 @@ int main( int argc, char **argv ) { LatticeModel_T latticeModel = LatticeModel_T( omegaFieldID, ForceModel_T( forceFieldID ) ); // add PDF field - BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, initialFluidVelocity, real_t(1), FieldGhostLayers, field::zyxf ); + BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, initialFluidVelocity, 1_r, FieldGhostLayers, field::zyxf ); // add flag field BlockDataID flagFieldID = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" ); @@ -1020,10 +1020,10 @@ int main( int argc, char **argv ) { BlockDataID swappedOldVelocityFieldID = field::addToStorage< Vec3Field_T >( blocks, "swapped old velocity field", initialFluidVelocity, field::zyxf, FieldGhostLayers ); // create pressure field - BlockDataID pressureFieldID = field::addToStorage< ScalarField_T >( blocks, "pressure field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID pressureFieldID = field::addToStorage< ScalarField_T >( blocks, "pressure field", 0_r, field::zyxf, FieldGhostLayers ); // create solid volume fraction field - BlockDataID svfFieldID = field::addToStorage< ScalarField_T >( blocks, "svf field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID svfFieldID = field::addToStorage< ScalarField_T >( blocks, "svf field", 0_r, field::zyxf, FieldGhostLayers ); // field to store pressure gradient BlockDataID pressureGradientFieldID = field::addToStorage< Vec3Field_T >( blocks, "pressure gradient field", Vector3<real_t>(real_c(0)), field::zyxf, FieldGhostLayers ); @@ -1374,7 +1374,7 @@ int main( int argc, char **argv ) { // function to evaluate lubrication forces std::function<void(void)> lubricationEvaluationFunction; - if( lubricationCutOffDistance > real_t(0) ) + if( lubricationCutOffDistance > 0_r ) { using LE_T = pe_coupling::discrete_particle_methods::LubricationForceEvaluator; shared_ptr<LE_T> lubEval = make_shared<LE_T>( blocks, globalBodyStorage, bodyStorageID, viscosity, lubricationCutOffDistance ); @@ -1569,7 +1569,7 @@ int main( int argc, char **argv ) { // ext forces on bodies and PE step(s) timeloop.add() << Sweep( DummySweep(), "Dummy Sweep ") << AfterFunction( BodiesQuantityEvaluator(&timeloop, blocks, bodyStorageID, vtkBaseFolder+"/quantityLogging.txt", numSpheres, real_t(numSpheres) * particleMass ), "Body Quantity Evaluator") - << AfterFunction( ForceOnBodiesAdder( blocks, bodyStorageID, Vector3<real_t>(0,0,- gravitationalAcc * ( densityRatio - real_t(1) ) ) ), "Gravitational and Buoyancy Force Add" ) + << AfterFunction( ForceOnBodiesAdder( blocks, bodyStorageID, Vector3<real_t>(0,0,- gravitationalAcc * ( densityRatio - 1_r ) ) ), "Gravitational and Buoyancy Force Add" ) << AfterFunction( pe_coupling::TimeStep( blocks, bodyStorageID, *cr, syncCall, dtInteractionSubCycle, peSubSteps, lubricationEvaluationFunction ), "Pe Time Step" ); // update solid volume fraction field diff --git a/apps/tools/povrayFileCompressor/main.cpp b/apps/tools/povrayFileCompressor/main.cpp index a66acbf5..0095861b 100644 --- a/apps/tools/povrayFileCompressor/main.cpp +++ b/apps/tools/povrayFileCompressor/main.cpp @@ -22,6 +22,7 @@ #include "geometry/mesh/TriangleMeshIO.h" #include "core/Regex.h" #include "core/Filesystem.h" +#include "core/DataTypes.h" #include <fstream> #include <iomanip> @@ -58,14 +59,16 @@ int main(int argc, char** argv) return EXIT_SUCCESS; } - if( argc < 3 || argv[argc-1][0] == '-' || argv[argc-2][0] == '-' ) - PRINT_ERR( "Usage: PovrayFileCompressor [-q|-v|-n|-s|-o ${count}] <inDir> <outDir>\n" ) + if (argc < 3 || argv[argc - 1][0] == '-' || argv[argc - 2][0] == '-') + PRINT_ERR("Usage: PovrayFileCompressor [-q|-v|-n|-s|-o ${count}] <inDir> <outDir>\n") + + using walberla::operator"" _r; verbose = false; quiet = false; size_t n = 9000u; size_t s = 0u; - walberla::real_t o = walberla::real_t(0); + walberla::real_t o = 0_r; if( argc > 3 ) { for( walberla::uint_t i = 1; i < walberla::uint_c(argc-2); ++i ) { @@ -153,7 +156,7 @@ int main(int argc, char** argv) PRINT_VER( "Remove Duplicate Vertices ... \n" ) size_t removed; - if( o > walberla::real_t(0) ) + if( o > 0_r ) removed = mesh.removeDuplicateVertices( o ); else removed = mesh.removeDuplicateVertices( ); diff --git a/apps/tutorials/cuda/01_GameOfLife_cuda.cpp b/apps/tutorials/cuda/01_GameOfLife_cuda.cpp index 518acb7e..ea749c84 100644 --- a/apps/tutorials/cuda/01_GameOfLife_cuda.cpp +++ b/apps/tutorials/cuda/01_GameOfLife_cuda.cpp @@ -102,7 +102,7 @@ int main( int argc, char ** argv ) shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid ( uint_t(1) , uint_t(2), uint_t(1), // number of blocks in x,y,z direction image.size( uint_t(0) ), image.size( uint_t(1) ) / uint_t(2), uint_t(1), // how many cells per block (x,y,z) - real_t(1), // dx: length of one cell in physical coordinates + 1_r, // dx: length of one cell in physical coordinates false, // one block per process - "false" means all blocks to one process false, false, false ); // no periodicity diff --git a/apps/tutorials/lbm/01_BasicLBM.cpp b/apps/tutorials/lbm/01_BasicLBM.cpp index 1380a1f1..b5eccdaf 100644 --- a/apps/tutorials/lbm/01_BasicLBM.cpp +++ b/apps/tutorials/lbm/01_BasicLBM.cpp @@ -61,7 +61,7 @@ int main( int argc, char ** argv ) // create fields LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::SRT( omega ) ); - BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, real_t(1) ); + BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, 1_r ); BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" ); // create and initialize boundary handling diff --git a/apps/tutorials/lbm/02_BasicLBM_ExemplaryExtensions.cpp b/apps/tutorials/lbm/02_BasicLBM_ExemplaryExtensions.cpp index 3f75b9bf..a801b815 100644 --- a/apps/tutorials/lbm/02_BasicLBM_ExemplaryExtensions.cpp +++ b/apps/tutorials/lbm/02_BasicLBM_ExemplaryExtensions.cpp @@ -574,7 +574,7 @@ int main( int argc, char ** argv ) // create fields - BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, real_t(1) ); + BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, 1_r ); BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" ); // create and initialize boundary handling diff --git a/apps/tutorials/pe/01_ConfinedGas.cpp b/apps/tutorials/pe/01_ConfinedGas.cpp index 3d984792..3a9dd02d 100644 --- a/apps/tutorials/pe/01_ConfinedGas.cpp +++ b/apps/tutorials/pe/01_ConfinedGas.cpp @@ -84,7 +84,7 @@ int main( int argc, char ** argv ) cr::HCSITS cr(globalBodyStorage, forest, storageID, ccdID, fcdID); cr.setMaxIterations( 10 ); cr.setRelaxationModel( cr::HardContactSemiImplicitTimesteppingSolvers::ApproximateInelasticCoulombContactByDecoupling ); - cr.setRelaxationParameter( real_t(0.7) ); + cr.setRelaxationParameter( 0.7_r ); cr.setGlobalLinearAcceleration( Vec3(0,0,0) ); //! [Integrator] diff --git a/apps/tutorials/pe/02_ConfinedGasExtended.cpp b/apps/tutorials/pe/02_ConfinedGasExtended.cpp index e1da27b0..f70b3f10 100644 --- a/apps/tutorials/pe/02_ConfinedGasExtended.cpp +++ b/apps/tutorials/pe/02_ConfinedGasExtended.cpp @@ -148,7 +148,7 @@ int main( int argc, char ** argv ) cr::HCSITS cr(globalBodyStorage, forest, storageID, ccdID, fcdID); cr.setMaxIterations( 10 ); cr.setRelaxationModel( cr::HardContactSemiImplicitTimesteppingSolvers::ApproximateInelasticCoulombContactByDecoupling ); - cr.setRelaxationParameter( real_t(0.7) ); + cr.setRelaxationParameter( 0.7_r ); cr.setGlobalLinearAcceleration( Vec3(0,0,0) ); WALBERLA_LOG_INFO_ON_ROOT("*** SYNCCALL ***"); diff --git a/src/blockforest/BlockForestEvaluation.cpp b/src/blockforest/BlockForestEvaluation.cpp index d587ef26..12f8aff6 100644 --- a/src/blockforest/BlockForestEvaluation.cpp +++ b/src/blockforest/BlockForestEvaluation.cpp @@ -60,7 +60,7 @@ BlockForestEvaluation::BlockForestEvaluation( const BlockForest & forest ) : blockStatistics_[i].avg = sample.mean(); blockStatistics_[i].stdDev = sample.stdDeviation(); const auto relStdDev = sample.relativeStdDeviation(); - blockStatistics_[i].relStdDev = math::isnan( relStdDev ) ? real_t(0) : relStdDev; + blockStatistics_[i].relStdDev = math::isnan( relStdDev ) ? 0_r : relStdDev; } } } diff --git a/src/blockforest/GlobalLoadBalancing.h b/src/blockforest/GlobalLoadBalancing.h index 521af77d..b937dbc1 100644 --- a/src/blockforest/GlobalLoadBalancing.h +++ b/src/blockforest/GlobalLoadBalancing.h @@ -841,7 +841,7 @@ uint_t GlobalLoadBalancing::metis( const std::vector< BLOCK* >& blocks, const me // second call to METIS: try to balance both workload and memory as good as possible ... - real_t minUbvec = real_t(1); + real_t minUbvec = 1_r; ubvec[1] = minUbvec; ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), NULL, &(adjwgt[0]), &nparts, NULL, @@ -969,7 +969,7 @@ void GlobalLoadBalancing::metis2( const std::vector< BLOCK* >& blocks, const uin { if( block->getNeighbor( k )->getLevel() == block->getLevel() && block->getNeighbor( k )->getWorkload() > workload_t(0) ) { - if( communicationWeights[ commIdx ] > real_t(0) ) + if( communicationWeights[ commIdx ] > 0_r ) { adjncy.push_back( numeric_cast<int64_t>( block->getNeighbor( k )->getIndex() ) ); WALBERLA_ASSERT_LESS( commIdx, communicationWeights.size() ); diff --git a/src/blockforest/Initialization.cpp b/src/blockforest/Initialization.cpp index c13896c8..956f30fe 100644 --- a/src/blockforest/Initialization.cpp +++ b/src/blockforest/Initialization.cpp @@ -111,7 +111,7 @@ shared_ptr< StructuredBlockForest > createUniformBlockGridFromConfig( const Conf const bool keepGlobalBlockInformation ) { const Vector3<bool> periodic = configBlock.getParameter<Vector3<bool> >( "periodic", Vector3<bool> (false) ); - const real_t dx = configBlock.getParameter<real_t >( "dx", real_t(1) ); + const real_t dx = configBlock.getParameter<real_t >( "dx", 1_r ); Vector3<uint_t> cellsPerBlock; Vector3<uint_t> blocks; diff --git a/src/blockforest/SetupBlockForest.cpp b/src/blockforest/SetupBlockForest.cpp index 66201296..5ffd2bf2 100644 --- a/src/blockforest/SetupBlockForest.cpp +++ b/src/blockforest/SetupBlockForest.cpp @@ -1152,7 +1152,7 @@ void SetupBlockForest::balanceLoad( const TargetProcessAssignmentFunction & func { WALBERLA_LOG_PROGRESS( "Balancing SetupBlockForest: Creating a process distribution for " << numberOfProcesses_ << " process(es) ..." ); - if( minBufferProcessesFraction < real_t(0) || !(minBufferProcessesFraction < real_t(1)) ) + if( minBufferProcessesFraction < 0_r || !(minBufferProcessesFraction < 1_r) ) WALBERLA_ABORT( "Load balancing failed: \'buffer processes fraction\' must be in [0,1). " "The value you provided was \'" << minBufferProcessesFraction << "\'." ); @@ -1166,7 +1166,7 @@ void SetupBlockForest::balanceLoad( const TargetProcessAssignmentFunction & func // // integer = cast< integer >( 0.5 + floating point ) [for correct rounding] - const uint_t numberOfWorkerProcesses = uint_c( real_c(0.5) + ( real_t(1) - minBufferProcessesFraction ) * real_c( numberOfProcesses ) ); + const uint_t numberOfWorkerProcesses = uint_c( real_c(0.5) + ( 1_r - minBufferProcessesFraction ) * real_c( numberOfProcesses ) ); WALBERLA_CHECK_LESS_EQUAL( numberOfWorkerProcesses, numberOfProcesses ); const uint_t numberOfBufferProcesses = numberOfProcesses - numberOfWorkerProcesses; @@ -1978,7 +1978,7 @@ void SetupBlockForest::toStream( std::ostream & os ) const << "- initial decomposition: " << size_[0] << " x " << size_[1] << " x " << size_[2] << " (= forest size)\n" << std::boolalpha << "- periodicity: " << periodic_[0] << " x " << periodic_[1] << " x " << periodic_[2] << "\n" << "- number of blocks discarded from the initial grid: " << discardedRootBlocks << " (= " - << ( real_t(100) * real_c(discardedRootBlocks) / real_c(size_[0]*size_[1]*size_[2]) ) << " %)\n" + << ( 100_r * real_c(discardedRootBlocks) / real_c(size_[0]*size_[1]*size_[2]) ) << " %)\n" << "- number of levels: " << getNumberOfLevels() << "\n" << "- tree ID digits: " << treeIdDigits_ << " (-> block ID bytes = " << getBlockIdBytes() << ")\n" << "- total number of blocks: " << numberOfBlocks_ << "\n"; @@ -1991,9 +1991,9 @@ void SetupBlockForest::toStream( std::ostream & os ) const { os << "\n- distribution of space/memory/work to different grid levels:\n"; - std::vector< real_t > space ( depth_ + 2, real_t(0) ); - std::vector< real_t > memory ( depth_ + 2, real_t(0) ); - std::vector< real_t > workload ( depth_ + 2, real_t(0) ); + std::vector< real_t > space ( depth_ + 2, 0_r ); + std::vector< real_t > memory ( depth_ + 2, 0_r ); + std::vector< real_t > workload ( depth_ + 2, 0_r ); std::vector< uint_t > numberOfBlocks( depth_ + 2, uint_t(0) ); for( auto block = begin(); block != end(); ++block ) @@ -2017,9 +2017,9 @@ void SetupBlockForest::toStream( std::ostream & os ) const { os << " + level " << l << ":\n" << " - " << numberOfBlocks[l] << " blocks ...\n" - << " - ... cover " << ( real_t(100) * space[l] / space.back() ) << " % of the total simulation space\n" - << " - ... account for " << ( real_t(100) * memory[l] / memory.back() ) << " % of the total memory foot print\n" - << " - ... generate " << ( real_t(100) * workload[l] / workload.back() ) << " % of the total workload"; + << " - ... cover " << ( 100_r * space[l] / space.back() ) << " % of the total simulation space\n" + << " - ... account for " << ( 100_r * memory[l] / memory.back() ) << " % of the total memory foot print\n" + << " - ... generate " << ( 100_r * workload[l] / workload.back() ) << " % of the total workload"; if( l != depth_ ) os << "\n"; } } @@ -2087,7 +2087,7 @@ void SetupBlockForest::toStream( std::ostream & os ) const { os << "\n- distribution of space/memory/work to different grid levels:\n"; - std::vector< real_t > space( depth_ + 2, real_t(0) ); + std::vector< real_t > space( depth_ + 2, 0_r ); std::vector< uint_t > numberOfBlocks( depth_ + 2, uint_t(0) ); for( auto block = begin(); block != end(); ++block ) @@ -2107,9 +2107,9 @@ void SetupBlockForest::toStream( std::ostream & os ) const { os << " + level " << l << ":\n" << " - " << numberOfBlocks[l] << " blocks ...\n" - << " - ... cover " << ( real_t(100) * space[l] / space.back() ) << " % of the total simulation space\n" - << " - ... account for " << ( real_t(100) * memory[l].sum() / memory.back().sum() ) << " % of the total memory foot print\n" - << " - ... generate " << ( real_t(100) * workload[l].sum() / workload.back().sum() ) << " % of the total work load\n" + << " - ... cover " << ( 100_r * space[l] / space.back() ) << " % of the total simulation space\n" + << " - ... account for " << ( 100_r * memory[l].sum() / memory.back().sum() ) << " % of the total memory foot print\n" + << " - ... generate " << ( 100_r * workload[l].sum() / workload.back().sum() ) << " % of the total work load\n" << " - blocks per process:\n" << " + min = " << blocks[l].min() << "\n" << " + max = " << blocks[l].max() << "\n" diff --git a/src/blockforest/SetupBlockForest.h b/src/blockforest/SetupBlockForest.h index a9192cac..54975768 100644 --- a/src/blockforest/SetupBlockForest.h +++ b/src/blockforest/SetupBlockForest.h @@ -275,7 +275,7 @@ public: void assignAllBlocksToRootProcess(); void balanceLoad( const TargetProcessAssignmentFunction & function, - const uint_t numberOfProcesses, const real_t minBufferProcessesFraction = real_t(0), + const uint_t numberOfProcesses, const real_t minBufferProcessesFraction = 0_r, const memory_t perProcessMemoryLimit = memory_t(0), const bool reorderProcessesByBFS = false, const bool insertBufferProcesses = false ); diff --git a/src/blockforest/loadbalancing/DynamicParMetis.h b/src/blockforest/loadbalancing/DynamicParMetis.h index fa5663db..953fc138 100644 --- a/src/blockforest/loadbalancing/DynamicParMetis.h +++ b/src/blockforest/loadbalancing/DynamicParMetis.h @@ -51,7 +51,7 @@ public: const WeightsToUse weightsToUse = PARMETIS_BOTH_WEIGHTS, const EdgeSource edgeSource = PARMETIS_EDGES_FROM_EDGE_WEIGHTS, const uint_t ncon = uint_t(1)) - : algorithm_( algorithm ), weightsToUse_( weightsToUse ), edgeSource_( edgeSource ), ncon_( ncon ), ubvec_( ncon, real_t(1.05) ) {} + : algorithm_( algorithm ), weightsToUse_( weightsToUse ), edgeSource_( edgeSource ), ncon_( ncon ), ubvec_( ncon, 1.05_r ) {} bool operator()( std::vector< std::pair< const PhantomBlock *, uint_t > > & targetProcess, std::set< uint_t > & processesToRecvFrom, diff --git a/src/core/EndianIndependentSerialization.h b/src/core/EndianIndependentSerialization.h index 36a9e8eb..30946875 100644 --- a/src/core/EndianIndependentSerialization.h +++ b/src/core/EndianIndependentSerialization.h @@ -102,9 +102,9 @@ uint_t realToByteArray( const REAL_T value, std::vector< uint8_t >& array, const int exp; const REAL_T x = std::frexp( value, &exp ); - const REAL_T sign = ( x < REAL_T(0) ) ? REAL_T(-1) : REAL_T(1); + const REAL_T sign = ( x < 0_r ) ? -1_r : 1_r; - uint_t signByte = ( ( exp >= 0 ) ? uint_c(0) : uint_c(1) ) + ( ( sign < REAL_T(0) ) ? uint_c(2) : uint_c(0) ); + uint_t signByte = ( ( exp >= 0 ) ? uint_c(0) : uint_c(1) ) + ( ( sign < 0_r ) ? uint_c(2) : uint_c(0) ); array[ offset ] = uint8_c( signByte ); uint32_t uexp = ( exp >= 0 ) ? uint32_c( exp ) : uint32_c( -1 * exp ); @@ -141,7 +141,7 @@ REAL_T byteArrayToReal( const std::vector< uint8_t >& array, const uint_t offset for( uint_t i = 0; i != sizeof( REAL_T ); ++i ) mant |= uint64_c( array[ offset + 3 + i ] ) << ( i * 8 ); - const REAL_T sign = ( ( uint_c( array[ offset ] ) & uint_c(2) ) == uint_c(0) ) ? REAL_T(1) : REAL_T(-1); + const REAL_T sign = ( ( uint_c( array[ offset ] ) & uint_c(2) ) == uint_c(0) ) ? 1_r : -1_r; return std::ldexp( sign * numeric_cast<REAL_T>( mant ) / numeric_cast<REAL_T>( uint64_c(1) << uint64_c( 1 + std::numeric_limits<REAL_T>::digits ) ), exp ); } diff --git a/src/core/math/DistributedSample.cpp b/src/core/math/DistributedSample.cpp index 509af72a..6e993864 100644 --- a/src/core/math/DistributedSample.cpp +++ b/src/core/math/DistributedSample.cpp @@ -39,7 +39,7 @@ namespace math { **********************************************************************************************************************/ void DistributedSample::mpiAllGather() { - sum_ = real_t(0); + sum_ = 0_r; min_ = std::numeric_limits< real_t >::max(); max_ = -std::numeric_limits< real_t >::max(); size_ = uint_c( data_.size() ); @@ -60,7 +60,7 @@ void DistributedSample::mpiAllGather() } mean_ = sum_ / real_c(size_); - variance_ = real_t(0); + variance_ = 0_r; for( auto it = data_.begin(); it != data_.end(); ++it ) { @@ -77,10 +77,10 @@ void DistributedSample::mpiAllGather() if( size_ == uint_t(0) ) { - min_ = real_t(0); - max_ = real_t(0); - mean_ = real_t(0); - variance_ = real_t(0); + min_ = 0_r; + max_ = 0_r; + mean_ = 0_r; + variance_ = 0_r; } } @@ -98,7 +98,7 @@ void DistributedSample::mpiGather( int rank ) WALBERLA_ASSERT( rank == 0 ); } - sum_ = real_t(0); + sum_ = 0_r; min_ = std::numeric_limits< real_t >::max(); max_ = -std::numeric_limits< real_t >::max(); size_ = uint_c( data_.size() ); @@ -119,7 +119,7 @@ void DistributedSample::mpiGather( int rank ) } mean_ = sum_ / real_c(size_); - variance_ = real_t(0); + variance_ = 0_r; for( auto it = data_.begin(); it != data_.end(); ++it ) { @@ -136,10 +136,10 @@ void DistributedSample::mpiGather( int rank ) if( size_ == uint_t(0) ) { - min_ = real_t(0); - max_ = real_t(0); - mean_ = real_t(0); - variance_ = real_t(0); + min_ = 0_r; + max_ = 0_r; + mean_ = 0_r; + variance_ = 0_r; } } diff --git a/src/core/math/DistributedSample.h b/src/core/math/DistributedSample.h index 14e716e6..4aa3c508 100644 --- a/src/core/math/DistributedSample.h +++ b/src/core/math/DistributedSample.h @@ -42,7 +42,7 @@ class DistributedSample public: DistributedSample() : - sum_( real_t(0) ), min_( real_t(0) ), max_( real_t(0) ), size_( uint_t(0) ), mean_( real_t(0) ), variance_( real_t(0) ) {} + sum_( 0_r ), min_( 0_r ), max_( 0_r ), size_( uint_t(0) ), mean_( 0_r ), variance_( 0_r ) {} // insert @@ -57,7 +57,7 @@ public: template <class InputIterator> void castToRealAndInsert( InputIterator first, InputIterator last ); - void clear() { data_.clear(); sum_ = real_t(0); min_ = real_t(0); max_ = real_t(0); size_ = uint_t(0); mean_ = real_t(0); variance_ = real_t(0); } + void clear() { data_.clear(); sum_ = 0_r; min_ = 0_r; max_ = 0_r; size_ = uint_t(0); mean_ = 0_r; variance_ = 0_r; } // synchronization diff --git a/src/core/math/Plane.h b/src/core/math/Plane.h index bab0ac1e..53cab707 100644 --- a/src/core/math/Plane.h +++ b/src/core/math/Plane.h @@ -66,7 +66,7 @@ private: }; Plane::Plane() : - normal_( Vec3Real( real_t(1), real_t(0), real_t(0) ) ), d_( real_t(0) ) + normal_( Vec3Real( 1_r, 0_r, 0_r ) ), d_( 0_r ) { } diff --git a/src/core/math/Quaternion.h b/src/core/math/Quaternion.h index f6822daf..a5d023c3 100644 --- a/src/core/math/Quaternion.h +++ b/src/core/math/Quaternion.h @@ -262,7 +262,7 @@ inline Quaternion<Type>::Quaternion( Vector3<Axis> axis, Type angle ) static_assert(boost::is_floating_point<Axis>::value, "Axis has to be floating point!" ); auto axisLength = axis.length(); - if( (floatIsEqual(axisLength, 0)) || (math::equal(std::fabs(angle), real_t(0))) ) { + if( (floatIsEqual(axisLength, 0)) || (math::equal(std::fabs(angle), 0_r)) ) { reset(); return; } @@ -270,7 +270,7 @@ inline Quaternion<Type>::Quaternion( Vector3<Axis> axis, Type angle ) const Type sina( std::sin( angle*Type(0.5) ) ); const Type cosa( std::cos( angle*Type(0.5) ) ); - auto invAxisLength = real_t(1) / axisLength; + auto invAxisLength = 1_r / axisLength; axis *= invAxisLength; v_[0] = cosa; diff --git a/src/core/math/Random.h b/src/core/math/Random.h index d63d2e7e..0bcc4466 100644 --- a/src/core/math/Random.h +++ b/src/core/math/Random.h @@ -193,7 +193,7 @@ private: inline bool boolRandom() { ///< Randomly returns 'true' or 'false' - return realRandom<real_t>() >= real_t(0.5); + return realRandom<real_t>() >= 0.5_r; } diff --git a/src/core/math/Sample.cpp b/src/core/math/Sample.cpp index eabe897c..1e33b53b 100644 --- a/src/core/math/Sample.cpp +++ b/src/core/math/Sample.cpp @@ -187,7 +187,7 @@ real_t Sample::mad() const real_t upperMedian = *upperMedianPosition; real_t lowerMedian = *std::max_element( deviations.begin(), upperMedianPosition ); - return ( lowerMedian + upperMedian ) / real_t(2); + return ( lowerMedian + upperMedian ) / 2_r; } } @@ -204,7 +204,7 @@ real_t Sample::mad() const real_t Sample::giniCoefficient() const { WALBERLA_ASSERT_GREATER( size(), 1LU ); - WALBERLA_ASSERT_GREATER( mean(), real_t(0) ); + WALBERLA_ASSERT_GREATER( mean(), 0_r ); real_t sum0 = 0; real_t sum1 = 0; @@ -217,7 +217,7 @@ real_t Sample::giniCoefficient() const } const real_t theSize = real_c( size() ); - return real_t(1) - ( real_t(2) / ( theSize - real_t(1) ) ) * ( theSize - sum0 / sum1 ); + return 1_r - ( 2_r / ( theSize - 1_r ) ) * ( theSize - sum0 / sum1 ); } /*******************************************************************************************************************//** diff --git a/src/core/math/Utility.h b/src/core/math/Utility.h index 198cd4c7..7587e53f 100644 --- a/src/core/math/Utility.h +++ b/src/core/math/Utility.h @@ -371,7 +371,7 @@ inline bool equal( T1 a, T2 b ) */ inline real_t round( real_t a ) { - return std::floor( a + real_t(0.5) ); + return std::floor( a + 0.5_r ); } //********************************************************************************************************************** diff --git a/src/core/timing/Time.h b/src/core/timing/Time.h index 374a49f0..d05aa263 100644 --- a/src/core/timing/Time.h +++ b/src/core/timing/Time.h @@ -107,7 +107,7 @@ inline std::string timeToString(real_t time) time -= tmp * sPerMin; } - result << std::floor(time + real_t(0.5)) << "s "; + result << std::floor(time + 0.5_r) << "s "; return result.str(); } diff --git a/src/domain_decomposition/MapPointToPeriodicDomain.cpp b/src/domain_decomposition/MapPointToPeriodicDomain.cpp index 1c86e736..ea3837e0 100644 --- a/src/domain_decomposition/MapPointToPeriodicDomain.cpp +++ b/src/domain_decomposition/MapPointToPeriodicDomain.cpp @@ -37,7 +37,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB if( x < domain.xMin() ) { real_t shift = ( domain.xMin() - x ) - ( std::floor( ( domain.xMin() - x ) / domainSize ) * domainSize ); - shift = std::max( shift, real_t(0) ); + shift = std::max( shift, 0_r ); x = domain.xMax() - shift; if( isIdentical( x, domain.xMax() ) || x < domain.xMin() ) x = std::nextafter(domain.xMax(), domain.xMin()); @@ -45,7 +45,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB else if( x >= domain.xMax() ) { real_t shift = ( x - domain.xMax() ) - ( std::floor( ( x - domain.xMax() ) / domainSize ) * domainSize ); - shift = std::max( shift, real_t(0) ); + shift = std::max( shift, 0_r ); x = domain.xMin() + shift; if( x >= domain.xMax() ) x = domain.xMin(); @@ -58,7 +58,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB if( y < domain.yMin() ) { real_t shift = ( domain.yMin() - y ) - ( std::floor( ( domain.yMin() - y ) / domainSize ) * domainSize ); - shift = std::max( shift, real_t(0) ); + shift = std::max( shift, 0_r ); y = domain.yMax() - shift; if( isIdentical( y, domain.yMax() ) || y < domain.yMin() ) y = std::nextafter(domain.yMax(), domain.yMin()); @@ -66,7 +66,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB else if( y >= domain.yMax() ) { real_t shift = ( y - domain.yMax() ) - ( std::floor( ( y - domain.yMax() ) / domainSize ) * domainSize ); - shift = std::max( shift, real_t(0) ); + shift = std::max( shift, 0_r ); y = domain.yMin() + shift; if( y >= domain.yMax() ) y = domain.yMin(); @@ -79,7 +79,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB if( z < domain.zMin() ) { real_t shift = ( domain.zMin() - z ) - ( std::floor( ( domain.zMin() - z ) / domainSize ) * domainSize ); - shift = std::max( shift, real_t(0) ); + shift = std::max( shift, 0_r ); z = domain.zMax() - shift; if( isIdentical( z, domain.zMax() ) || z < domain.zMin() ) z = std::nextafter(domain.zMax(), domain.zMin()); @@ -87,7 +87,7 @@ void mapPointToPeriodicDomain( const std::array< bool, 3 > & periodic, const AAB else if( z >= domain.zMax() ) { real_t shift = ( z - domain.zMax() ) - ( std::floor( ( z - domain.zMax() ) / domainSize ) * domainSize ); - shift = std::max( shift, real_t(0) ); + shift = std::max( shift, 0_r ); z = domain.zMin() + shift; if( z >= domain.zMax() ) z = domain.zMin(); diff --git a/src/domain_decomposition/PeriodicIntersectionVolume.cpp b/src/domain_decomposition/PeriodicIntersectionVolume.cpp index ac61fc47..d8805965 100644 --- a/src/domain_decomposition/PeriodicIntersectionVolume.cpp +++ b/src/domain_decomposition/PeriodicIntersectionVolume.cpp @@ -27,7 +27,7 @@ namespace domain_decomposition { real_t periodicIntersectionVolume( const std::array< bool, 3 > & periodic, const math::AABB & domain, const math::AABB & box1, const math::AABB & box2 ) { const auto diagonal = (domain.maxCorner() - domain.minCorner()); - const auto halfDiagonal = real_t(0.5) * diagonal; + const auto halfDiagonal = 0.5_r * diagonal; const auto center1 = box1.center(); auto center2 = box2.center(); diff --git a/src/field/AccuracyEvaluation.h b/src/field/AccuracyEvaluation.h index 4f6e4017..a31d6bcb 100644 --- a/src/field/AccuracyEvaluation.h +++ b/src/field/AccuracyEvaluation.h @@ -146,7 +146,7 @@ public: const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : blocks_( blocks ), fieldId_( fieldId ), solution_( solution ), filter_( filter ), executionCounter_( uint_t(0) ), plotFrequency_( plotFrequency ), logFrequency_( logFrequency ), - filename_( internal::accuracyEvaluationFilename ), normalizationFactor_( real_t(1) ), + filename_( internal::accuracyEvaluationFilename ), normalizationFactor_( 1_r ), requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors ) {} @@ -157,8 +157,8 @@ public: const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : blocks_( blocks ), fieldId_( fieldId ), solution_( solution ), filter_( Filter_T() ), executionCounter_( uint_t(0) ), plotFrequency_( plotFrequency ), logFrequency_( logFrequency ), - filename_( internal::accuracyEvaluationFilename ), normalizationFactor_( real_t(1) ), - L1_( real_t(0) ), L2_( real_t(0) ), Lmax_( real_t(0) ), + filename_( internal::accuracyEvaluationFilename ), normalizationFactor_( 1_r ), + L1_( 0_r ), L2_( 0_r ), Lmax_( 0_r ), requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors ) { static_assert( (boost::is_same< Filter_T, DefaultEvaluationFilter >::value), @@ -221,9 +221,9 @@ void AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::operator()() const auto & domainAABB = blocks->getDomain(); - real_t _L1( real_t(0) ); - real_t _L2( real_t(0) ); - real_t _Lmax( real_t(0) ); + real_t _L1( 0_r ); + real_t _L2( 0_r ); + real_t _Lmax( 0_r ); for( auto block = blocks->begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks->end(); ++block ) { @@ -236,7 +236,7 @@ void AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::operator()() #ifdef _OPENMP - std::vector< real_t > lmax( numeric_cast<size_t>( omp_get_max_threads() ), real_t(0) ); + std::vector< real_t > lmax( numeric_cast<size_t>( omp_get_max_threads() ), 0_r ); #pragma omp parallel { diff --git a/src/field/AccuracyEvaluationLinePlot.h b/src/field/AccuracyEvaluationLinePlot.h index d2c1fcbe..b691b4c5 100644 --- a/src/field/AccuracyEvaluationLinePlot.h +++ b/src/field/AccuracyEvaluationLinePlot.h @@ -202,7 +202,7 @@ public: const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : blocks_( blocks ), fieldId_( fieldId ), solution_( solution ), filter_( filter ), yAxis_( yAxis ), - relLinePoint_( Vector3<real_t>( real_c(0.5) ) ), normalizationFactor_( real_t(1) ), + relLinePoint_( Vector3<real_t>( real_c(0.5) ) ), normalizationFactor_( 1_r ), requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors ) { auto _blocks = blocks_.lock(); @@ -215,7 +215,7 @@ public: const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : blocks_( blocks ), fieldId_( fieldId ), solution_( solution ), filter_( Filter_T() ), yAxis_( yAxis ), - relLinePoint_( Vector3<real_t>( real_c(0.5) ) ), normalizationFactor_( real_t(1) ), + relLinePoint_( Vector3<real_t>( real_c(0.5) ) ), normalizationFactor_( 1_r ), requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors ) { static_assert( (boost::is_same< Filter_T, DefaultEvaluationFilter >::value), @@ -469,7 +469,7 @@ inline void accuracyEvaluationLinePlotConfigParser( const shared_ptr< Config > & #define WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_LINE_PLOT_CONFIG_PARSER( config ) \ bool defaultYAxis( true ); \ Vector3<real_t> defaultRelLinePoint( real_c(0.5) ); \ - real_t defaultNormalizationFactor( real_t(1) ); \ + real_t defaultNormalizationFactor( 1_r ); \ auto _blocks = blocks.lock(); \ WALBERLA_CHECK_NOT_NULLPTR( _blocks, "Trying to execute 'makeAccuracyEvaluationLinePlot' for a block storage object that doesn't exist anymore" ); \ math::AABB defaultDomainNormalization( _blocks->getDomain() ); \ diff --git a/src/field/MassEvaluation.h b/src/field/MassEvaluation.h index 3d822875..ab46d568 100644 --- a/src/field/MassEvaluation.h +++ b/src/field/MassEvaluation.h @@ -135,7 +135,7 @@ public: blocks_( blocks ), filter_( filter ), executionCounter_( uint_c(0) ), plotFrequency_( plotFrequency ), logFrequency_( logFrequency ), filename_( filename ), fieldId_( fieldId ), - initialMass_( real_t(0) ), minMass_( real_t(0) ), maxMass_( real_t(0) ), + initialMass_( 0_r ), minMass_( 0_r ), maxMass_( 0_r ), requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors ) { auto _blocks = blocks.lock(); @@ -152,7 +152,7 @@ public: blocks_( blocks ), filter_( Filter_T() ), executionCounter_( uint_c(0) ), plotFrequency_( plotFrequency ), logFrequency_( logFrequency ), filename_( filename ), fieldId_( fieldId ), - initialMass_( real_t(0) ), minMass_( real_t(0) ), maxMass_( real_t(0) ), + initialMass_( 0_r ), minMass_( 0_r ), maxMass_( 0_r ), requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors ) { static_assert( (boost::is_same< Filter_T, DefaultEvaluationFilter >::value), @@ -209,7 +209,7 @@ void MassEvaluation< DensityField_T, Filter_T, Pseudo2D >::operator()() if( !log && !plot ) return; - real_t mass( real_t(0) ); + real_t mass( 0_r ); auto blocks = blocks_.lock(); WALBERLA_CHECK_NOT_NULLPTR( blocks, "Trying to access 'MassEvaluation' for a block storage object that doesn't exist anymore" ); diff --git a/src/field/VolumetricFlowRateEvaluation.h b/src/field/VolumetricFlowRateEvaluation.h index 1763ea0e..ed67be33 100644 --- a/src/field/VolumetricFlowRateEvaluation.h +++ b/src/field/VolumetricFlowRateEvaluation.h @@ -51,7 +51,7 @@ typedef std::function< real_t () > FlowRateSolution_T; typedef std::function< Vector3< real_t > ( const Vector3< real_t > & ) > FlowRateVelocitySolution_T; const std::string volumetricFlowRateEvaluationFilename("flowrate.dat"); -const real_t volumetricFlowRateEvaluationNormalization( real_t(1) ); +const real_t volumetricFlowRateEvaluationNormalization( 1_r ); const Vector3<bool> volumetricFlowRateEvaluationAxis( Vector3<bool>( true, false, false ) ); const Vector3<real_t> volumetricFlowRateEvaluationPoint( Vector3<real_t>( real_c(0.5) ) ); @@ -164,7 +164,7 @@ public: filename_( internal::volumetricFlowRateEvaluationFilename ), normalizationFactor_( internal::volumetricFlowRateEvaluationNormalization ), axis_( internal::volumetricFlowRateEvaluationAxis ), surfacePoint_( internal::volumetricFlowRateEvaluationPoint ), - flowRate_( real_t(0) ), velocitySolutionFlowRate_( real_t(0) ), + flowRate_( 0_r ), velocitySolutionFlowRate_( 0_r ), requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors ) { auto _blocks = blocks.lock(); @@ -183,7 +183,7 @@ public: filename_( internal::volumetricFlowRateEvaluationFilename ), normalizationFactor_( internal::volumetricFlowRateEvaluationNormalization ), axis_( internal::volumetricFlowRateEvaluationAxis ), surfacePoint_( internal::volumetricFlowRateEvaluationPoint ), - flowRate_( real_t(0) ), velocitySolutionFlowRate_( real_t(0) ), + flowRate_( 0_r ), velocitySolutionFlowRate_( 0_r ), requiredSelectors_(requiredSelectors), incompatibleSelectors_( incompatibleSelectors ) { static_assert( (boost::is_same< Filter_T, DefaultEvaluationFilter >::value), @@ -206,7 +206,7 @@ public: real_t solution() const { if( !solution_ ) - return real_t(0); + return 0_r; auto blocks = blocks_.lock(); WALBERLA_CHECK_NOT_NULLPTR( blocks, "Trying to access 'VolumetricFlowRateEvaluation' for a block storage object that doesn't exist anymore" ); @@ -287,8 +287,8 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()() sp[1] += surfacePoint_[1] * domainAABB.ySize(); sp[2] += surfacePoint_[2] * domainAABB.zSize(); - real_t _flowRate( real_t(0) ); - real_t _velocitySolutionFlowRate( real_t(0) ); + real_t _flowRate( 0_r ); + real_t _velocitySolutionFlowRate( 0_r ); for( auto block = blocks->begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks->end(); ++block ) { @@ -468,8 +468,8 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()() { std::ofstream file( filename_.c_str(), std::ofstream::out | std::ofstream::app ); file << ( executionCounter_ - uint_t(1) ) << " " << flowRate_ << " " << velocitySolutionFlowRate_ << " " << _solution << " " - << ( isIdentical( velocitySolutionFlowRate_, real_t(0) ) ? real_t(0) : std::abs( ( flowRate_ - velocitySolutionFlowRate_ ) / velocitySolutionFlowRate_ ) ) << " " - << ( isIdentical( _solution, real_t(0) ) ? real_t(0) : std::abs( ( flowRate_ - _solution ) / _solution ) ) << std::endl; + << ( isIdentical( velocitySolutionFlowRate_, 0_r ) ? 0_r : std::abs( ( flowRate_ - velocitySolutionFlowRate_ ) / velocitySolutionFlowRate_ ) ) << " " + << ( isIdentical( _solution, 0_r ) ? 0_r : std::abs( ( flowRate_ - _solution ) / _solution ) ) << std::endl; file.close(); } } diff --git a/src/field/blockforest/GradientRefinement.h b/src/field/blockforest/GradientRefinement.h index b05b8d1d..313c122d 100644 --- a/src/field/blockforest/GradientRefinement.h +++ b/src/field/blockforest/GradientRefinement.h @@ -109,7 +109,7 @@ void GradientRefinement< VectorField_T, Filter_T, Pseudo2D >::operator()( std::v real_t gradient[gradients]; for( int i = 0; i < gradients; ++i ) - gradient[i] = real_t(0); + gradient[i] = 0_r; if( innerInterval.contains(x,y,z) ) { @@ -184,7 +184,7 @@ void GradientRefinement< VectorField_T, Filter_T, Pseudo2D >::operator()( std::v } } - real_t magnitute( real_t(0) ); + real_t magnitute( 0_r ); for( int i = 0; i < gradients; ++i ) magnitute += gradient[i]; diff --git a/src/field/distributors/KernelDistributor.h b/src/field/distributors/KernelDistributor.h index 1aed2f2e..38b62680 100644 --- a/src/field/distributors/KernelDistributor.h +++ b/src/field/distributors/KernelDistributor.h @@ -92,11 +92,11 @@ public: centerCell[0] + cell_idx_c(neighborhoodSize), centerCell[1] + cell_idx_c(neighborhoodSize), centerCell[2] + cell_idx_c(neighborhoodSize) ); const uint_t kernelSizeOneDirection = uint_t(2) * neighborhoodSize + uint_t(1); - std::vector<real_t> weights( kernelSizeOneDirection * kernelSizeOneDirection * kernelSizeOneDirection, real_t(0) ); + std::vector<real_t> weights( kernelSizeOneDirection * kernelSizeOneDirection * kernelSizeOneDirection, 0_r ); uint_t counter = uint_t(0); - real_t sumOfWeights = real_t(0); - real_t sumOfWeightsUnavailable = real_t(0); + real_t sumOfWeights = 0_r; + real_t sumOfWeightsUnavailable = 0_r; // get distribution weights and count available cells in surrounding cells for( auto cellIt = cellNeighborhood.begin(); cellIt != cellNeighborhood.end(); ++cellIt ) @@ -109,24 +109,24 @@ public: } else { - weights[counter] = real_t(0); + weights[counter] = 0_r; sumOfWeightsUnavailable += kernelweights::kernelWeightFunction( x, y, z, curCellCenter[0], curCellCenter[1], curCellCenter[2], dx, dy, dz ); } ++counter; } // check if at least one cell was available, to prevent division by 0 - if( sumOfWeights <= real_t(0) ) + if( sumOfWeights <= 0_r ) return; // scale domain weights if some non-domain cells are in neighborhood - const real_t scalingFactor = real_t(1) + sumOfWeightsUnavailable / sumOfWeights; + const real_t scalingFactor = 1_r + sumOfWeightsUnavailable / sumOfWeights; // distribute the values to the neighboring domain cells with the corresponding (scaled) weighting counter = uint_t(0); for( auto cellIt = cellNeighborhood.begin(); cellIt != cellNeighborhood.end(); ++cellIt ) { - if ( weights[counter] > real_t(0) ) + if ( weights[counter] > 0_r ) { addWeightedCellValue( distributeValueBegin, *cellIt, scalingFactor * weights[counter] ); } diff --git a/src/field/interpolators/KernelFieldInterpolator.h b/src/field/interpolators/KernelFieldInterpolator.h index 50dfde0f..a96d433b 100644 --- a/src/field/interpolators/KernelFieldInterpolator.h +++ b/src/field/interpolators/KernelFieldInterpolator.h @@ -43,32 +43,32 @@ namespace kernelweights inline real_t smoothedDeltaFunction( const real_t & r ) { real_t rAbs = std::fabs(r); - if( rAbs <= real_t(0.5) ) + if( rAbs <= 0.5_r ) { - return (real_t(1) + std::sqrt( - real_t(3) * r * r + real_t(1) ) ) * (real_t(1) / real_t(3)); - } else if ( rAbs < real_t(1.5) ) + return (1_r + std::sqrt( - 3_r * r * r + 1_r ) ) * (1_r / 3_r); + } else if ( rAbs < 1.5_r ) { - return (real_t(5) - real_t(3) * rAbs - std::sqrt( - real_t(3) * ( real_t(1) - rAbs ) * ( real_t(1) - rAbs ) + real_t(1) ) ) * ( real_t(1) / real_t(6) ); + return (5_r - 3_r * rAbs - std::sqrt( - 3_r * ( 1_r - rAbs ) * ( 1_r - rAbs ) + 1_r ) ) * ( 1_r / 6_r ); } else { - return real_t(0); + return 0_r; } } // X: Lagrangian position, x: Eulerian position (usually cell center), global coordinates // dx, dy, dz: mesh spacing -inline real_t kernelWeightFunction( const real_t & X, const real_t & Y, const real_t & Z, - const real_t & x, const real_t & y, const real_t & z, - const real_t & dx = real_t(1), const real_t & dy = real_t(1), const real_t & dz = real_t(1) ) +real_t kernelWeightFunction( const real_t & X, const real_t & Y, const real_t & Z, + const real_t & x, const real_t & y, const real_t & z, + const real_t & dx = 1_r, const real_t & dy = 1_r, const real_t & dz = 1_r ) { return smoothedDeltaFunction( ( X - x ) / dx ) * smoothedDeltaFunction( ( Y - y ) / dy ) * smoothedDeltaFunction( ( Z - z ) / dz ); } // X: Lagrangian position, x: Eulerian position (usually cell center), global coordinates // dx, dy, dz: mesh spacing -inline real_t kernelWeightFunction( const Vector3<real_t> & X, const Vector3<real_t> & x, - const real_t & dx = real_t(1), const real_t & dy = real_t(1), const real_t & dz = real_t(1) ) +real_t kernelWeightFunction( const Vector3<real_t> & X, const Vector3<real_t> & x, + const real_t & dx = 1_r, const real_t & dy = 1_r, const real_t & dz = 1_r ) { return smoothedDeltaFunction( ( X[0] - x[0] ) / dx ) * smoothedDeltaFunction( ( X[1] - x[1] ) / dy ) * smoothedDeltaFunction( ( X[2] - x[2] ) / dz ); } @@ -137,10 +137,10 @@ public: const uint_t kernelSizeOneDirection = uint_t(2) * neighborhoodSize + uint_t(1); // store the calculated weighting factors of the available cells, i.e. cells flagged by the evaluation mask - std::vector<real_t> weights( kernelSizeOneDirection * kernelSizeOneDirection * kernelSizeOneDirection, real_t(0) ); + std::vector<real_t> weights( kernelSizeOneDirection * kernelSizeOneDirection * kernelSizeOneDirection, 0_r ); // store the calculated weighting factors of the UNavailable cells, i.e. cells not included in the evaluation mask - std::vector<real_t> weightsUnavailable( kernelSizeOneDirection * kernelSizeOneDirection * kernelSizeOneDirection, real_t(0) ); + std::vector<real_t> weightsUnavailable( kernelSizeOneDirection * kernelSizeOneDirection * kernelSizeOneDirection, 0_r ); cell_idx_t cellIdx0x = cellNeighborhood.xMin(); cell_idx_t cellIdx0y = cellNeighborhood.yMin(); @@ -183,46 +183,46 @@ public: int j = cy + 1; int k = cz + 1; - if( weightsUnavailable[k*nxy+j*nx+i] > real_t(0) ) + if( weightsUnavailable[k*nxy+j*nx+i] > 0_r ) { // check if we can distribute the non-fluid weight to nearby fluid weights that lie in one line inside the neighborhood // it should generally not matter in which direction it is distributed // check x direction - if( weights[k*nxy+j*nx+i-cx] > real_t(0) && weights[k*nxy+j*nx+i-2*cx] > real_t(0) ) + if( weights[k*nxy+j*nx+i-cx] > 0_r && weights[k*nxy+j*nx+i-2*cx] > 0_r ) { - weights[k*nxy+j*nx+i-cx] += real_t(2)*weightsUnavailable[k*nxy+j*nx+i]; + weights[k*nxy+j*nx+i-cx] += 2_r*weightsUnavailable[k*nxy+j*nx+i]; weights[k*nxy+j*nx+i-2*cx] -= weightsUnavailable[k*nxy+j*nx+i]; - weightsUnavailable[k*nxy+j*nx+i] = real_t(0); + weightsUnavailable[k*nxy+j*nx+i] = 0_r; continue; } // check y direction - if( weights[k*nxy+(j-cy)*nx+i] > real_t(0) && weights[k*nxy+(j-2*cy)*nx+i] > real_t(0) ) + if( weights[k*nxy+(j-cy)*nx+i] > 0_r && weights[k*nxy+(j-2*cy)*nx+i] > 0_r ) { - weights[k*nxy+(j-cy)*nx+i] += real_t(2)*weightsUnavailable[k*nxy+j*nx+i]; + weights[k*nxy+(j-cy)*nx+i] += 2_r*weightsUnavailable[k*nxy+j*nx+i]; weights[k*nxy+(j-2*cy)*nx+i] -= weightsUnavailable[k*nxy+j*nx+i]; - weightsUnavailable[k*nxy+j*nx+i] = real_t(0); + weightsUnavailable[k*nxy+j*nx+i] = 0_r; continue; } // check z direction - if( weights[(k-cz)*nxy+j*nx+i] > real_t(0) && weights[(k-2*cz)*nxy+j*nx+i] > real_t(0) ) + if( weights[(k-cz)*nxy+j*nx+i] > 0_r && weights[(k-2*cz)*nxy+j*nx+i] > 0_r ) { - weights[(k-cz)*nxy+j*nx+i] += real_t(2)*weightsUnavailable[k*nxy+j*nx+i]; + weights[(k-cz)*nxy+j*nx+i] += 2_r*weightsUnavailable[k*nxy+j*nx+i]; weights[(k-2*cz)*nxy+j*nx+i] -= weightsUnavailable[k*nxy+j*nx+i]; - weightsUnavailable[k*nxy+j*nx+i] = real_t(0); + weightsUnavailable[k*nxy+j*nx+i] = 0_r; continue; } } } */ // scale available weights by the total amount of unavailable weights such that afterwards sum over all weights is 1 - const real_t sumOfWeightsUnavailable = std::accumulate(weightsUnavailable.begin(), weightsUnavailable.end(), real_t(0) ); - const real_t sumOfWeights = std::accumulate(weights.begin(), weights.end(), real_t(0) ); + const real_t sumOfWeightsUnavailable = std::accumulate(weightsUnavailable.begin(), weightsUnavailable.end(), 0_r ); + const real_t sumOfWeights = std::accumulate(weights.begin(), weights.end(), 0_r ); // check if at least one cell was available, to prevent division by 0 - if( sumOfWeights <= real_t(0) ) + if( sumOfWeights <= 0_r ) return; - const real_t scalingFactor = real_t(1) + sumOfWeightsUnavailable / sumOfWeights; + const real_t scalingFactor = 1_r + sumOfWeightsUnavailable / sumOfWeights; for( auto weightIt = weights.begin(); weightIt != weights.end(); ++weightIt ) { @@ -237,7 +237,7 @@ public: { for( uint_t i = uint_t(0); i < kernelSizeOneDirection; ++i) { - if ( weights[k*nxy+j*nx+i] > real_t(0) ) + if ( weights[k*nxy+j*nx+i] > 0_r ) { Cell curCell( cellIdx0x + cell_idx_c(i), cellIdx0y + cell_idx_c(j), cellIdx0z + cell_idx_c(k) ); addWeightedCellValue( interpolationResultBegin, curCell, weights[k*nxy+j*nx+i] ); diff --git a/src/field/interpolators/NearestNeighborInterpolator.h b/src/field/interpolators/NearestNeighborInterpolator.h index 0a609dc6..f08ead74 100644 --- a/src/field/interpolators/NearestNeighborInterpolator.h +++ b/src/field/interpolators/NearestNeighborInterpolator.h @@ -75,9 +75,9 @@ namespace field { { WALBERLA_ASSERT( validRegion_.contains( x,y,z ) ); - const cell_idx_t ciX = x < real_t(0) ? cell_idx_c( x - real_t(1) ) : cell_idx_c( x ); - const cell_idx_t ciY = y < real_t(0) ? cell_idx_c( y - real_t(1) ) : cell_idx_c( y ); - const cell_idx_t ciZ = z < real_t(0) ? cell_idx_c( z - real_t(1) ) : cell_idx_c( z ); + const cell_idx_t ciX = x < 0_r ? cell_idx_c( x - 1_r ) : cell_idx_c( x ); + const cell_idx_t ciY = y < 0_r ? cell_idx_c( y - 1_r ) : cell_idx_c( y ); + const cell_idx_t ciZ = z < 0_r ? cell_idx_c( z - 1_r ) : cell_idx_c( z ); return field_.get( ciX, ciY, ciZ, f ); } diff --git a/src/field/interpolators/TrilinearFieldInterpolator.h b/src/field/interpolators/TrilinearFieldInterpolator.h index bdac4ff1..55ab977f 100644 --- a/src/field/interpolators/TrilinearFieldInterpolator.h +++ b/src/field/interpolators/TrilinearFieldInterpolator.h @@ -117,7 +117,7 @@ public: { // trilinear interpolation can be applied - const real_t inv_totalVolume = real_t(1) / ( dx * dy * dz ); + const real_t inv_totalVolume = 1_r / ( dx * dy * dz ); Vector3<real_t> cccCellCenter = blockStorage->getBlockLocalCellCenter( block_, ccc ); // weighting = volume of opposing volume element / total volume diff --git a/src/field/interpolators/TrilinearInterpolator.h b/src/field/interpolators/TrilinearInterpolator.h index 7208e6f6..a2af3840 100644 --- a/src/field/interpolators/TrilinearInterpolator.h +++ b/src/field/interpolators/TrilinearInterpolator.h @@ -65,7 +65,7 @@ namespace field { const CellInterval size = field_.xyzSizeWithGhostLayer(); validRegion_ = AABB( real_c(size.xMin()) + real_c(0.5), real_c(size.yMin()) + real_c(0.5), real_c(size.zMin()) + real_c(0.5), - real_c(size.xMax()) + real_t(1) - real_c(0.5), real_c(size.yMax()) + real_t(1) - real_c(0.5), real_c(size.zMax()) + real_t(1) - real_c(0.5) ); + real_c(size.xMax()) + 1_r - real_c(0.5), real_c(size.yMax()) + 1_r - real_c(0.5), real_c(size.zMax()) + 1_r - real_c(0.5) ); } inline ResType operator()( real_t x, real_t y, real_t z ) const diff --git a/src/geometry/GeometricalFunctions.cpp b/src/geometry/GeometricalFunctions.cpp index 6726e44c..843841a7 100644 --- a/src/geometry/GeometricalFunctions.cpp +++ b/src/geometry/GeometricalFunctions.cpp @@ -86,7 +86,7 @@ void getClosestLineBoxPoints( const Vector3<real_t>& p1, const Vector3<real_t>& sign[2]*( R[2]*tmp[0] + R[5]*tmp[1] + R[8]*tmp[2] ) }; // Calculating the half lengths of the box - const real_t h[] = { real_t(0.5)*side[0], real_t(0.5)*side[1], real_t(0.5)*side[2] }; + const real_t h[] = { 0.5_r*side[0], 0.5_r*side[1], 0.5_r*side[2] }; // Estimating the region of the starting point depending on which side of the @@ -159,13 +159,13 @@ void getClosestLineBoxPoints( const Vector3<real_t>& p1, const Vector3<real_t>& // Finding the t value for the next clip plane/line intersection real_t next_t( 1 ); - if( ( tanchor[0] > t ) && ( tanchor[0] < real_t(1) ) && ( tanchor[0] < next_t ) ) { + if( ( tanchor[0] > t ) && ( tanchor[0] < 1_r ) && ( tanchor[0] < next_t ) ) { next_t = tanchor[0]; } - if( ( tanchor[1] > t ) && ( tanchor[1] < real_t(1) ) && ( tanchor[1] < next_t ) ) { + if( ( tanchor[1] > t ) && ( tanchor[1] < 1_r ) && ( tanchor[1] < next_t ) ) { next_t = tanchor[1]; } - if( ( tanchor[2] > t ) && ( tanchor[2] < real_t(1) ) && ( tanchor[2] < next_t ) ) { + if( ( tanchor[2] > t ) && ( tanchor[2] < 1_r ) && ( tanchor[2] < next_t ) ) { next_t = tanchor[2]; } @@ -205,11 +205,11 @@ void getClosestLineBoxPoints( const Vector3<real_t>& p1, const Vector3<real_t>& t = next_t; dd2dt = next_dd2dt; } - while( t < real_t(1) ); + while( t < 1_r ); } - WALBERLA_ASSERT_GREATER_EQUAL( t, real_t(0), "Invalid line point" ); - WALBERLA_ASSERT_LESS_EQUAL( t, real_t(1), "Invalid line point" ); + WALBERLA_ASSERT_GREATER_EQUAL( t, 0_r, "Invalid line point" ); + WALBERLA_ASSERT_LESS_EQUAL( t, 1_r, "Invalid line point" ); // Computing the closest point on the line lret = p1 + t * l; @@ -347,8 +347,8 @@ void getClosestLineSegmentPoints( const Vector3<real_t>& a1, const Vector3<real_ const real_t scale( a1a2 * b1b2 ); real_t div( la * lb - math::sq(scale) ); - WALBERLA_ASSERT_GREATER( div, real_t(0), std::setprecision(16) << "Invalid division\n" << a1 << "\n" << a2 << "\n" << b1 << "\n" << b2 ); - div = real_t(1) / div; + WALBERLA_ASSERT_GREATER( div, 0_r, std::setprecision(16) << "Invalid division\n" << a1 << "\n" << a2 << "\n" << b1 << "\n" << b2 ); + div = 1_r / div; const real_t s( ( lb * da1 - scale * db1 ) * div ); const real_t t( ( scale * da1 - la * db1 ) * div ); @@ -386,12 +386,12 @@ void intersectLines( const Vector3<real_t>& o1, const Vector3<real_t>& d1, const if( floatIsEqual(sqrlen, 0) ) { - s = real_t(0); - t = real_t(0); + s = 0_r; + t = 0_r; } else { - const real_t isqrlen( real_t(1) / sqrlen ); + const real_t isqrlen( 1_r / sqrlen ); const Vector3<real_t> p( o2 - o1 ); const real_t dot( d1 * d2 ); const real_t a ( d1 * p ); diff --git a/src/geometry/bodies/AABBBody.h b/src/geometry/bodies/AABBBody.h index bf2aed3c..da6323ab 100644 --- a/src/geometry/bodies/AABBBody.h +++ b/src/geometry/bodies/AABBBody.h @@ -32,8 +32,8 @@ namespace geometry { template<> inline real_t overlapFraction ( const AABB & body, const Vector3<real_t> & cellMidpoint, const Vector3<real_t> & dx, uint_t ) { - AABB box = AABB::createFromMinMaxCorner( cellMidpoint[0] - real_t(0.5)*dx[0], cellMidpoint[1] - real_t(0.5)*dx[1], cellMidpoint[2] - real_t(0.5)*dx[2], - cellMidpoint[0] + real_t(0.5)*dx[0], cellMidpoint[1] + real_t(0.5)*dx[1], cellMidpoint[2] + real_t(0.5)*dx[2]); + AABB box = AABB::createFromMinMaxCorner( cellMidpoint[0] - 0.5_r*dx[0], cellMidpoint[1] - 0.5_r*dx[1], cellMidpoint[2] - 0.5_r*dx[2], + cellMidpoint[0] + 0.5_r*dx[0], cellMidpoint[1] + 0.5_r*dx[1], cellMidpoint[2] + 0.5_r*dx[2]); return body.intersectionVolume( box ) / ( dx[0] * dx[1] * dx[2] ); } diff --git a/src/geometry/bodies/BodyFromConfig.cpp b/src/geometry/bodies/BodyFromConfig.cpp index 0b9d1947..70f5c6fd 100644 --- a/src/geometry/bodies/BodyFromConfig.cpp +++ b/src/geometry/bodies/BodyFromConfig.cpp @@ -85,8 +85,8 @@ Ellipsoid ellipsoidFromConfig ( const Config::BlockHandle & block ) Vector3<real_t> radii = block.getParameter<Vector3<real_t> > ( "radii" ); return Ellipsoid( block.getParameter<Vector3<real_t> >( "midpoint" ), - block.getParameter<Vector3<real_t> >( "axis1", Vector3<real_t>( real_t(1),real_t(0),real_t(0) ) ), - block.getParameter<Vector3<real_t> >( "axis2", Vector3<real_t>( real_t(0),real_t(1),real_t(0) ) ), + block.getParameter<Vector3<real_t> >( "axis1", Vector3<real_t>( 1_r,0_r,0_r ) ), + block.getParameter<Vector3<real_t> >( "axis2", Vector3<real_t>( 0_r,1_r,0_r ) ), radii ); } diff --git a/src/geometry/bodies/BodyOverlapFunctions.impl.h b/src/geometry/bodies/BodyOverlapFunctions.impl.h index 19b16da3..8790cab7 100644 --- a/src/geometry/bodies/BodyOverlapFunctions.impl.h +++ b/src/geometry/bodies/BodyOverlapFunctions.impl.h @@ -46,9 +46,9 @@ namespace geometry { { FastOverlapResult r = fastOverlapCheck( body, cellMidpoint, dx ); if ( r == CONTAINED_INSIDE_BODY ) - return real_t(1); + return 1_r; else if ( r == COMPLETELY_OUTSIDE ) - return real_t(0); + return 0_r; uint_t nrCornerPointsInBody(0u); for( int signX = -1; signX <= 1; signX += 2 ) @@ -56,19 +56,19 @@ namespace geometry { for( int signZ = -1; signZ <= 1; signZ += 2 ) { // epsilon is subtracted due to symmetry reasons ( i.e. a sphere on a cell boundary should be symmetric) - const Vector3<real_t> corner( cellMidpoint[0] + real_c(signX) * dx[0] * (real_t(0.5) - real_comparison::Epsilon<real_t>::value ), - cellMidpoint[1] + real_c(signY) * dx[1] * (real_t(0.5) - real_comparison::Epsilon<real_t>::value ), - cellMidpoint[2] + real_c(signZ) * dx[2] * (real_t(0.5) - real_comparison::Epsilon<real_t>::value ) ); + const Vector3<real_t> corner( cellMidpoint[0] + real_c(signX) * dx[0] * (0.5_r - real_comparison::Epsilon<real_t>::value ), + cellMidpoint[1] + real_c(signY) * dx[1] * (0.5_r - real_comparison::Epsilon<real_t>::value ), + cellMidpoint[2] + real_c(signZ) * dx[2] * (0.5_r - real_comparison::Epsilon<real_t>::value ) ); if ( contains( body, corner ) ) ++nrCornerPointsInBody; } if ( nrCornerPointsInBody == uint_t(8u) ) - return real_t(1); + return 1_r; else if ( nrCornerPointsInBody == uint_t(0u) && !contains( body, cellMidpoint ) ) - return real_t(0); + return 0_r; else if ( depth == maxDepth ) - return real_c(nrCornerPointsInBody) * real_t(0.125); + return real_c(nrCornerPointsInBody) * 0.125_r; // Recursive calls for 8 sub-cubes real_t fraction(0); @@ -76,10 +76,10 @@ namespace geometry { for( int signY = -1; signY <= 1; signY += 2 ) for( int signZ = -1; signZ <= 1; signZ += 2 ) { - const Vector3<real_t> offsetVec ( real_c(signX) * real_t(0.25) * dx[0], real_c(signY) * real_t(0.25) * dx[1], real_c(signZ) * real_t(0.25) * dx[2] ); - fraction += cellSupersampling( cellMidpoint + offsetVec, dx*real_t(0.5), body, maxDepth, depth+uint_t(1u) ); + const Vector3<real_t> offsetVec ( real_c(signX) * 0.25_r * dx[0], real_c(signY) * 0.25_r * dx[1], real_c(signZ) * 0.25_r * dx[2] ); + fraction += cellSupersampling( cellMidpoint + offsetVec, dx*0.5_r, body, maxDepth, depth+uint_t(1u) ); } - fraction *= real_t(0.125); + fraction *= 0.125_r; return fraction; } @@ -98,8 +98,8 @@ namespace geometry { if ( maxDepth >= 0 ) return overlapFraction( body, cellMidpoint, dx, uint_c(maxDepth)); if( contains( body, cellMidpoint ) ) - return real_t(1); - return real_t(0); + return 1_r; + return 0_r; } template < typename Body > @@ -107,14 +107,14 @@ namespace geometry { { FastOverlapResult r = fastOverlapCheck( body, cellMidpoint, dx ); if ( r == CONTAINED_INSIDE_BODY ) - return real_t(1); + return 1_r; else if ( r == COMPLETELY_OUTSIDE ) - return real_t(0); + return 0_r; // default: fall-back to super-sampling real_t overlapFractionBySuperSampling = cellSupersampling( cellMidpoint, dx, body, maxDepth ); - WALBERLA_ASSERT_GREATER_EQUAL(overlapFractionBySuperSampling, real_t(0)); - WALBERLA_ASSERT_LESS_EQUAL(overlapFractionBySuperSampling, real_t(1)); + WALBERLA_ASSERT_GREATER_EQUAL(overlapFractionBySuperSampling, 0_r); + WALBERLA_ASSERT_LESS_EQUAL(overlapFractionBySuperSampling, 1_r); return overlapFractionBySuperSampling; } diff --git a/src/geometry/bodies/Cylinder.cpp b/src/geometry/bodies/Cylinder.cpp index 13dbcd94..9d950534 100644 --- a/src/geometry/bodies/Cylinder.cpp +++ b/src/geometry/bodies/Cylinder.cpp @@ -33,11 +33,11 @@ namespace geometry { void Cylinder::update() { - WALBERLA_ASSERT_GREATER( rad_, real_t(0) ); + WALBERLA_ASSERT_GREATER( rad_, 0_r ); dir_ = end_ - start_; len_ = dir_.length(); - WALBERLA_ASSERT_GREATER( len_, real_t(1e-16) ); + WALBERLA_ASSERT_GREATER( len_, 1e-16_r ); math::normalize(dir_); boundingBox_.initMinMaxCorner( std::min( start_[0], end_[0] ) - rad_, @@ -68,7 +68,7 @@ namespace geometry { const real_t ps = ( point - cyl.start() ) * cyl.dir(); // before start point or after end point - if( ps < real_t(0) || ps > cyl.length() ) + if( ps < 0_r || ps > cyl.length() ) return false; // outside radius diff --git a/src/geometry/bodies/Ellipsoid.cpp b/src/geometry/bodies/Ellipsoid.cpp index bf6727ab..67493e00 100644 --- a/src/geometry/bodies/Ellipsoid.cpp +++ b/src/geometry/bodies/Ellipsoid.cpp @@ -46,9 +46,9 @@ namespace geometry { } Matrix3<real_t> diagonalMatrix ( 0.0 ); - diagonalMatrix(0,0) = real_t(1) / ( radii_[0] * radii_[0] ); - diagonalMatrix(1,1) = real_t(1) / ( radii_[1] * radii_[1] ); - diagonalMatrix(2,2) = real_t(1) / ( radii_[2] * radii_[2] ); + diagonalMatrix(0,0) = 1_r / ( radii_[0] * radii_[0] ); + diagonalMatrix(1,1) = 1_r / ( radii_[1] * radii_[1] ); + diagonalMatrix(2,2) = 1_r / ( radii_[2] * radii_[2] ); mat_ = rotationMatrix_ * diagonalMatrix * rotationMatrix_.getTranspose() ; @@ -101,15 +101,15 @@ namespace geometry { template<> FastOverlapResult fastOverlapCheck ( const Ellipsoid & ellipsoid, const Vector3<real_t> & cellMidpoint, const Vector3<real_t> & dx ) { - AABB box = AABB::createFromMinMaxCorner( cellMidpoint[0] - real_t(0.5)*dx[0], cellMidpoint[1] - real_t(0.5)*dx[1], cellMidpoint[2] - real_t(0.5)*dx[2], - cellMidpoint[0] + real_t(0.5)*dx[0], cellMidpoint[1] + real_t(0.5)*dx[1], cellMidpoint[2] + real_t(0.5)*dx[2]); + AABB box = AABB::createFromMinMaxCorner( cellMidpoint[0] - 0.5_r*dx[0], cellMidpoint[1] - 0.5_r*dx[1], cellMidpoint[2] - 0.5_r*dx[2], + cellMidpoint[0] + 0.5_r*dx[0], cellMidpoint[1] + 0.5_r*dx[1], cellMidpoint[2] + 0.5_r*dx[2]); if ( ! ellipsoid.boundingBox().intersects( box ) ) return COMPLETELY_OUTSIDE; // Check against inner circle - static const real_t sqrt3half = std::sqrt( real_t(3) ) / real_t(2); + static const real_t sqrt3half = std::sqrt( 3_r ) / 2_r; const real_t midPointDistSq = (ellipsoid.midpoint() - cellMidpoint).sqrLength(); diff --git a/src/geometry/bodies/Sphere.cpp b/src/geometry/bodies/Sphere.cpp index f7fc0dce..750405bd 100644 --- a/src/geometry/bodies/Sphere.cpp +++ b/src/geometry/bodies/Sphere.cpp @@ -34,7 +34,7 @@ namespace geometry { void Sphere::updateBoxes() { - static const real_t oneOverSqrt3 = real_t(1) / std::sqrt( real_t(3) ); + static const real_t oneOverSqrt3 = 1_r / std::sqrt( 3_r ); boundingBox_ = AABB::createFromMinMaxCorner( midpoint_[0] - radius_, midpoint_[1] - radius_, midpoint_[2] - radius_, midpoint_[0] + radius_, midpoint_[1] + radius_, midpoint_[2] + radius_ ); @@ -65,7 +65,7 @@ namespace geometry { template<> FastOverlapResult fastOverlapCheck ( const Sphere & sphere, const Vector3<real_t> & cellMidpoint, const Vector3<real_t> & dx ) { - static const real_t sqrt3half = std::sqrt( real_t(3) ) / real_t(2); + static const real_t sqrt3half = std::sqrt( 3_r ) / 2_r; const real_t midPointDistSq = (sphere.midpoint() - cellMidpoint).sqrLength(); diff --git a/src/geometry/bodies/Torus.cpp b/src/geometry/bodies/Torus.cpp index 1c744840..7658e795 100644 --- a/src/geometry/bodies/Torus.cpp +++ b/src/geometry/bodies/Torus.cpp @@ -33,9 +33,9 @@ namespace geometry { void Torus::update() { - WALBERLA_ASSERT_GREATER( distnc_, real_t(0) ); + WALBERLA_ASSERT_GREATER( distnc_, 0_r ); WALBERLA_ASSERT_GREATER( radius_, distnc_ ); - WALBERLA_ASSERT_GREATER( normal_.sqrLength(), real_t(1e-16) ); + WALBERLA_ASSERT_GREATER( normal_.sqrLength(), 1e-16_r ); math::normalize( normal_ ); math::normals( normal_, defTan_, comTan_ ); @@ -65,7 +65,7 @@ namespace geometry { { const auto dir = point - torus.midPnt(); const auto tan = (dir*torus.defTan())*torus.defTan() + (dir*torus.comTan())*torus.comTan(); - if( tan.sqrLength() < real_t(1e-16) ) + if( tan.sqrLength() < 1e-16_r ) return false; const auto pnt = torus.midPnt() + tan.getNormalized()*torus.radius(); const auto len = ( pnt - point ).sqrLength(); diff --git a/src/geometry/initializer/BoundaryFromBody.impl.h b/src/geometry/initializer/BoundaryFromBody.impl.h index cbbdc26b..f5098075 100644 --- a/src/geometry/initializer/BoundaryFromBody.impl.h +++ b/src/geometry/initializer/BoundaryFromBody.impl.h @@ -90,7 +90,7 @@ void BoundaryFromBody<BoundaryHandlerT>::init( const Body & body, BoundarySetter structuredBlockStorage_.getBlockLocalCellAABB( *block, ff->beginWithGhostLayer().cell(), firstCellBB ); Vector3<real_t> firstCellMidpoint; for( uint_t i = 0; i < 3; ++i ) - firstCellMidpoint[i] = firstCellBB.min(i) + real_t(0.5) * firstCellBB.size(i); + firstCellMidpoint[i] = firstCellBB.min(i) + 0.5_r * firstCellBB.size(i); Vector3<real_t> currentMidpoint; currentMidpoint[2] = firstCellMidpoint[2]; diff --git a/src/geometry/initializer/OverlapFieldFromBody.cpp b/src/geometry/initializer/OverlapFieldFromBody.cpp index 457fc2cb..01de97a9 100644 --- a/src/geometry/initializer/OverlapFieldFromBody.cpp +++ b/src/geometry/initializer/OverlapFieldFromBody.cpp @@ -62,11 +62,11 @@ namespace initializer { if ( initialFill == addKeyword_ ) { for( auto blockIt = structuredBlockStorage_.begin(); blockIt != structuredBlockStorage_.end(); ++blockIt ) - blockIt->getData<GhostLayerField<real_t,1> > ( scalarFieldID_ )->setWithGhostLayer( real_t(1.0) ); + blockIt->getData<GhostLayerField<real_t,1> > ( scalarFieldID_ )->setWithGhostLayer( 1.0_r ); } else if ( initialFill == subtractKeyword_ ) { for( auto blockIt = structuredBlockStorage_.begin(); blockIt != structuredBlockStorage_.end(); ++blockIt ) - blockIt->getData<GhostLayerField<real_t,1> > ( scalarFieldID_ )->setWithGhostLayer( real_t(0.0) ); + blockIt->getData<GhostLayerField<real_t,1> > ( scalarFieldID_ )->setWithGhostLayer( 0.0_r ); } else { WALBERLA_ABORT("Unknown value of initialFill. Valid values are " << addKeyword_ << "," << subtractKeyword_ ); diff --git a/src/geometry/initializer/OverlapFieldFromBody.h b/src/geometry/initializer/OverlapFieldFromBody.h index 3671049a..c40ad863 100644 --- a/src/geometry/initializer/OverlapFieldFromBody.h +++ b/src/geometry/initializer/OverlapFieldFromBody.h @@ -159,7 +159,7 @@ namespace initializer { structuredBlockStorage_.getBlockLocalCellAABB( *block, ff->beginWithGhostLayer().cell(), firstCellBB ); Vector3<real_t> firstCellMidpoint; for( uint_t i = 0; i < 3; ++i ) - firstCellMidpoint[i] = firstCellBB.min(i) + real_t(0.5) * firstCellBB.size(i); + firstCellMidpoint[i] = firstCellBB.min(i) + 0.5_r * firstCellBB.size(i); Vector3<real_t> currentMidpoint; currentMidpoint[2] = firstCellMidpoint[2]; @@ -177,11 +177,11 @@ namespace initializer { if ( addOrSubtract ) { val += overlap; - val = std::min( val, real_t(1) ); + val = std::min( val, 1_r ); } else { val -= overlap; - val = std::max( val, real_t(0) ); + val = std::max( val, 0_r ); } } diff --git a/src/geometry/initializer/ScalarFieldFromBody.impl.h b/src/geometry/initializer/ScalarFieldFromBody.impl.h index 98b6d2a1..a45f9951 100644 --- a/src/geometry/initializer/ScalarFieldFromBody.impl.h +++ b/src/geometry/initializer/ScalarFieldFromBody.impl.h @@ -108,7 +108,7 @@ namespace initializer { structuredBlockStorage_.getBlockLocalCellAABB( *block, ff->beginWithGhostLayer().cell(), firstCellBB ); Vector3<real_t> firstCellMidpoint; for( uint_t i = 0; i < 3; ++i ) - firstCellMidpoint[i] = firstCellBB.min(i) + real_t(0.5) * firstCellBB.size(i); + firstCellMidpoint[i] = firstCellBB.min(i) + 0.5_r * firstCellBB.size(i); Vector3<real_t> currentMidpoint; currentMidpoint[2] = firstCellMidpoint[2]; @@ -169,7 +169,7 @@ namespace initializer { structuredBlockStorage_.getBlockLocalCellAABB( *block, ff->beginWithGhostLayer().cell(), firstCellBB ); Vector3<real_t> firstCellMidpoint; for( uint_t i = 0; i < 3; ++i ) - firstCellMidpoint[i] = firstCellBB.min(i) + real_t(0.5) * firstCellBB.size(i); + firstCellMidpoint[i] = firstCellBB.min(i) + 0.5_r * firstCellBB.size(i); Vector3<real_t> currentMidpoint; currentMidpoint[2] = firstCellMidpoint[2]; diff --git a/src/geometry/mesh/TriangleMesh.cpp b/src/geometry/mesh/TriangleMesh.cpp index de03f589..9eabd079 100644 --- a/src/geometry/mesh/TriangleMesh.cpp +++ b/src/geometry/mesh/TriangleMesh.cpp @@ -463,7 +463,7 @@ real_t TriangleMesh::volume() const for(size_t i = 0; i < getNumTriangles(); ++i) { getTriangle( i, v0, v1, v2 ); - result += ( v0 * ( v1 % v2 ) ) / real_t(6); + result += ( v0 * ( v1 % v2 ) ) / 6_r; } return std::fabs(result); diff --git a/src/geometry/mesh/TriangleMesh.h b/src/geometry/mesh/TriangleMesh.h index 12501c96..00171a5a 100644 --- a/src/geometry/mesh/TriangleMesh.h +++ b/src/geometry/mesh/TriangleMesh.h @@ -134,7 +134,7 @@ namespace geometry { /*! \name Mesh Operations */ //@{ void merge(const TriangleMesh & other, const Vector3<real_t> & offset = Vector3<real_t>(0.0) ); - size_t removeDuplicateVertices( real_t tolerance = real_t(1e-4) ); + size_t removeDuplicateVertices( real_t tolerance = 1e-4_r ); void translate( const Vector3<real_t> & offset ); void scale( real_t scaleFactor ) { scale( Vector3<real_t>( scaleFactor, scaleFactor, scaleFactor ) ); } void scale( const Vector3<real_t> & scaleFactors ); diff --git a/src/geometry/structured/GrayScaleImage.cpp b/src/geometry/structured/GrayScaleImage.cpp index 63084a54..d8fe691a 100644 --- a/src/geometry/structured/GrayScaleImage.cpp +++ b/src/geometry/structured/GrayScaleImage.cpp @@ -65,8 +65,8 @@ namespace geometry { void GrayScaleImage::setElement( cell_idx_t x, cell_idx_t y, real_t val) { - WALBERLA_ASSERT_LESS_EQUAL ( val, real_t(1.0) ); - WALBERLA_ASSERT_GREATER_EQUAL( val, real_t(0.0) ); + WALBERLA_ASSERT_LESS_EQUAL ( val, 1.0_r ); + WALBERLA_ASSERT_GREATER_EQUAL( val, 0.0_r ); getElement(x,y) = static_cast<unsigned char>( real_c( std::numeric_limits<unsigned char>::max() ) * val ); } diff --git a/src/geometry/structured/RGBAImage.cpp b/src/geometry/structured/RGBAImage.cpp index e2566f3c..e6bc5411 100644 --- a/src/geometry/structured/RGBAImage.cpp +++ b/src/geometry/structured/RGBAImage.cpp @@ -81,8 +81,8 @@ namespace geometry { void RGBAImage::setElement( cell_idx_t x, cell_idx_t y, RGBAImage::Channel c, real_t val) { - WALBERLA_ASSERT_LESS_EQUAL ( val, real_t(1.0) ); - WALBERLA_ASSERT_GREATER_EQUAL( val, real_t(0.0) ); + WALBERLA_ASSERT_LESS_EQUAL ( val, 1.0_r ); + WALBERLA_ASSERT_GREATER_EQUAL( val, 0.0_r ); getElement(x,y,c) = static_cast<unsigned char> ( real_c( std::numeric_limits<unsigned char>::max() ) * val ); } diff --git a/src/lbm/BlockForestEvaluation.h b/src/lbm/BlockForestEvaluation.h index f9b82369..ec721737 100644 --- a/src/lbm/BlockForestEvaluation.h +++ b/src/lbm/BlockForestEvaluation.h @@ -135,7 +135,7 @@ private: real_t totalWorkload( const shared_ptr< StructuredBlockForest > & blocks ) const { - real_t work( real_t(0) ); + real_t work( 0_r ); for( uint_t i = uint_t(0); i < blocks->getNumberOfLevels(); ++i ) work += real_c( cells_.numberOfCells(i) * uint64_c( math::uintPow2(i) ) ); return work; @@ -148,7 +148,7 @@ private: real_t allFineWorkload( const shared_ptr< StructuredBlockForest > & blocks ) const { - real_t work( real_t(0) ); + real_t work( 0_r ); for( uint_t i = uint_t(0); i < blocks->getNumberOfLevels(); ++i ) work += real_c( cells_.numberOfCells(i) * uint64_c( Pseudo2D ? math::uintPow4( blocks->getNumberOfLevels() - uint_t(1) - i ) : math::uintPow8( blocks->getNumberOfLevels() - uint_t(1) - i ) ) ) * diff --git a/src/lbm/blockforest/PostProcessing.h b/src/lbm/blockforest/PostProcessing.h index 23644cdd..652d9b66 100644 --- a/src/lbm/blockforest/PostProcessing.h +++ b/src/lbm/blockforest/PostProcessing.h @@ -168,7 +168,7 @@ void PostProcessing< LatticeModel_T, Filter_T >::operator()( BlockForest & fores WALBERLA_ASSERT( !math::isnan( coarse(x,y,z,f) ) ); const auto v = coarse(x,y,z,f); - Vector3< real_t > grad( real_t(0) ); + Vector3< real_t > grad( 0_r ); for( uint_t i = 0; i < Stencil_T::D; ++i ) { @@ -176,7 +176,7 @@ void PostProcessing< LatticeModel_T, Filter_T >::operator()( BlockForest & fores { if( interval.contains( fmin[i] ) && markerField->get( fmin[i] ) != uint8_t(0) ) { - grad[i] = real_t(0.5) * ( coarse( max[i], f ) - coarse( min[i], f ) ); + grad[i] = 0.5_r * ( coarse( max[i], f ) - coarse( min[i], f ) ); } else { @@ -262,8 +262,8 @@ void PostProcessing< LatticeModel_T, Filter_T >::operator()( BlockForest & fores /* Vector3<real_t> velocity; - real_t density( real_t(0) ); - real_t count( real_t(0) ); + real_t density( 0_r ); + real_t count( 0_r ); for( auto it = NeighborsStencil_T::begin(); it != NeighborsStencil_T::end(); ++it ) { @@ -278,20 +278,20 @@ void PostProcessing< LatticeModel_T, Filter_T >::operator()( BlockForest & fores Vector3<real_t> vel; density += pdfField->getDensityAndVelocity(vel,x,y,z); velocity += vel; - count += real_t(1); + count += 1_r; } } } - if( count > real_t(0) ) + if( count > 0_r ) { - const real_t factor = real_t(1) / count; + const real_t factor = 1_r / count; velocity *= factor; density *= factor; } else { - density = real_t(1); + density = 1_r; } pdfField->setDensityAndVelocity(x,y,z,velocity,density); diff --git a/src/lbm/boundary/DiffusionDirichlet.h b/src/lbm/boundary/DiffusionDirichlet.h index 75563c3d..79e44990 100644 --- a/src/lbm/boundary/DiffusionDirichlet.h +++ b/src/lbm/boundary/DiffusionDirichlet.h @@ -67,7 +67,7 @@ public: class SingleScalarConfiguration : public ScalarConfiguration { public: - SingleScalarConfiguration( const real_t _val = real_t(0) ) : val_( _val ) {} + SingleScalarConfiguration( const real_t _val = 0_r ) : val_( _val ) {} inline SingleScalarConfiguration( const Config::BlockHandle & config ){ val_ = ( config && config.isDefined( "val" ) ) ? config.getParameter< real_t >( "val" ) : real_c( 0. ); } const real_t & val() const { return val_; } @@ -194,7 +194,7 @@ inline void DiffusionDirichlet< LatticeModel_T, flag_t >::treatDirection( const const real_t & bndVal = sclField_->get( nx, ny, nz ); real_t & target = pdfField_->get( nx, ny, nz, Stencil::invDirIdx(dir) ); - target = - pdfField_->get( x, y, z, Stencil::idx[dir] ) + real_t(2) * bndVal * LatticeModel_T::w[Stencil::idx[dir]]; + target = - pdfField_->get( x, y, z, Stencil::idx[dir] ) + 2_r * bndVal * LatticeModel_T::w[Stencil::idx[dir]]; } diff --git a/src/lbm/boundary/DynamicUBB.h b/src/lbm/boundary/DynamicUBB.h index 67425aa0..fcbccc43 100644 --- a/src/lbm/boundary/DynamicUBB.h +++ b/src/lbm/boundary/DynamicUBB.h @@ -69,7 +69,7 @@ public: DynamicUBB( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField * const pdfField, const shared_ptr< TimeTracker > & timeTracker, const uint_t level, const VelocityFunctor_T & velocity, const AABB & aabb ) : Boundary<flag_t>( boundaryUID ), uid_( uid ), pdfField_( pdfField ), - timeTracker_( timeTracker ), time_( real_t(0) ), level_( level ), velocity_( velocity ) + timeTracker_( timeTracker ), time_( 0_r ), level_( level ), velocity_( velocity ) { WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); dx_[0] = aabb.xSize() / real_c( pdfField_->xSize() ); @@ -151,7 +151,7 @@ public: } else { - const auto vel = AdaptVelocityToExternalForce ? lbm::internal::AdaptVelocityToForce<LatticeModel_T>::get( x, y, z, pdfField_->latticeModel(), velocity, real_t(1) ) : + const auto vel = AdaptVelocityToExternalForce ? lbm::internal::AdaptVelocityToForce<LatticeModel_T>::get( x, y, z, pdfField_->latticeModel(), velocity, 1_r ) : velocity; pdfField_->get( nx, ny, nz, Stencil::invDirIdx(dir) ) = pdfField_->get( x, y, z, Stencil::idx[dir] ) - diff --git a/src/lbm/boundary/ParserUBB.h b/src/lbm/boundary/ParserUBB.h index 82bfff5e..3e0fa1ca 100644 --- a/src/lbm/boundary/ParserUBB.h +++ b/src/lbm/boundary/ParserUBB.h @@ -265,7 +265,7 @@ template< typename LatticeModel_T, typename flag_t, bool AdaptVelocityToExternal inline ParserUBB<LatticeModel_T, flag_t, AdaptVelocityToExternalForce>::ParserUBB( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField * const pdfField, FlagField<flag_t> * const flagField, const shared_ptr< TimeTracker > & timeTracker, const uint_t level, const AABB & aabb ) - : Boundary<flag_t>( boundaryUID ), uid_( uid ), pdfField_( pdfField ), timeTracker_( timeTracker ), time_( real_t(0) ), level_( level ) + : Boundary<flag_t>( boundaryUID ), uid_( uid ), pdfField_( pdfField ), timeTracker_( timeTracker ), time_( 0_r ), level_( level ) { WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); dx_[0] = aabb.xSize() / real_c( pdfField_->xSize() ); @@ -503,7 +503,7 @@ inline void ParserUBB<LatticeModel_T, flag_t, AdaptVelocityToExternalForce>::Par } else { - const auto vel = AdaptVelocityToExternalForce ? lbm::internal::AdaptVelocityToForce<LatticeModel_T>::get( x, y, z, pdfField_->latticeModel(), velocity, real_t(1) ) : + const auto vel = AdaptVelocityToExternalForce ? lbm::internal::AdaptVelocityToForce<LatticeModel_T>::get( x, y, z, pdfField_->latticeModel(), velocity, 1_r ) : velocity; pdfField_->get( nx, ny, nz, Stencil::invDirIdx(dir) ) = pdfField_->get( x, y, z, Stencil::idx[dir] ) - diff --git a/src/lbm/boundary/Pressure.h b/src/lbm/boundary/Pressure.h index ae8afb05..83a88e24 100644 --- a/src/lbm/boundary/Pressure.h +++ b/src/lbm/boundary/Pressure.h @@ -217,7 +217,7 @@ inline void Pressure< LatticeModel_T, flag_t >::treatDirection( const cell_idx_t // result will be streamed to (x,y,z, stencil::inverseDir[d]) during sweep pdfField_->get( nx, ny, nz, Stencil::invDirIdx(dir) ) = - pdfField_->get( x, y, z, Stencil::idx[dir] ) //anti-bounce-back - + real_t(2) * EquilibriumDistribution<LatticeModel_T>::getSymmetricPart( dir, u, latticeDensityField_->get(nx,ny,nz) ); //pressure term + + 2_r * EquilibriumDistribution<LatticeModel_T>::getSymmetricPart( dir, u, latticeDensityField_->get(nx,ny,nz) ); //pressure term } diff --git a/src/lbm/boundary/SimpleDiffusionDirichlet.h b/src/lbm/boundary/SimpleDiffusionDirichlet.h index f57f4a8b..a5b10100 100644 --- a/src/lbm/boundary/SimpleDiffusionDirichlet.h +++ b/src/lbm/boundary/SimpleDiffusionDirichlet.h @@ -60,8 +60,8 @@ public: class ScalarConfiguration : public BoundaryConfiguration { public: - ScalarConfiguration( const real_t _val = real_t(0) ) : val_( _val ) {} - inline ScalarConfiguration( const Config::BlockHandle & config ){ val_ = ( config && config.isDefined( "val" ) ) ? config.getParameter< real_t >( "val" ) : real_t(0); } + ScalarConfiguration( const real_t _val = 0_r ) : val_( _val ) {} + inline ScalarConfiguration( const Config::BlockHandle & config ){ val_ = ( config && config.isDefined( "val" ) ) ? config.getParameter< real_t >( "val" ) : 0_r; } const real_t & val() const { return val_; } real_t & val() { return val_; } @@ -72,7 +72,7 @@ public: static shared_ptr<ScalarConfiguration> createConfiguration( const Config::BlockHandle & config ) { return make_shared<ScalarConfiguration>( config ); } - inline SimpleDiffusionDirichlet( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, const real_t val = real_t(0) ); + inline SimpleDiffusionDirichlet( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, const real_t val = 0_r ); void pushFlags( std::vector< FlagUID > & uids ) const { uids.push_back( uid_ ); } @@ -186,7 +186,7 @@ inline void SimpleDiffusionDirichlet< LatticeModel_T, flag_t >::treatDirection( WALBERLA_ASSERT_EQUAL ( mask & this->mask_, this->mask_ ); // only true if "this->mask_" only contains one single flag, which is the case for the current implementation of this boundary condition (SimpleDiffusionDirichlet) - pdfField_->get( nx, ny, nz, Stencil::invDirIdx(dir) ) = real_t(2) * val_ * LatticeModel_T::w[Stencil::idx[dir]] - pdfField_->get( x, y, z, Stencil::idx[dir] ); + pdfField_->get( nx, ny, nz, Stencil::invDirIdx(dir) ) = 2_r * val_ * LatticeModel_T::w[Stencil::idx[dir]] - pdfField_->get( x, y, z, Stencil::idx[dir] ); } diff --git a/src/lbm/boundary/SimplePAB.h b/src/lbm/boundary/SimplePAB.h index b4319a7c..54e81271 100644 --- a/src/lbm/boundary/SimplePAB.h +++ b/src/lbm/boundary/SimplePAB.h @@ -75,7 +75,7 @@ public: SimplePAB( const BoundaryUID& boundaryUID, const FlagUID & uid, PDFField * const pdfField, FlagFieldT * const flagField, const real_t latticeDensity, const real_t omega, FlagUID domain, FlagUID noSlip ) : Boundary<flag_t>( boundaryUID ), uid_( uid ), pdfs_( pdfField ), flags_(flagField), - latticeDensity_( latticeDensity ), omega_( omega ), tau_( real_t(1) / omega ) + latticeDensity_( latticeDensity ), omega_( omega ), tau_( 1_r / omega ) { WALBERLA_ASSERT_NOT_NULLPTR( pdfs_ ); WALBERLA_ASSERT_NOT_NULLPTR( flags_ ); @@ -93,18 +93,18 @@ public: WALBERLA_ASSERT_UNEQUAL( domainFlag_, 0 ); WALBERLA_ASSERT_UNEQUAL( noSlipFlag_, 0 ); - if( omega_ <= real_t(0) && omega_ >= real_t(2) ) + if( omega_ <= 0_r && omega_ >= 2_r ) { WALBERLA_ABORT( "You are trying to use the simplePAB boundary condition with an omega of " << omega_ << ". " "Omega has to be in the open interval (0,2)." ); } - else if( omega_ > real_t(0.99) && omega_ < real_t(1.01) ) + else if( omega_ > 0.99_r && omega_ < 1.01_r ) { WALBERLA_ABORT( "You are trying to use the simplePAB boundary condition with an omega of " << omega_ << ". " "With an omega that close to 1, the pre collision PDFs can not be restored and SimplePAB will " "not work!" ); } - else if( omega_ > real_t(0.9) && omega_ < real_t(1.1) ) + else if( omega_ > 0.9_r && omega_ < 1.1_r ) { WALBERLA_LOG_WARNING( "You are trying to use the simplePAB boundary condition with an omega of " << omega_ << ". " "With an omega that close to 1, the pre collision PDFs can not be restored accurately and " @@ -181,13 +181,13 @@ public: if( flags_->get(nfx, nfy, nfz) & domainFlag_ ) { - wu = u + real_t(0.5) * (u - nfu); + wu = u + 0.5_r * (u - nfu); } else // Check whether we can get the velocity from a BC { if( flags_->get(nfx, nfy, nfz) & noSlipFlag_ ) { - wu = real_t(2.0) * u; // NoSlip: u at boundary is 0 + wu = 2.0_r * u; // NoSlip: u at boundary is 0 } else if( flags_->get(nfx, nfy, nfz) & this->mask_ ) { @@ -208,8 +208,8 @@ public: real_t f2 = pdfs_->get( x, y, z, Stencil::idx[inverseDir[dir]] ); real_t f1_eq = EquilibriumDistribution<LatticeModel_T>::get( dir , u, rho); real_t f2_eq = EquilibriumDistribution<LatticeModel_T>::get( inverseDir[dir], u, rho ); - real_t f1_pc = ( tau_ * f1 - f1_eq ) / ( tau_ - real_t(1) ); - real_t f2_pc = ( tau_ * f2 - f2_eq ) / ( tau_ - real_t(1) ); + real_t f1_pc = ( tau_ * f1 - f1_eq ) / ( tau_ - 1_r ); + real_t f2_pc = ( tau_ * f2 - f2_eq ) / ( tau_ - 1_r ); real_t symDistFunc_pc = real_c( 0.5 ) * ( f1_pc + f2_pc ); //////////////////////////////////////////////////// @@ -219,8 +219,8 @@ public: // result will be streamed to (x,y,z, stencil::inverseDir[d]) during sweep pdfs_->get(nx, ny, nz, Stencil::invDirIdx(dir)) = - pdfs_->get(x, y, z, Stencil::idx[dir]) //anti-bounce-back - + real_t(2.0) * EquilibriumDistribution<LatticeModel_T>::getSymmetricPart( dir, wu, latticeDensity_ ) //pressure term - + ( real_t(2.0) - omega_ ) * ( symDistFunc_pc - EquilibriumDistribution<LatticeModel_T>::getSymmetricPart( dir, u, rho ) ); //error correction + + 2.0_r * EquilibriumDistribution<LatticeModel_T>::getSymmetricPart( dir, wu, latticeDensity_ ) //pressure term + + ( 2.0_r - omega_ ) * ( symDistFunc_pc - EquilibriumDistribution<LatticeModel_T>::getSymmetricPart( dir, u, rho ) ); //error correction } protected: diff --git a/src/lbm/boundary/SimplePressure.h b/src/lbm/boundary/SimplePressure.h index d7b39045..e2ab51dd 100644 --- a/src/lbm/boundary/SimplePressure.h +++ b/src/lbm/boundary/SimplePressure.h @@ -111,7 +111,7 @@ public: // result will be streamed to (x,y,z, stencil::inverseDir[d]) during sweep pdfs_->get( nx, ny, nz, Stencil::invDirIdx(dir) ) = - pdfs_->get( x, y, z, Stencil::idx[dir] ) //anti-bounce-back - + real_t(2) * EquilibriumDistribution<LatticeModel_T>::getSymmetricPart( dir, u, latticeDensity_ ); //pressure term + + 2_r * EquilibriumDistribution<LatticeModel_T>::getSymmetricPart( dir, u, latticeDensity_ ); //pressure term } protected: diff --git a/src/lbm/boundary/SimpleUBB.h b/src/lbm/boundary/SimpleUBB.h index da6e7839..8faf57c8 100644 --- a/src/lbm/boundary/SimpleUBB.h +++ b/src/lbm/boundary/SimpleUBB.h @@ -113,7 +113,7 @@ public: } else { - const auto velocity = AdaptVelocityToExternalForce ? internal::AdaptVelocityToForce<LatticeModel_T>::get( x, y, z, pdfField_->latticeModel(), velocity_, real_t(1) ) : + const auto velocity = AdaptVelocityToExternalForce ? internal::AdaptVelocityToForce<LatticeModel_T>::get( x, y, z, pdfField_->latticeModel(), velocity_, 1_r ) : velocity_; pdfField_->get( nx, ny, nz, Stencil::invDirIdx(dir) ) = pdfField_->get( x, y, z, Stencil::idx[dir] ) - diff --git a/src/lbm/boundary/SimpleVelocityBoundary.h b/src/lbm/boundary/SimpleVelocityBoundary.h index edb6a4d9..9421c409 100644 --- a/src/lbm/boundary/SimpleVelocityBoundary.h +++ b/src/lbm/boundary/SimpleVelocityBoundary.h @@ -60,7 +60,7 @@ public: SimpleVelocityBoundary( const BoundaryUID& boundaryUID, const FlagUID& uid, PDFField* const pdfField, - const Vector3< real_t > & velocity, const real_t density = real_t(1) ) : + const Vector3< real_t > & velocity, const real_t density = 1_r ) : Boundary<flag_t>( boundaryUID ), uid_( uid ), pdfField_( pdfField ) { WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); @@ -69,7 +69,7 @@ public: } SimpleVelocityBoundary( const BoundaryUID& boundaryUID, const FlagUID& uid, PDFField* const pdfField, - const real_t x, const real_t y, const real_t z, const real_t density = real_t(1) ) : + const real_t x, const real_t y, const real_t z, const real_t density = 1_r ) : Boundary<flag_t>( boundaryUID ), uid_( uid ), pdfField_( pdfField ) { WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); diff --git a/src/lbm/boundary/UBB.h b/src/lbm/boundary/UBB.h index 36132241..558d1e14 100644 --- a/src/lbm/boundary/UBB.h +++ b/src/lbm/boundary/UBB.h @@ -237,7 +237,7 @@ inline void UBB< LatticeModel_T, flag_t, AdaptVelocityToExternalForce >::treatDi } else { - const auto velocity = AdaptVelocityToExternalForce ? internal::AdaptVelocityToForce<LatticeModel_T>::get( x, y, z, pdfField_->latticeModel(), vel_->get(nx,ny,nz), real_t(1) ) : + const auto velocity = AdaptVelocityToExternalForce ? internal::AdaptVelocityToForce<LatticeModel_T>::get( x, y, z, pdfField_->latticeModel(), vel_->get(nx,ny,nz), 1_r ) : vel_->get(nx,ny,nz); pdfField_->get( nx, ny, nz, Stencil::invDirIdx(dir) ) = pdfField_->get( x, y, z, Stencil::idx[dir] ) - diff --git a/src/lbm/boundary/VelocityBoundary.h b/src/lbm/boundary/VelocityBoundary.h index 8b470021..34eabfcc 100644 --- a/src/lbm/boundary/VelocityBoundary.h +++ b/src/lbm/boundary/VelocityBoundary.h @@ -59,9 +59,9 @@ public: class Configuration : public BoundaryConfiguration { public: - Configuration( const Vector3< real_t > & _velocity, const real_t _density = real_t(1) ) : + Configuration( const Vector3< real_t > & _velocity, const real_t _density = 1_r ) : velocity_( _velocity ), density_( _density ) {} - Configuration( const real_t _x, const real_t _y, const real_t _z, const real_t _density = real_t(1) ) : + Configuration( const real_t _x, const real_t _y, const real_t _z, const real_t _density = 1_r ) : velocity_(_x,_y,_z), density_( _density ) {} inline Configuration( const Config::BlockHandle & config ); @@ -131,7 +131,7 @@ inline VelocityBoundary< LatticeModel_T, flag_t >::Configuration::Configuration( velocity_[0] = ( config && config.isDefined( "x" ) ) ? config.getParameter<real_t>( "x" ) : real_c(0.0); velocity_[1] = ( config && config.isDefined( "y" ) ) ? config.getParameter<real_t>( "y" ) : real_c(0.0); velocity_[2] = ( config && config.isDefined( "z" ) ) ? config.getParameter<real_t>( "z" ) : real_c(0.0); - density_ = ( config && config.isDefined( "rho" ) ) ? config.getParameter<real_t>( "rho" ) : real_t(1); + density_ = ( config && config.isDefined( "rho" ) ) ? config.getParameter<real_t>( "rho" ) : 1_r; } diff --git a/src/lbm/cumulant/CellwiseSweep.impl.h b/src/lbm/cumulant/CellwiseSweep.impl.h index 7b65e4c7..d97317d7 100644 --- a/src/lbm/cumulant/CellwiseSweep.impl.h +++ b/src/lbm/cumulant/CellwiseSweep.impl.h @@ -78,16 +78,16 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t omega9 = src->latticeModel().collisionModel().omega9(); const real_t omega10 = src->latticeModel().collisionModel().omega10(); - const real_t omega_trm1( real_t(1.0) - omega1 ); - const real_t omega_trm2( real_t(1.0) - omega2 ); - const real_t omega_trm3( real_t(1.0) - omega3 ); - const real_t omega_trm4( real_t(1.0) - omega4 ); - const real_t omega_trm5( real_t(1.0) - omega5 ); - const real_t omega_trm6( real_t(1.0) - omega6 ); - const real_t omega_trm7( real_t(1.0) - omega7 ); - const real_t omega_trm8( real_t(1.0) - omega8 ); - const real_t omega_trm9( real_t(1.0) - omega9 ); - const real_t omega_trm10( real_t(1.0) - omega10 ); + const real_t omega_trm1( 1.0_r - omega1 ); + const real_t omega_trm2( 1.0_r - omega2 ); + const real_t omega_trm3( 1.0_r - omega3 ); + const real_t omega_trm4( 1.0_r - omega4 ); + const real_t omega_trm5( 1.0_r - omega5 ); + const real_t omega_trm6( 1.0_r - omega6 ); + const real_t omega_trm7( 1.0_r - omega7 ); + const real_t omega_trm8( 1.0_r - omega8 ); + const real_t omega_trm9( 1.0_r - omega9 ); + const real_t omega_trm10( 1.0_r - omega10 ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -112,11 +112,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE // defining velocity terms for central moment space // velocity in z direction - const real_t velz_term = real_t(-1.0) * velZ ; + const real_t velz_term = -1.0_r * velZ ; const real_t sqr_velz_term = velz_term * velz_term ; - const real_t oneminus_velz = real_t(1.0) - velZ ; + const real_t oneminus_velz = 1.0_r - velZ ; const real_t sqr_oneminus_velz = oneminus_velz * oneminus_velz ; - const real_t negoneminus_velz = real_t(-1.0) - velZ ; + const real_t negoneminus_velz = -1.0_r - velZ ; const real_t sqr_negoneminus_velz = negoneminus_velz * negoneminus_velz ; // Declaring the constants and initialising them with distribution function to transform for the moment space @@ -149,11 +149,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t k_22_2 = vBNE * sqr_negoneminus_velz + vNE * sqr_velz_term + vTNE * sqr_oneminus_velz ; // velocity in y direction - const real_t vely_term = real_t(-1.0) * velY ; + const real_t vely_term = -1.0_r * velY ; const real_t sqr_vely_term = vely_term * vely_term ; - const real_t oneminus_vely = real_t(1.0) - velY ; + const real_t oneminus_vely = 1.0_r - velY ; const real_t sqr_oneminus_vely = oneminus_vely * oneminus_vely ; - const real_t negoneminus_vely = real_t(-1.0) - velY ; + const real_t negoneminus_vely = -1.0_r - velY ; const real_t sqr_negoneminus_vely = negoneminus_vely * negoneminus_vely ; const real_t k_0_00 = k_00_0 + k_01_0 + k_02_0; @@ -185,11 +185,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t k_2_22 = k_20_2 * sqr_negoneminus_vely + k_21_2 * sqr_vely_term + k_22_2 * sqr_oneminus_vely; // Velocity in x direction - const real_t velx_term = real_t(-1.0) * velX ; + const real_t velx_term = -1.0_r * velX ; const real_t sqr_velx_term = velx_term * velx_term ; - const real_t oneminus_velx = real_t(1.0) - velX ; + const real_t oneminus_velx = 1.0_r - velX ; const real_t sqr_oneminus_velx = oneminus_velx * oneminus_velx ; - const real_t negoneminus_velx = real_t(-1.0) - velX ; + const real_t negoneminus_velx = -1.0_r - velX ; const real_t sqr_negoneminus_velx = negoneminus_velx * negoneminus_velx ; const real_t k_000 = k_0_00 + k_1_00 + k_2_00; @@ -223,7 +223,7 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE // transformation to moment space done now , transform to cumulant space // defining the constants for central moment space - const real_t rho_inv = real_t(1.0) / updated_rho; + const real_t rho_inv = 1.0_r / updated_rho; // defining the sqaures const real_t sqr_k_110 = k_110 * k_110; @@ -242,26 +242,26 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t C_012 = k_012 ; const real_t C_020 = k_020 ; const real_t C_021 = k_021 ; - const real_t C_022 = k_022 - (k_020 * k_002 + real_t(2.0) * sqr_k_011) * rho_inv ; + const real_t C_022 = k_022 - (k_020 * k_002 + 2.0_r * sqr_k_011) * rho_inv ; const real_t C_100 = k_100 ; const real_t C_101 = k_101 ; const real_t C_102 = k_102 ; const real_t C_110 = k_110 ; const real_t C_111 = k_111 ; - const real_t C_112 = k_112 - (k_002 * k_110 + real_t(2.0) * k_101 * k_011) * rho_inv ; + const real_t C_112 = k_112 - (k_002 * k_110 + 2.0_r * k_101 * k_011) * rho_inv ; const real_t C_120 = k_120 ; - const real_t C_121 = k_121 - (k_020 * k_101 + real_t(2.0) * k_011 * k_110) * rho_inv ; - const real_t C_122 = k_122 - (k_002 * k_120 + k_020 * k_120 + real_t(4.0) * k_011 * k_111 + real_t(2.0) * (k_101 * k_021 + k_110 * k_012)) * rho_inv ; + const real_t C_121 = k_121 - (k_020 * k_101 + 2.0_r * k_011 * k_110) * rho_inv ; + const real_t C_122 = k_122 - (k_002 * k_120 + k_020 * k_120 + 4.0_r * k_011 * k_111 + 2.0_r * (k_101 * k_021 + k_110 * k_012)) * rho_inv ; const real_t C_200 = k_200 ; const real_t C_201 = k_201 ; - const real_t C_202 = k_202 - (k_002 * k_200 + real_t(2.0) * sqr_k_101) * rho_inv ; + const real_t C_202 = k_202 - (k_002 * k_200 + 2.0_r * sqr_k_101) * rho_inv ; const real_t C_210 = k_210 ; - const real_t C_211 = k_211 - (k_200 * k_011 + real_t(2.0) * k_110 * k_101) * rho_inv ; - const real_t C_212 = k_212 - (k_002 * k_210 + k_200 * k_210 + real_t(4.0) * k_101 * k_111 + real_t(2.0) * (k_011 * k_201 + k_110 * k_102)) * rho_inv ; - const real_t C_220 = k_220 - (k_200 * k_020 + real_t(2.0) * sqr_k_110) * rho_inv ; - const real_t C_221 = k_221 - (k_020 * k_201 + k_200 * k_201 + real_t(4.0) * k_110 * k_111 + real_t(2.0) * (k_011 * k_210 + k_101 * k_120)) * rho_inv; - const real_t C_222 = k_222 - (real_t(4.0)* sqr_k_111 + k_200 * k_022 + k_020 * k_202 + k_002 * k_220 + real_t(4.0) * (k_011 * k_211 + k_101 * k_121 + k_110 * k_112) + real_t(2.0) * (k_120 * k_102 + k_210 * k_012 + k_201 * k_021)) * rho_inv - + (real_t(16.0) * k_110 * k_101 * k_011 + real_t(4.0) * (k_020 * sqr_k_101 + k_200 * sqr_k_011 + k_002 * sqr_k_110) + real_t(2.0) * k_200 *k_020 * k_002) * sqr_rho_inv; + const real_t C_211 = k_211 - (k_200 * k_011 + 2.0_r * k_110 * k_101) * rho_inv ; + const real_t C_212 = k_212 - (k_002 * k_210 + k_200 * k_210 + 4.0_r * k_101 * k_111 + 2.0_r * (k_011 * k_201 + k_110 * k_102)) * rho_inv ; + const real_t C_220 = k_220 - (k_200 * k_020 + 2.0_r * sqr_k_110) * rho_inv ; + const real_t C_221 = k_221 - (k_020 * k_201 + k_200 * k_201 + 4.0_r * k_110 * k_111 + 2.0_r * (k_011 * k_210 + k_101 * k_120)) * rho_inv; + const real_t C_222 = k_222 - (4.0_r* sqr_k_111 + k_200 * k_022 + k_020 * k_202 + k_002 * k_220 + 4.0_r * (k_011 * k_211 + k_101 * k_121 + k_110 * k_112) + 2.0_r * (k_120 * k_102 + k_210 * k_012 + k_201 * k_021)) * rho_inv + + (16.0_r * k_110 * k_101 * k_011 + 4.0_r * (k_020 * sqr_k_101 + k_200 * sqr_k_011 + k_002 * sqr_k_110) + 2.0_r * k_200 *k_020 * k_002) * sqr_rho_inv; // collision happens in cumulant space @@ -273,14 +273,14 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t CS_101 = omega_trm1 * C_101 ; const real_t CS_011 = omega_trm1 * C_011 ; - const real_t Dxux = real_t(-0.5) * omega1 * rho_inv * (real_t(2.0) * C_200 - C_020 - C_002) - real_t(0.5) * omega2 * rho_inv * (C_200 + C_020 + C_002 - C_000); - const real_t Dyuy = Dxux + real_t(1.5) * omega1 * rho_inv * (C_200 - C_020); - const real_t Dzuz = Dxux + real_t(1.5) * omega1 * rho_inv * (C_200 - C_002); + const real_t Dxux = -0.5_r * omega1 * rho_inv * (2.0_r * C_200 - C_020 - C_002) - 0.5_r * omega2 * rho_inv * (C_200 + C_020 + C_002 - C_000); + const real_t Dyuy = Dxux + 1.5_r * omega1 * rho_inv * (C_200 - C_020); + const real_t Dzuz = Dxux + 1.5_r * omega1 * rho_inv * (C_200 - C_002); - const real_t CS_200__m__CS020 = (omega_trm1) * (C_200 - C_020) - real_t(3.0) * updated_rho * (real_t(1.0) - real_t(0.5) * omega1) * (Dxux * velXX - Dyuy * velYY) ; - const real_t CS_200__m__CS002 = (omega_trm1) * (C_200 - C_002) - real_t(3.0) * updated_rho * (real_t(1.0) - real_t(0.5) * omega1) * (Dxux * velXX - Dzuz * velZZ) ; - const real_t CS_200__p__CS020__p__CS_002 = omega2 * C_000 + (omega_trm2) * (C_200 + C_020 + C_002) - real_t(3.0) * updated_rho *(real_t(1.0) - real_t(0.5) * omega2) * (Dxux * velXX + Dyuy * velYY + Dzuz * velZZ); - const real_t CS_200 = (CS_200__m__CS020 + CS_200__m__CS002 + CS_200__p__CS020__p__CS_002) / real_t(3.0) ; + const real_t CS_200__m__CS020 = (omega_trm1) * (C_200 - C_020) - 3.0_r * updated_rho * (1.0_r - 0.5_r * omega1) * (Dxux * velXX - Dyuy * velYY) ; + const real_t CS_200__m__CS002 = (omega_trm1) * (C_200 - C_002) - 3.0_r * updated_rho * (1.0_r - 0.5_r * omega1) * (Dxux * velXX - Dzuz * velZZ) ; + const real_t CS_200__p__CS020__p__CS_002 = omega2 * C_000 + (omega_trm2) * (C_200 + C_020 + C_002) - 3.0_r * updated_rho *(1.0_r - 0.5_r * omega2) * (Dxux * velXX + Dyuy * velYY + Dzuz * velZZ); + const real_t CS_200 = (CS_200__m__CS020 + CS_200__m__CS002 + CS_200__p__CS020__p__CS_002) / 3.0_r ; const real_t CS_020 = CS_200 - CS_200__m__CS020 ; const real_t CS_002 = CS_200 - CS_200__m__CS002 ; @@ -291,21 +291,21 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t CS_210__m__CS_012 = (omega_trm4) * (C_210 - C_012) ; const real_t CS_201__m__CS_021 = (omega_trm4) * (C_201 - C_021) ; - const real_t CS_120 = real_t(0.5) * (CS_120__p__CS_102 + CS_120__m__CS_102) ; - const real_t CS_102 = real_t(0.5) * (CS_120__p__CS_102 - CS_120__m__CS_102) ; - const real_t CS_012 = real_t(0.5) * (CS_210__p__CS_012 - CS_210__m__CS_012) ; - const real_t CS_210 = real_t(0.5) * (CS_210__p__CS_012 + CS_210__m__CS_012) ; - const real_t CS_201 = real_t(0.5) * (CS_201__p__CS_021 + CS_201__m__CS_021) ; - const real_t CS_021 = real_t(0.5) * (CS_201__p__CS_021 - CS_201__m__CS_021) ; + const real_t CS_120 = 0.5_r * (CS_120__p__CS_102 + CS_120__m__CS_102) ; + const real_t CS_102 = 0.5_r * (CS_120__p__CS_102 - CS_120__m__CS_102) ; + const real_t CS_012 = 0.5_r * (CS_210__p__CS_012 - CS_210__m__CS_012) ; + const real_t CS_210 = 0.5_r * (CS_210__p__CS_012 + CS_210__m__CS_012) ; + const real_t CS_201 = 0.5_r * (CS_201__p__CS_021 + CS_201__m__CS_021) ; + const real_t CS_021 = 0.5_r * (CS_201__p__CS_021 - CS_201__m__CS_021) ; const real_t CS_111 = (omega_trm5) * C_111 ; - const real_t CS_220__m__2CS_202__p__CS_022 = (omega_trm6) * (C_220 - real_t(2.0) * C_202 + C_022) ; - const real_t CS_220__p__CS_202__m__2CS_022 = (omega_trm6) * (C_220 + C_202 - real_t(2.0) * C_022) ; + const real_t CS_220__m__2CS_202__p__CS_022 = (omega_trm6) * (C_220 - 2.0_r * C_202 + C_022) ; + const real_t CS_220__p__CS_202__m__2CS_022 = (omega_trm6) * (C_220 + C_202 - 2.0_r * C_022) ; const real_t CS_220__p__CS_202__p__CS_022 = (omega_trm7) * (C_220 + C_202 + C_022) ; - const real_t CS_220 = (CS_220__m__2CS_202__p__CS_022 + CS_220__p__CS_202__m__2CS_022 + CS_220__p__CS_202__p__CS_022) / real_t(3.0) ; - const real_t CS_202 = (CS_220__p__CS_202__p__CS_022 - CS_220__m__2CS_202__p__CS_022) / real_t(3.0) ; - const real_t CS_022 = (CS_220__p__CS_202__p__CS_022 - CS_220__p__CS_202__m__2CS_022) / real_t(3.0) ; + const real_t CS_220 = (CS_220__m__2CS_202__p__CS_022 + CS_220__p__CS_202__m__2CS_022 + CS_220__p__CS_202__p__CS_022) / 3.0_r ; + const real_t CS_202 = (CS_220__p__CS_202__p__CS_022 - CS_220__m__2CS_202__p__CS_022) / 3.0_r ; + const real_t CS_022 = (CS_220__p__CS_202__p__CS_022 - CS_220__p__CS_202__m__2CS_022) / 3.0_r ; const real_t CS_211 = (omega_trm8 ) * C_211 ; const real_t CS_121 = (omega_trm8 ) * C_121 ; @@ -327,147 +327,147 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t KC_102 = CS_102; const real_t sqr_KC_101 = KC_101 * KC_101 ; - const real_t KC_202 = CS_202 + (KC_002 * KC_200 + real_t(2.0) * sqr_KC_101) * rho_inv ; + const real_t KC_202 = CS_202 + (KC_002 * KC_200 + 2.0_r * sqr_KC_101) * rho_inv ; const real_t KC_010 = CS_010 ; const real_t KC_110 = CS_110 ; const real_t KC_210 = CS_210 ; const real_t KC_011 = CS_011 ; const real_t KC_111 = CS_111 ; - const real_t KC_211 = CS_211 + (KC_200 * KC_011 + real_t(2.0) * KC_110 * KC_101) * rho_inv ; + const real_t KC_211 = CS_211 + (KC_200 * KC_011 + 2.0_r * KC_110 * KC_101) * rho_inv ; const real_t KC_012 = CS_012; - const real_t KC_112 = CS_112 + (KC_002 * KC_110 + real_t(2.0) * KC_101 * KC_011) * rho_inv ; - const real_t KC_212 = CS_212 + (KC_002 * KC_210 + KC_200 * KC_210 + real_t(4.0) * KC_101 * KC_111 + real_t(2.0) * (KC_011 * KC_201 + KC_110 * KC_102)) * rho_inv; + const real_t KC_112 = CS_112 + (KC_002 * KC_110 + 2.0_r * KC_101 * KC_011) * rho_inv ; + const real_t KC_212 = CS_212 + (KC_002 * KC_210 + KC_200 * KC_210 + 4.0_r * KC_101 * KC_111 + 2.0_r * (KC_011 * KC_201 + KC_110 * KC_102)) * rho_inv; const real_t KC_020 = CS_020; const real_t KC_120 = CS_120; const real_t sqr_KC_110 = KC_110 * KC_110 ; - const real_t KC_220 = CS_220 + (KC_200 * KC_020 + real_t(2.0) * sqr_KC_110) * rho_inv; + const real_t KC_220 = CS_220 + (KC_200 * KC_020 + 2.0_r * sqr_KC_110) * rho_inv; const real_t KC_021 = CS_021; - const real_t KC_121 = CS_121 + (KC_020 * KC_101 + real_t(2.0) * KC_011 * KC_110) * rho_inv; - const real_t KC_221 = CS_221 + (KC_020 * KC_201 + KC_200 * KC_201 + real_t(4.0) * KC_110 * KC_111 + real_t(2.0) * (KC_011 * KC_210 + KC_101 * KC_120)) * rho_inv; + const real_t KC_121 = CS_121 + (KC_020 * KC_101 + 2.0_r * KC_011 * KC_110) * rho_inv; + const real_t KC_221 = CS_221 + (KC_020 * KC_201 + KC_200 * KC_201 + 4.0_r * KC_110 * KC_111 + 2.0_r * (KC_011 * KC_210 + KC_101 * KC_120)) * rho_inv; const real_t sqr_KC_011 = KC_011 * KC_011 ; - const real_t KC_022 = CS_022 + (KC_020 * KC_002 + real_t(2.0) * sqr_KC_011) * rho_inv; - const real_t KC_122 = CS_122 + (KC_002 * KC_120 + KC_020 * KC_120 + real_t(4.0) * KC_011 * KC_111 + real_t(2.0) * (KC_101 * KC_021 + KC_110 * KC_012)) * rho_inv; + const real_t KC_022 = CS_022 + (KC_020 * KC_002 + 2.0_r * sqr_KC_011) * rho_inv; + const real_t KC_122 = CS_122 + (KC_002 * KC_120 + KC_020 * KC_120 + 4.0_r * KC_011 * KC_111 + 2.0_r * (KC_101 * KC_021 + KC_110 * KC_012)) * rho_inv; const real_t sqr_KC_111 = KC_111 * KC_111 ; - const real_t KC_222 = CS_222 + (real_t(4.0) * sqr_KC_111 + KC_200 * KC_022 + KC_020 * KC_202 + KC_002 * KC_220 + real_t(4.0) * (KC_011 * KC_211 + KC_101 * KC_121 + KC_110 * KC_112) + real_t(2.0) * (KC_120 * KC_102 + KC_210 * KC_012 + KC_201 * KC_021)) * rho_inv - - (real_t(16.0) * KC_110 * KC_101 * KC_011 + real_t(4.0) * (KC_020 * sqr_KC_101 + KC_200 * sqr_KC_011 + KC_002 * sqr_KC_110) + real_t(2.0) * KC_200 * KC_020 * KC_002) * sqr_rho_inv; + const real_t KC_222 = CS_222 + (4.0_r * sqr_KC_111 + KC_200 * KC_022 + KC_020 * KC_202 + KC_002 * KC_220 + 4.0_r * (KC_011 * KC_211 + KC_101 * KC_121 + KC_110 * KC_112) + 2.0_r * (KC_120 * KC_102 + KC_210 * KC_012 + KC_201 * KC_021)) * rho_inv + - (16.0_r * KC_110 * KC_101 * KC_011 + 4.0_r * (KC_020 * sqr_KC_101 + KC_200 * sqr_KC_011 + KC_002 * sqr_KC_110) + 2.0_r * KC_200 * KC_020 * KC_002) * sqr_rho_inv; // trnasform back to central moment space // transform from central moment space to distribution funtion // const defined for velocity in X direction - const real_t oneminus_sqr_velx = real_t(1.0) - velXX ; + const real_t oneminus_sqr_velx = 1.0_r - velXX ; const real_t sqr_velx_plus_velX = velXX + velX ; const real_t sqr_velx_minus_velX = velXX - velX ; - const real_t velx_term_plus = real_t(2.0) * velX + real_t(1.0) ; - const real_t velx_term_minus = real_t(2.0) * velX - real_t(1.0) ; - - - const real_t KC_1_00 = KC_000 * oneminus_sqr_velx - KC_100 * real_t(2.0) * velX - KC_200; - const real_t KC_0_00 = (KC_000 * sqr_velx_minus_velX + KC_100 * velx_term_minus + KC_200) * real_t(0.5); - const real_t KC_2_00 = (KC_000 * sqr_velx_plus_velX + KC_100 * velx_term_plus + KC_200) * real_t(0.5); - const real_t KC_1_01 = KC_001 * oneminus_sqr_velx - KC_101 * real_t(2.0) * velX - KC_201; - const real_t KC_0_01 = (KC_001 * sqr_velx_minus_velX + KC_101 * velx_term_minus + KC_201) * real_t(0.5); - const real_t KC_2_01 = (KC_001 * sqr_velx_plus_velX + KC_101 * velx_term_plus + KC_201) * real_t(0.5); - const real_t KC_1_02 = KC_002 * oneminus_sqr_velx - KC_102 * real_t(2.0) * velX - KC_202; - const real_t KC_0_02 = (KC_002 * sqr_velx_minus_velX + KC_102 * velx_term_minus + KC_202) * real_t(0.5); - const real_t KC_2_02 = (KC_002 * sqr_velx_plus_velX + KC_102 * velx_term_plus + KC_202) * real_t(0.5); - const real_t KC_1_10 = KC_010 * oneminus_sqr_velx - KC_110 * real_t(2.0) * velX - KC_210; - const real_t KC_0_10 = (KC_010 * sqr_velx_minus_velX + KC_110 * velx_term_minus + KC_210) * real_t(0.5); - const real_t KC_2_10 = (KC_010 * sqr_velx_plus_velX + KC_110 * velx_term_plus + KC_210) * real_t(0.5); - const real_t KC_1_11 = KC_011 * oneminus_sqr_velx - KC_111 * real_t(2.0) * velX - KC_211; - const real_t KC_0_11 = (KC_011 * sqr_velx_minus_velX + KC_111 * velx_term_minus + KC_211) * real_t(0.5); - const real_t KC_2_11 = (KC_011 * sqr_velx_plus_velX + KC_111 * velx_term_plus + KC_211) * real_t(0.5); - const real_t KC_1_12 = KC_012 * oneminus_sqr_velx - KC_112 * real_t(2.0) * velX - KC_212; - const real_t KC_0_12 = (KC_012 * sqr_velx_minus_velX + KC_112 * velx_term_minus + KC_212) * real_t(0.5); - const real_t KC_2_12 = (KC_012 * sqr_velx_plus_velX + KC_112 * velx_term_plus + KC_212) * real_t(0.5); - const real_t KC_1_20 = KC_020 * oneminus_sqr_velx - KC_120 * real_t(2.0) * velX - KC_220; - const real_t KC_0_20 = (KC_020 * sqr_velx_minus_velX + KC_120 * velx_term_minus + KC_220) * real_t(0.5); - const real_t KC_2_20 = (KC_020 * sqr_velx_plus_velX + KC_120 * velx_term_plus + KC_220) * real_t(0.5); - const real_t KC_1_21 = KC_021 * oneminus_sqr_velx - KC_121 * real_t(2.0) * velX - KC_221; - const real_t KC_0_21 = (KC_021 * sqr_velx_minus_velX + KC_121 * velx_term_minus + KC_221) * real_t(0.5); - const real_t KC_2_21 = (KC_021 * sqr_velx_plus_velX + KC_121 * velx_term_plus + KC_221) * real_t(0.5); - const real_t KC_1_22 = KC_022 * oneminus_sqr_velx - KC_122 * real_t(2.0) * velX - KC_222; - const real_t KC_0_22 = (KC_022 * sqr_velx_minus_velX + KC_122 * velx_term_minus + KC_222) * real_t(0.5); - const real_t KC_2_22 = (KC_022 * sqr_velx_plus_velX + KC_122 * velx_term_plus + KC_222) * real_t(0.5); + const real_t velx_term_plus = 2.0_r * velX + 1.0_r ; + const real_t velx_term_minus = 2.0_r * velX - 1.0_r ; + + + const real_t KC_1_00 = KC_000 * oneminus_sqr_velx - KC_100 * 2.0_r * velX - KC_200; + const real_t KC_0_00 = (KC_000 * sqr_velx_minus_velX + KC_100 * velx_term_minus + KC_200) * 0.5_r; + const real_t KC_2_00 = (KC_000 * sqr_velx_plus_velX + KC_100 * velx_term_plus + KC_200) * 0.5_r; + const real_t KC_1_01 = KC_001 * oneminus_sqr_velx - KC_101 * 2.0_r * velX - KC_201; + const real_t KC_0_01 = (KC_001 * sqr_velx_minus_velX + KC_101 * velx_term_minus + KC_201) * 0.5_r; + const real_t KC_2_01 = (KC_001 * sqr_velx_plus_velX + KC_101 * velx_term_plus + KC_201) * 0.5_r; + const real_t KC_1_02 = KC_002 * oneminus_sqr_velx - KC_102 * 2.0_r * velX - KC_202; + const real_t KC_0_02 = (KC_002 * sqr_velx_minus_velX + KC_102 * velx_term_minus + KC_202) * 0.5_r; + const real_t KC_2_02 = (KC_002 * sqr_velx_plus_velX + KC_102 * velx_term_plus + KC_202) * 0.5_r; + const real_t KC_1_10 = KC_010 * oneminus_sqr_velx - KC_110 * 2.0_r * velX - KC_210; + const real_t KC_0_10 = (KC_010 * sqr_velx_minus_velX + KC_110 * velx_term_minus + KC_210) * 0.5_r; + const real_t KC_2_10 = (KC_010 * sqr_velx_plus_velX + KC_110 * velx_term_plus + KC_210) * 0.5_r; + const real_t KC_1_11 = KC_011 * oneminus_sqr_velx - KC_111 * 2.0_r * velX - KC_211; + const real_t KC_0_11 = (KC_011 * sqr_velx_minus_velX + KC_111 * velx_term_minus + KC_211) * 0.5_r; + const real_t KC_2_11 = (KC_011 * sqr_velx_plus_velX + KC_111 * velx_term_plus + KC_211) * 0.5_r; + const real_t KC_1_12 = KC_012 * oneminus_sqr_velx - KC_112 * 2.0_r * velX - KC_212; + const real_t KC_0_12 = (KC_012 * sqr_velx_minus_velX + KC_112 * velx_term_minus + KC_212) * 0.5_r; + const real_t KC_2_12 = (KC_012 * sqr_velx_plus_velX + KC_112 * velx_term_plus + KC_212) * 0.5_r; + const real_t KC_1_20 = KC_020 * oneminus_sqr_velx - KC_120 * 2.0_r * velX - KC_220; + const real_t KC_0_20 = (KC_020 * sqr_velx_minus_velX + KC_120 * velx_term_minus + KC_220) * 0.5_r; + const real_t KC_2_20 = (KC_020 * sqr_velx_plus_velX + KC_120 * velx_term_plus + KC_220) * 0.5_r; + const real_t KC_1_21 = KC_021 * oneminus_sqr_velx - KC_121 * 2.0_r * velX - KC_221; + const real_t KC_0_21 = (KC_021 * sqr_velx_minus_velX + KC_121 * velx_term_minus + KC_221) * 0.5_r; + const real_t KC_2_21 = (KC_021 * sqr_velx_plus_velX + KC_121 * velx_term_plus + KC_221) * 0.5_r; + const real_t KC_1_22 = KC_022 * oneminus_sqr_velx - KC_122 * 2.0_r * velX - KC_222; + const real_t KC_0_22 = (KC_022 * sqr_velx_minus_velX + KC_122 * velx_term_minus + KC_222) * 0.5_r; + const real_t KC_2_22 = (KC_022 * sqr_velx_plus_velX + KC_122 * velx_term_plus + KC_222) * 0.5_r; // collision is taking place from here and I need to change it from here // transform from velocity space to moment space and then to cumulant space , perform collsiopn and then again back transform to velocity space // // const defined for velocity in Y direction - const real_t oneminus_sqr_vely = real_t(1.0) - velYY ; + const real_t oneminus_sqr_vely = 1.0_r - velYY ; const real_t sqr_vely_plus_velY = velYY + velY ; const real_t sqr_vely_minus_velY = velYY - velY ; - const real_t vely_term_plus = real_t(2.0) * velY + real_t(1.0) ; - const real_t vely_term_minus = real_t(2.0) * velY - real_t(1.0) ; - - - const real_t KC_01_0 = KC_0_00 * oneminus_sqr_vely - KC_0_10 * real_t(2.0) * velY - KC_0_20; - const real_t KC_00_0 = (KC_0_00 * sqr_vely_minus_velY + KC_0_10 * vely_term_minus + KC_0_20) * real_t(0.5); - const real_t KC_02_0 = (KC_0_00 * sqr_vely_plus_velY + KC_0_10 * vely_term_plus + KC_0_20) * real_t(0.5); - const real_t KC_01_1 = KC_0_01 * oneminus_sqr_vely - KC_0_11 * real_t(2.0) * velY - KC_0_21; - const real_t KC_00_1 = (KC_0_01 * sqr_vely_minus_velY + KC_0_11 * vely_term_minus + KC_0_21) * real_t(0.5); - const real_t KC_02_1 = (KC_0_01 * sqr_vely_plus_velY + KC_0_11 * vely_term_plus + KC_0_21) * real_t(0.5); - const real_t KC_01_2 = KC_0_02 * oneminus_sqr_vely - KC_0_12 * real_t(2.0) * velY - KC_0_22; - const real_t KC_00_2 = (KC_0_02 * sqr_vely_minus_velY + KC_0_12 * vely_term_minus + KC_0_22) * real_t(0.5); - const real_t KC_02_2 = (KC_0_02 * sqr_vely_plus_velY + KC_0_12 * vely_term_plus + KC_0_22) * real_t(0.5); - const real_t KC_11_0 = KC_1_00 * oneminus_sqr_vely - KC_1_10 * real_t(2.0) * velY - KC_1_20; - const real_t KC_10_0 = (KC_1_00 * sqr_vely_minus_velY + KC_1_10 * vely_term_minus + KC_1_20) * real_t(0.5); - const real_t KC_12_0 = (KC_1_00 * sqr_vely_plus_velY + KC_1_10 * vely_term_plus + KC_1_20) * real_t(0.5); - const real_t KC_11_1 = KC_1_01 * oneminus_sqr_vely - KC_1_11 * real_t(2.0) * velY - KC_1_21; - const real_t KC_10_1 = (KC_1_01 * sqr_vely_minus_velY + KC_1_11 * vely_term_minus + KC_1_21) * real_t(0.5); - const real_t KC_12_1 = (KC_1_01 * sqr_vely_plus_velY + KC_1_11 * vely_term_plus + KC_1_21) * real_t(0.5); - const real_t KC_11_2 = KC_1_02 * oneminus_sqr_vely - KC_1_12 * real_t(2.0) * velY - KC_1_22; - const real_t KC_10_2 = (KC_1_02 * sqr_vely_minus_velY + KC_1_12 * vely_term_minus + KC_1_22) * real_t(0.5); - const real_t KC_12_2 = (KC_1_02 * sqr_vely_plus_velY + KC_1_12 * vely_term_plus + KC_1_22) * real_t(0.5); - const real_t KC_21_0 = KC_2_00 * oneminus_sqr_vely - KC_2_10 * real_t(2.0) * velY - KC_2_20; - const real_t KC_20_0 = (KC_2_00 * sqr_vely_minus_velY + KC_2_10 * vely_term_minus + KC_2_20) * real_t(0.5); - const real_t KC_22_0 = (KC_2_00 * sqr_vely_plus_velY + KC_2_10 * vely_term_plus + KC_2_20) * real_t(0.5); - const real_t KC_21_1 = KC_2_01 * oneminus_sqr_vely - KC_2_11 * real_t(2.0) * velY - KC_2_21; - const real_t KC_20_1 = (KC_2_01 * sqr_vely_minus_velY + KC_2_11 * vely_term_minus + KC_2_21) * real_t(0.5); - const real_t KC_22_1 = (KC_2_01 * sqr_vely_plus_velY + KC_2_11 * vely_term_plus + KC_2_21) * real_t(0.5); - const real_t KC_21_2 = KC_2_02 * oneminus_sqr_vely - KC_2_12 * real_t(2.0) * velY - KC_2_22; - const real_t KC_20_2 = (KC_2_02 * sqr_vely_minus_velY + KC_2_12 * vely_term_minus + KC_2_22) * real_t(0.5); - const real_t KC_22_2 = (KC_2_02 * sqr_vely_plus_velY + KC_2_12 * vely_term_plus + KC_2_22) * real_t(0.5); + const real_t vely_term_plus = 2.0_r * velY + 1.0_r ; + const real_t vely_term_minus = 2.0_r * velY - 1.0_r ; + + + const real_t KC_01_0 = KC_0_00 * oneminus_sqr_vely - KC_0_10 * 2.0_r * velY - KC_0_20; + const real_t KC_00_0 = (KC_0_00 * sqr_vely_minus_velY + KC_0_10 * vely_term_minus + KC_0_20) * 0.5_r; + const real_t KC_02_0 = (KC_0_00 * sqr_vely_plus_velY + KC_0_10 * vely_term_plus + KC_0_20) * 0.5_r; + const real_t KC_01_1 = KC_0_01 * oneminus_sqr_vely - KC_0_11 * 2.0_r * velY - KC_0_21; + const real_t KC_00_1 = (KC_0_01 * sqr_vely_minus_velY + KC_0_11 * vely_term_minus + KC_0_21) * 0.5_r; + const real_t KC_02_1 = (KC_0_01 * sqr_vely_plus_velY + KC_0_11 * vely_term_plus + KC_0_21) * 0.5_r; + const real_t KC_01_2 = KC_0_02 * oneminus_sqr_vely - KC_0_12 * 2.0_r * velY - KC_0_22; + const real_t KC_00_2 = (KC_0_02 * sqr_vely_minus_velY + KC_0_12 * vely_term_minus + KC_0_22) * 0.5_r; + const real_t KC_02_2 = (KC_0_02 * sqr_vely_plus_velY + KC_0_12 * vely_term_plus + KC_0_22) * 0.5_r; + const real_t KC_11_0 = KC_1_00 * oneminus_sqr_vely - KC_1_10 * 2.0_r * velY - KC_1_20; + const real_t KC_10_0 = (KC_1_00 * sqr_vely_minus_velY + KC_1_10 * vely_term_minus + KC_1_20) * 0.5_r; + const real_t KC_12_0 = (KC_1_00 * sqr_vely_plus_velY + KC_1_10 * vely_term_plus + KC_1_20) * 0.5_r; + const real_t KC_11_1 = KC_1_01 * oneminus_sqr_vely - KC_1_11 * 2.0_r * velY - KC_1_21; + const real_t KC_10_1 = (KC_1_01 * sqr_vely_minus_velY + KC_1_11 * vely_term_minus + KC_1_21) * 0.5_r; + const real_t KC_12_1 = (KC_1_01 * sqr_vely_plus_velY + KC_1_11 * vely_term_plus + KC_1_21) * 0.5_r; + const real_t KC_11_2 = KC_1_02 * oneminus_sqr_vely - KC_1_12 * 2.0_r * velY - KC_1_22; + const real_t KC_10_2 = (KC_1_02 * sqr_vely_minus_velY + KC_1_12 * vely_term_minus + KC_1_22) * 0.5_r; + const real_t KC_12_2 = (KC_1_02 * sqr_vely_plus_velY + KC_1_12 * vely_term_plus + KC_1_22) * 0.5_r; + const real_t KC_21_0 = KC_2_00 * oneminus_sqr_vely - KC_2_10 * 2.0_r * velY - KC_2_20; + const real_t KC_20_0 = (KC_2_00 * sqr_vely_minus_velY + KC_2_10 * vely_term_minus + KC_2_20) * 0.5_r; + const real_t KC_22_0 = (KC_2_00 * sqr_vely_plus_velY + KC_2_10 * vely_term_plus + KC_2_20) * 0.5_r; + const real_t KC_21_1 = KC_2_01 * oneminus_sqr_vely - KC_2_11 * 2.0_r * velY - KC_2_21; + const real_t KC_20_1 = (KC_2_01 * sqr_vely_minus_velY + KC_2_11 * vely_term_minus + KC_2_21) * 0.5_r; + const real_t KC_22_1 = (KC_2_01 * sqr_vely_plus_velY + KC_2_11 * vely_term_plus + KC_2_21) * 0.5_r; + const real_t KC_21_2 = KC_2_02 * oneminus_sqr_vely - KC_2_12 * 2.0_r * velY - KC_2_22; + const real_t KC_20_2 = (KC_2_02 * sqr_vely_minus_velY + KC_2_12 * vely_term_minus + KC_2_22) * 0.5_r; + const real_t KC_22_2 = (KC_2_02 * sqr_vely_plus_velY + KC_2_12 * vely_term_plus + KC_2_22) * 0.5_r; // const defined for velocity in Z direction - const real_t oneminus_sqr_velz = real_t(1.0) - velZZ ; + const real_t oneminus_sqr_velz = 1.0_r - velZZ ; const real_t sqr_velz_plus_velZ = velZZ + velZ ; const real_t sqr_velz_minus_velZ = velZZ - velZ ; - const real_t velz_term_plus = real_t(2.0) * velZ + real_t(1.0) ; - const real_t velz_term_minus = real_t(2.0) * velZ - real_t(1.0) ; - - dst->get(x,y,z,Stencil_T::idx[SW]) = KC_00_0 * oneminus_sqr_velz - KC_00_1 * real_t(2.0) * velZ - KC_00_2; - dst->get(x,y,z,Stencil_T::idx[BSW]) = (KC_00_0 * sqr_velz_minus_velZ + KC_00_1 * velz_term_minus + KC_00_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[TSW]) = (KC_00_0 * sqr_velz_plus_velZ + KC_00_1 * velz_term_plus + KC_00_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[W]) = KC_01_0 * oneminus_sqr_velz - KC_01_1 * real_t(2.0) * velZ - KC_01_2; - dst->get(x,y,z,Stencil_T::idx[BW]) = (KC_01_0 * sqr_velz_minus_velZ + KC_01_1 * velz_term_minus + KC_01_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[TW]) = (KC_01_0 * sqr_velz_plus_velZ + KC_01_1 * velz_term_plus + KC_01_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[NW]) = KC_02_0 * oneminus_sqr_velz - KC_02_1 * real_t(2.0) * velZ - KC_02_2; - dst->get(x,y,z,Stencil_T::idx[BNW]) = (KC_02_0 * sqr_velz_minus_velZ + KC_02_1 * velz_term_minus + KC_02_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[TNW]) = (KC_02_0 * sqr_velz_plus_velZ + KC_02_1 * velz_term_plus + KC_02_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[S]) = KC_10_0 * oneminus_sqr_velz - KC_10_1 * real_t(2.0) * velZ - KC_10_2; - dst->get(x,y,z,Stencil_T::idx[BS]) = (KC_10_0 * sqr_velz_minus_velZ + KC_10_1 * velz_term_minus + KC_10_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[TS]) = (KC_10_0 * sqr_velz_plus_velZ + KC_10_1 * velz_term_plus + KC_10_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[C]) = KC_11_0 * oneminus_sqr_velz - KC_11_1 * real_t(2.0) * velZ - KC_11_2; - dst->get(x,y,z,Stencil_T::idx[B]) = (KC_11_0 * sqr_velz_minus_velZ + KC_11_1 * velz_term_minus + KC_11_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[T]) = (KC_11_0 * sqr_velz_plus_velZ + KC_11_1 * velz_term_plus + KC_11_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[N]) = KC_12_0 * oneminus_sqr_velz - KC_12_1 * real_t(2.0) * velZ - KC_12_2; - dst->get(x,y,z,Stencil_T::idx[BN]) = (KC_12_0 * sqr_velz_minus_velZ + KC_12_1 * velz_term_minus + KC_12_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[TN]) = (KC_12_0 * sqr_velz_plus_velZ + KC_12_1 * velz_term_plus + KC_12_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[SE]) = KC_20_0 * oneminus_sqr_velz - KC_20_1 * real_t(2.0) * velZ - KC_20_2; - dst->get(x,y,z,Stencil_T::idx[BSE]) = (KC_20_0 * sqr_velz_minus_velZ + KC_20_1 * velz_term_minus + KC_20_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[TSE]) = (KC_20_0 * sqr_velz_plus_velZ + KC_20_1 * velz_term_plus + KC_20_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[E]) = KC_21_0 * oneminus_sqr_velz - KC_21_1 * real_t(2.0) * velZ - KC_21_2; - dst->get(x,y,z,Stencil_T::idx[BE]) = (KC_21_0 * sqr_velz_minus_velZ + KC_21_1 * velz_term_minus + KC_21_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[TE]) = (KC_21_0 * sqr_velz_plus_velZ + KC_21_1 * velz_term_plus + KC_21_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[NE]) = KC_22_0 * oneminus_sqr_velz - KC_22_1 * real_t(2.0) * velZ - KC_22_2; - dst->get(x,y,z,Stencil_T::idx[BNE]) = (KC_22_0 * sqr_velz_minus_velZ + KC_22_1 * velz_term_minus + KC_22_2) * real_t(0.5); - dst->get(x,y,z,Stencil_T::idx[TNE]) = (KC_22_0 * sqr_velz_plus_velZ + KC_22_1 * velz_term_plus + KC_22_2) * real_t(0.5); + const real_t velz_term_plus = 2.0_r * velZ + 1.0_r ; + const real_t velz_term_minus = 2.0_r * velZ - 1.0_r ; + + dst->get(x,y,z,Stencil_T::idx[SW]) = KC_00_0 * oneminus_sqr_velz - KC_00_1 * 2.0_r * velZ - KC_00_2; + dst->get(x,y,z,Stencil_T::idx[BSW]) = (KC_00_0 * sqr_velz_minus_velZ + KC_00_1 * velz_term_minus + KC_00_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[TSW]) = (KC_00_0 * sqr_velz_plus_velZ + KC_00_1 * velz_term_plus + KC_00_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[W]) = KC_01_0 * oneminus_sqr_velz - KC_01_1 * 2.0_r * velZ - KC_01_2; + dst->get(x,y,z,Stencil_T::idx[BW]) = (KC_01_0 * sqr_velz_minus_velZ + KC_01_1 * velz_term_minus + KC_01_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[TW]) = (KC_01_0 * sqr_velz_plus_velZ + KC_01_1 * velz_term_plus + KC_01_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[NW]) = KC_02_0 * oneminus_sqr_velz - KC_02_1 * 2.0_r * velZ - KC_02_2; + dst->get(x,y,z,Stencil_T::idx[BNW]) = (KC_02_0 * sqr_velz_minus_velZ + KC_02_1 * velz_term_minus + KC_02_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[TNW]) = (KC_02_0 * sqr_velz_plus_velZ + KC_02_1 * velz_term_plus + KC_02_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[S]) = KC_10_0 * oneminus_sqr_velz - KC_10_1 * 2.0_r * velZ - KC_10_2; + dst->get(x,y,z,Stencil_T::idx[BS]) = (KC_10_0 * sqr_velz_minus_velZ + KC_10_1 * velz_term_minus + KC_10_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[TS]) = (KC_10_0 * sqr_velz_plus_velZ + KC_10_1 * velz_term_plus + KC_10_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[C]) = KC_11_0 * oneminus_sqr_velz - KC_11_1 * 2.0_r * velZ - KC_11_2; + dst->get(x,y,z,Stencil_T::idx[B]) = (KC_11_0 * sqr_velz_minus_velZ + KC_11_1 * velz_term_minus + KC_11_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[T]) = (KC_11_0 * sqr_velz_plus_velZ + KC_11_1 * velz_term_plus + KC_11_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[N]) = KC_12_0 * oneminus_sqr_velz - KC_12_1 * 2.0_r * velZ - KC_12_2; + dst->get(x,y,z,Stencil_T::idx[BN]) = (KC_12_0 * sqr_velz_minus_velZ + KC_12_1 * velz_term_minus + KC_12_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[TN]) = (KC_12_0 * sqr_velz_plus_velZ + KC_12_1 * velz_term_plus + KC_12_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[SE]) = KC_20_0 * oneminus_sqr_velz - KC_20_1 * 2.0_r * velZ - KC_20_2; + dst->get(x,y,z,Stencil_T::idx[BSE]) = (KC_20_0 * sqr_velz_minus_velZ + KC_20_1 * velz_term_minus + KC_20_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[TSE]) = (KC_20_0 * sqr_velz_plus_velZ + KC_20_1 * velz_term_plus + KC_20_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[E]) = KC_21_0 * oneminus_sqr_velz - KC_21_1 * 2.0_r * velZ - KC_21_2; + dst->get(x,y,z,Stencil_T::idx[BE]) = (KC_21_0 * sqr_velz_minus_velZ + KC_21_1 * velz_term_minus + KC_21_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[TE]) = (KC_21_0 * sqr_velz_plus_velZ + KC_21_1 * velz_term_plus + KC_21_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[NE]) = KC_22_0 * oneminus_sqr_velz - KC_22_1 * 2.0_r * velZ - KC_22_2; + dst->get(x,y,z,Stencil_T::idx[BNE]) = (KC_22_0 * sqr_velz_minus_velZ + KC_22_1 * velz_term_minus + KC_22_2) * 0.5_r; + dst->get(x,y,z,Stencil_T::idx[TNE]) = (KC_22_0 * sqr_velz_plus_velZ + KC_22_1 * velz_term_plus + KC_22_2) * 0.5_r; } @@ -493,16 +493,16 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t omega10 = src->latticeModel().collisionModel().omega10(); // This is the omega term used in the collision process - const real_t omega_trm1( real_t(1.0) - omega1 ); - const real_t omega_trm2( real_t(1.0) - omega2 ); - const real_t omega_trm3( real_t(1.0) - omega3 ); - const real_t omega_trm4( real_t(1.0) - omega4 ); - const real_t omega_trm5( real_t(1.0) - omega5 ); - const real_t omega_trm6( real_t(1.0) - omega6 ); - const real_t omega_trm7( real_t(1.0) - omega7 ); - const real_t omega_trm8( real_t(1.0) - omega8 ); - const real_t omega_trm9( real_t(1.0) - omega9 ); - const real_t omega_trm10( real_t(1.0) - omega10 ); + const real_t omega_trm1( 1.0_r - omega1 ); + const real_t omega_trm2( 1.0_r - omega2 ); + const real_t omega_trm3( 1.0_r - omega3 ); + const real_t omega_trm4( 1.0_r - omega4 ); + const real_t omega_trm5( 1.0_r - omega5 ); + const real_t omega_trm6( 1.0_r - omega6 ); + const real_t omega_trm7( 1.0_r - omega7 ); + const real_t omega_trm8( 1.0_r - omega8 ); + const real_t omega_trm9( 1.0_r - omega9 ); + const real_t omega_trm10( 1.0_r - omega10 ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -526,11 +526,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA // defining velocity terms for central moment space // velocity in z direction - const real_t velz_term = real_t(-1.0) * velZ ; + const real_t velz_term = -1.0_r * velZ ; const real_t sqr_velz_term = velz_term * velz_term ; - const real_t oneminus_velz = real_t(1.0) - velZ ; + const real_t oneminus_velz = 1.0_r - velZ ; const real_t sqr_oneminus_velz = oneminus_velz * oneminus_velz ; - const real_t negoneminus_velz = real_t(-1.0) - velZ ; + const real_t negoneminus_velz = -1.0_r - velZ ; const real_t sqr_negoneminus_velz = negoneminus_velz * negoneminus_velz ; // Declaring the constants and initialising them with distribution function to transform for the moment space @@ -563,11 +563,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t k_22_2 = vBNE * sqr_negoneminus_velz + vNE * sqr_velz_term + vTNE * sqr_oneminus_velz ; // velocity in y direction - const real_t vely_term = real_t(-1.0) * velY ; + const real_t vely_term = -1.0_r * velY ; const real_t sqr_vely_term = vely_term * vely_term ; - const real_t oneminus_vely = real_t(1.0) - velY ; + const real_t oneminus_vely = 1.0_r - velY ; const real_t sqr_oneminus_vely = oneminus_vely * oneminus_vely ; - const real_t negoneminus_vely = real_t(-1.0) - velY ; + const real_t negoneminus_vely = -1.0_r - velY ; const real_t sqr_negoneminus_vely = negoneminus_vely * negoneminus_vely ; const real_t k_0_00 = k_00_0 + k_01_0 + k_02_0; @@ -599,11 +599,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t k_2_22 = k_20_2 * sqr_negoneminus_vely + k_21_2 * sqr_vely_term + k_22_2 * sqr_oneminus_vely; // Velocity in x direction - const real_t velx_term = real_t(-1.0) * velX ; + const real_t velx_term = -1.0_r * velX ; const real_t sqr_velx_term = velx_term * velx_term ; - const real_t oneminus_velx = real_t(1.0) - velX ; + const real_t oneminus_velx = 1.0_r - velX ; const real_t sqr_oneminus_velx = oneminus_velx * oneminus_velx ; - const real_t negoneminus_velx = real_t(-1.0) - velX ; + const real_t negoneminus_velx = -1.0_r - velX ; const real_t sqr_negoneminus_velx = negoneminus_velx * negoneminus_velx ; const real_t k_000 = k_0_00 + k_1_00 + k_2_00 ; @@ -637,7 +637,7 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA // transformation to moment space done now , transform to cumulant space // defining the constants for central moment space - const real_t rho_inv = real_t(1.0) / updated_rho; + const real_t rho_inv = 1.0_r / updated_rho; // defining the sqaures const real_t sqr_k_110 = k_110 * k_110 ; @@ -656,26 +656,26 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t C_012 = k_012 ; const real_t C_020 = k_020 ; const real_t C_021 = k_021 ; - const real_t C_022 = k_022 - (k_020 * k_002 + real_t(2.0) * sqr_k_011) * rho_inv ; + const real_t C_022 = k_022 - (k_020 * k_002 + 2.0_r * sqr_k_011) * rho_inv ; const real_t C_100 = k_100 ; const real_t C_101 = k_101 ; const real_t C_102 = k_102 ; const real_t C_110 = k_110 ; const real_t C_111 = k_111 ; - const real_t C_112 = k_112 - (k_002 * k_110 + real_t(2.0) * k_101 * k_011) * rho_inv ; + const real_t C_112 = k_112 - (k_002 * k_110 + 2.0_r * k_101 * k_011) * rho_inv ; const real_t C_120 = k_120 ; - const real_t C_121 = k_121 - (k_020 * k_101 + real_t(2.0) * k_011 * k_110) * rho_inv ; - const real_t C_122 = k_122 - (k_002 * k_120 + k_020 * k_120 + real_t(4.0) * k_011 * k_111 + real_t(2.0) * (k_101 * k_021 + k_110 * k_012)) * rho_inv ; + const real_t C_121 = k_121 - (k_020 * k_101 + 2.0_r * k_011 * k_110) * rho_inv ; + const real_t C_122 = k_122 - (k_002 * k_120 + k_020 * k_120 + 4.0_r * k_011 * k_111 + 2.0_r * (k_101 * k_021 + k_110 * k_012)) * rho_inv ; const real_t C_200 = k_200 ; const real_t C_201 = k_201 ; - const real_t C_202 = k_202 - (k_002 * k_200 + real_t(2.0) * sqr_k_101) * rho_inv ; + const real_t C_202 = k_202 - (k_002 * k_200 + 2.0_r * sqr_k_101) * rho_inv ; const real_t C_210 = k_210 ; - const real_t C_211 = k_211 - (k_200 * k_011 + real_t(2.0) * k_110 * k_101) * rho_inv ; - const real_t C_212 = k_212 - (k_002 * k_210 + k_200 * k_210 + real_t(4.0) * k_101 * k_111 + real_t(2.0) * (k_011 * k_201 + k_110 * k_102)) * rho_inv ; - const real_t C_220 = k_220 - (k_200 * k_020 + real_t(2.0) * sqr_k_110) * rho_inv ; - const real_t C_221 = k_221 - (k_020 * k_201 + k_200 * k_201 + real_t(4.0) * k_110 * k_111 + real_t(2.0) * (k_011 * k_210 + k_101 * k_120)) * rho_inv ; - const real_t C_222 = k_222 - (real_t(4.0)* sqr_k_111 + k_200 * k_022 + k_020 * k_202 + k_002 * k_220 + real_t(4.0) * (k_011 * k_211 + k_101 * k_121 + k_110 * k_112) + real_t(2.0) * (k_120 * k_102 + k_210 * k_012 + k_201 * k_021)) * rho_inv - + (real_t(16.0) * k_110 * k_101 * k_011 + real_t(4.0) * (k_020 * sqr_k_101 + k_200 * sqr_k_011 + k_002 * sqr_k_110) + real_t(2.0) * k_200 *k_020 * k_002) * sqr_rho_inv ; + const real_t C_211 = k_211 - (k_200 * k_011 + 2.0_r * k_110 * k_101) * rho_inv ; + const real_t C_212 = k_212 - (k_002 * k_210 + k_200 * k_210 + 4.0_r * k_101 * k_111 + 2.0_r * (k_011 * k_201 + k_110 * k_102)) * rho_inv ; + const real_t C_220 = k_220 - (k_200 * k_020 + 2.0_r * sqr_k_110) * rho_inv ; + const real_t C_221 = k_221 - (k_020 * k_201 + k_200 * k_201 + 4.0_r * k_110 * k_111 + 2.0_r * (k_011 * k_210 + k_101 * k_120)) * rho_inv ; + const real_t C_222 = k_222 - (4.0_r* sqr_k_111 + k_200 * k_022 + k_020 * k_202 + k_002 * k_220 + 4.0_r * (k_011 * k_211 + k_101 * k_121 + k_110 * k_112) + 2.0_r * (k_120 * k_102 + k_210 * k_012 + k_201 * k_021)) * rho_inv + + (16.0_r * k_110 * k_101 * k_011 + 4.0_r * (k_020 * sqr_k_101 + k_200 * sqr_k_011 + k_002 * sqr_k_110) + 2.0_r * k_200 *k_020 * k_002) * sqr_rho_inv ; // collision happens in cumulant space @@ -687,14 +687,14 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t CS_101 = omega_trm1 * C_101 ; const real_t CS_011 = omega_trm1 * C_011 ; - const real_t Dxux = -real_t(0.5) * omega1 * rho_inv * (real_t(2.0) * C_200 - C_020 - C_002) - real_t(0.5) * omega2 * rho_inv * (C_200 + C_020 + C_002 - C_000) ; - const real_t Dyuy = Dxux + real_t(1.5) * omega1 * rho_inv * (C_200 - C_020) ; - const real_t Dzuz = Dxux + real_t(1.5) * omega1 * rho_inv * (C_200 - C_002) ; + const real_t Dxux = -0.5_r * omega1 * rho_inv * (2.0_r * C_200 - C_020 - C_002) - 0.5_r * omega2 * rho_inv * (C_200 + C_020 + C_002 - C_000) ; + const real_t Dyuy = Dxux + 1.5_r * omega1 * rho_inv * (C_200 - C_020) ; + const real_t Dzuz = Dxux + 1.5_r * omega1 * rho_inv * (C_200 - C_002) ; - const real_t CS_200__m__CS020 = (omega_trm1) * (C_200 - C_020) - real_t(3.0) * updated_rho * (real_t(1.0) - real_t(0.5) * omega1) * (Dxux * velXX - Dyuy * velYY) ; - const real_t CS_200__m__CS002 = (omega_trm1) * (C_200 - C_002) - real_t(3.0) * updated_rho * (real_t(1.0) - real_t(0.5) * omega1) * (Dxux * velXX - Dzuz * velZZ) ; - const real_t CS_200__p__CS020__p__CS_002 = omega2 * C_000 + (omega_trm2) * (C_200 + C_020 + C_002) - real_t(3.0) * updated_rho *(real_t(1.0) - real_t(0.5) * omega2) * (Dxux * velXX + Dyuy * velYY + Dzuz * velZZ); - const real_t CS_200 = (CS_200__m__CS020 + CS_200__m__CS002 + CS_200__p__CS020__p__CS_002) / real_t(3.0) ; + const real_t CS_200__m__CS020 = (omega_trm1) * (C_200 - C_020) - 3.0_r * updated_rho * (1.0_r - 0.5_r * omega1) * (Dxux * velXX - Dyuy * velYY) ; + const real_t CS_200__m__CS002 = (omega_trm1) * (C_200 - C_002) - 3.0_r * updated_rho * (1.0_r - 0.5_r * omega1) * (Dxux * velXX - Dzuz * velZZ) ; + const real_t CS_200__p__CS020__p__CS_002 = omega2 * C_000 + (omega_trm2) * (C_200 + C_020 + C_002) - 3.0_r * updated_rho *(1.0_r - 0.5_r * omega2) * (Dxux * velXX + Dyuy * velYY + Dzuz * velZZ); + const real_t CS_200 = (CS_200__m__CS020 + CS_200__m__CS002 + CS_200__p__CS020__p__CS_002) / 3.0_r ; const real_t CS_020 = CS_200 - CS_200__m__CS020 ; const real_t CS_002 = CS_200 - CS_200__m__CS002 ; const real_t CS_120__p__CS_102 = (omega_trm3) * (C_120 + C_102) ; @@ -704,21 +704,21 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t CS_210__m__CS_012 = (omega_trm4) * (C_210 - C_012) ; const real_t CS_201__m__CS_021 = (omega_trm4) * (C_201 - C_021) ; - const real_t CS_120 = real_t(0.5) * (CS_120__p__CS_102 + CS_120__m__CS_102) ; - const real_t CS_102 = real_t(0.5) * (CS_120__p__CS_102 - CS_120__m__CS_102) ; - const real_t CS_012 = real_t(0.5) * (CS_210__p__CS_012 - CS_210__m__CS_012) ; - const real_t CS_210 = real_t(0.5) * (CS_210__p__CS_012 + CS_210__m__CS_012) ; - const real_t CS_201 = real_t(0.5) * (CS_201__p__CS_021 + CS_201__m__CS_021) ; - const real_t CS_021 = real_t(0.5) * (CS_201__p__CS_021 - CS_201__m__CS_021) ; + const real_t CS_120 = 0.5_r * (CS_120__p__CS_102 + CS_120__m__CS_102) ; + const real_t CS_102 = 0.5_r * (CS_120__p__CS_102 - CS_120__m__CS_102) ; + const real_t CS_012 = 0.5_r * (CS_210__p__CS_012 - CS_210__m__CS_012) ; + const real_t CS_210 = 0.5_r * (CS_210__p__CS_012 + CS_210__m__CS_012) ; + const real_t CS_201 = 0.5_r * (CS_201__p__CS_021 + CS_201__m__CS_021) ; + const real_t CS_021 = 0.5_r * (CS_201__p__CS_021 - CS_201__m__CS_021) ; const real_t CS_111 = (omega_trm5) * C_111 ; - const real_t CS_220__m__2CS_202__p__CS_022 = (omega_trm6) * (C_220 - real_t(2.0) * C_202 + C_022) ; - const real_t CS_220__p__CS_202__m__2CS_022 = (omega_trm6) * (C_220 + C_202 - real_t(2.0) * C_022) ; + const real_t CS_220__m__2CS_202__p__CS_022 = (omega_trm6) * (C_220 - 2.0_r * C_202 + C_022) ; + const real_t CS_220__p__CS_202__m__2CS_022 = (omega_trm6) * (C_220 + C_202 - 2.0_r * C_022) ; const real_t CS_220__p__CS_202__p__CS_022 = (omega_trm7) * (C_220 + C_202 + C_022) ; - const real_t CS_220 = (CS_220__m__2CS_202__p__CS_022 + CS_220__p__CS_202__m__2CS_022 + CS_220__p__CS_202__p__CS_022) / real_t(3.0) ; - const real_t CS_202 = (CS_220__p__CS_202__p__CS_022 - CS_220__m__2CS_202__p__CS_022) / real_t(3.0) ; - const real_t CS_022 = (CS_220__p__CS_202__p__CS_022 - CS_220__p__CS_202__m__2CS_022) / real_t(3.0) ; + const real_t CS_220 = (CS_220__m__2CS_202__p__CS_022 + CS_220__p__CS_202__m__2CS_022 + CS_220__p__CS_202__p__CS_022) / 3.0_r ; + const real_t CS_202 = (CS_220__p__CS_202__p__CS_022 - CS_220__m__2CS_202__p__CS_022) / 3.0_r ; + const real_t CS_022 = (CS_220__p__CS_202__p__CS_022 - CS_220__p__CS_202__m__2CS_022) / 3.0_r ; const real_t CS_211 = (omega_trm8 ) * C_211 ; const real_t CS_121 = (omega_trm8 ) * C_121 ; @@ -741,151 +741,151 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t sqr_KC_101 = KC_101 * KC_101 ; - const real_t KC_202 = CS_202 + (KC_002 * KC_200 + real_t(2.0) * sqr_KC_101) * rho_inv ; + const real_t KC_202 = CS_202 + (KC_002 * KC_200 + 2.0_r * sqr_KC_101) * rho_inv ; const real_t KC_010 = CS_010 ; const real_t KC_110 = CS_110 ; const real_t KC_210 = CS_210 ; const real_t KC_011 = CS_011 ; const real_t KC_111 = CS_111 ; - const real_t KC_211 = CS_211 + (KC_200 * KC_011 + real_t(2.0) * KC_110 * KC_101) * rho_inv ; + const real_t KC_211 = CS_211 + (KC_200 * KC_011 + 2.0_r * KC_110 * KC_101) * rho_inv ; const real_t KC_012 = CS_012; - const real_t KC_112 = CS_112 + (KC_002 * KC_110 + real_t(2.0) * KC_101 * KC_011) * rho_inv ; - const real_t KC_212 = CS_212 + (KC_002 * KC_210 + KC_200 * KC_210 + real_t(4.0) * KC_101 * KC_111 + real_t(2.0) * (KC_011 * KC_201 + KC_110 * KC_102)) * rho_inv ; + const real_t KC_112 = CS_112 + (KC_002 * KC_110 + 2.0_r * KC_101 * KC_011) * rho_inv ; + const real_t KC_212 = CS_212 + (KC_002 * KC_210 + KC_200 * KC_210 + 4.0_r * KC_101 * KC_111 + 2.0_r * (KC_011 * KC_201 + KC_110 * KC_102)) * rho_inv ; const real_t KC_020 = CS_020; const real_t KC_120 = CS_120; const real_t sqr_KC_110 = KC_110 * KC_110 ; - const real_t KC_220 = CS_220 + (KC_200 * KC_020 + real_t(2.0) * sqr_KC_110) * rho_inv; + const real_t KC_220 = CS_220 + (KC_200 * KC_020 + 2.0_r * sqr_KC_110) * rho_inv; const real_t KC_021 = CS_021; - const real_t KC_121 = CS_121 + (KC_020 * KC_101 + real_t(2.0) * KC_011 * KC_110) * rho_inv; - const real_t KC_221 = CS_221 + (KC_020 * KC_201 + KC_200 * KC_201 + real_t(4.0) * KC_110 * KC_111 + real_t(2.0) * (KC_011 * KC_210 + KC_101 * KC_120)) * rho_inv; + const real_t KC_121 = CS_121 + (KC_020 * KC_101 + 2.0_r * KC_011 * KC_110) * rho_inv; + const real_t KC_221 = CS_221 + (KC_020 * KC_201 + KC_200 * KC_201 + 4.0_r * KC_110 * KC_111 + 2.0_r * (KC_011 * KC_210 + KC_101 * KC_120)) * rho_inv; const real_t sqr_KC_011 = KC_011 * KC_011 ; - const real_t KC_022 = CS_022 + (KC_020 * KC_002 + real_t(2.0) * sqr_KC_011) * rho_inv; - const real_t KC_122 = CS_122 + (KC_002 * KC_120 + KC_020 * KC_120 + real_t(4.0) * KC_011 * KC_111 + real_t(2.0) * (KC_101 * KC_021 + KC_110 * KC_012)) * rho_inv; + const real_t KC_022 = CS_022 + (KC_020 * KC_002 + 2.0_r * sqr_KC_011) * rho_inv; + const real_t KC_122 = CS_122 + (KC_002 * KC_120 + KC_020 * KC_120 + 4.0_r * KC_011 * KC_111 + 2.0_r * (KC_101 * KC_021 + KC_110 * KC_012)) * rho_inv; const real_t sqr_KC_111 = KC_111 * KC_111 ; - const real_t KC_222 = CS_222 + (real_t(4.0) * sqr_KC_111 + KC_200 * KC_022 + KC_020 * KC_202 + KC_002 * KC_220 + real_t(4.0) * (KC_011 * KC_211 + KC_101 * KC_121 + KC_110 * KC_112) + real_t(2.0) * (KC_120 * KC_102 + KC_210 * KC_012 + KC_201 * KC_021)) * rho_inv - - (real_t(16.0) * KC_110 * KC_101 * KC_011 + real_t(4.0) * (KC_020 * sqr_KC_101 + KC_200 * sqr_KC_011 + KC_002 * sqr_KC_110) + real_t(2.0) * KC_200 * KC_020 * KC_002) * sqr_rho_inv; + const real_t KC_222 = CS_222 + (4.0_r * sqr_KC_111 + KC_200 * KC_022 + KC_020 * KC_202 + KC_002 * KC_220 + 4.0_r * (KC_011 * KC_211 + KC_101 * KC_121 + KC_110 * KC_112) + 2.0_r * (KC_120 * KC_102 + KC_210 * KC_012 + KC_201 * KC_021)) * rho_inv + - (16.0_r * KC_110 * KC_101 * KC_011 + 4.0_r * (KC_020 * sqr_KC_101 + KC_200 * sqr_KC_011 + KC_002 * sqr_KC_110) + 2.0_r * KC_200 * KC_020 * KC_002) * sqr_rho_inv; // trnasform back to central moment space // transform from central moment space to distribution funtion // const defined for velocity in X direction - const real_t oneminus_sqr_velx = real_t(1.0) - velXX ; + const real_t oneminus_sqr_velx = 1.0_r - velXX ; const real_t sqr_velx_plus_velX = velXX + velX ; const real_t sqr_velx_minus_velX = velXX - velX ; - const real_t velx_term_plus = real_t(2.0) * velX + real_t(1.0) ; - const real_t velx_term_minus = real_t(2.0) * velX - real_t(1.0) ; - - - const real_t KC_1_00 = KC_000 * oneminus_sqr_velx - KC_100 * real_t(2.0) * velX - KC_200; - const real_t KC_0_00 = (KC_000 * sqr_velx_minus_velX + KC_100 * velx_term_minus + KC_200) * real_t(0.5); - const real_t KC_2_00 = (KC_000 * sqr_velx_plus_velX + KC_100 * velx_term_plus + KC_200) * real_t(0.5); - const real_t KC_1_01 = KC_001 * oneminus_sqr_velx - KC_101 * real_t(2.0) * velX - KC_201; - const real_t KC_0_01 = (KC_001 * sqr_velx_minus_velX + KC_101 * velx_term_minus + KC_201) * real_t(0.5); - const real_t KC_2_01 = (KC_001 * sqr_velx_plus_velX + KC_101 * velx_term_plus + KC_201) * real_t(0.5); - const real_t KC_1_02 = KC_002 * oneminus_sqr_velx - KC_102 * real_t(2.0) * velX - KC_202; - const real_t KC_0_02 = (KC_002 * sqr_velx_minus_velX + KC_102 * velx_term_minus + KC_202) * real_t(0.5); - const real_t KC_2_02 = (KC_002 * sqr_velx_plus_velX + KC_102 * velx_term_plus + KC_202) * real_t(0.5); - const real_t KC_1_10 = KC_010 * oneminus_sqr_velx - KC_110 * real_t(2.0) * velX - KC_210; - const real_t KC_0_10 = (KC_010 * sqr_velx_minus_velX + KC_110 * velx_term_minus + KC_210) * real_t(0.5); - const real_t KC_2_10 = (KC_010 * sqr_velx_plus_velX + KC_110 * velx_term_plus + KC_210) * real_t(0.5); - const real_t KC_1_11 = KC_011 * oneminus_sqr_velx - KC_111 * real_t(2.0) * velX - KC_211; - const real_t KC_0_11 = (KC_011 * sqr_velx_minus_velX + KC_111 * velx_term_minus + KC_211) * real_t(0.5); - const real_t KC_2_11 = (KC_011 * sqr_velx_plus_velX + KC_111 * velx_term_plus + KC_211) * real_t(0.5); - const real_t KC_1_12 = KC_012 * oneminus_sqr_velx - KC_112 * real_t(2.0) * velX - KC_212; - const real_t KC_0_12 = (KC_012 * sqr_velx_minus_velX + KC_112 * velx_term_minus + KC_212) * real_t(0.5); - const real_t KC_2_12 = (KC_012 * sqr_velx_plus_velX + KC_112 * velx_term_plus + KC_212) * real_t(0.5); - const real_t KC_1_20 = KC_020 * oneminus_sqr_velx - KC_120 * real_t(2.0) * velX - KC_220; - const real_t KC_0_20 = (KC_020 * sqr_velx_minus_velX + KC_120 * velx_term_minus + KC_220) * real_t(0.5); - const real_t KC_2_20 = (KC_020 * sqr_velx_plus_velX + KC_120 * velx_term_plus + KC_220) * real_t(0.5); - const real_t KC_1_21 = KC_021 * oneminus_sqr_velx - KC_121 * real_t(2.0) * velX - KC_221; - const real_t KC_0_21 = (KC_021 * sqr_velx_minus_velX + KC_121 * velx_term_minus + KC_221) * real_t(0.5); - const real_t KC_2_21 = (KC_021 * sqr_velx_plus_velX + KC_121 * velx_term_plus + KC_221) * real_t(0.5); - const real_t KC_1_22 = KC_022 * oneminus_sqr_velx - KC_122 * real_t(2.0) * velX - KC_222; - const real_t KC_0_22 = (KC_022 * sqr_velx_minus_velX + KC_122 * velx_term_minus + KC_222) * real_t(0.5); - const real_t KC_2_22 = (KC_022 * sqr_velx_plus_velX + KC_122 * velx_term_plus + KC_222) * real_t(0.5); + const real_t velx_term_plus = 2.0_r * velX + 1.0_r ; + const real_t velx_term_minus = 2.0_r * velX - 1.0_r ; + + + const real_t KC_1_00 = KC_000 * oneminus_sqr_velx - KC_100 * 2.0_r * velX - KC_200; + const real_t KC_0_00 = (KC_000 * sqr_velx_minus_velX + KC_100 * velx_term_minus + KC_200) * 0.5_r; + const real_t KC_2_00 = (KC_000 * sqr_velx_plus_velX + KC_100 * velx_term_plus + KC_200) * 0.5_r; + const real_t KC_1_01 = KC_001 * oneminus_sqr_velx - KC_101 * 2.0_r * velX - KC_201; + const real_t KC_0_01 = (KC_001 * sqr_velx_minus_velX + KC_101 * velx_term_minus + KC_201) * 0.5_r; + const real_t KC_2_01 = (KC_001 * sqr_velx_plus_velX + KC_101 * velx_term_plus + KC_201) * 0.5_r; + const real_t KC_1_02 = KC_002 * oneminus_sqr_velx - KC_102 * 2.0_r * velX - KC_202; + const real_t KC_0_02 = (KC_002 * sqr_velx_minus_velX + KC_102 * velx_term_minus + KC_202) * 0.5_r; + const real_t KC_2_02 = (KC_002 * sqr_velx_plus_velX + KC_102 * velx_term_plus + KC_202) * 0.5_r; + const real_t KC_1_10 = KC_010 * oneminus_sqr_velx - KC_110 * 2.0_r * velX - KC_210; + const real_t KC_0_10 = (KC_010 * sqr_velx_minus_velX + KC_110 * velx_term_minus + KC_210) * 0.5_r; + const real_t KC_2_10 = (KC_010 * sqr_velx_plus_velX + KC_110 * velx_term_plus + KC_210) * 0.5_r; + const real_t KC_1_11 = KC_011 * oneminus_sqr_velx - KC_111 * 2.0_r * velX - KC_211; + const real_t KC_0_11 = (KC_011 * sqr_velx_minus_velX + KC_111 * velx_term_minus + KC_211) * 0.5_r; + const real_t KC_2_11 = (KC_011 * sqr_velx_plus_velX + KC_111 * velx_term_plus + KC_211) * 0.5_r; + const real_t KC_1_12 = KC_012 * oneminus_sqr_velx - KC_112 * 2.0_r * velX - KC_212; + const real_t KC_0_12 = (KC_012 * sqr_velx_minus_velX + KC_112 * velx_term_minus + KC_212) * 0.5_r; + const real_t KC_2_12 = (KC_012 * sqr_velx_plus_velX + KC_112 * velx_term_plus + KC_212) * 0.5_r; + const real_t KC_1_20 = KC_020 * oneminus_sqr_velx - KC_120 * 2.0_r * velX - KC_220; + const real_t KC_0_20 = (KC_020 * sqr_velx_minus_velX + KC_120 * velx_term_minus + KC_220) * 0.5_r; + const real_t KC_2_20 = (KC_020 * sqr_velx_plus_velX + KC_120 * velx_term_plus + KC_220) * 0.5_r; + const real_t KC_1_21 = KC_021 * oneminus_sqr_velx - KC_121 * 2.0_r * velX - KC_221; + const real_t KC_0_21 = (KC_021 * sqr_velx_minus_velX + KC_121 * velx_term_minus + KC_221) * 0.5_r; + const real_t KC_2_21 = (KC_021 * sqr_velx_plus_velX + KC_121 * velx_term_plus + KC_221) * 0.5_r; + const real_t KC_1_22 = KC_022 * oneminus_sqr_velx - KC_122 * 2.0_r * velX - KC_222; + const real_t KC_0_22 = (KC_022 * sqr_velx_minus_velX + KC_122 * velx_term_minus + KC_222) * 0.5_r; + const real_t KC_2_22 = (KC_022 * sqr_velx_plus_velX + KC_122 * velx_term_plus + KC_222) * 0.5_r; // collision is taking place from here and I need to change it from here // transform from velocity space to moment space and then to cumulant space , perform collsiopn and then again back transform to velocity space // // const defined for velocity in Y direction - const real_t oneminus_sqr_vely = real_t(1.0) - velYY ; + const real_t oneminus_sqr_vely = 1.0_r - velYY ; const real_t sqr_vely_plus_velY = velYY + velY ; const real_t sqr_vely_minus_velY = velYY - velY ; - const real_t vely_term_plus = real_t(2.0) * velY + real_t(1.0) ; - const real_t vely_term_minus = real_t(2.0) * velY - real_t(1.0) ; - - - const real_t KC_01_0 = KC_0_00 * oneminus_sqr_vely - KC_0_10 * real_t(2.0) * velY - KC_0_20; - const real_t KC_00_0 = (KC_0_00 * sqr_vely_minus_velY + KC_0_10 * vely_term_minus + KC_0_20) * real_t(0.5); - const real_t KC_02_0 = (KC_0_00 * sqr_vely_plus_velY + KC_0_10 * vely_term_plus + KC_0_20) * real_t(0.5); - const real_t KC_01_1 = KC_0_01 * oneminus_sqr_vely - KC_0_11 * real_t(2.0) * velY - KC_0_21; - const real_t KC_00_1 = (KC_0_01 * sqr_vely_minus_velY + KC_0_11 * vely_term_minus + KC_0_21) * real_t(0.5); - const real_t KC_02_1 = (KC_0_01 * sqr_vely_plus_velY + KC_0_11 * vely_term_plus + KC_0_21) * real_t(0.5); - const real_t KC_01_2 = KC_0_02 * oneminus_sqr_vely - KC_0_12 * real_t(2.0) * velY - KC_0_22; - const real_t KC_00_2 = (KC_0_02 * sqr_vely_minus_velY + KC_0_12 * vely_term_minus + KC_0_22) * real_t(0.5); - const real_t KC_02_2 = (KC_0_02 * sqr_vely_plus_velY + KC_0_12 * vely_term_plus + KC_0_22) * real_t(0.5); - const real_t KC_11_0 = KC_1_00 * oneminus_sqr_vely - KC_1_10 * real_t(2.0) * velY - KC_1_20; - const real_t KC_10_0 = (KC_1_00 * sqr_vely_minus_velY + KC_1_10 * vely_term_minus + KC_1_20) * real_t(0.5); - const real_t KC_12_0 = (KC_1_00 * sqr_vely_plus_velY + KC_1_10 * vely_term_plus + KC_1_20) * real_t(0.5); - const real_t KC_11_1 = KC_1_01 * oneminus_sqr_vely - KC_1_11 * real_t(2.0) * velY - KC_1_21; - const real_t KC_10_1 = (KC_1_01 * sqr_vely_minus_velY + KC_1_11 * vely_term_minus + KC_1_21) * real_t(0.5); - const real_t KC_12_1 = (KC_1_01 * sqr_vely_plus_velY + KC_1_11 * vely_term_plus + KC_1_21) * real_t(0.5); - const real_t KC_11_2 = KC_1_02 * oneminus_sqr_vely - KC_1_12 * real_t(2.0) * velY - KC_1_22; - const real_t KC_10_2 = (KC_1_02 * sqr_vely_minus_velY + KC_1_12 * vely_term_minus + KC_1_22) * real_t(0.5); - const real_t KC_12_2 = (KC_1_02 * sqr_vely_plus_velY + KC_1_12 * vely_term_plus + KC_1_22) * real_t(0.5); - const real_t KC_21_0 = KC_2_00 * oneminus_sqr_vely - KC_2_10 * real_t(2.0) * velY - KC_2_20; - const real_t KC_20_0 = (KC_2_00 * sqr_vely_minus_velY + KC_2_10 * vely_term_minus + KC_2_20) * real_t(0.5); - const real_t KC_22_0 = (KC_2_00 * sqr_vely_plus_velY + KC_2_10 * vely_term_plus + KC_2_20) * real_t(0.5); - const real_t KC_21_1 = KC_2_01 * oneminus_sqr_vely - KC_2_11 * real_t(2.0) * velY - KC_2_21; - const real_t KC_20_1 = (KC_2_01 * sqr_vely_minus_velY + KC_2_11 * vely_term_minus + KC_2_21) * real_t(0.5); - const real_t KC_22_1 = (KC_2_01 * sqr_vely_plus_velY + KC_2_11 * vely_term_plus + KC_2_21) * real_t(0.5); - const real_t KC_21_2 = KC_2_02 * oneminus_sqr_vely - KC_2_12 * real_t(2.0) * velY - KC_2_22; - const real_t KC_20_2 = (KC_2_02 * sqr_vely_minus_velY + KC_2_12 * vely_term_minus + KC_2_22) * real_t(0.5); - const real_t KC_22_2 = (KC_2_02 * sqr_vely_plus_velY + KC_2_12 * vely_term_plus + KC_2_22) * real_t(0.5); + const real_t vely_term_plus = 2.0_r * velY + 1.0_r ; + const real_t vely_term_minus = 2.0_r * velY - 1.0_r ; + + + const real_t KC_01_0 = KC_0_00 * oneminus_sqr_vely - KC_0_10 * 2.0_r * velY - KC_0_20; + const real_t KC_00_0 = (KC_0_00 * sqr_vely_minus_velY + KC_0_10 * vely_term_minus + KC_0_20) * 0.5_r; + const real_t KC_02_0 = (KC_0_00 * sqr_vely_plus_velY + KC_0_10 * vely_term_plus + KC_0_20) * 0.5_r; + const real_t KC_01_1 = KC_0_01 * oneminus_sqr_vely - KC_0_11 * 2.0_r * velY - KC_0_21; + const real_t KC_00_1 = (KC_0_01 * sqr_vely_minus_velY + KC_0_11 * vely_term_minus + KC_0_21) * 0.5_r; + const real_t KC_02_1 = (KC_0_01 * sqr_vely_plus_velY + KC_0_11 * vely_term_plus + KC_0_21) * 0.5_r; + const real_t KC_01_2 = KC_0_02 * oneminus_sqr_vely - KC_0_12 * 2.0_r * velY - KC_0_22; + const real_t KC_00_2 = (KC_0_02 * sqr_vely_minus_velY + KC_0_12 * vely_term_minus + KC_0_22) * 0.5_r; + const real_t KC_02_2 = (KC_0_02 * sqr_vely_plus_velY + KC_0_12 * vely_term_plus + KC_0_22) * 0.5_r; + const real_t KC_11_0 = KC_1_00 * oneminus_sqr_vely - KC_1_10 * 2.0_r * velY - KC_1_20; + const real_t KC_10_0 = (KC_1_00 * sqr_vely_minus_velY + KC_1_10 * vely_term_minus + KC_1_20) * 0.5_r; + const real_t KC_12_0 = (KC_1_00 * sqr_vely_plus_velY + KC_1_10 * vely_term_plus + KC_1_20) * 0.5_r; + const real_t KC_11_1 = KC_1_01 * oneminus_sqr_vely - KC_1_11 * 2.0_r * velY - KC_1_21; + const real_t KC_10_1 = (KC_1_01 * sqr_vely_minus_velY + KC_1_11 * vely_term_minus + KC_1_21) * 0.5_r; + const real_t KC_12_1 = (KC_1_01 * sqr_vely_plus_velY + KC_1_11 * vely_term_plus + KC_1_21) * 0.5_r; + const real_t KC_11_2 = KC_1_02 * oneminus_sqr_vely - KC_1_12 * 2.0_r * velY - KC_1_22; + const real_t KC_10_2 = (KC_1_02 * sqr_vely_minus_velY + KC_1_12 * vely_term_minus + KC_1_22) * 0.5_r; + const real_t KC_12_2 = (KC_1_02 * sqr_vely_plus_velY + KC_1_12 * vely_term_plus + KC_1_22) * 0.5_r; + const real_t KC_21_0 = KC_2_00 * oneminus_sqr_vely - KC_2_10 * 2.0_r * velY - KC_2_20; + const real_t KC_20_0 = (KC_2_00 * sqr_vely_minus_velY + KC_2_10 * vely_term_minus + KC_2_20) * 0.5_r; + const real_t KC_22_0 = (KC_2_00 * sqr_vely_plus_velY + KC_2_10 * vely_term_plus + KC_2_20) * 0.5_r; + const real_t KC_21_1 = KC_2_01 * oneminus_sqr_vely - KC_2_11 * 2.0_r * velY - KC_2_21; + const real_t KC_20_1 = (KC_2_01 * sqr_vely_minus_velY + KC_2_11 * vely_term_minus + KC_2_21) * 0.5_r; + const real_t KC_22_1 = (KC_2_01 * sqr_vely_plus_velY + KC_2_11 * vely_term_plus + KC_2_21) * 0.5_r; + const real_t KC_21_2 = KC_2_02 * oneminus_sqr_vely - KC_2_12 * 2.0_r * velY - KC_2_22; + const real_t KC_20_2 = (KC_2_02 * sqr_vely_minus_velY + KC_2_12 * vely_term_minus + KC_2_22) * 0.5_r; + const real_t KC_22_2 = (KC_2_02 * sqr_vely_plus_velY + KC_2_12 * vely_term_plus + KC_2_22) * 0.5_r; // const defined for velocity in Z direction - const real_t oneminus_sqr_velz = real_t(1.0) - velZZ ; + const real_t oneminus_sqr_velz = 1.0_r - velZZ ; const real_t sqr_velz_plus_velZ = velZZ + velZ ; const real_t sqr_velz_minus_velZ = velZZ - velZ ; - const real_t velz_term_plus = real_t(2.0) * velZ + real_t(1.0) ; - const real_t velz_term_minus = real_t(2.0) * velZ - real_t(1.0) ; + const real_t velz_term_plus = 2.0_r * velZ + 1.0_r ; + const real_t velz_term_minus = 2.0_r * velZ - 1.0_r ; // updating the distribution function - src->get(x,y,z,Stencil_T::idx[SW]) = KC_00_0 * oneminus_sqr_velz - KC_00_1 * real_t(2.0) * velZ - KC_00_2; - src->get(x,y,z,Stencil_T::idx[BSW]) = (KC_00_0 * sqr_velz_minus_velZ + KC_00_1 * velz_term_minus + KC_00_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[TSW]) = (KC_00_0 * sqr_velz_plus_velZ + KC_00_1 * velz_term_plus + KC_00_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[W]) = KC_01_0 * oneminus_sqr_velz - KC_01_1 * real_t(2.0) * velZ - KC_01_2; - src->get(x,y,z,Stencil_T::idx[BW]) = (KC_01_0 * sqr_velz_minus_velZ + KC_01_1 * velz_term_minus + KC_01_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[TW]) = (KC_01_0 * sqr_velz_plus_velZ + KC_01_1 * velz_term_plus + KC_01_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[NW]) = KC_02_0 * oneminus_sqr_velz - KC_02_1 * real_t(2.0) * velZ - KC_02_2; - src->get(x,y,z,Stencil_T::idx[BNW]) = (KC_02_0 * sqr_velz_minus_velZ + KC_02_1 * velz_term_minus + KC_02_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[TNW]) = (KC_02_0 * sqr_velz_plus_velZ + KC_02_1 * velz_term_plus + KC_02_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[S]) = KC_10_0 * oneminus_sqr_velz - KC_10_1 * real_t(2.0) * velZ - KC_10_2; - src->get(x,y,z,Stencil_T::idx[BS]) = (KC_10_0 * sqr_velz_minus_velZ + KC_10_1 * velz_term_minus + KC_10_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[TS]) = (KC_10_0 * sqr_velz_plus_velZ + KC_10_1 * velz_term_plus + KC_10_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[C]) = KC_11_0 * oneminus_sqr_velz - KC_11_1 * real_t(2.0) * velZ - KC_11_2; - src->get(x,y,z,Stencil_T::idx[B]) = (KC_11_0 * sqr_velz_minus_velZ + KC_11_1 * velz_term_minus + KC_11_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[T]) = (KC_11_0 * sqr_velz_plus_velZ + KC_11_1 * velz_term_plus + KC_11_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[N]) = KC_12_0 * oneminus_sqr_velz - KC_12_1 * real_t(2.0) * velZ - KC_12_2; - src->get(x,y,z,Stencil_T::idx[BN]) = (KC_12_0 * sqr_velz_minus_velZ + KC_12_1 * velz_term_minus + KC_12_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[TN]) = (KC_12_0 * sqr_velz_plus_velZ + KC_12_1 * velz_term_plus + KC_12_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[SE]) = KC_20_0 * oneminus_sqr_velz - KC_20_1 * real_t(2.0) * velZ - KC_20_2; - src->get(x,y,z,Stencil_T::idx[BSE]) = (KC_20_0 * sqr_velz_minus_velZ + KC_20_1 * velz_term_minus + KC_20_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[TSE]) = (KC_20_0 * sqr_velz_plus_velZ + KC_20_1 * velz_term_plus + KC_20_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[E]) = KC_21_0 * oneminus_sqr_velz - KC_21_1 * real_t(2.0) * velZ - KC_21_2; - src->get(x,y,z,Stencil_T::idx[BE]) = (KC_21_0 * sqr_velz_minus_velZ + KC_21_1 * velz_term_minus + KC_21_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[TE]) = (KC_21_0 * sqr_velz_plus_velZ + KC_21_1 * velz_term_plus + KC_21_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[NE]) = KC_22_0 * oneminus_sqr_velz - KC_22_1 * real_t(2.0) * velZ - KC_22_2; - src->get(x,y,z,Stencil_T::idx[BNE]) = (KC_22_0 * sqr_velz_minus_velZ + KC_22_1 * velz_term_minus + KC_22_2) * real_t(0.5); - src->get(x,y,z,Stencil_T::idx[TNE]) = (KC_22_0 * sqr_velz_plus_velZ + KC_22_1 * velz_term_plus + KC_22_2) * real_t(0.5); + src->get(x,y,z,Stencil_T::idx[SW]) = KC_00_0 * oneminus_sqr_velz - KC_00_1 * 2.0_r * velZ - KC_00_2; + src->get(x,y,z,Stencil_T::idx[BSW]) = (KC_00_0 * sqr_velz_minus_velZ + KC_00_1 * velz_term_minus + KC_00_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[TSW]) = (KC_00_0 * sqr_velz_plus_velZ + KC_00_1 * velz_term_plus + KC_00_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[W]) = KC_01_0 * oneminus_sqr_velz - KC_01_1 * 2.0_r * velZ - KC_01_2; + src->get(x,y,z,Stencil_T::idx[BW]) = (KC_01_0 * sqr_velz_minus_velZ + KC_01_1 * velz_term_minus + KC_01_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[TW]) = (KC_01_0 * sqr_velz_plus_velZ + KC_01_1 * velz_term_plus + KC_01_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[NW]) = KC_02_0 * oneminus_sqr_velz - KC_02_1 * 2.0_r * velZ - KC_02_2; + src->get(x,y,z,Stencil_T::idx[BNW]) = (KC_02_0 * sqr_velz_minus_velZ + KC_02_1 * velz_term_minus + KC_02_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[TNW]) = (KC_02_0 * sqr_velz_plus_velZ + KC_02_1 * velz_term_plus + KC_02_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[S]) = KC_10_0 * oneminus_sqr_velz - KC_10_1 * 2.0_r * velZ - KC_10_2; + src->get(x,y,z,Stencil_T::idx[BS]) = (KC_10_0 * sqr_velz_minus_velZ + KC_10_1 * velz_term_minus + KC_10_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[TS]) = (KC_10_0 * sqr_velz_plus_velZ + KC_10_1 * velz_term_plus + KC_10_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[C]) = KC_11_0 * oneminus_sqr_velz - KC_11_1 * 2.0_r * velZ - KC_11_2; + src->get(x,y,z,Stencil_T::idx[B]) = (KC_11_0 * sqr_velz_minus_velZ + KC_11_1 * velz_term_minus + KC_11_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[T]) = (KC_11_0 * sqr_velz_plus_velZ + KC_11_1 * velz_term_plus + KC_11_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[N]) = KC_12_0 * oneminus_sqr_velz - KC_12_1 * 2.0_r * velZ - KC_12_2; + src->get(x,y,z,Stencil_T::idx[BN]) = (KC_12_0 * sqr_velz_minus_velZ + KC_12_1 * velz_term_minus + KC_12_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[TN]) = (KC_12_0 * sqr_velz_plus_velZ + KC_12_1 * velz_term_plus + KC_12_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[SE]) = KC_20_0 * oneminus_sqr_velz - KC_20_1 * 2.0_r * velZ - KC_20_2; + src->get(x,y,z,Stencil_T::idx[BSE]) = (KC_20_0 * sqr_velz_minus_velZ + KC_20_1 * velz_term_minus + KC_20_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[TSE]) = (KC_20_0 * sqr_velz_plus_velZ + KC_20_1 * velz_term_plus + KC_20_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[E]) = KC_21_0 * oneminus_sqr_velz - KC_21_1 * 2.0_r * velZ - KC_21_2; + src->get(x,y,z,Stencil_T::idx[BE]) = (KC_21_0 * sqr_velz_minus_velZ + KC_21_1 * velz_term_minus + KC_21_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[TE]) = (KC_21_0 * sqr_velz_plus_velZ + KC_21_1 * velz_term_plus + KC_21_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[NE]) = KC_22_0 * oneminus_sqr_velz - KC_22_1 * 2.0_r * velZ - KC_22_2; + src->get(x,y,z,Stencil_T::idx[BNE]) = (KC_22_0 * sqr_velz_minus_velZ + KC_22_1 * velz_term_minus + KC_22_2) * 0.5_r; + src->get(x,y,z,Stencil_T::idx[TNE]) = (KC_22_0 * sqr_velz_plus_velZ + KC_22_1 * velz_term_plus + KC_22_2) * 0.5_r; WALBERLA_CHECK( math::finite( src->get(x,y,z,Stencil_T::idx[SW]) ) ); diff --git a/src/lbm/evaluations/Permeability.h b/src/lbm/evaluations/Permeability.h index 997bda39..74318b6d 100644 --- a/src/lbm/evaluations/Permeability.h +++ b/src/lbm/evaluations/Permeability.h @@ -79,7 +79,7 @@ public: * \param calcFrequency The frequency (in time steps) in which the permeability is evaluated. * \param convCrit The delta value (du/dt) at which the flow is considered to have reached steady state. */ - void init( const AABB & sampleVolume, uint_t flowAxis, uint_t calcFrequency, real_t convCrit = real_t(1.0E-20) ); + void init( const AABB & sampleVolume, uint_t flowAxis, uint_t calcFrequency, real_t convCrit = 1.0E-20_r ); /*! * \brief Initializes the permeability evaluation with the given set of parameters. @@ -89,7 +89,7 @@ public: * \param calcFrequency The frequency (in time steps) in which the permeability is evaluated. * \param convCrit The delta value (du/dt) at which the flow is considered to have reached steady state. */ - void init( const CellInterval & sampleVolume, uint_t flowAxis, uint_t calcFrequency, real_t convCrit = real_t(1.0E-20) ); + void init( const CellInterval & sampleVolume, uint_t flowAxis, uint_t calcFrequency, real_t convCrit = 1.0E-20_r ); real_t convCriterion() const { return convCrit_; } real_t currentDelta() const { return delta_; } diff --git a/src/lbm/evaluations/Permeability.impl.h b/src/lbm/evaluations/Permeability.impl.h index 3da9ce05..29d2f041 100644 --- a/src/lbm/evaluations/Permeability.impl.h +++ b/src/lbm/evaluations/Permeability.impl.h @@ -29,13 +29,13 @@ Permeability<PdfField_T, BoundaryHandling_T>::Permeability( real_t viscosity, co : nu_( viscosity ), pdfFieldId_( pdfFieldId ), boundaryHandlingId_( boundaryHandlingId ), fluid_( fluid ), blocks_( blocks ), time_( 0 ), lastU_( 0 ) { delta_ = std::numeric_limits<real_t>::max(); - k_ = real_t(0); + k_ = 0_r; numSampleFluidNodes_ = uint_t(0); numC0FluidNodes_ = uint_t(0); numC1FluidNodes_ = uint_t(0); flowAxis_ = uint_t(0); - convCrit_ = real_t(0); + convCrit_ = 0_r; interval_ = uint_t(0); initialized_ = false; @@ -48,7 +48,7 @@ void Permeability<PdfField_T, BoundaryHandling_T>::init( const Config::BlockHand sampleVolume_ = blocks_->getCellBBFromAABB( config.getParameter<AABB>( "sampleVolume", blocks_->getDomain() ) ); flowAxis_ = config.getParameter<uint_t>( "flowAxis" ); interval_ = config.getParameter<uint_t>( "calcFrequency" ); - convCrit_ = config.getParameter<real_t>( "convCriterion", real_t(1.0E-20) ); + convCrit_ = config.getParameter<real_t>( "convCriterion", 1.0E-20_r ); initSampleVolume(); } @@ -169,14 +169,14 @@ void Permeability<PdfField_T, BoundaryHandling_T>::operator()() p1 /= real_c( numC1FluidNodes_ ); // average density in cross section c1 // convert density to pressure (P = rho / 3) and calculate average gradient - const real_t pressureGradient = ( p0 - p1 ) / ( real_t(3) * real_c( sampleVolume_.size( flowAxis_ ) - 1 ) ); + const real_t pressureGradient = ( p0 - p1 ) / ( 3_r * real_c( sampleVolume_.size( flowAxis_ ) - 1 ) ); if( math::isnan( u ) || math::isinf( u ) ) { WALBERLA_LOG_WARNING( "Cannot determine permeability. Invalid mean fluid velocity " << u ); delta_ = std::numeric_limits<real_t>::max(); - k_ = real_t(0); + k_ = 0_r; } else diff --git a/src/lbm/field/AddToStorage.h b/src/lbm/field/AddToStorage.h index 912b0135..02058b01 100644 --- a/src/lbm/field/AddToStorage.h +++ b/src/lbm/field/AddToStorage.h @@ -166,7 +166,7 @@ BlockDataID addPdfFieldToStorage( const shared_ptr< BlockStorage_T > & blocks, c const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) { return blocks->addBlockData( make_shared< internal::PdfFieldHandling< LatticeModel_T > >( - blocks, latticeModel, true, Vector3<real_t>(0), real_t(1), uint_t(1), layout ), + blocks, latticeModel, true, Vector3<real_t>(0), 1_r, uint_t(1), layout ), identifier, requiredSelectors, incompatibleSelectors ); } @@ -181,7 +181,7 @@ BlockDataID addPdfFieldToStorage( const shared_ptr< BlockStorage_T > & blocks, c const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) { return blocks->addBlockData( make_shared< internal::PdfFieldHandling< LatticeModel_T > >( - blocks, latticeModel, true, Vector3<real_t>(0), real_t(1), ghostLayers, layout ), + blocks, latticeModel, true, Vector3<real_t>(0), 1_r, ghostLayers, layout ), identifier, requiredSelectors, incompatibleSelectors ); } @@ -229,7 +229,7 @@ struct PdfFieldCreator : public domain_decomposition::BlockDataCreator< lbm::Pdf const LatticeModel_T & latticeModel, const field::Layout & layout = field::zyxf ) : domain_decomposition::BlockDataCreator< lbm::PdfField< LatticeModel_T > >( make_shared< internal::PdfFieldHandling< LatticeModel_T > >( - blocks, latticeModel, false, Vector3<real_t>(0), real_t(1), uint_t(1), layout ), + blocks, latticeModel, false, Vector3<real_t>(0), 1_r, uint_t(1), layout ), identifier, requiredSelectors, incompatibleSelectors ) {} @@ -238,7 +238,7 @@ struct PdfFieldCreator : public domain_decomposition::BlockDataCreator< lbm::Pdf const LatticeModel_T & latticeModel, const uint_t ghostLayers, const field::Layout & layout = field::zyxf ) : domain_decomposition::BlockDataCreator< lbm::PdfField< LatticeModel_T > >( make_shared< internal::PdfFieldHandling< LatticeModel_T > >( - blocks, latticeModel, false, Vector3<real_t>(0), real_t(1), ghostLayers, layout ), + blocks, latticeModel, false, Vector3<real_t>(0), 1_r, ghostLayers, layout ), identifier, requiredSelectors, incompatibleSelectors ) {} diff --git a/src/lbm/field/Density.h b/src/lbm/field/Density.h index f45983df..556d867f 100644 --- a/src/lbm/field/Density.h +++ b/src/lbm/field/Density.h @@ -57,7 +57,7 @@ struct Density< LatticeModel_T, typename boost::enable_if_c< LatticeModel_T::com rho += it[i]; return rho; - //real_t rho = real_t(0.0); + //real_t rho = 0.0_r; //for( auto i = LatticeModel_T::Stencil::begin(); i != LatticeModel_T::Stencil::end(); ++i ) // rho += it[ i.toIdx() ]; //return rho; @@ -87,12 +87,12 @@ struct Density< LatticeModel_T, typename boost::enable_if< boost::mpl::not_< boo template< typename FieldPtrOrIterator > static inline real_t get( const LatticeModel_T & /*latticeModel*/, const FieldPtrOrIterator & it ) { - real_t rho = it[0] + real_t(1.0); + real_t rho = it[0] + 1.0_r; for( uint_t i = 1; i != LatticeModel_T::Stencil::Size; ++i ) rho += it[i]; return rho; - //real_t rho = real_t(1.0); + //real_t rho = 1.0_r; //for( auto i = LatticeModel_T::Stencil::begin(); i != LatticeModel_T::Stencil::end(); ++i ) // rho += it[ i.toIdx() ]; //return rho; @@ -103,7 +103,7 @@ struct Density< LatticeModel_T, typename boost::enable_if< boost::mpl::not_< boo const PdfField_T & pdf, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { const real_t & xyz0 = pdf(x,y,z,0); - real_t rho = xyz0 + real_t(1.0); + real_t rho = xyz0 + 1.0_r; for( uint_t i = 1; i != LatticeModel_T::Stencil::Size; ++i ) rho += pdf.getF( &xyz0, i ); return rho; diff --git a/src/lbm/field/DensityAndMomentumDensity.h b/src/lbm/field/DensityAndMomentumDensity.h index 8502b38d..f773862a 100644 --- a/src/lbm/field/DensityAndMomentumDensity.h +++ b/src/lbm/field/DensityAndMomentumDensity.h @@ -54,7 +54,7 @@ real_t getDensityAndMomentumDensity( Vector3< real_t > & momentumDensity, const momentumDensity[0] = firstPdf * real_c(d.cx()); momentumDensity[1] = firstPdf * real_c(d.cy()); momentumDensity[2] = firstPdf * real_c(d.cz()); - real_t rho = firstPdf + ( ( LatticeModel_T::compressible ) ? real_t(0.0) : real_t(1.0) ); + real_t rho = firstPdf + ( ( LatticeModel_T::compressible ) ? 0.0_r : 1.0_r ); ++d; @@ -89,7 +89,7 @@ real_t getDensityAndMomentumDensity( Vector3< real_t > & momentumDensity, const momentumDensity[0] = firstPdf * real_c(d.cx()); momentumDensity[1] = firstPdf * real_c(d.cy()); momentumDensity[2] = firstPdf * real_c(d.cz()); - real_t rho = firstPdf + ( ( LatticeModel_T::compressible ) ? real_t(0.0) : real_t(1.0) ); + real_t rho = firstPdf + ( ( LatticeModel_T::compressible ) ? 0.0_r : 1.0_r ); ++d; @@ -120,7 +120,7 @@ real_t getDensityAndMomentumDensityD3Q19( Vector3< real_t > & momentumDensity, c momentumDensity[1] = it[ Stencil::idx[N] ] + it[ Stencil::idx[NW] ] + it[ Stencil::idx[TN] ] + it[ Stencil::idx[BN] ]; momentumDensity[2] = it[ Stencil::idx[T] ] + it[ Stencil::idx[TS] ] + it[ Stencil::idx[TW] ]; - const real_t rho = ( ( LatticeModel_T::compressible ) ? real_t(0.0) : real_t(1.0) ) + + const real_t rho = ( ( LatticeModel_T::compressible ) ? 0.0_r : 1.0_r ) + it[ Stencil::idx[C] ] + it[ Stencil::idx[S] ] + it[ Stencil::idx[W] ] + it[ Stencil::idx[B] ] + it[ Stencil::idx[SW] ] + it[ Stencil::idx[BS] ] + it[ Stencil::idx[BW] ] + momentumDensity[0] + momentumDensity[1] + momentumDensity[2]; @@ -150,7 +150,7 @@ real_t getDensityAndMomentumDensityD3Q19( Vector3< real_t > & momentumDensity, c pdf.getF( &xyz0, Stencil::idx[BN] ); momentumDensity[2] = pdf.getF( &xyz0, Stencil::idx[T] ) + pdf.getF( &xyz0, Stencil::idx[TS] ) + pdf.getF( &xyz0, Stencil::idx[TW] ); - const real_t rho = ( ( LatticeModel_T::compressible ) ? real_t(0.0) : real_t(1.0) ) + + const real_t rho = ( ( LatticeModel_T::compressible ) ? 0.0_r : 1.0_r ) + pdf.getF( &xyz0, Stencil::idx[C] ) + pdf.getF( &xyz0, Stencil::idx[S] ) + pdf.getF( &xyz0, Stencil::idx[W] ) + pdf.getF( &xyz0, Stencil::idx[B] ) + pdf.getF( &xyz0, Stencil::idx[SW] ) + pdf.getF( &xyz0, Stencil::idx[BS] ) + pdf.getF( &xyz0, Stencil::idx[BW] ) + momentumDensity[0] + momentumDensity[1] + momentumDensity[2]; diff --git a/src/lbm/field/DensityAndVelocity.h b/src/lbm/field/DensityAndVelocity.h index d6957f9d..af78b80e 100644 --- a/src/lbm/field/DensityAndVelocity.h +++ b/src/lbm/field/DensityAndVelocity.h @@ -54,7 +54,7 @@ struct AdaptVelocityToForce< LatticeModel_T, typename boost::enable_if< boost::m { static Vector3<real_t> get( const LatticeModel_T & latticeModel, const Vector3< real_t > & velocity, const real_t rho ) { - return velocity - latticeModel.forceModel().force() * real_t(0.5) / rho; + return velocity - latticeModel.forceModel().force() * 0.5_r / rho; } template< typename FieldPtrOrIterator > @@ -77,7 +77,7 @@ struct AdaptVelocityToForce< LatticeModel_T, typename boost::enable_if< boost::m { static Vector3<real_t> get( const LatticeModel_T & latticeModel, const Vector3< real_t > & velocity, const real_t ) { - return velocity - latticeModel.forceModel().force() * real_t(0.5); + return velocity - latticeModel.forceModel().force() * 0.5_r; } template< typename FieldPtrOrIterator > @@ -101,20 +101,20 @@ struct AdaptVelocityToForce< LatticeModel_T, typename boost::enable_if< boost::m /* static Vector3<real_t> get( const LatticeModel_T & latticeModel, const Vector3< real_t > & velocity, const real_t rho ) { - return velocity - latticeModel.forceModel().force() * real_t(0.5) / rho; + return velocity - latticeModel.forceModel().force() * 0.5_r / rho; } */ template< typename FieldPtrOrIterator > static Vector3<real_t> get( FieldPtrOrIterator & it, const LatticeModel_T & latticeModel, const Vector3< real_t > & velocity, const real_t rho ) { - return velocity - latticeModel.forceModel().force(it.x(),it.y(),it.z()) * real_t(0.5) / rho; + return velocity - latticeModel.forceModel().force(it.x(),it.y(),it.z()) * 0.5_r / rho; } static Vector3<real_t> get( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const LatticeModel_T & latticeModel, const Vector3< real_t > & velocity, const real_t rho ) { - return velocity - latticeModel.forceModel().force(x,y,z) * real_t(0.5) / rho; + return velocity - latticeModel.forceModel().force(x,y,z) * 0.5_r / rho; } }; @@ -126,20 +126,20 @@ struct AdaptVelocityToForce< LatticeModel_T, typename boost::enable_if< boost::m /* static Vector3<real_t> get( const LatticeModel_T & latticeModel, const Vector3< real_t > & velocity, const real_t ) { - return velocity - latticeModel.forceModel().force() * real_t(0.5); + return velocity - latticeModel.forceModel().force() * 0.5_r; } */ template< typename FieldPtrOrIterator > static Vector3<real_t> get( FieldPtrOrIterator & it, const LatticeModel_T & latticeModel, const Vector3< real_t > & velocity, const real_t ) { - return velocity - latticeModel.forceModel().force(it.x(),it.y(),it.z()) * real_t(0.5); + return velocity - latticeModel.forceModel().force(it.x(),it.y(),it.z()) * 0.5_r; } static Vector3<real_t> get( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const LatticeModel_T & latticeModel, const Vector3< real_t > & velocity, const real_t ) { - return velocity - latticeModel.forceModel().force(x,y,z) * real_t(0.5); + return velocity - latticeModel.forceModel().force(x,y,z) * 0.5_r; } }; @@ -177,7 +177,7 @@ struct DensityAndVelocity { template< typename FieldPtrOrIterator > static void set( FieldPtrOrIterator & it, const LatticeModel_T & latticeModel, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { Vector3< real_t > velAdaptedToForce = internal::AdaptVelocityToForce<LatticeModel_T>::get( it, latticeModel, velocity, rho ); Equilibrium< LatticeModel_T >::set( it, velAdaptedToForce, rho ); @@ -185,7 +185,7 @@ struct DensityAndVelocity template< typename PdfField_T > static void set( PdfField_T & pdf, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const LatticeModel_T & latticeModel, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { Vector3< real_t > velAdaptedToForce = internal::AdaptVelocityToForce<LatticeModel_T>::get( x, y, z, latticeModel, velocity, rho ); Equilibrium< LatticeModel_T >::set( pdf, x, y, z, velAdaptedToForce, rho ); @@ -212,7 +212,7 @@ struct DensityAndVelocityRange< LatticeModel_T, FieldIteratorXYZ, typename boost static_assert( LatticeModel_T::ForceModel::constant, "Only works with constant forces!" ); static void set( FieldIteratorXYZ & begin, const FieldIteratorXYZ & end, const LatticeModel_T & latticeModel, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { Vector3< real_t > velAdaptedToForce = internal::AdaptVelocityToForce<LatticeModel_T>::get( latticeModel, velocity, rho ); EquilibriumRange< LatticeModel_T, FieldIteratorXYZ >::set( begin, end, velAdaptedToForce, rho ); @@ -227,7 +227,7 @@ struct DensityAndVelocityRange< LatticeModel_T, FieldIteratorXYZ, typename boost static_assert( LatticeModel_T::ForceModel::constant == false, "Does not work with constant forces!" ); static void set( FieldIteratorXYZ & begin, const FieldIteratorXYZ & end, const LatticeModel_T & latticeModel, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { for( auto cell = begin; cell != end; ++cell ) DensityAndVelocity< LatticeModel_T >::set( cell, latticeModel, velocity, rho ); diff --git a/src/lbm/field/DensityVelocityCallback.h b/src/lbm/field/DensityVelocityCallback.h index 60c9c817..cce18451 100644 --- a/src/lbm/field/DensityVelocityCallback.h +++ b/src/lbm/field/DensityVelocityCallback.h @@ -76,7 +76,7 @@ struct VelocityCallbackCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( Vector3< real_t > & velocity, const cell_idx_t, const cell_idx_t, const cell_idx_t, const LatticeModel_T & latticeModel, const real_t rho ) { - velocity += latticeModel.forceModel().force() * real_t(0.5) / rho; + velocity += latticeModel.forceModel().force() * 0.5_r / rho; } }; @@ -89,7 +89,7 @@ struct VelocityCallbackCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( Vector3< real_t > & velocity, const cell_idx_t, const cell_idx_t, const cell_idx_t, const LatticeModel_T & latticeModel, const real_t ) { - velocity += latticeModel.forceModel().force() * real_t(0.5); + velocity += latticeModel.forceModel().force() * 0.5_r; } }; @@ -102,7 +102,7 @@ struct VelocityCallbackCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const LatticeModel_T & latticeModel, const real_t rho ) { - velocity += latticeModel.forceModel().force(x,y,z) * real_t(0.5) / rho; + velocity += latticeModel.forceModel().force(x,y,z) * 0.5_r / rho; } }; @@ -115,7 +115,7 @@ struct VelocityCallbackCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const LatticeModel_T & latticeModel, const real_t ) { - velocity += latticeModel.forceModel().force(x,y,z) * real_t(0.5); + velocity += latticeModel.forceModel().force(x,y,z) * 0.5_r; } }; @@ -128,7 +128,7 @@ struct VelocityCallbackCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( Vector3< real_t > & velocity, const cell_idx_t, const cell_idx_t, const cell_idx_t, const LatticeModel_T & latticeModel, const real_t rho ) { - velocity -= latticeModel.forceModel().force() * real_t(0.5) / rho; + velocity -= latticeModel.forceModel().force() * 0.5_r / rho; } }; @@ -141,7 +141,7 @@ struct VelocityCallbackCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( Vector3< real_t > & velocity, const cell_idx_t, const cell_idx_t, const cell_idx_t, const LatticeModel_T & latticeModel, const real_t ) { - velocity -= latticeModel.forceModel().force() * real_t(0.5); + velocity -= latticeModel.forceModel().force() * 0.5_r; } }; @@ -154,7 +154,7 @@ struct VelocityCallbackCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const LatticeModel_T & latticeModel, const real_t rho ) { - velocity -= latticeModel.forceModel().force(x,y,z) * real_t(0.5) / rho; + velocity -= latticeModel.forceModel().force(x,y,z) * 0.5_r / rho; } }; @@ -167,7 +167,7 @@ struct VelocityCallbackCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const LatticeModel_T & latticeModel, const real_t ) { - velocity -= latticeModel.forceModel().force(x,y,z) * real_t(0.5); + velocity -= latticeModel.forceModel().force(x,y,z) * 0.5_r; } }; @@ -488,7 +488,7 @@ private: // { // auto & storage = field->get(x,y,z,1); // field->get(x,y,z) = velocity + storage; -// storage = latticeModel.forceModel().force() * real_t(0.5) / rho; +// storage = latticeModel.forceModel().force() * 0.5_r / rho; // } //}; // @@ -504,7 +504,7 @@ private: // { // auto & storage = field->get(x,y,z,1); // field->get(x,y,z) = velocity + storage; -// storage = latticeModel.forceModel().force() * real_t(0.5); +// storage = latticeModel.forceModel().force() * 0.5_r; // } //}; // @@ -520,7 +520,7 @@ private: // { // auto & storage = field->get(x,y,z,1); // field->get(x,y,z) = velocity + storage; -// storage = latticeModel.forceModel().force(x,y,z) * real_t(0.5) / rho; +// storage = latticeModel.forceModel().force(x,y,z) * 0.5_r / rho; // } //}; // @@ -536,7 +536,7 @@ private: // { // auto & storage = field->get(x,y,z,1); // field->get(x,y,z) = velocity + storage; -// storage = latticeModel.forceModel().force(x,y,z) * real_t(0.5); +// storage = latticeModel.forceModel().force(x,y,z) * 0.5_r; // } //}; // @@ -550,7 +550,7 @@ private: // static void apply( VelocityField_T * const & field, const Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, // const LatticeModel_T & latticeModel, const real_t rho ) // { -// field->get(x,y,z) = velocity - latticeModel.forceModel().force() * real_t(0.5) / rho; +// field->get(x,y,z) = velocity - latticeModel.forceModel().force() * 0.5_r / rho; // } //}; // @@ -564,7 +564,7 @@ private: // static void apply( VelocityField_T * const & field, const Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, // const LatticeModel_T & latticeModel, const real_t ) // { -// field->get(x,y,z) = velocity - latticeModel.forceModel().force() * real_t(0.5); +// field->get(x,y,z) = velocity - latticeModel.forceModel().force() * 0.5_r; // } //}; // @@ -578,7 +578,7 @@ private: // static void apply( VelocityField_T * const & field, const Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, // const LatticeModel_T & latticeModel, const real_t rho ) // { -// field->get(x,y,z) = velocity - latticeModel.forceModel().force(x,y,z) * real_t(0.5) / rho; +// field->get(x,y,z) = velocity - latticeModel.forceModel().force(x,y,z) * 0.5_r / rho; // } //}; // @@ -592,7 +592,7 @@ private: // static void apply( VelocityField_T * const & field, const Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, // const LatticeModel_T & latticeModel, const real_t ) // { -// field->get(x,y,z) = velocity - latticeModel.forceModel().force(x,y,z) * real_t(0.5); +// field->get(x,y,z) = velocity - latticeModel.forceModel().force(x,y,z) * 0.5_r; // } //}; // @@ -606,7 +606,7 @@ private: // static void apply( VelocityField_T * const & field, const Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, // const LatticeModel_T & latticeModel, const real_t rho ) // { -// const auto current = latticeModel.forceModel().force() * real_t(0.5) / rho; +// const auto current = latticeModel.forceModel().force() * 0.5_r / rho; // auto & storage = field->get(x,y,z,1); // field->get(x,y,z) = velocity - current + storage; // storage = current; @@ -623,7 +623,7 @@ private: // static void apply( VelocityField_T * const & field, const Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, // const LatticeModel_T & latticeModel, const real_t ) // { -// const auto current = latticeModel.forceModel().force() * real_t(0.5); +// const auto current = latticeModel.forceModel().force() * 0.5_r; // auto & storage = field->get(x,y,z,1); // field->get(x,y,z) = velocity - current + storage; // storage = current; @@ -640,7 +640,7 @@ private: // static void apply( VelocityField_T * const & field, const Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, // const LatticeModel_T & latticeModel, const real_t rho ) // { -// const auto current = latticeModel.forceModel().force(x,y,z) * real_t(0.5) / rho; +// const auto current = latticeModel.forceModel().force(x,y,z) * 0.5_r / rho; // auto & storage = field->get(x,y,z,1); // field->get(x,y,z) = velocity - current + storage; // storage = current; @@ -657,7 +657,7 @@ private: // static void apply( VelocityField_T * const & field, const Vector3< real_t > & velocity, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, // const LatticeModel_T & latticeModel, const real_t ) // { -// const auto current = latticeModel.forceModel().force(x,y,z) * real_t(0.5); +// const auto current = latticeModel.forceModel().force(x,y,z) * 0.5_r; // auto & storage = field->get(x,y,z,1); // field->get(x,y,z) = velocity - current + storage; // storage = current; diff --git a/src/lbm/field/Equilibrium.h b/src/lbm/field/Equilibrium.h index 4c2294f9..44f87628 100644 --- a/src/lbm/field/Equilibrium.h +++ b/src/lbm/field/Equilibrium.h @@ -67,26 +67,26 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< template< typename FieldPtrOrIterator > static void set( FieldPtrOrIterator & it, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { - const real_t dir_independent = (rho - real_t(1.0)) - real_t(1.5) * velocity.sqrLength(); + const real_t dir_independent = (rho - 1.0_r) - 1.5_r * velocity.sqrLength(); for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - it[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + real_t(3.0)*vel + real_t(4.5)*vel*vel ); + it[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + 3.0_r*vel + 4.5_r*vel*vel ); } } template< typename PdfField_T > static void set( PdfField_T & pdf, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { real_t & xyz0 = pdf(x,y,z,0); - const real_t dir_independent = (rho - real_t(1.0)) - real_t(1.5) * velocity.sqrLength(); + const real_t dir_independent = (rho - 1.0_r) - 1.5_r * velocity.sqrLength(); for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - pdf.getF( &xyz0, d.toIdx() ) = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + real_t(3.0)*vel + real_t(4.5)*vel*vel ); + pdf.getF( &xyz0, d.toIdx() ) = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + 3.0_r*vel + 4.5_r*vel*vel ); } } }; @@ -104,26 +104,26 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< template< typename FieldPtrOrIterator > static void set( FieldPtrOrIterator & it, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { - const real_t dir_independent = rho - real_t(1.0); + const real_t dir_independent = rho - 1.0_r; for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - it[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + real_t(3.0)*vel ); + it[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + 3.0_r*vel ); } } template< typename PdfField_T > static void set( PdfField_T & pdf, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { real_t & xyz0 = pdf(x,y,z,0); - const real_t dir_independent = rho - real_t(1.0); + const real_t dir_independent = rho - 1.0_r; for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - pdf.getF( &xyz0, d.toIdx() ) = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + real_t(3.0)*vel ); + pdf.getF( &xyz0, d.toIdx() ) = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + 3.0_r*vel ); } } }; @@ -142,26 +142,26 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< template< typename FieldPtrOrIterator > static void set( FieldPtrOrIterator & it, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { - const real_t dir_independent = real_t(1.0) - real_t(1.5) * velocity.sqrLength(); + const real_t dir_independent = 1.0_r - 1.5_r * velocity.sqrLength(); for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - it[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( dir_independent + real_t(3.0)*vel + real_t(4.5)*vel*vel ); + it[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( dir_independent + 3.0_r*vel + 4.5_r*vel*vel ); } } template< typename PdfField_T > static void set( PdfField_T & pdf, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { real_t & xyz0 = pdf(x,y,z,0); - const real_t dir_independent = real_t(1.0) - real_t(1.5) * velocity.sqrLength(); + const real_t dir_independent = 1.0_r - 1.5_r * velocity.sqrLength(); for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - pdf.getF( &xyz0, d.toIdx() ) = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( dir_independent + real_t(3.0)*vel + real_t(4.5)*vel*vel ); + pdf.getF( &xyz0, d.toIdx() ) = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( dir_independent + 3.0_r*vel + 4.5_r*vel*vel ); } } }; @@ -179,24 +179,24 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< template< typename FieldPtrOrIterator > static void set( FieldPtrOrIterator & it, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - it[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( real_t(1.0) + real_t(3.0)*vel ); + it[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( 1.0_r + 3.0_r*vel ); } } template< typename PdfField_T > static void set( PdfField_T & pdf, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { real_t & xyz0 = pdf(x,y,z,0); for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - pdf.getF( &xyz0, d.toIdx() ) = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( real_t(1.0) + real_t(3.0)*vel ); + pdf.getF( &xyz0, d.toIdx() ) = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( 1.0_r + 3.0_r*vel ); } } }; @@ -217,7 +217,7 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< template< typename FieldPtrOrIterator > static void set( FieldPtrOrIterator & it, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { using namespace stencil; @@ -225,15 +225,15 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< const real_t velYY = velocity[1] * velocity[1]; const real_t velZZ = velocity[2] * velocity[2]; - const real_t dir_indep_trm = ( real_t(1) / real_t(3) ) * (rho - real_t(1.0)) - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = ( 1_r / 3_r ) * (rho - 1.0_r) - 0.5_r * ( velXX + velYY + velZZ ); it[ Stencil::idx[C] ] = dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; - const real_t w1 = real_t(3.0) / real_t(18.0); + const real_t w1 = 3.0_r / 18.0_r; it[ Stencil::idx[E] ] = w1 * ( vel_trm_E_W + velocity[0] ); it[ Stencil::idx[W] ] = w1 * ( vel_trm_E_W - velocity[0] ); @@ -243,39 +243,39 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< it[ Stencil::idx[B] ] = w1 * ( vel_trm_T_B - velocity[2] ); const real_t velXmY = velocity[0] - velocity[1]; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; - const real_t w2 = real_t(3.0) / real_t(36.0); + const real_t w2 = 3.0_r / 36.0_r; it[ Stencil::idx[NW] ] = w2 * ( vel_trm_NW_SE - velXmY ); it[ Stencil::idx[SE] ] = w2 * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velocity[0] + velocity[1]; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; it[ Stencil::idx[NE] ] = w2 * ( vel_trm_NE_SW + velXpY ); it[ Stencil::idx[SW] ] = w2 * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velocity[0] - velocity[2]; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; it[ Stencil::idx[TW] ] = w2 * ( vel_trm_TW_BE - velXmZ ); it[ Stencil::idx[BE] ] = w2 * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velocity[0] + velocity[2]; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; it[ Stencil::idx[TE] ] = w2 * ( vel_trm_TE_BW + velXpZ ); it[ Stencil::idx[BW] ] = w2 * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velocity[1] - velocity[2]; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; it[ Stencil::idx[TS] ] = w2 * ( vel_trm_TS_BN - velYmZ ); it[ Stencil::idx[BN] ] = w2 * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velocity[1] + velocity[2]; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; it[ Stencil::idx[TN] ] = w2 * ( vel_trm_TN_BS + velYpZ ); it[ Stencil::idx[BS] ] = w2 * ( vel_trm_TN_BS - velYpZ ); @@ -283,7 +283,7 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< template< typename PdfField_T > static void set( PdfField_T & pdf, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { using namespace stencil; @@ -293,15 +293,15 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< const real_t velYY = velocity[1] * velocity[1]; const real_t velZZ = velocity[2] * velocity[2]; - const real_t dir_indep_trm = ( real_t(1) / real_t(3) ) * (rho - real_t(1.0)) - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = ( 1_r / 3_r ) * (rho - 1.0_r) - 0.5_r * ( velXX + velYY + velZZ ); pdf.getF( &xyz0, Stencil::idx[C] ) = dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; - const real_t w1 = real_t(3.0) / real_t(18.0); + const real_t w1 = 3.0_r / 18.0_r; pdf.getF( &xyz0, Stencil::idx[E] ) = w1 * ( vel_trm_E_W + velocity[0] ); pdf.getF( &xyz0, Stencil::idx[W] ) = w1 * ( vel_trm_E_W - velocity[0] ); @@ -311,39 +311,39 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< pdf.getF( &xyz0, Stencil::idx[B] ) = w1 * ( vel_trm_T_B - velocity[2] ); const real_t velXmY = velocity[0] - velocity[1]; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; - const real_t w2 = real_t(3.0) / real_t(36.0); + const real_t w2 = 3.0_r / 36.0_r; pdf.getF( &xyz0, Stencil::idx[NW] ) = w2 * ( vel_trm_NW_SE - velXmY ); pdf.getF( &xyz0, Stencil::idx[SE] ) = w2 * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velocity[0] + velocity[1]; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; pdf.getF( &xyz0, Stencil::idx[NE] ) = w2 * ( vel_trm_NE_SW + velXpY ); pdf.getF( &xyz0, Stencil::idx[SW] ) = w2 * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velocity[0] - velocity[2]; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; pdf.getF( &xyz0, Stencil::idx[TW] ) = w2 * ( vel_trm_TW_BE - velXmZ ); pdf.getF( &xyz0, Stencil::idx[BE] ) = w2 * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velocity[0] + velocity[2]; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; pdf.getF( &xyz0, Stencil::idx[TE] ) = w2 * ( vel_trm_TE_BW + velXpZ ); pdf.getF( &xyz0, Stencil::idx[BW] ) = w2 * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velocity[1] - velocity[2]; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; pdf.getF( &xyz0, Stencil::idx[TS] ) = w2 * ( vel_trm_TS_BN - velYmZ ); pdf.getF( &xyz0, Stencil::idx[BN] ) = w2 * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velocity[1] + velocity[2]; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; pdf.getF( &xyz0, Stencil::idx[TN] ) = w2 * ( vel_trm_TN_BS + velYpZ ); pdf.getF( &xyz0, Stencil::idx[BS] ) = w2 * ( vel_trm_TN_BS - velYpZ ); @@ -366,7 +366,7 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< template< typename FieldPtrOrIterator > static void set( FieldPtrOrIterator & it, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { using namespace stencil; @@ -374,15 +374,15 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< const real_t velYY = velocity[1] * velocity[1]; const real_t velZZ = velocity[2] * velocity[2]; - const real_t dir_indep_trm = ( real_t(1) / real_t(3) ) - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = ( 1_r / 3_r ) - 0.5_r * ( velXX + velYY + velZZ ); it[ Stencil::idx[C] ] = rho * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; - const real_t w1_rho = rho * real_t(3.0) / real_t(18.0); + const real_t w1_rho = rho * 3.0_r / 18.0_r; it[ Stencil::idx[E] ] = w1_rho * ( vel_trm_E_W + velocity[0] ); it[ Stencil::idx[W] ] = w1_rho * ( vel_trm_E_W - velocity[0] ); @@ -392,39 +392,39 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< it[ Stencil::idx[B] ] = w1_rho * ( vel_trm_T_B - velocity[2] ); const real_t velXmY = velocity[0] - velocity[1]; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; - const real_t w2_rho = rho * real_t(3.0) / real_t(36.0); + const real_t w2_rho = rho * 3.0_r / 36.0_r; it[ Stencil::idx[NW] ] = w2_rho * ( vel_trm_NW_SE - velXmY ); it[ Stencil::idx[SE] ] = w2_rho * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velocity[0] + velocity[1]; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; it[ Stencil::idx[NE] ] = w2_rho * ( vel_trm_NE_SW + velXpY ); it[ Stencil::idx[SW] ] = w2_rho * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velocity[0] - velocity[2]; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; it[ Stencil::idx[TW] ] = w2_rho * ( vel_trm_TW_BE - velXmZ ); it[ Stencil::idx[BE] ] = w2_rho * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velocity[0] + velocity[2]; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; it[ Stencil::idx[TE] ] = w2_rho * ( vel_trm_TE_BW + velXpZ ); it[ Stencil::idx[BW] ] = w2_rho * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velocity[1] - velocity[2]; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; it[ Stencil::idx[TS] ] = w2_rho * ( vel_trm_TS_BN - velYmZ ); it[ Stencil::idx[BN] ] = w2_rho * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velocity[1] + velocity[2]; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; it[ Stencil::idx[TN] ] = w2_rho * ( vel_trm_TN_BS + velYpZ ); it[ Stencil::idx[BS] ] = w2_rho * ( vel_trm_TN_BS - velYpZ ); @@ -432,7 +432,7 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< template< typename PdfField_T > static void set( PdfField_T & pdf, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { using namespace stencil; @@ -442,15 +442,15 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< const real_t velYY = velocity[1] * velocity[1]; const real_t velZZ = velocity[2] * velocity[2]; - const real_t dir_indep_trm = ( real_t(1) / real_t(3) ) - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = ( 1_r / 3_r ) - 0.5_r * ( velXX + velYY + velZZ ); pdf.getF( &xyz0, Stencil::idx[C] ) = rho * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; - const real_t w1_rho = rho * real_t(3.0) / real_t(18.0); + const real_t w1_rho = rho * 3.0_r / 18.0_r; pdf.getF( &xyz0, Stencil::idx[E] ) = w1_rho * ( vel_trm_E_W + velocity[0] ); pdf.getF( &xyz0, Stencil::idx[W] ) = w1_rho * ( vel_trm_E_W - velocity[0] ); @@ -460,39 +460,39 @@ struct Equilibrium< LatticeModel_T, typename boost::enable_if< boost::mpl::and_< pdf.getF( &xyz0, Stencil::idx[B] ) = w1_rho * ( vel_trm_T_B - velocity[2] ); const real_t velXmY = velocity[0] - velocity[1]; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; - const real_t w2_rho = rho * real_t(3.0) / real_t(36.0); + const real_t w2_rho = rho * 3.0_r / 36.0_r; pdf.getF( &xyz0, Stencil::idx[NW] ) = w2_rho * ( vel_trm_NW_SE - velXmY ); pdf.getF( &xyz0, Stencil::idx[SE] ) = w2_rho * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velocity[0] + velocity[1]; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; pdf.getF( &xyz0, Stencil::idx[NE] ) = w2_rho * ( vel_trm_NE_SW + velXpY ); pdf.getF( &xyz0, Stencil::idx[SW] ) = w2_rho * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velocity[0] - velocity[2]; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; pdf.getF( &xyz0, Stencil::idx[TW] ) = w2_rho * ( vel_trm_TW_BE - velXmZ ); pdf.getF( &xyz0, Stencil::idx[BE] ) = w2_rho * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velocity[0] + velocity[2]; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; pdf.getF( &xyz0, Stencil::idx[TE] ) = w2_rho * ( vel_trm_TE_BW + velXpZ ); pdf.getF( &xyz0, Stencil::idx[BW] ) = w2_rho * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velocity[1] - velocity[2]; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; pdf.getF( &xyz0, Stencil::idx[TS] ) = w2_rho * ( vel_trm_TS_BN - velYmZ ); pdf.getF( &xyz0, Stencil::idx[BN] ) = w2_rho * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velocity[1] + velocity[2]; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; pdf.getF( &xyz0, Stencil::idx[TN] ) = w2_rho * ( vel_trm_TN_BS + velYpZ ); pdf.getF( &xyz0, Stencil::idx[BS] ) = w2_rho * ( vel_trm_TN_BS - velYpZ ); @@ -518,15 +518,15 @@ struct EquilibriumRange< LatticeModel_T, FieldIteratorXYZ, typename boost::enabl boost::mpl::equal_to< boost::mpl::int_< LatticeModel_T::equilibriumAccuracyOrder >, boost::mpl::int_< 2 > > > >::type > { static void set( FieldIteratorXYZ & begin, const FieldIteratorXYZ & end, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { std::vector< real_t > value( stencil::NR_OF_DIRECTIONS ); - const real_t dir_independent = (rho - real_t(1.0)) - real_t(1.5) * velocity.sqrLength(); + const real_t dir_independent = (rho - 1.0_r) - 1.5_r * velocity.sqrLength(); for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - value[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + real_t(3.0)*vel + real_t(4.5)*vel*vel ); + value[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + 3.0_r*vel + 4.5_r*vel*vel ); } for( auto cell = begin; cell != end; ++cell ) @@ -540,15 +540,15 @@ struct EquilibriumRange< LatticeModel_T, FieldIteratorXYZ, typename boost::enabl boost::mpl::equal_to< boost::mpl::int_< LatticeModel_T::equilibriumAccuracyOrder >, boost::mpl::int_<1> > > >::type > { static void set( FieldIteratorXYZ & begin, const FieldIteratorXYZ & end, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { std::vector< real_t > value( stencil::NR_OF_DIRECTIONS ); - const real_t dir_independent = rho - real_t(1.0); + const real_t dir_independent = rho - 1.0_r; for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - value[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + real_t(3.0)*vel ); + value[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * ( dir_independent + 3.0_r*vel ); } for( auto cell = begin; cell != end; ++cell ) @@ -562,15 +562,15 @@ struct EquilibriumRange< LatticeModel_T, FieldIteratorXYZ, typename boost::enabl boost::mpl::equal_to< boost::mpl::int_<LatticeModel_T::equilibriumAccuracyOrder>, boost::mpl::int_<2> > > >::type > { static void set( FieldIteratorXYZ & begin, const FieldIteratorXYZ & end, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { std::vector< real_t > value( stencil::NR_OF_DIRECTIONS ); - const real_t dir_independent = real_t(1.0) - real_t(1.5) * velocity.sqrLength(); + const real_t dir_independent = 1.0_r - 1.5_r * velocity.sqrLength(); for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - value[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( dir_independent + real_t(3.0)*vel + real_t(4.5)*vel*vel ); + value[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( dir_independent + 3.0_r*vel + 4.5_r*vel*vel ); } for( auto cell = begin; cell != end; ++cell ) @@ -584,15 +584,15 @@ struct EquilibriumRange< LatticeModel_T, FieldIteratorXYZ, typename boost::enabl boost::mpl::equal_to< boost::mpl::int_<LatticeModel_T::equilibriumAccuracyOrder>, boost::mpl::int_<1> > > >::type > { static void set( FieldIteratorXYZ & begin, const FieldIteratorXYZ & end, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { std::vector< real_t > value( stencil::NR_OF_DIRECTIONS ); - const real_t dir_independent = real_t(1.0); + const real_t dir_independent = 1.0_r; for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - value[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( dir_independent + real_t(3.0)*vel ); + value[ d.toIdx() ] = real_c(LatticeModel_T::w[ d.toIdx() ]) * rho * ( dir_independent + 3.0_r*vel ); } for( auto cell = begin; cell != end; ++cell ) diff --git a/src/lbm/field/MacroscopicValueCalculation.h b/src/lbm/field/MacroscopicValueCalculation.h index dae0a43c..bda69eaf 100644 --- a/src/lbm/field/MacroscopicValueCalculation.h +++ b/src/lbm/field/MacroscopicValueCalculation.h @@ -44,7 +44,7 @@ namespace lbm { template< typename LatticeModel_T, typename FieldPtrOrIterator > inline void setDensityAndVelocity( FieldPtrOrIterator & it, const LatticeModel_T & latticeModel, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ); + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ); ///////////////// // EQUILIBRIUM // @@ -52,7 +52,7 @@ inline void setDensityAndVelocity( FieldPtrOrIterator & it, const LatticeModel_T template< typename LatticeModel_T, typename FieldPtrOrIterator > inline void setToEquilibrium( FieldPtrOrIterator & it, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ); + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ); ///////////// // DENSITY // @@ -261,7 +261,7 @@ inline void getVelocity( Vector3< real_t > & velocity, const LatticeModel_T & la if( LatticeModel_T::compressible ) { const real_t rho = getDensityAndMomentumDensity< LatticeModel_T >( velocity, latticeModel, it ); - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velocity *= invRho; } else @@ -288,7 +288,7 @@ inline void getEquilibriumVelocity( Vector3< real_t > & velocity, const LatticeM if( LatticeModel_T::compressible ) { const real_t rho = getDensityAndEquilibriumMomentumDensity< LatticeModel_T >( velocity, latticeModel, it ); - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velocity *= invRho; } else @@ -361,7 +361,7 @@ inline real_t getDensityAndVelocity( Vector3< real_t > & velocity, const Lattice const real_t rho = getDensityAndMomentumDensity< LatticeModel_T >( velocity, latticeModel, it ); if( LatticeModel_T::compressible ) { - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velocity *= invRho; } return rho; @@ -375,7 +375,7 @@ inline real_t getDensityAndEquilibriumVelocity( Vector3< real_t > & velocity, co const real_t rho = getDensityAndEquilibriumMomentumDensity< LatticeModel_T >( velocity, latticeModel, it ); if( LatticeModel_T::compressible ) { - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velocity *= invRho; } return rho; diff --git a/src/lbm/field/MomentumDensity.h b/src/lbm/field/MomentumDensity.h index 28e092c8..dd5c78a5 100644 --- a/src/lbm/field/MomentumDensity.h +++ b/src/lbm/field/MomentumDensity.h @@ -160,7 +160,7 @@ struct MacroscopicForceCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( const LatticeModel_T & latticeModel, Vector3< real_t > & momentumDensity ) { const auto & force = latticeModel.forceModel().force(); - const real_t dt_2 = real_t(0.5); + const real_t dt_2 = 0.5_r; momentumDensity[0] += dt_2 * force[0]; momentumDensity[1] += dt_2 * force[1]; @@ -187,7 +187,7 @@ struct MacroscopicForceCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( const LatticeModel_T & latticeModel, Vector3< real_t > & momentumDensity ) { const auto & force = latticeModel.forceModel().force(); - const real_t dt_2 = real_t(0.5); + const real_t dt_2 = 0.5_r; momentumDensity[0] += dt_2 * force[0]; momentumDensity[1] += dt_2 * force[1]; @@ -199,7 +199,7 @@ struct MacroscopicForceCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( FieldPtrOrIterator & it, const LatticeModel_T & latticeModel, Vector3< real_t > & momentumDensity ) { const auto & force = latticeModel.forceModel().force(it.x(), it.y(), it.z()); - const real_t dt_2 = real_t(0.5); + const real_t dt_2 = 0.5_r; momentumDensity[0] += dt_2 * force[0]; momentumDensity[1] += dt_2 * force[1]; @@ -209,7 +209,7 @@ struct MacroscopicForceCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const LatticeModel_T & latticeModel, Vector3< real_t > & momentumDensity ) { const auto & force = latticeModel.forceModel().force(x,y,z); - const real_t dt_2 = real_t(0.5); + const real_t dt_2 = 0.5_r; momentumDensity[0] += dt_2 * force[0]; momentumDensity[1] += dt_2 * force[1]; @@ -247,7 +247,7 @@ struct EquilibriumForceCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( const LatticeModel_T & latticeModel, Vector3< real_t > & momentumDensity ) { const auto & force = latticeModel.forceModel().force(); - const real_t dt_2 = real_t(0.5); + const real_t dt_2 = 0.5_r; momentumDensity[0] += dt_2 * force[0]; momentumDensity[1] += dt_2 * force[1]; @@ -274,7 +274,7 @@ struct EquilibriumForceCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( const LatticeModel_T & latticeModel, Vector3< real_t > & momentumDensity ) { const auto & force = latticeModel.forceModel().force(); - const real_t dt_2 = real_t(0.5); + const real_t dt_2 = 0.5_r; momentumDensity[0] += dt_2 * force[0]; momentumDensity[1] += dt_2 * force[1]; @@ -286,7 +286,7 @@ struct EquilibriumForceCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( FieldPtrOrIterator & it, const LatticeModel_T & latticeModel, Vector3< real_t > & momentumDensity ) { const auto & force = latticeModel.forceModel().force(it.x(), it.y(), it.z()); - const real_t dt_2 = real_t(0.5); + const real_t dt_2 = 0.5_r; momentumDensity[0] += dt_2 * force[0]; momentumDensity[1] += dt_2 * force[1]; @@ -296,7 +296,7 @@ struct EquilibriumForceCorrection< LatticeModel_T, typename boost::enable_if< bo static void apply( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const LatticeModel_T & latticeModel, Vector3< real_t > & momentumDensity ) { const auto & force = latticeModel.forceModel().force(x,y,z); - const real_t dt_2 = real_t(0.5); + const real_t dt_2 = 0.5_r; momentumDensity[0] += dt_2 * force[0]; momentumDensity[1] += dt_2 * force[1]; diff --git a/src/lbm/field/PdfField.h b/src/lbm/field/PdfField.h index b2e0bce5..5f995dcf 100644 --- a/src/lbm/field/PdfField.h +++ b/src/lbm/field/PdfField.h @@ -84,8 +84,8 @@ public: PdfField( const uint_t _xSize, const uint_t _ySize, const uint_t _zSize, const LatticeModel_T & _latticeModel, - const bool initialize = true, const Vector3< real_t > & initialVelocity = Vector3< real_t >( real_t(0.0) ), - const real_t initialDensity = real_t(1.0), + const bool initialize = true, const Vector3< real_t > & initialVelocity = Vector3< real_t >( 0.0_r ), + const real_t initialDensity = 1.0_r, const uint_t ghostLayers = uint_t(1), const field::Layout & _layout = field::zyxf, const shared_ptr< field::FieldAllocator<real_t> > & alloc = shared_ptr< field::FieldAllocator<real_t> >() ); @@ -127,23 +127,23 @@ public: // set density and velocity // ////////////////////////////// - inline void setDensityAndVelocity( const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ); + inline void setDensityAndVelocity( const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ); inline void setDensityAndVelocity( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ); + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ); inline void setDensityAndVelocity( const Cell & cell, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ); + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ); ///////////////////// // set equilibrium // ///////////////////// - inline void setToEquilibrium( const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ); + inline void setToEquilibrium( const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ); inline void setToEquilibrium( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ); + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ); inline void setToEquilibrium( const Cell & cell, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ); + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ); ///////////////// // get density // @@ -288,7 +288,7 @@ PdfField< LatticeModel_T >::PdfField( const uint_t _xSize, const uint_t _ySize, { #ifdef _OPENMP // take care of proper thread<->memory assignment (first-touch allocation policy !) - this->setWithGhostLayer( real_t(0) ); + this->setWithGhostLayer( 0_r ); #endif if( initialize ) @@ -475,7 +475,7 @@ inline void PdfField< LatticeModel_T >::getVelocity( Vector3< real_t > & velocit if( LatticeModel_T::compressible ) { const real_t rho = DensityAndMomentumDensity< LatticeModel_T >::get( velocity, latticeModel_, *this, x, y, z ); - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velocity *= invRho; } else @@ -514,7 +514,7 @@ inline void PdfField< LatticeModel_T >::getEquilibriumVelocity( Vector3< real_t if( LatticeModel_T::compressible ) { const real_t rho = DensityAndMomentumDensity< LatticeModel_T >::getEquilibrium( velocity, latticeModel_, *this, x, y, z ); - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velocity *= invRho; } else @@ -633,7 +633,7 @@ inline real_t PdfField< LatticeModel_T >::getDensityAndVelocity( Vector3< real_t const real_t rho = DensityAndMomentumDensity< LatticeModel_T >::get( velocity, latticeModel_, *this, x, y, z ); if( LatticeModel_T::compressible ) { - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velocity *= invRho; } return rho; @@ -654,7 +654,7 @@ inline real_t PdfField< LatticeModel_T >::getDensityAndEquilibriumVelocity( Vect const real_t rho = DensityAndMomentumDensity< LatticeModel_T >::getEquilibrium( velocity, latticeModel_, *this, x, y, z ); if( LatticeModel_T::compressible ) { - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velocity *= invRho; } return rho; diff --git a/src/lbm/field/ShearRate.h b/src/lbm/field/ShearRate.h index 29577948..d21cdd68 100644 --- a/src/lbm/field/ShearRate.h +++ b/src/lbm/field/ShearRate.h @@ -122,22 +122,22 @@ struct ShearRate } /// For incompressible LB you don't have to pass a value for 'rho' since for incompressible LB 'rho' is not used in this function! - static inline real_t get( const std::vector< real_t > & nonEquilibrium, const real_t relaxationParam, const real_t rho = real_t(1) ) + static inline real_t get( const std::vector< real_t > & nonEquilibrium, const real_t relaxationParam, const real_t rho = 1_r ) { WALBERLA_ASSERT_EQUAL( nonEquilibrium.size(), Stencil::Size ); - real_t D2 = real_t(0); + real_t D2 = 0_r; if( LatticeModel_T::compressible ) { for( uint_t alpha = 0; alpha < 3; ++alpha ) for( uint_t beta = 0; beta < 3; ++beta ) { - real_t curStrain = real_t(0); + real_t curStrain = 0_r; for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) curStrain += nonEquilibrium[ d.toIdx() ] * stencil::c[alpha][*d] * stencil::c[beta][*d]; - curStrain *= ( -real_t(3) / ( real_t(2) * rho ) ) * relaxationParam; + curStrain *= ( -3_r / ( 2_r * rho ) ) * relaxationParam; D2 += curStrain * curStrain; } } @@ -146,16 +146,16 @@ struct ShearRate for( uint_t alpha = 0; alpha < 3; ++alpha ) for( uint_t beta = 0; beta < 3; ++beta ) { - real_t curStrain = real_t(0); + real_t curStrain = 0_r; for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) curStrain += nonEquilibrium[ d.toIdx() ] * stencil::c[alpha][*d] * stencil::c[beta][*d]; - curStrain *= ( -real_t(3) / real_t(2) ) * relaxationParam; + curStrain *= ( -3_r / 2_r ) * relaxationParam; D2 += curStrain * curStrain; } } - return real_t(2) * std::sqrt( D2 ); + return 2_r * std::sqrt( D2 ); } }; diff --git a/src/lbm/geometry/IntersectionRatio.h b/src/lbm/geometry/IntersectionRatio.h index 7ff17e71..5fb33dde 100644 --- a/src/lbm/geometry/IntersectionRatio.h +++ b/src/lbm/geometry/IntersectionRatio.h @@ -74,7 +74,7 @@ real_t intersectionRatio( const Body & body, inline real_t intersectionRatio( const geometry::Sphere & sphere, const Vector3<real_t> & fluidPoint, const Vector3<real_t> & direction, - const real_t /*epsilon*/ = real_t(0) ) + const real_t /*epsilon*/ = 0_r ) { return intersectionRatioSphere( sphere, fluidPoint, direction ); } diff --git a/src/lbm/geometry/initializer/PoiseuilleInitializer.impl.h b/src/lbm/geometry/initializer/PoiseuilleInitializer.impl.h index 02b6d333..9526be0a 100644 --- a/src/lbm/geometry/initializer/PoiseuilleInitializer.impl.h +++ b/src/lbm/geometry/initializer/PoiseuilleInitializer.impl.h @@ -216,7 +216,7 @@ void Poiseuille<BH_T,LM,SP,UBB>::initVelocityBoundary( Scenario scenario, Axis f auto pdfField = blockIt->template getData< lbm::PdfField<LM> > ( pdfFieldID_ ); SP & pressure = handling->template getBoundaryCondition< SP >( handling->getBoundaryUID( pressureFlag1_ ) ); - pressure.setLatticeDensity( real_t(1) ); + pressure.setLatticeDensity( 1_r ); if ( storage_.atDomainMinBorder( flowAxis, *blockIt) ) { @@ -269,10 +269,10 @@ void Poiseuille<BH_T,LM,SP,UBB>::initPressureBoundary( Axis flowAxis, real_t pre SP & pressure1 = handling->template getBoundaryCondition< SP >( handling->getBoundaryUID( pressureFlag1_ ) ); SP & pressure2 = handling->template getBoundaryCondition< SP >( handling->getBoundaryUID( pressureFlag2_ ) ); - const real_t densityDiff = real_t(3) * pressureDiff; + const real_t densityDiff = 3_r * pressureDiff; - pressure1.setLatticeDensity ( real_t(1) + densityDiff / real_t(2) ); - pressure2.setLatticeDensity ( real_t(1) - densityDiff / real_t(2) ); + pressure1.setLatticeDensity ( 1_r + densityDiff / 2_r ); + pressure2.setLatticeDensity ( 1_r - densityDiff / 2_r ); } } @@ -360,7 +360,7 @@ real_t Poiseuille<BH_T,LM,SP,UBB>::getVelocity( const Cell & globalCell, Scenari { const real_t x = real_c( globalCell[ parabolaAxis] ); const real_t max = maxPoint_ [ parabolaAxis ]; - return - real_t(4) * x * (x-max) / ( max * max) * maxVelocity; + return - 4_r * x * (x-max) / ( max * max) * maxVelocity; } else if ( scenario == PIPE ) // pipe setup { @@ -370,7 +370,7 @@ real_t Poiseuille<BH_T,LM,SP,UBB>::getVelocity( const Cell & globalCell, Scenari const real_t dist = std::sqrt( distSq ); const real_t pipeRadius = getPipeRadius( scenario, flowAxis, parabolaAxis ); if ( distSq < pipeRadius * pipeRadius ) - return - real_t(4) * dist * (dist - pipeRadius) / ( pipeRadius * pipeRadius) * maxVelocity; + return - 4_r * dist * (dist - pipeRadius) / ( pipeRadius * pipeRadius) * maxVelocity; else // outside pipe return 0; } @@ -396,7 +396,7 @@ real_t Poiseuille<BH_T,LM,SP,UBB>::velocityFromPressureDiff( Scenario scenario, { const real_t pipeRadius = getPipeRadius( scenario, flowAxis, parabolaAxis ); real_t acceleration = pressureDiff / real_c( storage_.getNumberOfCells( flowAxis ) ); - real_t geometryFactor = (scenario == PIPE) ? real_t(4) : real_t(2); + real_t geometryFactor = (scenario == PIPE) ? 4_r : 2_r; return acceleration / ( geometryFactor * latticeViscosity_ ) * pipeRadius * pipeRadius; } @@ -404,7 +404,7 @@ template< typename BH_T, typename LM, typename SP, typename UBB > real_t Poiseuille<BH_T,LM,SP,UBB>::pressureDiffFromVelocity( Scenario scenario, real_t velocity, Axis flowAxis, Axis parabolaAxis ) { const real_t pipeRadius = getPipeRadius( scenario, flowAxis, parabolaAxis ); - real_t geometryFactor = (scenario == PIPE) ? real_t(4) : real_t(2); + real_t geometryFactor = (scenario == PIPE) ? 4_r : 2_r; real_t acceleration = ( geometryFactor * velocity * latticeViscosity_ ) / ( pipeRadius * pipeRadius ); return acceleration * real_c( storage_.getNumberOfCells( flowAxis ) ); } diff --git a/src/lbm/lattice_model/CollisionModel.cpp b/src/lbm/lattice_model/CollisionModel.cpp index 546d570a..fcc1a664 100644 --- a/src/lbm/lattice_model/CollisionModel.cpp +++ b/src/lbm/lattice_model/CollisionModel.cpp @@ -25,8 +25,8 @@ namespace walberla { namespace lbm { namespace collision_model { -const real_t TRT::threeSixteenth = real_t(3) / real_t(16); -const real_t D3Q19MRT::threeSixteenth = real_t(3) / real_t(16); +const real_t TRT::threeSixteenth = 3_r / 16_r; +const real_t D3Q19MRT::threeSixteenth = 3_r / 16_r; } // namespace collision_model } // namespace lbm diff --git a/src/lbm/lattice_model/CollisionModel.h b/src/lbm/lattice_model/CollisionModel.h index df97cc3c..5d16b3d6 100644 --- a/src/lbm/lattice_model/CollisionModel.h +++ b/src/lbm/lattice_model/CollisionModel.h @@ -53,21 +53,21 @@ inline real_t levelDependentRelaxationParameter( const uint_t targetLevel, const else if( level == targetLevel ) return parameter_level; else - powFactor = real_t(1) / real_c( uint_t(1) << ( level - targetLevel ) ); + powFactor = 1_r / real_c( uint_t(1) << ( level - targetLevel ) ); const real_t parameter_level_half = real_c(0.5) * parameter_level; - return parameter_level / ( parameter_level_half + powFactor * ( real_t(1) - parameter_level_half ) ); + return parameter_level / ( parameter_level_half + powFactor * ( 1_r - parameter_level_half ) ); } inline real_t viscosityFromOmega( const real_t omega ) { - static const real_t one_third = real_t(1) / real_t(3); - return ( real_t(1) / omega - real_t(0.5) ) * one_third; + static const real_t one_third = 1_r / 3_r; + return ( 1_r / omega - 0.5_r ) * one_third; } inline real_t omegaFromViscosity( const real_t viscosity ) { - return real_t(1) / ( real_t(0.5) + real_t(3) * viscosity ); + return 1_r / ( 0.5_r + 3_r * viscosity ); } @@ -112,7 +112,7 @@ public: real_t viscosity() const { return viscosity_; } real_t omega( const cell_idx_t /*x*/, const cell_idx_t /*y*/, const cell_idx_t /*z*/, - const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = real_t(1) ) const { return omega_; } + const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = 1_r ) const { return omega_; } real_t viscosity( const cell_idx_t /*x*/, const cell_idx_t /*y*/, const cell_idx_t /*z*/ ) const { return viscosity_; } real_t viscosity( const uint_t _level ) const @@ -173,7 +173,7 @@ public: } real_t omega( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, - const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = real_t(1) ) const + const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = 1_r ) const { return omegaField_->get(x,y,z); } @@ -271,18 +271,18 @@ public: real_t omega() const { return lambda_e_; } real_t omega( const cell_idx_t /*x*/, const cell_idx_t /*y*/, const cell_idx_t /*z*/, - const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = real_t(1) ) const { return omega(); } + const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = 1_r ) const { return omega(); } inline real_t omega_bulk() const { return omega(); } static real_t lambda_e( const real_t _omega ) { return _omega; } static real_t lambda_d( const real_t _omega, const real_t _magicNumber = threeSixteenth ) { - return ( real_t(4) - real_t(2) * _omega ) / ( real_t(4) * _magicNumber * _omega + real_t(2) - _omega ); + return ( 4_r - 2_r * _omega ) / ( 4_r * _magicNumber * _omega + 2_r - _omega ); } static real_t magicNumber( const real_t _lambda_e, const real_t _lambda_d ) { - return ( ( real_t(2) - _lambda_e ) * ( real_t(2) - _lambda_d ) ) / ( real_t(4) * _lambda_e * _lambda_d ); + return ( ( 2_r - _lambda_e ) * ( 2_r - _lambda_d ) ) / ( 4_r * _lambda_e * _lambda_d ); } real_t viscosity( const uint_t _level ) const @@ -295,7 +295,7 @@ public: private: - TRT() : lambda_e_( real_t(0) ), lambda_d_( real_t(0) ), magicNumber_( real_t(0) ), viscosity_( real_t(0) ), level_( uint_t(0) ) {} + TRT() : lambda_e_( 0_r ), lambda_d_( 0_r ), magicNumber_( 0_r ), viscosity_( 0_r ), level_( uint_t(0) ) {} void initWithMagicNumber( const real_t _omega, const real_t _magicNumber, const uint_t _level ) { @@ -342,14 +342,14 @@ public: const uint_t _level = uint_t(0) ) : viscosity_( viscosityFromOmega( _s9 ) ), level_( _level ) { - s_[0] = real_t(0); + s_[0] = 0_r; s_[1] = _s1; s_[2] = _s2; - s_[3] = real_t(0); + s_[3] = 0_r; s_[4] = _s4; - s_[5] = real_t(0); + s_[5] = 0_r; s_[6] = _s4; - s_[7] = real_t(0); + s_[7] = 0_r; s_[8] = _s4; s_[9] = _s9; s_[10] = _s10; @@ -446,14 +446,14 @@ public: */ } - real_t s0() const { return real_t(0); } + real_t s0() const { return 0_r; } real_t s1() const { return s_[1]; } real_t s2() const { return s_[2]; } - real_t s3() const { return real_t(0); } + real_t s3() const { return 0_r; } real_t s4() const { return s_[4]; } - real_t s5() const { return real_t(0); } + real_t s5() const { return 0_r; } real_t s6() const { return s_[6]; } - real_t s7() const { return real_t(0); } + real_t s7() const { return 0_r; } real_t s8() const { return s_[8]; } real_t s9() const { return s_[9]; } real_t s10() const { return s_[10]; } @@ -481,7 +481,7 @@ public: real_t omega() const { return s_[9]; } real_t omega( const cell_idx_t /*x*/, const cell_idx_t /*y*/, const cell_idx_t /*z*/, - const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = real_t(1) ) const { return omega(); } + const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = 1_r ) const { return omega(); } real_t omega_bulk() const { return s_[1]; } @@ -498,24 +498,24 @@ public: private: - D3Q19MRT() : viscosity_( real_t(0) ), level_( uint_t(0) ) + D3Q19MRT() : viscosity_( 0_r ), level_( uint_t(0) ) { - s_[0] = real_t(0); s_[1] = real_t(0); s_[2] = real_t(0); s_[3] = real_t(0); s_[4] = real_t(0); - s_[5] = real_t(0); s_[6] = real_t(0); s_[7] = real_t(0); s_[8] = real_t(0); s_[9] = real_t(0); - s_[10] = real_t(0); s_[11] = real_t(0); s_[12] = real_t(0); s_[13] = real_t(0); s_[14] = real_t(0); - s_[15] = real_t(0); s_[16] = real_t(0); s_[17] = real_t(0); s_[18] = real_t(0); + s_[0] = 0_r; s_[1] = 0_r; s_[2] = 0_r; s_[3] = 0_r; s_[4] = 0_r; + s_[5] = 0_r; s_[6] = 0_r; s_[7] = 0_r; s_[8] = 0_r; s_[9] = 0_r; + s_[10] = 0_r; s_[11] = 0_r; s_[12] = 0_r; s_[13] = 0_r; s_[14] = 0_r; + s_[15] = 0_r; s_[16] = 0_r; s_[17] = 0_r; s_[18] = 0_r; } void initTRT( const real_t lambda_e, const real_t lambda_d, const uint_t _level = uint_t(0) ) { - s_[0] = real_t(0); + s_[0] = 0_r; s_[1] = lambda_e; s_[2] = lambda_e; - s_[3] = real_t(0); + s_[3] = 0_r; s_[4] = lambda_d; - s_[5] = real_t(0); + s_[5] = 0_r; s_[6] = lambda_d; - s_[7] = real_t(0); + s_[7] = 0_r; s_[8] = lambda_d; s_[9] = lambda_e; s_[10] = lambda_e; @@ -534,14 +534,14 @@ private: void initPan( const real_t lambda_e, const real_t lambda_d, const uint_t _level = uint_t(0) ) { - s_[0] = real_t(0); + s_[0] = 0_r; s_[1] = lambda_d; s_[2] = lambda_d; - s_[3] = real_t(0); + s_[3] = 0_r; s_[4] = lambda_d; - s_[5] = real_t(0); + s_[5] = 0_r; s_[6] = lambda_d; - s_[7] = real_t(0); + s_[7] = 0_r; s_[8] = lambda_d; s_[9] = lambda_e; s_[10] = lambda_d; @@ -589,7 +589,7 @@ public: { omega_[0] = _omega1; for( uint_t i = uint_t(1); i < uint_t(10); ++i ) - omega_[i] = real_t(1); + omega_[i] = 1_r; } /// Initializes all omegas separately @@ -644,7 +644,7 @@ public: real_t omega() const { return omega_[0]; } real_t omega( const cell_idx_t /*x*/, const cell_idx_t /*y*/, const cell_idx_t /*z*/, - const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = real_t(1) ) const { return omega(); } + const Vector3<real_t> & /*velocity*/ = Vector3<real_t>(), const real_t /*rho*/ = 1_r ) const { return omega(); } real_t omega( uint_t idx ) const { return omega_[idx]; } diff --git a/src/lbm/lattice_model/D2Q9.h b/src/lbm/lattice_model/D2Q9.h index 5cdebfd1..9b142ebf 100644 --- a/src/lbm/lattice_model/D2Q9.h +++ b/src/lbm/lattice_model/D2Q9.h @@ -73,31 +73,31 @@ protected: template< typename CM, bool C, typename FM, int EAO > const char* D2Q9<CM,C,FM,EAO>::NAME = "D2Q9"; -template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::w_0 = real_t(4.0) / real_t( 9.0); -template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::w_1 = real_t(1.0) / real_t( 9.0); -template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::w_2 = real_t(1.0) / real_t(36.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::w_0 = 4.0_r / real_t( 9.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::w_1 = 1.0_r / real_t( 9.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::w_2 = 1.0_r / 36.0_r; // must match with the static array 'dir' in stencil::D2Q9 -template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::w[9] = { real_t(4.0) / real_t( 9.0), // C - real_t(1.0) / real_t( 9.0), // N - real_t(1.0) / real_t( 9.0), // S - real_t(1.0) / real_t( 9.0), // W - real_t(1.0) / real_t( 9.0), // E - real_t(1.0) / real_t(36.0), // NW - real_t(1.0) / real_t(36.0), // NE - real_t(1.0) / real_t(36.0), // SW - real_t(1.0) / real_t(36.0) }; // SE +template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::w[9] = { 4.0_r / real_t( 9.0), // C + 1.0_r / real_t( 9.0), // N + 1.0_r / real_t( 9.0), // S + 1.0_r / real_t( 9.0), // W + 1.0_r / real_t( 9.0), // E + 1.0_r / 36.0_r, // NW + 1.0_r / 36.0_r, // NE + 1.0_r / 36.0_r, // SW + 1.0_r / 36.0_r }; // SE // must match with the static array 'dir' in stencil::D2Q9 -template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::wInv[9] = { real_t(9.0) / real_t( 4.0), // C +template< typename CM, bool C, typename FM, int EAO > const real_t D2Q9<CM,C,FM,EAO>::wInv[9] = { 9.0_r / real_t( 4.0), // C real_t( 9.0), // N real_t( 9.0), // S real_t( 9.0), // W real_t( 9.0), // E - real_t(36.0), // NW - real_t(36.0), // NE - real_t(36.0), // SW - real_t(36.0) }; // SE + 36.0_r, // NW + 36.0_r, // NE + 36.0_r, // SW + 36.0_r }; // SE } // namespace lbm } // namespace walberla diff --git a/src/lbm/lattice_model/D3Q15.h b/src/lbm/lattice_model/D3Q15.h index 35a849cd..0b1a9967 100644 --- a/src/lbm/lattice_model/D3Q15.h +++ b/src/lbm/lattice_model/D3Q15.h @@ -71,26 +71,26 @@ protected: template< typename CM, bool C, typename FM, int EAO > const char* D3Q15<CM,C,FM,EAO>::NAME = "D3Q15"; -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM,EAO>::w_0 = real_t(2.0) / real_t( 9.0); -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM,EAO>::w_1 = real_t(1.0) / real_t( 9.0); -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM,EAO>::w_2 = real_t(1.0) / real_t(72.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM,EAO>::w_0 = 2.0_r / real_t( 9.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM,EAO>::w_1 = 1.0_r / real_t( 9.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM,EAO>::w_2 = 1.0_r / 72.0_r; // must match with the static array 'dir' in stencil::D3Q15 -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM,EAO>::w[15] = { real_t(2.0) / real_t( 9.0), // C - real_t(1.0) / real_t( 9.0), // N - real_t(1.0) / real_t( 9.0), // S - real_t(1.0) / real_t( 9.0), // W - real_t(1.0) / real_t( 9.0), // E - real_t(1.0) / real_t( 9.0), // T - real_t(1.0) / real_t( 9.0), // B - real_t(1.0) / real_t(72.0), // TNE - real_t(1.0) / real_t(72.0), // TNW - real_t(1.0) / real_t(72.0), // TSE - real_t(1.0) / real_t(72.0), // TSW - real_t(1.0) / real_t(72.0), // BNE - real_t(1.0) / real_t(72.0), // BNW - real_t(1.0) / real_t(72.0), // BSE - real_t(1.0) / real_t(72.0) }; // BSW +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM,EAO>::w[15] = { 2.0_r / real_t( 9.0), // C + 1.0_r / real_t( 9.0), // N + 1.0_r / real_t( 9.0), // S + 1.0_r / real_t( 9.0), // W + 1.0_r / real_t( 9.0), // E + 1.0_r / real_t( 9.0), // T + 1.0_r / real_t( 9.0), // B + 1.0_r / 72.0_r, // TNE + 1.0_r / 72.0_r, // TNW + 1.0_r / 72.0_r, // TSE + 1.0_r / 72.0_r, // TSW + 1.0_r / 72.0_r, // BNE + 1.0_r / 72.0_r, // BNW + 1.0_r / 72.0_r, // BSE + 1.0_r / 72.0_r }; // BSW // must match with the static array 'dir' in stencil::D3Q15 template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM,EAO>::wInv[15] = { real_t( 4.5), // C @@ -100,14 +100,14 @@ template< typename CM, bool C, typename FM, int EAO > const real_t D3Q15<CM,C,FM real_t( 9.0), // E real_t( 9.0), // T real_t( 9.0), // B - real_t(72.0), // TNE - real_t(72.0), // TNW - real_t(72.0), // TSE - real_t(72.0), // TSW - real_t(72.0), // BNE - real_t(72.0), // BNW - real_t(72.0), // BSE - real_t(72.0) }; // BSW + 72.0_r, // TNE + 72.0_r, // TNW + 72.0_r, // TSE + 72.0_r, // TSW + 72.0_r, // BNE + 72.0_r, // BNW + 72.0_r, // BSE + 72.0_r }; // BSW diff --git a/src/lbm/lattice_model/D3Q19.h b/src/lbm/lattice_model/D3Q19.h index 4f008d86..a4384294 100644 --- a/src/lbm/lattice_model/D3Q19.h +++ b/src/lbm/lattice_model/D3Q19.h @@ -71,51 +71,51 @@ protected: template< typename CM, bool C, typename FM, int EAO > const char* D3Q19<CM,C,FM,EAO>::NAME = "D3Q19"; -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q19<CM,C,FM,EAO>::w_0 = real_t(1.0) / real_t( 3.0); -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q19<CM,C,FM,EAO>::w_1 = real_t(1.0) / real_t(18.0); -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q19<CM,C,FM,EAO>::w_2 = real_t(1.0) / real_t(36.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q19<CM,C,FM,EAO>::w_0 = 1.0_r / real_t( 3.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q19<CM,C,FM,EAO>::w_1 = 1.0_r / 18.0_r; +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q19<CM,C,FM,EAO>::w_2 = 1.0_r / 36.0_r; // must match with the static array 'dir' in stencil::D3Q19 -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q19<CM,C,FM,EAO>::w[19] = { real_t(1.0) / real_t( 3.0), // C - real_t(1.0) / real_t(18.0), // N - real_t(1.0) / real_t(18.0), // S - real_t(1.0) / real_t(18.0), // W - real_t(1.0) / real_t(18.0), // E - real_t(1.0) / real_t(18.0), // T - real_t(1.0) / real_t(18.0), // B - real_t(1.0) / real_t(36.0), // NW - real_t(1.0) / real_t(36.0), // NE - real_t(1.0) / real_t(36.0), // SW - real_t(1.0) / real_t(36.0), // SE - real_t(1.0) / real_t(36.0), // TN - real_t(1.0) / real_t(36.0), // TS - real_t(1.0) / real_t(36.0), // TW - real_t(1.0) / real_t(36.0), // TE - real_t(1.0) / real_t(36.0), // BN - real_t(1.0) / real_t(36.0), // BS - real_t(1.0) / real_t(36.0), // BW - real_t(1.0) / real_t(36.0) }; // BE +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q19<CM,C,FM,EAO>::w[19] = { 1.0_r / real_t( 3.0), // C + 1.0_r / 18.0_r, // N + 1.0_r / 18.0_r, // S + 1.0_r / 18.0_r, // W + 1.0_r / 18.0_r, // E + 1.0_r / 18.0_r, // T + 1.0_r / 18.0_r, // B + 1.0_r / 36.0_r, // NW + 1.0_r / 36.0_r, // NE + 1.0_r / 36.0_r, // SW + 1.0_r / 36.0_r, // SE + 1.0_r / 36.0_r, // TN + 1.0_r / 36.0_r, // TS + 1.0_r / 36.0_r, // TW + 1.0_r / 36.0_r, // TE + 1.0_r / 36.0_r, // BN + 1.0_r / 36.0_r, // BS + 1.0_r / 36.0_r, // BW + 1.0_r / 36.0_r }; // BE // must match with the static array 'dir' in stencil::D3Q19 template< typename CM, bool C, typename FM, int EAO > const real_t D3Q19<CM,C,FM,EAO>::wInv[19] = { real_t( 3.0), // C - real_t(18.0), // N - real_t(18.0), // S - real_t(18.0), // W - real_t(18.0), // E - real_t(18.0), // T - real_t(18.0), // B - real_t(36.0), // NW - real_t(36.0), // NE - real_t(36.0), // SW - real_t(36.0), // SE - real_t(36.0), // TN - real_t(36.0), // TS - real_t(36.0), // TW - real_t(36.0), // TE - real_t(36.0), // BN - real_t(36.0), // BS - real_t(36.0), // BW - real_t(36.0) }; // BE + 18.0_r, // N + 18.0_r, // S + 18.0_r, // W + 18.0_r, // E + 18.0_r, // T + 18.0_r, // B + 36.0_r, // NW + 36.0_r, // NE + 36.0_r, // SW + 36.0_r, // SE + 36.0_r, // TN + 36.0_r, // TS + 36.0_r, // TW + 36.0_r, // TE + 36.0_r, // BN + 36.0_r, // BS + 36.0_r, // BW + 36.0_r }; // BE diff --git a/src/lbm/lattice_model/D3Q27.h b/src/lbm/lattice_model/D3Q27.h index 5ca2ade6..ae7a4442 100644 --- a/src/lbm/lattice_model/D3Q27.h +++ b/src/lbm/lattice_model/D3Q27.h @@ -73,48 +73,48 @@ protected: template< typename CM, bool C, typename FM, int EAO > const char* D3Q27<CM,C,FM,EAO>::NAME = "D3Q27"; -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w_0 = real_t(8.0) / real_t( 27.0); -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w_1 = real_t(2.0) / real_t( 27.0); -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w_2 = real_t(1.0) / real_t( 54.0); -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w_3 = real_t(1.0) / real_t(216.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w_0 = 8.0_r / real_t( 27.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w_1 = 2.0_r / real_t( 27.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w_2 = 1.0_r / real_t( 54.0); +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w_3 = 1.0_r / 216.0_r; // must match with the static array 'dir' in stencil::D3Q27 -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w[27] = { real_t(8.0) / real_t( 27.0), // C - real_t(2.0) / real_t( 27.0), // N - real_t(2.0) / real_t( 27.0), // S - real_t(2.0) / real_t( 27.0), // W - real_t(2.0) / real_t( 27.0), // E - real_t(2.0) / real_t( 27.0), // T - real_t(2.0) / real_t( 27.0), // B - real_t(1.0) / real_t( 54.0), // NW - real_t(1.0) / real_t( 54.0), // NE - real_t(1.0) / real_t( 54.0), // SW - real_t(1.0) / real_t( 54.0), // SE - real_t(1.0) / real_t( 54.0), // TN - real_t(1.0) / real_t( 54.0), // TS - real_t(1.0) / real_t( 54.0), // TW - real_t(1.0) / real_t( 54.0), // TE - real_t(1.0) / real_t( 54.0), // BN - real_t(1.0) / real_t( 54.0), // BS - real_t(1.0) / real_t( 54.0), // BW - real_t(1.0) / real_t( 54.0), // BE - real_t(1.0) / real_t(216.0), // TNE - real_t(1.0) / real_t(216.0), // TNW - real_t(1.0) / real_t(216.0), // TSE - real_t(1.0) / real_t(216.0), // TSW - real_t(1.0) / real_t(216.0), // BNE - real_t(1.0) / real_t(216.0), // BNW - real_t(1.0) / real_t(216.0), // BSE - real_t(1.0) / real_t(216.0) }; // BSW +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::w[27] = { 8.0_r / real_t( 27.0), // C + 2.0_r / real_t( 27.0), // N + 2.0_r / real_t( 27.0), // S + 2.0_r / real_t( 27.0), // W + 2.0_r / real_t( 27.0), // E + 2.0_r / real_t( 27.0), // T + 2.0_r / real_t( 27.0), // B + 1.0_r / real_t( 54.0), // NW + 1.0_r / real_t( 54.0), // NE + 1.0_r / real_t( 54.0), // SW + 1.0_r / real_t( 54.0), // SE + 1.0_r / real_t( 54.0), // TN + 1.0_r / real_t( 54.0), // TS + 1.0_r / real_t( 54.0), // TW + 1.0_r / real_t( 54.0), // TE + 1.0_r / real_t( 54.0), // BN + 1.0_r / real_t( 54.0), // BS + 1.0_r / real_t( 54.0), // BW + 1.0_r / real_t( 54.0), // BE + 1.0_r / 216.0_r, // TNE + 1.0_r / 216.0_r, // TNW + 1.0_r / 216.0_r, // TSE + 1.0_r / 216.0_r, // TSW + 1.0_r / 216.0_r, // BNE + 1.0_r / 216.0_r, // BNW + 1.0_r / 216.0_r, // BSE + 1.0_r / 216.0_r }; // BSW // must match with the static array 'dir' in stencil::D3Q27 -template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::wInv[27] = { real_t(27.0) / real_t( 8.0), // C - real_t(27.0) / real_t( 2.0), // N - real_t(27.0) / real_t( 2.0), // S - real_t(27.0) / real_t( 2.0), // W - real_t(27.0) / real_t( 2.0), // E - real_t(27.0) / real_t( 2.0), // T - real_t(27.0) / real_t( 2.0), // B +template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM,EAO>::wInv[27] = { 27.0_r / real_t( 8.0), // C + 27.0_r / real_t( 2.0), // N + 27.0_r / real_t( 2.0), // S + 27.0_r / real_t( 2.0), // W + 27.0_r / real_t( 2.0), // E + 27.0_r / real_t( 2.0), // T + 27.0_r / real_t( 2.0), // B real_t( 54.0), // NW real_t( 54.0), // NE real_t( 54.0), // SW @@ -127,14 +127,14 @@ template< typename CM, bool C, typename FM, int EAO > const real_t D3Q27<CM,C,FM real_t( 54.0), // BS real_t( 54.0), // BW real_t( 54.0), // BE - real_t(216.0), // TNE - real_t(216.0), // TNW - real_t(216.0), // TSE - real_t(216.0), // TSW - real_t(216.0), // BNE - real_t(216.0), // BNW - real_t(216.0), // BSE - real_t(216.0) }; // BSW + 216.0_r, // TNE + 216.0_r, // TNW + 216.0_r, // TSE + 216.0_r, // TSW + 216.0_r, // BNE + 216.0_r, // BNW + 216.0_r, // BSE + 216.0_r }; // BSW } // namespace lbm } // namespace walberla diff --git a/src/lbm/lattice_model/EquilibriumDistribution.h b/src/lbm/lattice_model/EquilibriumDistribution.h index b9b16e87..67ceddad 100644 --- a/src/lbm/lattice_model/EquilibriumDistribution.h +++ b/src/lbm/lattice_model/EquilibriumDistribution.h @@ -77,41 +77,41 @@ public: typedef typename LatticeModel_T::Stencil Stencil; static real_t get( const real_t cx, const real_t cy, const real_t cz, const real_t w, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { const real_t vel = internal::multiplyVelocityDirection( cx, cy, cz, velocity ); - return w * ( (rho - real_t(1.0)) - real_t(1.5) * velocity.sqrLength() + real_t(4.5) * vel * vel + real_t(3.0) * vel ); + return w * ( (rho - 1.0_r) - 1.5_r * velocity.sqrLength() + 4.5_r * vel * vel + 3.0_r * vel ); } static real_t get( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { using namespace stencil; return get( real_c(cx[direction]), real_c(cy[direction]), real_c(cz[direction]), LatticeModel_T::w[ Stencil::idx[direction] ], velocity, rho ); } static real_t getSymmetricPart( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { const real_t vel = internal::multiplyVelocityDirection( direction, velocity ); - return LatticeModel_T::w[ Stencil::idx[direction] ] * ( (rho - real_t(1.0)) - real_t(1.5) * velocity.sqrLength() + real_t(4.5) * vel * vel ); + return LatticeModel_T::w[ Stencil::idx[direction] ] * ( (rho - 1.0_r) - 1.5_r * velocity.sqrLength() + 4.5_r * vel * vel ); } static real_t getAsymmetricPart( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t /*rho*/ = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t /*rho*/ = 1.0_r ) { - return LatticeModel_T::w[ Stencil::idx[direction] ] * real_t(3.0) * internal::multiplyVelocityDirection( direction, velocity ); + return LatticeModel_T::w[ Stencil::idx[direction] ] * 3.0_r * internal::multiplyVelocityDirection( direction, velocity ); } - static std::vector< real_t > get( const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + static std::vector< real_t > get( const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { std::vector< real_t > equilibrium( Stencil::Size ); - const real_t dirIndependent = (rho - real_t(1.0)) - real_t(1.5) * velocity.sqrLength(); + const real_t dirIndependent = (rho - 1.0_r) - 1.5_r * velocity.sqrLength(); for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) { const real_t vel = internal::multiplyVelocityDirection( *d, velocity ); - equilibrium[d.toIdx()] = LatticeModel_T::w[ d.toIdx() ] * ( dirIndependent + real_t(4.5) * vel * vel + real_t(3.0) * vel ); + equilibrium[d.toIdx()] = LatticeModel_T::w[ d.toIdx() ] * ( dirIndependent + 4.5_r * vel * vel + 3.0_r * vel ); } return equilibrium; @@ -132,36 +132,36 @@ public: typedef typename LatticeModel_T::Stencil Stencil; static real_t get( const real_t cx, const real_t cy, const real_t cz, const real_t w, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { - return w * ( (rho - real_t(1.0)) + real_t(3.0) * internal::multiplyVelocityDirection( cx, cy, cz, velocity ) ); + return w * ( (rho - 1.0_r) + 3.0_r * internal::multiplyVelocityDirection( cx, cy, cz, velocity ) ); } static real_t get( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { using namespace stencil; return get( real_c(cx[direction]), real_c(cy[direction]), real_c(cz[direction]), LatticeModel_T::w[ Stencil::idx[direction] ], velocity, rho ); } static real_t getSymmetricPart( const stencil::Direction direction, - const Vector3< real_t > & /*velocity*/ = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & /*velocity*/ = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { - return LatticeModel_T::w[ Stencil::idx[direction] ] * ( rho - real_t(1.0) ); + return LatticeModel_T::w[ Stencil::idx[direction] ] * ( rho - 1.0_r ); } static real_t getAsymmetricPart( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t /*rho*/ = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t /*rho*/ = 1.0_r ) { - return LatticeModel_T::w[ Stencil::idx[direction] ] * real_t(3.0) * internal::multiplyVelocityDirection( direction, velocity ); + return LatticeModel_T::w[ Stencil::idx[direction] ] * 3.0_r * internal::multiplyVelocityDirection( direction, velocity ); } - static std::vector< real_t > get( const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + static std::vector< real_t > get( const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { std::vector< real_t > equilibrium( Stencil::Size ); for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) - equilibrium[d.toIdx()] = LatticeModel_T::w[ d.toIdx() ] * ( (rho - real_t(1.0)) + real_t(3.0) * internal::multiplyVelocityDirection( *d, velocity ) ); + equilibrium[d.toIdx()] = LatticeModel_T::w[ d.toIdx() ] * ( (rho - 1.0_r) + 3.0_r * internal::multiplyVelocityDirection( *d, velocity ) ); return equilibrium; } @@ -181,41 +181,41 @@ public: typedef typename LatticeModel_T::Stencil Stencil; static real_t get( const real_t cx, const real_t cy, const real_t cz, const real_t w, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { const real_t vel = internal::multiplyVelocityDirection( cx, cy, cz, velocity ); - return w * rho * ( real_t(1.0) - real_t(1.5) * velocity.sqrLength() + real_t(4.5) * vel * vel + real_t(3.0) * vel ); + return w * rho * ( 1.0_r - 1.5_r * velocity.sqrLength() + 4.5_r * vel * vel + 3.0_r * vel ); } static real_t get( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { using namespace stencil; return get( real_c(cx[direction]), real_c(cy[direction]), real_c(cz[direction]), LatticeModel_T::w[ Stencil::idx[direction] ], velocity, rho ); } static real_t getSymmetricPart( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { const real_t vel = internal::multiplyVelocityDirection( direction, velocity ); - return LatticeModel_T::w[ Stencil::idx[direction] ] * rho * ( real_t(1.0) - real_t(1.5) * velocity.sqrLength() + real_t(4.5) * vel * vel ); + return LatticeModel_T::w[ Stencil::idx[direction] ] * rho * ( 1.0_r - 1.5_r * velocity.sqrLength() + 4.5_r * vel * vel ); } static real_t getAsymmetricPart( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { - return LatticeModel_T::w[ Stencil::idx[direction] ] * rho * real_t(3.0) * internal::multiplyVelocityDirection( direction, velocity ); + return LatticeModel_T::w[ Stencil::idx[direction] ] * rho * 3.0_r * internal::multiplyVelocityDirection( direction, velocity ); } - static std::vector< real_t > get( const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + static std::vector< real_t > get( const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { std::vector< real_t > equilibrium( Stencil::Size ); - const real_t dirIndependent = real_t(1.0) - real_t(1.5) * velocity.sqrLength(); + const real_t dirIndependent = 1.0_r - 1.5_r * velocity.sqrLength(); for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) { const real_t vel = internal::multiplyVelocityDirection( *d, velocity ); - equilibrium[d.toIdx()] = LatticeModel_T::w[ d.toIdx() ] * rho * ( dirIndependent + real_t(4.5) * vel * vel + real_t(3.0) * vel ); + equilibrium[d.toIdx()] = LatticeModel_T::w[ d.toIdx() ] * rho * ( dirIndependent + 4.5_r * vel * vel + 3.0_r * vel ); } return equilibrium; @@ -236,36 +236,36 @@ public: typedef typename LatticeModel_T::Stencil Stencil; static real_t get( const real_t cx, const real_t cy, const real_t cz, const real_t w, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { - return w * rho * ( real_t(1.0) + real_t(3.0) * internal::multiplyVelocityDirection( cx, cy, cz, velocity ) ); + return w * rho * ( 1.0_r + 3.0_r * internal::multiplyVelocityDirection( cx, cy, cz, velocity ) ); } static real_t get( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { using namespace stencil; return get( real_c(cx[direction]), real_c(cy[direction]), real_c(cz[direction]), LatticeModel_T::w[ Stencil::idx[direction] ], velocity, rho ); } static real_t getSymmetricPart( const stencil::Direction direction, - const Vector3< real_t > & /*velocity*/ = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & /*velocity*/ = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { return LatticeModel_T::w[ Stencil::idx[direction] ] * rho; } static real_t getAsymmetricPart( const stencil::Direction direction, - const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { - return LatticeModel_T::w[ Stencil::idx[direction] ] * rho * real_t(3.0) * internal::multiplyVelocityDirection( direction, velocity ); + return LatticeModel_T::w[ Stencil::idx[direction] ] * rho * 3.0_r * internal::multiplyVelocityDirection( direction, velocity ); } - static std::vector< real_t > get( const Vector3< real_t > & velocity = Vector3< real_t >( real_t(0.0) ), const real_t rho = real_t(1.0) ) + static std::vector< real_t > get( const Vector3< real_t > & velocity = Vector3< real_t >( 0.0_r ), const real_t rho = 1.0_r ) { std::vector< real_t > equilibrium( Stencil::Size ); for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) - equilibrium[d.toIdx()] = LatticeModel_T::w[ d.toIdx() ] * rho * ( real_t(1.0) + real_t(3.0) * internal::multiplyVelocityDirection( *d, velocity ) ); + equilibrium[d.toIdx()] = LatticeModel_T::w[ d.toIdx() ] * rho * ( 1.0_r + 3.0_r * internal::multiplyVelocityDirection( *d, velocity ) ); return equilibrium; } diff --git a/src/lbm/lattice_model/ForceModel.h b/src/lbm/lattice_model/ForceModel.h index 33a21bca..8c22e8f0 100644 --- a/src/lbm/lattice_model/ForceModel.h +++ b/src/lbm/lattice_model/ForceModel.h @@ -165,7 +165,7 @@ public: template< typename LatticeModel_T > real_t forceTerm( const cell_idx_t /*x*/, const cell_idx_t /*y*/, const cell_idx_t /*z*/, const Vector3<real_t> & /*velocity*/, const real_t /*rho*/, const DirectionIndependentTerms_T & /*commonTerms*/, const real_t /*w*/, - const real_t /*cx*/, const real_t /*cy*/, const real_t /*cz*/, const real_t /*omega*/, const real_t /*omega_bulk*/ ) const { return real_t(0); } + const real_t /*cx*/, const real_t /*cy*/, const real_t /*cz*/, const real_t /*omega*/, const real_t /*omega_bulk*/ ) const { return 0_r; } bool setConstantBodyForceIfPossible( const Vector3<real_t> &, const uint_t = uint_t(0) ) { return false; } }; @@ -220,7 +220,7 @@ public: const DirectionIndependentTerms_T & /*commonTerms*/, const real_t w, const real_t cx, const real_t cy, const real_t cz, const real_t /*omega*/, const real_t /*omega_bulk*/ ) const { - return real_t(3.0) * w * ( cx * bodyForce_[0] + cy * bodyForce_[1] + cz * bodyForce_[2] ); + return 3.0_r * w * ( cx * bodyForce_[0] + cy * bodyForce_[1] + cz * bodyForce_[2] ); } /// "force_level" is the level that corresponds to "acceleration" @@ -248,12 +248,12 @@ private: template< typename LatticeModel_T, class Enable = void > struct DirectionIndependentTerm { - static real_t get( const real_t ) { return real_t(0); } + static real_t get( const real_t ) { return 0_r; } }; template< typename LatticeModel_T > struct DirectionIndependentTerm< LatticeModel_T, typename boost::enable_if_c< LatticeModel_T::compressible >::type > { - static real_t get( const real_t rho ) { return real_t(1) / rho; } + static real_t get( const real_t rho ) { return 1_r / rho; } }; template< typename LatticeModel_T, class Enable = void > @@ -378,7 +378,7 @@ public: const real_t cx, const real_t cy, const real_t cz, const real_t /*omega*/, const real_t /*omega_bulk*/ ) const { const Vector3<real_t> c( cx, cy, cz ); - return real_t(3) * w * ( ( c - velocity + ( real_t(3) * ( c * velocity ) * c ) ) * bodyForce_ ); + return 3_r * w * ( ( c - velocity + ( 3_r * ( c * velocity ) * c ) ) * bodyForce_ ); } /// "force_level" is the level that corresponds to "bodyForce" @@ -438,7 +438,7 @@ public: const real_t cx, const real_t cy, const real_t cz, const real_t /*omega*/, const real_t /*omega_bulk*/ ) const { const Vector3<real_t> c( cx, cy, cz ); - return real_t(3) * w * ( ( c - velocity + ( real_t(3) * ( c * velocity ) * c ) ) * force(x,y,z) ); + return 3_r * w * ( ( c - velocity + ( 3_r * ( c * velocity ) * c ) ) * force(x,y,z) ); } bool setConstantBodyForceIfPossible( const Vector3< real_t > &, const uint_t = uint_t(0) ) { return false; } @@ -496,13 +496,13 @@ public: { if (!boost::is_same< typename LatticeModel_T::CollisionModel::tag, collision_model::SRT_tag >::value) { - const real_t one_third = real_t(1) / real_t(3); + const real_t one_third = 1_r / 3_r; const auto common = Matrix3<real_t>::makeDiagonalMatrix( velocity * bodyForce_ ); return (tensorProduct( velocity, bodyForce_ ) + tensorProduct( bodyForce_, velocity ) - - common * (real_t(2)*one_third) ) * real_t(0.5) * ( real_t(2) + omega ) - + common * ( one_third * ( real_t(2) + omega_bulk ) ); + common * (2_r*one_third) ) * 0.5_r * ( 2_r + omega ) + + common * ( one_third * ( 2_r + omega_bulk ) ); } else { @@ -518,15 +518,15 @@ public: const Vector3<real_t> c( cx, cy, cz ); if (!boost::is_same< typename LatticeModel_T::CollisionModel::tag, collision_model::SRT_tag >::value) { - const real_t one_third = real_t(1) / real_t(3); + const real_t one_third = 1_r / 3_r; const real_t common = (commonTerms * ( tensorProduct(c,c) - Matrix3<real_t>::makeDiagonalMatrix(one_third) )).trace(); - return real_t(3.0) * w * ( bodyForce_ * c + real_t(1.5) * common); + return 3.0_r * w * ( bodyForce_ * c + 1.5_r * common); } else { - return real_t(3.0) * w * ( real_t(1) - real_t(0.5) * omega ) * - ( ( c - velocity + ( real_t(3) * ( c * velocity ) * c ) ) * bodyForce_ ); + return 3.0_r * w * ( 1_r - 0.5_r * omega ) * + ( ( c - velocity + ( 3_r * ( c * velocity ) * c ) ) * bodyForce_ ); } } @@ -582,13 +582,13 @@ public: { if (!boost::is_same< typename LatticeModel_T::CollisionModel::tag, collision_model::SRT_tag >::value) { - const real_t one_third = real_t(1) / real_t(3); + const real_t one_third = 1_r / 3_r; const auto common = Matrix3<real_t>::makeDiagonalMatrix( velocity * force(x,y,z) ); return (tensorProduct( velocity, force(x,y,z) ) + tensorProduct( force(x,y,z), velocity ) - - common * (real_t(2)*one_third) ) * real_t(0.5) * ( real_t(2) + omega ) - + common * ( one_third * ( real_t(2) + omega_bulk ) ); + common * (2_r*one_third) ) * 0.5_r * ( 2_r + omega ) + + common * ( one_third * ( 2_r + omega_bulk ) ); } else { @@ -605,15 +605,15 @@ public: const Vector3<real_t> c( cx, cy, cz ); if (!boost::is_same< typename LatticeModel_T::CollisionModel::tag, collision_model::SRT_tag >::value) { - const real_t one_third = real_t(1) / real_t(3); + const real_t one_third = 1_r / 3_r; const real_t common = (commonTerms * ( tensorProduct(c,c) - Matrix3<real_t>::makeDiagonalMatrix(one_third) )).trace(); - return real_t(3.0) * w * ( force(x,y,z) * c + real_t(1.5) * common); + return 3.0_r * w * ( force(x,y,z) * c + 1.5_r * common); } else { - return real_t(3.0) * w * ( real_t(1) - real_t(0.5) * omega ) * - ( ( c - velocity + ( real_t(3) * ( c * velocity ) * c ) ) * force(x,y,z) ); + return 3.0_r * w * ( 1_r - 0.5_r * omega ) * + ( ( c - velocity + ( 3_r * ( c * velocity ) * c ) ) * force(x,y,z) ); } } @@ -642,7 +642,7 @@ public: static const bool constant = true; Correction( const BlockDataID & previousRhoVelocityId ) : - force_( real_t(0) ), previousRhoVelocityId_( previousRhoVelocityId ), previousRhoVelocity_(NULL) {} + force_( 0_r ), previousRhoVelocityId_( previousRhoVelocityId ), previousRhoVelocity_(NULL) {} void pack( mpi::SendBuffer & buffer ) const { buffer << force_ << previousRhoVelocityId_; } void unpack( mpi::RecvBuffer & buffer ) { buffer >> force_ >> previousRhoVelocityId_; } diff --git a/src/lbm/lattice_model/SmagorinskyLES.h b/src/lbm/lattice_model/SmagorinskyLES.h index 169439e7..b372187e 100644 --- a/src/lbm/lattice_model/SmagorinskyLES.h +++ b/src/lbm/lattice_model/SmagorinskyLES.h @@ -118,10 +118,10 @@ void SmagorinskyLES< LatticeModel_T, Filter_T >::operator()( IBlock * block, con WALBERLA_ASSERT_EQUAL( level, blocks->getLevel(*block) ); } - const real_t tau = real_t(1) / lbm::collision_model::levelDependentRelaxationParameter( level, + const real_t tau = 1_r / lbm::collision_model::levelDependentRelaxationParameter( level, lbm::collision_model::omegaFromViscosity( kinematicViscosity_ ), uint_t(0) ); - const real_t factor = real_t(18) * std::sqrt( real_t(2) ) * smagorinskyConstant_ * smagorinskyConstant_; + const real_t factor = 18_r * std::sqrt( 2_r ) * smagorinskyConstant_ * smagorinskyConstant_; filter_( *block ); @@ -138,21 +138,21 @@ void SmagorinskyLES< LatticeModel_T, Filter_T >::operator()( IBlock * block, con for( uint_t i = 0; i != Stencil_T::Size; ++i ) nonEquilibrium[i] = pdfField->get(x,y,z,i) - equilibrium[i]; - real_t filteredMeanMomentum = real_t(0); + real_t filteredMeanMomentum = 0_r; for( uint_t alpha = 0; alpha < 3; ++alpha ) { for( uint_t beta = 0; beta < 3; ++beta ) { - real_t qij = real_t(0); + real_t qij = 0_r; for( auto d = Stencil_T::begin(); d != Stencil_T::end(); ++d ) qij += nonEquilibrium[ d.toIdx() ] * real_c(stencil::c[alpha][*d]) * real_c(stencil::c[beta][*d]); filteredMeanMomentum += qij * qij; } } - const real_t tauTurbulent = LatticeModel_T::compressible ? ( real_t(0.5) * ( std::sqrt( tau * tau + (factor / rho) * std::sqrt( real_t(2) * filteredMeanMomentum ) ) - tau ) ) : - ( real_t(0.5) * ( std::sqrt( tau * tau + factor * std::sqrt( real_t(2) * filteredMeanMomentum ) ) - tau ) ); + const real_t tauTurbulent = LatticeModel_T::compressible ? ( 0.5_r * ( std::sqrt( tau * tau + (factor / rho) * std::sqrt( 2_r * filteredMeanMomentum ) ) - tau ) ) : + ( 0.5_r * ( std::sqrt( tau * tau + factor * std::sqrt( 2_r * filteredMeanMomentum ) ) - tau ) ); - omegaField->get(x,y,z) = real_t(1) / ( tau + tauTurbulent ); + omegaField->get(x,y,z) = 1_r / ( tau + tauTurbulent ); } ) } diff --git a/src/lbm/mrt/CellwiseSweep.impl.h b/src/lbm/mrt/CellwiseSweep.impl.h index 4c0726c4..10196830 100644 --- a/src/lbm/mrt/CellwiseSweep.impl.h +++ b/src/lbm/mrt/CellwiseSweep.impl.h @@ -76,18 +76,18 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t s17 = collisionModel.s17(); const real_t s18 = collisionModel.s18(); - const real_t _1_2 = real_t(1) / real_t(2); - const real_t _1_3 = real_t(1) / real_t(3); - const real_t _1_4 = real_t(1) / real_t(4); - const real_t _1_6 = real_t(1) / real_t(6); - const real_t _1_8 = real_t(1) / real_t(8); - const real_t _1_12 = real_t(1) / real_t(12); - const real_t _1_16 = real_t(1) / real_t(16); - const real_t _1_18 = real_t(1) / real_t(18); - const real_t _1_24 = real_t(1) / real_t(24); - const real_t _1_36 = real_t(1) / real_t(36); - const real_t _1_48 = real_t(1) / real_t(48); - const real_t _1_72 = real_t(1) / real_t(72); + const real_t _1_2 = 1_r / 2_r; + const real_t _1_3 = 1_r / 3_r; + const real_t _1_4 = 1_r / 4_r; + const real_t _1_6 = 1_r / 6_r; + const real_t _1_8 = 1_r / 8_r; + const real_t _1_12 = 1_r / 12_r; + const real_t _1_16 = 1_r / 16_r; + const real_t _1_18 = 1_r / 18_r; + const real_t _1_24 = 1_r / 24_r; + const real_t _1_36 = 1_r / 36_r; + const real_t _1_48 = 1_r / 48_r; + const real_t _1_72 = 1_r / 72_r; WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -100,38 +100,38 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() const Vector3<real_t> velocity( velX, velY, velZ ); - this->densityVelocityOut( x, y, z, lm, velocity, rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, velocity, rho + 1_r ); const real_t velSqr = velX * velX + velY * velY + velZ * velZ; - const real_t vel9 = real_t(2) * velX * velX - velY * velY - velZ * velZ; + const real_t vel9 = 2_r * velX * velX - velY * velY - velZ * velZ; const real_t vel11 = velY * velY - velZ * velZ; const real_t vel13 = velX * velY; const real_t vel14 = velY * velZ; const real_t vel15 = velX * velZ; const real_t mStar0 = rho; - const real_t mStar1 = velSqr + ( real_t(1) - s1 ) * ( -vC + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE - velSqr ); - const real_t mStar2 = ( real_t(1) - s2 ) * ( vC - real_t(2) * ( vN + vS + vW + vE + vT + vB ) + const real_t mStar1 = velSqr + ( 1_r - s1 ) * ( -vC + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE - velSqr ); + const real_t mStar2 = ( 1_r - s2 ) * ( vC - 2_r * ( vN + vS + vW + vE + vT + vB ) + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE ); const real_t mStar3 = velX; - const real_t mStar4 = ( real_t(1) - s4 ) * ( real_t(2) * vW - real_t(2) * vE - vNW + vNE - vSW + vSE - vTW + vTE - vBW + vBE ); + const real_t mStar4 = ( 1_r - s4 ) * ( 2_r * vW - 2_r * vE - vNW + vNE - vSW + vSE - vTW + vTE - vBW + vBE ); const real_t mStar5 = velY; - const real_t mStar6 = ( real_t(1) - s6 ) * ( real_t(-2) * vN + real_t(2) * vS + vNW + vNE - vSW - vSE + vTN - vTS + vBN - vBS ); + const real_t mStar6 = ( 1_r - s6 ) * ( -2_r * vN + 2_r * vS + vNW + vNE - vSW - vSE + vTN - vTS + vBN - vBS ); const real_t mStar7 = velZ; - const real_t mStar8 = ( real_t(1) - s8 ) * ( real_t(-2) * vT + real_t(2) * vB + vTN + vTS + vTW + vTE - vBN - vBS - vBW - vBE ); - const real_t mStar9 = vel9 + ( real_t(1) - s9 ) * ( -vN - vS + real_t(2) * vW + real_t(2) * vE - vT - vB + vNW + vNE + vSW + vSE - real_t(2) * vTN - - real_t(2) * vTS + vTW + vTE - real_t(2) * vBN - real_t(2) * vBS + vBW + vBE - vel9 ); - const real_t mStar10 = ( real_t(1) - s10 ) * ( vN + vS - real_t(2) * vW - real_t(2) * vE + vT + vB + vNW + vNE + vSW + vSE - real_t(2) * vTN - - real_t(2) * vTS + vTW + vTE - real_t(2) * vBN - real_t(2) * vBS + vBW + vBE ); - const real_t mStar11 = vel11 + ( real_t(1) - s11 ) * ( vN + vS - vT - vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE - vel11 ); - const real_t mStar12 = ( real_t(1) - s12 ) * ( -vN - vS + vT + vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE ); - const real_t mStar13 = vel13 + ( real_t(1) - s13 ) * ( -vNW + vNE + vSW - vSE - vel13 ); - const real_t mStar14 = vel14 + ( real_t(1) - s14 ) * ( vTN - vTS - vBN + vBS - vel14 ); - const real_t mStar15 = vel15 + ( real_t(1) - s15 ) * ( -vTW + vTE + vBW - vBE - vel15 ); - const real_t mStar16 = ( real_t(1) - s16 ) * ( -vNW + vNE - vSW + vSE + vTW - vTE + vBW - vBE ); - const real_t mStar17 = ( real_t(1) - s17 ) * ( -vNW - vNE + vSW + vSE + vTN - vTS + vBN - vBS ); - const real_t mStar18 = ( real_t(1) - s18 ) * ( -vTN - vTS + vTW + vTE + vBN + vBS - vBW - vBE ); + const real_t mStar8 = ( 1_r - s8 ) * ( -2_r * vT + 2_r * vB + vTN + vTS + vTW + vTE - vBN - vBS - vBW - vBE ); + const real_t mStar9 = vel9 + ( 1_r - s9 ) * ( -vN - vS + 2_r * vW + 2_r * vE - vT - vB + vNW + vNE + vSW + vSE - 2_r * vTN - + 2_r * vTS + vTW + vTE - 2_r * vBN - 2_r * vBS + vBW + vBE - vel9 ); + const real_t mStar10 = ( 1_r - s10 ) * ( vN + vS - 2_r * vW - 2_r * vE + vT + vB + vNW + vNE + vSW + vSE - 2_r * vTN - + 2_r * vTS + vTW + vTE - 2_r * vBN - 2_r * vBS + vBW + vBE ); + const real_t mStar11 = vel11 + ( 1_r - s11 ) * ( vN + vS - vT - vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE - vel11 ); + const real_t mStar12 = ( 1_r - s12 ) * ( -vN - vS + vT + vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE ); + const real_t mStar13 = vel13 + ( 1_r - s13 ) * ( -vNW + vNE + vSW - vSE - vel13 ); + const real_t mStar14 = vel14 + ( 1_r - s14 ) * ( vTN - vTS - vBN + vBS - vel14 ); + const real_t mStar15 = vel15 + ( 1_r - s15 ) * ( -vTW + vTE + vBW - vBE - vel15 ); + const real_t mStar16 = ( 1_r - s16 ) * ( -vNW + vNE - vSW + vSE + vTW - vTE + vBW - vBE ); + const real_t mStar17 = ( 1_r - s17 ) * ( -vNW - vNE + vSW + vSE + vTN - vTS + vBN - vBS ); + const real_t mStar18 = ( 1_r - s18 ) * ( -vTN - vTS + vTW + vTE + vBN + vBS - vBW - vBE ); dst->get( x, y, z, Stencil_T::idx[C] ) = _1_3 * mStar0 - _1_2 * mStar1 + _1_6 * mStar2; dst->get( x, y, z, Stencil_T::idx[N] ) = _1_18 * mStar0 - _1_18 * mStar2 + _1_6 * mStar5 - _1_6 * mStar6 - _1_24 * mStar9 + @@ -185,9 +185,9 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE if (boost::is_same< typename LatticeModel_T::ForceModel::tag, force_model::None_tag >::value == false) { - const auto commonForceTerms = lm.forceModel().template directionIndependentTerms< LatticeModel_T >( x, y, z, velocity, rho + real_t(1.0), collisionModel.omega(), collisionModel.omega_bulk() ); + const auto commonForceTerms = lm.forceModel().template directionIndependentTerms< LatticeModel_T >( x, y, z, velocity, rho + 1.0_r, collisionModel.omega(), collisionModel.omega_bulk() ); for( auto d = Stencil_T::begin(); d != Stencil_T::end(); ++d ) - dst->get( x, y, z, d.toIdx() ) += lm.forceModel().template forceTerm< LatticeModel_T >( x, y, z, velocity, rho + real_t(1.0), commonForceTerms, LatticeModel_T::w[ d.toIdx() ], real_c(d.cx()), real_c(d.cy()), real_c(d.cz()), collisionModel.omega(), collisionModel.omega_bulk() ); + dst->get( x, y, z, d.toIdx() ) += lm.forceModel().template forceTerm< LatticeModel_T >( x, y, z, velocity, rho + 1.0_r, commonForceTerms, LatticeModel_T::w[ d.toIdx() ], real_c(d.cx()), real_c(d.cy()), real_c(d.cz()), collisionModel.omega(), collisionModel.omega_bulk() ); } } @@ -215,18 +215,18 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t s17 = collisionModel.s17(); const real_t s18 = collisionModel.s18(); - const real_t _1_2 = real_t(1) / real_t(2); - const real_t _1_3 = real_t(1) / real_t(3); - const real_t _1_4 = real_t(1) / real_t(4); - const real_t _1_6 = real_t(1) / real_t(6); - const real_t _1_8 = real_t(1) / real_t(8); - const real_t _1_12 = real_t(1) / real_t(12); - const real_t _1_16 = real_t(1) / real_t(16); - const real_t _1_18 = real_t(1) / real_t(18); - const real_t _1_24 = real_t(1) / real_t(24); - const real_t _1_36 = real_t(1) / real_t(36); - const real_t _1_48 = real_t(1) / real_t(48); - const real_t _1_72 = real_t(1) / real_t(72); + const real_t _1_2 = 1_r / 2_r; + const real_t _1_3 = 1_r / 3_r; + const real_t _1_4 = 1_r / 4_r; + const real_t _1_6 = 1_r / 6_r; + const real_t _1_8 = 1_r / 8_r; + const real_t _1_12 = 1_r / 12_r; + const real_t _1_16 = 1_r / 16_r; + const real_t _1_18 = 1_r / 18_r; + const real_t _1_24 = 1_r / 24_r; + const real_t _1_36 = 1_r / 36_r; + const real_t _1_48 = 1_r / 48_r; + const real_t _1_72 = 1_r / 72_r; WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -239,38 +239,38 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() const Vector3<real_t> velocity( velX, velY, velZ ); - this->densityVelocityOut( x, y, z, lm, velocity, rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, velocity, rho + 1_r ); const real_t velSqr = velX * velX + velY * velY + velZ * velZ; - const real_t vel9 = real_t(2) * velX * velX - velY * velY - velZ * velZ; + const real_t vel9 = 2_r * velX * velX - velY * velY - velZ * velZ; const real_t vel11 = velY * velY - velZ * velZ; const real_t vel13 = velX * velY; const real_t vel14 = velY * velZ; const real_t vel15 = velX * velZ; const real_t mStar0 = rho; - const real_t mStar1 = velSqr + ( real_t(1) - s1 ) * ( -vC + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE - velSqr ); - const real_t mStar2 = ( real_t(1) - s2 ) * ( vC - real_t(2) * ( vN + vS + vW + vE + vT + vB ) + const real_t mStar1 = velSqr + ( 1_r - s1 ) * ( -vC + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE - velSqr ); + const real_t mStar2 = ( 1_r - s2 ) * ( vC - 2_r * ( vN + vS + vW + vE + vT + vB ) + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE ); const real_t mStar3 = velX; - const real_t mStar4 = ( real_t(1) - s4 ) * ( real_t(2) * vW - real_t(2) * vE - vNW + vNE - vSW + vSE - vTW + vTE - vBW + vBE ); + const real_t mStar4 = ( 1_r - s4 ) * ( 2_r * vW - 2_r * vE - vNW + vNE - vSW + vSE - vTW + vTE - vBW + vBE ); const real_t mStar5 = velY; - const real_t mStar6 = ( real_t(1) - s6 ) * ( real_t(-2) * vN + real_t(2) * vS + vNW + vNE - vSW - vSE + vTN - vTS + vBN - vBS ); + const real_t mStar6 = ( 1_r - s6 ) * ( -2_r * vN + 2_r * vS + vNW + vNE - vSW - vSE + vTN - vTS + vBN - vBS ); const real_t mStar7 = velZ; - const real_t mStar8 = ( real_t(1) - s8 ) * ( real_t(-2) * vT + real_t(2) * vB + vTN + vTS + vTW + vTE - vBN - vBS - vBW - vBE ); - const real_t mStar9 = vel9 + ( real_t(1) - s9 ) * ( -vN - vS + real_t(2) * vW + real_t(2) * vE - vT - vB + vNW + vNE + vSW + vSE - real_t(2) * vTN - - real_t(2) * vTS + vTW + vTE - real_t(2) * vBN - real_t(2) * vBS + vBW + vBE - vel9 ); - const real_t mStar10 = ( real_t(1) - s10 ) * ( vN + vS - real_t(2) * vW - real_t(2) * vE + vT + vB + vNW + vNE + vSW + vSE - real_t(2) * vTN - - real_t(2) * vTS + vTW + vTE - real_t(2) * vBN - real_t(2) * vBS + vBW + vBE ); - const real_t mStar11 = vel11 + ( real_t(1) - s11 ) * ( vN + vS - vT - vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE - vel11 ); - const real_t mStar12 = ( real_t(1) - s12 ) * ( -vN - vS + vT + vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE ); - const real_t mStar13 = vel13 + ( real_t(1) - s13 ) * ( -vNW + vNE + vSW - vSE - vel13 ); - const real_t mStar14 = vel14 + ( real_t(1) - s14 ) * ( vTN - vTS - vBN + vBS - vel14 ); - const real_t mStar15 = vel15 + ( real_t(1) - s15 ) * ( -vTW + vTE + vBW - vBE - vel15 ); - const real_t mStar16 = ( real_t(1) - s16 ) * ( -vNW + vNE - vSW + vSE + vTW - vTE + vBW - vBE ); - const real_t mStar17 = ( real_t(1) - s17 ) * ( -vNW - vNE + vSW + vSE + vTN - vTS + vBN - vBS ); - const real_t mStar18 = ( real_t(1) - s18 ) * ( -vTN - vTS + vTW + vTE + vBN + vBS - vBW - vBE ); + const real_t mStar8 = ( 1_r - s8 ) * ( -2_r * vT + 2_r * vB + vTN + vTS + vTW + vTE - vBN - vBS - vBW - vBE ); + const real_t mStar9 = vel9 + ( 1_r - s9 ) * ( -vN - vS + 2_r * vW + 2_r * vE - vT - vB + vNW + vNE + vSW + vSE - 2_r * vTN - + 2_r * vTS + vTW + vTE - 2_r * vBN - 2_r * vBS + vBW + vBE - vel9 ); + const real_t mStar10 = ( 1_r - s10 ) * ( vN + vS - 2_r * vW - 2_r * vE + vT + vB + vNW + vNE + vSW + vSE - 2_r * vTN - + 2_r * vTS + vTW + vTE - 2_r * vBN - 2_r * vBS + vBW + vBE ); + const real_t mStar11 = vel11 + ( 1_r - s11 ) * ( vN + vS - vT - vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE - vel11 ); + const real_t mStar12 = ( 1_r - s12 ) * ( -vN - vS + vT + vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE ); + const real_t mStar13 = vel13 + ( 1_r - s13 ) * ( -vNW + vNE + vSW - vSE - vel13 ); + const real_t mStar14 = vel14 + ( 1_r - s14 ) * ( vTN - vTS - vBN + vBS - vel14 ); + const real_t mStar15 = vel15 + ( 1_r - s15 ) * ( -vTW + vTE + vBW - vBE - vel15 ); + const real_t mStar16 = ( 1_r - s16 ) * ( -vNW + vNE - vSW + vSE + vTW - vTE + vBW - vBE ); + const real_t mStar17 = ( 1_r - s17 ) * ( -vNW - vNE + vSW + vSE + vTN - vTS + vBN - vBS ); + const real_t mStar18 = ( 1_r - s18 ) * ( -vTN - vTS + vTW + vTE + vBN + vBS - vBW - vBE ); src->get( x, y, z, Stencil_T::idx[C] ) = _1_3 * mStar0 - _1_2 * mStar1 + _1_6 * mStar2; src->get( x, y, z, Stencil_T::idx[N] ) = _1_18 * mStar0 - _1_18 * mStar2 + _1_6 * mStar5 - _1_6 * mStar6 - _1_24 * mStar9 + @@ -324,9 +324,9 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA if (boost::is_same< typename LatticeModel_T::ForceModel::tag, force_model::None_tag >::value == false) { - const auto commonForceTerms = lm.forceModel().template directionIndependentTerms< LatticeModel_T >( x, y, z, velocity, rho + real_t(1.0), collisionModel.omega(), collisionModel.omega_bulk() ); + const auto commonForceTerms = lm.forceModel().template directionIndependentTerms< LatticeModel_T >( x, y, z, velocity, rho + 1.0_r, collisionModel.omega(), collisionModel.omega_bulk() ); for( auto d = Stencil_T::begin(); d != Stencil_T::end(); ++d ) - src->get( x, y, z, d.toIdx() ) += lm.forceModel().template forceTerm< LatticeModel_T >( x, y, z, velocity, rho + real_t(1.0), commonForceTerms, LatticeModel_T::w[ d.toIdx() ], real_c(d.cx()), real_c(d.cy()), real_c(d.cz()), collisionModel.omega(), collisionModel.omega_bulk() ); + src->get( x, y, z, d.toIdx() ) += lm.forceModel().template forceTerm< LatticeModel_T >( x, y, z, velocity, rho + 1.0_r, commonForceTerms, LatticeModel_T::w[ d.toIdx() ], real_c(d.cx()), real_c(d.cy()), real_c(d.cz()), collisionModel.omega(), collisionModel.omega_bulk() ); } } diff --git a/src/lbm/python/ExportBasic.cpp b/src/lbm/python/ExportBasic.cpp index b8af2324..ef4d4fe2 100644 --- a/src/lbm/python/ExportBasic.cpp +++ b/src/lbm/python/ExportBasic.cpp @@ -226,7 +226,7 @@ void exportCollisionModels() real_t ( D3Q27Cumulant::*ptr_viscosity )() const = &D3Q27Cumulant::viscosity; class_< D3Q27Cumulant >( "D3Q27Cumulant", init<real_t, real_t, real_t, real_t, real_t, real_t, real_t, real_t, real_t,real_t, uint_t>( - ( arg("omega1"), arg("omega2")=real_t(1), arg("omega3")=real_t(1), arg("omega4")=real_t(1), arg("omega5")=real_t(1), arg("omega6")=real_t(1), arg("omega7")=real_t(1), arg("omega8")=real_t(1), arg("omega9")=real_t(1), arg("omega10")=real_t(1), arg("level")=uint_t(0) ) )) + ( arg("omega1"), arg("omega2")=1_r, arg("omega3")=1_r, arg("omega4")=1_r, arg("omega5")=1_r, arg("omega6")=1_r, arg("omega7")=1_r, arg("omega8")=1_r, arg("omega9")=1_r, arg("omega10")=1_r, arg("level")=uint_t(0) ) )) .add_property( "relaxationRates", getCumulantRelaxationRates ) .add_property( "viscosity", ptr_viscosity ) ; diff --git a/src/lbm/python/ExportBasic.impl.h b/src/lbm/python/ExportBasic.impl.h index c0097f54..7f830304 100644 --- a/src/lbm/python/ExportBasic.impl.h +++ b/src/lbm/python/ExportBasic.impl.h @@ -494,7 +494,7 @@ void exportBasic() ( arg("name") ), ( arg("latticeModel") ), ( arg("initialVelocity") = Vector3<real_t>() ), - ( arg("initialDensity") = real_t(1) ), + ( arg("initialDensity") = 1_r ), ( arg("ghostlayers") = uint_t(1) ), ( arg("layout") = field::zyxf ), ( arg("densityAdaptor") = std::string() ), diff --git a/src/lbm/refinement/LinearExplosion.h b/src/lbm/refinement/LinearExplosion.h index 97bc1c59..68b6967a 100644 --- a/src/lbm/refinement/LinearExplosion.h +++ b/src/lbm/refinement/LinearExplosion.h @@ -348,7 +348,7 @@ void fillTemporaryCoarseField( const cell_idx_t y, const cell_idx_t z, const Cel value += pdfField->get( fx + cell_idx_t(1), fy + cell_idx_t(1), fz , f ); value += pdfField->get( fx + cell_idx_t(1), fy + cell_idx_t(1), fz + cell_idx_t(1), f ); - tmpField->get(x,y,z,f) = real_t(0.125) * value; + tmpField->get(x,y,z,f) = 0.125_r * value; */ } } @@ -406,7 +406,7 @@ void linearInterpolation( const cell_idx_t y, const cell_idx_t z, const CellInte const auto v = tmpField->get( cell, f ); - Vector3< real_t > grad( real_t(0) ); + Vector3< real_t > grad( 0_r ); for( uint_t i = 0; i < PdfField_T::Stencil::D; ++i ) { @@ -419,7 +419,7 @@ void linearInterpolation( const cell_idx_t y, const cell_idx_t z, const CellInte WALBERLA_ASSERT( !math::isnan( tmpField->get( max[i], f ) ) ); WALBERLA_ASSERT( !math::isnan( tmpField->get( min[i], f ) ) ); - grad[i] = real_t(0.5) * ( tmpField->get( max[i], f ) - tmpField->get( min[i], f ) ); + grad[i] = 0.5_r * ( tmpField->get( max[i], f ) - tmpField->get( min[i], f ) ); } #else @@ -429,7 +429,7 @@ void linearInterpolation( const cell_idx_t y, const cell_idx_t z, const CellInte if( boolField->get( min[i] ) ) { WALBERLA_ASSERT( !math::isnan( tmpField->get( min[i], f ) ) ); - grad[i] = real_t(0.5) * ( tmpField->get( max[i], f ) - tmpField->get( min[i], f ) ); + grad[i] = 0.5_r * ( tmpField->get( max[i], f ) - tmpField->get( min[i], f ) ); } else { diff --git a/src/lbm/srt/CellwiseSweep.impl.h b/src/lbm/srt/CellwiseSweep.impl.h index 01f0c265..113ca09b 100644 --- a/src/lbm/srt/CellwiseSweep.impl.h +++ b/src/lbm/srt/CellwiseSweep.impl.h @@ -66,11 +66,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(4) / real_t( 9) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t( 9) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 4_r / real_t( 9) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / real_t( 9) ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -82,17 +82,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D2Q9_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, real_t(0) ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, 0_r ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY ); dst->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; dst->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1 * ( vel_trm_E_W + velX ); dst->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1 * ( vel_trm_E_W - velX ); @@ -100,13 +100,13 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE dst->get(x,y,z,Stencil_T::idx[S]) = omega_trm * vS + omega_w1 * ( vel_trm_N_S - velY ); const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ); dst->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ); dst->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ); @@ -120,11 +120,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(4) / real_t( 9) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t( 9) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 4_r / real_t( 9) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / real_t( 9) ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -136,17 +136,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D2Q9_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, real_t(0) ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, 0_r ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY ); src->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; src->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1 * ( vel_trm_E_W + velX ); src->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1 * ( vel_trm_E_W - velX ); @@ -154,13 +154,13 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA src->get(x,y,z,Stencil_T::idx[S]) = omega_trm * vS + omega_w1 * ( vel_trm_N_S - velY ); const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; src->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ); src->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; src->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ); src->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ); @@ -198,11 +198,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -214,19 +214,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; dst->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1 * ( vel_trm_E_W + velX ); dst->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1 * ( vel_trm_E_W - velX ); @@ -236,37 +236,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE dst->get(x,y,z,Stencil_T::idx[B]) = omega_trm * vB + omega_w1 * ( vel_trm_T_B - velZ ); const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ); dst->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ); dst->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2 * ( vel_trm_TW_BE - velXmZ ); dst->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2 * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2 * ( vel_trm_TE_BW + velXpZ ); dst->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2 * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2 * ( vel_trm_TS_BN - velYmZ ); dst->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2 * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2 * ( vel_trm_TN_BS + velYpZ ); dst->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2 * ( vel_trm_TN_BS - velYpZ ); @@ -280,11 +280,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -296,19 +296,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY + velZZ ); src->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; src->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1 * ( vel_trm_E_W + velX ); src->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1 * ( vel_trm_E_W - velX ); @@ -318,37 +318,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA src->get(x,y,z,Stencil_T::idx[B]) = omega_trm * vB + omega_w1 * ( vel_trm_T_B - velZ ); const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; src->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ); src->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; src->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ); src->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; src->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2 * ( vel_trm_TW_BE - velXmZ ); src->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2 * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; src->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2 * ( vel_trm_TE_BW + velXpZ ); src->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2 * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; src->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2 * ( vel_trm_TS_BN - velYmZ ); src->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2 * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; src->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2 * ( vel_trm_TN_BS + velYpZ ); src->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2 * ( vel_trm_TN_BS - velYpZ ); @@ -382,11 +382,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -404,15 +404,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * rho * dir_indep_trm; const real_t omega_w1_rho = omega_w1 * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; dst->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1_rho * ( vel_trm_E_W + velX ); dst->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1_rho * ( vel_trm_E_W - velX ); @@ -424,37 +424,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t omega_w2_rho = omega_w2 * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ); dst->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ); dst->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ); dst->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ); dst->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ); dst->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ); dst->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ); @@ -468,11 +468,11 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -490,15 +490,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third - 0.5_r * ( velXX + velYY + velZZ ); src->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * rho * dir_indep_trm; const real_t omega_w1_rho = omega_w1 * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; src->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1_rho * ( vel_trm_E_W + velX ); src->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1_rho * ( vel_trm_E_W - velX ); @@ -510,37 +510,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t omega_w2_rho = omega_w2 * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; src->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ); src->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; src->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ); src->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; src->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ); src->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; src->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ); src->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; src->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ); src->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; src->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ); src->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ); @@ -574,14 +574,14 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); - const real_t three_w1( real_t(1) / real_t(6) ); - const real_t three_w2( real_t(1) / real_t(12) ); + const real_t three_w1( 1_r / 6_r ); + const real_t three_w2( 1_r / 12_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -593,19 +593,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; // no force term - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); @@ -617,37 +617,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE dst->get(x,y,z,Stencil_T::idx[B]) = omega_trm * vB + omega_w1 * ( vel_trm_T_B - velZ ) - three_w1 * force[2]; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ) + three_w2 * ( force[1] - force[0] ); dst->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ) + three_w2 * ( force[0] - force[1] ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ) + three_w2 * ( force[0] + force[1] ); dst->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ) + three_w2 * ( -force[0] - force[1] ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2 * ( vel_trm_TW_BE - velXmZ ) + three_w2 * ( force[2] - force[0] ); dst->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2 * ( vel_trm_TW_BE + velXmZ ) + three_w2 * ( force[0] - force[2] ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2 * ( vel_trm_TE_BW + velXpZ ) + three_w2 * ( force[0] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2 * ( vel_trm_TE_BW - velXpZ ) + three_w2 * ( -force[0] - force[2] ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2 * ( vel_trm_TS_BN - velYmZ ) + three_w2 * ( force[2] - force[1] ); dst->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2 * ( vel_trm_TS_BN + velYmZ ) + three_w2 * ( force[1] - force[2] ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2 * ( vel_trm_TN_BS + velYpZ ) + three_w2 * ( force[1] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2 * ( vel_trm_TN_BS - velYpZ ) + three_w2 * ( -force[1] - force[2] ); @@ -661,14 +661,14 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); - const real_t three_w1( real_t(1) / real_t(6) ); - const real_t three_w2( real_t(1) / real_t(12) ); + const real_t three_w1( 1_r / 6_r ); + const real_t three_w2( 1_r / 12_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -680,19 +680,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY + velZZ ); src->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; // no force term - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); @@ -704,37 +704,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA src->get(x,y,z,Stencil_T::idx[B]) = omega_trm * vB + omega_w1 * ( vel_trm_T_B - velZ ) - three_w1 * force[2]; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; src->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ) + three_w2 * ( force[1] - force[0] ); src->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ) + three_w2 * ( force[0] - force[1] ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; src->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ) + three_w2 * ( force[0] + force[1] ); src->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ) + three_w2 * ( -force[0] - force[1] ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; src->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2 * ( vel_trm_TW_BE - velXmZ ) + three_w2 * ( force[2] - force[0] ); src->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2 * ( vel_trm_TW_BE + velXmZ ) + three_w2 * ( force[0] - force[2] ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; src->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2 * ( vel_trm_TE_BW + velXpZ ) + three_w2 * ( force[0] + force[2] ); src->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2 * ( vel_trm_TE_BW - velXpZ ) + three_w2 * ( -force[0] - force[2] ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; src->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2 * ( vel_trm_TS_BN - velYmZ ) + three_w2 * ( force[2] - force[1] ); src->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2 * ( vel_trm_TS_BN + velYmZ ) + three_w2 * ( force[1] - force[2] ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; src->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2 * ( vel_trm_TN_BS + velYpZ ) + three_w2 * ( force[1] + force[2] ); src->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2 * ( vel_trm_TN_BS - velYpZ ) + three_w2 * ( -force[1] - force[2] ); @@ -768,14 +768,14 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); - const real_t three_w1( real_t(1) / real_t(6) ); - const real_t three_w2( real_t(1) / real_t(12) ); + const real_t three_w1( 1_r / 6_r ); + const real_t three_w2( 1_r / 12_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -793,15 +793,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * rho * dir_indep_trm; // no force term const real_t omega_w1_rho = omega_w1 * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); @@ -815,37 +815,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t omega_w2_rho = omega_w2 * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ) + three_w2 * ( force[1] - force[0] ); dst->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ) + three_w2 * ( force[0] - force[1] ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ) + three_w2 * ( force[0] + force[1] ); dst->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ) + three_w2 * ( -force[0] - force[1] ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ) + three_w2 * ( force[2] - force[0] ); dst->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ) + three_w2 * ( force[0] - force[2] ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ) + three_w2 * ( force[0] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ) + three_w2 * ( -force[0] - force[2] ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ) + three_w2 * ( force[2] - force[1] ); dst->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ) + three_w2 * ( force[1] - force[2] ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ) + three_w2 * ( force[1] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ) + three_w2 * ( -force[1] - force[2] ); @@ -859,14 +859,14 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); - const real_t three_w1( real_t(1) / real_t(6) ); - const real_t three_w2( real_t(1) / real_t(12) ); + const real_t three_w1( 1_r / 6_r ); + const real_t three_w2( 1_r / 12_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -884,15 +884,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third - 0.5_r * ( velXX + velYY + velZZ ); src->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * rho * dir_indep_trm; // no force term const real_t omega_w1_rho = omega_w1 * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); @@ -906,37 +906,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t omega_w2_rho = omega_w2 * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; src->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ) + three_w2 * ( force[1] - force[0] ); src->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ) + three_w2 * ( force[0] - force[1] ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; src->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ) + three_w2 * ( force[0] + force[1] ); src->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ) + three_w2 * ( -force[0] - force[1] ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; src->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ) + three_w2 * ( force[2] - force[0] ); src->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ) + three_w2 * ( force[0] - force[2] ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; src->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ) + three_w2 * ( force[0] + force[2] ); src->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ) + three_w2 * ( -force[0] - force[2] ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; src->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ) + three_w2 * ( force[2] - force[1] ); src->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ) + three_w2 * ( force[1] - force[2] ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; src->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ) + three_w2 * ( force[1] + force[2] ); src->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ) + three_w2 * ( -force[1] - force[2] ); @@ -974,12 +974,12 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(8.0) / real_t(27.0) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(2.0) / real_t(27.0) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1.0) / real_t(54.0) ) * omega ); - const real_t omega_w3( real_t(3) * ( real_t(1.0) / real_t(216.0) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 8.0_r / 27.0_r ) * omega ); + const real_t omega_w1( 3_r * ( 2.0_r / 27.0_r ) * omega ); + const real_t omega_w2( 3_r * ( 1.0_r / 54.0_r ) * omega ); + const real_t omega_w3( 3_r * ( 1.0_r / 216.0_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -991,19 +991,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D3Q27_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; dst->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1 * ( vel_trm_E_W + velX ); dst->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1 * ( vel_trm_E_W - velX ); @@ -1013,61 +1013,61 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE dst->get(x,y,z,Stencil_T::idx[B]) = omega_trm * vB + omega_w1 * ( vel_trm_T_B - velZ ); const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ); dst->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ); dst->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2 * ( vel_trm_TW_BE - velXmZ ); dst->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2 * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2 * ( vel_trm_TE_BW + velXpZ ); dst->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2 * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2 * ( vel_trm_TS_BN - velYmZ ); dst->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2 * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2 * ( vel_trm_TN_BS + velYpZ ); dst->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2 * ( vel_trm_TN_BS - velYpZ ); const real_t vel_TNE_BSW = velX + velY + velZ; - const real_t vel_trm_TNE_BSW = dir_indep_trm + real_t(1.5) * vel_TNE_BSW * vel_TNE_BSW; + const real_t vel_trm_TNE_BSW = dir_indep_trm + 1.5_r * vel_TNE_BSW * vel_TNE_BSW; dst->get(x,y,z,Stencil_T::idx[TNE]) = omega_trm * vTNE + omega_w3 * ( vel_trm_TNE_BSW + vel_TNE_BSW ); dst->get(x,y,z,Stencil_T::idx[BSW]) = omega_trm * vBSW + omega_w3 * ( vel_trm_TNE_BSW - vel_TNE_BSW ); const real_t vel_TNW_BSE = -velX + velY + velZ; - const real_t vel_trm_TNW_BSE = dir_indep_trm + real_t(1.5) * vel_TNW_BSE * vel_TNW_BSE; + const real_t vel_trm_TNW_BSE = dir_indep_trm + 1.5_r * vel_TNW_BSE * vel_TNW_BSE; dst->get(x,y,z,Stencil_T::idx[TNW]) = omega_trm * vTNW + omega_w3 * ( vel_trm_TNW_BSE + vel_TNW_BSE ); dst->get(x,y,z,Stencil_T::idx[BSE]) = omega_trm * vBSE + omega_w3 * ( vel_trm_TNW_BSE - vel_TNW_BSE ); const real_t vel_TSE_BNW = velX - velY + velZ; - const real_t vel_trm_TSE_BNW = dir_indep_trm + real_t(1.5) * vel_TSE_BNW * vel_TSE_BNW; + const real_t vel_trm_TSE_BNW = dir_indep_trm + 1.5_r * vel_TSE_BNW * vel_TSE_BNW; dst->get( x, y, z, Stencil_T::idx[TSE] ) = omega_trm * vTSE + omega_w3 * ( vel_trm_TSE_BNW + vel_TSE_BNW ); dst->get( x, y, z, Stencil_T::idx[BNW] ) = omega_trm * vBNW + omega_w3 * ( vel_trm_TSE_BNW - vel_TSE_BNW ); const real_t vel_TSW_BNE = - velX - velY + velZ; - const real_t vel_trm_TSW_BNE = dir_indep_trm + real_t(1.5) * vel_TSW_BNE * vel_TSW_BNE; + const real_t vel_trm_TSW_BNE = dir_indep_trm + 1.5_r * vel_TSW_BNE * vel_TSW_BNE; dst->get( x, y, z, Stencil_T::idx[TSW] ) = omega_trm * vTSW + omega_w3 * ( vel_trm_TSW_BNE + vel_TSW_BNE ); dst->get( x, y, z, Stencil_T::idx[BNE] ) = omega_trm * vBNE + omega_w3 * ( vel_trm_TSW_BNE - vel_TSW_BNE ); @@ -1082,12 +1082,12 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(8.0) / real_t(27.0) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(2.0) / real_t(27.0) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1.0) / real_t(54.0) ) * omega ); - const real_t omega_w3( real_t(3) * ( real_t(1.0) / real_t(216.0) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 8.0_r / 27.0_r ) * omega ); + const real_t omega_w1( 3_r * ( 2.0_r / 27.0_r ) * omega ); + const real_t omega_w2( 3_r * ( 1.0_r / 54.0_r ) * omega ); + const real_t omega_w3( 3_r * ( 1.0_r / 216.0_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1099,19 +1099,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D3Q27_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY + velZZ ); src->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; src->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1 * ( vel_trm_E_W + velX ); src->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1 * ( vel_trm_E_W - velX ); @@ -1121,61 +1121,61 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA src->get(x,y,z,Stencil_T::idx[B]) = omega_trm * vB + omega_w1 * ( vel_trm_T_B - velZ ); const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; src->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ); src->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; src->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ); src->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; src->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2 * ( vel_trm_TW_BE - velXmZ ); src->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2 * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; src->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2 * ( vel_trm_TE_BW + velXpZ ); src->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2 * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; src->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2 * ( vel_trm_TS_BN - velYmZ ); src->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2 * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; src->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2 * ( vel_trm_TN_BS + velYpZ ); src->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2 * ( vel_trm_TN_BS - velYpZ ); const real_t vel_TNE_BSW = velX + velY + velZ; - const real_t vel_trm_TNE_BSW = dir_indep_trm + real_t(1.5) * vel_TNE_BSW * vel_TNE_BSW; + const real_t vel_trm_TNE_BSW = dir_indep_trm + 1.5_r * vel_TNE_BSW * vel_TNE_BSW; src->get(x,y,z,Stencil_T::idx[TNE]) = omega_trm * vTNE + omega_w3 * ( vel_trm_TNE_BSW + vel_TNE_BSW ); src->get(x,y,z,Stencil_T::idx[BSW]) = omega_trm * vBSW + omega_w3 * ( vel_trm_TNE_BSW - vel_TNE_BSW ); const real_t vel_TNW_BSE = -velX + velY + velZ; - const real_t vel_trm_TNW_BSE = dir_indep_trm + real_t(1.5) * vel_TNW_BSE * vel_TNW_BSE; + const real_t vel_trm_TNW_BSE = dir_indep_trm + 1.5_r * vel_TNW_BSE * vel_TNW_BSE; src->get(x,y,z,Stencil_T::idx[TNW]) = omega_trm * vTNW + omega_w3 * ( vel_trm_TNW_BSE + vel_TNW_BSE ); src->get(x,y,z,Stencil_T::idx[BSE]) = omega_trm * vBSE + omega_w3 * ( vel_trm_TNW_BSE - vel_TNW_BSE ); const real_t vel_TSE_BNW = velX - velY + velZ; - const real_t vel_trm_TSE_BNW = dir_indep_trm + real_t(1.5) * vel_TSE_BNW * vel_TSE_BNW; + const real_t vel_trm_TSE_BNW = dir_indep_trm + 1.5_r * vel_TSE_BNW * vel_TSE_BNW; src->get( x, y, z, Stencil_T::idx[TSE] ) = omega_trm * vTSE + omega_w3 * ( vel_trm_TSE_BNW + vel_TSE_BNW ); src->get( x, y, z, Stencil_T::idx[BNW] ) = omega_trm * vBNW + omega_w3 * ( vel_trm_TSE_BNW - vel_TSE_BNW ); const real_t vel_TSW_BNE = - velX - velY + velZ; - const real_t vel_trm_TSW_BNE = dir_indep_trm + real_t(1.5) * vel_TSW_BNE * vel_TSW_BNE; + const real_t vel_trm_TSW_BNE = dir_indep_trm + 1.5_r * vel_TSW_BNE * vel_TSW_BNE; src->get( x, y, z, Stencil_T::idx[TSW] ) = omega_trm * vTSW + omega_w3 * ( vel_trm_TSW_BNE + vel_TSW_BNE ); src->get( x, y, z, Stencil_T::idx[BNE] ) = omega_trm * vBNE + omega_w3 * ( vel_trm_TSW_BNE - vel_TSW_BNE ); @@ -1209,12 +1209,12 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(8.0) / real_t(27.0) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(2.0) / real_t(27.0) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1.0) / real_t(54.0) ) * omega ); - const real_t omega_w3( real_t(3) * ( real_t(1.0) / real_t(216.0) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 8.0_r / 27.0_r ) * omega ); + const real_t omega_w1( 3_r * ( 2.0_r / 27.0_r ) * omega ); + const real_t omega_w2( 3_r * ( 1.0_r / 54.0_r ) * omega ); + const real_t omega_w3( 3_r * ( 1.0_r / 216.0_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1232,15 +1232,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * rho * dir_indep_trm; const real_t omega_w1_rho = omega_w1 * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; dst->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1_rho * ( vel_trm_E_W + velX ); dst->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1_rho * ( vel_trm_E_W - velX ); @@ -1252,37 +1252,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t omega_w2_rho = omega_w2 * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ); dst->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ); dst->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ); dst->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ); dst->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ); dst->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ); dst->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ); @@ -1290,25 +1290,25 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t omega_w3_rho = omega_w3 * rho; const real_t vel_TNE_BSW = velX + velY + velZ; - const real_t vel_trm_TNE_BSW = dir_indep_trm + real_t(1.5) * vel_TNE_BSW * vel_TNE_BSW; + const real_t vel_trm_TNE_BSW = dir_indep_trm + 1.5_r * vel_TNE_BSW * vel_TNE_BSW; dst->get(x,y,z,Stencil_T::idx[TNE]) = omega_trm * vTNE + omega_w3_rho * ( vel_trm_TNE_BSW + vel_TNE_BSW ); dst->get(x,y,z,Stencil_T::idx[BSW]) = omega_trm * vBSW + omega_w3_rho * ( vel_trm_TNE_BSW - vel_TNE_BSW ); const real_t vel_TNW_BSE = -velX + velY + velZ; - const real_t vel_trm_TNW_BSE = dir_indep_trm + real_t(1.5) * vel_TNW_BSE * vel_TNW_BSE; + const real_t vel_trm_TNW_BSE = dir_indep_trm + 1.5_r * vel_TNW_BSE * vel_TNW_BSE; dst->get(x,y,z,Stencil_T::idx[TNW]) = omega_trm * vTNW + omega_w3_rho * ( vel_trm_TNW_BSE + vel_TNW_BSE ); dst->get(x,y,z,Stencil_T::idx[BSE]) = omega_trm * vBSE + omega_w3_rho * ( vel_trm_TNW_BSE - vel_TNW_BSE ); const real_t vel_TSE_BNW = velX - velY + velZ; - const real_t vel_trm_TSE_BNW = dir_indep_trm + real_t(1.5) * vel_TSE_BNW * vel_TSE_BNW; + const real_t vel_trm_TSE_BNW = dir_indep_trm + 1.5_r * vel_TSE_BNW * vel_TSE_BNW; dst->get( x, y, z, Stencil_T::idx[TSE] ) = omega_trm * vTSE + omega_w3_rho * ( vel_trm_TSE_BNW + vel_TSE_BNW ); dst->get( x, y, z, Stencil_T::idx[BNW] ) = omega_trm * vBNW + omega_w3_rho * ( vel_trm_TSE_BNW - vel_TSE_BNW ); const real_t vel_TSW_BNE = - velX - velY + velZ; - const real_t vel_trm_TSW_BNE = dir_indep_trm + real_t(1.5) * vel_TSW_BNE * vel_TSW_BNE; + const real_t vel_trm_TSW_BNE = dir_indep_trm + 1.5_r * vel_TSW_BNE * vel_TSW_BNE; dst->get( x, y, z, Stencil_T::idx[TSW] ) = omega_trm * vTSW + omega_w3_rho * ( vel_trm_TSW_BNE + vel_TSW_BNE ); dst->get( x, y, z, Stencil_T::idx[BNE] ) = omega_trm * vBNE + omega_w3_rho * ( vel_trm_TSW_BNE - vel_TSW_BNE ); @@ -1322,12 +1322,12 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(8.0) / real_t(27.0) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(2.0) / real_t(27.0) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1.0) / real_t(54.0) ) * omega ); - const real_t omega_w3( real_t(3) * ( real_t(1.0) / real_t(216.0) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 8.0_r / 27.0_r ) * omega ); + const real_t omega_w1( 3_r * ( 2.0_r / 27.0_r ) * omega ); + const real_t omega_w2( 3_r * ( 1.0_r / 54.0_r ) * omega ); + const real_t omega_w3( 3_r * ( 1.0_r / 216.0_r ) * omega ); + const real_t one_third( 1_r / 3_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1345,15 +1345,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third - 0.5_r * ( velXX + velYY + velZZ ); src->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * rho * dir_indep_trm; const real_t omega_w1_rho = omega_w1 * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; src->get(x,y,z,Stencil_T::idx[E]) = omega_trm * vE + omega_w1_rho * ( vel_trm_E_W + velX ); src->get(x,y,z,Stencil_T::idx[W]) = omega_trm * vW + omega_w1_rho * ( vel_trm_E_W - velX ); @@ -1365,37 +1365,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t omega_w2_rho = omega_w2 * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; src->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ); src->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; src->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ); src->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; src->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ); src->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; src->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ); src->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; src->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ); src->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; src->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ); src->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ); @@ -1403,25 +1403,25 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t omega_w3_rho = omega_w3 * rho; const real_t vel_TNE_BSW = velX + velY + velZ; - const real_t vel_trm_TNE_BSW = dir_indep_trm + real_t(1.5) * vel_TNE_BSW * vel_TNE_BSW; + const real_t vel_trm_TNE_BSW = dir_indep_trm + 1.5_r * vel_TNE_BSW * vel_TNE_BSW; src->get(x,y,z,Stencil_T::idx[TNE]) = omega_trm * vTNE + omega_w3_rho * ( vel_trm_TNE_BSW + vel_TNE_BSW ); src->get(x,y,z,Stencil_T::idx[BSW]) = omega_trm * vBSW + omega_w3_rho * ( vel_trm_TNE_BSW - vel_TNE_BSW ); const real_t vel_TNW_BSE = -velX + velY + velZ; - const real_t vel_trm_TNW_BSE = dir_indep_trm + real_t(1.5) * vel_TNW_BSE * vel_TNW_BSE; + const real_t vel_trm_TNW_BSE = dir_indep_trm + 1.5_r * vel_TNW_BSE * vel_TNW_BSE; src->get(x,y,z,Stencil_T::idx[TNW]) = omega_trm * vTNW + omega_w3_rho * ( vel_trm_TNW_BSE + vel_TNW_BSE ); src->get(x,y,z,Stencil_T::idx[BSE]) = omega_trm * vBSE + omega_w3_rho * ( vel_trm_TNW_BSE - vel_TNW_BSE ); const real_t vel_TSE_BNW = velX - velY + velZ; - const real_t vel_trm_TSE_BNW = dir_indep_trm + real_t(1.5) * vel_TSE_BNW * vel_TSE_BNW; + const real_t vel_trm_TSE_BNW = dir_indep_trm + 1.5_r * vel_TSE_BNW * vel_TSE_BNW; src->get( x, y, z, Stencil_T::idx[TSE] ) = omega_trm * vTSE + omega_w3_rho * ( vel_trm_TSE_BNW + vel_TSE_BNW ); src->get( x, y, z, Stencil_T::idx[BNW] ) = omega_trm * vBNW + omega_w3_rho * ( vel_trm_TSE_BNW - vel_TSE_BNW ); const real_t vel_TSW_BNE = - velX - velY + velZ; - const real_t vel_trm_TSW_BNE = dir_indep_trm + real_t(1.5) * vel_TSW_BNE * vel_TSW_BNE; + const real_t vel_trm_TSW_BNE = dir_indep_trm + 1.5_r * vel_TSW_BNE * vel_TSW_BNE; src->get( x, y, z, Stencil_T::idx[TSW] ) = omega_trm * vTSW + omega_w3_rho * ( vel_trm_TSW_BNE + vel_TSW_BNE ); src->get( x, y, z, Stencil_T::idx[BNE] ) = omega_trm * vBNE + omega_w3_rho * ( vel_trm_TSW_BNE - vel_TSW_BNE ); @@ -1455,16 +1455,16 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(8.0) / real_t(27.0) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(2.0) / real_t(27.0) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1.0) / real_t(54.0) ) * omega ); - const real_t omega_w3( real_t(3) * ( real_t(1.0) / real_t(216.0) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 8.0_r / 27.0_r ) * omega ); + const real_t omega_w1( 3_r * ( 2.0_r / 27.0_r ) * omega ); + const real_t omega_w2( 3_r * ( 1.0_r / 54.0_r ) * omega ); + const real_t omega_w3( 3_r * ( 1.0_r / 216.0_r ) * omega ); + const real_t one_third( 1_r / 3_r ); - const real_t three_w1( real_t(2) / real_t(9) ); - const real_t three_w2( real_t(1) / real_t(18) ); - const real_t three_w3( real_t(1) / real_t(72) ); + const real_t three_w1( 2_r / 9_r ); + const real_t three_w2( 1_r / 18_r ); + const real_t three_w3( 1_r / 72_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1476,19 +1476,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D3Q27_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; // no force term - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); @@ -1500,61 +1500,61 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE dst->get(x,y,z,Stencil_T::idx[B]) = omega_trm * vB + omega_w1 * ( vel_trm_T_B - velZ ) - three_w1 * force[2]; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ) + three_w2 * ( force[1] - force[0] ); dst->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ) + three_w2 * ( force[0] - force[1] ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ) + three_w2 * ( force[0] + force[1] ); dst->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ) + three_w2 * ( -force[0] - force[1] ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2 * ( vel_trm_TW_BE - velXmZ ) + three_w2 * ( force[2] - force[0] ); dst->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2 * ( vel_trm_TW_BE + velXmZ ) + three_w2 * ( force[0] - force[2] ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2 * ( vel_trm_TE_BW + velXpZ ) + three_w2 * ( force[0] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2 * ( vel_trm_TE_BW - velXpZ ) + three_w2 * ( -force[0] - force[2] ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2 * ( vel_trm_TS_BN - velYmZ ) + three_w2 * ( force[2] - force[1] ); dst->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2 * ( vel_trm_TS_BN + velYmZ ) + three_w2 * ( force[1] - force[2] ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2 * ( vel_trm_TN_BS + velYpZ ) + three_w2 * ( force[1] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2 * ( vel_trm_TN_BS - velYpZ ) + three_w2 * ( -force[1] - force[2] ); const real_t vel_TNE_BSW = velX + velY + velZ; - const real_t vel_trm_TNE_BSW = dir_indep_trm + real_t(1.5) * vel_TNE_BSW * vel_TNE_BSW; + const real_t vel_trm_TNE_BSW = dir_indep_trm + 1.5_r * vel_TNE_BSW * vel_TNE_BSW; dst->get(x,y,z,Stencil_T::idx[TNE]) = omega_trm * vTNE + omega_w3 * ( vel_trm_TNE_BSW + vel_TNE_BSW )+ three_w3 * ( force[0] + force[1] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BSW]) = omega_trm * vBSW + omega_w3 * ( vel_trm_TNE_BSW - vel_TNE_BSW )- three_w3 * ( force[0] + force[1] + force[2] ); const real_t vel_TNW_BSE = -velX + velY + velZ; - const real_t vel_trm_TNW_BSE = dir_indep_trm + real_t(1.5) * vel_TNW_BSE * vel_TNW_BSE; + const real_t vel_trm_TNW_BSE = dir_indep_trm + 1.5_r * vel_TNW_BSE * vel_TNW_BSE; dst->get(x,y,z,Stencil_T::idx[TNW]) = omega_trm * vTNW + omega_w3 * ( vel_trm_TNW_BSE + vel_TNW_BSE ) + three_w3 * ( -force[0] + force[1] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BSE]) = omega_trm * vBSE + omega_w3 * ( vel_trm_TNW_BSE - vel_TNW_BSE ) - three_w3 * ( -force[0] + force[1] + force[2] ); const real_t vel_TSE_BNW = velX - velY + velZ; - const real_t vel_trm_TSE_BNW = dir_indep_trm + real_t(1.5) * vel_TSE_BNW * vel_TSE_BNW; + const real_t vel_trm_TSE_BNW = dir_indep_trm + 1.5_r * vel_TSE_BNW * vel_TSE_BNW; dst->get( x, y, z, Stencil_T::idx[TSE] ) = omega_trm * vTSE + omega_w3 * ( vel_trm_TSE_BNW + vel_TSE_BNW ) + three_w3 * ( force[0] - force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BNW] ) = omega_trm * vBNW + omega_w3 * ( vel_trm_TSE_BNW - vel_TSE_BNW ) - three_w3 * ( force[0] - force[1] + force[2] ); const real_t vel_TSW_BNE = - velX - velY + velZ; - const real_t vel_trm_TSW_BNE = dir_indep_trm + real_t(1.5) * vel_TSW_BNE * vel_TSW_BNE; + const real_t vel_trm_TSW_BNE = dir_indep_trm + 1.5_r * vel_TSW_BNE * vel_TSW_BNE; dst->get( x, y, z, Stencil_T::idx[TSW] ) = omega_trm * vTSW + omega_w3 * ( vel_trm_TSW_BNE + vel_TSW_BNE ) + three_w3 * ( -force[0] - force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BNE] ) = omega_trm * vBNE + omega_w3 * ( vel_trm_TSW_BNE - vel_TSW_BNE ) - three_w3 * ( -force[0] - force[1] + force[2] ); @@ -1568,16 +1568,16 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(8.0) / real_t(27.0) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(2.0) / real_t(27.0) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1.0) / real_t(54.0) ) * omega ); - const real_t omega_w3( real_t(3) * ( real_t(1.0) / real_t(216.0) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 8.0_r / 27.0_r ) * omega ); + const real_t omega_w1( 3_r * ( 2.0_r / 27.0_r ) * omega ); + const real_t omega_w2( 3_r * ( 1.0_r / 54.0_r ) * omega ); + const real_t omega_w3( 3_r * ( 1.0_r / 216.0_r ) * omega ); + const real_t one_third( 1_r / 3_r ); - const real_t three_w1( real_t(2) / real_t(9) ); - const real_t three_w2( real_t(1) / real_t(18) ); - const real_t three_w3( real_t(1) / real_t(72) ); + const real_t three_w1( 2_r / 9_r ); + const real_t three_w2( 1_r / 18_r ); + const real_t three_w3( 1_r / 72_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1589,19 +1589,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D3Q27_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); const real_t velXX = velX * velX; const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third * rho - 0.5_r * ( velXX + velYY + velZZ ); src->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * dir_indep_trm; // no force term - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); @@ -1613,61 +1613,61 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA src->get(x,y,z,Stencil_T::idx[B]) = omega_trm * vB + omega_w1 * ( vel_trm_T_B - velZ ) - three_w1 * force[2]; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; src->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2 * ( vel_trm_NW_SE - velXmY ) + three_w2 * ( force[1] - force[0] ); src->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2 * ( vel_trm_NW_SE + velXmY ) + three_w2 * ( force[0] - force[1] ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; src->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2 * ( vel_trm_NE_SW + velXpY ) + three_w2 * ( force[0] + force[1] ); src->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2 * ( vel_trm_NE_SW - velXpY ) + three_w2 * ( -force[0] - force[1] ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; src->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2 * ( vel_trm_TW_BE - velXmZ ) + three_w2 * ( force[2] - force[0] ); src->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2 * ( vel_trm_TW_BE + velXmZ ) + three_w2 * ( force[0] - force[2] ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; src->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2 * ( vel_trm_TE_BW + velXpZ ) + three_w2 * ( force[0] + force[2] ); src->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2 * ( vel_trm_TE_BW - velXpZ ) + three_w2 * ( -force[0] - force[2] ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; src->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2 * ( vel_trm_TS_BN - velYmZ ) + three_w2 * ( force[2] - force[1] ); src->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2 * ( vel_trm_TS_BN + velYmZ ) + three_w2 * ( force[1] - force[2] ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; src->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2 * ( vel_trm_TN_BS + velYpZ ) + three_w2 * ( force[1] + force[2] ); src->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2 * ( vel_trm_TN_BS - velYpZ ) + three_w2 * ( -force[1] - force[2] ); const real_t vel_TNE_BSW = velX + velY + velZ; - const real_t vel_trm_TNE_BSW = dir_indep_trm + real_t(1.5) * vel_TNE_BSW * vel_TNE_BSW; + const real_t vel_trm_TNE_BSW = dir_indep_trm + 1.5_r * vel_TNE_BSW * vel_TNE_BSW; src->get(x,y,z,Stencil_T::idx[TNE]) = omega_trm * vTNE + omega_w3 * ( vel_trm_TNE_BSW + vel_TNE_BSW ) + three_w3 * ( force[0] + force[1] + force[2] ); src->get(x,y,z,Stencil_T::idx[BSW]) = omega_trm * vBSW + omega_w3 * ( vel_trm_TNE_BSW - vel_TNE_BSW ) - three_w3 * ( force[0] + force[1] + force[2] ); const real_t vel_TNW_BSE = -velX + velY + velZ; - const real_t vel_trm_TNW_BSE = dir_indep_trm + real_t(1.5) * vel_TNW_BSE * vel_TNW_BSE; + const real_t vel_trm_TNW_BSE = dir_indep_trm + 1.5_r * vel_TNW_BSE * vel_TNW_BSE; src->get(x,y,z,Stencil_T::idx[TNW]) = omega_trm * vTNW + omega_w3 * ( vel_trm_TNW_BSE + vel_TNW_BSE ) + three_w3 * ( -force[0] + force[1] + force[2] ); src->get(x,y,z,Stencil_T::idx[BSE]) = omega_trm * vBSE + omega_w3 * ( vel_trm_TNW_BSE - vel_TNW_BSE ) - three_w3 * ( -force[0] + force[1] + force[2] ); const real_t vel_TSE_BNW = velX - velY + velZ; - const real_t vel_trm_TSE_BNW = dir_indep_trm + real_t(1.5) * vel_TSE_BNW * vel_TSE_BNW; + const real_t vel_trm_TSE_BNW = dir_indep_trm + 1.5_r * vel_TSE_BNW * vel_TSE_BNW; src->get( x, y, z, Stencil_T::idx[TSE] ) = omega_trm * vTSE + omega_w3 * ( vel_trm_TSE_BNW + vel_TSE_BNW ) + three_w3 * ( force[0] - force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BNW] ) = omega_trm * vBNW + omega_w3 * ( vel_trm_TSE_BNW - vel_TSE_BNW ) - three_w3 * ( force[0] - force[1] + force[2] ); const real_t vel_TSW_BNE = - velX - velY + velZ; - const real_t vel_trm_TSW_BNE = dir_indep_trm + real_t(1.5) * vel_TSW_BNE * vel_TSW_BNE; + const real_t vel_trm_TSW_BNE = dir_indep_trm + 1.5_r * vel_TSW_BNE * vel_TSW_BNE; src->get( x, y, z, Stencil_T::idx[TSW] ) = omega_trm * vTSW + omega_w3 * ( vel_trm_TSW_BNE + vel_TSW_BNE ) + three_w3 * ( -force[0] - force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BNE] ) = omega_trm * vBNE + omega_w3 * ( vel_trm_TSW_BNE - vel_TSW_BNE ) - three_w3 * ( -force[0] - force[1] + force[2] ); @@ -1701,16 +1701,16 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(8.0) / real_t(27.0) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(2.0) / real_t(27.0) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1.0) / real_t(54.0) ) * omega ); - const real_t omega_w3( real_t(3) * ( real_t(1.0) / real_t(216.0) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 8.0_r / 27.0_r ) * omega ); + const real_t omega_w1( 3_r * ( 2.0_r / 27.0_r ) * omega ); + const real_t omega_w2( 3_r * ( 1.0_r / 54.0_r ) * omega ); + const real_t omega_w3( 3_r * ( 1.0_r / 216.0_r ) * omega ); + const real_t one_third( 1_r / 3_r ); - const real_t three_w1( real_t(2) / real_t(9) ); - const real_t three_w2( real_t(1) / real_t(18) ); - const real_t three_w3( real_t(1) / real_t(72) ); + const real_t three_w1( 2_r / 9_r ); + const real_t three_w2( 1_r / 18_r ); + const real_t three_w3( 1_r / 72_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1728,15 +1728,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * rho * dir_indep_trm; // no force term const real_t omega_w1_rho = omega_w1 * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); @@ -1750,37 +1750,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t omega_w2_rho = omega_w2 * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ) + three_w2 * ( force[1] - force[0] ); dst->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ) + three_w2 * ( force[0] - force[1] ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ) + three_w2 * ( force[0] + force[1] ); dst->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ) + three_w2 * ( -force[0] - force[1] ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ) + three_w2 * ( force[2] - force[0] ); dst->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ) + three_w2 * ( force[0] - force[2] ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ) + three_w2 * ( force[0] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ) + three_w2 * ( -force[0] - force[2] ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ) + three_w2 * ( force[2] - force[1] ); dst->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ) + three_w2 * ( force[1] - force[2] ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ) + three_w2 * ( force[1] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ) + three_w2 * ( -force[1] - force[2] ); @@ -1788,25 +1788,25 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t omega_w3_rho = omega_w3 * rho; const real_t vel_TNE_BSW = velX + velY + velZ; - const real_t vel_trm_TNE_BSW = dir_indep_trm + real_t(1.5) * vel_TNE_BSW * vel_TNE_BSW; + const real_t vel_trm_TNE_BSW = dir_indep_trm + 1.5_r * vel_TNE_BSW * vel_TNE_BSW; dst->get(x,y,z,Stencil_T::idx[TNE]) = omega_trm * vTNE + omega_w3_rho * ( vel_trm_TNE_BSW + vel_TNE_BSW ) + three_w3 * ( force[0] + force[1] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BSW]) = omega_trm * vBSW + omega_w3_rho * ( vel_trm_TNE_BSW - vel_TNE_BSW ) - three_w3 * ( force[0] + force[1] + force[2] ); const real_t vel_TNW_BSE = -velX + velY + velZ; - const real_t vel_trm_TNW_BSE = dir_indep_trm + real_t(1.5) * vel_TNW_BSE * vel_TNW_BSE; + const real_t vel_trm_TNW_BSE = dir_indep_trm + 1.5_r * vel_TNW_BSE * vel_TNW_BSE; dst->get(x,y,z,Stencil_T::idx[TNW]) = omega_trm * vTNW + omega_w3_rho * ( vel_trm_TNW_BSE + vel_TNW_BSE ) + three_w3 * ( -force[0] + force[1] + force[2] ); dst->get(x,y,z,Stencil_T::idx[BSE]) = omega_trm * vBSE + omega_w3_rho * ( vel_trm_TNW_BSE - vel_TNW_BSE ) - three_w3 * ( -force[0] + force[1] + force[2] ); const real_t vel_TSE_BNW = velX - velY + velZ; - const real_t vel_trm_TSE_BNW = dir_indep_trm + real_t(1.5) * vel_TSE_BNW * vel_TSE_BNW; + const real_t vel_trm_TSE_BNW = dir_indep_trm + 1.5_r * vel_TSE_BNW * vel_TSE_BNW; dst->get( x, y, z, Stencil_T::idx[TSE] ) = omega_trm * vTSE + omega_w3_rho * ( vel_trm_TSE_BNW + vel_TSE_BNW ) + three_w3 * ( force[0] - force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BNW] ) = omega_trm * vBNW + omega_w3_rho * ( vel_trm_TSE_BNW - vel_TSE_BNW ) - three_w3 * ( force[0] - force[1] + force[2] ); const real_t vel_TSW_BNE = - velX - velY + velZ; - const real_t vel_trm_TSW_BNE = dir_indep_trm + real_t(1.5) * vel_TSW_BNE * vel_TSW_BNE; + const real_t vel_trm_TSW_BNE = dir_indep_trm + 1.5_r * vel_TSW_BNE * vel_TSW_BNE; dst->get( x, y, z, Stencil_T::idx[TSW] ) = omega_trm * vTSW + omega_w3_rho * ( vel_trm_TSW_BNE + vel_TSW_BNE ) + three_w3 * ( -force[0] - force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BNE] ) = omega_trm * vBNE + omega_w3_rho * ( vel_trm_TSW_BNE - vel_TSW_BNE ) - three_w3 * ( -force[0] - force[1] + force[2] ); @@ -1820,16 +1820,16 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA { const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(8.0) / real_t(27.0) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(2.0) / real_t(27.0) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1.0) / real_t(54.0) ) * omega ); - const real_t omega_w3( real_t(3) * ( real_t(1.0) / real_t(216.0) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 8.0_r / 27.0_r ) * omega ); + const real_t omega_w1( 3_r * ( 2.0_r / 27.0_r ) * omega ); + const real_t omega_w2( 3_r * ( 1.0_r / 54.0_r ) * omega ); + const real_t omega_w3( 3_r * ( 1.0_r / 216.0_r ) * omega ); + const real_t one_third( 1_r / 3_r ); - const real_t three_w1( real_t(2) / real_t(9) ); - const real_t three_w2( real_t(1) / real_t(18) ); - const real_t three_w3( real_t(1) / real_t(72) ); + const real_t three_w1( 2_r / 9_r ); + const real_t three_w2( 1_r / 18_r ); + const real_t three_w3( 1_r / 72_r ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1847,15 +1847,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = one_third - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = one_third - 0.5_r * ( velXX + velYY + velZZ ); src->get(x,y,z,Stencil_T::idx[C]) = omega_trm * vC + omega_w0 * rho * dir_indep_trm; // no force term const real_t omega_w1_rho = omega_w1 * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); @@ -1869,37 +1869,37 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t omega_w2_rho = omega_w2 * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; src->get(x,y,z,Stencil_T::idx[NW]) = omega_trm * vNW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ) + three_w2 * ( force[1] - force[0] ); src->get(x,y,z,Stencil_T::idx[SE]) = omega_trm * vSE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ) + three_w2 * ( force[0] - force[1] ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; src->get(x,y,z,Stencil_T::idx[NE]) = omega_trm * vNE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ) + three_w2 * ( force[0] + force[1] ); src->get(x,y,z,Stencil_T::idx[SW]) = omega_trm * vSW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ) + three_w2 * ( -force[0] - force[1] ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; src->get(x,y,z,Stencil_T::idx[TW]) = omega_trm * vTW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ) + three_w2 * ( force[2] - force[0] ); src->get(x,y,z,Stencil_T::idx[BE]) = omega_trm * vBE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ) + three_w2 * ( force[0] - force[2] ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; src->get(x,y,z,Stencil_T::idx[TE]) = omega_trm * vTE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ) + three_w2 * ( force[0] + force[2] ); src->get(x,y,z,Stencil_T::idx[BW]) = omega_trm * vBW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ) + three_w2 * ( -force[0] - force[2] ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; src->get(x,y,z,Stencil_T::idx[TS]) = omega_trm * vTS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ) + three_w2 * ( force[2] - force[1] ); src->get(x,y,z,Stencil_T::idx[BN]) = omega_trm * vBN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ) + three_w2 * ( force[1] - force[2] ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; src->get(x,y,z,Stencil_T::idx[TN]) = omega_trm * vTN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ) + three_w2 * ( force[1] + force[2] ); src->get(x,y,z,Stencil_T::idx[BS]) = omega_trm * vBS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ) + three_w2 * ( -force[1] - force[2] ); @@ -1907,25 +1907,25 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t omega_w3_rho = omega_w3 * rho; const real_t vel_TNE_BSW = velX + velY + velZ; - const real_t vel_trm_TNE_BSW = dir_indep_trm + real_t(1.5) * vel_TNE_BSW * vel_TNE_BSW; + const real_t vel_trm_TNE_BSW = dir_indep_trm + 1.5_r * vel_TNE_BSW * vel_TNE_BSW; src->get(x,y,z,Stencil_T::idx[TNE]) = omega_trm * vTNE + omega_w3_rho * ( vel_trm_TNE_BSW + vel_TNE_BSW ) + three_w3 * ( force[0] + force[1] + force[2] ); src->get(x,y,z,Stencil_T::idx[BSW]) = omega_trm * vBSW + omega_w3_rho * ( vel_trm_TNE_BSW - vel_TNE_BSW ) - three_w3 * ( force[0] + force[1] + force[2] ); const real_t vel_TNW_BSE = -velX + velY + velZ; - const real_t vel_trm_TNW_BSE = dir_indep_trm + real_t(1.5) * vel_TNW_BSE * vel_TNW_BSE; + const real_t vel_trm_TNW_BSE = dir_indep_trm + 1.5_r * vel_TNW_BSE * vel_TNW_BSE; src->get(x,y,z,Stencil_T::idx[TNW]) = omega_trm * vTNW + omega_w3_rho * ( vel_trm_TNW_BSE + vel_TNW_BSE ) + three_w3 * ( -force[0] + force[1] + force[2] ); src->get(x,y,z,Stencil_T::idx[BSE]) = omega_trm * vBSE + omega_w3_rho * ( vel_trm_TNW_BSE - vel_TNW_BSE ) - three_w3 * ( -force[0] + force[1] + force[2] ); const real_t vel_TSE_BNW = velX - velY + velZ; - const real_t vel_trm_TSE_BNW = dir_indep_trm + real_t(1.5) * vel_TSE_BNW * vel_TSE_BNW; + const real_t vel_trm_TSE_BNW = dir_indep_trm + 1.5_r * vel_TSE_BNW * vel_TSE_BNW; src->get( x, y, z, Stencil_T::idx[TSE] ) = omega_trm * vTSE + omega_w3_rho * ( vel_trm_TSE_BNW + vel_TSE_BNW ) + three_w3 * ( force[0] - force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BNW] ) = omega_trm * vBNW + omega_w3_rho * ( vel_trm_TSE_BNW - vel_TSE_BNW ) - three_w3 * ( force[0] - force[1] + force[2] ); const real_t vel_TSW_BNE = - velX - velY + velZ; - const real_t vel_trm_TSW_BNE = dir_indep_trm + real_t(1.5) * vel_TSW_BNE * vel_TSW_BNE; + const real_t vel_trm_TSW_BNE = dir_indep_trm + 1.5_r * vel_TSW_BNE * vel_TSW_BNE; src->get( x, y, z, Stencil_T::idx[TSW] ) = omega_trm * vTSW + omega_w3_rho * ( vel_trm_TSW_BNE + vel_TSW_BNE ) + three_w3 * ( -force[0] - force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BNE] ) = omega_trm * vBNE + omega_w3_rho * ( vel_trm_TSW_BNE - vel_TSW_BNE ) - three_w3 * ( -force[0] - force[1] + force[2] ); @@ -1991,7 +1991,7 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t forceTerm = lm.forceModel().template forceTerm< LatticeModel_T >( x, y, z, velocity, rho, commonForceTerms, LatticeModel_T::w[ d.toIdx() ], real_c(d.cx()), real_c(d.cy()), real_c(d.cz()), omega, omega ); - dst->get( x, y, z, d.toIdx() ) = ( real_t(1.0) - omega ) * dst->get( x, y, z, d.toIdx() ) + + dst->get( x, y, z, d.toIdx() ) = ( 1.0_r - omega ) * dst->get( x, y, z, d.toIdx() ) + omega * EquilibriumDistribution< LatticeModel_T >::get( *d, velocity, rho ) + forceTerm; } @@ -2021,7 +2021,7 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t forceTerm = lm.forceModel().template forceTerm< LatticeModel_T >( x, y, z, velocity, rho, commonForceTerms, LatticeModel_T::w[ d.toIdx() ], real_c(d.cx()), real_c(d.cy()), real_c(d.cz()), omega, omega ); - src->get( x, y, z, d.toIdx() ) = ( real_t(1.0) - omega ) * src->get( x, y, z, d.toIdx() ) + + src->get( x, y, z, d.toIdx() ) = ( 1.0_r - omega ) * src->get( x, y, z, d.toIdx() ) + omega * EquilibriumDistribution< LatticeModel_T >::get( *d, velocity, rho ) + forceTerm; } diff --git a/src/lbm/srt/SplitPureSweep.impl.h b/src/lbm/srt/SplitPureSweep.impl.h index d545a9d1..c4b9ade3 100644 --- a/src/lbm/srt/SplitPureSweep.impl.h +++ b/src/lbm/srt/SplitPureSweep.impl.h @@ -117,11 +117,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -473,11 +473,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -817,11 +817,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -876,7 +876,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; rho[x] = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = rho_inv * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -1028,7 +1028,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; rho[x] = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = rho_inv * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -1175,11 +1175,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -1232,7 +1232,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; rho[x] = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = rho_inv * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -1356,7 +1356,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; rho[x] = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = rho_inv * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); diff --git a/src/lbm/srt/SplitSweep.impl.h b/src/lbm/srt/SplitSweep.impl.h index fca8be64..5c9a0d94 100644 --- a/src/lbm/srt/SplitSweep.impl.h +++ b/src/lbm/srt/SplitSweep.impl.h @@ -111,11 +111,11 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -177,7 +177,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: velY[x] = velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x]; velZ[x] = velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x]; - dir_indep_trm[x] = one_third * rho - real_t(0.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + dir_indep_trm[x] = one_third * rho - 0.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); dC[x] = omega_trm * pC[x] + omega_w0 * dir_indep_trm[x]; @@ -194,7 +194,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velY[x]; - const real_t vel_trm_NW_SE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NW_SE = dir_indep_trm[x] + 1.5_r * vel * vel; dNW[x] = omega_trm * pNW[x] + omega_w2 * ( vel_trm_NW_SE - vel ); dSE[x] = omega_trm * pSE[x] + omega_w2 * ( vel_trm_NW_SE + vel ); @@ -209,7 +209,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velY[x]; - const real_t vel_trm_NE_SW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NE_SW = dir_indep_trm[x] + 1.5_r * vel * vel; dNE[x] = omega_trm * pNE[x] + omega_w2 * ( vel_trm_NE_SW + vel ); dSW[x] = omega_trm * pSW[x] + omega_w2 * ( vel_trm_NE_SW - vel ); @@ -224,7 +224,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velZ[x]; - const real_t vel_trm_TW_BE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TW_BE = dir_indep_trm[x] + 1.5_r * vel * vel; dTW[x] = omega_trm * pTW[x] + omega_w2 * ( vel_trm_TW_BE - vel ); dBE[x] = omega_trm * pBE[x] + omega_w2 * ( vel_trm_TW_BE + vel ); @@ -239,7 +239,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velZ[x]; - const real_t vel_trm_TE_BW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TE_BW = dir_indep_trm[x] + 1.5_r * vel * vel; dTE[x] = omega_trm * pTE[x] + omega_w2 * ( vel_trm_TE_BW + vel ); dBW[x] = omega_trm * pBW[x] + omega_w2 * ( vel_trm_TE_BW - vel ); @@ -254,7 +254,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] - velZ[x]; - const real_t vel_trm_TS_BN = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TS_BN = dir_indep_trm[x] + 1.5_r * vel * vel; dTS[x] = omega_trm * pTS[x] + omega_w2 * ( vel_trm_TS_BN - vel ); dBN[x] = omega_trm * pBN[x] + omega_w2 * ( vel_trm_TS_BN + vel ); @@ -269,7 +269,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] + velZ[x]; - const real_t vel_trm_TN_BS = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TN_BS = dir_indep_trm[x] + 1.5_r * vel * vel; dTN[x] = omega_trm * pTN[x] + omega_w2 * ( vel_trm_TN_BS + vel ); dBS[x] = omega_trm * pBS[x] + omega_w2 * ( vel_trm_TN_BS - vel ); @@ -283,7 +283,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_N_S = dir_indep_trm[x] + real_t(1.5) * velY[x] * velY[x]; + const real_t vel_trm_N_S = dir_indep_trm[x] + 1.5_r * velY[x] * velY[x]; dN[x] = omega_trm * pN[x] + omega_w1 * ( vel_trm_N_S + velY[x] ); dS[x] = omega_trm * pS[x] + omega_w1 * ( vel_trm_N_S - velY[x] ); @@ -297,7 +297,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_E_W = dir_indep_trm[x] + real_t(1.5) * velX[x] * velX[x]; + const real_t vel_trm_E_W = dir_indep_trm[x] + 1.5_r * velX[x] * velX[x]; dE[x] = omega_trm * pE[x] + omega_w1 * ( vel_trm_E_W + velX[x] ); dW[x] = omega_trm * pW[x] + omega_w1 * ( vel_trm_E_W - velX[x] ); @@ -311,7 +311,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_T_B = dir_indep_trm[x] + real_t(1.5) * velZ[x] * velZ[x]; + const real_t vel_trm_T_B = dir_indep_trm[x] + 1.5_r * velZ[x] * velZ[x]; dT[x] = omega_trm * pT[x] + omega_w1 * ( vel_trm_T_B + velZ[x] ); dB[x] = omega_trm * pB[x] + omega_w1 * ( vel_trm_T_B - velZ[x] ); @@ -360,7 +360,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: velY[x] = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; velZ[x] = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - dir_indep_trm[x] = one_third * rho - real_t(0.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + dir_indep_trm[x] = one_third * rho - 0.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); dst->get(x,y,z,Stencil::idx[C]) = omega_trm * dd_tmp_C + omega_w0 * dir_indep_trm[x]; @@ -374,7 +374,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velY[x]; - const real_t vel_trm_NW_SE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NW_SE = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[NW]) = omega_trm * src->get(x+1, y-1, z, Stencil::idx[NW]) + omega_w2 * ( vel_trm_NW_SE - vel ); dst->get(x,y,z,Stencil::idx[SE]) = omega_trm * src->get(x-1, y+1, z, Stencil::idx[SE]) + omega_w2 * ( vel_trm_NW_SE + vel ); @@ -386,7 +386,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velY[x]; - const real_t vel_trm_NE_SW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NE_SW = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[NE]) = omega_trm * src->get(x-1, y-1, z, Stencil::idx[NE]) + omega_w2 * ( vel_trm_NE_SW + vel ); dst->get(x,y,z,Stencil::idx[SW]) = omega_trm * src->get(x+1, y+1, z, Stencil::idx[SW]) + omega_w2 * ( vel_trm_NE_SW - vel ); @@ -398,7 +398,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velZ[x]; - const real_t vel_trm_TW_BE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TW_BE = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[TW]) = omega_trm * src->get(x+1, y, z-1, Stencil::idx[TW]) + omega_w2 * ( vel_trm_TW_BE - vel ); dst->get(x,y,z,Stencil::idx[BE]) = omega_trm * src->get(x-1, y, z+1, Stencil::idx[BE]) + omega_w2 * ( vel_trm_TW_BE + vel ); @@ -410,7 +410,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velZ[x]; - const real_t vel_trm_TE_BW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TE_BW = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[TE]) = omega_trm * src->get(x-1, y, z-1, Stencil::idx[TE]) + omega_w2 * ( vel_trm_TE_BW + vel ); dst->get(x,y,z,Stencil::idx[BW]) = omega_trm * src->get(x+1, y, z+1, Stencil::idx[BW]) + omega_w2 * ( vel_trm_TE_BW - vel ); @@ -422,7 +422,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] - velZ[x]; - const real_t vel_trm_TS_BN = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TS_BN = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[TS]) = omega_trm * src->get(x, y+1, z-1, Stencil::idx[TS]) + omega_w2 * ( vel_trm_TS_BN - vel ); dst->get(x,y,z,Stencil::idx[BN]) = omega_trm * src->get(x, y-1, z+1, Stencil::idx[BN]) + omega_w2 * ( vel_trm_TS_BN + vel ); @@ -434,7 +434,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] + velZ[x]; - const real_t vel_trm_TN_BS = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TN_BS = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[TN]) = omega_trm * src->get(x, y-1, z-1, Stencil::idx[TN]) + omega_w2 * ( vel_trm_TN_BS + vel ); dst->get(x,y,z,Stencil::idx[BS]) = omega_trm * src->get(x, y+1, z+1, Stencil::idx[BS]) + omega_w2 * ( vel_trm_TN_BS - vel ); @@ -445,7 +445,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_N_S = dir_indep_trm[x] + real_t(1.5) * velY[x] * velY[x]; + const real_t vel_trm_N_S = dir_indep_trm[x] + 1.5_r * velY[x] * velY[x]; dst->get(x,y,z,Stencil::idx[N]) = omega_trm * src->get(x, y-1, z, Stencil::idx[N]) + omega_w1 * ( vel_trm_N_S + velY[x] ); dst->get(x,y,z,Stencil::idx[S]) = omega_trm * src->get(x, y+1, z, Stencil::idx[S]) + omega_w1 * ( vel_trm_N_S - velY[x] ); @@ -456,7 +456,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_E_W = dir_indep_trm[x] + real_t(1.5) * velX[x] * velX[x]; + const real_t vel_trm_E_W = dir_indep_trm[x] + 1.5_r * velX[x] * velX[x]; dst->get(x,y,z,Stencil::idx[E]) = omega_trm * src->get(x-1, y, z, Stencil::idx[E]) + omega_w1 * ( vel_trm_E_W + velX[x] ); dst->get(x,y,z,Stencil::idx[W]) = omega_trm * src->get(x+1, y, z, Stencil::idx[W]) + omega_w1 * ( vel_trm_E_W - velX[x] ); @@ -467,7 +467,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_T_B = dir_indep_trm[x] + real_t(1.5) * velZ[x] * velZ[x]; + const real_t vel_trm_T_B = dir_indep_trm[x] + 1.5_r * velZ[x] * velZ[x]; dst->get(x,y,z,Stencil::idx[T]) = omega_trm * src->get(x, y, z-1, Stencil::idx[T]) + omega_w1 * ( vel_trm_T_B + velZ[x] ); dst->get(x,y,z,Stencil::idx[B]) = omega_trm * src->get(x, y, z+1, Stencil::idx[B]) + omega_w1 * ( vel_trm_T_B - velZ[x] ); @@ -537,11 +537,11 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -601,7 +601,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: velY[x] = velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x]; velZ[x] = velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x]; - dir_indep_trm[x] = one_third * rho - real_t(0.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + dir_indep_trm[x] = one_third * rho - 0.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); pC[x] = omega_trm * pC[x] + omega_w0 * dir_indep_trm[x]; @@ -615,7 +615,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velY[x]; - const real_t vel_trm_NW_SE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NW_SE = dir_indep_trm[x] + 1.5_r * vel * vel; pNW[x] = omega_trm * pNW[x] + omega_w2 * ( vel_trm_NW_SE - vel ); pSE[x] = omega_trm * pSE[x] + omega_w2 * ( vel_trm_NW_SE + vel ); @@ -627,7 +627,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velY[x]; - const real_t vel_trm_NE_SW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NE_SW = dir_indep_trm[x] + 1.5_r * vel * vel; pNE[x] = omega_trm * pNE[x] + omega_w2 * ( vel_trm_NE_SW + vel ); pSW[x] = omega_trm * pSW[x] + omega_w2 * ( vel_trm_NE_SW - vel ); @@ -639,7 +639,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velZ[x]; - const real_t vel_trm_TW_BE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TW_BE = dir_indep_trm[x] + 1.5_r * vel * vel; pTW[x] = omega_trm * pTW[x] + omega_w2 * ( vel_trm_TW_BE - vel ); pBE[x] = omega_trm * pBE[x] + omega_w2 * ( vel_trm_TW_BE + vel ); @@ -651,7 +651,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velZ[x]; - const real_t vel_trm_TE_BW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TE_BW = dir_indep_trm[x] + 1.5_r * vel * vel; pTE[x] = omega_trm * pTE[x] + omega_w2 * ( vel_trm_TE_BW + vel ); pBW[x] = omega_trm * pBW[x] + omega_w2 * ( vel_trm_TE_BW - vel ); @@ -663,7 +663,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] - velZ[x]; - const real_t vel_trm_TS_BN = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TS_BN = dir_indep_trm[x] + 1.5_r * vel * vel; pTS[x] = omega_trm * pTS[x] + omega_w2 * ( vel_trm_TS_BN - vel ); pBN[x] = omega_trm * pBN[x] + omega_w2 * ( vel_trm_TS_BN + vel ); @@ -675,7 +675,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] + velZ[x]; - const real_t vel_trm_TN_BS = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TN_BS = dir_indep_trm[x] + 1.5_r * vel * vel; pTN[x] = omega_trm * pTN[x] + omega_w2 * ( vel_trm_TN_BS + vel ); pBS[x] = omega_trm * pBS[x] + omega_w2 * ( vel_trm_TN_BS - vel ); @@ -686,7 +686,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_N_S = dir_indep_trm[x] + real_t(1.5) * velY[x] * velY[x]; + const real_t vel_trm_N_S = dir_indep_trm[x] + 1.5_r * velY[x] * velY[x]; pN[x] = omega_trm * pN[x] + omega_w1 * ( vel_trm_N_S + velY[x] ); pS[x] = omega_trm * pS[x] + omega_w1 * ( vel_trm_N_S - velY[x] ); @@ -697,7 +697,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_E_W = dir_indep_trm[x] + real_t(1.5) * velX[x] * velX[x]; + const real_t vel_trm_E_W = dir_indep_trm[x] + 1.5_r * velX[x] * velX[x]; pE[x] = omega_trm * pE[x] + omega_w1 * ( vel_trm_E_W + velX[x] ); pW[x] = omega_trm * pW[x] + omega_w1 * ( vel_trm_E_W - velX[x] ); @@ -708,7 +708,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_T_B = dir_indep_trm[x] + real_t(1.5) * velZ[x] * velZ[x]; + const real_t vel_trm_T_B = dir_indep_trm[x] + 1.5_r * velZ[x] * velZ[x]; pT[x] = omega_trm * pT[x] + omega_w1 * ( vel_trm_T_B + velZ[x] ); pB[x] = omega_trm * pB[x] + omega_w1 * ( vel_trm_T_B - velZ[x] ); @@ -757,7 +757,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: velY[x] = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; velZ[x] = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - dir_indep_trm[x] = one_third * rho - real_t(0.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + dir_indep_trm[x] = one_third * rho - 0.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); src->get(x,y,z,Stencil::idx[C]) = omega_trm * dd_tmp_C + omega_w0 * dir_indep_trm[x]; @@ -771,7 +771,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velY[x]; - const real_t vel_trm_NW_SE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NW_SE = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[NW]) = omega_trm * src->get(x,y,z,Stencil::idx[NW]) + omega_w2 * ( vel_trm_NW_SE - vel ); src->get(x,y,z,Stencil::idx[SE]) = omega_trm * src->get(x,y,z,Stencil::idx[SE]) + omega_w2 * ( vel_trm_NW_SE + vel ); @@ -783,7 +783,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velY[x]; - const real_t vel_trm_NE_SW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NE_SW = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[NE]) = omega_trm * src->get(x,y,z,Stencil::idx[NE]) + omega_w2 * ( vel_trm_NE_SW + vel ); src->get(x,y,z,Stencil::idx[SW]) = omega_trm * src->get(x,y,z,Stencil::idx[SW]) + omega_w2 * ( vel_trm_NE_SW - vel ); @@ -795,7 +795,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velZ[x]; - const real_t vel_trm_TW_BE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TW_BE = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[TW]) = omega_trm * src->get(x,y,z,Stencil::idx[TW]) + omega_w2 * ( vel_trm_TW_BE - vel ); src->get(x,y,z,Stencil::idx[BE]) = omega_trm * src->get(x,y,z,Stencil::idx[BE]) + omega_w2 * ( vel_trm_TW_BE + vel ); @@ -807,7 +807,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velZ[x]; - const real_t vel_trm_TE_BW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TE_BW = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[TE]) = omega_trm * src->get(x,y,z,Stencil::idx[TE]) + omega_w2 * ( vel_trm_TE_BW + vel ); src->get(x,y,z,Stencil::idx[BW]) = omega_trm * src->get(x,y,z,Stencil::idx[BW]) + omega_w2 * ( vel_trm_TE_BW - vel ); @@ -819,7 +819,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] - velZ[x]; - const real_t vel_trm_TS_BN = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TS_BN = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[TS]) = omega_trm * src->get(x,y,z,Stencil::idx[TS]) + omega_w2 * ( vel_trm_TS_BN - vel ); src->get(x,y,z,Stencil::idx[BN]) = omega_trm * src->get(x,y,z,Stencil::idx[BN]) + omega_w2 * ( vel_trm_TS_BN + vel ); @@ -831,7 +831,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] + velZ[x]; - const real_t vel_trm_TN_BS = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TN_BS = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[TN]) = omega_trm * src->get(x,y,z,Stencil::idx[TN]) + omega_w2 * ( vel_trm_TN_BS + vel ); src->get(x,y,z,Stencil::idx[BS]) = omega_trm * src->get(x,y,z,Stencil::idx[BS]) + omega_w2 * ( vel_trm_TN_BS - vel ); @@ -842,7 +842,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_N_S = dir_indep_trm[x] + real_t(1.5) * velY[x] * velY[x]; + const real_t vel_trm_N_S = dir_indep_trm[x] + 1.5_r * velY[x] * velY[x]; src->get(x,y,z,Stencil::idx[N]) = omega_trm * src->get(x,y,z,Stencil::idx[N]) + omega_w1 * ( vel_trm_N_S + velY[x] ); src->get(x,y,z,Stencil::idx[S]) = omega_trm * src->get(x,y,z,Stencil::idx[S]) + omega_w1 * ( vel_trm_N_S - velY[x] ); @@ -853,7 +853,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_E_W = dir_indep_trm[x] + real_t(1.5) * velX[x] * velX[x]; + const real_t vel_trm_E_W = dir_indep_trm[x] + 1.5_r * velX[x] * velX[x]; src->get(x,y,z,Stencil::idx[E]) = omega_trm * src->get(x,y,z,Stencil::idx[E]) + omega_w1 * ( vel_trm_E_W + velX[x] ); src->get(x,y,z,Stencil::idx[W]) = omega_trm * src->get(x,y,z,Stencil::idx[W]) + omega_w1 * ( vel_trm_E_W - velX[x] ); @@ -864,7 +864,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_T_B = dir_indep_trm[x] + real_t(1.5) * velZ[x] * velZ[x]; + const real_t vel_trm_T_B = dir_indep_trm[x] + 1.5_r * velZ[x] * velZ[x]; src->get(x,y,z,Stencil::idx[T]) = omega_trm * src->get(x,y,z,Stencil::idx[T]) + omega_w1 * ( vel_trm_T_B + velZ[x] ); src->get(x,y,z,Stencil::idx[B]) = omega_trm * src->get(x,y,z,Stencil::idx[B]) + omega_w1 * ( vel_trm_T_B - velZ[x] ); @@ -951,11 +951,11 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -1014,13 +1014,13 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; rho[x] = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = rho_inv * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); velZ[x] = rho_inv * ( velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x] ); - dir_indep_trm[x] = one_third - real_t(0.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + dir_indep_trm[x] = one_third - 0.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); dC[x] = omega_trm * pC[x] + omega_w0 * rho[x] * dir_indep_trm[x]; @@ -1037,7 +1037,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velY[x]; - const real_t vel_trm_NW_SE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NW_SE = dir_indep_trm[x] + 1.5_r * vel * vel; dNW[x] = omega_trm * pNW[x] + omega_w2 * rho[x] * ( vel_trm_NW_SE - vel ); dSE[x] = omega_trm * pSE[x] + omega_w2 * rho[x] * ( vel_trm_NW_SE + vel ); @@ -1052,7 +1052,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velY[x]; - const real_t vel_trm_NE_SW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NE_SW = dir_indep_trm[x] + 1.5_r * vel * vel; dNE[x] = omega_trm * pNE[x] + omega_w2 * rho[x] * ( vel_trm_NE_SW + vel ); dSW[x] = omega_trm * pSW[x] + omega_w2 * rho[x] * ( vel_trm_NE_SW - vel ); @@ -1067,7 +1067,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velZ[x]; - const real_t vel_trm_TW_BE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TW_BE = dir_indep_trm[x] + 1.5_r * vel * vel; dTW[x] = omega_trm * pTW[x] + omega_w2 * rho[x] * ( vel_trm_TW_BE - vel ); dBE[x] = omega_trm * pBE[x] + omega_w2 * rho[x] * ( vel_trm_TW_BE + vel ); @@ -1082,7 +1082,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velZ[x]; - const real_t vel_trm_TE_BW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TE_BW = dir_indep_trm[x] + 1.5_r * vel * vel; dTE[x] = omega_trm * pTE[x] + omega_w2 * rho[x] * ( vel_trm_TE_BW + vel ); dBW[x] = omega_trm * pBW[x] + omega_w2 * rho[x] * ( vel_trm_TE_BW - vel ); @@ -1097,7 +1097,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] - velZ[x]; - const real_t vel_trm_TS_BN = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TS_BN = dir_indep_trm[x] + 1.5_r * vel * vel; dTS[x] = omega_trm * pTS[x] + omega_w2 * rho[x] * ( vel_trm_TS_BN - vel ); dBN[x] = omega_trm * pBN[x] + omega_w2 * rho[x] * ( vel_trm_TS_BN + vel ); @@ -1112,7 +1112,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] + velZ[x]; - const real_t vel_trm_TN_BS = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TN_BS = dir_indep_trm[x] + 1.5_r * vel * vel; dTN[x] = omega_trm * pTN[x] + omega_w2 * rho[x] * ( vel_trm_TN_BS + vel ); dBS[x] = omega_trm * pBS[x] + omega_w2 * rho[x] * ( vel_trm_TN_BS - vel ); @@ -1126,7 +1126,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_N_S = dir_indep_trm[x] + real_t(1.5) * velY[x] * velY[x]; + const real_t vel_trm_N_S = dir_indep_trm[x] + 1.5_r * velY[x] * velY[x]; dN[x] = omega_trm * pN[x] + omega_w1 * rho[x] * ( vel_trm_N_S + velY[x] ); dS[x] = omega_trm * pS[x] + omega_w1 * rho[x] * ( vel_trm_N_S - velY[x] ); @@ -1140,7 +1140,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_E_W = dir_indep_trm[x] + real_t(1.5) * velX[x] * velX[x]; + const real_t vel_trm_E_W = dir_indep_trm[x] + 1.5_r * velX[x] * velX[x]; dE[x] = omega_trm * pE[x] + omega_w1 * rho[x] * ( vel_trm_E_W + velX[x] ); dW[x] = omega_trm * pW[x] + omega_w1 * rho[x] * ( vel_trm_E_W - velX[x] ); @@ -1154,7 +1154,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_T_B = dir_indep_trm[x] + real_t(1.5) * velZ[x] * velZ[x]; + const real_t vel_trm_T_B = dir_indep_trm[x] + 1.5_r * velZ[x] * velZ[x]; dT[x] = omega_trm * pT[x] + omega_w1 * rho[x] * ( vel_trm_T_B + velZ[x] ); dB[x] = omega_trm * pB[x] + omega_w1 * rho[x] * ( vel_trm_T_B - velZ[x] ); @@ -1198,13 +1198,13 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; rho[x] = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = rho_inv * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); velZ[x] = rho_inv * ( velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE ); - dir_indep_trm[x] = one_third - real_t(0.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + dir_indep_trm[x] = one_third - 0.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); dst->get(x,y,z,Stencil::idx[C]) = omega_trm * dd_tmp_C + omega_w0 * rho[x] * dir_indep_trm[x]; @@ -1218,7 +1218,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velY[x]; - const real_t vel_trm_NW_SE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NW_SE = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[NW]) = omega_trm * src->get(x+1, y-1, z, Stencil::idx[NW]) + omega_w2 * rho[x] * ( vel_trm_NW_SE - vel ); dst->get(x,y,z,Stencil::idx[SE]) = omega_trm * src->get(x-1, y+1, z, Stencil::idx[SE]) + omega_w2 * rho[x] * ( vel_trm_NW_SE + vel ); @@ -1230,7 +1230,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velY[x]; - const real_t vel_trm_NE_SW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NE_SW = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[NE]) = omega_trm * src->get(x-1, y-1, z, Stencil::idx[NE]) + omega_w2 * rho[x] * ( vel_trm_NE_SW + vel ); dst->get(x,y,z,Stencil::idx[SW]) = omega_trm * src->get(x+1, y+1, z, Stencil::idx[SW]) + omega_w2 * rho[x] * ( vel_trm_NE_SW - vel ); @@ -1242,7 +1242,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velZ[x]; - const real_t vel_trm_TW_BE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TW_BE = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[TW]) = omega_trm * src->get(x+1, y, z-1, Stencil::idx[TW]) + omega_w2 * rho[x] * ( vel_trm_TW_BE - vel ); dst->get(x,y,z,Stencil::idx[BE]) = omega_trm * src->get(x-1, y, z+1, Stencil::idx[BE]) + omega_w2 * rho[x] * ( vel_trm_TW_BE + vel ); @@ -1254,7 +1254,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velZ[x]; - const real_t vel_trm_TE_BW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TE_BW = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[TE]) = omega_trm * src->get(x-1, y, z-1, Stencil::idx[TE]) + omega_w2 * rho[x] * ( vel_trm_TE_BW + vel ); dst->get(x,y,z,Stencil::idx[BW]) = omega_trm * src->get(x+1, y, z+1, Stencil::idx[BW]) + omega_w2 * rho[x] * ( vel_trm_TE_BW - vel ); @@ -1266,7 +1266,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] - velZ[x]; - const real_t vel_trm_TS_BN = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TS_BN = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[TS]) = omega_trm * src->get(x, y+1, z-1, Stencil::idx[TS]) + omega_w2 * rho[x] * ( vel_trm_TS_BN - vel ); dst->get(x,y,z,Stencil::idx[BN]) = omega_trm * src->get(x, y-1, z+1, Stencil::idx[BN]) + omega_w2 * rho[x] * ( vel_trm_TS_BN + vel ); @@ -1278,7 +1278,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] + velZ[x]; - const real_t vel_trm_TN_BS = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TN_BS = dir_indep_trm[x] + 1.5_r * vel * vel; dst->get(x,y,z,Stencil::idx[TN]) = omega_trm * src->get(x, y-1, z-1, Stencil::idx[TN]) + omega_w2 * rho[x] * ( vel_trm_TN_BS + vel ); dst->get(x,y,z,Stencil::idx[BS]) = omega_trm * src->get(x, y+1, z+1, Stencil::idx[BS]) + omega_w2 * rho[x] * ( vel_trm_TN_BS - vel ); @@ -1289,7 +1289,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_N_S = dir_indep_trm[x] + real_t(1.5) * velY[x] * velY[x]; + const real_t vel_trm_N_S = dir_indep_trm[x] + 1.5_r * velY[x] * velY[x]; dst->get(x,y,z,Stencil::idx[N]) = omega_trm * src->get(x, y-1, z, Stencil::idx[N]) + omega_w1 * rho[x] * ( vel_trm_N_S + velY[x] ); dst->get(x,y,z,Stencil::idx[S]) = omega_trm * src->get(x, y+1, z, Stencil::idx[S]) + omega_w1 * rho[x] * ( vel_trm_N_S - velY[x] ); @@ -1300,7 +1300,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_E_W = dir_indep_trm[x] + real_t(1.5) * velX[x] * velX[x]; + const real_t vel_trm_E_W = dir_indep_trm[x] + 1.5_r * velX[x] * velX[x]; dst->get(x,y,z,Stencil::idx[E]) = omega_trm * src->get(x-1, y, z, Stencil::idx[E]) + omega_w1 * rho[x] * ( vel_trm_E_W + velX[x] ); dst->get(x,y,z,Stencil::idx[W]) = omega_trm * src->get(x+1, y, z, Stencil::idx[W]) + omega_w1 * rho[x] * ( vel_trm_E_W - velX[x] ); @@ -1311,7 +1311,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_T_B = dir_indep_trm[x] + real_t(1.5) * velZ[x] * velZ[x]; + const real_t vel_trm_T_B = dir_indep_trm[x] + 1.5_r * velZ[x] * velZ[x]; dst->get(x,y,z,Stencil::idx[T]) = omega_trm * src->get(x, y, z-1, Stencil::idx[T]) + omega_w1 * rho[x] * ( vel_trm_T_B + velZ[x] ); dst->get(x,y,z,Stencil::idx[B]) = omega_trm * src->get(x, y, z+1, Stencil::idx[B]) + omega_w1 * rho[x] * ( vel_trm_T_B - velZ[x] ); @@ -1382,11 +1382,11 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -1443,13 +1443,13 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; rho[x] = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = rho_inv * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); velZ[x] = rho_inv * ( velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x] ); - dir_indep_trm[x] = one_third - real_t(0.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + dir_indep_trm[x] = one_third - 0.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); pC[x] = omega_trm * pC[x] + omega_w0 * rho[x] * dir_indep_trm[x]; @@ -1463,7 +1463,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velY[x]; - const real_t vel_trm_NW_SE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NW_SE = dir_indep_trm[x] + 1.5_r * vel * vel; pNW[x] = omega_trm * pNW[x] + omega_w2 * rho[x] * ( vel_trm_NW_SE - vel ); pSE[x] = omega_trm * pSE[x] + omega_w2 * rho[x] * ( vel_trm_NW_SE + vel ); @@ -1475,7 +1475,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velY[x]; - const real_t vel_trm_NE_SW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NE_SW = dir_indep_trm[x] + 1.5_r * vel * vel; pNE[x] = omega_trm * pNE[x] + omega_w2 * rho[x] * ( vel_trm_NE_SW + vel ); pSW[x] = omega_trm * pSW[x] + omega_w2 * rho[x] * ( vel_trm_NE_SW - vel ); @@ -1487,7 +1487,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velZ[x]; - const real_t vel_trm_TW_BE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TW_BE = dir_indep_trm[x] + 1.5_r * vel * vel; pTW[x] = omega_trm * pTW[x] + omega_w2 * rho[x] * ( vel_trm_TW_BE - vel ); pBE[x] = omega_trm * pBE[x] + omega_w2 * rho[x] * ( vel_trm_TW_BE + vel ); @@ -1499,7 +1499,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velZ[x]; - const real_t vel_trm_TE_BW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TE_BW = dir_indep_trm[x] + 1.5_r * vel * vel; pTE[x] = omega_trm * pTE[x] + omega_w2 * rho[x] * ( vel_trm_TE_BW + vel ); pBW[x] = omega_trm * pBW[x] + omega_w2 * rho[x] * ( vel_trm_TE_BW - vel ); @@ -1511,7 +1511,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] - velZ[x]; - const real_t vel_trm_TS_BN = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TS_BN = dir_indep_trm[x] + 1.5_r * vel * vel; pTS[x] = omega_trm * pTS[x] + omega_w2 * rho[x] * ( vel_trm_TS_BN - vel ); pBN[x] = omega_trm * pBN[x] + omega_w2 * rho[x] * ( vel_trm_TS_BN + vel ); @@ -1523,7 +1523,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] + velZ[x]; - const real_t vel_trm_TN_BS = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TN_BS = dir_indep_trm[x] + 1.5_r * vel * vel; pTN[x] = omega_trm * pTN[x] + omega_w2 * rho[x] * ( vel_trm_TN_BS + vel ); pBS[x] = omega_trm * pBS[x] + omega_w2 * rho[x] * ( vel_trm_TN_BS - vel ); @@ -1534,7 +1534,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_N_S = dir_indep_trm[x] + real_t(1.5) * velY[x] * velY[x]; + const real_t vel_trm_N_S = dir_indep_trm[x] + 1.5_r * velY[x] * velY[x]; pN[x] = omega_trm * pN[x] + omega_w1 * rho[x] * ( vel_trm_N_S + velY[x] ); pS[x] = omega_trm * pS[x] + omega_w1 * rho[x] * ( vel_trm_N_S - velY[x] ); @@ -1545,7 +1545,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_E_W = dir_indep_trm[x] + real_t(1.5) * velX[x] * velX[x]; + const real_t vel_trm_E_W = dir_indep_trm[x] + 1.5_r * velX[x] * velX[x]; pE[x] = omega_trm * pE[x] + omega_w1 * rho[x] * ( vel_trm_E_W + velX[x] ); pW[x] = omega_trm * pW[x] + omega_w1 * rho[x] * ( vel_trm_E_W - velX[x] ); @@ -1556,7 +1556,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: ( if( perform_lbm[x] ) { - const real_t vel_trm_T_B = dir_indep_trm[x] + real_t(1.5) * velZ[x] * velZ[x]; + const real_t vel_trm_T_B = dir_indep_trm[x] + 1.5_r * velZ[x] * velZ[x]; pT[x] = omega_trm * pT[x] + omega_w1 * rho[x] * ( vel_trm_T_B + velZ[x] ); pB[x] = omega_trm * pB[x] + omega_w1 * rho[x] * ( vel_trm_T_B - velZ[x] ); @@ -1600,13 +1600,13 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; rho[x] = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = rho_inv * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); velZ[x] = rho_inv * ( velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE ); - dir_indep_trm[x] = one_third - real_t(0.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + dir_indep_trm[x] = one_third - 0.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); src->get(x,y,z,Stencil::idx[C]) = omega_trm * dd_tmp_C + omega_w0 * rho[x] * dir_indep_trm[x]; @@ -1620,7 +1620,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velY[x]; - const real_t vel_trm_NW_SE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NW_SE = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[NW]) = omega_trm * src->get(x,y,z,Stencil::idx[NW]) + omega_w2 * rho[x] * ( vel_trm_NW_SE - vel ); src->get(x,y,z,Stencil::idx[SE]) = omega_trm * src->get(x,y,z,Stencil::idx[SE]) + omega_w2 * rho[x] * ( vel_trm_NW_SE + vel ); @@ -1632,7 +1632,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velY[x]; - const real_t vel_trm_NE_SW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_NE_SW = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[NE]) = omega_trm * src->get(x,y,z,Stencil::idx[NE]) + omega_w2 * rho[x] * ( vel_trm_NE_SW + vel ); src->get(x,y,z,Stencil::idx[SW]) = omega_trm * src->get(x,y,z,Stencil::idx[SW]) + omega_w2 * rho[x] * ( vel_trm_NE_SW - vel ); @@ -1644,7 +1644,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] - velZ[x]; - const real_t vel_trm_TW_BE = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TW_BE = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[TW]) = omega_trm * src->get(x,y,z,Stencil::idx[TW]) + omega_w2 * rho[x] * ( vel_trm_TW_BE - vel ); src->get(x,y,z,Stencil::idx[BE]) = omega_trm * src->get(x,y,z,Stencil::idx[BE]) + omega_w2 * rho[x] * ( vel_trm_TW_BE + vel ); @@ -1656,7 +1656,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velX[x] + velZ[x]; - const real_t vel_trm_TE_BW = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TE_BW = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[TE]) = omega_trm * src->get(x,y,z,Stencil::idx[TE]) + omega_w2 * rho[x] * ( vel_trm_TE_BW + vel ); src->get(x,y,z,Stencil::idx[BW]) = omega_trm * src->get(x,y,z,Stencil::idx[BW]) + omega_w2 * rho[x] * ( vel_trm_TE_BW - vel ); @@ -1668,7 +1668,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] - velZ[x]; - const real_t vel_trm_TS_BN = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TS_BN = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[TS]) = omega_trm * src->get(x,y,z,Stencil::idx[TS]) + omega_w2 * rho[x] * ( vel_trm_TS_BN - vel ); src->get(x,y,z,Stencil::idx[BN]) = omega_trm * src->get(x,y,z,Stencil::idx[BN]) + omega_w2 * rho[x] * ( vel_trm_TS_BN + vel ); @@ -1680,7 +1680,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t vel = velY[x] + velZ[x]; - const real_t vel_trm_TN_BS = dir_indep_trm[x] + real_t(1.5) * vel * vel; + const real_t vel_trm_TN_BS = dir_indep_trm[x] + 1.5_r * vel * vel; src->get(x,y,z,Stencil::idx[TN]) = omega_trm * src->get(x,y,z,Stencil::idx[TN]) + omega_w2 * rho[x] * ( vel_trm_TN_BS + vel ); src->get(x,y,z,Stencil::idx[BS]) = omega_trm * src->get(x,y,z,Stencil::idx[BS]) + omega_w2 * rho[x] * ( vel_trm_TN_BS - vel ); @@ -1691,7 +1691,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_N_S = dir_indep_trm[x] + real_t(1.5) * velY[x] * velY[x]; + const real_t vel_trm_N_S = dir_indep_trm[x] + 1.5_r * velY[x] * velY[x]; src->get(x,y,z,Stencil::idx[N]) = omega_trm * src->get(x,y,z,Stencil::idx[N]) + omega_w1 * rho[x] * ( vel_trm_N_S + velY[x] ); src->get(x,y,z,Stencil::idx[S]) = omega_trm * src->get(x,y,z,Stencil::idx[S]) + omega_w1 * rho[x] * ( vel_trm_N_S - velY[x] ); @@ -1702,7 +1702,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_E_W = dir_indep_trm[x] + real_t(1.5) * velX[x] * velX[x]; + const real_t vel_trm_E_W = dir_indep_trm[x] + 1.5_r * velX[x] * velX[x]; src->get(x,y,z,Stencil::idx[E]) = omega_trm * src->get(x,y,z,Stencil::idx[E]) + omega_w1 * rho[x] * ( vel_trm_E_W + velX[x] ); src->get(x,y,z,Stencil::idx[W]) = omega_trm * src->get(x,y,z,Stencil::idx[W]) + omega_w1 * rho[x] * ( vel_trm_E_W - velX[x] ); @@ -1713,7 +1713,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { if( perform_lbm[x] ) { - const real_t vel_trm_T_B = dir_indep_trm[x] + real_t(1.5) * velZ[x] * velZ[x]; + const real_t vel_trm_T_B = dir_indep_trm[x] + 1.5_r * velZ[x] * velZ[x]; src->get(x,y,z,Stencil::idx[T]) = omega_trm * src->get(x,y,z,Stencil::idx[T]) + omega_w1 * rho[x] * ( vel_trm_T_B + velZ[x] ); src->get(x,y,z,Stencil::idx[B]) = omega_trm * src->get(x,y,z,Stencil::idx[B]) + omega_w1 * rho[x] * ( vel_trm_T_B - velZ[x] ); diff --git a/src/lbm/srt/bluegeneq/SplitPureSweep.impl.h b/src/lbm/srt/bluegeneq/SplitPureSweep.impl.h index 865e3dfa..faa7f553 100644 --- a/src/lbm/srt/bluegeneq/SplitPureSweep.impl.h +++ b/src/lbm/srt/bluegeneq/SplitPureSweep.impl.h @@ -127,11 +127,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -616,11 +616,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -1020,11 +1020,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -1122,7 +1122,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; rho[x] = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = rho_inv * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -1362,7 +1362,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; rho[x] = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = rho_inv * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -1511,11 +1511,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t omega = src->latticeModel().collisionModel().omega(); - const real_t omega_trm( real_t(1) - omega ); - const real_t omega_w0( real_t(3) * ( real_t(1) / real_t( 3) ) * omega ); - const real_t omega_w1( real_t(3) * ( real_t(1) / real_t(18) ) * omega ); - const real_t omega_w2( real_t(3) * ( real_t(1) / real_t(36) ) * omega ); - const real_t one_third( real_t(1) / real_t(3) ); + const real_t omega_trm( 1_r - omega ); + const real_t omega_w0( 3_r * ( 1_r / real_t( 3) ) * omega ); + const real_t omega_w1( 3_r * ( 1_r / 18_r ) * omega ); + const real_t omega_w2( 3_r * ( 1_r / 36_r ) * omega ); + const real_t one_third( 1_r / 3_r ); // loop constants @@ -1609,7 +1609,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; rho[x] = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = rho_inv * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -1750,7 +1750,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; rho[x] = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t rho_inv = real_t(1) / rho[x]; + const real_t rho_inv = 1_r / rho[x]; velX[x] = rho_inv * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = rho_inv * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); diff --git a/src/lbm/srt/cell_operations/AdvectionDiffusionCellOperation.impl.h b/src/lbm/srt/cell_operations/AdvectionDiffusionCellOperation.impl.h index 13d7767a..2ed2cf2d 100644 --- a/src/lbm/srt/cell_operations/AdvectionDiffusionCellOperation.impl.h +++ b/src/lbm/srt/cell_operations/AdvectionDiffusionCellOperation.impl.h @@ -71,7 +71,7 @@ public: typedef PdfField< LM_Hydro > HydroPdfField_T; typedef typename LM_AdvDiff::Stencil Stencil; - AdvectionDiffusionCellOperation() : omega_( real_t(0) ), advDiffLatticeModel_( NULL ), hydroLatticeModel_(NULL) {} + AdvectionDiffusionCellOperation() : omega_( 0_r ), advDiffLatticeModel_( NULL ), hydroLatticeModel_(NULL) {} void configure( const LM_AdvDiff & advDiffLatticeModel, const LM_Hydro & hydroLatticeModel ) { @@ -92,7 +92,7 @@ public: // collide for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) { - dst->get( x, y, z, d.toIdx() ) = ( real_t(1.0) - omega_ ) * dst->get( x, y, z, d.toIdx() ) + + dst->get( x, y, z, d.toIdx() ) = ( 1.0_r - omega_ ) * dst->get( x, y, z, d.toIdx() ) + omega_ * EquilibriumDistribution< LM_AdvDiff >::get( *d, velocity, scalar ); } } @@ -110,7 +110,7 @@ public: // collide for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) { - dst[ d.toIdx() ] = ( real_t(1.0) - omega_ ) * dst[ d.toIdx() ] + + dst[ d.toIdx() ] = ( 1.0_r - omega_ ) * dst[ d.toIdx() ] + omega_ * EquilibriumDistribution< LM_AdvDiff >::get( *d, velocity, scalar ); } } @@ -148,7 +148,7 @@ public: typedef PdfField< LM_Hydro > HydroPdfField_T; typedef typename LM_AdvDiff::Stencil Stencil; - AdvectionDiffusionCellOperation() : omega_( real_t(0) ), advDiffLatticeModel_( NULL ), hydroLatticeModel_(NULL) {} + AdvectionDiffusionCellOperation() : omega_( 0_r ), advDiffLatticeModel_( NULL ), hydroLatticeModel_(NULL) {} void configure( const LM_AdvDiff & advDiffLatticeModel, const LM_Hydro & hydroLatticeModel ) { @@ -165,12 +165,12 @@ public: Vector3<real_t> velocity = hydro->getVelocity( x, y, z ); real_t scalar = dst->getDensity( x, y, z ); - dtsv *= real_t(3) - real_c(1.5)*omega_; + dtsv *= 3_r - real_c(1.5)*omega_; // collide for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) { - dst->get( x, y, z, d.toIdx() ) = ( real_t(1.0) - omega_ ) * dst->get( x, y, z, d.toIdx() ) + + dst->get( x, y, z, d.toIdx() ) = ( 1.0_r - omega_ ) * dst->get( x, y, z, d.toIdx() ) + omega_ * EquilibriumDistribution< LM_AdvDiff >::get( *d, velocity, scalar ) + LM_AdvDiff::w[ d.toIdx() ] * ( d.cx()*dtsv[0] + d.cy()*dtsv[1] + d.cz()*dtsv[2] ); } @@ -185,12 +185,12 @@ public: Vector3<real_t> velocity = getVelocity( *hydroLatticeModel_, hydro ); real_t scalar = getDensity( *advDiffLatticeModel_, dst ); - dtsv *= real_t(3) - real_c(1.5)*omega_; + dtsv *= 3_r - real_c(1.5)*omega_; // collide for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) { - dst[ d.toIdx() ] = ( real_t(1.0) - omega_ ) * dst[ d.toIdx() ] + + dst[ d.toIdx() ] = ( 1.0_r - omega_ ) * dst[ d.toIdx() ] + omega_ * EquilibriumDistribution< LM_AdvDiff >::get( *d, velocity, scalar ) + LM_AdvDiff::w[ d.toIdx() ] * ( d.cx()*dtsv[0] + d.cy()*dtsv[1] + d.cz()*dtsv[2] ); } diff --git a/src/lbm/srt/cell_operations/DefaultCellOperation.impl.h b/src/lbm/srt/cell_operations/DefaultCellOperation.impl.h index bae0832e..e1b768d5 100644 --- a/src/lbm/srt/cell_operations/DefaultCellOperation.impl.h +++ b/src/lbm/srt/cell_operations/DefaultCellOperation.impl.h @@ -72,7 +72,7 @@ public: typedef PdfField< LatticeModel_T > PdfField_T; typedef typename LatticeModel_T::Stencil Stencil; - DefaultCellOperation() : omega_( real_t(0) ), latticeModel_( NULL ) {} + DefaultCellOperation() : omega_( 0_r ), latticeModel_( NULL ) {} void configure( const LatticeModel_T & latticeModel ) { @@ -92,7 +92,7 @@ public: // collide for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) { - dst->get( x, y, z, d.toIdx() ) = ( real_t(1.0) - omega_ ) * dst->get( x, y, z, d.toIdx() ) + + dst->get( x, y, z, d.toIdx() ) = ( 1.0_r - omega_ ) * dst->get( x, y, z, d.toIdx() ) + omega_ * EquilibriumDistribution< LatticeModel_T >::get( *d, velocity, rho ); } } @@ -110,7 +110,7 @@ public: // collide for( auto d = Stencil::begin(); d != Stencil::end(); ++d ) { - dst[ d.toIdx() ] = ( real_t(1.0) - omega_ ) * dst[ d.toIdx() ] + + dst[ d.toIdx() ] = ( 1.0_r - omega_ ) * dst[ d.toIdx() ] + omega_ * EquilibriumDistribution< LatticeModel_T >::get( *d, velocity, rho ); } } @@ -144,7 +144,7 @@ public: typedef PdfField< LatticeModel_T > PdfField_T; typedef typename LatticeModel_T::Stencil Stencil; - DefaultCellOperation() : omega_( real_t(0) ), latticeModel_( NULL ) {} + DefaultCellOperation() : omega_( 0_r ), latticeModel_( NULL ) {} void configure( const LatticeModel_T & latticeModel ) { @@ -167,10 +167,10 @@ public: { const Vector3<real_t> c( real_c(d.cx()), real_c(d.cy()), real_c(d.cz()) ); - const real_t force_trm = real_t(3.0) * LatticeModel_T::w[ d.toIdx() ] * ( real_t(1) - real_t(0.5) * omega_ ) * - ( ( c - velocity + ( real_t(3) * ( c * velocity ) * c ) ) * force_ ); + const real_t force_trm = 3.0_r * LatticeModel_T::w[ d.toIdx() ] * ( 1_r - 0.5_r * omega_ ) * + ( ( c - velocity + ( 3_r * ( c * velocity ) * c ) ) * force_ ); - dst->get( x, y, z, d.toIdx() ) = ( real_t(1.0) - omega_ ) * dst->get( x, y, z, d.toIdx() ) + + dst->get( x, y, z, d.toIdx() ) = ( 1.0_r - omega_ ) * dst->get( x, y, z, d.toIdx() ) + omega_ * EquilibriumDistribution< LatticeModel_T >::get( *d, velocity, rho ) + force_trm; } @@ -191,10 +191,10 @@ public: { const Vector3<real_t> c( real_c(d.cx()), real_c(d.cy()), real_c(d.cz()) ); - const real_t force_trm = real_t(3.0) * LatticeModel_T::w[ d.toIdx() ] * ( real_t(1) - real_t(0.5) * omega_ ) * - ( ( c - velocity + ( real_t(3) * ( c * velocity ) * c ) ) * force_ ); + const real_t force_trm = 3.0_r * LatticeModel_T::w[ d.toIdx() ] * ( 1_r - 0.5_r * omega_ ) * + ( ( c - velocity + ( 3_r * ( c * velocity ) * c ) ) * force_ ); - dst[ d.toIdx() ] = ( real_t(1.0) - omega_ ) * dst[ d.toIdx() ] + + dst[ d.toIdx() ] = ( 1.0_r - omega_ ) * dst[ d.toIdx() ] + omega_ * EquilibriumDistribution< LatticeModel_T >::get( *d, velocity, rho ) + force_trm; } @@ -239,15 +239,15 @@ public: typedef PdfField< LatticeModel_T > PdfField_T; typedef typename LatticeModel_T::Stencil Stencil; - DefaultCellOperation() : omega_trm_( real_t(0) ), omega_w0_( real_t(0) ), omega_w1_( real_t(0) ), omega_w2_( real_t(0) ) {} + DefaultCellOperation() : omega_trm_( 0_r ), omega_w0_( 0_r ), omega_w1_( 0_r ), omega_w2_( 0_r ) {} void configure( const LatticeModel_T & latticeModel ) { const real_t omega = latticeModel.collisionModel().omega(); - omega_trm_ = real_t(1) - omega; - omega_w0_ = real_t(3) * ( real_t(1) / real_t( 3) ) * omega; - omega_w1_ = real_t(3) * ( real_t(1) / real_t(18) ) * omega; - omega_w2_ = real_t(3) * ( real_t(1) / real_t(36) ) * omega; + omega_trm_ = 1_r - omega; + omega_w0_ = 3_r * ( 1_r / real_t( 3) ) * omega; + omega_w1_ = 3_r * ( 1_r / 18_r ) * omega; + omega_w2_ = 3_r * ( 1_r / 36_r ) * omega; } void operator()( PdfField_T * src, PdfField_T * dst, cell_idx_t x, cell_idx_t y, cell_idx_t z ) const; @@ -309,13 +309,13 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = ( real_t(1) / real_t(3) ) * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = ( 1_r / 3_r ) * rho - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil::idx[C]) = omega_trm_ * dd_tmp_C + omega_w0_ * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; dst->get(x,y,z,Stencil::idx[E]) = omega_trm_ * dd_tmp_E + omega_w1_ * ( vel_trm_E_W + velX ); dst->get(x,y,z,Stencil::idx[W]) = omega_trm_ * dd_tmp_W + omega_w1_ * ( vel_trm_E_W - velX ); @@ -325,37 +325,37 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl dst->get(x,y,z,Stencil::idx[B]) = omega_trm_ * dd_tmp_B + omega_w1_ * ( vel_trm_T_B - velZ ); const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil::idx[NW]) = omega_trm_ * dd_tmp_NW + omega_w2_ * ( vel_trm_NW_SE - velXmY ); dst->get(x,y,z,Stencil::idx[SE]) = omega_trm_ * dd_tmp_SE + omega_w2_ * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil::idx[NE]) = omega_trm_ * dd_tmp_NE + omega_w2_ * ( vel_trm_NE_SW + velXpY ); dst->get(x,y,z,Stencil::idx[SW]) = omega_trm_ * dd_tmp_SW + omega_w2_ * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil::idx[TW]) = omega_trm_ * dd_tmp_TW + omega_w2_ * ( vel_trm_TW_BE - velXmZ ); dst->get(x,y,z,Stencil::idx[BE]) = omega_trm_ * dd_tmp_BE + omega_w2_ * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil::idx[TE]) = omega_trm_ * dd_tmp_TE + omega_w2_ * ( vel_trm_TE_BW + velXpZ ); dst->get(x,y,z,Stencil::idx[BW]) = omega_trm_ * dd_tmp_BW + omega_w2_ * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil::idx[TS]) = omega_trm_ * dd_tmp_TS + omega_w2_ * ( vel_trm_TS_BN - velYmZ ); dst->get(x,y,z,Stencil::idx[BN]) = omega_trm_ * dd_tmp_BN + omega_w2_ * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil::idx[TN]) = omega_trm_ * dd_tmp_TN + omega_w2_ * ( vel_trm_TN_BS + velYpZ ); dst->get(x,y,z,Stencil::idx[BS]) = omega_trm_ * dd_tmp_BS + omega_w2_ * ( vel_trm_TN_BS - velYpZ ); @@ -408,13 +408,13 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = ( real_t(1) / real_t(3) ) * rho - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = ( 1_r / 3_r ) * rho - 0.5_r * ( velXX + velYY + velZZ ); dst[ Stencil::idx[C] ] = omega_trm_ * dd_tmp_C + omega_w0_ * dir_indep_trm; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; dst[ Stencil::idx[E] ] = omega_trm_ * dd_tmp_E + omega_w1_ * ( vel_trm_E_W + velX ); dst[ Stencil::idx[W] ] = omega_trm_ * dd_tmp_W + omega_w1_ * ( vel_trm_E_W - velX ); @@ -424,37 +424,37 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl dst[ Stencil::idx[B] ] = omega_trm_ * dd_tmp_B + omega_w1_ * ( vel_trm_T_B - velZ ); const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst[ Stencil::idx[NW] ] = omega_trm_ * dd_tmp_NW + omega_w2_ * ( vel_trm_NW_SE - velXmY ); dst[ Stencil::idx[SE] ] = omega_trm_ * dd_tmp_SE + omega_w2_ * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst[ Stencil::idx[NE] ] = omega_trm_ * dd_tmp_NE + omega_w2_ * ( vel_trm_NE_SW + velXpY ); dst[ Stencil::idx[SW] ] = omega_trm_ * dd_tmp_SW + omega_w2_ * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst[ Stencil::idx[TW] ] = omega_trm_ * dd_tmp_TW + omega_w2_ * ( vel_trm_TW_BE - velXmZ ); dst[ Stencil::idx[BE] ] = omega_trm_ * dd_tmp_BE + omega_w2_ * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst[ Stencil::idx[TE] ] = omega_trm_ * dd_tmp_TE + omega_w2_ * ( vel_trm_TE_BW + velXpZ ); dst[ Stencil::idx[BW] ] = omega_trm_ * dd_tmp_BW + omega_w2_ * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst[ Stencil::idx[TS] ] = omega_trm_ * dd_tmp_TS + omega_w2_ * ( vel_trm_TS_BN - velYmZ ); dst[ Stencil::idx[BN] ] = omega_trm_ * dd_tmp_BN + omega_w2_ * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst[ Stencil::idx[TN] ] = omega_trm_ * dd_tmp_TN + omega_w2_ * ( vel_trm_TN_BS + velYpZ ); dst[ Stencil::idx[BS] ] = omega_trm_ * dd_tmp_BS + omega_w2_ * ( vel_trm_TN_BS - velYpZ ); @@ -488,15 +488,15 @@ public: typedef PdfField< LatticeModel_T > PdfField_T; typedef typename LatticeModel_T::Stencil Stencil; - DefaultCellOperation() : omega_trm_( real_t(0) ), omega_w0_( real_t(0) ), omega_w1_( real_t(0) ), omega_w2_( real_t(0) ) {} + DefaultCellOperation() : omega_trm_( 0_r ), omega_w0_( 0_r ), omega_w1_( 0_r ), omega_w2_( 0_r ) {} void configure( const LatticeModel_T & latticeModel ) { const real_t omega = latticeModel.collisionModel().omega(); - omega_trm_ = real_t(1) - omega; - omega_w0_ = real_t(3) * ( real_t(1) / real_t( 3) ) * omega; - omega_w1_ = real_t(3) * ( real_t(1) / real_t(18) ) * omega; - omega_w2_ = real_t(3) * ( real_t(1) / real_t(36) ) * omega; + omega_trm_ = 1_r - omega; + omega_w0_ = 3_r * ( 1_r / real_t( 3) ) * omega; + omega_w1_ = 3_r * ( 1_r / 18_r ) * omega; + omega_w2_ = 3_r * ( 1_r / 36_r ) * omega; } void operator()( PdfField_T * src, PdfField_T * dst, cell_idx_t x, cell_idx_t y, cell_idx_t z ) const; @@ -550,7 +550,7 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; const real_t rho = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; const real_t velX = invRho * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); const real_t velY = invRho * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -560,15 +560,15 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = ( real_t(1) / real_t(3) ) - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = ( 1_r / 3_r ) - 0.5_r * ( velXX + velYY + velZZ ); dst->get(x,y,z,Stencil::idx[C]) = omega_trm_ * dd_tmp_C + omega_w0_ * rho * dir_indep_trm; const real_t omega_w1_rho = omega_w1_ * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; dst->get(x,y,z,Stencil::idx[E]) = omega_trm_ * dd_tmp_E + omega_w1_rho * ( vel_trm_E_W + velX ); dst->get(x,y,z,Stencil::idx[W]) = omega_trm_ * dd_tmp_W + omega_w1_rho * ( vel_trm_E_W - velX ); @@ -580,37 +580,37 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t omega_w2_rho = omega_w2_ * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst->get(x,y,z,Stencil::idx[NW]) = omega_trm_ * dd_tmp_NW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ); dst->get(x,y,z,Stencil::idx[SE]) = omega_trm_ * dd_tmp_SE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst->get(x,y,z,Stencil::idx[NE]) = omega_trm_ * dd_tmp_NE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ); dst->get(x,y,z,Stencil::idx[SW]) = omega_trm_ * dd_tmp_SW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst->get(x,y,z,Stencil::idx[TW]) = omega_trm_ * dd_tmp_TW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ); dst->get(x,y,z,Stencil::idx[BE]) = omega_trm_ * dd_tmp_BE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst->get(x,y,z,Stencil::idx[TE]) = omega_trm_ * dd_tmp_TE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ); dst->get(x,y,z,Stencil::idx[BW]) = omega_trm_ * dd_tmp_BW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst->get(x,y,z,Stencil::idx[TS]) = omega_trm_ * dd_tmp_TS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ); dst->get(x,y,z,Stencil::idx[BN]) = omega_trm_ * dd_tmp_BN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst->get(x,y,z,Stencil::idx[TN]) = omega_trm_ * dd_tmp_TN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ); dst->get(x,y,z,Stencil::idx[BS]) = omega_trm_ * dd_tmp_BS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ); @@ -654,7 +654,7 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; const real_t rho = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; const real_t velX = invRho * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); const real_t velY = invRho * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -664,15 +664,15 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t velYY = velY * velY; const real_t velZZ = velZ * velZ; - const real_t dir_indep_trm = ( real_t(1) / real_t(3) ) - real_t(0.5) * ( velXX + velYY + velZZ ); + const real_t dir_indep_trm = ( 1_r / 3_r ) - 0.5_r * ( velXX + velYY + velZZ ); dst[ Stencil::idx[C] ] = omega_trm_ * dd_tmp_C + omega_w0_ * rho * dir_indep_trm; const real_t omega_w1_rho = omega_w1_ * rho; - const real_t vel_trm_E_W = dir_indep_trm + real_t(1.5) * velXX; - const real_t vel_trm_N_S = dir_indep_trm + real_t(1.5) * velYY; - const real_t vel_trm_T_B = dir_indep_trm + real_t(1.5) * velZZ; + const real_t vel_trm_E_W = dir_indep_trm + 1.5_r * velXX; + const real_t vel_trm_N_S = dir_indep_trm + 1.5_r * velYY; + const real_t vel_trm_T_B = dir_indep_trm + 1.5_r * velZZ; dst[ Stencil::idx[E] ] = omega_trm_ * dd_tmp_E + omega_w1_rho * ( vel_trm_E_W + velX ); dst[ Stencil::idx[W] ] = omega_trm_ * dd_tmp_W + omega_w1_rho * ( vel_trm_E_W - velX ); @@ -684,37 +684,37 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t omega_w2_rho = omega_w2_ * rho; const real_t velXmY = velX - velY; - const real_t vel_trm_NW_SE = dir_indep_trm + real_t(1.5) * velXmY * velXmY; + const real_t vel_trm_NW_SE = dir_indep_trm + 1.5_r * velXmY * velXmY; dst[ Stencil::idx[NW] ] = omega_trm_ * dd_tmp_NW + omega_w2_rho * ( vel_trm_NW_SE - velXmY ); dst[ Stencil::idx[SE] ] = omega_trm_ * dd_tmp_SE + omega_w2_rho * ( vel_trm_NW_SE + velXmY ); const real_t velXpY = velX + velY; - const real_t vel_trm_NE_SW = dir_indep_trm + real_t(1.5) * velXpY * velXpY; + const real_t vel_trm_NE_SW = dir_indep_trm + 1.5_r * velXpY * velXpY; dst[ Stencil::idx[NE] ] = omega_trm_ * dd_tmp_NE + omega_w2_rho * ( vel_trm_NE_SW + velXpY ); dst[ Stencil::idx[SW] ] = omega_trm_ * dd_tmp_SW + omega_w2_rho * ( vel_trm_NE_SW - velXpY ); const real_t velXmZ = velX - velZ; - const real_t vel_trm_TW_BE = dir_indep_trm + real_t(1.5) * velXmZ * velXmZ; + const real_t vel_trm_TW_BE = dir_indep_trm + 1.5_r * velXmZ * velXmZ; dst[ Stencil::idx[TW] ] = omega_trm_ * dd_tmp_TW + omega_w2_rho * ( vel_trm_TW_BE - velXmZ ); dst[ Stencil::idx[BE] ] = omega_trm_ * dd_tmp_BE + omega_w2_rho * ( vel_trm_TW_BE + velXmZ ); const real_t velXpZ = velX + velZ; - const real_t vel_trm_TE_BW = dir_indep_trm + real_t(1.5) * velXpZ * velXpZ; + const real_t vel_trm_TE_BW = dir_indep_trm + 1.5_r * velXpZ * velXpZ; dst[ Stencil::idx[TE] ] = omega_trm_ * dd_tmp_TE + omega_w2_rho * ( vel_trm_TE_BW + velXpZ ); dst[ Stencil::idx[BW] ] = omega_trm_ * dd_tmp_BW + omega_w2_rho * ( vel_trm_TE_BW - velXpZ ); const real_t velYmZ = velY - velZ; - const real_t vel_trm_TS_BN = dir_indep_trm + real_t(1.5) * velYmZ * velYmZ; + const real_t vel_trm_TS_BN = dir_indep_trm + 1.5_r * velYmZ * velYmZ; dst[ Stencil::idx[TS] ] = omega_trm_ * dd_tmp_TS + omega_w2_rho * ( vel_trm_TS_BN - velYmZ ); dst[ Stencil::idx[BN] ] = omega_trm_ * dd_tmp_BN + omega_w2_rho * ( vel_trm_TS_BN + velYmZ ); const real_t velYpZ = velY + velZ; - const real_t vel_trm_TN_BS = dir_indep_trm + real_t(1.5) * velYpZ * velYpZ; + const real_t vel_trm_TN_BS = dir_indep_trm + 1.5_r * velYpZ * velYpZ; dst[ Stencil::idx[TN] ] = omega_trm_ * dd_tmp_TN + omega_w2_rho * ( vel_trm_TN_BS + velYpZ ); dst[ Stencil::idx[BS] ] = omega_trm_ * dd_tmp_BS + omega_w2_rho * ( vel_trm_TN_BS - velYpZ ); diff --git a/src/lbm/sweeps/CellwiseSweep.h b/src/lbm/sweeps/CellwiseSweep.h index d403ac79..490ab668 100644 --- a/src/lbm/sweeps/CellwiseSweep.h +++ b/src/lbm/sweeps/CellwiseSweep.h @@ -225,7 +225,7 @@ class CellwiseSweep const real_t velYTerm = vN + vNW; \ \ const real_t rho = vC + vS + vW + vB + vSW + velXTerm + velYTerm; \ - const real_t invRho = real_t(1.0) / rho; \ + const real_t invRho = 1.0_r / rho; \ \ const real_t velX = invRho * ( velXTerm - vW - vNW - vSW ); \ const real_t velY = invRho * ( velYTerm + vNE - vS - vSW - vSE ); @@ -291,7 +291,7 @@ class CellwiseSweep const real_t velZTerm = vT + vTS + vTW; \ \ const real_t rho = vC + vS + vW + vB + vSW + vBS + vBW + velXTerm + velYTerm + velZTerm; \ - const real_t invRho = real_t(1.0) / rho; \ + const real_t invRho = 1.0_r / rho; \ \ const real_t velX = invRho * ( velXTerm - vW - vNW - vSW - vTW - vBW ); \ const real_t velY = invRho * ( velYTerm + vNE - vS - vSW - vSE - vTS - vBS ); \ @@ -374,7 +374,7 @@ class CellwiseSweep const real_t velZTerm = vT + vTS + vTW + vTSW; \ \ const real_t rho = vC + vS + vW + vB + vSW + vBS + vBW + vBSW + velXTerm + velYTerm + velZTerm; \ - const real_t invRho = real_t(1.0) / rho; \ + const real_t invRho = 1.0_r / rho; \ \ const real_t velX = invRho * ( velXTerm - vW - vNW - vSW - vTW - vBW - vTNW - vTSW - vBNW - vBSW ); \ const real_t velY = invRho * ( velYTerm + vNE + vTNE + vBNE - vS - vSW - vSE - vTS - vBS - vTSE - vTSW - vBSE - vBSW ); \ diff --git a/src/lbm/trt/CellwiseSweep.impl.h b/src/lbm/trt/CellwiseSweep.impl.h index b1fa4a68..8963843b 100644 --- a/src/lbm/trt/CellwiseSweep.impl.h +++ b/src/lbm/trt/CellwiseSweep.impl.h @@ -67,17 +67,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(4.0) / real_t( 9.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t( 9.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 4.0_r / real_t( 9.0); // 1/3 for C + const real_t t1x2 = 1.0_r / real_t( 9.0) * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -89,31 +89,31 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D2Q9_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, real_t(0) ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, 0_r ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY ); - dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common; + dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); dst->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); dst->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; } @@ -128,17 +128,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(4.0) / real_t( 9.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t( 9.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 4.0_r / real_t( 9.0); // 1/3 for C + const real_t t1x2 = 1.0_r / real_t( 9.0) * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -150,31 +150,31 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D2Q9_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, real_t(0) ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, 0_r ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY ); - src->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common; + src->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); src->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; src->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); src->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; src->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; } @@ -212,17 +212,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -234,60 +234,60 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common; + dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); dst->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); dst->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); dst->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B; } @@ -302,17 +302,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -324,60 +324,60 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - src->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common; + src->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); src->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); src->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); src->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); src->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); src->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; src->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); src->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; src->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); src->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B; src->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B; } @@ -411,15 +411,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2_0 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0_0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2_0 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -433,46 +433,46 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho ); - const real_t feq_common = real_t(1.0) - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = 1.0_r - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common; + dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common; const real_t t2x2 = t2x2_0 * rho; const real_t fac2 = t2x2 * inv2csq2; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS; @@ -480,17 +480,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t fac1 = t1x2 * inv2csq2; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); dst->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); dst->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); dst->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B; } @@ -505,15 +505,15 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2_0 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0_0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2_0 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -527,46 +527,46 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho ); - const real_t feq_common = real_t(1.0) - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = 1.0_r - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - src->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common; + src->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common; const real_t t2x2 = t2x2_0 * rho; const real_t fac2 = t2x2 * inv2csq2; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); src->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); src->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); src->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); src->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS; @@ -574,17 +574,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t fac1 = t1x2 * inv2csq2; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); src->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; src->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); src->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; src->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); src->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B; src->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B; } @@ -617,21 +617,21 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t lambda_e = src->latticeModel().collisionModel().lambda_e(); const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); - const real_t three_w1( real_t(1) / real_t(6) ); - const real_t three_w2( real_t(1) / real_t(12) ); + const real_t three_w1( 1_r / 6_r ); + const real_t three_w2( 1_r / 12_r ); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -643,62 +643,62 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common; // no force term + dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common; // no force term const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW + three_w2 * ( force[0] + force[1] ); dst->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW + three_w2 * ( -force[0] - force[1] ); const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW + three_w2 * ( force[0] - force[1] ); dst->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW + three_w2 * ( force[1] - force[0] ); const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW + three_w2 * ( force[0] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW + three_w2 * ( -force[0] - force[2] ); const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW + three_w2 * ( force[0] - force[2] ); dst->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW + three_w2 * ( force[2] - force[0] ); const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS + three_w2 * ( force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS + three_w2 * ( -force[1] - force[2] ); const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS + three_w2 * ( force[1] - force[2] ); dst->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS + three_w2 * ( force[2] - force[1] ); const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); dst->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S + three_w1 * force[1]; dst->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S - three_w1 * force[1]; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); dst->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W + three_w1 * force[0]; dst->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W - three_w1 * force[0]; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); dst->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B + three_w1 * force[2]; dst->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B - three_w1 * force[2]; } @@ -712,21 +712,21 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t lambda_e = src->latticeModel().collisionModel().lambda_e(); const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); - const real_t three_w1( real_t(1) / real_t(6) ); - const real_t three_w2( real_t(1) / real_t(12) ); + const real_t three_w1( 1_r / 6_r ); + const real_t three_w2( 1_r / 12_r ); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -738,62 +738,62 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D3Q19_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - src->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common; // no force term + src->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common; // no force term const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW + three_w2 * ( force[0] + force[1] ); src->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW + three_w2 * ( -force[0] - force[1] ); const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW + three_w2 * ( force[0] - force[1] ); src->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW + three_w2 * ( force[1] - force[0] ); const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); src->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW + three_w2 * ( force[0] + force[2] ); src->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW + three_w2 * ( -force[0] - force[2] ); const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); src->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW + three_w2 * ( force[0] - force[2] ); src->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW + three_w2 * ( force[2] - force[0] ); const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); src->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS + three_w2 * ( force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS + three_w2 * ( -force[1] - force[2] ); const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); src->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS + three_w2 * ( force[1] - force[2] ); src->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS + three_w2 * ( force[2] - force[1] ); const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); src->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S + three_w1 * force[1]; src->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S - three_w1 * force[1]; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); src->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W + three_w1 * force[0]; src->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W - three_w1 * force[0]; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); src->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B + three_w1 * force[2]; src->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B - three_w1 * force[2]; } @@ -831,19 +831,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(8.0) / real_t(27.0); // 8/27 for C - const real_t t1x2 = real_t(2.0) / real_t(27.0) * real_t(2.0); // 2/27 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(54.0) * real_t(2.0); // 1/54 * 2 else - const real_t t3x2 = real_t(1.0) / real_t(216.0) * real_t(2.0); // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE + const real_t t0 = 8.0_r / 27.0_r; // 8/27 for C + const real_t t1x2 = 2.0_r / 27.0_r * 2.0_r; // 2/27 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 54.0_r * 2.0_r; // 1/54 * 2 else + const real_t t3x2 = 1.0_r / 216.0_r * 2.0_r; // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; const real_t fac3 = t3x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -856,84 +856,84 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D3Q27_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common; + dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); dst->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); dst->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); dst->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B; const real_t vel_TNE_BSW = velX + velY + velZ; const real_t sym_TNE_BSW = lambda_e_scaled * ( vTNE + vBSW - fac3 * vel_TNE_BSW * vel_TNE_BSW - t3x2 * feq_common ); - const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - real_t(3.0) * t3x2 * vel_TNE_BSW ); + const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - 3.0_r * t3x2 * vel_TNE_BSW ); dst->get( x, y, z, Stencil_T::idx[TNE] ) = vTNE - sym_TNE_BSW - asym_TNE_BSW; dst->get( x, y, z, Stencil_T::idx[BSW] ) = vBSW - sym_TNE_BSW + asym_TNE_BSW; const real_t vel_TNW_BSE = -velX + velY + velZ; const real_t sym_TNW_BSE = lambda_e_scaled * ( vTNW + vBSE - fac3 * vel_TNW_BSE * vel_TNW_BSE - t3x2 * feq_common ); - const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - real_t(3.0) * t3x2 * vel_TNW_BSE ); + const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - 3.0_r * t3x2 * vel_TNW_BSE ); dst->get( x, y, z, Stencil_T::idx[TNW] ) = vTNW - sym_TNW_BSE - asym_TNW_BSE; dst->get( x, y, z, Stencil_T::idx[BSE] ) = vBSE - sym_TNW_BSE + asym_TNW_BSE; const real_t vel_TSE_BNW = velX - velY + velZ; const real_t sym_TSE_BNW = lambda_e_scaled * ( vTSE + vBNW - fac3 * vel_TSE_BNW * vel_TSE_BNW - t3x2 * feq_common ); - const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - real_t(3.0) * t3x2 * vel_TSE_BNW ); + const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - 3.0_r * t3x2 * vel_TSE_BNW ); dst->get( x, y, z, Stencil_T::idx[TSE] ) = vTSE - sym_TSE_BNW - asym_TSE_BNW; dst->get( x, y, z, Stencil_T::idx[BNW] ) = vBNW - sym_TSE_BNW + asym_TSE_BNW; const real_t vel_TSW_BNE = - velX - velY + velZ; const real_t sym_TSW_BNE = lambda_e_scaled * ( vTSW + vBNE - fac3 * vel_TSW_BNE * vel_TSW_BNE - t3x2 * feq_common ); - const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - real_t(3.0) * t3x2 * vel_TSW_BNE ); + const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - 3.0_r * t3x2 * vel_TSW_BNE ); dst->get( x, y, z, Stencil_T::idx[TSW] ) = vTSW - sym_TSW_BNE - asym_TSW_BNE; dst->get( x, y, z, Stencil_T::idx[BNE] ) = vBNE - sym_TSW_BNE + asym_TSW_BNE; @@ -949,19 +949,19 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(8.0) / real_t(27.0); // 8/27 for C - const real_t t1x2 = real_t(2.0) / real_t(27.0) * real_t(2.0); // 2/27 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(54.0) * real_t(2.0); // 1/54 * 2 else - const real_t t3x2 = real_t(1.0) / real_t(216.0)* real_t(2.0); // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE + const real_t t0 = 8.0_r / 27.0_r; // 8/27 for C + const real_t t1x2 = 2.0_r / 27.0_r * 2.0_r; // 2/27 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 54.0_r * 2.0_r; // 1/54 * 2 else + const real_t t3x2 = 1.0_r / 216.0_r* 2.0_r; // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; const real_t fac3 = t3x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -973,84 +973,84 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D3Q27_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - src->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common; + src->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); src->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); src->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); src->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); src->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); src->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; src->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); src->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; src->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); src->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B; src->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B; const real_t vel_TNE_BSW = velX + velY + velZ; const real_t sym_TNE_BSW = lambda_e_scaled * ( vTNE + vBSW - fac3 * vel_TNE_BSW * vel_TNE_BSW - t3x2 * feq_common ); - const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - real_t(3.0) * t3x2 * vel_TNE_BSW ); + const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - 3.0_r * t3x2 * vel_TNE_BSW ); src->get( x, y, z, Stencil_T::idx[TNE] ) = vTNE - sym_TNE_BSW - asym_TNE_BSW; src->get( x, y, z, Stencil_T::idx[BSW] ) = vBSW - sym_TNE_BSW + asym_TNE_BSW; const real_t vel_TNW_BSE = -velX + velY + velZ; const real_t sym_TNW_BSE = lambda_e_scaled * ( vTNW + vBSE - fac3 * vel_TNW_BSE * vel_TNW_BSE - t3x2 * feq_common ); - const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - real_t(3.0) * t3x2 * vel_TNW_BSE ); + const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - 3.0_r * t3x2 * vel_TNW_BSE ); src->get( x, y, z, Stencil_T::idx[TNW] ) = vTNW - sym_TNW_BSE - asym_TNW_BSE; src->get( x, y, z, Stencil_T::idx[BSE] ) = vBSE - sym_TNW_BSE + asym_TNW_BSE; const real_t vel_TSE_BNW = velX - velY + velZ; const real_t sym_TSE_BNW = lambda_e_scaled * ( vTSE + vBNW - fac3 * vel_TSE_BNW * vel_TSE_BNW - t3x2 * feq_common ); - const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - real_t(3.0) * t3x2 * vel_TSE_BNW ); + const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - 3.0_r * t3x2 * vel_TSE_BNW ); src->get( x, y, z, Stencil_T::idx[TSE] ) = vTSE - sym_TSE_BNW - asym_TSE_BNW; src->get( x, y, z, Stencil_T::idx[BNW] ) = vBNW - sym_TSE_BNW + asym_TSE_BNW; const real_t vel_TSW_BNE = - velX - velY + velZ; const real_t sym_TSW_BNE = lambda_e_scaled * ( vTSW + vBNE - fac3 * vel_TSW_BNE * vel_TSW_BNE - t3x2 * feq_common ); - const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - real_t(3.0) * t3x2 * vel_TSW_BNE ); + const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - 3.0_r * t3x2 * vel_TSW_BNE ); src->get( x, y, z, Stencil_T::idx[TSW] ) = vTSW - sym_TSW_BNE - asym_TSW_BNE; src->get( x, y, z, Stencil_T::idx[BNE] ) = vBNE - sym_TSW_BNE + asym_TSW_BNE; } @@ -1084,16 +1084,16 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(8.0) / real_t(27.0); // 8/27 for C - const real_t t1x2_0 = real_t(2.0) / real_t(27.0) * real_t(2.0); // 2/27 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(54.0) * real_t(2.0); // 1/54 * 2 else - const real_t t3x2_0 = real_t(1.0) / real_t(216.0) * real_t(2.0); // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE + const real_t t0_0 = 8.0_r / 27.0_r; // 8/27 for C + const real_t t1x2_0 = 2.0_r / 27.0_r * 2.0_r; // 2/27 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 54.0_r * 2.0_r; // 1/54 * 2 else + const real_t t3x2_0 = 1.0_r / 216.0_r * 2.0_r; // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1107,46 +1107,46 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho ); - const real_t feq_common = real_t(1.0) - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = 1.0_r - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common; + dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common; const real_t t2x2 = t2x2_0 * rho; const real_t fac2 = t2x2 * inv2csq2; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS; @@ -1154,17 +1154,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t fac1 = t1x2 * inv2csq2; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); dst->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); dst->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); dst->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B; @@ -1173,25 +1173,25 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t vel_TNE_BSW = velX + velY + velZ; const real_t sym_TNE_BSW = lambda_e_scaled * ( vTNE + vBSW - fac3 * vel_TNE_BSW * vel_TNE_BSW - t3x2 * feq_common ); - const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - real_t(3.0) * t3x2 * vel_TNE_BSW ); + const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - 3.0_r * t3x2 * vel_TNE_BSW ); dst->get( x, y, z, Stencil_T::idx[TNE] ) = vTNE - sym_TNE_BSW - asym_TNE_BSW; dst->get( x, y, z, Stencil_T::idx[BSW] ) = vBSW - sym_TNE_BSW + asym_TNE_BSW; const real_t vel_TNW_BSE = -velX + velY + velZ; const real_t sym_TNW_BSE = lambda_e_scaled * ( vTNW + vBSE - fac3 * vel_TNW_BSE * vel_TNW_BSE - t3x2 * feq_common ); - const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - real_t(3.0) * t3x2 * vel_TNW_BSE ); + const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - 3.0_r * t3x2 * vel_TNW_BSE ); dst->get( x, y, z, Stencil_T::idx[TNW] ) = vTNW - sym_TNW_BSE - asym_TNW_BSE; dst->get( x, y, z, Stencil_T::idx[BSE] ) = vBSE - sym_TNW_BSE + asym_TNW_BSE; const real_t vel_TSE_BNW = velX - velY + velZ; const real_t sym_TSE_BNW = lambda_e_scaled * ( vTSE + vBNW - fac3 * vel_TSE_BNW * vel_TSE_BNW - t3x2 * feq_common ); - const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - real_t(3.0) * t3x2 * vel_TSE_BNW ); + const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - 3.0_r * t3x2 * vel_TSE_BNW ); dst->get( x, y, z, Stencil_T::idx[TSE] ) = vTSE - sym_TSE_BNW - asym_TSE_BNW; dst->get( x, y, z, Stencil_T::idx[BNW] ) = vBNW - sym_TSE_BNW + asym_TSE_BNW; const real_t vel_TSW_BNE = - velX - velY + velZ; const real_t sym_TSW_BNE = lambda_e_scaled * ( vTSW + vBNE - fac3 * vel_TSW_BNE * vel_TSW_BNE - t3x2 * feq_common ); - const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - real_t(3.0) * t3x2 * vel_TSW_BNE ); + const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - 3.0_r * t3x2 * vel_TSW_BNE ); dst->get( x, y, z, Stencil_T::idx[TSW] ) = vTSW - sym_TSW_BNE - asym_TSW_BNE; dst->get( x, y, z, Stencil_T::idx[BNE] ) = vBNE - sym_TSW_BNE + asym_TSW_BNE; } @@ -1206,16 +1206,16 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(8.0) / real_t(27.0); // 8/27 for C - const real_t t1x2_0 = real_t(2.0) / real_t(27.0) * real_t(2.0); // 2/27 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(54.0) * real_t(2.0); // 1/54 * 2 else - const real_t t3x2_0 = real_t(1.0) / real_t(216.0) * real_t(2.0); // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE + const real_t t0_0 = 8.0_r / 27.0_r; // 8/27 for C + const real_t t1x2_0 = 2.0_r / 27.0_r * 2.0_r; // 2/27 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 54.0_r * 2.0_r; // 1/54 * 2 else + const real_t t3x2_0 = 1.0_r / 216.0_r * 2.0_r; // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1229,46 +1229,46 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho ); - const real_t feq_common = real_t(1.0) - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = 1.0_r - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - src->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common; + src->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common; const real_t t2x2 = t2x2_0 * rho; const real_t fac2 = t2x2 * inv2csq2; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); src->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); src->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); src->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); src->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS; @@ -1276,17 +1276,17 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t fac1 = t1x2 * inv2csq2; const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); src->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S; src->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); src->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W; src->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); src->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B; src->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B; @@ -1295,25 +1295,25 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t vel_TNE_BSW = velX + velY + velZ; const real_t sym_TNE_BSW = lambda_e_scaled * ( vTNE + vBSW - fac3 * vel_TNE_BSW * vel_TNE_BSW - t3x2 * feq_common ); - const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - real_t(3.0) * t3x2 * vel_TNE_BSW ); + const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - 3.0_r * t3x2 * vel_TNE_BSW ); src->get( x, y, z, Stencil_T::idx[TNE] ) = vTNE - sym_TNE_BSW - asym_TNE_BSW; src->get( x, y, z, Stencil_T::idx[BSW] ) = vBSW - sym_TNE_BSW + asym_TNE_BSW; const real_t vel_TNW_BSE = -velX + velY + velZ; const real_t sym_TNW_BSE = lambda_e_scaled * ( vTNW + vBSE - fac3 * vel_TNW_BSE * vel_TNW_BSE - t3x2 * feq_common ); - const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - real_t(3.0) * t3x2 * vel_TNW_BSE ); + const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - 3.0_r * t3x2 * vel_TNW_BSE ); src->get( x, y, z, Stencil_T::idx[TNW] ) = vTNW - sym_TNW_BSE - asym_TNW_BSE; src->get( x, y, z, Stencil_T::idx[BSE] ) = vBSE - sym_TNW_BSE + asym_TNW_BSE; const real_t vel_TSE_BNW = velX - velY + velZ; const real_t sym_TSE_BNW = lambda_e_scaled * ( vTSE + vBNW - fac3 * vel_TSE_BNW * vel_TSE_BNW - t3x2 * feq_common ); - const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - real_t(3.0) * t3x2 * vel_TSE_BNW ); + const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - 3.0_r * t3x2 * vel_TSE_BNW ); src->get( x, y, z, Stencil_T::idx[TSE] ) = vTSE - sym_TSE_BNW - asym_TSE_BNW; src->get( x, y, z, Stencil_T::idx[BNW] ) = vBNW - sym_TSE_BNW + asym_TSE_BNW; const real_t vel_TSW_BNE = - velX - velY + velZ; const real_t sym_TSW_BNE = lambda_e_scaled * ( vTSW + vBNE - fac3 * vel_TSW_BNE * vel_TSW_BNE - t3x2 * feq_common ); - const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - real_t(3.0) * t3x2 * vel_TSW_BNE ); + const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - 3.0_r * t3x2 * vel_TSW_BNE ); src->get( x, y, z, Stencil_T::idx[TSW] ) = vTSW - sym_TSW_BNE - asym_TSW_BNE; src->get( x, y, z, Stencil_T::idx[BNE] ) = vBNE - sym_TSW_BNE + asym_TSW_BNE; } @@ -1347,23 +1347,23 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE const real_t lambda_e = src->latticeModel().collisionModel().lambda_e(); const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); - const real_t three_w1( real_t(2) / real_t(9) ); - const real_t three_w2( real_t(1) / real_t(18) ); - const real_t three_w3( real_t(1) / real_t(72) ); + const real_t three_w1( 2_r / 9_r ); + const real_t three_w2( 1_r / 18_r ); + const real_t three_w3( 1_r / 72_r ); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(8.0) / real_t(27.0); // 8/27 for C - const real_t t1x2 = real_t(2.0) / real_t(27.0) * real_t(2.0); // 2/27 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(54.0) * real_t(2.0); // 1/54 * 2 else - const real_t t3x2 = real_t(1.0) / real_t(216.0) * real_t(2.0); // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE + const real_t t0 = 8.0_r / 27.0_r; // 8/27 for C + const real_t t1x2 = 2.0_r / 27.0_r * 2.0_r; // 2/27 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 54.0_r * 2.0_r; // 1/54 * 2 else + const real_t t3x2 = 1.0_r / 216.0_r * 2.0_r; // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; const real_t fac3 = t3x2 * inv2csq2; - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1375,86 +1375,86 @@ WALBERLA_LBM_CELLWISE_SWEEP_STREAM_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPE WALBERLA_LBM_CELLWISE_SWEEP_D3Q27_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common;// no force term + dst->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common;// no force term const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW + three_w2 * ( force[0] + force[1] ); dst->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW - three_w2 * ( force[0] + force[1] ); const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW + three_w2 * ( force[0] - force[1] ); dst->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW - three_w2 * ( force[0] - force[1] ); const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW + three_w2 * ( force[0] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW - three_w2 * ( force[0] + force[2] ); const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW + three_w2 * ( force[0] - force[2] ); dst->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW - three_w2 * ( force[0] - force[2] ); const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS + three_w2 * ( force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS - three_w2 * ( force[1] + force[2] ); const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS + three_w2 * ( force[1] - force[2] ); dst->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS - three_w2 * ( force[1] - force[2] ); const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); dst->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S + three_w1 * force[1]; dst->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S - three_w1 * force[1]; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); dst->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W + three_w1 * force[0]; dst->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W - three_w1 * force[0]; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); dst->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B + three_w1 * force[2]; dst->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B - three_w1 * force[2]; const real_t vel_TNE_BSW = velX + velY + velZ; const real_t sym_TNE_BSW = lambda_e_scaled * ( vTNE + vBSW - fac3 * vel_TNE_BSW * vel_TNE_BSW - t3x2 * feq_common ); - const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - real_t(3.0) * t3x2 * vel_TNE_BSW ); + const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - 3.0_r * t3x2 * vel_TNE_BSW ); dst->get( x, y, z, Stencil_T::idx[TNE] ) = vTNE - sym_TNE_BSW - asym_TNE_BSW + three_w3 * ( force[0] + force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BSW] ) = vBSW - sym_TNE_BSW + asym_TNE_BSW - three_w3 * ( force[0] + force[1] + force[2] ); const real_t vel_TNW_BSE = -velX + velY + velZ; const real_t sym_TNW_BSE = lambda_e_scaled * ( vTNW + vBSE - fac3 * vel_TNW_BSE * vel_TNW_BSE - t3x2 * feq_common ); - const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - real_t(3.0) * t3x2 * vel_TNW_BSE ); + const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - 3.0_r * t3x2 * vel_TNW_BSE ); dst->get( x, y, z, Stencil_T::idx[TNW] ) = vTNW - sym_TNW_BSE - asym_TNW_BSE + three_w3 * ( -force[0] + force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BSE] ) = vBSE - sym_TNW_BSE + asym_TNW_BSE - three_w3 * ( -force[0] + force[1] + force[2] ); const real_t vel_TSE_BNW = velX - velY + velZ; const real_t sym_TSE_BNW = lambda_e_scaled * ( vTSE + vBNW - fac3 * vel_TSE_BNW * vel_TSE_BNW - t3x2 * feq_common ); - const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - real_t(3.0) * t3x2 * vel_TSE_BNW ); + const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - 3.0_r * t3x2 * vel_TSE_BNW ); dst->get( x, y, z, Stencil_T::idx[TSE] ) = vTSE - sym_TSE_BNW - asym_TSE_BNW + three_w3 * ( force[0] - force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BNW] ) = vBNW - sym_TSE_BNW + asym_TSE_BNW - three_w3 * ( force[0] - force[1] + force[2] ); const real_t vel_TSW_BNE = - velX - velY + velZ; const real_t sym_TSW_BNE = lambda_e_scaled * ( vTSW + vBNE - fac3 * vel_TSW_BNE * vel_TSW_BNE - t3x2 * feq_common ); - const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - real_t(3.0) * t3x2 * vel_TSW_BNE ); + const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - 3.0_r * t3x2 * vel_TSW_BNE ); dst->get( x, y, z, Stencil_T::idx[TSW] ) = vTSW - sym_TSW_BNE - asym_TSW_BNE + three_w3 * ( -force[0] - force[1] + force[2] ); dst->get( x, y, z, Stencil_T::idx[BNE] ) = vBNE - sym_TSW_BNE + asym_TSW_BNE - three_w3 * ( -force[0] - force[1] + force[2] ); } @@ -1469,24 +1469,24 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA const real_t lambda_e = src->latticeModel().collisionModel().lambda_e(); const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); - const real_t three_w1( real_t(2) / real_t(9) ); - const real_t three_w2( real_t(1) / real_t(18) ); - const real_t three_w3( real_t(1) / real_t(72) ); + const real_t three_w1( 2_r / 9_r ); + const real_t three_w2( 1_r / 18_r ); + const real_t three_w3( 1_r / 72_r ); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(8.0) / real_t(27.0); // 8/27 for C - const real_t t1x2 = real_t(2.0) / real_t(27.0) * real_t(2.0); // 2/27 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(54.0) * real_t(2.0); // 1/54 * 2 else - const real_t t3x2 = real_t(1.0) / real_t(216.0) * real_t(2.0); // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE + const real_t t0 = 8.0_r / 27.0_r; // 8/27 for C + const real_t t1x2 = 2.0_r / 27.0_r * 2.0_r; // 2/27 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 54.0_r * 2.0_r; // 1/54 * 2 else + const real_t t3x2 = 1.0_r / 216.0_r * 2.0_r; // 1/216 for TNE,BSW,TNW,BSE,TSE,BNW,TSW,BNE - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; const real_t fac3 = t3x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, @@ -1498,86 +1498,86 @@ WALBERLA_LBM_CELLWISE_SWEEP_COLLIDE_HEAD( WALBERLA_LBM_CELLWISE_SWEEP_SPECIALIZA WALBERLA_LBM_CELLWISE_SWEEP_D3Q27_DENSITY_VELOCITY_INCOMP() - this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + real_t(1) ); + this->densityVelocityOut( x, y, z, lm, Vector3<real_t>( velX, velY, velZ ), rho + 1_r ); - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - src->get( x, y, z, Stencil_T::idx[C] ) = vC * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common; // no force term + src->get( x, y, z, Stencil_T::idx[C] ) = vC * (1.0_r - lambda_e) + lambda_e * t0 * feq_common; // no force term const Vector3< real_t > & force = src->latticeModel().forceModel().force(x,y,z); const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled * ( vNE + vSW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( vNE - vSW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil_T::idx[NE] ) = vNE - sym_NE_SW - asym_NE_SW + three_w2 * ( force[0] + force[1] ); src->get( x, y, z, Stencil_T::idx[SW] ) = vSW - sym_NE_SW + asym_NE_SW - three_w2 * ( force[0] + force[1] ); const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled * ( vSE + vNW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( vSE - vNW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil_T::idx[SE] ) = vSE - sym_SE_NW - asym_SE_NW + three_w2 * ( force[0] - force[1] ); src->get( x, y, z, Stencil_T::idx[NW] ) = vNW - sym_SE_NW + asym_SE_NW - three_w2 * ( force[0] - force[1] ); const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled * ( vTE + vBW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( vTE - vBW - 3.0_r * t2x2 * velXPZ ); src->get( x, y, z, Stencil_T::idx[TE] ) = vTE - sym_TE_BW - asym_TE_BW + three_w2 * ( force[0] + force[2] ); src->get( x, y, z, Stencil_T::idx[BW] ) = vBW - sym_TE_BW + asym_TE_BW - three_w2 * ( force[0] + force[2] ); const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled * ( vBE + vTW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( vBE - vTW - 3.0_r * t2x2 * velXMZ ); src->get( x, y, z, Stencil_T::idx[BE] ) = vBE - sym_BE_TW - asym_BE_TW + three_w2 * ( force[0] - force[2] ); src->get( x, y, z, Stencil_T::idx[TW] ) = vTW - sym_BE_TW + asym_BE_TW - three_w2 * ( force[0] - force[2] ); const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled * ( vTN + vBS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( vTN - vBS - 3.0_r * t2x2 * velYPZ ); src->get( x, y, z, Stencil_T::idx[TN] ) = vTN - sym_TN_BS - asym_TN_BS + three_w2 * ( force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BS] ) = vBS - sym_TN_BS + asym_TN_BS - three_w2 * ( force[1] + force[2] ); const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled * ( vBN + vTS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( vBN - vTS - 3.0_r * t2x2 * velYMZ ); src->get( x, y, z, Stencil_T::idx[BN] ) = vBN - sym_BN_TS - asym_BN_TS + three_w2 * ( force[1] - force[2] ); src->get( x, y, z, Stencil_T::idx[TS] ) = vTS - sym_BN_TS + asym_BN_TS - three_w2 * ( force[1] - force[2] ); const real_t sym_N_S = lambda_e_scaled * ( vN + vS - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled * ( vN - vS - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled * ( vN - vS - 3.0_r * t1x2 * velY ); src->get( x, y, z, Stencil_T::idx[N] ) = vN - sym_N_S - asym_N_S + three_w1 * force[1]; src->get( x, y, z, Stencil_T::idx[S] ) = vS - sym_N_S + asym_N_S - three_w1 * force[1]; const real_t sym_E_W = lambda_e_scaled * ( vE + vW - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled * ( vE - vW - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled * ( vE - vW - 3.0_r * t1x2 * velX ); src->get( x, y, z, Stencil_T::idx[E] ) = vE - sym_E_W - asym_E_W + three_w1 * force[0]; src->get( x, y, z, Stencil_T::idx[W] ) = vW - sym_E_W + asym_E_W - three_w1 * force[0]; const real_t sym_T_B = lambda_e_scaled * ( vT + vB - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled * ( vT - vB - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled * ( vT - vB - 3.0_r * t1x2 * velZ ); src->get( x, y, z, Stencil_T::idx[T] ) = vT - sym_T_B - asym_T_B + three_w1 * force[2]; src->get( x, y, z, Stencil_T::idx[B] ) = vB - sym_T_B + asym_T_B - three_w1 * force[2]; const real_t vel_TNE_BSW = velX + velY + velZ; const real_t sym_TNE_BSW = lambda_e_scaled * ( vTNE + vBSW - fac3 * vel_TNE_BSW * vel_TNE_BSW - t3x2 * feq_common ); - const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - real_t(3.0) * t3x2 * vel_TNE_BSW ); + const real_t asym_TNE_BSW = lambda_d_scaled * ( vTNE - vBSW - 3.0_r * t3x2 * vel_TNE_BSW ); src->get( x, y, z, Stencil_T::idx[TNE] ) = vTNE - sym_TNE_BSW - asym_TNE_BSW + three_w3 * ( force[0] + force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BSW] ) = vBSW - sym_TNE_BSW + asym_TNE_BSW - three_w3 * ( force[0] + force[1] + force[2] ); const real_t vel_TNW_BSE = -velX + velY + velZ; const real_t sym_TNW_BSE = lambda_e_scaled * ( vTNW + vBSE - fac3 * vel_TNW_BSE * vel_TNW_BSE - t3x2 * feq_common ); - const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - real_t(3.0) * t3x2 * vel_TNW_BSE ); + const real_t asym_TNW_BSE = lambda_d_scaled * ( vTNW - vBSE - 3.0_r * t3x2 * vel_TNW_BSE ); src->get( x, y, z, Stencil_T::idx[TNW] ) = vTNW - sym_TNW_BSE - asym_TNW_BSE + three_w3 * ( -force[0] + force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BSE] ) = vBSE - sym_TNW_BSE + asym_TNW_BSE - three_w3 * ( -force[0] + force[1] + force[2] ); const real_t vel_TSE_BNW = velX - velY + velZ; const real_t sym_TSE_BNW = lambda_e_scaled * ( vTSE + vBNW - fac3 * vel_TSE_BNW * vel_TSE_BNW - t3x2 * feq_common ); - const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - real_t(3.0) * t3x2 * vel_TSE_BNW ); + const real_t asym_TSE_BNW = lambda_d_scaled * ( vTSE - vBNW - 3.0_r * t3x2 * vel_TSE_BNW ); src->get( x, y, z, Stencil_T::idx[TSE] ) = vTSE - sym_TSE_BNW - asym_TSE_BNW + three_w3 * ( force[0] - force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BNW] ) = vBNW - sym_TSE_BNW + asym_TSE_BNW - three_w3 * ( force[0] - force[1] + force[2] ); const real_t vel_TSW_BNE = - velX - velY + velZ; const real_t sym_TSW_BNE = lambda_e_scaled * ( vTSW + vBNE - fac3 * vel_TSW_BNE * vel_TSW_BNE - t3x2 * feq_common ); - const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - real_t(3.0) * t3x2 * vel_TSW_BNE ); + const real_t asym_TSW_BNE = lambda_d_scaled * ( vTSW - vBNE - 3.0_r * t3x2 * vel_TSW_BNE ); src->get( x, y, z, Stencil_T::idx[TSW] ) = vTSW - sym_TSW_BNE - asym_TSW_BNE + three_w3 * ( -force[0] - force[1] + force[2] ); src->get( x, y, z, Stencil_T::idx[BNE] ) = vBNE - sym_TSW_BNE + asym_TSW_BNE - three_w3 * ( -force[0] - force[1] + force[2] ); } diff --git a/src/lbm/trt/SplitPureSweep.impl.h b/src/lbm/trt/SplitPureSweep.impl.h index 0c60f11b..794de541 100644 --- a/src/lbm/trt/SplitPureSweep.impl.h +++ b/src/lbm/trt/SplitPureSweep.impl.h @@ -118,17 +118,17 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -186,9 +186,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ velY[x] = velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x]; velZ[x] = velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x]; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + dC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; ) real_t * WALBERLA_RESTRICT dNE = &dst->get(0,y,z,Stencil::idx[NE]); @@ -198,7 +198,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2 * velXPY ); dNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; dSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -211,7 +211,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2 * velXMY ); dSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; dNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -224,7 +224,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2 * velXPZ ); dTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; dBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -237,7 +237,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2 * velXMZ ); dBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; dTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -250,7 +250,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2 * velYPZ ); dTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; dBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -263,7 +263,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2 * velYMZ ); dBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; dTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -275,7 +275,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2 * velY[x] ); dN[x] = pN[x] - sym_N_S - asym_N_S; dS[x] = pS[x] - sym_N_S + asym_N_S; @@ -287,7 +287,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2 * velX[x] ); dE[x] = pE[x] - sym_E_W - asym_E_W; dW[x] = pW[x] - sym_E_W + asym_E_W; @@ -299,7 +299,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2 * velZ[x] ); dT[x] = pT[x] - sym_T_B - asym_T_B; dB[x] = pB[x] - sym_T_B + asym_T_B; @@ -345,9 +345,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ velY[x] = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; velZ[x] = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; } for( cell_idx_t x = 0; x != xSize; ++x ) @@ -357,7 +357,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -370,7 +370,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -383,7 +383,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -396,7 +396,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -409,7 +409,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -422,7 +422,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -434,7 +434,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_S = src->get(x, y+1, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2 * velY[x] ); dst->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -446,7 +446,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_W = src->get(x+1, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2 * velX[x] ); dst->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -458,7 +458,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_B = src->get(x, y, z+1, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2 * velZ[x] ); dst->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; @@ -521,17 +521,17 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -587,16 +587,16 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ velY[x] = velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x]; velZ[x] = velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x]; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - pC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + pC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; ) X_LOOP ( const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2 * velXPY ); pNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; pSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -606,7 +606,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2 * velXMY ); pSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; pNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -616,7 +616,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2 * velXPZ ); pTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; pBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -626,7 +626,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2 * velXMZ ); pBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; pTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -636,7 +636,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2 * velYPZ ); pTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; pBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -646,7 +646,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2 * velYMZ ); pBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; pTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -655,7 +655,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2 * velY[x] ); pN[x] = pN[x] - sym_N_S - asym_N_S; pS[x] = pS[x] - sym_N_S + asym_N_S; @@ -664,7 +664,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2 * velX[x] ); pE[x] = pE[x] - sym_E_W - asym_E_W; pW[x] = pW[x] - sym_E_W + asym_E_W; @@ -673,7 +673,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2 * velZ[x] ); pT[x] = pT[x] - sym_T_B - asym_T_B; pB[x] = pB[x] - sym_T_B + asym_T_B; @@ -719,9 +719,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ velY[x] = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; velZ[x] = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; } for( cell_idx_t x = 0; x != xSize; ++x ) @@ -731,7 +731,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -744,7 +744,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -757,7 +757,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2 * velXPZ ); src->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -770,7 +770,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2 * velXMZ ); src->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -783,7 +783,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2 * velYPZ ); src->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -796,7 +796,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2 * velYMZ ); src->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -808,7 +808,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_S = src->get( x, y, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2 * velY[x] ); src->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; src->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -820,7 +820,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_W = src->get( x, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2 * velX[x] ); src->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; src->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -832,7 +832,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_B = src->get( x, y, z, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2 * velZ[x] ); src->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; src->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; @@ -916,15 +916,15 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2_0 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0_0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2_0 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -982,7 +982,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; const real_t rho = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = invRho * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -993,9 +993,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + dC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; ) real_t * WALBERLA_RESTRICT dNE = &dst->get(0,y,z,Stencil::idx[NE]); @@ -1005,7 +1005,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2[x] * velXPY ); dNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; dSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -1018,7 +1018,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2[x] * velXMY ); dSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; dNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -1031,7 +1031,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2[x] * velXPZ ); dTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; dBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -1044,7 +1044,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2[x] * velXMZ ); dBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; dTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -1057,7 +1057,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2[x] * velYPZ ); dTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; dBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -1070,7 +1070,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2[x] * velYMZ ); dBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; dTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -1082,7 +1082,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2[x] * velY[x] ); dN[x] = pN[x] - sym_N_S - asym_N_S; dS[x] = pS[x] - sym_N_S + asym_N_S; @@ -1094,7 +1094,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2[x] * velX[x] ); dE[x] = pE[x] - sym_E_W - asym_E_W; dW[x] = pW[x] - sym_E_W + asym_E_W; @@ -1106,7 +1106,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2[x] * velZ[x] ); dT[x] = pT[x] - sym_T_B - asym_T_B; dB[x] = pB[x] - sym_T_B + asym_T_B; @@ -1147,7 +1147,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; const real_t rho = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = invRho * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -1158,9 +1158,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; } for( cell_idx_t x = 0; x != xSize; ++x ) @@ -1170,7 +1170,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2[x] * velXPY ); dst->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -1183,7 +1183,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2[x] * velXMY ); dst->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -1196,7 +1196,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2[x] * velXPZ ); dst->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -1209,7 +1209,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2[x] * velXMZ ); dst->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -1222,7 +1222,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2[x] * velYPZ ); dst->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -1235,7 +1235,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2[x] * velYMZ ); dst->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -1247,7 +1247,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_S = src->get(x, y+1, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2[x] * velY[x] ); dst->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -1259,7 +1259,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_W = src->get(x+1, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2[x] * velX[x] ); dst->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -1271,7 +1271,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_B = src->get(x, y, z+1, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2[x] * velZ[x] ); dst->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; @@ -1338,15 +1338,15 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2_0 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0_0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2_0 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -1402,7 +1402,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; const real_t rho = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = invRho * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -1413,16 +1413,16 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - pC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + pC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; ) X_LOOP ( const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2[x] * velXPY ); pNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; pSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -1432,7 +1432,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2[x] * velXMY ); pSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; pNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -1442,7 +1442,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2[x] * velXPZ ); pTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; pBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -1452,7 +1452,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2[x] * velXMZ ); pBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; pTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -1462,7 +1462,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2[x] * velYPZ ); pTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; pBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -1472,7 +1472,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ ( const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2[x] * velYMZ ); pBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; pTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -1481,7 +1481,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2[x] * velY[x] ); pN[x] = pN[x] - sym_N_S - asym_N_S; pS[x] = pS[x] - sym_N_S + asym_N_S; @@ -1490,7 +1490,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2[x] * velX[x] ); pE[x] = pE[x] - sym_E_W - asym_E_W; pW[x] = pW[x] - sym_E_W + asym_E_W; @@ -1499,7 +1499,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ X_LOOP ( const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2[x] * velZ[x] ); pT[x] = pT[x] - sym_T_B - asym_T_B; pB[x] = pB[x] - sym_T_B + asym_T_B; @@ -1540,7 +1540,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; const real_t rho = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = invRho * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -1551,9 +1551,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; } for( cell_idx_t x = 0; x != xSize; ++x ) @@ -1563,7 +1563,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2[x] * velXPY ); src->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -1576,7 +1576,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2[x] * velXMY ); src->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -1589,7 +1589,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2[x] * velXPZ ); src->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -1602,7 +1602,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2[x] * velXMZ ); src->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -1615,7 +1615,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2[x] * velYPZ ); src->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -1628,7 +1628,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2[x] * velYMZ ); src->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -1640,7 +1640,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_S = src->get( x, y, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2[x] * velY[x] ); src->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; src->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -1652,7 +1652,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_W = src->get( x, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2[x] * velX[x] ); src->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; src->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -1664,7 +1664,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ const real_t dd_tmp_B = src->get( x, y, z, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2[x] * velZ[x] ); src->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; src->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; diff --git a/src/lbm/trt/SplitSweep.impl.h b/src/lbm/trt/SplitSweep.impl.h index fed687b1..c7c448f9 100644 --- a/src/lbm/trt/SplitSweep.impl.h +++ b/src/lbm/trt/SplitSweep.impl.h @@ -112,17 +112,17 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -184,9 +184,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: velY[x] = velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x]; velZ[x] = velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x]; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + dC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; perform_lbm[x] = true; } @@ -202,7 +202,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2 * velXPY ); dNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; dSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -218,7 +218,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2 * velXMY ); dSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; dNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -234,7 +234,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2 * velXPZ ); dTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; dBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -250,7 +250,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2 * velXMZ ); dBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; dTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -266,7 +266,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2 * velYPZ ); dTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; dBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -282,7 +282,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2 * velYMZ ); dBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; dTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -297,7 +297,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2 * velY[x] ); dN[x] = pN[x] - sym_N_S - asym_N_S; dS[x] = pS[x] - sym_N_S + asym_N_S; @@ -312,7 +312,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2 * velX[x] ); dE[x] = pE[x] - sym_E_W - asym_E_W; dW[x] = pW[x] - sym_E_W + asym_E_W; @@ -327,7 +327,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2 * velZ[x] ); dT[x] = pT[x] - sym_T_B - asym_T_B; dB[x] = pB[x] - sym_T_B + asym_T_B; @@ -376,9 +376,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: velY[x] = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; velZ[x] = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; perform_lbm[x] = true; } @@ -394,7 +394,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -410,7 +410,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -426,7 +426,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -442,7 +442,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -458,7 +458,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -474,7 +474,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -489,7 +489,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_S = src->get(x, y+1, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2 * velY[x] ); dst->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -504,7 +504,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_W = src->get(x+1, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2 * velX[x] ); dst->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -519,7 +519,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_B = src->get(x, y, z+1, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2 * velZ[x] ); dst->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; @@ -589,17 +589,17 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -659,9 +659,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: velY[x] = velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x]; velZ[x] = velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x]; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - pC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + pC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; perform_lbm[x] = true; } @@ -674,7 +674,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2 * velXPY ); pNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; pSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -687,7 +687,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2 * velXMY ); pSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; pNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -700,7 +700,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2 * velXPZ ); pTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; pBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -713,7 +713,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2 * velXMZ ); pBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; pTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -726,7 +726,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2 * velYPZ ); pTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; pBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -739,7 +739,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2 * velYMZ ); pBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; pTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -751,7 +751,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2 * velY[x] ); pN[x] = pN[x] - sym_N_S - asym_N_S; pS[x] = pS[x] - sym_N_S + asym_N_S; @@ -763,7 +763,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2 * velX[x] ); pE[x] = pE[x] - sym_E_W - asym_E_W; pW[x] = pW[x] - sym_E_W + asym_E_W; @@ -775,7 +775,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2 * velZ[x] ); pT[x] = pT[x] - sym_T_B - asym_T_B; pB[x] = pB[x] - sym_T_B + asym_T_B; @@ -824,9 +824,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: velY[x] = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; velZ[x] = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; perform_lbm[x] = true; } @@ -842,7 +842,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -858,7 +858,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -874,7 +874,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2 * velXPZ ); src->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -890,7 +890,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2 * velXMZ ); src->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -906,7 +906,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2 * velYPZ ); src->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -922,7 +922,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2 * velYMZ ); src->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -937,7 +937,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_S = src->get( x, y, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2 * velY[x] ); src->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; src->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -952,7 +952,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_W = src->get( x, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2 * velX[x] ); src->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; src->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -967,7 +967,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_B = src->get( x, y, z, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2 * velZ[x] ); src->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; src->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; @@ -1054,15 +1054,15 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2_0 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0_0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2_0 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -1124,7 +1124,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; const real_t rho = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = invRho * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -1135,9 +1135,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + dC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; perform_lbm[x] = true; } @@ -1153,7 +1153,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2[x] * velXPY ); dNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; dSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -1169,7 +1169,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2[x] * velXMY ); dSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; dNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -1185,7 +1185,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2[x] * velXPZ ); dTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; dBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -1201,7 +1201,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2[x] * velXMZ ); dBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; dTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -1217,7 +1217,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2[x] * velYPZ ); dTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; dBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -1233,7 +1233,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2[x] * velYMZ ); dBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; dTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -1248,7 +1248,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2[x] * velY[x] ); dN[x] = pN[x] - sym_N_S - asym_N_S; dS[x] = pS[x] - sym_N_S + asym_N_S; @@ -1263,7 +1263,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2[x] * velX[x] ); dE[x] = pE[x] - sym_E_W - asym_E_W; dW[x] = pW[x] - sym_E_W + asym_E_W; @@ -1278,7 +1278,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2[x] * velZ[x] ); dT[x] = pT[x] - sym_T_B - asym_T_B; dB[x] = pB[x] - sym_T_B + asym_T_B; @@ -1322,7 +1322,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; const real_t rho = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = invRho * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -1333,9 +1333,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; perform_lbm[x] = true; } @@ -1351,7 +1351,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2[x] * velXPY ); dst->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -1367,7 +1367,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2[x] * velXMY ); dst->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -1383,7 +1383,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2[x] * velXPZ ); dst->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -1399,7 +1399,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2[x] * velXMZ ); dst->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -1415,7 +1415,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2[x] * velYPZ ); dst->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -1431,7 +1431,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2[x] * velYMZ ); dst->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -1446,7 +1446,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_S = src->get(x, y+1, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2[x] * velY[x] ); dst->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -1461,7 +1461,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_W = src->get(x+1, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2[x] * velX[x] ); dst->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -1476,7 +1476,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_B = src->get(x, y, z+1, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2[x] * velZ[x] ); dst->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; @@ -1550,15 +1550,15 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2_0 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0_0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2_0 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -1618,7 +1618,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; const real_t rho = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = invRho * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -1629,9 +1629,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - pC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + pC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; perform_lbm[x] = true; } @@ -1644,7 +1644,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2[x] * velXPY ); pNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; pSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -1657,7 +1657,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2[x] * velXMY ); pSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; pNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -1670,7 +1670,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2[x] * velXPZ ); pTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; pBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -1683,7 +1683,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2[x] * velXMZ ); pBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; pTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -1696,7 +1696,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2[x] * velYPZ ); pTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; pBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -1709,7 +1709,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: { const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2[x] * velYMZ ); pBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; pTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -1721,7 +1721,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2[x] * velY[x] ); pN[x] = pN[x] - sym_N_S - asym_N_S; pS[x] = pS[x] - sym_N_S + asym_N_S; @@ -1733,7 +1733,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2[x] * velX[x] ); pE[x] = pE[x] - sym_E_W - asym_E_W; pW[x] = pW[x] - sym_E_W + asym_E_W; @@ -1745,7 +1745,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: if( perform_lbm[x] ) { const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2[x] * velZ[x] ); pT[x] = pT[x] - sym_T_B - asym_T_B; pB[x] = pB[x] - sym_T_B + asym_T_B; @@ -1789,7 +1789,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; const real_t rho = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = invRho * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -1800,9 +1800,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; perform_lbm[x] = true; } @@ -1818,7 +1818,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2[x] * velXPY ); src->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -1834,7 +1834,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2[x] * velXMY ); src->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -1850,7 +1850,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2[x] * velXPZ ); src->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -1866,7 +1866,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2[x] * velXMZ ); src->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -1882,7 +1882,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2[x] * velYPZ ); src->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -1898,7 +1898,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2[x] * velYMZ ); src->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -1913,7 +1913,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_S = src->get( x, y, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2[x] * velY[x] ); src->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; src->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -1928,7 +1928,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_W = src->get( x, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2[x] * velX[x] ); src->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; src->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -1943,7 +1943,7 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: const real_t dd_tmp_B = src->get( x, y, z, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2[x] * velZ[x] ); src->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; src->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; diff --git a/src/lbm/trt/bluegeneq/SplitPureSweep.impl.h b/src/lbm/trt/bluegeneq/SplitPureSweep.impl.h index ca382109..0761464c 100644 --- a/src/lbm/trt/bluegeneq/SplitPureSweep.impl.h +++ b/src/lbm/trt/bluegeneq/SplitPureSweep.impl.h @@ -127,17 +127,17 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -237,9 +237,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost velY[x] = velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x]; velZ[x] = velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x]; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + dC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; } real_t* dNE = &dst->get(0,y,z,Stencil::idx[NE]); @@ -258,7 +258,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2 * velXPY ); dNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; dSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -280,7 +280,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2 * velXMY ); dSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; dNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -302,7 +302,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2 * velXPZ ); dTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; dBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -324,7 +324,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2 * velXMZ ); dBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; dTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -346,7 +346,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2 * velYPZ ); dTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; dBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -368,7 +368,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2 * velYMZ ); dBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; dTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -389,7 +389,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2 * velY[x] ); dN[x] = pN[x] - sym_N_S - asym_N_S; dS[x] = pS[x] - sym_N_S + asym_N_S; @@ -410,7 +410,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2 * velX[x] ); dE[x] = pE[x] - sym_E_W - asym_E_W; dW[x] = pW[x] - sym_E_W + asym_E_W; @@ -431,7 +431,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2 * velZ[x] ); dT[x] = pT[x] - sym_T_B - asym_T_B; dB[x] = pB[x] - sym_T_B + asym_T_B; @@ -485,9 +485,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost velY[x] = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; velZ[x] = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; } for( cell_idx_t x = 0; x != xSize; ++x ) @@ -497,7 +497,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -510,7 +510,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -523,7 +523,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -536,7 +536,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -549,7 +549,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -562,7 +562,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -574,7 +574,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_S = src->get(x, y+1, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2 * velY[x] ); dst->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -586,7 +586,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_W = src->get(x+1, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2 * velX[x] ); dst->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -598,7 +598,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_B = src->get(x, y, z+1, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2 * velZ[x] ); dst->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; @@ -663,17 +663,17 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function const real_t fac1 = t1x2 * inv2csq2; const real_t fac2 = t2x2 * inv2csq2; // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -769,9 +769,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost velY[x] = velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x]; velZ[x] = velZ_trm + pTN[x] + pTE[x] - pB[x] - pBN[x] - pBS[x] - pBW[x] - pBE[x]; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - pC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + pC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; } #pragma ibm iterations(100) @@ -779,7 +779,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2 * velXPY ); pNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; pSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -790,7 +790,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2 * velXMY ); pSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; pNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -801,7 +801,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2 * velXPZ ); pTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; pBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -812,7 +812,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2 * velXMZ ); pBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; pTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -823,7 +823,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2 * velYPZ ); pTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; pBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -834,7 +834,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2 * velYMZ ); pBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; pTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -844,7 +844,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2 * velY[x] ); pN[x] = pN[x] - sym_N_S - asym_N_S; pS[x] = pS[x] - sym_N_S + asym_N_S; @@ -854,7 +854,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2 * velX[x] ); pE[x] = pE[x] - sym_E_W - asym_E_W; pW[x] = pW[x] - sym_E_W + asym_E_W; @@ -864,7 +864,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2 * velZ[x] ); pT[x] = pT[x] - sym_T_B - asym_T_B; pB[x] = pB[x] - sym_T_B + asym_T_B; @@ -918,9 +918,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost velY[x] = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; velZ[x] = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - feq_common[x] = rho - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = rho - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0 * feq_common[x]; + src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0 * feq_common[x]; } for( cell_idx_t x = 0; x != xSize; ++x ) @@ -930,7 +930,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2 * velXPY * velXPY - t2x2 * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2 * velXPY ); src->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -943,7 +943,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2 * velXMY * velXMY - t2x2 * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2 * velXMY ); src->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -956,7 +956,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2 * velXPZ * velXPZ - t2x2 * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2 * velXPZ ); src->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -969,7 +969,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2 * velXMZ * velXMZ - t2x2 * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2 * velXMZ ); src->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -982,7 +982,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2 * velYPZ * velYPZ - t2x2 * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2 * velYPZ ); src->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -995,7 +995,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2 * velYMZ * velYMZ - t2x2 * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2 * velYMZ ); src->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -1007,7 +1007,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_S = src->get( x, y, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1 * velY[x] * velY[x] - t1x2 * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2 * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2 * velY[x] ); src->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; src->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -1019,7 +1019,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_W = src->get( x, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1 * velX[x] * velX[x] - t1x2 * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2 * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2 * velX[x] ); src->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; src->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -1031,7 +1031,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_B = src->get( x, y, z, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1 * velZ[x] * velZ[x] - t1x2 * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2 * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2 * velZ[x] ); src->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; src->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; @@ -1118,15 +1118,15 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2_0 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0_0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2_0 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -1230,7 +1230,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; const real_t rho = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = invRho * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -1241,9 +1241,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + dC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; } real_t* dNE = &dst->get(0,y,z,Stencil::idx[NE]); @@ -1262,7 +1262,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2[x] * velXPY ); dNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; dSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -1284,7 +1284,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2[x] * velXMY ); dSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; dNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -1306,7 +1306,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2[x] * velXPZ ); dTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; dBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -1328,7 +1328,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2[x] * velXMZ ); dBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; dTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -1350,7 +1350,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2[x] * velYPZ ); dTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; dBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -1372,7 +1372,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2[x] * velYMZ ); dBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; dTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -1393,7 +1393,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2[x] * velY[x] ); dN[x] = pN[x] - sym_N_S - asym_N_S; dS[x] = pS[x] - sym_N_S + asym_N_S; @@ -1414,7 +1414,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2[x] * velX[x] ); dE[x] = pE[x] - sym_E_W - asym_E_W; dW[x] = pW[x] - sym_E_W + asym_E_W; @@ -1435,7 +1435,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2[x] * velZ[x] ); dT[x] = pT[x] - sym_T_B - asym_T_B; dB[x] = pB[x] - sym_T_B + asym_T_B; @@ -1484,7 +1484,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; const real_t rho = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = invRho * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -1495,9 +1495,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; } for( cell_idx_t x = 0; x != xSize; ++x ) @@ -1507,7 +1507,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2[x] * velXPY ); dst->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -1520,7 +1520,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2[x] * velXMY ); dst->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -1533,7 +1533,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2[x] * velXPZ ); dst->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -1546,7 +1546,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2[x] * velXMZ ); dst->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -1559,7 +1559,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2[x] * velYPZ ); dst->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -1572,7 +1572,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2[x] * velYMZ ); dst->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -1584,7 +1584,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_S = src->get(x, y+1, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2[x] * velY[x] ); dst->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -1596,7 +1596,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_W = src->get(x+1, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2[x] * velX[x] ); dst->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -1608,7 +1608,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_B = src->get(x, y, z+1, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2[x] * velZ[x] ); dst->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; @@ -1677,15 +1677,15 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t lambda_d = src->latticeModel().collisionModel().lambda_d(); // common prefactors for calculating the equilibrium parts - const real_t t0_0 = real_t(1.0) / real_t(3.0); // 1/3 for C - const real_t t1x2_0 = real_t(1.0) / real_t(18.0) * real_t(2.0); // 1/18 * 2 for N, S, W, E, T, B - const real_t t2x2_0 = real_t(1.0) / real_t(36.0) * real_t(2.0); // 1/36 * 2 else + const real_t t0_0 = 1.0_r / 3.0_r; // 1/3 for C + const real_t t1x2_0 = 1.0_r / 18.0_r * 2.0_r; // 1/18 * 2 for N, S, W, E, T, B + const real_t t2x2_0 = 1.0_r / 36.0_r * 2.0_r; // 1/36 * 2 else - const real_t inv2csq2 = real_t(1.0) / ( real_t(2.0) * ( real_t(1.0) / real_t(3.0) ) * ( real_t(1.0) / real_t(3.0) ) ); //speed of sound related factor for equilibrium distribution function + const real_t inv2csq2 = 1.0_r / ( 2.0_r * ( 1.0_r / 3.0_r ) * ( 1.0_r / 3.0_r ) ); //speed of sound related factor for equilibrium distribution function // relaxation parameter variables - const real_t lambda_e_scaled = real_t(0.5) * lambda_e; // 0.5 times the usual value ... - const real_t lambda_d_scaled = real_t(0.5) * lambda_d; // ... due to the way of calculations + const real_t lambda_e_scaled = 0.5_r * lambda_e; // 0.5 times the usual value ... + const real_t lambda_d_scaled = 0.5_r * lambda_d; // ... due to the way of calculations // loop constants @@ -1785,7 +1785,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velZ_trm = pT[x] + pTS[x] + pTW[x]; const real_t rho = pC[x] + pS[x] + pW[x] + pB[x] + pSW[x] + pBS[x] + pBW[x] + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - pW[x] - pNW[x] - pSW[x] - pTW[x] - pBW[x] ); velY[x] = invRho * ( velY_trm + pNE[x] - pS[x] - pSW[x] - pSE[x] - pTS[x] - pBS[x] ); @@ -1796,9 +1796,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - pC[x] = pC[x] * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + pC[x] = pC[x] * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; } #pragma ibm iterations(100) @@ -1806,7 +1806,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( pNE[x] + pSW[x] - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( pNE[x] - pSW[x] - 3.0_r * t2x2[x] * velXPY ); pNE[x] = pNE[x] - sym_NE_SW - asym_NE_SW; pSW[x] = pSW[x] - sym_NE_SW + asym_NE_SW; @@ -1817,7 +1817,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( pSE[x] + pNW[x] - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( pSE[x] - pNW[x] - 3.0_r * t2x2[x] * velXMY ); pSE[x] = pSE[x] - sym_SE_NW - asym_SE_NW; pNW[x] = pNW[x] - sym_SE_NW + asym_SE_NW; @@ -1828,7 +1828,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( pTE[x] + pBW[x] - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( pTE[x] - pBW[x] - 3.0_r * t2x2[x] * velXPZ ); pTE[x] = pTE[x] - sym_TE_BW - asym_TE_BW; pBW[x] = pBW[x] - sym_TE_BW + asym_TE_BW; @@ -1839,7 +1839,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( pBE[x] + pTW[x] - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( pBE[x] - pTW[x] - 3.0_r * t2x2[x] * velXMZ ); pBE[x] = pBE[x] - sym_BE_TW - asym_BE_TW; pTW[x] = pTW[x] - sym_BE_TW + asym_BE_TW; @@ -1850,7 +1850,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( pTN[x] + pBS[x] - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( pTN[x] - pBS[x] - 3.0_r * t2x2[x] * velYPZ ); pTN[x] = pTN[x] - sym_TN_BS - asym_TN_BS; pBS[x] = pBS[x] - sym_TN_BS + asym_TN_BS; @@ -1861,7 +1861,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost { const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( pBN[x] + pTS[x] - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( pBN[x] - pTS[x] - 3.0_r * t2x2[x] * velYMZ ); pBN[x] = pBN[x] - sym_BN_TS - asym_BN_TS; pTS[x] = pTS[x] - sym_BN_TS + asym_BN_TS; @@ -1871,7 +1871,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_N_S = lambda_e_scaled * ( pN[x] + pS[x] - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( pN[x] - pS[x] - 3.0_r * t1x2[x] * velY[x] ); pN[x] = pN[x] - sym_N_S - asym_N_S; pS[x] = pS[x] - sym_N_S + asym_N_S; @@ -1881,7 +1881,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_E_W = lambda_e_scaled * ( pE[x] + pW[x] - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( pE[x] - pW[x] - 3.0_r * t1x2[x] * velX[x] ); pE[x] = pE[x] - sym_E_W - asym_E_W; pW[x] = pW[x] - sym_E_W + asym_E_W; @@ -1891,7 +1891,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost for( cell_idx_t x = 0; x != xSize; ++x ) { const real_t sym_T_B = lambda_e_scaled * ( pT[x] + pB[x] - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( pT[x] - pB[x] - 3.0_r * t1x2[x] * velZ[x] ); pT[x] = pT[x] - sym_T_B - asym_T_B; pB[x] = pB[x] - sym_T_B + asym_T_B; @@ -1940,7 +1940,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; const real_t rho = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; velX[x] = invRho * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); velY[x] = invRho * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); @@ -1951,9 +1951,9 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost fac1[x] = t1x2_0 * rho * inv2csq2; fac2[x] = t2x2_0 * rho * inv2csq2; - feq_common[x] = real_t(1.0) - real_t(1.5) * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); + feq_common[x] = 1.0_r - 1.5_r * ( velX[x] * velX[x] + velY[x] * velY[x] + velZ[x] * velZ[x] ); - src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; + src->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e) + lambda_e * t0_0 * rho * feq_common[x]; } for( cell_idx_t x = 0; x != xSize; ++x ) @@ -1963,7 +1963,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXPY = velX[x] + velY[x]; const real_t sym_NE_SW = lambda_e_scaled * ( dd_tmp_NE + dd_tmp_SW - fac2[x] * velXPY * velXPY - t2x2[x] * feq_common[x] ); - const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2[x] * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2[x] * velXPY ); src->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; src->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; @@ -1976,7 +1976,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXMY = velX[x] - velY[x]; const real_t sym_SE_NW = lambda_e_scaled * ( dd_tmp_SE + dd_tmp_NW - fac2[x] * velXMY * velXMY - t2x2[x] * feq_common[x] ); - const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2[x] * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2[x] * velXMY ); src->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; src->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; @@ -1989,7 +1989,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXPZ = velX[x] + velZ[x]; const real_t sym_TE_BW = lambda_e_scaled * ( dd_tmp_TE + dd_tmp_BW - fac2[x] * velXPZ * velXPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2[x] * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2[x] * velXPZ ); src->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; src->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; @@ -2002,7 +2002,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velXMZ = velX[x] - velZ[x]; const real_t sym_BE_TW = lambda_e_scaled * ( dd_tmp_BE + dd_tmp_TW - fac2[x] * velXMZ * velXMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2[x] * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2[x] * velXMZ ); src->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; src->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; @@ -2015,7 +2015,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velYPZ = velY[x] + velZ[x]; const real_t sym_TN_BS = lambda_e_scaled * ( dd_tmp_TN + dd_tmp_BS - fac2[x] * velYPZ * velYPZ - t2x2[x] * feq_common[x] ); - const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2[x] * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2[x] * velYPZ ); src->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; src->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; @@ -2028,7 +2028,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t velYMZ = velY[x] - velZ[x]; const real_t sym_BN_TS = lambda_e_scaled * ( dd_tmp_BN + dd_tmp_TS - fac2[x] * velYMZ * velYMZ - t2x2[x] * feq_common[x] ); - const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2[x] * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2[x] * velYMZ ); src->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; src->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; @@ -2040,7 +2040,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_S = src->get( x, y, z, Stencil::idx[S]); const real_t sym_N_S = lambda_e_scaled * ( dd_tmp_N + dd_tmp_S - fac1[x] * velY[x] * velY[x] - t1x2[x] * feq_common[x] ); - const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2[x] * velY[x] ); + const real_t asym_N_S = lambda_d_scaled * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2[x] * velY[x] ); src->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; src->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; @@ -2052,7 +2052,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_W = src->get( x, y, z, Stencil::idx[W]); const real_t sym_E_W = lambda_e_scaled * ( dd_tmp_E + dd_tmp_W - fac1[x] * velX[x] * velX[x] - t1x2[x] * feq_common[x] ); - const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2[x] * velX[x] ); + const real_t asym_E_W = lambda_d_scaled * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2[x] * velX[x] ); src->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; src->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; @@ -2064,7 +2064,7 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost const real_t dd_tmp_B = src->get( x, y, z, Stencil::idx[B]); const real_t sym_T_B = lambda_e_scaled * ( dd_tmp_T + dd_tmp_B - fac1[x] * velZ[x] * velZ[x] - t1x2[x] * feq_common[x] ); - const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2[x] * velZ[x] ); + const real_t asym_T_B = lambda_d_scaled * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2[x] * velZ[x] ); src->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; src->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; diff --git a/src/lbm/trt/cell_operations/DefaultCellOperation.impl.h b/src/lbm/trt/cell_operations/DefaultCellOperation.impl.h index f5fa0ca2..e713bd59 100644 --- a/src/lbm/trt/cell_operations/DefaultCellOperation.impl.h +++ b/src/lbm/trt/cell_operations/DefaultCellOperation.impl.h @@ -71,7 +71,7 @@ public: typedef PdfField< LatticeModel_T > PdfField_T; typedef typename LatticeModel_T::Stencil Stencil; - DefaultCellOperation() : lambda_e_( real_t(0) ), lambda_d_( real_t(0) ), latticeModel_( NULL ) {} + DefaultCellOperation() : lambda_e_( 0_r ), lambda_d_( 0_r ), latticeModel_( NULL ) {} void configure( const LatticeModel_T & latticeModel ) { @@ -193,18 +193,18 @@ public: typedef typename LatticeModel_T::Stencil Stencil; DefaultCellOperation() : - lambda_e_( real_t(0) ), lambda_e_scaled_( real_t(0) ), lambda_d_scaled_( real_t(0) ), - t0_( real_t(1.0) / real_t(3.0) ), - t1x2_( real_t(1.0) / real_t(18.0) * real_t(2.0) ), - t2x2_( real_t(1.0) / real_t(36.0) * real_t(2.0) ), - fac1_( (real_t(1.0) / real_t(18.0) * real_t(2.0)) * (real_t(9.0) / real_t(2.0)) ), - fac2_( (real_t(1.0) / real_t(36.0) * real_t(2.0)) * (real_t(9.0) / real_t(2.0)) ) {} + lambda_e_( 0_r ), lambda_e_scaled_( 0_r ), lambda_d_scaled_( 0_r ), + t0_( 1.0_r / 3.0_r ), + t1x2_( 1.0_r / 18.0_r * 2.0_r ), + t2x2_( 1.0_r / 36.0_r * 2.0_r ), + fac1_( (1.0_r / 18.0_r * 2.0_r) * (9.0_r / 2.0_r) ), + fac2_( (1.0_r / 36.0_r * 2.0_r) * (9.0_r / 2.0_r) ) {} void configure( const LatticeModel_T & latticeModel ) { lambda_e_ = latticeModel.collisionModel().lambda_e(); - lambda_e_scaled_ = real_t(0.5) * lambda_e_; - lambda_d_scaled_ = real_t(0.5) * latticeModel.collisionModel().lambda_d(); + lambda_e_scaled_ = 0.5_r * lambda_e_; + lambda_d_scaled_ = 0.5_r * latticeModel.collisionModel().lambda_d(); } void operator()( PdfField_T * src, PdfField_T * dst, cell_idx_t x, cell_idx_t y, cell_idx_t z ) const; @@ -266,58 +266,58 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t velY = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; const real_t velZ = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e_) + lambda_e_ * t0_ * feq_common; + dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e_) + lambda_e_ * t0_ * feq_common; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled_ * ( dd_tmp_NE + dd_tmp_SW - fac2_ * velXPY * velXPY - t2x2_ * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled_ * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2_ * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled_ * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2_ * velXPY ); dst->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled_ * ( dd_tmp_SE + dd_tmp_NW - fac2_ * velXMY * velXMY - t2x2_ * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled_ * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2_ * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled_ * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2_ * velXMY ); dst->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled_ * ( dd_tmp_TE + dd_tmp_BW - fac2_ * velXPZ * velXPZ - t2x2_ * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled_ * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2_ * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled_ * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2_ * velXPZ ); dst->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled_ * ( dd_tmp_BE + dd_tmp_TW - fac2_ * velXMZ * velXMZ - t2x2_ * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled_ * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2_ * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled_ * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2_ * velXMZ ); dst->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled_ * ( dd_tmp_TN + dd_tmp_BS - fac2_ * velYPZ * velYPZ - t2x2_ * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled_ * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2_ * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled_ * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2_ * velYPZ ); dst->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled_ * ( dd_tmp_BN + dd_tmp_TS - fac2_ * velYMZ * velYMZ - t2x2_ * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled_ * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2_ * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled_ * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2_ * velYMZ ); dst->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; const real_t sym_N_S = lambda_e_scaled_ * ( dd_tmp_N + dd_tmp_S - fac1_ * velY * velY - t1x2_ * feq_common ); - const real_t asym_N_S = lambda_d_scaled_ * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2_ * velY ); + const real_t asym_N_S = lambda_d_scaled_ * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2_ * velY ); dst->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled_ * ( dd_tmp_E + dd_tmp_W - fac1_ * velX * velX - t1x2_ * feq_common ); - const real_t asym_E_W = lambda_d_scaled_ * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2_ * velX ); + const real_t asym_E_W = lambda_d_scaled_ * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2_ * velX ); dst->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled_ * ( dd_tmp_T + dd_tmp_B - fac1_ * velZ * velZ - t1x2_ * feq_common ); - const real_t asym_T_B = lambda_d_scaled_ * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2_ * velZ ); + const real_t asym_T_B = lambda_d_scaled_ * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2_ * velZ ); dst->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; } @@ -364,58 +364,58 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t velY = velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS; const real_t velZ = velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE; - const real_t feq_common = rho - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = rho - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - dst[ Stencil::idx[C] ]= dd_tmp_C * (real_t(1.0) - lambda_e_) + lambda_e_ * t0_ * feq_common; + dst[ Stencil::idx[C] ]= dd_tmp_C * (1.0_r - lambda_e_) + lambda_e_ * t0_ * feq_common; const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled_ * ( dd_tmp_NE + dd_tmp_SW - fac2_ * velXPY * velXPY - t2x2_ * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled_ * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2_ * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled_ * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2_ * velXPY ); dst[ Stencil::idx[NE] ]= dd_tmp_NE - sym_NE_SW - asym_NE_SW; dst[ Stencil::idx[SW] ]= dd_tmp_SW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled_ * ( dd_tmp_SE + dd_tmp_NW - fac2_ * velXMY * velXMY - t2x2_ * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled_ * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2_ * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled_ * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2_ * velXMY ); dst[ Stencil::idx[SE] ]= dd_tmp_SE - sym_SE_NW - asym_SE_NW; dst[ Stencil::idx[NW] ]= dd_tmp_NW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled_ * ( dd_tmp_TE + dd_tmp_BW - fac2_ * velXPZ * velXPZ - t2x2_ * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled_ * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2_ * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled_ * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2_ * velXPZ ); dst[ Stencil::idx[TE] ]= dd_tmp_TE - sym_TE_BW - asym_TE_BW; dst[ Stencil::idx[BW] ]= dd_tmp_BW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled_ * ( dd_tmp_BE + dd_tmp_TW - fac2_ * velXMZ * velXMZ - t2x2_ * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled_ * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2_ * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled_ * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2_ * velXMZ ); dst[ Stencil::idx[BE] ]= dd_tmp_BE - sym_BE_TW - asym_BE_TW; dst[ Stencil::idx[TW] ]= dd_tmp_TW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled_ * ( dd_tmp_TN + dd_tmp_BS - fac2_ * velYPZ * velYPZ - t2x2_ * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled_ * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2_ * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled_ * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2_ * velYPZ ); dst[ Stencil::idx[TN] ]= dd_tmp_TN - sym_TN_BS - asym_TN_BS; dst[ Stencil::idx[BS] ]= dd_tmp_BS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled_ * ( dd_tmp_BN + dd_tmp_TS - fac2_ * velYMZ * velYMZ - t2x2_ * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled_ * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2_ * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled_ * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2_ * velYMZ ); dst[ Stencil::idx[BN] ]= dd_tmp_BN - sym_BN_TS - asym_BN_TS; dst[ Stencil::idx[TS] ]= dd_tmp_TS - sym_BN_TS + asym_BN_TS; const real_t sym_N_S = lambda_e_scaled_ * ( dd_tmp_N + dd_tmp_S - fac1_ * velY * velY - t1x2_ * feq_common ); - const real_t asym_N_S = lambda_d_scaled_ * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2_ * velY ); + const real_t asym_N_S = lambda_d_scaled_ * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2_ * velY ); dst[ Stencil::idx[N] ]= dd_tmp_N - sym_N_S - asym_N_S; dst[ Stencil::idx[S] ]= dd_tmp_S - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled_ * ( dd_tmp_E + dd_tmp_W - fac1_ * velX * velX - t1x2_ * feq_common ); - const real_t asym_E_W = lambda_d_scaled_ * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2_ * velX ); + const real_t asym_E_W = lambda_d_scaled_ * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2_ * velX ); dst[ Stencil::idx[E] ]= dd_tmp_E - sym_E_W - asym_E_W; dst[ Stencil::idx[W] ]= dd_tmp_W - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled_ * ( dd_tmp_T + dd_tmp_B - fac1_ * velZ * velZ - t1x2_ * feq_common ); - const real_t asym_T_B = lambda_d_scaled_ * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2_ * velZ ); + const real_t asym_T_B = lambda_d_scaled_ * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2_ * velZ ); dst[ Stencil::idx[T] ]= dd_tmp_T - sym_T_B - asym_T_B; dst[ Stencil::idx[B] ]= dd_tmp_B - sym_T_B + asym_T_B; } @@ -448,16 +448,16 @@ public: typedef typename LatticeModel_T::Stencil Stencil; DefaultCellOperation() : - lambda_e_( real_t(0) ), lambda_e_scaled_( real_t(0) ), lambda_d_scaled_( real_t(0) ), - t0_0_( real_t(1.0) / real_t(3.0) ), - t1x2_0_( real_t(1.0) / real_t(18.0) * real_t(2.0) ), - t2x2_0_( real_t(1.0) / real_t(36.0) * real_t(2.0) ) {} + lambda_e_( 0_r ), lambda_e_scaled_( 0_r ), lambda_d_scaled_( 0_r ), + t0_0_( 1.0_r / 3.0_r ), + t1x2_0_( 1.0_r / 18.0_r * 2.0_r ), + t2x2_0_( 1.0_r / 36.0_r * 2.0_r ) {} void configure( const LatticeModel_T & latticeModel ) { lambda_e_ = latticeModel.collisionModel().lambda_e(); - lambda_e_scaled_ = real_t(0.5) * lambda_e_; - lambda_d_scaled_ = real_t(0.5) * latticeModel.collisionModel().lambda_d(); + lambda_e_scaled_ = 0.5_r * lambda_e_; + lambda_d_scaled_ = 0.5_r * latticeModel.collisionModel().lambda_d(); } void operator()( PdfField_T * src, PdfField_T * dst, cell_idx_t x, cell_idx_t y, cell_idx_t z ) const; @@ -512,70 +512,70 @@ void DefaultCellOperation< LatticeModel_T, typename boost::enable_if< boost::mpl const real_t velZ_trm = dd_tmp_T + dd_tmp_TS + dd_tmp_TW; const real_t rho = dd_tmp_C + dd_tmp_S + dd_tmp_W + dd_tmp_B + dd_tmp_SW + dd_tmp_BS + dd_tmp_BW + velX_trm + velY_trm + velZ_trm; - const real_t invRho = real_t(1.0) / rho; + const real_t invRho = 1.0_r / rho; const real_t velX = invRho * ( velX_trm - dd_tmp_W - dd_tmp_NW - dd_tmp_SW - dd_tmp_TW - dd_tmp_BW ); const real_t velY = invRho * ( velY_trm + dd_tmp_NE - dd_tmp_S - dd_tmp_SW - dd_tmp_SE - dd_tmp_TS - dd_tmp_BS ); const real_t velZ = invRho * ( velZ_trm + dd_tmp_TN + dd_tmp_TE - dd_tmp_B - dd_tmp_BN - dd_tmp_BS - dd_tmp_BW - dd_tmp_BE ); - const real_t feq_common = real_t(1.0) - real_t(1.5) * ( velX * velX + velY * velY + velZ * velZ ); + const real_t feq_common = 1.0_r - 1.5_r * ( velX * velX + velY * velY + velZ * velZ ); - dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (real_t(1.0) - lambda_e_) + lambda_e_ * t0_0_ * rho * feq_common; + dst->get( x, y, z, Stencil::idx[C] ) = dd_tmp_C * (1.0_r - lambda_e_) + lambda_e_ * t0_0_ * rho * feq_common; const real_t t2x2 = t2x2_0_ * rho; - const real_t fac2 = t2x2 * (real_t(9.0) / real_t(2.0)); + const real_t fac2 = t2x2 * (9.0_r / 2.0_r); const real_t velXPY = velX + velY; const real_t sym_NE_SW = lambda_e_scaled_ * ( dd_tmp_NE + dd_tmp_SW - fac2 * velXPY * velXPY - t2x2 * feq_common ); - const real_t asym_NE_SW = lambda_d_scaled_ * ( dd_tmp_NE - dd_tmp_SW - real_t(3.0) * t2x2 * velXPY ); + const real_t asym_NE_SW = lambda_d_scaled_ * ( dd_tmp_NE - dd_tmp_SW - 3.0_r * t2x2 * velXPY ); dst->get( x, y, z, Stencil::idx[NE] ) = dd_tmp_NE - sym_NE_SW - asym_NE_SW; dst->get( x, y, z, Stencil::idx[SW] ) = dd_tmp_SW - sym_NE_SW + asym_NE_SW; const real_t velXMY = velX - velY; const real_t sym_SE_NW = lambda_e_scaled_ * ( dd_tmp_SE + dd_tmp_NW - fac2 * velXMY * velXMY - t2x2 * feq_common ); - const real_t asym_SE_NW = lambda_d_scaled_ * ( dd_tmp_SE - dd_tmp_NW - real_t(3.0) * t2x2 * velXMY ); + const real_t asym_SE_NW = lambda_d_scaled_ * ( dd_tmp_SE - dd_tmp_NW - 3.0_r * t2x2 * velXMY ); dst->get( x, y, z, Stencil::idx[SE] ) = dd_tmp_SE - sym_SE_NW - asym_SE_NW; dst->get( x, y, z, Stencil::idx[NW] ) = dd_tmp_NW - sym_SE_NW + asym_SE_NW; const real_t velXPZ = velX + velZ; const real_t sym_TE_BW = lambda_e_scaled_ * ( dd_tmp_TE + dd_tmp_BW - fac2 * velXPZ * velXPZ - t2x2 * feq_common ); - const real_t asym_TE_BW = lambda_d_scaled_ * ( dd_tmp_TE - dd_tmp_BW - real_t(3.0) * t2x2 * velXPZ ); + const real_t asym_TE_BW = lambda_d_scaled_ * ( dd_tmp_TE - dd_tmp_BW - 3.0_r * t2x2 * velXPZ ); dst->get( x, y, z, Stencil::idx[TE] ) = dd_tmp_TE - sym_TE_BW - asym_TE_BW; dst->get( x, y, z, Stencil::idx[BW] ) = dd_tmp_BW - sym_TE_BW + asym_TE_BW; const real_t velXMZ = velX - velZ; const real_t sym_BE_TW = lambda_e_scaled_ * ( dd_tmp_BE + dd_tmp_TW - fac2 * velXMZ * velXMZ - t2x2 * feq_common ); - const real_t asym_BE_TW = lambda_d_scaled_ * ( dd_tmp_BE - dd_tmp_TW - real_t(3.0) * t2x2 * velXMZ ); + const real_t asym_BE_TW = lambda_d_scaled_ * ( dd_tmp_BE - dd_tmp_TW - 3.0_r * t2x2 * velXMZ ); dst->get( x, y, z, Stencil::idx[BE] ) = dd_tmp_BE - sym_BE_TW - asym_BE_TW; dst->get( x, y, z, Stencil::idx[TW] ) = dd_tmp_TW - sym_BE_TW + asym_BE_TW; const real_t velYPZ = velY + velZ; const real_t sym_TN_BS = lambda_e_scaled_ * ( dd_tmp_TN + dd_tmp_BS - fac2 * velYPZ * velYPZ - t2x2 * feq_common ); - const real_t asym_TN_BS = lambda_d_scaled_ * ( dd_tmp_TN - dd_tmp_BS - real_t(3.0) * t2x2 * velYPZ ); + const real_t asym_TN_BS = lambda_d_scaled_ * ( dd_tmp_TN - dd_tmp_BS - 3.0_r * t2x2 * velYPZ ); dst->get( x, y, z, Stencil::idx[TN] ) = dd_tmp_TN - sym_TN_BS - asym_TN_BS; dst->get( x, y, z, Stencil::idx[BS] ) = dd_tmp_BS - sym_TN_BS + asym_TN_BS; const real_t velYMZ = velY - velZ; const real_t sym_BN_TS = lambda_e_scaled_ * ( dd_tmp_BN + dd_tmp_TS - fac2 * velYMZ * velYMZ - t2x2 * feq_common ); - const real_t asym_BN_TS = lambda_d_scaled_ * ( dd_tmp_BN - dd_tmp_TS - real_t(3.0) * t2x2 * velYMZ ); + const real_t asym_BN_TS = lambda_d_scaled_ * ( dd_tmp_BN - dd_tmp_TS - 3.0_r * t2x2 * velYMZ ); dst->get( x, y, z, Stencil::idx[BN] ) = dd_tmp_BN - sym_BN_TS - asym_BN_TS; dst->get( x, y, z, Stencil::idx[TS] ) = dd_tmp_TS - sym_BN_TS + asym_BN_TS; const real_t t1x2 = t1x2_0_ * rho; - const real_t fac1 = t1x2 * (real_t(9.0) / real_t(2.0)); + const real_t fac1 = t1x2 * (9.0_r / 2.0_r); const real_t sym_N_S = lambda_e_scaled_ * ( dd_tmp_N + dd_tmp_S - fac1 * velY * velY - t1x2 * feq_common ); - const real_t asym_N_S = lambda_d_scaled_ * ( dd_tmp_N - dd_tmp_S - real_t(3.0) * t1x2 * velY ); + const real_t asym_N_S = lambda_d_scaled_ * ( dd_tmp_N - dd_tmp_S - 3.0_r * t1x2 * velY ); dst->get( x, y, z, Stencil::idx[N] ) = dd_tmp_N - sym_N_S - asym_N_S; dst->get( x, y, z, Stencil::idx[S] ) = dd_tmp_S - sym_N_S + asym_N_S; const real_t sym_E_W = lambda_e_scaled_ * ( dd_tmp_E + dd_tmp_W - fac1 * velX * velX - t1x2 * feq_common ); - const real_t asym_E_W = lambda_d_scaled_ * ( dd_tmp_E - dd_tmp_W - real_t(3.0) * t1x2 * velX ); + const real_t asym_E_W = lambda_d_scaled_ * ( dd_tmp_E - dd_tmp_W - 3.0_r * t1x2 * velX ); dst->get( x, y, z, Stencil::idx[E] ) = dd_tmp_E - sym_E_W - asym_E_W; dst->get( x, y, z, Stencil::idx[W] ) = dd_tmp_W - sym_E_W + asym_E_W; const real_t sym_T_B = lambda_e_scaled_ * ( dd_tmp_T + dd_tmp_B - fac1 * velZ * velZ - t1x2 * feq_common ); - const real_t asym_T_B = lambda_d_scaled_ * ( dd_tmp_T - dd_tmp_B - real_t(3.0) * t1x2 * velZ ); + const real_t asym_T_B = lambda_d_scaled_ * ( dd_tmp_T - dd_tmp_B - 3.0_r * t1x2 * velZ ); dst->get( x, y, z, Stencil::idx[T] ) = dd_tmp_T - sym_T_B - asym_T_B; dst->get( x, y, z, Stencil::idx[B] ) = dd_tmp_B - sym_T_B + asym_T_B; } diff --git a/src/mesh/DistanceComputations.h b/src/mesh/DistanceComputations.h index 6df23c07..fa4f35b0 100644 --- a/src/mesh/DistanceComputations.h +++ b/src/mesh/DistanceComputations.h @@ -43,11 +43,11 @@ struct DistanceProperties typedef math::Matrix3<Scalar> Matrix; // Dummy constructor to suppress GCC 7 warnings - DistanceProperties() : e0(real_t(0)), e1(real_t(0)), e2(real_t(0)), - e1_normal(real_t(0)), e2_normal(real_t(0)), - e1_normalized(real_t(0)), e2_normalized(real_t(0)), e0_normalized(real_t(0)), - e0l(real_t(0)), e1l(real_t(0)), e2l(real_t(0)), - translation(real_t(0)) + DistanceProperties() : e0(0_r), e1(0_r), e2(0_r), + e1_normal(0_r), e2_normal(0_r), + e1_normalized(0_r), e2_normalized(0_r), e0_normalized(0_r), + e0l(0_r), e1l(0_r), e2l(0_r), + translation(0_r) {} Vec2 e0, e1, e2; diff --git a/src/mesh/blockforest/BlockForestInitialization.cpp b/src/mesh/blockforest/BlockForestInitialization.cpp index 134aef9c..753927fc 100644 --- a/src/mesh/blockforest/BlockForestInitialization.cpp +++ b/src/mesh/blockforest/BlockForestInitialization.cpp @@ -41,7 +41,7 @@ static inline uint_t uintAbsDiff( const uint_t x, const uint_t y ) } ComplexGeometryBlockforestCreator::ComplexGeometryBlockforestCreator( const AABB & aabb, const blockforest::SetupBlockForest::RootBlockExclusionFunction & rootBlockExclusionFunction ) - : aabb_(aabb), maxIterations_(25), acceptableRelativeError_( real_t(0.1) ), maxBlockSkewness_(2.0), + : aabb_(aabb), maxIterations_(25), acceptableRelativeError_( 0.1_r ), maxBlockSkewness_(2.0), processMemoryLimit_( real_t( 0.0 ) ), periodicity_( false, false, false ), rootBlockExclusionFunction_ ( rootBlockExclusionFunction ), workloadMemorySUIDAssignmentFunction_( blockforest::uniformWorkloadAndMemoryAssignment ), #ifdef WALBERLA_BUILD_WITH_PARMETIS @@ -106,18 +106,18 @@ shared_ptr<SetupBlockForest> ComplexGeometryBlockforestCreator::createSetupBlock const real_t factor = real_c( numRootBlocks ) / real_c( targetNumRootBlocks ); - if( std::fabs( factor - real_t(1) ) < acceptableRelativeError_ ) + if( std::fabs( factor - 1_r ) < acceptableRelativeError_ ) { break; } if( numRootBlocks < targetNumRootBlocks ) { - sizeBlockGrid = uint_c( real_c( sizeBlockGrid ) / factor + real_t(0.5) ); + sizeBlockGrid = uint_c( real_c( sizeBlockGrid ) / factor + 0.5_r ); dir = UP; } else if( numRootBlocks > targetNumRootBlocks ) { - sizeBlockGrid = uint_c( real_c( sizeBlockGrid ) / factor + real_t(0.5) ); + sizeBlockGrid = uint_c( real_c( sizeBlockGrid ) / factor + 0.5_r ); dir = DOWN; } else @@ -150,7 +150,7 @@ shared_ptr<SetupBlockForest> ComplexGeometryBlockforestCreator::createSetupBlock for( uint_t i = uint_t(0); i < uint_t(3); ++i ) numBlocks[i] = uint_c( std::ceil( aabb_.size( i ) / blockSize[i] ) ); - AABB newAABB( real_t(0), real_t(0), real_t(0), + AABB newAABB( 0_r, 0_r, 0_r, real_c( numBlocks[0] ) * blockSize[0], real_c( numBlocks[1] ) * blockSize[1], real_c( numBlocks[2] ) * blockSize[2] ); newAABB.translate( aabb_.center() - newAABB.center() ); @@ -218,7 +218,7 @@ uint_t ComplexGeometryBlockforestCreator::findNumBlocks( const Vector3<uint_t> & ComplexGeometryStructuredBlockforestCreator::ComplexGeometryStructuredBlockforestCreator( const AABB & aabb, const Vector3<real_t> & cellSize, const blockforest::SetupBlockForest::RootBlockExclusionFunction & rootBlockExclusionFunction ) - : aabb_(aabb), cellSize_( cellSize ), maxIterations_(25), acceptableRelativeError_( real_t(0.1) ), + : aabb_(aabb), cellSize_( cellSize ), maxIterations_(25), acceptableRelativeError_( 0.1_r ), processMemoryLimit_( real_t( 0.0 ) ), periodicity_( false, false, false ), rootBlockExclusionFunction_ ( rootBlockExclusionFunction ), workloadMemorySUIDAssignmentFunction_( blockforest::uniformWorkloadAndMemoryAssignment ), @@ -239,7 +239,7 @@ shared_ptr<SetupBlockForest> ComplexGeometryStructuredBlockforestCreator::create std::set< uint_t > blockSizeTested; - uint_t blockSize = uint_c( std::pow( domainVolume / ( real_t(2) * real_t( targetNumRootBlocks ) ), real_t(1) / real_t(3) ) + 0.5 ); + uint_t blockSize = uint_c( std::pow( domainVolume / ( 2_r * real_t( targetNumRootBlocks ) ), 1_r / 3_r ) + 0.5 ); uint_t bestBlockSize = blockSize; uint_t bestNumRootBlocks = std::numeric_limits<uint_t>::max(); @@ -278,18 +278,18 @@ shared_ptr<SetupBlockForest> ComplexGeometryStructuredBlockforestCreator::create const real_t factor = real_c( numRootBlocks ) / real_c( targetNumRootBlocks ); - if( std::fabs( factor - real_t(1) ) < acceptableRelativeError_ ) + if( std::fabs( factor - 1_r ) < acceptableRelativeError_ ) { break; } if( numRootBlocks < targetNumRootBlocks ) { - blockSize = uint_c( real_c( blockSize ) * std::pow( factor, real_t(1) / real_t(3) ) + real_t(0.5) ); + blockSize = uint_c( real_c( blockSize ) * std::pow( factor, 1_r / 3_r ) + 0.5_r ); dir = UP; } else if( numRootBlocks > targetNumRootBlocks ) { - blockSize = uint_c( real_c( blockSize ) * std::pow( factor, real_t(1) / real_t(3) ) + real_t(0.5) ); + blockSize = uint_c( real_c( blockSize ) * std::pow( factor, 1_r / 3_r ) + 0.5_r ); dir = DOWN; } else @@ -306,7 +306,7 @@ shared_ptr<SetupBlockForest> ComplexGeometryStructuredBlockforestCreator::create uint_c( std::ceil( real_c( numCells[1] ) / real_c( bestBlockSize ) ) ), uint_c( std::ceil( real_c( numCells[2] ) / real_c( bestBlockSize ) ) ) ); - AABB newAABB( real_t(0), real_t(0), real_t(0), + AABB newAABB( 0_r, 0_r, 0_r, real_c( numBlocks[0] * bestBlockSize ) * cellSize_[0], real_c( numBlocks[1] * bestBlockSize ) * cellSize_[1], real_c( numBlocks[2] * bestBlockSize ) * cellSize_[2] ); @@ -344,7 +344,7 @@ shared_ptr<SetupBlockForest> ComplexGeometryStructuredBlockforestCreator::create uint_c( std::ceil( real_c( numCells[1] ) / real_c( blockSize[1] ) ) ), uint_c( std::ceil( real_c( numCells[2] ) / real_c( blockSize[2] ) ) ) ); - AABB newAABB( real_t(0), real_t(0), real_t(0), + AABB newAABB( 0_r, 0_r, 0_r, real_c( numBlocks[0] * blockSize[0] ) * cellSize_[0], real_c( numBlocks[1] * blockSize[1] ) * cellSize_[1], real_c( numBlocks[2] * blockSize[2] ) * cellSize_[2] ); @@ -377,7 +377,7 @@ shared_ptr<StructuredBlockForest> ComplexGeometryStructuredBlockforestCreator::c setupBlockForest->getRootBlockYSize(), setupBlockForest->getRootBlockZSize() ); - Vector3<uint_t> blockSizeCells( uint_c( blockSize[0] / cellSize_[0] + real_t(0.5) ), uint_c( blockSize[1] / cellSize_[1] + real_t(0.5) ), uint_c( blockSize[2] / cellSize_[2] + real_t(0.5) ) ); + Vector3<uint_t> blockSizeCells( uint_c( blockSize[0] / cellSize_[0] + 0.5_r ), uint_c( blockSize[1] / cellSize_[1] + 0.5_r ), uint_c( blockSize[2] / cellSize_[2] + 0.5_r ) ); WALBERLA_ASSERT_FLOAT_EQUAL( blockSize[0] / cellSize_[0], real_c( blockSizeCells[0] ) ); WALBERLA_ASSERT_FLOAT_EQUAL( blockSize[1] / cellSize_[1], real_c( blockSizeCells[1] ) ); @@ -417,7 +417,7 @@ uint_t ComplexGeometryStructuredBlockforestCreator::findNumBlocks( const Vector3 uint_c( std::ceil( real_c( numCells[1] ) / real_c( blockSize[1] ) ) ), uint_c( std::ceil( real_c( numCells[2] ) / real_c( blockSize[2] ) ) ) ); - AABB newAABB( real_t(0), real_t(0), real_t(0), + AABB newAABB( 0_r, 0_r, 0_r, real_c( numBlocks[0] * blockSize[0] ) * cellSize_[0], real_c( numBlocks[1] * blockSize[1] ) * cellSize_[1], real_c( numBlocks[2] * blockSize[2] ) * cellSize_[2] ); diff --git a/src/mesh/boundary/BoundarySetup.cpp b/src/mesh/boundary/BoundarySetup.cpp index c0edcc1e..0caaac61 100644 --- a/src/mesh/boundary/BoundarySetup.cpp +++ b/src/mesh/boundary/BoundarySetup.cpp @@ -137,7 +137,7 @@ void BoundarySetup::voxelize() if( curCi.numCells() == uint_t(1) ) { - if( ( sqSignedDistance < real_t(0) ) ) + if( ( sqSignedDistance < 0_r ) ) { Cell localCell; structuredBlockStorage_->transformGlobalToBlockLocalCell( localCell, block, curCi.min() ); @@ -148,7 +148,7 @@ void BoundarySetup::voxelize() continue; } - const real_t circumRadius = curAABB.sizes().length() * real_t(0.5); + const real_t circumRadius = curAABB.sizes().length() * 0.5_r; const real_t sqCircumRadius = circumRadius * circumRadius; if( sqSignedDistance < -sqCircumRadius ) @@ -245,7 +245,7 @@ void BoundarySetup::refinementCorrection( StructuredBlockForest & blockForest ) structuredBlockStorage_->getCellCenter( coarseCenter, coarseCell, level - uint_t(1) ); structuredBlockStorage_->mapToPeriodicDomain( coarseCenter ); - voxelizationField->get( cell ) = distanceFunction_( coarseCenter ) < real_t(0) ? uint8_t(1) : uint8_t(0); + voxelizationField->get( cell ) = distanceFunction_( coarseCenter ) < 0_r ? uint8_t(1) : uint8_t(0); } } } diff --git a/src/mesh/pe/raytracing/Intersects.h b/src/mesh/pe/raytracing/Intersects.h index 52761d65..15e75772 100644 --- a/src/mesh/pe/raytracing/Intersects.h +++ b/src/mesh/pe/raytracing/Intersects.h @@ -47,18 +47,18 @@ inline bool intersects(const mesh::pe::ConvexPolyhedronID poly, const Ray& ray, const real_t vn = Pn * transformedRay.getOrigin() + d; const real_t vd = Pn * transformedRay.getDirection(); - if ( floatIsEqual(vd, real_t(0)) ) + if ( floatIsEqual(vd, 0_r) ) { - if (vn > real_t(0)) return false; + if (vn > 0_r) return false; continue; } const real_t t = -vn / vd; - if (vd > real_t(0)) + if (vd > 0_r) { // back-facing - if (t < real_t(0)) return false; + if (t < 0_r) return false; if (t < t_far) t_far=t; } else { diff --git a/src/mesh/pe/rigid_body/ConvexPolyhedron.cpp b/src/mesh/pe/rigid_body/ConvexPolyhedron.cpp index eb3c3c3e..f803c86e 100644 --- a/src/mesh/pe/rigid_body/ConvexPolyhedron.cpp +++ b/src/mesh/pe/rigid_body/ConvexPolyhedron.cpp @@ -76,7 +76,7 @@ ConvexPolyhedron::ConvexPolyhedron( id_t sid, id_t uid, const Vec3& gpos, const void ConvexPolyhedron::init( const Vec3& gpos, const Vec3& rpos, const Quat& q, const bool global, const bool communicating, const bool infiniteMass ) { - WALBERLA_ASSERT_FLOAT_EQUAL( (toWalberla( computeCentroid( mesh_ ) ) - Vec3() ).length(), real_t(0) ); + WALBERLA_ASSERT_FLOAT_EQUAL( (toWalberla( computeCentroid( mesh_ ) ) - Vec3() ).length(), 0_r ); WALBERLA_ASSERT_GREATER_EQUAL( mesh_.n_vertices(), 4 ); mesh_.request_face_normals(); @@ -114,13 +114,13 @@ void ConvexPolyhedron::init( const Vec3& gpos, const Vec3& rpos, const Quat& q, ConvexPolyhedron::calcBoundingBox(); octandVertices_[0] = supportVertex( TriangleMesh::Normal( real_t( 1), real_t( 1), real_t( 1) ), *mesh_.vertices_begin() ); - octandVertices_[1] = supportVertex( TriangleMesh::Normal( real_t( 1), real_t( 1), real_t(-1) ), *mesh_.vertices_begin() ); - octandVertices_[2] = supportVertex( TriangleMesh::Normal( real_t( 1), real_t(-1), real_t( 1) ), *mesh_.vertices_begin() ); - octandVertices_[3] = supportVertex( TriangleMesh::Normal( real_t( 1), real_t(-1), real_t(-1) ), *mesh_.vertices_begin() ); - octandVertices_[4] = supportVertex( TriangleMesh::Normal( real_t(-1), real_t( 1), real_t( 1) ), *mesh_.vertices_begin() ); - octandVertices_[5] = supportVertex( TriangleMesh::Normal( real_t(-1), real_t( 1), real_t(-1) ), *mesh_.vertices_begin() ); - octandVertices_[6] = supportVertex( TriangleMesh::Normal( real_t(-1), real_t(-1), real_t( 1) ), *mesh_.vertices_begin() ); - octandVertices_[7] = supportVertex( TriangleMesh::Normal( real_t(-1), real_t(-1), real_t(-1) ), *mesh_.vertices_begin() ); + octandVertices_[1] = supportVertex( TriangleMesh::Normal( real_t( 1), real_t( 1), -1_r ), *mesh_.vertices_begin() ); + octandVertices_[2] = supportVertex( TriangleMesh::Normal( real_t( 1), -1_r, real_t( 1) ), *mesh_.vertices_begin() ); + octandVertices_[3] = supportVertex( TriangleMesh::Normal( real_t( 1), -1_r, -1_r ), *mesh_.vertices_begin() ); + octandVertices_[4] = supportVertex( TriangleMesh::Normal( -1_r, real_t( 1), real_t( 1) ), *mesh_.vertices_begin() ); + octandVertices_[5] = supportVertex( TriangleMesh::Normal( -1_r, real_t( 1), -1_r ), *mesh_.vertices_begin() ); + octandVertices_[6] = supportVertex( TriangleMesh::Normal( -1_r, -1_r, real_t( 1) ), *mesh_.vertices_begin() ); + octandVertices_[7] = supportVertex( TriangleMesh::Normal( -1_r, -1_r, -1_r ), *mesh_.vertices_begin() ); } @@ -193,7 +193,7 @@ real_t ConvexPolyhedron::getSurfaceArea() const */ Vec3 ConvexPolyhedron::support( const Vec3& d ) const { - if (math::equal(d.length(), real_t(0))) return Vec3(0,0,0); + if (math::equal(d.length(), 0_r)) return Vec3(0,0,0); TriangleMesh::Normal d_loc = toOpenMesh( vectorFromWFtoBF(d) ); @@ -302,7 +302,7 @@ bool ConvexPolyhedron::containsRelPointImpl( real_t px, real_t py, real_t pz ) c const TriangleMesh::Normal & n = mesh_.normal(fh); // Plane normal const TriangleMesh::Point & pp = mesh_.point(mesh_.to_vertex_handle(mesh_.halfedge_handle(fh))); // Point on plane - if( n[0] * (px - pp[0]) + n[1] * (py - pp[1]) + n[2] * (pz - pp[2]) >= real_t(0) ) + if( n[0] * (px - pp[0]) + n[1] * (py - pp[1]) + n[2] * (pz - pp[2]) >= 0_r ) return false; } diff --git a/src/mesh/pe/tesselation/Box.h b/src/mesh/pe/tesselation/Box.h index 242e52a9..84a0fd35 100644 --- a/src/mesh/pe/tesselation/Box.h +++ b/src/mesh/pe/tesselation/Box.h @@ -36,7 +36,7 @@ void tesselateBox( const walberla::pe::Box & box, MeshType & mesh, std::vector<t typedef typename MeshType::VertexHandle VertexHandle; typedef typename MeshType::FaceHandle FaceHandle; - const Vector3<real_t> d = real_t(0.5) * box.getLengths(); + const Vector3<real_t> d = 0.5_r * box.getLengths(); const VertexHandle nnn = mesh.add_vertex( toOpenMeshNumericCast<Scalar>( box.pointFromBFtoWF( Vector3<real_t>( -d[0], -d[1], -d[2] ) ) ) ); const VertexHandle nnp = mesh.add_vertex( toOpenMeshNumericCast<Scalar>( box.pointFromBFtoWF( Vector3<real_t>( -d[0], -d[1], +d[2] ) ) ) ); diff --git a/src/pde/ConditionalResidualNorm.h b/src/pde/ConditionalResidualNorm.h index 68307def..5b81ea09 100644 --- a/src/pde/ConditionalResidualNorm.h +++ b/src/pde/ConditionalResidualNorm.h @@ -80,7 +80,7 @@ protected: template< typename Stencil_T, typename FlagField_T > real_t ConditionalResidualNorm< Stencil_T, FlagField_T >::weightedL2() const { - real_t result( real_t(0) ); + real_t result( 0_r ); uint_t cells( uint_t(0) ); for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) @@ -91,7 +91,7 @@ real_t ConditionalResidualNorm< Stencil_T, FlagField_T >::weightedL2() const const FlagField_T * const flag = block->template getData< const FlagField_T >( flagFieldId_ ); auto domain = flag->getMask( domainMask_ ); - real_t blockResult( real_t(0) ); + real_t blockResult( 0_r ); uint_t blockCells( uint_t(0) ); WALBERLA_FOR_ALL_CELLS_XYZ_OMP( uf, omp parallel for schedule(static) reduction(+:blockResult,blockCells), diff --git a/src/pde/ResidualNorm.h b/src/pde/ResidualNorm.h index bd58cad7..47006485 100644 --- a/src/pde/ResidualNorm.h +++ b/src/pde/ResidualNorm.h @@ -80,14 +80,14 @@ protected: template< typename Stencil_T > real_t ResidualNorm< Stencil_T >::weightedL2() const { - real_t result( real_t(0) ); + real_t result( 0_r ); for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) { const Field_T * const uf = block->template getData< const Field_T >( uId_ ); const Field_T * const ff = block->template getData< const Field_T >( fId_ ); - real_t blockResult( real_t(0) ); + real_t blockResult( 0_r ); WALBERLA_FOR_ALL_CELLS_XYZ_OMP( uf, omp parallel for schedule(static) reduction(+:blockResult), diff --git a/src/pde/ResidualNormStencilField.h b/src/pde/ResidualNormStencilField.h index 166caf76..03b82cf5 100644 --- a/src/pde/ResidualNormStencilField.h +++ b/src/pde/ResidualNormStencilField.h @@ -77,7 +77,7 @@ protected: template< typename Stencil_T > real_t ResidualNormStencilField< Stencil_T >::weightedL2() const { - real_t result( real_t(0) ); + real_t result( 0_r ); for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) { @@ -85,7 +85,7 @@ real_t ResidualNormStencilField< Stencil_T >::weightedL2() const const Field_T * const ff = block->template getData< const Field_T >( fId_ ); const StencilField_T * stencil = block->template getData< StencilField_T >( stencilId_ ); - real_t blockResult( real_t(0) ); + real_t blockResult( 0_r ); WALBERLA_FOR_ALL_CELLS_XYZ_OMP( uf, omp parallel for schedule(static) reduction(+:blockResult), diff --git a/src/pde/boundary/Neumann.h b/src/pde/boundary/Neumann.h index ba5fb0e8..6f7033ab 100644 --- a/src/pde/boundary/Neumann.h +++ b/src/pde/boundary/Neumann.h @@ -70,7 +70,7 @@ public: { includeBoundary_[i] = true; order_[i] = uint_t(1); - value_[i] = real_t(0); + value_[i] = 0_r; } dx_[ stencil::D3Q6::idx[ stencil::W ] ] = blocks.dx(); dx_[ stencil::D3Q6::idx[ stencil::E ] ] = blocks.dx(); @@ -177,7 +177,7 @@ void NeumannDomainBoundary< PdeField >::apply( PdeField * p, const CellInterval { if( order == uint_t(1) ) { - if( isIdentical( value, real_t(0) ) ) + if( isIdentical( value, 0_r ) ) { WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_XYZ( interval, p->get(x,y,z) = p->get( x + cx, y + cy, z + cz ); // (dp / dx) == 0 _on_ the boundary @@ -195,7 +195,7 @@ void NeumannDomainBoundary< PdeField >::apply( PdeField * p, const CellInterval { WALBERLA_ASSERT_EQUAL( order, uint_t(2) ); - if( isIdentical( value, real_t(0) ) ) + if( isIdentical( value, 0_r ) ) { WALBERLA_FOR_ALL_CELLS_IN_INTERVAL_XYZ( interval, @@ -204,7 +204,7 @@ void NeumannDomainBoundary< PdeField >::apply( PdeField * p, const CellInterval const real_t boundaryValue = pBoundary + real_c(0.5) * ( pBoundary - pInner ); // extrapolation of value _on_ the boundary - p->get(x,y,z) = real_t(2) * boundaryValue - pBoundary; // (d^2 p / dx^2) == 0 _on_ the boundary + p->get(x,y,z) = 2_r * boundaryValue - pBoundary; // (d^2 p / dx^2) == 0 _on_ the boundary ) } else @@ -217,7 +217,7 @@ void NeumannDomainBoundary< PdeField >::apply( PdeField * p, const CellInterval const real_t boundaryValue = pBoundary + real_c(0.5) * ( pBoundary - pInner ); // extrapolation of value _on_ the boundary - p->get(x,y,z) = vdx + real_t(2) * boundaryValue - pBoundary; // (d^2 p / dx^2) == value _on_ the boundary + p->get(x,y,z) = vdx + 2_r * boundaryValue - pBoundary; // (d^2 p / dx^2) == value _on_ the boundary ) } } diff --git a/src/pde/iterations/CGFixedStencilIteration.h b/src/pde/iterations/CGFixedStencilIteration.h index 145fa37c..e4a443cb 100644 --- a/src/pde/iterations/CGFixedStencilIteration.h +++ b/src/pde/iterations/CGFixedStencilIteration.h @@ -51,7 +51,7 @@ public: const BlockDataID & uId, const BlockDataID & rId, const BlockDataID & dId, const BlockDataID & zId, const BlockDataID & fId, const std::vector< real_t > & weights, const uint_t iterations, const std::function< void () > & synchronizeD, - const real_t residualNormThreshold = real_t(0), + const real_t residualNormThreshold = 0_r, const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ); @@ -215,13 +215,13 @@ void CGFixedStencilIteration< Stencil_T >::calcR() // r = f - Au template< typename Stencil_T > real_t CGFixedStencilIteration< Stencil_T >::scalarProductRR() // r*r { - real_t result( real_t(0) ); + real_t result( 0_r ); for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) { Field_T * rf = block->template getData< Field_T >( rId_ ); - real_t blockResult( real_t(0) ); + real_t blockResult( 0_r ); WALBERLA_FOR_ALL_CELLS_XYZ_OMP( rf, omp parallel for schedule(static) reduction(+:blockResult), @@ -290,7 +290,7 @@ void CGFixedStencilIteration< Stencil_T >::calcAd() // z = Ad template< typename Stencil_T > real_t CGFixedStencilIteration< Stencil_T >::scalarProductDZ() // d*z { - real_t result( real_t(0) ); + real_t result( 0_r ); for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) { @@ -302,7 +302,7 @@ real_t CGFixedStencilIteration< Stencil_T >::scalarProductDZ() // d*z WALBERLA_ASSERT_EQUAL( df->xyzSize(), zf->xyzSize() ); - real_t blockResult( real_t(0) ); + real_t blockResult( 0_r ); WALBERLA_FOR_ALL_CELLS_XYZ_OMP( df, omp parallel for schedule(static) reduction(+:blockResult), diff --git a/src/pde/iterations/CGIteration.h b/src/pde/iterations/CGIteration.h index d3339759..b29f8eb4 100644 --- a/src/pde/iterations/CGIteration.h +++ b/src/pde/iterations/CGIteration.h @@ -52,7 +52,7 @@ public: const BlockDataID & uId, const BlockDataID & rId, const BlockDataID & dId, const BlockDataID & zId, const BlockDataID & fId, const BlockDataID & stencilId, const uint_t iterations, const std::function< void () > & synchronizeD, - const real_t residualNormThreshold = real_t(0), + const real_t residualNormThreshold = 0_r, const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ); @@ -214,13 +214,13 @@ void CGIteration< Stencil_T >::calcR() // r = f - Au template< typename Stencil_T > real_t CGIteration< Stencil_T >::scalarProductRR() // r*r { - real_t result( real_t(0) ); + real_t result( 0_r ); for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) { Field_T * rf = block->template getData< Field_T >( rId_ ); - real_t blockResult( real_t(0) ); + real_t blockResult( 0_r ); WALBERLA_FOR_ALL_CELLS_XYZ_OMP( rf, omp parallel for schedule(static) reduction(+:blockResult), @@ -290,7 +290,7 @@ void CGIteration< Stencil_T >::calcAd() // z = Ad template< typename Stencil_T > real_t CGIteration< Stencil_T >::scalarProductDZ() // d*z { - real_t result( real_t(0) ); + real_t result( 0_r ); for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) { @@ -302,7 +302,7 @@ real_t CGIteration< Stencil_T >::scalarProductDZ() // d*z WALBERLA_ASSERT_EQUAL( df->xyzSize(), zf->xyzSize() ); - real_t blockResult( real_t(0) ); + real_t blockResult( 0_r ); WALBERLA_FOR_ALL_CELLS_XYZ_OMP( df, omp parallel for schedule(static) reduction(+:blockResult), diff --git a/src/pde/iterations/JacobiIteration.cpp b/src/pde/iterations/JacobiIteration.cpp index f088ebe3..44d1e093 100644 --- a/src/pde/iterations/JacobiIteration.cpp +++ b/src/pde/iterations/JacobiIteration.cpp @@ -44,7 +44,7 @@ void JacobiIteration::operator()() for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) jacobi_( block.get() ); - if( residualNormThreshold_ > real_t(0) && residualCheckFrequency_ > uint_t(0) ) + if( residualNormThreshold_ > 0_r && residualCheckFrequency_ > uint_t(0) ) { if( (i % residualCheckFrequency_) == uint_t(0) ) { diff --git a/src/pde/iterations/JacobiIteration.h b/src/pde/iterations/JacobiIteration.h index 3002e7ff..61eb0a85 100644 --- a/src/pde/iterations/JacobiIteration.h +++ b/src/pde/iterations/JacobiIteration.h @@ -42,7 +42,7 @@ public: const std::function< void () > & communication, const std::function< void ( IBlock * ) > & jacobi, const std::function< real_t () > & residualNorm, - const real_t residualNormThreshold = real_t(0), const uint_t residualCheckFrequency = uint_t(1), + const real_t residualNormThreshold = 0_r, const uint_t residualCheckFrequency = uint_t(1), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : blocks_( blocks ), iterations_( iterations ), diff --git a/src/pde/iterations/RBGSIteration.cpp b/src/pde/iterations/RBGSIteration.cpp index 18c503db..50d46be4 100644 --- a/src/pde/iterations/RBGSIteration.cpp +++ b/src/pde/iterations/RBGSIteration.cpp @@ -54,7 +54,7 @@ void RBGSIteration::operator()() for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) blackUpdate_( block.get() ); - if( residualNormThreshold_ > real_t(0) && residualCheckFrequency_ > uint_t(0) ) + if( residualNormThreshold_ > 0_r && residualCheckFrequency_ > uint_t(0) ) { if( (i % residualCheckFrequency_) == uint_t(0) ) { diff --git a/src/pde/iterations/RBGSIteration.h b/src/pde/iterations/RBGSIteration.h index 9f4ee04e..b79e4ff7 100644 --- a/src/pde/iterations/RBGSIteration.h +++ b/src/pde/iterations/RBGSIteration.h @@ -43,7 +43,7 @@ public: const std::function< void ( IBlock * ) > & redUpdate, const std::function< void ( IBlock * ) > & blackUpdate, const std::function< real_t () > & residualNorm, - const real_t residualNormThreshold = real_t(0), const uint_t residualCheckFrequency = uint_t(1), + const real_t residualNormThreshold = 0_r, const uint_t residualCheckFrequency = uint_t(1), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : blocks_( blocks ), iterations_( iterations ), diff --git a/src/pde/iterations/VCycles.h b/src/pde/iterations/VCycles.h index 1d6f12fa..799da3f3 100644 --- a/src/pde/iterations/VCycles.h +++ b/src/pde/iterations/VCycles.h @@ -85,7 +85,7 @@ public: const uint_t iterations, const uint_t numLvl, const uint_t preSmoothingIters, const uint_t postSmoothingIters, const uint_t coarseIters, const std::function< real_t () > & residualNorm, - const real_t residualNormThreshold = real_t(0), const uint_t residualCheckFrequency = uint_t(1), + const real_t residualNormThreshold = 0_r, const uint_t residualCheckFrequency = uint_t(1), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ); @@ -111,7 +111,7 @@ public: const uint_t iterations, const uint_t numLvl, const uint_t preSmoothingIters, const uint_t postSmoothingIters, const uint_t coarseIters, const std::function< real_t () > & residualNorm, - const real_t residualNormThreshold = real_t(0), const uint_t residualCheckFrequency = uint_t(1), + const real_t residualNormThreshold = 0_r, const uint_t residualCheckFrequency = uint_t(1), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ); diff --git a/src/pde/iterations/VCycles.impl.h b/src/pde/iterations/VCycles.impl.h index f202d89e..ee26f099 100644 --- a/src/pde/iterations/VCycles.impl.h +++ b/src/pde/iterations/VCycles.impl.h @@ -60,7 +60,7 @@ VCycles< Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T >:: // Set up fields for finest level uId_.push_back( uFieldId ); fId_.push_back( fFieldId ); - rId_.push_back( field::addToStorage< PdeField_T >( blocks, "r_0", real_t(0), field::zyxf, uint_t(1) ) ); + rId_.push_back( field::addToStorage< PdeField_T >( blocks, "r_0", 0_r, field::zyxf, uint_t(1) ) ); // Check that coarsest grid has more than one cell per dimension auto block = blocks->begin(); @@ -85,27 +85,27 @@ VCycles< Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T >:: } - real_t scalingFactor = real_t(0.25); // scaling by ( 1/h^2 )^lvl + real_t scalingFactor = 0.25_r; // scaling by ( 1/h^2 )^lvl // Set up fields for coarser levels for ( uint_t lvl = 1; lvl < numLvl; ++lvl ) { auto getSize = std::bind(VCycles<Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T>::getSizeForLevel, lvl, std::placeholders::_1, std::placeholders::_2); - uId_.push_back( field::addToStorage< PdeField_T >( blocks, "u_"+boost::lexical_cast<std::string>(lvl), getSize, real_t(0), field::zyxf, uint_t(1) ) ); - fId_.push_back( field::addToStorage< PdeField_T >( blocks, "f_"+boost::lexical_cast<std::string>(lvl), getSize, real_t(0), field::zyxf, uint_t(1) ) ); - rId_.push_back( field::addToStorage< PdeField_T >( blocks, "r_"+boost::lexical_cast<std::string>(lvl), getSize, real_t(0), field::zyxf, uint_t(1) ) ); + uId_.push_back( field::addToStorage< PdeField_T >( blocks, "u_"+boost::lexical_cast<std::string>(lvl), getSize, 0_r, field::zyxf, uint_t(1) ) ); + fId_.push_back( field::addToStorage< PdeField_T >( blocks, "f_"+boost::lexical_cast<std::string>(lvl), getSize, 0_r, field::zyxf, uint_t(1) ) ); + rId_.push_back( field::addToStorage< PdeField_T >( blocks, "r_"+boost::lexical_cast<std::string>(lvl), getSize, 0_r, field::zyxf, uint_t(1) ) ); for ( auto & w: weights_[lvl] ) { w *= scalingFactor; } - scalingFactor *= real_t(0.25); + scalingFactor *= 0.25_r; } // Set up fields for CG on coarsest level auto getFineSize = std::bind(VCycles<Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T>::getSizeForLevel, numLvl-1, std::placeholders::_1, std::placeholders::_2); - dId_ = field::addToStorage< PdeField_T >( blocks, "d", getFineSize, real_t(0), field::zyxf, uint_t(1) ); - zId_ = field::addToStorage< PdeField_T >( blocks, "z", getFineSize, real_t(0), field::zyxf, uint_t(1) ); + dId_ = field::addToStorage< PdeField_T >( blocks, "d", getFineSize, 0_r, field::zyxf, uint_t(1) ); + zId_ = field::addToStorage< PdeField_T >( blocks, "z", getFineSize, 0_r, field::zyxf, uint_t(1) ); // Set up communication for ( uint_t lvl = 0; lvl < numLvl-1; ++lvl ) @@ -127,7 +127,7 @@ VCycles< Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T >:: { RBGSFixedSweeps_.push_back( walberla::make_shared<RBGSFixedStencil< Stencil_T > >( blocks, uId_[lvl], fId_[lvl], weights_[lvl] ) ); RBGSIteration_.push_back( RBGSIteration(blocks->getBlockStorage(), preSmoothingIters_, communication_[lvl], - RBGSFixedSweeps_.back()->getRedSweep(), RBGSFixedSweeps_.back()->getBlackSweep(), [](){ return real_t(1.0); }, 0, 1, + RBGSFixedSweeps_.back()->getRedSweep(), RBGSFixedSweeps_.back()->getBlackSweep(), [](){ return 1.0_r; }, 0, 1, requiredSelectors, incompatibleSelectors ) ); } @@ -142,7 +142,7 @@ VCycles< Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T >:: // Set up CG coarse-grid iteration CGIteration_ = CGFixedStencilIteration< Stencil_T >( blocks->getBlockStorage(), uId_.back(), rId_.back(), dId_, zId_, fId_.back(), weights_.back(), - coarseIters_, communication_.back(), real_t(10)*math::Limits<real_t>::epsilon(), + coarseIters_, communication_.back(), 10_r*math::Limits<real_t>::epsilon(), requiredSelectors, incompatibleSelectors ); } @@ -167,7 +167,7 @@ VCycles< Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T >:: // Set up fields for finest level uId_.push_back( uFieldId ); fId_.push_back( fFieldId ); - rId_.push_back( field::addToStorage< PdeField_T >( blocks, "r_0", real_t(0), field::zyxf, uint_t(1) ) ); + rId_.push_back( field::addToStorage< PdeField_T >( blocks, "r_0", 0_r, field::zyxf, uint_t(1) ) ); stencilId_.push_back( stencilFieldId ); // Check that coarsest grid has more than one cell per dimension @@ -197,20 +197,20 @@ VCycles< Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T >:: for ( uint_t lvl = 1; lvl < numLvl; ++lvl ) { auto getSize = std::bind(VCycles<Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T>::getSizeForLevel, lvl, std::placeholders::_1, std::placeholders::_2); - uId_.push_back( field::addToStorage< PdeField_T >( blocks, "u_"+boost::lexical_cast<std::string>(lvl), getSize, real_t(0), field::zyxf, uint_t(1) ) ); - fId_.push_back( field::addToStorage< PdeField_T >( blocks, "f_"+boost::lexical_cast<std::string>(lvl), getSize, real_t(0), field::zyxf, uint_t(1) ) ); - rId_.push_back( field::addToStorage< PdeField_T >( blocks, "r_"+boost::lexical_cast<std::string>(lvl), getSize, real_t(0), field::zyxf, uint_t(1) ) ); - stencilId_.push_back( field::addToStorage< StencilField_T >( blocks, "w_"+boost::lexical_cast<std::string>(lvl), getSize, real_t(0), field::zyxf, uint_t(1) ) ); + uId_.push_back( field::addToStorage< PdeField_T >( blocks, "u_"+boost::lexical_cast<std::string>(lvl), getSize, 0_r, field::zyxf, uint_t(1) ) ); + fId_.push_back( field::addToStorage< PdeField_T >( blocks, "f_"+boost::lexical_cast<std::string>(lvl), getSize, 0_r, field::zyxf, uint_t(1) ) ); + rId_.push_back( field::addToStorage< PdeField_T >( blocks, "r_"+boost::lexical_cast<std::string>(lvl), getSize, 0_r, field::zyxf, uint_t(1) ) ); + stencilId_.push_back( field::addToStorage< StencilField_T >( blocks, "w_"+boost::lexical_cast<std::string>(lvl), getSize, 0_r, field::zyxf, uint_t(1) ) ); } // CoarsenStencilFieldsDCA<Stencil_T>( blocks, stencilId_, numLvl, uint_t(2)) (); // scaling by ( 1/h^2 )^lvl - // CoarsenStencilFieldsGCA<Stencil_T>( blocks, stencilId_, numLvl, real_t(2)) (); + // CoarsenStencilFieldsGCA<Stencil_T>( blocks, stencilId_, numLvl, 2_r) (); operatorCoarsening(stencilId_); // Set up fields for CG on coarsest level auto getFineSize = std::bind(VCycles<Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T>::getSizeForLevel, numLvl-1, std::placeholders::_1, std::placeholders::_2); - dId_ = field::addToStorage< PdeField_T >( blocks, "d", getFineSize, real_t(0), field::zyxf, uint_t(1) ); - zId_ = field::addToStorage< PdeField_T >( blocks, "z", getFineSize, real_t(0), field::zyxf, uint_t(1) ); + dId_ = field::addToStorage< PdeField_T >( blocks, "d", getFineSize, 0_r, field::zyxf, uint_t(1) ); + zId_ = field::addToStorage< PdeField_T >( blocks, "z", getFineSize, 0_r, field::zyxf, uint_t(1) ); // Set up communication for ( uint_t lvl = 0; lvl < numLvl-1; ++lvl ) @@ -232,7 +232,7 @@ VCycles< Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T >:: { RBGSSweeps_.push_back( walberla::make_shared<RBGS< Stencil_T > >( blocks, uId_[lvl], fId_[lvl], stencilId_[lvl] ) ); RBGSIteration_.push_back( RBGSIteration(blocks->getBlockStorage(), preSmoothingIters_, communication_[lvl], - RBGSSweeps_.back()->getRedSweep(), RBGSSweeps_.back()->getBlackSweep(), [](){ return real_t(1.0); }, 0, 1, + RBGSSweeps_.back()->getRedSweep(), RBGSSweeps_.back()->getBlackSweep(), [](){ return 1.0_r; }, 0, 1, requiredSelectors, incompatibleSelectors ) ); } @@ -247,7 +247,7 @@ VCycles< Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_T >:: // Set up CG coarse-grid iteration CGIteration_ = CGIteration< Stencil_T >( blocks->getBlockStorage(), uId_.back(), rId_.back(), dId_, zId_, fId_.back(), stencilId_.back(), - coarseIters_, communication_.back(), real_t(10)*math::Limits<real_t>::epsilon(), + coarseIters_, communication_.back(), 10_r*math::Limits<real_t>::epsilon(), requiredSelectors, incompatibleSelectors ); } @@ -259,12 +259,12 @@ void VCycles< Stencil_T, OperatorCoarsening_T, Restrict_T, ProlongateAndCorrect_ WALBERLA_LOG_PROGRESS_ON_ROOT( "Starting VCycle iteration with a maximum number of " << iterations_ << " cycles and " << numLvl_ << " levels" ); thresholdReached_ = false; - real_t residualNorm_old = real_t(1); + real_t residualNorm_old = 1_r; for( uint_t i = 0; i < iterations_; ++i ) { // compute L2 norm of residual as termination criterion - if( residualNormThreshold_ > real_t(0) && residualCheckFrequency_ > uint_t(0) ) + if( residualNormThreshold_ > 0_r && residualCheckFrequency_ > uint_t(0) ) { if( (i % residualCheckFrequency_) == uint_t(0) ) { diff --git a/src/pde/sweeps/JacobiFixedStencil.h b/src/pde/sweeps/JacobiFixedStencil.h index eb1367aa..fffd79e1 100644 --- a/src/pde/sweeps/JacobiFixedStencil.h +++ b/src/pde/sweeps/JacobiFixedStencil.h @@ -66,7 +66,7 @@ void JacobiFixedStencil< Stencil_T >::operator()( IBlock * const block ) real_t weights[ Stencil_T::Size ]; for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir ) weights[ dir.toIdx() ] = this->w( dir.toIdx() ); - weights[ Stencil_T::idx[ stencil::C ] ] = real_t(1) / this->w( Stencil_T::idx[ stencil::C ] ); // center already inverted here! + weights[ Stencil_T::idx[ stencil::C ] ] = 1_r / this->w( Stencil_T::idx[ stencil::C ] ); // center already inverted here! WALBERLA_FOR_ALL_CELLS_XYZ( sf, diff --git a/src/pde/sweeps/Multigrid.h b/src/pde/sweeps/Multigrid.h index 58d4d8f0..dc5837cf 100644 --- a/src/pde/sweeps/Multigrid.h +++ b/src/pde/sweeps/Multigrid.h @@ -200,7 +200,7 @@ public: void operator()( IBlock * const block ) const { - block->getData< Field_T >( fieldId_ )->setWithGhostLayer( real_t(0) ); + block->getData< Field_T >( fieldId_ )->setWithGhostLayer( 0_r ); } private: @@ -277,7 +277,7 @@ public: * \param overrelaxFact overrelaxation factor, e.g. 2 for the Poisson equation *******************************************************************************************************************/ CoarsenStencilFieldsGCA( shared_ptr< StructuredBlockForest > blocks, - const uint_t numLvl, const real_t overrelaxFact = real_t(1), + const uint_t numLvl, const real_t overrelaxFact = 1_r, const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : blocks_( blocks ), numLvl_(numLvl), overrelaxFact_(overrelaxFact), diff --git a/src/pde/sweeps/Multigrid.impl.h b/src/pde/sweeps/Multigrid.impl.h index e4b5decf..e0541c42 100644 --- a/src/pde/sweeps/Multigrid.impl.h +++ b/src/pde/sweeps/Multigrid.impl.h @@ -66,7 +66,7 @@ void Restrict< Stencil_T >::operator()( IBlock * const block ) const else { WALBERLA_ASSERT_EQUAL(z, 0); - coarse->get(x,y,z) = real_t(0); + coarse->get(x,y,z) = 0_r; } coarse->get(x,y,z) += fine->get(fx , fy , fz ) + fine->get(fx+1, fy , fz ) @@ -85,12 +85,12 @@ void ProlongateAndCorrect< Stencil_T >::operator()( IBlock * const block ) const WALBERLA_FOR_ALL_CELLS_XYZ( fine, if( Stencil_T::D == uint_t(3) ) { - fine->get(x,y,z) += real_t(0.125) * coarse->get(x/2,y/2,z/2); + fine->get(x,y,z) += 0.125_r * coarse->get(x/2,y/2,z/2); } else { WALBERLA_ASSERT_EQUAL(z, 0); - fine->get(x,y,z) += real_t(0.25) * coarse->get(x/2,y/2,z); + fine->get(x,y,z) += 0.25_r * coarse->get(x/2,y/2,z); } ); } @@ -157,7 +157,7 @@ void ComputeResidualFixedStencil< Stencil_T >::operator()( IBlock * const block template< typename Stencil_T > void CoarsenStencilFieldsDCA<Stencil_T >::operator()( const std::vector<BlockDataID> & stencilFieldId ) const { - const real_t scalingFactor = real_t(1)/real_c(2<< (operatorOrder_-1) ); // scaling by ( 1/h^operatorOrder )^lvl + const real_t scalingFactor = 1_r/real_c(2<< (operatorOrder_-1) ); // scaling by ( 1/h^operatorOrder )^lvl WALBERLA_ASSERT_EQUAL(numLvl_, stencilFieldId.size(), "This function can only be called when operating with stencil fields!"); @@ -203,7 +203,7 @@ void CoarsenStencilFieldsGCA< stencil::D3Q7 >::operator()( const std::vector<Blo for(Array3D::index z=0; z<2; ++z) { for(Array3D::index y=0; y<2; ++y) { for(Array3D::index x=0; x<2; ++x) { - r[x][y][z] = real_t(1); + r[x][y][z] = 1_r; } } } @@ -212,7 +212,7 @@ void CoarsenStencilFieldsGCA< stencil::D3Q7 >::operator()( const std::vector<Blo for(Array3D::index k=0; k<7; ++k) { for(Array3D::index j=0; j<7; ++j) { for(Array3D::index i=0; i<7; ++i) { - p[i][j][k] = real_t(0); + p[i][j][k] = 0_r; } } } @@ -221,7 +221,7 @@ void CoarsenStencilFieldsGCA< stencil::D3Q7 >::operator()( const std::vector<Blo for(Array3D::index k=0; k<2; ++k) { for(Array3D::index j=0; j<2; ++j) { for(Array3D::index i=0; i<2; ++i) { - p[i+2][j+2][k+2] = real_t(0.125)/overrelaxFact_; // Factor 0.125 such that same prolongation operator for DCA and GCA + p[i+2][j+2][k+2] = 0.125_r/overrelaxFact_; // Factor 0.125 such that same prolongation operator for DCA and GCA } } } @@ -238,14 +238,14 @@ void CoarsenStencilFieldsGCA< stencil::D3Q7 >::operator()( const std::vector<Blo for(Array3D::index k=0; k<7; ++k) for(Array3D::index j=0; j<7; ++j) for(Array3D::index i=0; i<7; ++i) - ap[i][j][k] = real_t(0); + ap[i][j][k] = 0_r; // Tested for spatially varying stencils! // for(Array3D::index k=1; k<5; ++k) for(Array3D::index j=1; j<5; ++j) for(Array3D::index i=1; i<5; ++i) { - ap[i][j][k] = real_t(0); + ap[i][j][k] = 0_r; for(auto d = stencil::D3Q7::begin(); d != stencil::D3Q7::end(); ++d ){ ap[i][j][k] += p[ i+d.cx() ] [ j+d.cy() ] [k+d.cz() ] * fine->get( fx+cell_idx_c(i%2), fy+cell_idx_c(j%2), fz+cell_idx_c(k%2), d.toIdx() ); // contains elements of one row of coarse grid matrix } diff --git a/src/pde/sweeps/RBGS.h b/src/pde/sweeps/RBGS.h index 69f7245f..9e0f6cb0 100644 --- a/src/pde/sweeps/RBGS.h +++ b/src/pde/sweeps/RBGS.h @@ -74,7 +74,7 @@ void RBGS< Stencil_T >::update( IBlock * const block, const bool rb ) { #ifndef NDEBUG for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir ) - WALBERLA_ASSERT( realIsIdentical( dir.length(), real_t(1) ) ); + WALBERLA_ASSERT( realIsIdentical( dir.length(), 1_r ) ); #endif Field_T * uf( NULL ); diff --git a/src/pde/sweeps/RBGSFixedStencil.h b/src/pde/sweeps/RBGSFixedStencil.h index 75196987..f91365fe 100644 --- a/src/pde/sweeps/RBGSFixedStencil.h +++ b/src/pde/sweeps/RBGSFixedStencil.h @@ -73,7 +73,7 @@ void RBGSFixedStencil< Stencil_T >::update( IBlock * const block, const bool rb { #ifndef NDEBUG for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir ) - WALBERLA_ASSERT( realIsIdentical( dir.length(), real_t(1) ) ); + WALBERLA_ASSERT( realIsIdentical( dir.length(), 1_r ) ); #endif Field_T * uf( NULL ); @@ -86,7 +86,7 @@ void RBGSFixedStencil< Stencil_T >::update( IBlock * const block, const bool rb real_t weights[ Stencil_T::Size ]; for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir ) weights[ dir.toIdx() ] = this->w( dir.toIdx() ); - weights[ Stencil_T::idx[ stencil::C ] ] = real_t(1) / this->w( Stencil_T::idx[ stencil::C ] ); // center already inverted here! + weights[ Stencil_T::idx[ stencil::C ] ] = 1_r / this->w( Stencil_T::idx[ stencil::C ] ); // center already inverted here! cell_idx_t zero = cell_idx_t(0); cell_idx_t one = cell_idx_t(1); diff --git a/src/pde/sweeps/SOR.h b/src/pde/sweeps/SOR.h index 4997b40d..7b590a4f 100644 --- a/src/pde/sweeps/SOR.h +++ b/src/pde/sweeps/SOR.h @@ -74,7 +74,7 @@ void SOR< Stencil_T >::update( IBlock * const block, const bool rb ) { #ifndef NDEBUG for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir ) - WALBERLA_ASSERT( realIsIdentical( dir.length(), real_t(1) ) ); + WALBERLA_ASSERT( realIsIdentical( dir.length(), 1_r ) ); #endif Field_T * uf( NULL ); @@ -87,7 +87,7 @@ void SOR< Stencil_T >::update( IBlock * const block, const bool rb ) const cell_idx_t zero = cell_idx_t(0); const cell_idx_t one = cell_idx_t(1); - const real_t omegaInv = real_t(1) - omega_; + const real_t omegaInv = 1_r - omega_; Cell cell(zero,zero,zero); blocks_->transformBlockLocalToGlobalCell( cell, *block ); diff --git a/src/pde/sweeps/SORFixedStencil.h b/src/pde/sweeps/SORFixedStencil.h index d3983ab1..f01537ac 100644 --- a/src/pde/sweeps/SORFixedStencil.h +++ b/src/pde/sweeps/SORFixedStencil.h @@ -73,7 +73,7 @@ void SORFixedStencil< Stencil_T >::update( IBlock * const block, const bool rb ) { #ifndef NDEBUG for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir ) - WALBERLA_ASSERT( realIsIdentical( dir.length(), real_t(1) ) ); + WALBERLA_ASSERT( realIsIdentical( dir.length(), 1_r ) ); #endif Field_T * uf( NULL ); @@ -86,12 +86,12 @@ void SORFixedStencil< Stencil_T >::update( IBlock * const block, const bool rb ) real_t weights[ Stencil_T::Size ]; for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir ) weights[ dir.toIdx() ] = this->w( dir.toIdx() ); - weights[ Stencil_T::idx[ stencil::C ] ] = real_t(1) / this->w( Stencil_T::idx[ stencil::C ] ); // center already inverted here! + weights[ Stencil_T::idx[ stencil::C ] ] = 1_r / this->w( Stencil_T::idx[ stencil::C ] ); // center already inverted here! const cell_idx_t zero = cell_idx_t(0); const cell_idx_t one = cell_idx_t(1); - const real_t omegaInv = real_t(1) - omega_; + const real_t omegaInv = 1_r - omega_; Cell cell(zero,zero,zero); blocks_->transformBlockLocalToGlobalCell( cell, *block ); diff --git a/src/pe/amr/weight_assignment/MetisAssignmentFunctor.h b/src/pe/amr/weight_assignment/MetisAssignmentFunctor.h index dd1fdac5..e5998a19 100644 --- a/src/pe/amr/weight_assignment/MetisAssignmentFunctor.h +++ b/src/pe/amr/weight_assignment/MetisAssignmentFunctor.h @@ -36,7 +36,7 @@ public: typedef blockforest::DynamicParMetisBlockInfo PhantomBlockWeight; typedef blockforest::DynamicParMetisBlockInfoPackUnpack PhantomBlockWeightPackUnpackFunctor; - MetisAssignmentFunctor( shared_ptr<InfoCollection>& ic, const real_t baseWeight = real_t(10.0) ) : ic_(ic), baseWeight_(baseWeight) {} + MetisAssignmentFunctor( shared_ptr<InfoCollection>& ic, const real_t baseWeight = 10.0_r ) : ic_(ic), baseWeight_(baseWeight) {} void operator()( std::vector< std::pair< const PhantomBlock *, walberla::any > > & blockData, const PhantomBlockForest & forest ) { diff --git a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h b/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h index 7c7b3817..f0ab8809 100644 --- a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h +++ b/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h @@ -35,7 +35,7 @@ public: typedef walberla::blockforest::PODPhantomWeight<double> PhantomBlockWeight; typedef walberla::blockforest::PODPhantomWeightPackUnpack<double> PhantomBlockWeightPackUnpackFunctor; - WeightAssignmentFunctor( shared_ptr<InfoCollection>& ic, const real_t baseWeight = real_t(10.0) ) : ic_(ic), baseWeight_(baseWeight) {} + WeightAssignmentFunctor( shared_ptr<InfoCollection>& ic, const real_t baseWeight = 10.0_r ) : ic_(ic), baseWeight_(baseWeight) {} void operator()( std::vector< std::pair< const PhantomBlock *, walberla::any > > & blockData, const PhantomBlockForest & ) { @@ -58,7 +58,7 @@ private: shared_ptr<InfoCollection> ic_; ///Base weight due to allocated data structures. A weight of zero for blocks is dangerous as empty blocks might accumulate on one process! - double baseWeight_ = real_t(10.0); + double baseWeight_ = 10.0_r; }; } diff --git a/src/pe/ccd/HashGrids.h b/src/pe/ccd/HashGrids.h index 49c40b5c..3f81c686 100644 --- a/src/pe/ccd/HashGrids.h +++ b/src/pe/ccd/HashGrids.h @@ -526,9 +526,9 @@ BodyID HashGrids::HashGrid::getBodyIntersectionForBlockCell(const Vector3<int32_ raytracing::IntersectsFunctor intersectsFunc(ray, t_local, n_local); // calculate center coordinates of the cell in the block - real_t x = (real_c(blockCell[0]) + real_t(0.5)) * cellSpan_; - real_t y = (real_c(blockCell[1]) + real_t(0.5)) * cellSpan_; - real_t z = (real_c(blockCell[2]) + real_t(0.5)) * cellSpan_; + real_t x = (real_c(blockCell[0]) + 0.5_r) * cellSpan_; + real_t y = (real_c(blockCell[1]) + 0.5_r) * cellSpan_; + real_t z = (real_c(blockCell[2]) + 0.5_r) * cellSpan_; // hash of cell in the hashgrid size_t cellHash = hashPoint(x, y, z); @@ -639,7 +639,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c Vec3 firstPointNormal; if (intersects(blockAABB, ray, t_start, cellSpan_, &firstPointNormal)) { firstPoint = ray.getOrigin() + ray.getDirection()*t_start; - firstPointCenteredInCell = firstPoint - firstPointNormal * (cellSpan_/real_t(2)); + firstPointCenteredInCell = firstPoint - firstPointNormal * (cellSpan_/2_r); tRayOriginToGrid = (ray.getOrigin() - firstPoint).length(); } else { return NULL; diff --git a/src/pe/collision/EPA.cpp b/src/pe/collision/EPA.cpp index 8e93e89a..2b128746 100644 --- a/src/pe/collision/EPA.cpp +++ b/src/pe/collision/EPA.cpp @@ -81,11 +81,11 @@ inline EPA::EPA_Triangle::EPA_Triangle( size_t a, size_t b, size_t c, real_t vc = nT * (A % B); real_t va = nT * (B % C); real_t vb = nT * (C % A); - real_t denom = real_t(1.0) / (va + vb + vc); + real_t denom = 1.0_r / (va + vb + vc); bar_[0] = va * denom; bar_[1] = vb * denom; - bar_[2] = real_t(1.0) - bar_[0] - bar_[1]; + bar_[2] = 1.0_r - bar_[0] - bar_[1]; closest_ = bar_[0] * A + bar_[1] * B + bar_[2] * C; diff --git a/src/pe/collision/EPA.h b/src/pe/collision/EPA.h index a318e7e5..42e1078f 100644 --- a/src/pe/collision/EPA.h +++ b/src/pe/collision/EPA.h @@ -435,7 +435,7 @@ inline bool EPA::EPA_Triangle::isObsolete() const */ inline bool EPA::EPA_Triangle::isClosestInternal() const { - real_t tol = real_t(0.0); + real_t tol = 0.0_r; return bar_[0] >= tol && bar_[1] >= tol && bar_[2] >= tol; @@ -478,7 +478,7 @@ inline void EPA::pushSupportMargin(const GeomPrimitive &geom1, const GeomPrimiti std::vector<Vec3>& epaVolume, std::vector<Vec3>& supportA, std::vector<Vec3>& supportB) { Vec3 ndir; - if(floatIsEqual(dir.sqrLength(), real_t(1.0))){ + if(floatIsEqual(dir.sqrLength(), 1.0_r)){ ndir = dir.getNormalized(); }else{ ndir = dir; @@ -488,7 +488,7 @@ inline void EPA::pushSupportMargin(const GeomPrimitive &geom1, const GeomPrimiti supportA.push_back(sA); supportB.push_back(sB); - Vec3 support = sA -sB + real_t(2.0) * ndir * margin; + Vec3 support = sA -sB + 2.0_r * ndir * margin; epaVolume.push_back(support); } //************************************************************************************************* @@ -505,14 +505,14 @@ inline void EPA::replaceSupportMargin(const GeomPrimitive &geom1, const GeomPrim std::vector<Vec3>& epaVolume, std::vector<Vec3>& supportA, std::vector<Vec3>& supportB, size_t indexToReplace) { Vec3 ndir; - if(floatIsEqual(dir.sqrLength(), real_t(1.0))){ + if(floatIsEqual(dir.sqrLength(), 1.0_r)){ ndir = dir.getNormalized(); }else{ ndir = dir; } Vec3 sA = geom1.support(ndir); Vec3 sB = geom2.support(-ndir); - Vec3 support = sA -sB + real_t(2.0) * ndir * margin; + Vec3 support = sA -sB + 2.0_r * ndir * margin; supportA[indexToReplace] = sA; supportB[indexToReplace] = sB; diff --git a/src/pe/collision/GJK.cpp b/src/pe/collision/GJK.cpp index e25c62b5..e5aa8ad8 100644 --- a/src/pe/collision/GJK.cpp +++ b/src/pe/collision/GJK.cpp @@ -73,7 +73,7 @@ real_t GJK::doGJK(GeomPrimitive &geom1, GeomPrimitive &geom2, Vec3& normal, Vec3 simplex_[0] = support; numPoints_ = 1; - if(support * d_ < real_t(0.0)){ + if(support * d_ < 0.0_r){ //we went as far as we could in direction 'd' but not passed the origin //this means the bodies don't overlap ret = calcDistance(normal, contactPoint); @@ -95,7 +95,7 @@ real_t GJK::doGJK(GeomPrimitive &geom1, GeomPrimitive &geom2, Vec3& normal, Vec3 //std::cerr << "[GJK] Got Support: " << support << std::endl; //check if "support" is passed the origin in search direction - if(support * d_ < real_t(0.0)){ + if(support * d_ < 0.0_r){ //we went as far as we could in direction 'd' but not passed the origin //this means the bodies don't overlap //calc distance simplex to Origin @@ -300,7 +300,7 @@ inline real_t GJK::calcDistance( Vec3& normal, Vec3& contactPoint ) { //the only point in simplex is closest to Origin dist = std::sqrt(A.sqrLength()); - u = real_t(1.0); + u = 1.0_r; break; } case 2: @@ -317,10 +317,10 @@ inline real_t GJK::calcDistance( Vec3& normal, Vec3& contactPoint ) //calc baryzenctric coordinats // compare "Real-Time Collision Detection" by Christer Ericson page 129 //double t = ac*ab; - real_t t = real_t(-1.0) * (A * ab); + real_t t = -1.0_r * (A * ab); real_t denom = std::sqrt(ab.sqrLength()); u = t / denom; - v = real_t(1.0) - u; + v = 1.0_r - u; Vec3 closestPoint = u*A + v*B; dist = std::sqrt(closestPoint.sqrLength()); // compare "Real-Time Collision Detection" by Christer Ericson page 130 @@ -346,10 +346,10 @@ inline real_t GJK::calcDistance( Vec3& normal, Vec3& contactPoint ) real_t vc = nT * (A % B); real_t va = nT * (B % C); real_t vb = nT * (C % A); - real_t denom = real_t(1.0) / (va + vb + vc); + real_t denom = 1.0_r / (va + vb + vc); u = va * denom; v = vb * denom; - w = real_t(1.0) - u - v; + w = 1.0_r - u - v; //std::cerr << u << " " << v << " " << w << std::endl; Vec3 closestPoint = u*A + v*B + w*C; dist = std::sqrt(closestPoint.sqrLength()); @@ -371,7 +371,7 @@ inline real_t GJK::calcDistance( Vec3& normal, Vec3& contactPoint ) } normal = (pointOnA - pointOnB).getNormalized(); - contactPoint = (pointOnA + pointOnB) * real_t(0.5); + contactPoint = (pointOnA + pointOnB) * 0.5_r; return dist; @@ -417,7 +417,7 @@ bool GJK::simplex2(Vec3& d) //if the new search direction has zero length //than the origin is on the simplex if(zeroLengthVector(d)) { - d_ = Vec3(real_t(0.0),real_t(0.6),real_t(0.8)); // give the GJK a chance to rerun + d_ = Vec3(0.0_r,0.6_r,0.8_r); // give the GJK a chance to rerun return true; } return false; @@ -544,7 +544,7 @@ bool GJK::simplex3(Vec3& d) //if the new search direction has zero length //than the origin is on the boundary of the simplex if(zeroLengthVector(d)) { - d_ = Vec3(real_t(0.0),real_t(0.6),real_t(0.8)); // give the GJK a chance to rerun + d_ = Vec3(0.0_r,0.6_r,0.8_r); // give the GJK a chance to rerun return true; } return false; diff --git a/src/pe/collision/GJK.h b/src/pe/collision/GJK.h index a562ccc0..a6fb69b0 100644 --- a/src/pe/collision/GJK.h +++ b/src/pe/collision/GJK.h @@ -115,7 +115,7 @@ private: //************************************************************************************************* inline GJK::GJK() : simplex_(4), supportA_(4), supportB_(4), numPoints_(0) { - d_ = Vec3(real_t(0.0),real_t(0.6),real_t(0.8)); // just start with any vector of length 1 + d_ = Vec3(0.0_r,0.6_r,0.8_r); // just start with any vector of length 1 } //************************************************************************************************* @@ -169,7 +169,7 @@ inline const std::vector<Vec3>& GJK::getSupportB() const */ inline bool GJK::sameDirection(const Vec3& vec1, const Vec3& vec2) const { - return vec1 * vec2 > real_t(0.0); + return vec1 * vec2 > 0.0_r; } //************************************************************************************************* @@ -194,7 +194,7 @@ inline const Vec3 GJK::putSupport(const GeomPrimitive &geom1, const GeomPrimitiv std::vector<Vec3> &simplex, std::vector<Vec3> &supportA, std::vector<Vec3> &supportB, size_t index){ supportA[index] = geom1.support(dir); supportB[index] = geom2.support(-dir); - Vec3 supp = supportA[index]- supportB[index] + (real_t(2.0) * dir * margin); + Vec3 supp = supportA[index]- supportB[index] + (2.0_r * dir * margin); simplex[index] = supp; return supp; } diff --git a/src/pe/contact/ContactFunctions.impl.h b/src/pe/contact/ContactFunctions.impl.h index 2585eae0..01e6dc6a 100644 --- a/src/pe/contact/ContactFunctions.impl.h +++ b/src/pe/contact/ContactFunctions.impl.h @@ -123,7 +123,7 @@ inline real_t getRestitution(ConstContactID c) { return Material::getRestitution( c->getBody1()->getMaterial(), c->getBody1()->getMaterial() ); } - return real_t(0.0); + return 0.0_r; } // Calculate the stiffness and damping parameters diff --git a/src/pe/cr/HCSITS.h b/src/pe/cr/HCSITS.h index 896f3580..82aa4a9c 100644 --- a/src/pe/cr/HCSITS.h +++ b/src/pe/cr/HCSITS.h @@ -150,7 +150,7 @@ public: inline void setRelaxationModel( RelaxationModel relaxationModel ); inline void setErrorReductionParameter( real_t erp ); inline void setAbortThreshold( real_t threshold ); - inline void setSpeedLimiter( bool active, const real_t speedLimitFactor = real_t(0.0) ); + inline void setSpeedLimiter( bool active, const real_t speedLimitFactor = 0.0_r ); //@} //********************************************************************************************** diff --git a/src/pe/cr/HCSITS.impl.h b/src/pe/cr/HCSITS.impl.h index 314b3d1c..2ff0c352 100644 --- a/src/pe/cr/HCSITS.impl.h +++ b/src/pe/cr/HCSITS.impl.h @@ -1807,7 +1807,7 @@ inline void HardContactSemiImplicitTimesteppingSolvers::integratePositions( Body v = v * (edge * getSpeedLimitFactor() / dt / speed ); } - const real_t maxPhi = real_t(2) * math::PI * getSpeedLimitFactor(); + const real_t maxPhi = 2_r * math::PI * getSpeedLimitFactor(); const real_t phi = w.length() * dt; if (phi > maxPhi) { @@ -1850,10 +1850,10 @@ void configure( const Config::BlockHandle& config, pe::cr::HCSITS& cr ) int HCSITSmaxIterations = config.getParameter<int>("HCSITSmaxIterations", 10); WALBERLA_LOG_INFO_ON_ROOT("HCSITSmaxIterations: " << HCSITSmaxIterations); - real_t HCSITSRelaxationParameter = config.getParameter<real_t>("HCSITSRelaxationParameter", real_t(0.75) ); + real_t HCSITSRelaxationParameter = config.getParameter<real_t>("HCSITSRelaxationParameter", 0.75_r ); WALBERLA_LOG_INFO_ON_ROOT("HCSITSRelaxationParameter: " << HCSITSRelaxationParameter); - real_t HCSITSErrorReductionParameter = config.getParameter<real_t>("HCSITSErrorReductionParameter", real_t(0.8) ); + real_t HCSITSErrorReductionParameter = config.getParameter<real_t>("HCSITSErrorReductionParameter", 0.8_r ); WALBERLA_LOG_INFO_ON_ROOT("HCSITSErrorReductionParameter: " << HCSITSErrorReductionParameter); std::string HCSITSRelaxationModelStr = config.getParameter<std::string>("HCSITSRelaxationModelStr", "ApproximateInelasticCoulombContactByDecoupling" ); diff --git a/src/pe/fcd/AnalyticCollisionDetection.h b/src/pe/fcd/AnalyticCollisionDetection.h index 2bf9513b..3a6998f9 100644 --- a/src/pe/fcd/AnalyticCollisionDetection.h +++ b/src/pe/fcd/AnalyticCollisionDetection.h @@ -275,7 +275,7 @@ inline bool collide( SphereID s, BoxID b, Container& container ) { //WALBERLA_ABORT(s << b); - const Vec3 l( real_t(0.5)*b->getLengths() ); // Box half side lengths + const Vec3 l( 0.5_r*b->getLengths() ); // Box half side lengths const Vec3& spos( s->getPosition() ); // Global position of the sphere const Vec3& bpos( b->getPosition() ); // Global position of the box const Mat3& R( b->getRotation() ); // Rotation of the box @@ -404,12 +404,12 @@ bool collide( BoxID b1, BoxID b2, Container& container ) const Vec3 b2_rPos( b1->getRotation().getTranspose() * ( b2->getPosition() - b1->getPosition() ) ); // Calculating the half Lengths of both boxes - const real_t hl1[] = { real_t(0.5) * b1->getLengths()[0], - real_t(0.5) * b1->getLengths()[1], - real_t(0.5) * b1->getLengths()[2] }; - const real_t hl2[] = { real_t(0.5) * b2->getLengths()[0], - real_t(0.5) * b2->getLengths()[1], - real_t(0.5) * b2->getLengths()[2] }; + const real_t hl1[] = { 0.5_r * b1->getLengths()[0], + 0.5_r * b1->getLengths()[1], + 0.5_r * b1->getLengths()[2] }; + const real_t hl2[] = { 0.5_r * b2->getLengths()[0], + 0.5_r * b2->getLengths()[1], + 0.5_r * b2->getLengths()[2] }; //----- Testing the three axes of box 1 ----- @@ -427,7 +427,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = term1; contactNormal = Vec3( R1[0], R1[3], R1[6] ); contactCase = 1; - invertNormal = ( b2_rPos[0] < real_t(0) ); + invertNormal = ( b2_rPos[0] < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 1 succeeded!\n" << @@ -445,7 +445,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = term1; contactNormal = Vec3( R1[1], R1[4], R1[7] ); contactCase = 2; - invertNormal = ( b2_rPos[1] < real_t(0) ); + invertNormal = ( b2_rPos[1] < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 2 succeeded!\n" << @@ -463,7 +463,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = term1; contactNormal = Vec3( R1[2], R1[5], R1[8] ); contactCase = 3; - invertNormal = ( b2_rPos[2] < real_t(0) ); + invertNormal = ( b2_rPos[2] < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 3 succeeded!\n" << @@ -487,7 +487,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = term2; contactNormal = Vec3( R2[0], R2[3], R2[6] ); contactCase = 4; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 4 succeeded!\n" << @@ -506,7 +506,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = term2; contactNormal = Vec3( R2[1], R2[4], R2[7] ); contactCase = 5; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 5 succeeded!\n" << @@ -525,7 +525,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = term2; contactNormal = Vec3( R2[2], R2[5], R2[8] ); contactCase = 6; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 6 succeeded!\n" << @@ -558,7 +558,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = sum; normal_c = Vec3( 0, -b2_rR[6]/length, b2_rR[3]/length ); contactCase = 7; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 7 succeeded!\n" << @@ -585,7 +585,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = sum; normal_c = Vec3( 0, -b2_rR[7]/length, b2_rR[4]/length ); contactCase = 8; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 8 succeeded!\n" << @@ -612,7 +612,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = sum; normal_c = Vec3( 0, -b2_rR[8]/length, b2_rR[5]/length ); contactCase = 9; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 9 succeeded!\n" << @@ -639,7 +639,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = sum; normal_c = Vec3( b2_rR[6]/length, 0, -b2_rR[0]/length ); contactCase = 10; - invertNormal = ( term1 < real_t(0) ) ; + invertNormal = ( term1 < 0_r ) ; WALBERLA_LOG_DETAIL( " Contact test 10 succeeded!\n" << @@ -666,7 +666,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = sum; normal_c = Vec3( b2_rR[7]/length, 0, -b2_rR[1]/length ); contactCase = 11; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 11 succeeded!\n" << @@ -693,7 +693,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = sum; normal_c = Vec3( b2_rR[8]/length, 0, -b2_rR[2]/length ); contactCase = 12; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 12 succeeded!\n" << @@ -720,7 +720,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = sum; normal_c = Vec3( -b2_rR[3]/length, b2_rR[0]/length, 0 ); contactCase = 13; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 13 succeeded!\n" << @@ -747,7 +747,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = sum; normal_c = Vec3( -b2_rR[4]/length, b2_rR[1]/length, 0 ); contactCase = 14; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 14 succeeded!\n" << @@ -774,7 +774,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) maxDepth = sum; normal_c = Vec3( -b2_rR[5]/length, b2_rR[2]/length, 0 ); contactCase = 15; - invertNormal = ( term1 < real_t(0) ); + invertNormal = ( term1 < 0_r ); WALBERLA_LOG_DETAIL( " Contact test 15 succeeded!\n" << @@ -843,7 +843,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) geometry::intersectLines( pB1, ua, pB2, ub, s, t ); pB1 += s * ua; pB2 += t * ub; - Vec3 gpos = real_t(0.5) * ( pB1 + pB2 ); + Vec3 gpos = 0.5_r * ( pB1 + pB2 ); Vec3 normal = ( ua % ub ).getNormalized(); WALBERLA_LOG_DETAIL( @@ -863,7 +863,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) << " normal = " << normal << "\n\n" ); // TEST - if( normal*contactNormal < real_t(0) ) { + if( normal*contactNormal < 0_r ) { WALBERLA_LOG_DETAIL( " Inverting ub!\n" << " ua = " << ua << "\n" @@ -959,19 +959,19 @@ bool collide( BoxID b1, BoxID b2, Container& container ) // Calculating the four vertices of the colliding face of box B in the frame of box B Vec3 vertexb[4]; - vertexb[0][xb] = ( normalb[xb] > real_t(0) )?( -hlb[xb] ):( hlb[xb] ); + vertexb[0][xb] = ( normalb[xb] > 0_r )?( -hlb[xb] ):( hlb[xb] ); vertexb[0][yb] = -hlb[yb]; vertexb[0][zb] = -hlb[zb]; - vertexb[1][xb] = ( normalb[xb] > real_t(0) )?( -hlb[xb] ):( hlb[xb] ); + vertexb[1][xb] = ( normalb[xb] > 0_r )?( -hlb[xb] ):( hlb[xb] ); vertexb[1][yb] = hlb[yb]; vertexb[1][zb] = -hlb[zb]; - vertexb[2][xb] = ( normalb[xb] > real_t(0) )?( -hlb[xb] ):( hlb[xb] ); + vertexb[2][xb] = ( normalb[xb] > 0_r )?( -hlb[xb] ):( hlb[xb] ); vertexb[2][yb] = -hlb[yb]; vertexb[2][zb] = hlb[zb]; - vertexb[3][xb] = ( normalb[xb] > real_t(0) )?( -hlb[xb] ):( hlb[xb] ); + vertexb[3][xb] = ( normalb[xb] > 0_r )?( -hlb[xb] ):( hlb[xb] ); vertexb[3][yb] = hlb[yb]; vertexb[3][zb] = hlb[zb]; @@ -987,7 +987,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) //----- Calculating the line/line intersections between the two colliding faces ----- - const real_t offseta( ( normala[xa] > real_t(0) )?( hla[xa] ):( -hla[xa] ) ); + const real_t offseta( ( normala[xa] > 0_r )?( hla[xa] ):( -hla[xa] ) ); real_t s, dist, tmp; // Intersection between v0--v1 with hla[ya] @@ -999,7 +999,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 1\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[0][za] + s*( vertexba[1][za] - vertexba[0][za] ) ) < hla[za] ) { dist = std::fabs( vertexba[0][xa] + s*( vertexba[1][xa] - vertexba[0][xa] ) ) - hla[xa]; @@ -1030,7 +1030,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 2\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[0][za] + s*( vertexba[1][za] - vertexba[0][za] ) ) < hla[za] ) { dist = std::fabs( vertexba[0][xa] + s*( vertexba[1][xa] - vertexba[0][xa] ) ) - hla[xa]; @@ -1061,7 +1061,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 3\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[0][ya] + s*( vertexba[1][ya] - vertexba[0][ya] ) ) < hla[ya] ) { dist = std::fabs( vertexba[0][xa] + s*( vertexba[1][xa] - vertexba[0][xa] ) ) - hla[xa]; @@ -1092,7 +1092,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 4\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[0][ya] + s*( vertexba[1][ya] - vertexba[0][ya] ) ) < hla[ya] ) { dist = std::fabs( vertexba[0][xa] + s*( vertexba[1][xa] - vertexba[0][xa] ) ) - hla[xa]; @@ -1124,7 +1124,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 5\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[0][za] + s*( vertexba[2][za] - vertexba[0][za] ) ) < hla[za] ) { dist = std::fabs( vertexba[0][xa] + s*( vertexba[2][xa] - vertexba[0][xa] ) ) - hla[xa]; @@ -1155,7 +1155,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 6\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[0][za] + s*( vertexba[2][za] - vertexba[0][za] ) ) < hla[za] ) { dist = std::fabs( vertexba[0][xa] + s*( vertexba[2][xa] - vertexba[0][xa] ) ) - hla[xa]; @@ -1186,7 +1186,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 7\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[0][ya] + s*( vertexba[2][ya] - vertexba[0][ya] ) ) < hla[ya] ) { dist = std::fabs( vertexba[0][xa] + s*( vertexba[2][xa] - vertexba[0][xa] ) ) - hla[xa]; @@ -1217,7 +1217,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 8\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[0][ya] + s*( vertexba[2][ya] - vertexba[0][ya] ) ) < hla[ya] ) { dist = std::fabs( vertexba[0][xa] + s*( vertexba[2][xa] - vertexba[0][xa] ) ) - hla[xa]; @@ -1249,7 +1249,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 9\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[3][za] + s*( vertexba[1][za] - vertexba[3][za] ) ) < hla[za] ) { dist = std::fabs( vertexba[3][xa] + s*( vertexba[1][xa] - vertexba[3][xa] ) ) - hla[xa]; @@ -1280,7 +1280,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 10\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[3][za] + s*( vertexba[1][za] - vertexba[3][za] ) ) < hla[za] ) { dist = std::fabs( vertexba[3][xa] + s*( vertexba[1][xa] - vertexba[3][xa] ) ) - hla[xa]; @@ -1311,7 +1311,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 11\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[3][ya] + s*( vertexba[1][ya] - vertexba[3][ya] ) ) < hla[ya] ) { dist = std::fabs( vertexba[3][xa] + s*( vertexba[1][xa] - vertexba[3][xa] ) ) - hla[xa]; @@ -1342,7 +1342,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 12\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[3][ya] + s*( vertexba[1][ya] - vertexba[3][ya] ) ) < hla[ya] ) { dist = std::fabs( vertexba[3][xa] + s*( vertexba[1][xa] - vertexba[3][xa] ) ) - hla[xa]; @@ -1374,7 +1374,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 13\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[3][za] + s*( vertexba[2][za] - vertexba[3][za] ) ) < hla[za] ) { dist = std::fabs( vertexba[3][xa] + s*( vertexba[2][xa] - vertexba[3][xa] ) ) - hla[xa]; @@ -1405,7 +1405,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 14\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[3][za] + s*( vertexba[2][za] - vertexba[3][za] ) ) < hla[za] ) { dist = std::fabs( vertexba[3][xa] + s*( vertexba[2][xa] - vertexba[3][xa] ) ) - hla[xa]; @@ -1436,7 +1436,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 15\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[3][ya] + s*( vertexba[2][ya] - vertexba[3][ya] ) ) < hla[ya] ) { dist = std::fabs( vertexba[3][xa] + s*( vertexba[2][xa] - vertexba[3][xa] ) ) - hla[xa]; @@ -1467,7 +1467,7 @@ bool collide( BoxID b1, BoxID b2, Container& container ) " Treating case 16\n" << " s = " << s ); - if( s > real_t(0) && s < real_t(1) && + if( s > 0_r && s < 1_r && std::fabs( tmp = vertexba[3][ya] + s*( vertexba[2][ya] - vertexba[3][ya] ) ) < hla[ya] ) { dist = std::fabs( vertexba[3][xa] + s*( vertexba[2][xa] - vertexba[3][xa] ) ) - hla[xa]; @@ -1558,19 +1558,19 @@ bool collide( BoxID b1, BoxID b2, Container& container ) // Calculating the four vertices of the colliding face of box B in the frame of box B Vec3 vertexa[4]; - vertexa[0][xa] = ( normala[xa] > real_t(0) )?( hla[xa] ):( -hla[xa] ); + vertexa[0][xa] = ( normala[xa] > 0_r )?( hla[xa] ):( -hla[xa] ); vertexa[0][ya] = -hla[ya]; vertexa[0][za] = -hla[za]; - vertexa[1][xa] = ( normala[xa] > real_t(0) )?( hla[xa] ):( -hla[xa] ); + vertexa[1][xa] = ( normala[xa] > 0_r )?( hla[xa] ):( -hla[xa] ); vertexa[1][ya] = hla[ya]; vertexa[1][za] = -hla[za]; - vertexa[2][xa] = ( normala[xa] > real_t(0) )?( hla[xa] ):( -hla[xa] ); + vertexa[2][xa] = ( normala[xa] > 0_r )?( hla[xa] ):( -hla[xa] ); vertexa[2][ya] = -hla[ya]; vertexa[2][za] = hla[za]; - vertexa[3][xa] = ( normala[xa] > real_t(0) )?( hla[xa] ):( -hla[xa] ); + vertexa[3][xa] = ( normala[xa] > 0_r )?( hla[xa] ):( -hla[xa] ); vertexa[3][ya] = hla[ya]; vertexa[3][za] = hla[za]; @@ -1857,8 +1857,8 @@ bool collide( CapsuleID c1, CapsuleID c2, Container& container ) const Vec3 c2_up_dir( R2[0], R2[3], R2[6] ); // Calculating the displacement of the center of the upper cap-spheres in world space coordinates - const Vec3 c1_up( real_t(0.5) * c1->getLength() * c1_up_dir ); - const Vec3 c2_up( real_t(0.5) * c2->getLength() * c2_up_dir ); + const Vec3 c1_up( 0.5_r * c1->getLength() * c1_up_dir ); + const Vec3 c2_up( 0.5_r * c2->getLength() * c2_up_dir ); // calculate the closest points of the two center lines Vec3 cp1, cp2; @@ -1876,12 +1876,12 @@ bool collide( CapsuleID c1, CapsuleID c2, Container& container ) const real_t c2x( c1_up_dir * ( c2->getPosition() - c1->getPosition() ) ); // Creating two contact points if the capsules are parallel to each other - if ( floatIsEqual(std::fabs( c1_up_dir * c2_up_dir ), real_t(1) ) && + if ( floatIsEqual(std::fabs( c1_up_dir * c2_up_dir ), 1_r ) && c2x > -c1->getLength() && c2x < c1->getLength() ) { - const real_t k( c1->getRadius() + real_t(0.5) * dist ); - const real_t hl1( real_t(0.5) * c1->getLength() ); - const real_t hl2( real_t(0.5) * c2->getLength() ); + const real_t k( c1->getRadius() + 0.5_r * dist ); + const real_t hl1( 0.5_r * c1->getLength() ); + const real_t hl2( 0.5_r * c2->getLength() ); WALBERLA_LOG_DETAIL( " First contact created between capsule " << c1->getID() @@ -1923,7 +1923,7 @@ bool collide( CapsuleID c1, CapsuleID c2, Container& container ) // Creating a single contact point else { - const real_t k( c2->getRadius() + real_t(0.5) * dist ); + const real_t k( c2->getRadius() + 0.5_r * dist ); const Vec3 gPos( cp2 + normal * k ); WALBERLA_LOG_DETAIL( @@ -1962,7 +1962,7 @@ bool collide( CapsuleID c, PlaneID p, Container& container ) const Mat3& R( c->getRotation() ); // Computing the location of the sphere caps of the capsule - const Vec3 c_up ( real_t(0.5) * c->getLength() * Vec3( R[0], R[3], R[6] ) ); + const Vec3 c_up ( 0.5_r * c->getLength() * Vec3( R[0], R[3], R[6] ) ); const Vec3 posUp( c->getPosition() + c_up ); const Vec3 posDn( c->getPosition() - c_up ); @@ -2006,7 +2006,7 @@ template <typename Container> inline bool collide( SphereID s, CapsuleID c, Container& container ) { - const real_t length( real_t(0.5)*c->getLength() ); // Half cylinder length + const real_t length( 0.5_r*c->getLength() ); // Half cylinder length const Vec3& spos( s->getPosition() ); // Global position of the sphere const Vec3& cpos( c->getPosition() ); // Global position of the capsule const Mat3& R( c->getRotation() ); // Rotation of the capsule @@ -2031,7 +2031,7 @@ bool collide( SphereID s, CapsuleID c, Container& container ) if( dist < contactThreshold ) { normal = normal.getNormalized(); - const real_t k( c->getRadius() + real_t(0.5) * dist ); + const real_t k( c->getRadius() + 0.5_r * dist ); const Vec3 gPos( spos2 + normal * k ); WALBERLA_LOG_DETAIL( @@ -2062,9 +2062,9 @@ bool collide( BoxID b, CapsuleID c, Container& container ) //----- Calculating the first contact point between the capsule and the box ----- // Computing the displacement of the spherical caps of the capsule in world space coordinates - const Vec3 c_up( real_t(0.5)*c->getLength()*R[0], - real_t(0.5)*c->getLength()*R[3], - real_t(0.5)*c->getLength()*R[6] ); + const Vec3 c_up( 0.5_r*c->getLength()*R[0], + 0.5_r*c->getLength()*R[3], + 0.5_r*c->getLength()*R[6] ); // Computing the centers of the spherical caps in world space coordinates const Vec3 up ( c->getPosition()+c_up ); @@ -2082,7 +2082,7 @@ bool collide( BoxID b, CapsuleID c, Container& container ) // Calculating the contact normal and the position of the closest contact point normalize(normal1); - const Vec3 gpos1( bp1 - real_t(0.5)*dist1*normal1 ); + const Vec3 gpos1( bp1 - 0.5_r*dist1*normal1 ); WALBERLA_LOG_DETAIL( " Contact created between box " << b->getID() << " and capsule " << c->getID() @@ -2104,7 +2104,7 @@ bool collide( BoxID b, CapsuleID c, Container& container ) // Calculating the contact normal and the position of the closest contact point normalize(normal2); - const Vec3 gpos2( bp2 - real_t(0.5)*dist2*normal2 ); + const Vec3 gpos2( bp2 - 0.5_r*dist2*normal2 ); WALBERLA_LOG_DETAIL( " Contact created between box " << b->getID() << " and capsule " << c->getID() diff --git a/src/pe/fcd/GJKEPACollideFunctor.h b/src/pe/fcd/GJKEPACollideFunctor.h index 051d5bcb..cdf2ed55 100644 --- a/src/pe/fcd/GJKEPACollideFunctor.h +++ b/src/pe/fcd/GJKEPACollideFunctor.h @@ -110,7 +110,7 @@ namespace gjkepa{ Vec3 contactPoint; real_t penetrationDepth; - real_t margin = real_t(1e-4); + real_t margin = 1e-4_r; GJK gjk; if(gjk.doGJKmargin(*a, *b, margin)){ //2. If collision is possible perform EPA. @@ -143,7 +143,7 @@ namespace gjkepa{ if(pdepth < contactThreshold){ //We have a collision normal = support_dir; penetrationDepth = pdepth; - contactPoint = contactp + real_t(0.5) * penetrationDepth * normal; + contactPoint = contactp + 0.5_r * penetrationDepth * normal; contacts_.push_back( Contact(a, b, contactPoint, normal, penetrationDepth) ); return true; }else{ //No collision diff --git a/src/pe/raytracing/Color.cpp b/src/pe/raytracing/Color.cpp index 4e9deab3..a18c75ec 100644 --- a/src/pe/raytracing/Color.cpp +++ b/src/pe/raytracing/Color.cpp @@ -33,43 +33,43 @@ Color Color::colorFromHSV(real_t hue, real_t saturation, real_t value) { // based on Max K. Agoston: Computer Graphics and Geometric Modeling - Implementation and Algorithms real_t r, g, b; - if (realIsEqual(hue, real_t(360))) { - hue = real_t(0); + if (realIsEqual(hue, 360_r)) { + hue = 0_r; } else { - hue /= real_t(60); + hue /= 60_r; } real_t fract = hue - std::floor(hue); - real_t P = value*(real_t(1) - saturation); - real_t Q = value*(real_t(1) - saturation*fract); - real_t T = value*(real_t(1) - saturation*(real_t(1) - fract)); + real_t P = value*(1_r - saturation); + real_t Q = value*(1_r - saturation*fract); + real_t T = value*(1_r - saturation*(1_r - fract)); - if (real_t(0) <= hue && hue < real_t(1)) { + if (0_r <= hue && hue < 1_r) { r = value; g = T; b = P; - } else if (real_t(1) <= hue && hue < real_t(2)) { + } else if (1_r <= hue && hue < 2_r) { r = Q; g = value, b = P; - } else if (real_t(2) <= hue && hue < real_t(3)) { + } else if (2_r <= hue && hue < 3_r) { r = P; g = value; b = T; - } else if (real_t(3) <= hue && hue < real_t(4)) { + } else if (3_r <= hue && hue < 4_r) { r = P; g = Q; b = value; - } else if (real_t(4) <= hue && hue < real_t(5)) { + } else if (4_r <= hue && hue < 5_r) { r = T; g = P; b = value; - } else if (real_t(5) <= hue && hue < real_t(6)) { + } else if (5_r <= hue && hue < 6_r) { r = value; g = P; b = Q; } else { - r = g = b = real_t(0); + r = g = b = 0_r; } return Color(r, g, b); diff --git a/src/pe/raytracing/Color.h b/src/pe/raytracing/Color.h index cf599930..d927e68c 100644 --- a/src/pe/raytracing/Color.h +++ b/src/pe/raytracing/Color.h @@ -70,9 +70,9 @@ public: /*!\brief Clamps this colors component values between 0 and 1. */ inline void clamp() { - (*this)[0] = std::min(std::max((*this)[0], real_t(0)), real_t(1)); - (*this)[1] = std::min(std::max((*this)[1], real_t(0)), real_t(1)); - (*this)[2] = std::min(std::max((*this)[2], real_t(0)), real_t(1)); + (*this)[0] = std::min(std::max((*this)[0], 0_r), 1_r); + (*this)[1] = std::min(std::max((*this)[1], 0_r), 1_r); + (*this)[2] = std::min(std::max((*this)[2], 0_r), 1_r); } static Color colorFromHSV(real_t hue, real_t saturation, real_t value); diff --git a/src/pe/raytracing/Intersects.h b/src/pe/raytracing/Intersects.h index 836ee8dc..cb997fc4 100644 --- a/src/pe/raytracing/Intersects.h +++ b/src/pe/raytracing/Intersects.h @@ -46,7 +46,7 @@ inline bool intersects(const EllipsoidID ellipsoid, const Ray& ray, real_t& t, V inline bool intersects(const BodyID body, const Ray& ray, real_t& t, Vec3& n); -inline bool intersects(const AABB& aabb, const Ray& ray, real_t& t, real_t padding = real_t(0.0), Vec3* n = NULL); +inline bool intersects(const AABB& aabb, const Ray& ray, real_t& t, real_t padding = 0.0_r, Vec3* n = NULL); inline bool intersectsSphere(const Vec3& gpos, real_t radius, const Ray& ray, real_t& t0, real_t& t1); struct IntersectsFunctor @@ -63,7 +63,7 @@ struct IntersectsFunctor } }; -const real_t discriminantEps = real_t(1e-4); +const real_t discriminantEps = 1e-4_r; inline bool intersects(const SphereID sphere, const Ray& ray, real_t& t, Vec3& n) { const real_t realMax = std::numeric_limits<real_t>::max(); @@ -110,7 +110,7 @@ inline bool intersects(const BoxID box, const Ray& ray, real_t& t, Vec3& n) { Ray transformedRay = ray.transformedToBF(box); const Vec3& lengths = box->getLengths(); - const Vec3 lengthsHalved = lengths/real_t(2); + const Vec3 lengthsHalved = lengths/2_r; const Vec3 bounds[2] = { -lengthsHalved, @@ -156,12 +156,12 @@ inline bool intersects(const BoxID box, const Ray& ray, real_t& t, Vec3& n) { tmax = tzmax; } - n[0] = n[1] = n[2] = real_t(0); + n[0] = n[1] = n[2] = 0_r; real_t t_; if (tmin > 0) { // ray hit box from outside t_ = tmin; - n[tminAxis] = real_t(1); + n[tminAxis] = 1_r; } else if (tmax < 0) { // tmin and tmax are smaller than 0 -> box is in rays negative direction t = realMax; @@ -169,7 +169,7 @@ inline bool intersects(const BoxID box, const Ray& ray, real_t& t, Vec3& n) { } else { // ray origin within box t_ = tmax; - n[tmaxAxis] = real_t(1); + n[tmaxAxis] = 1_r; } if (transformedRay.getDirection() * n > 0) { @@ -185,7 +185,7 @@ inline bool intersects(const CapsuleID capsule, const Ray& ray, real_t& t, Vec3& const Ray transformedRay = ray.transformedToBF(capsule); const Vec3& direction = transformedRay.getDirection(); const Vec3& origin = transformedRay.getOrigin(); - real_t halfLength = capsule->getLength()/real_t(2); + real_t halfLength = capsule->getLength()/2_r; const real_t realMax = std::numeric_limits<real_t>::max(); t = realMax; @@ -194,16 +194,16 @@ inline bool intersects(const CapsuleID capsule, const Ray& ray, real_t& t, Vec3& size_t intersectedPrimitive = 0; // 1 for capsule, 2 for left half sphere, 3 for right half sphere real_t a = direction[2]*direction[2] + direction[1]*direction[1]; - real_t b = real_t(2)*origin[2]*direction[2] + real_t(2)*origin[1]*direction[1]; + real_t b = 2_r*origin[2]*direction[2] + 2_r*origin[1]*direction[1]; real_t c = origin[2]*origin[2] + origin[1]*origin[1] - capsule->getRadius()*capsule->getRadius(); - real_t discriminant = b*b - real_t(4.)*a*c; + real_t discriminant = b*b - 4._r*a*c; if (std::abs(discriminant) >= discriminantEps) { // With discriminant smaller than 0, cylinder is not hit by ray (no solution for quadratic equation). // Thus only enter this section if the equation is actually solvable. real_t root = real_t(std::sqrt(discriminant)); - real_t t0 = (-b - root) / (real_t(2) * a); // Distance to point where the ray enters the cylinder - real_t t1 = (-b + root) / (real_t(2) * a); // Distance to point where the ray leaves the cylinder + real_t t0 = (-b - root) / (2_r * a); // Distance to point where the ray enters the cylinder + real_t t1 = (-b + root) / (2_r * a); // Distance to point where the ray leaves the cylinder real_t tx0 = origin[0] + direction[0]*t0; real_t tx1 = origin[0] + direction[0]*t1; @@ -281,7 +281,7 @@ inline bool intersects(const CapsuleID capsule, const Ray& ray, real_t& t, Vec3& if (intersectedPrimitive == 1) { Vec3 intersectionPoint = origin + direction*t; - Vec3 intersectionPointOnXAxis(intersectionPoint[0], real_t(0), real_t(0)); + Vec3 intersectionPointOnXAxis(intersectionPoint[0], 0_r, 0_r); n = (intersectionPoint - intersectionPointOnXAxis).getNormalized(); } @@ -296,16 +296,16 @@ inline bool intersects(const EllipsoidID ellipsoid, const Ray& ray, real_t& t, V const Ray transformedRay = ray.transformedToBF(ellipsoid); const Vec3& semiAxes = ellipsoid->getSemiAxes(); - const Mat3 M = Mat3::makeDiagonalMatrix(real_t(1)/semiAxes[0], real_t(1)/semiAxes[1], real_t(1)/semiAxes[2]); + const Mat3 M = Mat3::makeDiagonalMatrix(1_r/semiAxes[0], 1_r/semiAxes[1], 1_r/semiAxes[2]); const Vec3 d_M = M*transformedRay.getDirection(); const Vec3 P_M = M*transformedRay.getOrigin(); const real_t a = d_M*d_M; - const real_t b = real_t(2)*P_M*d_M; + const real_t b = 2_r*P_M*d_M; const real_t c = P_M*P_M - 1; - const real_t discriminant = b*b - real_t(4.)*a*c; + const real_t discriminant = b*b - 4._r*a*c; if (discriminant < 0) { // with discriminant smaller than 0, sphere is not hit by ray // (no solution for quadratic equation) @@ -314,8 +314,8 @@ inline bool intersects(const EllipsoidID ellipsoid, const Ray& ray, real_t& t, V } const real_t root = real_t(std::sqrt(discriminant)); - const real_t t0 = (-b - root) / (real_t(2.) * a); // distance to point where the ray enters the sphere - const real_t t1 = (-b + root) / (real_t(2.) * a); // distance to point where the ray leaves the sphere + const real_t t0 = (-b - root) / (2._r * a); // distance to point where the ray enters the sphere + const real_t t1 = (-b + root) / (2._r * a); // distance to point where the ray leaves the sphere if (t0 < 0 && t1 < 0) { return false; @@ -354,9 +354,9 @@ inline bool intersectsSphere(const Vec3& gpos, real_t radius, const Ray& ray, re Vec3 displacement = ray.getOrigin() - gpos; real_t a = direction * direction; - real_t b = real_t(2.) * (displacement * direction); + real_t b = 2._r * (displacement * direction); real_t c = (displacement * displacement) - (radius * radius); - real_t discriminant = b*b - real_t(4.)*a*c; + real_t discriminant = b*b - 4._r*a*c; if (discriminant < 0) { // with discriminant smaller than 0, sphere is not hit by ray // (no solution for quadratic equation) @@ -366,8 +366,8 @@ inline bool intersectsSphere(const Vec3& gpos, real_t radius, const Ray& ray, re } real_t root = real_t(std::sqrt(discriminant)); - t0 = (-b - root) / (real_t(2.) * a); // distance to point where the ray enters the sphere - t1 = (-b + root) / (real_t(2.) * a); // distance to point where the ray leaves the sphere + t0 = (-b - root) / (2._r * a); // distance to point where the ray enters the sphere + t1 = (-b + root) / (2._r * a); // distance to point where the ray leaves the sphere if (t0 < 0 && t1 < 0) { return false; @@ -432,14 +432,14 @@ inline bool intersects(const AABB& aabb, const Ray& ray, real_t& t, real_t paddi } if (n != NULL) { - (*n)[0] = (*n)[1] = (*n)[2] = real_t(0); + (*n)[0] = (*n)[1] = (*n)[2] = 0_r; } real_t t_; if (tmin > 0) { // ray hit box from outside t_ = tmin; if (n != NULL) { - (*n)[tminAxis] = real_t(1); + (*n)[tminAxis] = 1_r; } } else if (tmax < 0) { // tmin and tmax are smaller than 0 -> box is in rays negative direction @@ -449,7 +449,7 @@ inline bool intersects(const AABB& aabb, const Ray& ray, real_t& t, real_t paddi // ray origin within box t_ = tmax; if (n != NULL) { - (*n)[tmaxAxis] = real_t(1); + (*n)[tmaxAxis] = 1_r; } } diff --git a/src/pe/raytracing/Ray.h b/src/pe/raytracing/Ray.h index 052ee87b..b0c3cfea 100644 --- a/src/pe/raytracing/Ray.h +++ b/src/pe/raytracing/Ray.h @@ -170,7 +170,7 @@ public: */ inline void setDirection (const Vec3& direction) { // im kommentar verweis auf normalisierung - WALBERLA_CHECK_FLOAT_EQUAL(direction.length(), real_t(1)); + WALBERLA_CHECK_FLOAT_EQUAL(direction.length(), 1_r); direction_ = direction; calcInvDirection(); } diff --git a/src/pe/raytracing/Raytracer.cpp b/src/pe/raytracing/Raytracer.cpp index 6c23292f..32b46ebd 100644 --- a/src/pe/raytracing/Raytracer.cpp +++ b/src/pe/raytracing/Raytracer.cpp @@ -161,7 +161,7 @@ Raytracer::Raytracer(const shared_ptr<BlockStorage>& forest, const BlockDataID s lookAtPoint_ = config.getParameter<Vec3>("lookAt"); upVector_ = config.getParameter<Vec3>("upVector"); lighting_ = Lighting(config.getBlock("Lighting")); - backgroundColor_ = config.getParameter<Color>("backgroundColor", Vec3(real_t(0.1), real_t(0.1), real_t(0.1))); + backgroundColor_ = config.getParameter<Color>("backgroundColor", Vec3(0.1_r, 0.1_r, 0.1_r)); std::string raytracingAlgorithm = config.getParameter<std::string>("raytracingAlgorithm", "RAYTRACE_HASHGRIDS"); if (raytracingAlgorithm == "RAYTRACE_HASHGRIDS") { @@ -197,10 +197,10 @@ void Raytracer::setupView_() { // viewing plane setup d_ = (cameraPosition_ - lookAtPoint_).length(); aspectRatio_ = real_t(pixelsHorizontal_) / real_t(pixelsVertical_); - real_t fov_vertical_rad = fov_vertical_ * math::M_PI / real_t(180.0); - viewingPlaneHeight_ = real_c(tan(fov_vertical_rad/real_t(2.))) * real_t(2.) * d_; + real_t fov_vertical_rad = fov_vertical_ * math::M_PI / 180.0_r; + viewingPlaneHeight_ = real_c(tan(fov_vertical_rad/2._r)) * 2._r * d_; viewingPlaneWidth_ = viewingPlaneHeight_ * aspectRatio_; - viewingPlaneOrigin_ = lookAtPoint_ - u_*viewingPlaneWidth_/real_t(2.) - v_*viewingPlaneHeight_/real_t(2.); + viewingPlaneOrigin_ = lookAtPoint_ - u_*viewingPlaneWidth_/2._r - v_*viewingPlaneHeight_/2._r; pixelWidth_ = viewingPlaneWidth_ / real_c(pixelsHorizontal_*antiAliasFactor_); pixelHeight_ = viewingPlaneHeight_ / real_c(pixelsVertical_*antiAliasFactor_); diff --git a/src/pe/raytracing/ShadingFunctions.h b/src/pe/raytracing/ShadingFunctions.h index 65675bb2..57c48d0d 100644 --- a/src/pe/raytracing/ShadingFunctions.h +++ b/src/pe/raytracing/ShadingFunctions.h @@ -68,13 +68,13 @@ inline ShadingParameters processRankDependentShadingParams (const BodyID body) { int numProcesses = mpi::MPIManager::instance()->numProcesses(); int rank = mpi::MPIManager::instance()->rank(); - real_t hue = real_t(360) * real_t(rank)/real_t(numProcesses); - Color color = Color::colorFromHSV(hue, real_t(1), real_t(0.9)); + real_t hue = 360_r * real_t(rank)/real_t(numProcesses); + Color color = Color::colorFromHSV(hue, 1_r, 0.9_r); return ShadingParameters(color, - color*real_t(0.5), + color*0.5_r, Color(0,0,0), - real_t(0)); + 0_r); } inline ShadingParameters defaultShadingParams (const BodyID body) { @@ -83,91 +83,91 @@ inline ShadingParameters defaultShadingParams (const BodyID body) { inline ShadingParameters whiteShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(1), real_t(1), real_t(1)), - Color(real_t(0.9), real_t(0.9), real_t(0.9)), - Color(real_t(0), real_t(0), real_t(0)), - real_t(0)); + ShadingParameters s(Color(1_r, 1_r, 1_r), + Color(0.9_r, 0.9_r, 0.9_r), + Color(0_r, 0_r, 0_r), + 0_r); return s; } inline ShadingParameters blackShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(0), real_t(0), real_t(0)), - Color(real_t(0), real_t(0), real_t(0)), - Color(real_t(0.1), real_t(0.1), real_t(0.1)), - real_t(0)); + ShadingParameters s(Color(0_r, 0_r, 0_r), + Color(0_r, 0_r, 0_r), + Color(0.1_r, 0.1_r, 0.1_r), + 0_r); return s; } inline ShadingParameters lightGreyShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(0.82), real_t(0.82), real_t(0.82)), - Color(real_t(0.5), real_t(0.5), real_t(0.5)), - Color(real_t(0), real_t(0), real_t(0)), - real_t(0)); + ShadingParameters s(Color(0.82_r, 0.82_r, 0.82_r), + Color(0.5_r, 0.5_r, 0.5_r), + Color(0_r, 0_r, 0_r), + 0_r); return s; } inline ShadingParameters greyShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(0.5), real_t(0.5), real_t(0.5)), - Color(real_t(0.4), real_t(0.4), real_t(0.4)), - Color(real_t(0.1), real_t(0.1), real_t(0.1)), - real_t(0)); + ShadingParameters s(Color(0.5_r, 0.5_r, 0.5_r), + Color(0.4_r, 0.4_r, 0.4_r), + Color(0.1_r, 0.1_r, 0.1_r), + 0_r); return s; } inline ShadingParameters darkGreyShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(0.2), real_t(0.2), real_t(0.2)), - Color(real_t(0.06), real_t(0.06), real_t(0.06)), - Color(real_t(0.1), real_t(0.1), real_t(0.1)), - real_t(0)); + ShadingParameters s(Color(0.2_r, 0.2_r, 0.2_r), + Color(0.06_r, 0.06_r, 0.06_r), + Color(0.1_r, 0.1_r, 0.1_r), + 0_r); return s; } inline ShadingParameters redShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(1), real_t(0), real_t(0)), - Color(real_t(0.5), real_t(0), real_t(0)), - Color(real_t(0.1), real_t(0.1), real_t(0.1)), - real_t(0)); + ShadingParameters s(Color(1_r, 0_r, 0_r), + Color(0.5_r, 0_r, 0_r), + Color(0.1_r, 0.1_r, 0.1_r), + 0_r); return s; } inline ShadingParameters greenShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(0), real_t(0.72), real_t(0)), - Color(real_t(0), real_t(0.41), real_t(0)), - Color(real_t(0.1), real_t(0.1), real_t(0.1)), - real_t(0)); + ShadingParameters s(Color(0_r, 0.72_r, 0_r), + Color(0_r, 0.41_r, 0_r), + Color(0.1_r, 0.1_r, 0.1_r), + 0_r); return s; } inline ShadingParameters blueShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(0.15), real_t(0.44), real_t(0.91)), - Color(real_t(0), real_t(0), real_t(0.4)), - Color(real_t(0.1), real_t(0.1), real_t(0.1)), - real_t(0)); + ShadingParameters s(Color(0.15_r, 0.44_r, 0.91_r), + Color(0_r, 0_r, 0.4_r), + Color(0.1_r, 0.1_r, 0.1_r), + 0_r); return s; } inline ShadingParameters yellowShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(1), real_t(0.96), real_t(0)), - Color(real_t(0.5), real_t(0.48), real_t(0)), - Color(real_t(0), real_t(0), real_t(0)), - real_t(0)); + ShadingParameters s(Color(1_r, 0.96_r, 0_r), + Color(0.5_r, 0.48_r, 0_r), + Color(0_r, 0_r, 0_r), + 0_r); return s; } inline ShadingParameters violetShadingParams (const BodyID body) { WALBERLA_UNUSED(body); - ShadingParameters s(Color(real_t(0.6), real_t(0), real_t(0.9)), - Color(real_t(0.5), real_t(0), real_t(0.8)), - Color(real_t(0), real_t(0), real_t(0)), - real_t(0)); + ShadingParameters s(Color(0.6_r, 0_r, 0.9_r), + Color(0.5_r, 0_r, 0.8_r), + Color(0_r, 0_r, 0_r), + 0_r); return s; } diff --git a/src/pe/raytracing/ShadingParameters.h b/src/pe/raytracing/ShadingParameters.h index 7e476527..d97e1068 100644 --- a/src/pe/raytracing/ShadingParameters.h +++ b/src/pe/raytracing/ShadingParameters.h @@ -69,7 +69,7 @@ struct ShadingParameters { */ ShadingParameters& makeGlossy(real_t _shininess = 30) { shininess = _shininess; - specularColor.set(real_t(1), real_t(1), real_t(1)); + specularColor.set(1_r, 1_r, 1_r); return *this; } @@ -77,7 +77,7 @@ struct ShadingParameters { */ ShadingParameters& makeMatte() { shininess = 0; - specularColor.set(real_t(0.1), real_t(0.1), real_t(0.1)); + specularColor.set(0.1_r, 0.1_r, 0.1_r); return *this; } }; diff --git a/src/pe/rigidbody/Box.cpp b/src/pe/rigidbody/Box.cpp index ffd27fc8..79a0d309 100644 --- a/src/pe/rigidbody/Box.cpp +++ b/src/pe/rigidbody/Box.cpp @@ -65,9 +65,9 @@ Box::Box( id_t sid, id_t uid, const Vec3& gpos, const Vec3& rpos, const Quat& q, // Since the box constructor is never directly called but only used in a small number // of functions that already check the box arguments, only asserts are used here to // double check the arguments. - WALBERLA_ASSERT_GREATER( lengths[0], real_t(0), "Invalid side length in x-dimension" ); - WALBERLA_ASSERT_GREATER( lengths[1], real_t(0), "Invalid side length in y-dimension" ); - WALBERLA_ASSERT_GREATER( lengths[2], real_t(0), "Invalid side length in z-dimension" ); + WALBERLA_ASSERT_GREATER( lengths[0], 0_r, "Invalid side length in x-dimension" ); + WALBERLA_ASSERT_GREATER( lengths[1], 0_r, "Invalid side length in y-dimension" ); + WALBERLA_ASSERT_GREATER( lengths[2], 0_r, "Invalid side length in z-dimension" ); // Initializing the instantiated box gpos_ = gpos; @@ -129,9 +129,9 @@ Box::~Box() */ bool Box::containsRelPointImpl( real_t px, real_t py, real_t pz ) const { - return std::fabs(px) <= real_t(0.5)*lengths_[0] && - std::fabs(py) <= real_t(0.5)*lengths_[1] && - std::fabs(pz) <= real_t(0.5)*lengths_[2]; + return std::fabs(px) <= 0.5_r*lengths_[0] && + std::fabs(py) <= 0.5_r*lengths_[1] && + std::fabs(pz) <= 0.5_r*lengths_[2]; } //************************************************************************************************* @@ -149,21 +149,21 @@ bool Box::containsRelPointImpl( real_t px, real_t py, real_t pz ) const bool Box::isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const { // Checking if the body relative point lies on one of the x-faces - if( std::fabs( real_t(0.5)*lengths_[0] - std::fabs(px) ) <= surfaceThreshold && - std::fabs(py) < real_t(0.5)*lengths_[1] + surfaceThreshold && - std::fabs(pz) < real_t(0.5)*lengths_[2] + surfaceThreshold ) { + if( std::fabs( 0.5_r*lengths_[0] - std::fabs(px) ) <= surfaceThreshold && + std::fabs(py) < 0.5_r*lengths_[1] + surfaceThreshold && + std::fabs(pz) < 0.5_r*lengths_[2] + surfaceThreshold ) { return true; } // Checking if the body relative point lies on one of the y-faces - else if( std::fabs( real_t(0.5)*lengths_[1] - std::fabs(py) ) <= surfaceThreshold && - std::fabs(pz) < real_t(0.5)*lengths_[2] + surfaceThreshold && - std::fabs(px) < real_t(0.5)*lengths_[0] + surfaceThreshold ) { + else if( std::fabs( 0.5_r*lengths_[1] - std::fabs(py) ) <= surfaceThreshold && + std::fabs(pz) < 0.5_r*lengths_[2] + surfaceThreshold && + std::fabs(px) < 0.5_r*lengths_[0] + surfaceThreshold ) { return true; } // Checking if the body relative point lies on one of the z-faces - else if( std::fabs( real_t(0.5)*lengths_[2] - std::fabs(pz) ) <= surfaceThreshold && - std::fabs(px) < real_t(0.5)*lengths_[0] + surfaceThreshold && - std::fabs(py) < real_t(0.5)*lengths_[1] + surfaceThreshold ) { + else if( std::fabs( 0.5_r*lengths_[2] - std::fabs(pz) ) <= surfaceThreshold && + std::fabs(px) < 0.5_r*lengths_[0] + surfaceThreshold && + std::fabs(py) < 0.5_r*lengths_[1] + surfaceThreshold ) { return true; } else return false; @@ -184,30 +184,30 @@ bool Box::isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const */ real_t Box::getRelDepth( real_t px, real_t py, real_t pz ) const { - const real_t xdepth( std::fabs(px)-real_t(0.5)*lengths_[0] ); - const real_t ydepth( std::fabs(py)-real_t(0.5)*lengths_[1] ); - const real_t zdepth( std::fabs(pz)-real_t(0.5)*lengths_[2] ); + const real_t xdepth( std::fabs(px)-0.5_r*lengths_[0] ); + const real_t ydepth( std::fabs(py)-0.5_r*lengths_[1] ); + const real_t zdepth( std::fabs(pz)-0.5_r*lengths_[2] ); // Calculating the depth for relative points outside the box - if( xdepth >= real_t(0) ) { - if( ydepth >= real_t(0) ) { - if( zdepth >= real_t(0) ) { + if( xdepth >= 0_r ) { + if( ydepth >= 0_r ) { + if( zdepth >= 0_r ) { return -std::sqrt( math::sq(xdepth) + math::sq(ydepth) + math::sq(zdepth) ); } else return -std::sqrt( math::sq(xdepth) + math::sq(ydepth) ); } - else if( zdepth >= real_t(0) ) { + else if( zdepth >= 0_r ) { return -std::sqrt( math::sq(xdepth) + math::sq(zdepth) ); } else return -xdepth; } - else if( ydepth >= real_t(0) ) { - if( zdepth >= real_t(0) ) { + else if( ydepth >= 0_r ) { + if( zdepth >= 0_r ) { return -std::sqrt( math::sq(ydepth) + math::sq(zdepth) ); } else return -ydepth; } - else if( zdepth >= real_t(0) ) { + else if( zdepth >= 0_r ) { return -zdepth; } @@ -303,9 +303,9 @@ void Box::calcBoundingBox() { using std::fabs; - const real_t xlength( real_t(0.5) * ( fabs(R_[0]*lengths_[0]) + fabs(R_[1]*lengths_[1]) + fabs(R_[2]*lengths_[2]) ) + contactThreshold ); - const real_t ylength( real_t(0.5) * ( fabs(R_[3]*lengths_[0]) + fabs(R_[4]*lengths_[1]) + fabs(R_[5]*lengths_[2]) ) + contactThreshold ); - const real_t zlength( real_t(0.5) * ( fabs(R_[6]*lengths_[0]) + fabs(R_[7]*lengths_[1]) + fabs(R_[8]*lengths_[2]) ) + contactThreshold ); + const real_t xlength( 0.5_r * ( fabs(R_[0]*lengths_[0]) + fabs(R_[1]*lengths_[1]) + fabs(R_[2]*lengths_[2]) ) + contactThreshold ); + const real_t ylength( 0.5_r * ( fabs(R_[3]*lengths_[0]) + fabs(R_[4]*lengths_[1]) + fabs(R_[5]*lengths_[2]) ) + contactThreshold ); + const real_t zlength( 0.5_r * ( fabs(R_[6]*lengths_[0]) + fabs(R_[7]*lengths_[1]) + fabs(R_[8]*lengths_[2]) ) + contactThreshold ); aabb_ = math::AABB( gpos_[0] - xlength, gpos_[1] - ylength, diff --git a/src/pe/rigidbody/Box.h b/src/pe/rigidbody/Box.h index cd6ab866..2938aad1 100644 --- a/src/pe/rigidbody/Box.h +++ b/src/pe/rigidbody/Box.h @@ -422,7 +422,7 @@ inline real_t Box::calcDensity( const Vec3& l, real_t mass ) inline Vec3 Box::support( const Vec3& d ) const { auto len = d.sqrLength(); - if (math::equal(len, real_t(0))) + if (math::equal(len, 0_r)) return Vec3(0,0,0); const Vec3 bfD = vectorFromWFtoBF(d / sqrt(len)); //d in body frame coordinates @@ -436,9 +436,9 @@ inline Vec3 Box::support( const Vec3& d ) const */ //As it is save to say we have atleast one component of the d-vector != 0 we can use - Vec3 relativSupport = Vec3( math::sign(bfD[0])*lengths_[0]*real_t(0.5), - math::sign(bfD[1])*lengths_[1]*real_t(0.5), - math::sign(bfD[2])*lengths_[2]*real_t(0.5) ); + Vec3 relativSupport = Vec3( math::sign(bfD[0])*lengths_[0]*0.5_r, + math::sign(bfD[1])*lengths_[1]*0.5_r, + math::sign(bfD[2])*lengths_[2]*0.5_r ); return gpos_ + vectorFromBFtoWF(relativSupport); } @@ -455,7 +455,7 @@ inline Vec3 Box::support( const Vec3& d ) const inline Vec3 Box::supportContactThreshold( const Vec3& d ) const { auto len = d.sqrLength(); - if (math::equal(len, real_t(0))) + if (math::equal(len, 0_r)) return Vec3(0,0,0); return support(d) + d*contactThreshold / sqrt(len); diff --git a/src/pe/rigidbody/BoxFactory.cpp b/src/pe/rigidbody/BoxFactory.cpp index 6f471ba5..c8f0c1fa 100644 --- a/src/pe/rigidbody/BoxFactory.cpp +++ b/src/pe/rigidbody/BoxFactory.cpp @@ -40,7 +40,7 @@ BoxID createBox( BodyStorage& globalStorage, BlockStorage& blocks, BlockDa WALBERLA_ASSERT_UNEQUAL( Box::getStaticTypeID(), std::numeric_limits<id_t>::max(), "Box TypeID not initalized!"); // Checking the side lengths - if( lengths[0] <= real_t(0) || lengths[1] <= real_t(0) || lengths[2] <= real_t(0) ) + if( lengths[0] <= 0_r || lengths[1] <= 0_r || lengths[2] <= 0_r ) throw std::invalid_argument( "Invalid side length" ); BoxID box = nullptr; diff --git a/src/pe/rigidbody/Capsule.cpp b/src/pe/rigidbody/Capsule.cpp index 7b58b0ce..ed0e4d8d 100644 --- a/src/pe/rigidbody/Capsule.cpp +++ b/src/pe/rigidbody/Capsule.cpp @@ -66,8 +66,8 @@ Capsule::Capsule( id_t sid, id_t uid, const Vec3& gpos, const Vec3& rpos, const // Since the capsule constructor is never directly called but only used in a small number // of functions that already check the capsule arguments, only asserts are used here to // double check the arguments. - WALBERLA_ASSERT_GREATER( radius, real_t(0), "Invalid capsule radius" ); - WALBERLA_ASSERT_GREATER( length, real_t(0), "Invalid capsule length" ); + WALBERLA_ASSERT_GREATER( radius, 0_r, "Invalid capsule radius" ); + WALBERLA_ASSERT_GREATER( length, 0_r, "Invalid capsule length" ); // Initializing the instantiated capsule gpos_ = gpos; @@ -124,7 +124,7 @@ Capsule::~Capsule() bool Capsule::containsRelPointImpl( real_t px, real_t py, real_t pz ) const { const real_t xabs( std::fabs( px ) ); // Absolute x-distance - const real_t hlength( real_t(0.5) * length_ ); // Capsule half length + const real_t hlength( 0.5_r * length_ ); // Capsule half length if( xabs > hlength ) { return ( ( math::sq(xabs-hlength) + math::sq(py) + math::sq(pz) ) <= ( radius_ * radius_ ) ); @@ -148,7 +148,7 @@ bool Capsule::containsRelPointImpl( real_t px, real_t py, real_t pz ) const bool Capsule::isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const { const real_t xabs( std::fabs( px ) ); // Absolute x-distance - const real_t hlength( real_t(0.5) * length_ ); // Capsule half length + const real_t hlength( 0.5_r * length_ ); // Capsule half length if( xabs > hlength ) { return ( std::fabs( math::sq(xabs-hlength) + math::sq(py) + math::sq(pz) - radius_*radius_ ) <= surfaceThreshold*surfaceThreshold ); diff --git a/src/pe/rigidbody/Capsule.h b/src/pe/rigidbody/Capsule.h index ce6bb8cb..4e9e00c9 100644 --- a/src/pe/rigidbody/Capsule.h +++ b/src/pe/rigidbody/Capsule.h @@ -268,7 +268,7 @@ inline real_t Capsule::calcDensity( real_t radius, real_t length, real_t mas inline Vec3 Capsule::support( const Vec3& d ) const { auto len = d.sqrLength(); - if (math::equal(len, real_t(0))) + if (math::equal(len, 0_r)) return Vec3(0,0,0); Vec3 dnorm = d / sqrt(len); @@ -293,7 +293,7 @@ inline Vec3 Capsule::support( const Vec3& d ) const inline Vec3 Capsule::supportContactThreshold( const Vec3& d ) const { auto len = d.sqrLength(); - if (math::equal(len, real_t(0))) + if (math::equal(len, 0_r)) return Vec3(0,0,0); return support(d) + d*contactThreshold; diff --git a/src/pe/rigidbody/CapsuleFactory.cpp b/src/pe/rigidbody/CapsuleFactory.cpp index 325af970..c0d50828 100644 --- a/src/pe/rigidbody/CapsuleFactory.cpp +++ b/src/pe/rigidbody/CapsuleFactory.cpp @@ -40,8 +40,8 @@ CapsuleID createCapsule( BodyStorage& globalStorage, BlockStorage& blocks, Blo WALBERLA_ASSERT_UNEQUAL( Capsule::getStaticTypeID(), std::numeric_limits<id_t>::max(), "Capsule TypeID not initalized!"); // Checking the radius and the length - WALBERLA_ASSERT_GREATER( radius, real_t(0), "Invalid capsule radius" ); - WALBERLA_ASSERT_GREATER( length, real_t(0), "Invalid capsule length" ); + WALBERLA_ASSERT_GREATER( radius, 0_r, "Invalid capsule radius" ); + WALBERLA_ASSERT_GREATER( length, 0_r, "Invalid capsule length" ); CapsuleID capsule = nullptr; diff --git a/src/pe/rigidbody/CylindricalBoundary.cpp b/src/pe/rigidbody/CylindricalBoundary.cpp index 66f639e4..7c6a0145 100644 --- a/src/pe/rigidbody/CylindricalBoundary.cpp +++ b/src/pe/rigidbody/CylindricalBoundary.cpp @@ -68,7 +68,7 @@ CylindricalBoundary::CylindricalBoundary( id_t sid, id_t uid, const Vec3& gpos, // Since the constructor is never directly called but only used in a small number // of functions that already check the cylinder arguments, only asserts are used here to // double check the arguments. - WALBERLA_ASSERT_GREATER( radius, real_t(0), "Invalid cylinder radius" ); + WALBERLA_ASSERT_GREATER( radius, 0_r, "Invalid cylinder radius" ); // Initializing the instantiated cylinder gpos_ = gpos; diff --git a/src/pe/rigidbody/Ellipsoid.cpp b/src/pe/rigidbody/Ellipsoid.cpp index 3c68d587..5f58d13f 100644 --- a/src/pe/rigidbody/Ellipsoid.cpp +++ b/src/pe/rigidbody/Ellipsoid.cpp @@ -140,7 +140,7 @@ Ellipsoid::~Ellipsoid() bool Ellipsoid::containsRelPointImpl( real_t px, real_t py, real_t pz ) const { return ( (px * px)/(semiAxes_[0] * semiAxes_[0]) + (py * py)/(semiAxes_[1] * semiAxes_[1]) - + (pz * pz)/(semiAxes_[2] * semiAxes_[2]) <= real_t(1.0) ); + + (pz * pz)/(semiAxes_[2] * semiAxes_[2]) <= 1.0_r ); } //************************************************************************************************* @@ -158,7 +158,7 @@ return ( (px * px)/(semiAxes_[0] * semiAxes_[0]) + (py * py)/(semiAxes_[1] * sem bool Ellipsoid::isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const { return floatIsEqual( (px * px)/(semiAxes_[0] * semiAxes_[0]) + (py * py)/(semiAxes_[1] * semiAxes_[1]) - + (pz * pz)/(semiAxes_[2] * semiAxes_[2]), real_t(1.0), pe::surfaceThreshold); + + (pz * pz)/(semiAxes_[2] * semiAxes_[2]), 1.0_r, pe::surfaceThreshold); } //************************************************************************************************* diff --git a/src/pe/rigidbody/Ellipsoid.h b/src/pe/rigidbody/Ellipsoid.h index e723bc1b..e5b21077 100644 --- a/src/pe/rigidbody/Ellipsoid.h +++ b/src/pe/rigidbody/Ellipsoid.h @@ -301,12 +301,12 @@ inline Mat3 Ellipsoid::calcInertia( const real_t mass, const Vec3& semiAxes ) inline Vec3 Ellipsoid::support( const Vec3& d ) const { auto len = d.sqrLength(); - if (!math::equal(len, real_t(0))) + if (!math::equal(len, 0_r)) { Vec3 d_loc = vectorFromWFtoBF(d); Vec3 norm_vec(d_loc[0] * semiAxes_[0], d_loc[1] * semiAxes_[1], d_loc[2] * semiAxes_[2]); real_t norm_length = norm_vec.length(); - Vec3 local_support = (real_t(1.0) / norm_length) * Vec3(semiAxes_[0] * semiAxes_[0] * d_loc[0], + Vec3 local_support = (1.0_r / norm_length) * Vec3(semiAxes_[0] * semiAxes_[0] * d_loc[0], semiAxes_[1] * semiAxes_[1] * d_loc[1], semiAxes_[2] * semiAxes_[2] * d_loc[2]); return pointFromBFtoWF(local_support); } else diff --git a/src/pe/rigidbody/Sphere.cpp b/src/pe/rigidbody/Sphere.cpp index 2d45389c..fc6682f9 100644 --- a/src/pe/rigidbody/Sphere.cpp +++ b/src/pe/rigidbody/Sphere.cpp @@ -86,7 +86,7 @@ Sphere::Sphere( id_t const typeId, id_t sid, id_t uid, const Vec3& gpos, const V setGlobal( global ); if (infiniteMass) { - setMassAndInertia( std::numeric_limits<real_t>::infinity(), Mat3(real_t(0)) ); + setMassAndInertia( std::numeric_limits<real_t>::infinity(), Mat3(0_r) ); } else { auto mass = calcMass( radius, Material::getDensity( material ) ); diff --git a/src/pe/rigidbody/Sphere.h b/src/pe/rigidbody/Sphere.h index d062e616..c1512614 100644 --- a/src/pe/rigidbody/Sphere.h +++ b/src/pe/rigidbody/Sphere.h @@ -303,9 +303,9 @@ inline Mat3 Sphere::calcInertia( const real_t mass, const real_t radius ) inline Vec3 Sphere::support( const Vec3& d ) const { auto len = d.sqrLength(); - if (!math::equal(len, real_t(0))) + if (!math::equal(len, 0_r)) { - //WALBERLA_ASSERT_FLOAT_EQUAL( len, real_t(1), "search direction not normalized!"); + //WALBERLA_ASSERT_FLOAT_EQUAL( len, 1_r, "search direction not normalized!"); const Vec3 s = getPosition() + (getRadius() / sqrt(len)) * d; //std::cout << "Support in direction " << d << " with center " << getPosition() << " (r=" << getRadius() << ") is " << s << std::endl; return s; @@ -327,9 +327,9 @@ inline Vec3 Sphere::support( const Vec3& d ) const inline Vec3 Sphere::supportContactThreshold( const Vec3& d ) const { auto len = d.sqrLength(); - if (!math::equal(len, real_t(0))) + if (!math::equal(len, 0_r)) { - //WALBERLA_ASSERT_FLOAT_EQUAL( len, real_t(1), "search direction not normalized!"); + //WALBERLA_ASSERT_FLOAT_EQUAL( len, 1_r, "search direction not normalized!"); const Vec3 s = getPosition() + (getRadius() / sqrt(len) + contactThreshold) * d; //std::cout << "Support in direction " << d << " with center " << getPosition() << " (r=" << getRadius() << ") is " << s << std::endl; return s; diff --git a/src/pe/rigidbody/Union.h b/src/pe/rigidbody/Union.h index fe6e0ce9..62b4a495 100644 --- a/src/pe/rigidbody/Union.h +++ b/src/pe/rigidbody/Union.h @@ -328,12 +328,12 @@ void Union<BodyTypeTuple>::calcBoundingBox() // Setting the bounding box of an empty union if( bodies_.isEmpty() ) { aabb_ = math::AABB( - gpos_[0] - real_t(0.01), - gpos_[1] - real_t(0.01), - gpos_[2] - real_t(0.01), - gpos_[0] + real_t(0.01), - gpos_[1] + real_t(0.01), - gpos_[2] + real_t(0.01) + gpos_[0] - 0.01_r, + gpos_[1] - 0.01_r, + gpos_[2] - 0.01_r, + gpos_[0] + 0.01_r, + gpos_[1] + 0.01_r, + gpos_[2] + 0.01_r ); } @@ -363,8 +363,8 @@ void Union<BodyTypeTuple>::calcCenterOfMass() WALBERLA_ASSERT( checkInvariants(), "Invalid union state detected" ); // Initializing the total mass and the inverse mass - mass_ = real_t(0); - invMass_ = real_t(0); + mass_ = 0_r; + invMass_ = 0_r; // Don't calculate the center of mass of an empty union if( bodies_.isEmpty() ) return; @@ -375,8 +375,8 @@ void Union<BodyTypeTuple>::calcCenterOfMass() const BodyID body( bodies_.begin().getBodyID() ); gpos_ = body->getPosition(); mass_ = body->getMass(); - if( !isFixed() && mass_ > real_t(0) ) - invMass_ = real_t(1) / mass_; + if( !isFixed() && mass_ > 0_r ) + invMass_ = 1_r / mass_; } // Calculating the center of mass of a union containing several bodies @@ -396,8 +396,8 @@ void Union<BodyTypeTuple>::calcCenterOfMass() } // Calculating the center of mass for unions with non-zero mass - if( mass_ > real_t(0) ) { - if( !isFixed() ) invMass_ = real_t(1) / mass_; + if( mass_ > 0_r ) { + if( !isFixed() ) invMass_ = 1_r / mass_; gpos_ /= mass_; } @@ -447,11 +447,11 @@ void Union<BodyTypeTuple>::calcInertia() WALBERLA_ASSERT( checkInvariants(), "Invalid union state detected" ); // Initializing the body moment of inertia and the inverse moment of inertia - I_ = real_t(0); - Iinv_ = real_t(0); + I_ = 0_r; + Iinv_ = 0_r; // Don't calculate the moment of inertia of an infinite or empty union - if( !isFinite() || bodies_.isEmpty() || floatIsEqual(mass_, real_t(0)) ) return; + if( !isFinite() || bodies_.isEmpty() || floatIsEqual(mass_, 0_r) ) return; // Calculating the global moment of inertia real_t mass; diff --git a/src/pe/rigidbody/UnionFactory.h b/src/pe/rigidbody/UnionFactory.h index eeff2ffe..298593d9 100644 --- a/src/pe/rigidbody/UnionFactory.h +++ b/src/pe/rigidbody/UnionFactory.h @@ -141,7 +141,7 @@ BoxID createBox( Union<BodyTypeTuple>* un, throw std::logic_error( "createBox: Union is remote" ); // Checking the side lengths - if( lengths[0] <= real_t(0) || lengths[1] <= real_t(0) || lengths[2] <= real_t(0) ) + if( lengths[0] <= 0_r || lengths[1] <= 0_r || lengths[2] <= 0_r ) throw std::invalid_argument( "Invalid side length" ); id_t sid = 0; diff --git a/src/pe/synchronization/SyncNextNeighbors.h b/src/pe/synchronization/SyncNextNeighbors.h index 83ad74ac..6cf5eb9f 100644 --- a/src/pe/synchronization/SyncNextNeighbors.h +++ b/src/pe/synchronization/SyncNextNeighbors.h @@ -250,7 +250,7 @@ void generateSynchonizationMessages(mpi::BufferSystem& bs, const Block& block, B } template <typename BodyTypeTuple> -void syncNextNeighbors( BlockForest& forest, BlockDataID storageID, WcTimingTree* tt = NULL, const real_t dx = real_t(0), const bool syncNonCommunicatingBodies = false ) +void syncNextNeighbors( BlockForest& forest, BlockDataID storageID, WcTimingTree* tt = NULL, const real_t dx = 0_r, const bool syncNonCommunicatingBodies = false ) { if (tt != NULL) tt->start("Sync"); if (tt != NULL) tt->start("Assembling Body Synchronization"); diff --git a/src/pe/synchronization/SyncShadowOwners.h b/src/pe/synchronization/SyncShadowOwners.h index 89716ed2..497aa704 100644 --- a/src/pe/synchronization/SyncShadowOwners.h +++ b/src/pe/synchronization/SyncShadowOwners.h @@ -372,7 +372,7 @@ void checkAndResolveOverlap( BlockForest& forest, BlockDataID storageID, const r } template <typename BodyTypeTuple> -void syncShadowOwners( BlockForest& forest, BlockDataID storageID, WcTimingTree* tt = NULL, const real_t dx = real_t(0), const bool syncNonCommunicatingBodies = false ) +void syncShadowOwners( BlockForest& forest, BlockDataID storageID, WcTimingTree* tt = NULL, const real_t dx = 0_r, const bool syncNonCommunicatingBodies = false ) { if (tt != NULL) tt->start("Sync"); diff --git a/src/pe/utility/CreateWorld.cpp b/src/pe/utility/CreateWorld.cpp index 377473c6..9b9253d8 100644 --- a/src/pe/utility/CreateWorld.cpp +++ b/src/pe/utility/CreateWorld.cpp @@ -88,7 +88,7 @@ std::unique_ptr<SetupBlockForest> createSetupBlockForest(const math::AABB& simul WALBERLA_LOG_INFO_ON_ROOT( "Balancing " << sforest->getNumberOfBlocks() << " blocks for " << numberOfProcesses << " processes..."); - sforest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, real_t(0), memory_t(0), false, true ); + sforest->balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), numberOfProcesses, 0_r, memory_t(0), false, true ); return sforest; } diff --git a/src/pe_coupling/discrete_particle_methods/correlations/AddedMassForceCorrelations.h b/src/pe_coupling/discrete_particle_methods/correlations/AddedMassForceCorrelations.h index 4574cbc1..b084082a 100644 --- a/src/pe_coupling/discrete_particle_methods/correlations/AddedMassForceCorrelations.h +++ b/src/pe_coupling/discrete_particle_methods/correlations/AddedMassForceCorrelations.h @@ -40,13 +40,13 @@ Vector3<real_t> addedMassForceFinn( const Vector3<real_t> & timeDerivativeFluidV const real_t & bodyVolume, const real_t & fluidDensity ) { // formula from Finn et al(2016) - const real_t Coeffam = real_t(0.5); + const real_t Coeffam = 0.5_r; return bodyVolume * fluidDensity * Coeffam * ( timeDerivativeFluidVel - timeDerivativeBodyVel ); } Vector3<real_t> noAddedMassForce( const Vector3<real_t> &, const Vector3<real_t> &, const real_t &, const real_t & ) { - return Vector3<real_t>(real_t(0)); + return Vector3<real_t>(0_r); } } // namespace discrete_particle_methods diff --git a/src/pe_coupling/discrete_particle_methods/correlations/DragForceCorrelations.h b/src/pe_coupling/discrete_particle_methods/correlations/DragForceCorrelations.h index 91ae0da4..f4964314 100644 --- a/src/pe_coupling/discrete_particle_methods/correlations/DragForceCorrelations.h +++ b/src/pe_coupling/discrete_particle_methods/correlations/DragForceCorrelations.h @@ -47,22 +47,22 @@ namespace discrete_particle_methods { // Schiller, L., Naumann, A., 1935. A drag coefficient correlation. Vdi Zeitung 77, 318-320. real_t dragCoeffSchillerNaumann( real_t reynoldsNumber ) { - WALBERLA_ASSERT_GREATER_EQUAL( reynoldsNumber, real_t(0) ); + WALBERLA_ASSERT_GREATER_EQUAL( reynoldsNumber, 0_r ); - return ( reynoldsNumber < real_t(1000) ) ? real_t(24) * ( real_t(1) + real_t(0.15) * std::pow(reynoldsNumber, real_t(0.687) ) ) / reynoldsNumber - : real_t(0.44); + return ( reynoldsNumber < 1000_r ) ? 24_r * ( 1_r + 0.15_r * std::pow(reynoldsNumber, 0.687_r ) ) / reynoldsNumber + : 0.44_r; } // Coefficient from Stokes' law for drag, only valid for Stokes regime (low Reynolds numbers) // = 3 * PI * mu * D * fluidVolumeFraction real_t dragCoeffStokes ( real_t fluidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity ) { - return real_t(3) * math::M_PI * diameter * fluidDynamicViscosity * fluidVolumeFraction; + return 3_r * math::M_PI * diameter * fluidDynamicViscosity * fluidVolumeFraction; } // threshold value for absolute relative velocity // if it is below this value, a drag force of 0 is set, to avoid instabilities stemming from divisions by this small value -const real_t thresholdAbsoluteVelocityDifference = real_t(1e-10); +const real_t thresholdAbsoluteVelocityDifference = 1e-10_r; ////////////////////// @@ -75,15 +75,15 @@ const real_t thresholdAbsoluteVelocityDifference = real_t(1e-10); Vector3<real_t> dragForceStokes( const Vector3<real_t> & fluidVel, const Vector3<real_t> & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t /*fluidDensity*/ ) { - WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, real_t(0) ); - WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, real_t(1) ); + WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, 0_r ); + WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, 1_r ); Vector3<real_t> velDiff = fluidVel - particleVel; real_t absVelDiff = velDiff.length(); - if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(real_t(0)); + if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(0_r); - real_t fluidVolumeFraction = real_t(1) - solidVolumeFraction; + real_t fluidVolumeFraction = 1_r - solidVolumeFraction; return dragCoeffStokes( fluidVolumeFraction, diameter, fluidDynamicViscosity ) * velDiff; } @@ -95,28 +95,28 @@ Vector3<real_t> dragForceStokes( const Vector3<real_t> & fluidVel, const Vector3 Vector3<real_t> dragForceErgunWenYu( const Vector3<real_t> & fluidVel, const Vector3<real_t> & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { - WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, real_t(0) ); - WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, real_t(1) ); + WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, 0_r ); + WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, 1_r ); Vector3<real_t> velDiff = fluidVel - particleVel; real_t absVelDiff = velDiff.length(); - if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(real_t(0)); + if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(0_r); - real_t fluidVolumeFraction = real_t(1) - solidVolumeFraction; + real_t fluidVolumeFraction = 1_r - solidVolumeFraction; - if( fluidVolumeFraction < real_t(0.8) ) + if( fluidVolumeFraction < 0.8_r ) { // Ergun relation real_t reynoldsNumber = fluidVolumeFraction * fluidDensity * absVelDiff * diameter / fluidDynamicViscosity; - real_t fDrag = real_t(150) * solidVolumeFraction / ( real_t(18) * fluidVolumeFraction * fluidVolumeFraction ) + - real_t(1.75) / ( real_t(18) * fluidVolumeFraction * fluidVolumeFraction ) * reynoldsNumber; + real_t fDrag = 150_r * solidVolumeFraction / ( 18_r * fluidVolumeFraction * fluidVolumeFraction ) + + 1.75_r / ( 18_r * fluidVolumeFraction * fluidVolumeFraction ) * reynoldsNumber; return fDrag * dragCoeffStokes( fluidVolumeFraction, diameter, fluidDynamicViscosity ) * velDiff; } else { // Wen & Yu correlation real_t reynoldsNumber = fluidVolumeFraction * fluidDensity * absVelDiff * diameter / fluidDynamicViscosity; - real_t fDrag = dragCoeffSchillerNaumann( reynoldsNumber ) * reynoldsNumber / real_t(24) * std::pow( fluidVolumeFraction, real_t(-3.7) ); + real_t fDrag = dragCoeffSchillerNaumann( reynoldsNumber ) * reynoldsNumber / 24_r * std::pow( fluidVolumeFraction, -3.7_r ); return fDrag * dragCoeffStokes( fluidVolumeFraction, diameter, fluidDynamicViscosity ) * velDiff; } } @@ -126,23 +126,23 @@ Vector3<real_t> dragForceErgunWenYu( const Vector3<real_t> & fluidVel, const Ve Vector3<real_t> dragForceTang( const Vector3<real_t> & fluidVel, const Vector3<real_t> & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { - WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, real_t(0) ); - WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, real_t(1) ); + WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, 0_r ); + WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, 1_r ); Vector3<real_t> velDiff = fluidVel - particleVel; real_t absVelDiff = velDiff.length(); - if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(real_t(0)); + if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(0_r); - real_t fluidVolumeFraction = real_t(1) - solidVolumeFraction; + real_t fluidVolumeFraction = 1_r - solidVolumeFraction; real_t fluidVolumeFractionP2 = fluidVolumeFraction * fluidVolumeFraction; - real_t inv_fluidVolumeFractionP4 = real_t(1) / (fluidVolumeFractionP2 * fluidVolumeFractionP2); + real_t inv_fluidVolumeFractionP4 = 1_r / (fluidVolumeFractionP2 * fluidVolumeFractionP2); real_t reynoldsNumber = fluidVolumeFraction * fluidDensity * absVelDiff * diameter / fluidDynamicViscosity; // Eq.21 from the paper - real_t fDrag = real_t(10) * solidVolumeFraction / fluidVolumeFractionP2 + fluidVolumeFractionP2 * ( real_t(1) + real_t(1.5) * std::sqrt(solidVolumeFraction) ) - + ( real_t(0.11) * solidVolumeFraction * ( real_t(1) + solidVolumeFraction ) - real_t(0.00456) * inv_fluidVolumeFractionP4 - + ( real_t(0.169) * fluidVolumeFraction + real_t(0.0644) * inv_fluidVolumeFractionP4 ) * std::pow( reynoldsNumber, -real_t(0.343) ) ) * reynoldsNumber; + real_t fDrag = 10_r * solidVolumeFraction / fluidVolumeFractionP2 + fluidVolumeFractionP2 * ( 1_r + 1.5_r * std::sqrt(solidVolumeFraction) ) + + ( 0.11_r * solidVolumeFraction * ( 1_r + solidVolumeFraction ) - 0.00456_r * inv_fluidVolumeFractionP4 + + ( 0.169_r * fluidVolumeFraction + 0.0644_r * inv_fluidVolumeFractionP4 ) * std::pow( reynoldsNumber, -0.343_r ) ) * reynoldsNumber; return fDrag * dragCoeffStokes( fluidVolumeFraction, diameter, fluidDynamicViscosity ) * velDiff; @@ -154,26 +154,26 @@ Vector3<real_t> dragForceTang( const Vector3<real_t> & fluidVel, const Vector3<r Vector3<real_t> dragForceFelice( const Vector3<real_t> & fluidVel, const Vector3<real_t> & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { - WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, real_t(0) ); - WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, real_t(1) ); + WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, 0_r ); + WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, 1_r ); Vector3<real_t> velDiff = fluidVel - particleVel; real_t absVelDiff = velDiff.length(); - if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(real_t(0)); + if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(0_r); - real_t fluidVolumeFraction = real_t(1) - solidVolumeFraction; + real_t fluidVolumeFraction = 1_r - solidVolumeFraction; real_t reynoldsNumber = fluidVolumeFraction * fluidDensity * absVelDiff * diameter / fluidDynamicViscosity; - real_t temp1 = ( real_t(0.63) + real_t(4.8) / std::sqrt( reynoldsNumber ) ); + real_t temp1 = ( 0.63_r + 4.8_r / std::sqrt( reynoldsNumber ) ); real_t dragCoeff = temp1 * temp1; - real_t temp2 = real_t(1.5) - std::log10( reynoldsNumber ); - real_t chi = real_t(3.7) - std::pow( real_t(0.65), (- real_t(0.5) * temp2 * temp2 ) ); + real_t temp2 = 1.5_r - std::log10( reynoldsNumber ); + real_t chi = 3.7_r - std::pow( 0.65_r, (- 0.5_r * temp2 * temp2 ) ); - return real_t(0.125) * dragCoeff * fluidDensity * math::M_PI * diameter * diameter * absVelDiff * - std::pow( fluidVolumeFraction, real_t(2) - chi) * velDiff; + return 0.125_r * dragCoeff * fluidDensity * math::M_PI * diameter * diameter * absVelDiff * + std::pow( fluidVolumeFraction, 2_r - chi) * velDiff; } @@ -183,30 +183,30 @@ Vector3<real_t> dragForceFelice( const Vector3<real_t> & fluidVel, const Vector3 Vector3<real_t> dragForceTenneti( const Vector3<real_t> & fluidVel, const Vector3<real_t> & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { - WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, real_t(0) ); - WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, real_t(1) ); + WALBERLA_ASSERT_GREATER_EQUAL( solidVolumeFraction, 0_r ); + WALBERLA_ASSERT_LESS_EQUAL( solidVolumeFraction, 1_r ); Vector3<real_t> velDiff = fluidVel - particleVel; const real_t absVelDiff = velDiff.length(); - if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(real_t(0)); + if( absVelDiff < thresholdAbsoluteVelocityDifference ) return Vector3<real_t>(0_r); - const real_t fluidVolumeFraction = real_t(1) - solidVolumeFraction; + const real_t fluidVolumeFraction = 1_r - solidVolumeFraction; const real_t reynoldsNumber = fluidVolumeFraction * fluidDensity * absVelDiff * diameter / fluidDynamicViscosity; const real_t fvfCubed = fluidVolumeFraction * fluidVolumeFraction * fluidVolumeFraction; - const real_t A = real_t(5.81) * solidVolumeFraction / fvfCubed + real_t(0.48) * std::cbrt( solidVolumeFraction ) / ( fvfCubed * fluidVolumeFraction ); + const real_t A = 5.81_r * solidVolumeFraction / fvfCubed + 0.48_r * std::cbrt( solidVolumeFraction ) / ( fvfCubed * fluidVolumeFraction ); const real_t svfCubed = solidVolumeFraction * solidVolumeFraction * solidVolumeFraction; - const real_t B = svfCubed * reynoldsNumber * ( real_t(0.95) + real_t(0.61) * svfCubed / ( fluidVolumeFraction * fluidVolumeFraction ) ); + const real_t B = svfCubed * reynoldsNumber * ( 0.95_r + 0.61_r * svfCubed / ( fluidVolumeFraction * fluidVolumeFraction ) ); // version from Finn et al. - const real_t CdRe0Sphere = real_t(1) + real_t(0.15) * std::pow( reynoldsNumber, real_t(0.687) ); + const real_t CdRe0Sphere = 1_r + 0.15_r * std::pow( reynoldsNumber, 0.687_r ); const real_t CdRe = fluidVolumeFraction * ( CdRe0Sphere / fvfCubed + A + B ); - return real_t(3) * math::M_PI * diameter * fluidDynamicViscosity * fluidVolumeFraction * CdRe * velDiff; + return 3_r * math::M_PI * diameter * fluidDynamicViscosity * fluidVolumeFraction * CdRe * velDiff; } @@ -214,7 +214,7 @@ Vector3<real_t> dragForceTenneti( const Vector3<real_t> & fluidVel, const Vector Vector3<real_t> noDragForce( const Vector3<real_t> & /*fluidVel*/, const Vector3<real_t> & /*particleVel*/, real_t /*solidVolumeFraction*/, real_t /*diameter*/, real_t /*fluidDynamicViscosity*/, real_t /*fluidDensity*/ ) { - return Vector3<real_t>(real_t(0)); + return Vector3<real_t>(0_r); } } // namespace discrete_particle_methods diff --git a/src/pe_coupling/discrete_particle_methods/correlations/LiftForceCorrelations.h b/src/pe_coupling/discrete_particle_methods/correlations/LiftForceCorrelations.h index 8e66b93d..c85ae98f 100644 --- a/src/pe_coupling/discrete_particle_methods/correlations/LiftForceCorrelations.h +++ b/src/pe_coupling/discrete_particle_methods/correlations/LiftForceCorrelations.h @@ -41,21 +41,21 @@ Vector3<real_t> liftForceSaffman ( const Vector3<real_t> & fluidVel, const Vecto real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { const real_t absCurlVel = curlFluidVel.length(); - if( absCurlVel < real_t(1e-10) ) return Vector3<real_t>(real_t(0)); + if( absCurlVel < 1e-10_r ) return Vector3<real_t>(0_r); // Finn et al (2016) for spheres - const real_t Cl = real_t(1.61) * std::sqrt( ( fluidDynamicViscosity * fluidDensity) / absCurlVel ); + const real_t Cl = 1.61_r * std::sqrt( ( fluidDynamicViscosity * fluidDensity) / absCurlVel ); return Cl * diameter * diameter * ( ( fluidVel - particleVel ) % curlFluidVel ); // Sun, Xiao (2016) - //const real_t Cl = real_t(1.6); + //const real_t Cl = 1.6_r; //return Cl * fluidDensity * std::sqrt( fluidDynamicViscosity / fluidDensity ) * diameter * diameter * ( ( fluidVel - particleVel ) % curlFluidVel ); } Vector3<real_t> noLiftForce ( const Vector3<real_t> &, const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t ) { - return Vector3<real_t>(real_t(0)); + return Vector3<real_t>(0_r); } } // namespace discrete_particle_methods diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/AddedMassForceEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/AddedMassForceEvaluator.h index c452f886..5a2a7b0a 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/AddedMassForceEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/AddedMassForceEvaluator.h @@ -123,16 +123,16 @@ void AddedMassForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T > { if(!dpmBodySelectorFct_(bodyIt.getBodyID())) continue; - Vector3<real_t> forceOnFluid( real_t(0) ); + Vector3<real_t> forceOnFluid( 0_r ); Vector3<real_t> bodyPosition = bodyIt->getPosition(); Vector3<real_t> bodyVelocity = bodyIt->getLinearVel(); real_t bodyVolume = bodyIt->getVolume(); - real_t fluidDensity( real_t(1) ); + real_t fluidDensity( 1_r ); // evaluate added (virtual) mass force - Vector3<real_t> timeDerivativeFluidVelocity( real_t(0) ); - Vector3<real_t> timeDerivativeBodyVelocity( real_t(0) ); + Vector3<real_t> timeDerivativeFluidVelocity( 0_r ); + Vector3<real_t> timeDerivativeBodyVelocity( 0_r ); bodyVelocityTimeDerivativeEvaluator_->get(timeDerivativeBodyVelocity, bodyVelocity, bodyIt->getSystemID() ); velocityTimeDerivativeInterpolator->get( bodyPosition, &timeDerivativeFluidVelocity ); Vector3<real_t> addedMassForce = addedMassForceCorrelationFunction_( timeDerivativeFluidVelocity, timeDerivativeBodyVelocity, bodyVolume, fluidDensity ); diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/BodyVelocityTimeDerivativeEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/BodyVelocityTimeDerivativeEvaluator.h index 7345398b..15dd2f14 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/BodyVelocityTimeDerivativeEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/BodyVelocityTimeDerivativeEvaluator.h @@ -49,9 +49,9 @@ class BodyVelocityTimeDerivativeEvaluator public: BodyVelocityTimeDerivativeEvaluator( const shared_ptr<StructuredBlockStorage> & blockStorage, - const BlockDataID & bodyStorageID, const real_t & deltaT = real_t(1), + const BlockDataID & bodyStorageID, const real_t & deltaT = 1_r, const std::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) - : blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), deltaTinv_( real_t(1) / deltaT ), + : blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), deltaTinv_( 1_r / deltaT ), dpmBodySelectorFct_( dpmBodySelectorFct) { } @@ -72,7 +72,7 @@ public: void resetDeltaT( const real_t & deltaT ) { - deltaTinv_ = real_t(1) / deltaT; + deltaTinv_ = 1_r / deltaT; } void get( Vector3<real_t> & particleVelocityTimeDerivative, const Vector3<real_t> currentParticleVelocity, const walberla::id_t & bodySystemID ) diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h index fc10c9b9..1df98fb4 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h @@ -47,9 +47,9 @@ real_t calculateRescaledEffectiveViscosity( real_t fluidViscosity, real_t porosi // bottom boundary layer", Journal of Fluid Mechanics 796 (2016) 340–385. doi:10.1017/jfm.2016.246. real_t calculateEilersEffectiveViscosity( real_t fluidViscosity, real_t porosity ) { - const real_t closePackingFraction = real_t(0.64); - const real_t intrinsicViscosity = real_t(2.5); //for monosized spheres - const real_t temp = real_t(1) + real_t(0.5) * intrinsicViscosity * ( real_t(1) - porosity ) / ( porosity / closePackingFraction ); + const real_t closePackingFraction = 0.64_r; + const real_t intrinsicViscosity = 2.5_r; //for monosized spheres + const real_t temp = 1_r + 0.5_r * intrinsicViscosity * ( 1_r - porosity ) / ( porosity / closePackingFraction ); return fluidViscosity * temp * temp; } @@ -78,8 +78,8 @@ public: const ScalarField_T* svfField = block->getData<ScalarField_T>(solidVolumeFractionFieldID_); WALBERLA_FOR_ALL_CELLS_XYZ(omegaField, - const real_t porosity = real_t(1) - svfField->get(x,y,z); - WALBERLA_ASSERT_FLOAT_UNEQUAL(porosity, real_t(0)); + const real_t porosity = 1_r - svfField->get(x,y,z); + WALBERLA_ASSERT_FLOAT_UNEQUAL(porosity, 0_r); real_t effectiveViscosity = effectiveViscosityFunc_(fluidViscosity_, porosity); diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/InteractionForceEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/InteractionForceEvaluator.h index 11709d1e..9a546c03 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/InteractionForceEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/InteractionForceEvaluator.h @@ -138,25 +138,25 @@ void InteractionForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T { if(!dpmBodySelectorFct_(bodyIt.getBodyID())) continue; - Vector3<real_t> forceOnFluid( real_t(0) ); + Vector3<real_t> forceOnFluid( 0_r ); Vector3<real_t> bodyPosition = bodyIt->getPosition(); // interpolate fluid velocity to body position - Vector3<real_t> fluidVelocity( real_t(0) ); + Vector3<real_t> fluidVelocity( 0_r ); velocityInterpolator->get( bodyPosition, &fluidVelocity ); // interpolate solid volume fraction to body position - real_t solidVolumeFraction( real_t(0) ); + real_t solidVolumeFraction( 0_r ); solidVolumeFractionInterpolator->get( bodyPosition, &solidVolumeFraction ); - WALBERLA_ASSERT_GREATER( solidVolumeFraction, real_t(0) ); + WALBERLA_ASSERT_GREATER( solidVolumeFraction, 0_r ); // evaluate drag force Vector3<real_t> bodyVelocity = bodyIt->getLinearVel(); real_t bodyDiameter = getSphereEquivalentDiameter( *bodyIt ); real_t bodyVolume = bodyIt->getVolume(); - real_t fluidDensity( real_t(1) ); + real_t fluidDensity( 1_r ); Vector3<real_t> dragForce = dragForceCorrelationFunction_( fluidVelocity, bodyVelocity, solidVolumeFraction, bodyDiameter, fluidDynamicViscosity_, fluidDensity ); @@ -168,7 +168,7 @@ void InteractionForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T forceOnFluid += ( -dragForce ); // evaluate pressure gradient force = - V * grad(p) - Vector3<real_t> pressureGradient( real_t(0) ); + Vector3<real_t> pressureGradient( 0_r ); pressureGradientInterpolator->get( bodyPosition, &pressureGradient ); Vector3<real_t> pressureGradientForce = -bodyVolume * pressureGradient; WALBERLA_ASSERT( !math::isnan(pressureGradientForce[0]) && !math::isnan(pressureGradientForce[1]) && !math::isnan(pressureGradientForce[2]), diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/LiftForceEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/LiftForceEvaluator.h index de851834..9b131978 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/LiftForceEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/LiftForceEvaluator.h @@ -117,19 +117,19 @@ void LiftForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T > { if(!dpmBodySelectorFct_(bodyIt.getBodyID())) continue; - Vector3<real_t> forceOnFluid( real_t(0) ); + Vector3<real_t> forceOnFluid( 0_r ); Vector3<real_t> bodyPosition = bodyIt->getPosition(); Vector3<real_t> bodyVelocity = bodyIt->getLinearVel(); - real_t fluidDensity( real_t(1) ); + real_t fluidDensity( 1_r ); real_t bodyDiameter = getSphereEquivalentDiameter( *bodyIt ); // interpolate fluid velocity and fluid curl to body position - Vector3<real_t> fluidVelocity( real_t(0) ); + Vector3<real_t> fluidVelocity( 0_r ); velocityInterpolator->get( bodyPosition, &fluidVelocity ); - Vector3<real_t> velocityCurl( real_t(0) ); + Vector3<real_t> velocityCurl( 0_r ); velocityCurlInterpolator->get( bodyPosition, &velocityCurl ); // evaluate lift force according to empirical model diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/LubricationForceEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/LubricationForceEvaluator.h index b9bf1029..5ef05b64 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/LubricationForceEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/LubricationForceEvaluator.h @@ -55,7 +55,7 @@ public: LubricationForceEvaluator ( const shared_ptr<StructuredBlockStorage> & blockStorage, const shared_ptr<pe::BodyStorage> & globalBodyStorage, const BlockDataID & bodyStorageID, real_t dynamicViscosity, - real_t cutOffDistance = real_t(2) / real_t(3), real_t minimalGapSize = real_t(1e-5) ) + real_t cutOffDistance = 2_r / 3_r, real_t minimalGapSize = 1e-5_r ) : blockStorage_ ( blockStorage ) , globalBodyStorage_( globalBodyStorage ) , bodyStorageID_( bodyStorageID ) @@ -149,7 +149,7 @@ void LubricationForceEvaluator::treatLubricationSphrSphr( const pe::SphereID sph real_t gap = pe::getSurfaceDistance( sphereI, sphereJ ); - if ( gap > cutOffDistance_ || gap < real_t(0) ) + if ( gap > cutOffDistance_ || gap < 0_r ) { WALBERLA_LOG_DETAIL("gap " << gap << " larger than cutOff " << cutOffDistance_ << " - ignoring pair"); return; @@ -166,7 +166,7 @@ void LubricationForceEvaluator::treatLubricationSphrSphr( const pe::SphereID sph pe::Vec3 fLub(0); // compute (global) coordinate between spheres' centers of gravity - pe::Vec3 midPoint( (posSphereI + posSphereJ ) * real_t(0.5) ); + pe::Vec3 midPoint( (posSphereI + posSphereJ ) * 0.5_r ); // Let process on which midPoint lies do the lubrication correction // or the local process of sphereI if sphereJ is global @@ -187,7 +187,7 @@ void LubricationForceEvaluator::treatLubricationSphrPlane( const pe::SphereID sp real_t gap = pe::getSurfaceDistance( sphereI, planeJ ); - if ( gap > cutOffDistance_ || gap < real_t(0) ) + if ( gap > cutOffDistance_ || gap < 0_r ) { WALBERLA_LOG_DETAIL("gap " << gap << " larger than cutOff " << cutOffDistance_ << " - ignoring pair"); return; @@ -215,35 +215,35 @@ pe::Vec3 LubricationForceEvaluator::compLubricationSphrSphr( real_t gap, const p const pe::Vec3 &tmpVec = posSphereJ - posSphereI; const pe::Vec3 &rIJ = tmpVec.getNormalized(); - real_t diameterSphereI = real_t(2) * sphereI->getRadius(); - real_t diameterSphereJ = real_t(2) * sphereJ->getRadius(); + real_t diameterSphereI = 2_r * sphereI->getRadius(); + real_t diameterSphereJ = 2_r * sphereJ->getRadius(); pe::Vec3 velDiff(sphereI->getLinearVel() - sphereJ->getLinearVel()); real_t length = velDiff * rIJ; - real_t d = real_t(2) * diameterSphereI * diameterSphereJ / ( diameterSphereI + diameterSphereJ ); + real_t d = 2_r * diameterSphereI * diameterSphereJ / ( diameterSphereI + diameterSphereJ ); real_t h = gap; real_t r = d + h; - real_t a_sq = ( real_t(3) * dynamicViscosity_ * walberla::math::PI * d / real_t(2) ) * ( d / ( real_t(4) * h ) + ( real_t(18) / real_t(40) ) * std::log( d / ( real_t(2) * h ) ) + - ( real_t(9)/real_t(84) ) * ( h / d ) * std::log( d/( real_t(2)*h ) ) ); - real_t a_sh = ( dynamicViscosity_ * walberla::math::PI * d / real_t(2) ) * std::log( d / ( real_t(2) * h ) ) * ( d + h ) * ( d + h ) / real_t(4); - pe::Vec3 fLub( - a_sq * length * rIJ - a_sh * ( real_t(2) / r ) * ( real_t(2) / r ) * ( velDiff - length * rIJ ) ); + real_t a_sq = ( 3_r * dynamicViscosity_ * walberla::math::PI * d / 2_r ) * ( d / ( 4_r * h ) + ( 18_r / 40_r ) * std::log( d / ( 2_r * h ) ) + + ( 9_r/84_r ) * ( h / d ) * std::log( d/( 2_r*h ) ) ); + real_t a_sh = ( dynamicViscosity_ * walberla::math::PI * d / 2_r ) * std::log( d / ( 2_r * h ) ) * ( d + h ) * ( d + h ) / 4_r; + pe::Vec3 fLub( - a_sq * length * rIJ - a_sh * ( 2_r / r ) * ( 2_r / r ) * ( velDiff - length * rIJ ) ); WALBERLA_LOG_DETAIL_SECTION() { std::stringstream ss; ss << "Sphere I: \n uid:" << sphereI->getID() << "\n"; ss << "vel: " << sphereI->getLinearVel() << "\n"; - ss << "rad: " << diameterSphereI * real_t(0.5) << "\n"; + ss << "rad: " << diameterSphereI * 0.5_r << "\n"; ss << "pos: " << posSphereI << "\n\n"; ss << "Sphere J: \n uid:" << sphereJ->getID() << "\n"; ss << "vel: " << sphereJ->getLinearVel() << "\n"; - ss << "rad: " << diameterSphereJ * real_t(0.5) << "\n"; + ss << "rad: " << diameterSphereJ * 0.5_r << "\n"; ss << "pos: " << posSphereJ << "\n\n"; - real_t distance = gap + diameterSphereI * real_t(0.5) + diameterSphereJ * real_t(0.5); + real_t distance = gap + diameterSphereI * 0.5_r + diameterSphereJ * 0.5_r; ss << "distance: " << distance << "\n"; ss << "viscosity: " << dynamicViscosity_ << "\n"; @@ -271,13 +271,13 @@ pe::Vec3 LubricationForceEvaluator::compLubricationSphrPlane( real_t gap, const real_t length = sphereI->getLinearVel() * rIJ; pe::Vec3 v1 = sphereI->getLinearVel(); - real_t d = real_t(4) * radiusSphereI; + real_t d = 4_r * radiusSphereI; real_t h = gap; real_t r = d + h; - real_t a_sq = ( real_t(3) * dynamicViscosity_ * walberla::math::PI * d / real_t(2) ) * ( d / ( real_t(4) * h ) + ( real_t(18) / real_t(40) ) * std::log( d / ( real_t(2) * h ) ) + - ( real_t(9)/real_t(84) ) * ( h / d ) * std::log( d/( real_t(2)*h ) ) ); - real_t a_sh = ( dynamicViscosity_ * walberla::math::PI * d / real_t(2) ) * std::log( d / ( real_t(2) * h ) ) * ( d + h ) * ( d + h ) / real_t(4); - pe::Vec3 fLub( - a_sq * length * rIJ - a_sh * ( real_t(2) / r ) * ( real_t(2) / r ) * ( v1 - length * rIJ ) ); + real_t a_sq = ( 3_r * dynamicViscosity_ * walberla::math::PI * d / 2_r ) * ( d / ( 4_r * h ) + ( 18_r / 40_r ) * std::log( d / ( 2_r * h ) ) + + ( 9_r/84_r ) * ( h / d ) * std::log( d/( 2_r*h ) ) ); + real_t a_sh = ( dynamicViscosity_ * walberla::math::PI * d / 2_r ) * std::log( d / ( 2_r * h ) ) * ( d + h ) * ( d + h ) / 4_r; + pe::Vec3 fLub( - a_sq * length * rIJ - a_sh * ( 2_r / r ) * ( 2_r / r ) * ( v1 - length * rIJ ) ); WALBERLA_LOG_DETAIL_SECTION() { std::stringstream ss; diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/PressureFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/PressureFieldEvaluator.h index 61998ae6..5be08802 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/PressureFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/PressureFieldEvaluator.h @@ -52,7 +52,7 @@ public: ScalarField_T* pressureField = block->getData< ScalarField_T >( pressureFieldID_ ); const BoundaryHandling_T * boundaryHandling = block->getData< BoundaryHandling_T >( boundaryHandlingID_ ); - const real_t c_s_sqr = real_t(1)/real_t(3); + const real_t c_s_sqr = 1_r/3_r; WALBERLA_FOR_ALL_CELLS_XYZ( pdfField, if( boundaryHandling->isDomain(x,y,z) ) { diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/PressureGradientFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/PressureGradientFieldEvaluator.h index 2e8511fc..0462a133 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/PressureGradientFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/PressureGradientFieldEvaluator.h @@ -72,7 +72,7 @@ private: { // temporarily store pressure values of surrounding cells - std::vector<real_t> pressureValues( Stencil_T::Size, real_t(0) ); + std::vector<real_t> pressureValues( Stencil_T::Size, 0_r ); // store pressure value in center cell to potentially apply Neumann like boundary conditions real_t pressureInCenterCell = pressureField->get( cell ); diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/StressTensorGradientFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/StressTensorGradientFieldEvaluator.h index 29dce0a6..f6bdef06 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/StressTensorGradientFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/StressTensorGradientFieldEvaluator.h @@ -82,7 +82,7 @@ private: Vector3<real_t> getStressTensorGradient( const Cell & cell, const TensorField_T* velocityGradientField, const BoundaryHandling_T * boundaryHandling ) { - std::vector< Matrix3< real_t > > stressTensorValues( Stencil_T::Size, Matrix3< real_t >(real_t(0)) ); + std::vector< Matrix3< real_t > > stressTensorValues( Stencil_T::Size, Matrix3< real_t >(0_r) ); Matrix3< real_t > velGradientInCenterCell = velocityGradientField->get( cell ); @@ -104,8 +104,8 @@ private: // obtain the gradient of the tensor using the gradient formula // See: Ramadugu et al - "Lattice differential operators for computational physics" (2013) // with T = c_s**2 - const real_t inv_c_s_sqr = real_t(3); - Vector3<real_t> gradStressTensor( real_t(0) ); + const real_t inv_c_s_sqr = 3_r; + Vector3<real_t> gradStressTensor( 0_r ); for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir) { Vector3<real_t> latticeVel( real_c(dir.cx()), real_c(dir.cy()), real_c(dir.cz()) ); diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/VelocityCurlFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/VelocityCurlFieldEvaluator.h index 0442814d..3b963b84 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/VelocityCurlFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/VelocityCurlFieldEvaluator.h @@ -70,7 +70,7 @@ private: Vector3<real_t> getVelocityCurl( const Cell & cell, const VectorField_T * velocityField, const BoundaryHandling_T * boundaryHandling ) { - std::vector< Vector3<real_t> > velocityValues( Stencil_T::Size, Vector3<real_t>(real_t(0)) ); + std::vector< Vector3<real_t> > velocityValues( Stencil_T::Size, Vector3<real_t>(0_r) ); Vector3<real_t> velocityInCenterCell = velocityField->get( cell ); @@ -89,8 +89,8 @@ private: // apply curl formula // See: Ramadugu et al - Lattice differential operators for computational physics (2013) // with T = c_s**2 - const real_t inv_c_s_sqr = real_t(3); - Vector3<real_t> curl( real_t(0) ); + const real_t inv_c_s_sqr = 3_r; + Vector3<real_t> curl( 0_r ); for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir) { Vector3<real_t> latticeVel( real_c(dir.cx()), real_c(dir.cy()), real_c(dir.cz()) ); diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/VelocityGradientFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/VelocityGradientFieldEvaluator.h index 9e0397a5..d55a44a1 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/VelocityGradientFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/VelocityGradientFieldEvaluator.h @@ -62,7 +62,7 @@ public: TensorField_T* velocityGradientField = block->getData< TensorField_T >( velocityGradientFieldID_ ); const BoundaryHandling_T * boundaryHandling = block->getData< BoundaryHandling_T >( boundaryHandlingID_ ); - Matrix3<real_t> velocityGradient( real_t(0) ); + Matrix3<real_t> velocityGradient( 0_r ); WALBERLA_FOR_ALL_CELLS_XYZ( velocityGradientField, if( boundaryHandling->isDomain(x,y,z) ) @@ -83,7 +83,7 @@ private: void getVelocityGradient( const Cell & cell, const VectorField_T * velocityField, const BoundaryHandling_T * boundaryHandling, Matrix3<real_t> & velocityGradient ) { - std::vector< Vector3<real_t> > velocityValues( Stencil_T::Size, Vector3<real_t>(real_t(0)) ); + std::vector< Vector3<real_t> > velocityValues( Stencil_T::Size, Vector3<real_t>(0_r) ); Vector3<real_t> velocityInCenterCell = velocityField->get( cell ); @@ -102,8 +102,8 @@ private: // obtain the matrix grad(u) with the help of the gradient formula from // See: Ramadugu et al - Lattice differential operators for computational physics (2013) // with T = c_s**2 - const real_t inv_c_s_sqr = real_t(3); - velocityGradient = real_t(0); + const real_t inv_c_s_sqr = 3_r; + velocityGradient = 0_r; for( auto dir = Stencil_T::beginNoCenter(); dir != Stencil_T::end(); ++dir) { real_t cx = real_c(dir.cx()); diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/VelocityTotalTimeDerivativeFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/VelocityTotalTimeDerivativeFieldEvaluator.h index 62e70f97..77d042aa 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/VelocityTotalTimeDerivativeFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/VelocityTotalTimeDerivativeFieldEvaluator.h @@ -53,9 +53,9 @@ public: const ConstBlockDataID & currentVelocityFieldID, const ConstBlockDataID & formerVelocityFieldID, const ConstBlockDataID & velocityGradientFieldID, - const real_t & deltaT = real_t(1) ) + const real_t & deltaT = 1_r ) : totalTimeDerivativeVelocityFieldID_( totalTimeDerivativeVelocityFieldID ), currentVelocityFieldID_( currentVelocityFieldID ), - formerVelocityFieldID_( formerVelocityFieldID ), velocityGradientFieldID_( velocityGradientFieldID ), deltaTinv_( real_t(1) / deltaT ) + formerVelocityFieldID_( formerVelocityFieldID ), velocityGradientFieldID_( velocityGradientFieldID ), deltaTinv_( 1_r / deltaT ) { } void operator()(IBlock * const block) @@ -86,7 +86,7 @@ public: void resetDeltaT( const real_t & deltaT ) { - deltaTinv_ = real_t(1) / deltaT; + deltaTinv_ = 1_r / deltaT; } private: diff --git a/src/pe_coupling/discrete_particle_methods/gns_lbm/GNSSweep.h b/src/pe_coupling/discrete_particle_methods/gns_lbm/GNSSweep.h index 72649668..db0e1c74 100644 --- a/src/pe_coupling/discrete_particle_methods/gns_lbm/GNSSweep.h +++ b/src/pe_coupling/discrete_particle_methods/gns_lbm/GNSSweep.h @@ -140,8 +140,8 @@ void GNSSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut if( this->filter(x,y,z) ) { - const real_t fluidVolumeFraction = real_t(1) - solidVolumeFractionField->get(x,y,z); //i.e. porosity - const real_t invFluidVolumeFraction = real_t(1)/fluidVolumeFraction; + const real_t fluidVolumeFraction = 1_r - solidVolumeFractionField->get(x,y,z); //i.e. porosity + const real_t invFluidVolumeFraction = 1_r/fluidVolumeFraction; // stream pull for( auto d = Stencil_T::begin(); d != Stencil_T::end(); ++d ) @@ -163,15 +163,15 @@ void GNSSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut { const real_t wq = LatticeModel_T::w[ d.toIdx() ]; const Vector3<real_t> c( real_c(d.cx()), real_c(d.cy()), real_c(d.cz()) ); - const real_t forceTerm = real_t(3.0) * wq * ( real_t(1) - real_t(0.5) * omega ) * - ( ( c - invFluidVolumeFraction * velocity + ( real_t(3) * invFluidVolumeFraction * ( c * velocity ) * c ) ) * extForce ); // modified Guo forcing, multiplication by rho is wrong because of units + const real_t forceTerm = 3.0_r * wq * ( 1_r - 0.5_r * omega ) * + ( ( c - invFluidVolumeFraction * velocity + ( 3_r * invFluidVolumeFraction * ( c * velocity ) * c ) ) * extForce ); // modified Guo forcing, multiplication by rho is wrong because of units const real_t vel = c * velocity; - real_t feq = wq * rho * ( real_t(1) - real_t(1.5) * invFluidVolumeFraction * velocity.sqrLength() + - real_t(4.5) * invFluidVolumeFraction * vel * vel + real_t(3.0) * vel ); // modified feq + real_t feq = wq * rho * ( 1_r - 1.5_r * invFluidVolumeFraction * velocity.sqrLength() + + 4.5_r * invFluidVolumeFraction * vel * vel + 3.0_r * vel ); // modified feq feq -= wq; // center PDFs around 0 - dst->get( x, y, z, d.toIdx() ) = ( real_t(1.0) - omega ) * dst->get( x, y, z, d.toIdx() ) + + dst->get( x, y, z, d.toIdx() ) = ( 1.0_r - omega ) * dst->get( x, y, z, d.toIdx() ) + omega * feq + forceTerm; } @@ -212,8 +212,8 @@ void GNSSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( src, numberOfGhostLayersToInclude, if( this->filter(x,y,z) ) { - const real_t fluidVolumeFraction = real_t(1) - solidVolumeFractionField->get(x,y,z); //i.e. porosity - const real_t invFluidVolumeFraction = real_t(1)/fluidVolumeFraction; + const real_t fluidVolumeFraction = 1_r - solidVolumeFractionField->get(x,y,z); //i.e. porosity + const real_t invFluidVolumeFraction = 1_r/fluidVolumeFraction; Vector3<real_t> velocity; real_t rho = this->densityVelocityIn( velocity, src, x, y, z ); @@ -231,15 +231,15 @@ void GNSSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut { const real_t wq = LatticeModel_T::w[ d.toIdx() ]; const Vector3<real_t> c( real_c(d.cx()), real_c(d.cy()), real_c(d.cz()) ); - const real_t forceTerm = real_t(3.0) * wq * ( real_t(1) - real_t(0.5) * omega ) * - ( ( c - invFluidVolumeFraction * velocity + ( real_t(3) * invFluidVolumeFraction * ( c * velocity ) * c ) ) * extForce ); // modified Guo forcing + const real_t forceTerm = 3.0_r * wq * ( 1_r - 0.5_r * omega ) * + ( ( c - invFluidVolumeFraction * velocity + ( 3_r * invFluidVolumeFraction * ( c * velocity ) * c ) ) * extForce ); // modified Guo forcing const real_t vel = c * velocity; - real_t feq = wq * rho * ( real_t(1) - real_t(1.5) * invFluidVolumeFraction * velocity.sqrLength() + - real_t(4.5) * invFluidVolumeFraction * vel * vel + real_t(3.0) * vel ); // modified feq + real_t feq = wq * rho * ( 1_r - 1.5_r * invFluidVolumeFraction * velocity.sqrLength() + + 4.5_r * invFluidVolumeFraction * vel * vel + 3.0_r * vel ); // modified feq feq -= wq; // center PDFs around 0 - src->get( x, y, z, d.toIdx() ) = ( real_t(1.0) - omega ) * src->get( x, y, z, d.toIdx() ) + + src->get( x, y, z, d.toIdx() ) = ( 1.0_r - omega ) * src->get( x, y, z, d.toIdx() ) + omega * feq + forceTerm; } diff --git a/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSExternalForceToForceFieldAdder.h b/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSExternalForceToForceFieldAdder.h index 73fc6f54..2ac98c97 100644 --- a/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSExternalForceToForceFieldAdder.h +++ b/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSExternalForceToForceFieldAdder.h @@ -56,7 +56,7 @@ public: //TODO include dx force scaling WALBERLA_FOR_ALL_CELLS_XYZ( forceField, - forceField->get(x,y,z) += ( real_t(1) - solidVolumeFractionField->get(x,y,z) ) * externalForce_; + forceField->get(x,y,z) += ( 1_r - solidVolumeFractionField->get(x,y,z) ) * externalForce_; ); } diff --git a/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSPressureFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSPressureFieldEvaluator.h index c284db5f..f5511f9c 100644 --- a/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSPressureFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSPressureFieldEvaluator.h @@ -52,12 +52,12 @@ public: //const ScalarField_T* solidVolumeFractionField = block->getData< ScalarField_T >( solidVolumeFractionFieldID_ ); const BoundaryHandling_T * boundaryHandling = block->getData< BoundaryHandling_T >( boundaryHandlingID_ ); - const real_t c_s_sqr = real_t(1)/real_t(3); + const real_t c_s_sqr = 1_r/3_r; WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ( pdfField, if( boundaryHandling->isDomain(x,y,z) ) { real_t fluidDensity = pdfField->getDensity(x,y,z); - //real_t fluidVolumeFraction = real_t(1) - solidVolumeFractionField->get(x,y,z); + //real_t fluidVolumeFraction = 1_r - solidVolumeFractionField->get(x,y,z); // according to Guo (2002): p = rho * eps / 3 // However, this would result in pressure gradients in the presence of solid volume fraction gradients. diff --git a/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSSmagorinskyLESField.h b/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSSmagorinskyLESField.h index 4ae1a67d..2ac19ee2 100644 --- a/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSSmagorinskyLESField.h +++ b/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSSmagorinskyLESField.h @@ -129,7 +129,7 @@ void GNSSmagorinskyLESField< LatticeModel_T, Filter_T >::operator()( IBlock * co WALBERLA_ASSERT_EQUAL( pdfField->xyzSizeWithGhostLayer(), omegaField->xyzSizeWithGhostLayer() ); - const real_t factor = real_t(18) * std::sqrt( real_t(2) ) * smagorinskyConstant_ * smagorinskyConstant_; + const real_t factor = 18_r * std::sqrt( 2_r ) * smagorinskyConstant_ * smagorinskyConstant_; filter_( *block ); @@ -137,15 +137,15 @@ void GNSSmagorinskyLESField< LatticeModel_T, Filter_T >::operator()( IBlock * co if( filter_(x,y,z) ) { - const real_t tau0 = real_t(1) / omegaField->get(x,y,z); + const real_t tau0 = 1_r / omegaField->get(x,y,z); Vector3< real_t > momentumDensity; const real_t rho = pdfField->getDensityAndEquilibriumMomentumDensity( momentumDensity, x, y, z ); Vector3< real_t > velocity = momentumDensity / rho; - const real_t porosity = real_t(1) - svfField->get(x,y,z); - const real_t invPorosity = real_t(1) / porosity; + const real_t porosity = 1_r - svfField->get(x,y,z); + const real_t invPorosity = 1_r / porosity; // use special GNS equilibrium std::vector< real_t > equilibrium( Stencil_T::Size ); @@ -153,8 +153,8 @@ void GNSSmagorinskyLESField< LatticeModel_T, Filter_T >::operator()( IBlock * co { const real_t wq = LatticeModel_T::w[ d.toIdx() ]; const real_t vel = real_c(d.cx()) * velocity[0] + real_c(d.cy()) * velocity[1] + real_c(d.cz()) * velocity[2]; - real_t feq = wq * rho * ( real_t(1) - real_t(1.5) * invPorosity * velocity.sqrLength() + - real_t(4.5) * invPorosity * vel * vel + real_t(3.0) * vel ); // modified feq + real_t feq = wq * rho * ( 1_r - 1.5_r * invPorosity * velocity.sqrLength() + + 4.5_r * invPorosity * vel * vel + 3.0_r * vel ); // modified feq feq -= wq; // walberla: center around 0 in incompressible case, attention if always needed! equilibrium[d.toIdx()] = feq; } @@ -163,21 +163,21 @@ void GNSSmagorinskyLESField< LatticeModel_T, Filter_T >::operator()( IBlock * co for( uint_t i = 0; i != Stencil_T::Size; ++i ) nonEquilibrium[i] = pdfField->get(x,y,z,i) - equilibrium[i]; - real_t filteredMeanMomentum = real_t(0); + real_t filteredMeanMomentum = 0_r; for( uint_t alpha = 0; alpha < 3; ++alpha ) { for( uint_t beta = 0; beta < 3; ++beta ) { - real_t qij = real_t(0); + real_t qij = 0_r; for( auto d = Stencil_T::begin(); d != Stencil_T::end(); ++d ) qij += nonEquilibrium[ d.toIdx() ] * real_c(stencil::c[alpha][*d]) * real_c(stencil::c[beta][*d]); filteredMeanMomentum += qij * qij; } } - const real_t tauTurbulent = LatticeModel_T::compressible ? ( real_t(0.5) * ( std::sqrt( tau0 * tau0 + (factor / rho) * std::sqrt( real_t(2) * filteredMeanMomentum ) ) - tau0 ) ) : - ( real_t(0.5) * ( std::sqrt( tau0 * tau0 + factor * std::sqrt( real_t(2) * filteredMeanMomentum ) ) - tau0 ) ); + const real_t tauTurbulent = LatticeModel_T::compressible ? ( 0.5_r * ( std::sqrt( tau0 * tau0 + (factor / rho) * std::sqrt( 2_r * filteredMeanMomentum ) ) - tau0 ) ) : + ( 0.5_r * ( std::sqrt( tau0 * tau0 + factor * std::sqrt( 2_r * filteredMeanMomentum ) ) - tau0 ) ); - omegaField->get(x,y,z) = real_t(1) / ( tau0 + tauTurbulent ); + omegaField->get(x,y,z) = 1_r / ( tau0 + tauTurbulent ); } ) } diff --git a/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSVelocityFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSVelocityFieldEvaluator.h index 157c812b..3415cc31 100644 --- a/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSVelocityFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/gns_lbm/utility/GNSVelocityFieldEvaluator.h @@ -68,7 +68,7 @@ public: WALBERLA_FOR_ALL_CELLS_XYZ( pdfField, if( boundaryHandling->isDomain(x,y,z) ) { - real_t fluidVolumeFraction = real_t(1) - svfField->get(x,y,z); + real_t fluidVolumeFraction = 1_r - svfField->get(x,y,z); Vector3<real_t> volumeAverageVelocity = pdfField->getVelocity(x,y,z); velocityField->get(x,y,z) = volumeAverageVelocity / fluidVolumeFraction; } diff --git a/src/pe_coupling/discrete_particle_methods/utility/AveragedInteractionForceFieldToForceFieldAdder.h b/src/pe_coupling/discrete_particle_methods/utility/AveragedInteractionForceFieldToForceFieldAdder.h index bffee157..f00b5990 100644 --- a/src/pe_coupling/discrete_particle_methods/utility/AveragedInteractionForceFieldToForceFieldAdder.h +++ b/src/pe_coupling/discrete_particle_methods/utility/AveragedInteractionForceFieldToForceFieldAdder.h @@ -61,7 +61,7 @@ public: { ++averagingCounter_; - const real_t averagingFactor = real_t(1)/real_c(averagingCounter_); + const real_t averagingFactor = 1_r/real_c(averagingCounter_); for( auto blockIt = blockStorage_->begin(); blockIt != blockStorage_->end(); ++blockIt ) diff --git a/src/pe_coupling/discrete_particle_methods/utility/BodyVelocityInitializer.h b/src/pe_coupling/discrete_particle_methods/utility/BodyVelocityInitializer.h index 9ffbad82..ec569915 100644 --- a/src/pe_coupling/discrete_particle_methods/utility/BodyVelocityInitializer.h +++ b/src/pe_coupling/discrete_particle_methods/utility/BodyVelocityInitializer.h @@ -84,12 +84,12 @@ public: { if(!dpmBodySelectorFct_(bodyIt.getBodyID())) continue; - Vector3<real_t> forceOnFluid( real_t(0) ); + Vector3<real_t> forceOnFluid( 0_r ); Vector3<real_t> bodyPosition = bodyIt->getPosition(); // interpolate fluid velocity to body position - Vector3<real_t> fluidVelocity( real_t(0) ); + Vector3<real_t> fluidVelocity( 0_r ); velocityInterpolator->get( bodyPosition, &fluidVelocity ); WALBERLA_ASSERT( !math::isnan(fluidVelocity[0]) && !math::isnan(fluidVelocity[1]) && !math::isnan(fluidVelocity[2]), diff --git a/src/pe_coupling/geometry/PeBodyOverlapFunctions.h b/src/pe_coupling/geometry/PeBodyOverlapFunctions.h index b0b0b3b2..348c47ec 100644 --- a/src/pe_coupling/geometry/PeBodyOverlapFunctions.h +++ b/src/pe_coupling/geometry/PeBodyOverlapFunctions.h @@ -46,7 +46,7 @@ template<> inline FastOverlapResult fastOverlapCheck( const pe::Sphere & peSpher else { Vector3<real_t> midPoint = peSphere.getPosition(); - const real_t oneOverSqrt3 = real_t(1) / std::sqrt( real_t(3) ); + const real_t oneOverSqrt3 = 1_r / std::sqrt( 3_r ); real_t halfBoxEdge = peSphere.getRadius() * oneOverSqrt3; AABB innerBox = AABB::createFromMinMaxCorner( midPoint[0] - halfBoxEdge, midPoint[1] - halfBoxEdge, midPoint[2] - halfBoxEdge, midPoint[0] + halfBoxEdge, midPoint[1] + halfBoxEdge, midPoint[2] + halfBoxEdge ); @@ -61,7 +61,7 @@ template<> inline FastOverlapResult fastOverlapCheck( const pe::Sphere & peSpher template<> inline FastOverlapResult fastOverlapCheck( const pe::Sphere & peSphere, const Vector3<real_t> & cellMidpoint, const Vector3<real_t> & dx ) { - const real_t sqrt3half = std::sqrt( real_t(3) ) / real_t(2); + const real_t sqrt3half = std::sqrt( 3_r ) / 2_r; const real_t midPointDistSq = (peSphere.getPosition() - cellMidpoint).sqrLength(); @@ -135,8 +135,8 @@ template<> inline FastOverlapResult fastOverlapCheck( const pe::Plane & pePlane, template<> inline FastOverlapResult fastOverlapCheck( const pe::Plane & pePlane, const Vector3<real_t> & cellMidpoint, const Vector3<real_t> & dx ) { - AABB box = AABB::createFromMinMaxCorner( cellMidpoint[0] - real_t(0.5)*dx[0], cellMidpoint[1] - real_t(0.5)*dx[1], cellMidpoint[2] - real_t(0.5)*dx[2], - cellMidpoint[0] + real_t(0.5)*dx[0], cellMidpoint[1] + real_t(0.5)*dx[1], cellMidpoint[2] + real_t(0.5)*dx[2]); + AABB box = AABB::createFromMinMaxCorner( cellMidpoint[0] - 0.5_r*dx[0], cellMidpoint[1] - 0.5_r*dx[1], cellMidpoint[2] - 0.5_r*dx[2], + cellMidpoint[0] + 0.5_r*dx[0], cellMidpoint[1] + 0.5_r*dx[1], cellMidpoint[2] + 0.5_r*dx[2]); return fastOverlapCheck(pePlane, box); } @@ -164,8 +164,8 @@ template<> inline FastOverlapResult fastOverlapCheck( const pe::RigidBody & peBo template<> inline FastOverlapResult fastOverlapCheck( const pe::RigidBody & peBody, const Vector3<real_t> & cellMidpoint, const Vector3<real_t> & dx ) { - AABB box = AABB::createFromMinMaxCorner( cellMidpoint[0] - real_t(0.5)*dx[0], cellMidpoint[1] - real_t(0.5)*dx[1], cellMidpoint[2] - real_t(0.5)*dx[2], - cellMidpoint[0] + real_t(0.5)*dx[0], cellMidpoint[1] + real_t(0.5)*dx[1], cellMidpoint[2] + real_t(0.5)*dx[2]); + AABB box = AABB::createFromMinMaxCorner( cellMidpoint[0] - 0.5_r*dx[0], cellMidpoint[1] - 0.5_r*dx[1], cellMidpoint[2] - 0.5_r*dx[2], + cellMidpoint[0] + 0.5_r*dx[0], cellMidpoint[1] + 0.5_r*dx[1], cellMidpoint[2] + 0.5_r*dx[2]); if ( ! peBody.getAABB().intersects( box ) ) { diff --git a/src/pe_coupling/geometry/PeIntersectionRatio.cpp b/src/pe_coupling/geometry/PeIntersectionRatio.cpp index 8d9fde47..c5885581 100644 --- a/src/pe_coupling/geometry/PeIntersectionRatio.cpp +++ b/src/pe_coupling/geometry/PeIntersectionRatio.cpp @@ -69,7 +69,7 @@ real_t intersectionRatioPlanePe( const pe::Plane & plane, auto diff = planeCenter - fluidPoint; - WALBERLA_ASSERT_FLOAT_UNEQUAL(denom, real_t(0)); + WALBERLA_ASSERT_FLOAT_UNEQUAL(denom, 0_r); real_t delta = diff * planeNormal / denom; @@ -92,22 +92,22 @@ real_t intersectionRatioEllipsoidPe( const pe::Ellipsoid & ellipsoid, Vector3<real_t> semiAxes = ellipsoid.getSemiAxes(); - Matrix3<real_t> M = Matrix3<real_t>::makeDiagonalMatrix(real_t(1)/semiAxes[0], real_t(1)/semiAxes[1], real_t(1)/semiAxes[2]); + Matrix3<real_t> M = Matrix3<real_t>::makeDiagonalMatrix(1_r/semiAxes[0], 1_r/semiAxes[1], 1_r/semiAxes[2]); Vector3<real_t> P_M = M*transformedP; Vector3<real_t> d_M = M*transformedDir; const real_t a = d_M*d_M; - const real_t b = real_t(2)*P_M*d_M; - const real_t c = P_M*P_M - real_t(1); + const real_t b = 2_r*P_M*d_M; + const real_t c = P_M*P_M - 1_r; - const real_t discriminant = b*b - real_t(4)*a*c; + const real_t discriminant = b*b - 4_r*a*c; - WALBERLA_ASSERT_GREATER_EQUAL(discriminant, real_t(0), "No intersection possible!"); - WALBERLA_ASSERT_FLOAT_UNEQUAL(a, real_t(0)); + WALBERLA_ASSERT_GREATER_EQUAL(discriminant, 0_r, "No intersection possible!"); + WALBERLA_ASSERT_FLOAT_UNEQUAL(a, 0_r); const real_t root = std::sqrt(discriminant); - real_t delta = (-b - root) / (real_t(2) * a); + real_t delta = (-b - root) / (2_r * a); WALBERLA_ASSERT_GREATER_EQUAL( delta, real_t( 0 ) ); WALBERLA_ASSERT_LESS_EQUAL( delta, real_t( 1 ) ); diff --git a/src/pe_coupling/geometry/PeIntersectionRatio.h b/src/pe_coupling/geometry/PeIntersectionRatio.h index 0697fc94..f41e29a6 100644 --- a/src/pe_coupling/geometry/PeIntersectionRatio.h +++ b/src/pe_coupling/geometry/PeIntersectionRatio.h @@ -64,7 +64,7 @@ inline real_t intersectionRatio( const pe::RigidBody & peRigidBody, { const pe::Plane & plane = static_cast< const pe::Plane & >( peRigidBody ); const real_t ratio = intersectionRatioPlanePe( plane, fluidPoint, direction ); - WALBERLA_ASSERT_FLOAT_EQUAL( ( fluidPoint + ratio * direction - plane.getPosition() ) * plane.getNormal(), real_t(0) ); + WALBERLA_ASSERT_FLOAT_EQUAL( ( fluidPoint + ratio * direction - plane.getPosition() ) * plane.getNormal(), 0_r ); return ratio; } else if ( peRigidBody.getTypeID() == pe::Ellipsoid::getStaticTypeID() ) diff --git a/src/pe_coupling/geometry/SphereEquivalentDiameter.h b/src/pe_coupling/geometry/SphereEquivalentDiameter.h index d3750379..9740dd89 100644 --- a/src/pe_coupling/geometry/SphereEquivalentDiameter.h +++ b/src/pe_coupling/geometry/SphereEquivalentDiameter.h @@ -37,9 +37,9 @@ real_t getSphereEquivalentDiameter( pe::RigidBody & body ) { pe::Sphere & sphere = static_cast<pe::Sphere &>( body ); real_t radius = sphere.getRadius(); - return real_t(2) * radius; + return 2_r * radius; } else { - const real_t preFac = real_t(6) / math::M_PI; + const real_t preFac = 6_r / math::M_PI; return std::cbrt( body.getVolume() * preFac ); } } diff --git a/src/pe_coupling/momentum_exchange_method/boundary/CurvedLinear.h b/src/pe_coupling/momentum_exchange_method/boundary/CurvedLinear.h index 05fee404..0f422486 100644 --- a/src/pe_coupling/momentum_exchange_method/boundary/CurvedLinear.h +++ b/src/pe_coupling/momentum_exchange_method/boundary/CurvedLinear.h @@ -174,11 +174,11 @@ inline void CurvedLinear< LatticeModel_T, FlagField_T >::treatDirection( const c // depending on the implementation for the specific body, either an analytical formula (e.g. for the sphere) or a line search algorithm is used real_t delta = lbm::intersectionRatio( body, cellCenter, direction, tolerance ); - WALBERLA_ASSERT_LESS_EQUAL( delta, real_t(1)); - WALBERLA_ASSERT_GREATER_EQUAL( delta, real_t(0)); + WALBERLA_ASSERT_LESS_EQUAL( delta, 1_r); + WALBERLA_ASSERT_GREATER_EQUAL( delta, 0_r); - real_t pdf_new = real_t(0); - real_t alpha = real_t(0); + real_t pdf_new = 0_r; + real_t alpha = 0_r; // get the cell indices of the cell further away from the obstacle const cell_idx_t xff = x - cell_idx_c( stencil::cx[ dir ] ); diff --git a/src/pe_coupling/momentum_exchange_method/boundary/CurvedQuadratic.h b/src/pe_coupling/momentum_exchange_method/boundary/CurvedQuadratic.h index ea6fe8b6..74563144 100644 --- a/src/pe_coupling/momentum_exchange_method/boundary/CurvedQuadratic.h +++ b/src/pe_coupling/momentum_exchange_method/boundary/CurvedQuadratic.h @@ -190,8 +190,8 @@ inline void CurvedQuadratic< LatticeModel_T, FlagField_T >::treatDirection( cons // depending on the implementation for the specific body, either an analytical formula (e.g. for the sphere) or a line search algorithm is used const real_t delta = lbm::intersectionRatio( body, cellCenter, direction, tolerance ); - WALBERLA_ASSERT_LESS_EQUAL( delta, real_t(1)); - WALBERLA_ASSERT_GREATER_EQUAL( delta, real_t(0)); + WALBERLA_ASSERT_LESS_EQUAL( delta, 1_r); + WALBERLA_ASSERT_GREATER_EQUAL( delta, 0_r); bool useMR1full = false; diff --git a/src/pe_coupling/momentum_exchange_method/restoration/ExtrapolationDirectionFinder.h b/src/pe_coupling/momentum_exchange_method/restoration/ExtrapolationDirectionFinder.h index 7e9968d8..a2300201 100644 --- a/src/pe_coupling/momentum_exchange_method/restoration/ExtrapolationDirectionFinder.h +++ b/src/pe_coupling/momentum_exchange_method/restoration/ExtrapolationDirectionFinder.h @@ -61,7 +61,7 @@ template < typename Stencil_T > void findCorrespondingLatticeDirection( const Vector3<real_t> & direction, Vector3<cell_idx_t> & correspondingLatticeDirection ) { stencil::Direction correspondingDirection = stencil::C; - real_t innerProduct = real_t(0); + real_t innerProduct = 0_r; for( auto d = Stencil_T::beginNoCenter(); d != Stencil_T::end(); ++d ) { // compute inner product <dir,c_i> diff --git a/src/pe_coupling/momentum_exchange_method/restoration/Reconstructor.h b/src/pe_coupling/momentum_exchange_method/restoration/Reconstructor.h index b8fb7aff..91248f93 100644 --- a/src/pe_coupling/momentum_exchange_method/restoration/Reconstructor.h +++ b/src/pe_coupling/momentum_exchange_method/restoration/Reconstructor.h @@ -142,7 +142,7 @@ real_t EquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T > CellInterval localDomain = pdfField->xyzSize(); uint_t nAverage = uint_t(0); - real_t averageDensity = real_t(0); + real_t averageDensity = 0_r; for( auto neighborDir = stencil::D3Q27::beginNoCenter(); neighborDir != stencil::D3Q27::end(); ++neighborDir ) { Cell neighbor( x + neighborDir.cx(), y + neighborDir.cy(), z + neighborDir.cz() ); @@ -160,7 +160,7 @@ real_t EquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T > } } - return ( nAverage > uint_t( 0 ) ) ? averageDensity / real_c( nAverage ) : real_t(1.0); + return ( nAverage > uint_t( 0 ) ) ? averageDensity / real_c( nAverage ) : 1.0_r; } @@ -382,15 +382,15 @@ void ExtrapolationReconstructor< LatticeModel_T, BoundaryHandling_T, Extrapolati // quadratic normal extrapolation for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { - pdfField->get( x, y, z, d.toIdx() ) = real_t(3) * pdfField->get( x + extrapolationDirection[0], y + extrapolationDirection[1], z + extrapolationDirection[2], d.toIdx() ) - - real_t(3) * pdfField->get( x + 2*extrapolationDirection[0], y + 2*extrapolationDirection[1], z + 2*extrapolationDirection[2], d.toIdx() ) + pdfField->get( x, y, z, d.toIdx() ) = 3_r * pdfField->get( x + extrapolationDirection[0], y + extrapolationDirection[1], z + extrapolationDirection[2], d.toIdx() ) + - 3_r * pdfField->get( x + 2*extrapolationDirection[0], y + 2*extrapolationDirection[1], z + 2*extrapolationDirection[2], d.toIdx() ) + pdfField->get( x + 3*extrapolationDirection[0], y + 3*extrapolationDirection[1], z + 3*extrapolationDirection[2], d.toIdx() ); } } else { // numberOfCellsForExtrapolation == 2 // linear normal extrapolation for( auto d = LatticeModel_T::Stencil::begin(); d != LatticeModel_T::Stencil::end(); ++d ) { - pdfField->get( x, y, z, d.toIdx() ) = real_t(2) * pdfField->get( x + extrapolationDirection[0], y + extrapolationDirection[1], z + extrapolationDirection[2], d.toIdx() ) + pdfField->get( x, y, z, d.toIdx() ) = 2_r * pdfField->get( x + extrapolationDirection[0], y + extrapolationDirection[1], z + extrapolationDirection[2], d.toIdx() ) - pdfField->get( x + 2*extrapolationDirection[0], y + 2*extrapolationDirection[1], z + 2*extrapolationDirection[2], d.toIdx() ); } } @@ -419,18 +419,18 @@ void ExtrapolationReconstructor< LatticeModel_T, BoundaryHandling_T, Extrapolati WALBERLA_ASSERT( !math::isnan(bodyVelocity) ); // transforms to moment space (see MRT collision model) to set the body's velocity in cell without affecting other moments - const real_t _1_2 = real_t(1) / real_t(2); - const real_t _1_3 = real_t(1) / real_t(3); - const real_t _1_4 = real_t(1) / real_t(4); - const real_t _1_6 = real_t(1) / real_t(6); - const real_t _1_8 = real_t(1) / real_t(8); - const real_t _1_12 = real_t(1) / real_t(12); - const real_t _1_16 = real_t(1) / real_t(16); - const real_t _1_18 = real_t(1) / real_t(18); - const real_t _1_24 = real_t(1) / real_t(24); - const real_t _1_36 = real_t(1) / real_t(36); - const real_t _1_48 = real_t(1) / real_t(48); - const real_t _1_72 = real_t(1) / real_t(72); + const real_t _1_2 = 1_r / 2_r; + const real_t _1_3 = 1_r / 3_r; + const real_t _1_4 = 1_r / 4_r; + const real_t _1_6 = 1_r / 6_r; + const real_t _1_8 = 1_r / 8_r; + const real_t _1_12 = 1_r / 12_r; + const real_t _1_16 = 1_r / 16_r; + const real_t _1_18 = 1_r / 18_r; + const real_t _1_24 = 1_r / 24_r; + const real_t _1_36 = 1_r / 36_r; + const real_t _1_48 = 1_r / 48_r; + const real_t _1_72 = 1_r / 72_r; // restriction to D3Q19! const real_t vC = pdfField->get( x, y, z, LatticeModel_T::Stencil::idx[stencil::C] ); @@ -456,17 +456,17 @@ void ExtrapolationReconstructor< LatticeModel_T, BoundaryHandling_T, Extrapolati // transform to moment space and change momentum to body's velocity ( * rho_0 ) const real_t m0 = vC + vN + vS + vW + vE + vT + vB + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE; const real_t m1 = -vC + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE; - const real_t m2 = vC - real_t(2) * ( vN + vS + vW + vE + vT + vB ) + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE; + const real_t m2 = vC - 2_r * ( vN + vS + vW + vE + vT + vB ) + vNW + vNE + vSW + vSE + vTN + vTS + vTW + vTE + vBN + vBS + vBW + vBE; const real_t m3 = bodyVelocity[0]; - const real_t m4 = real_t(2) * vW - real_t(2) * vE - vNW + vNE - vSW + vSE - vTW + vTE - vBW + vBE; + const real_t m4 = 2_r * vW - 2_r * vE - vNW + vNE - vSW + vSE - vTW + vTE - vBW + vBE; const real_t m5 = bodyVelocity[1]; - const real_t m6 = real_t(-2) * vN + real_t(2) * vS + vNW + vNE - vSW - vSE + vTN - vTS + vBN - vBS; + const real_t m6 = -2_r * vN + 2_r * vS + vNW + vNE - vSW - vSE + vTN - vTS + vBN - vBS; const real_t m7 = bodyVelocity[2]; - const real_t m8 = real_t(-2) * vT + real_t(2) * vB + vTN + vTS + vTW + vTE - vBN - vBS - vBW - vBE; - const real_t m9 = -vN - vS + real_t(2) * vW + real_t(2) * vE - vT - vB + vNW + vNE + vSW + vSE - real_t(2) * vTN - - real_t(2) * vTS + vTW + vTE - real_t(2) * vBN - real_t(2) * vBS + vBW + vBE; - const real_t m10 = vN + vS - real_t(2) * vW - real_t(2) * vE + vT + vB + vNW + vNE + vSW + vSE - real_t(2) * vTN - - real_t(2) * vTS + vTW + vTE - real_t(2) * vBN - real_t(2) * vBS + vBW + vBE; + const real_t m8 = -2_r * vT + 2_r * vB + vTN + vTS + vTW + vTE - vBN - vBS - vBW - vBE; + const real_t m9 = -vN - vS + 2_r * vW + 2_r * vE - vT - vB + vNW + vNE + vSW + vSE - 2_r * vTN + - 2_r * vTS + vTW + vTE - 2_r * vBN - 2_r * vBS + vBW + vBE; + const real_t m10 = vN + vS - 2_r * vW - 2_r * vE + vT + vB + vNW + vNE + vSW + vSE - 2_r * vTN + - 2_r * vTS + vTW + vTE - 2_r * vBN - 2_r * vBS + vBW + vBE; const real_t m11 = vN + vS - vT - vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE; const real_t m12 = -vN - vS + vT + vB + vNW + vNE + vSW + vSE - vTW - vTE - vBW - vBE; const real_t m13 = -vNW + vNE + vSW - vSE; diff --git a/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.cpp b/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.cpp index d0d36a92..5eead872 100644 --- a/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.cpp +++ b/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.cpp @@ -58,7 +58,7 @@ void mapPSMBodyAndVolumeFraction( const pe::BodyID body, IBlock & block, Structu const real_t fraction = overlapFractionPe( *body, cellCenter, dxVec ); // if the cell intersected with the body, store a pointer to that body and the corresponding volume fraction in the field - if( fraction > real_t(0) ) + if( fraction > 0_r ) { bodyAndVolumeFractionField->get(cell).emplace_back( body, fraction ); } @@ -156,7 +156,7 @@ void BodyAndVolumeFractionMapping::updatePSMBodyAndVolumeFraction( pe::BodyID bo WALBERLA_ASSERT_NOT_NULLPTR( oldBodyAndVolumeFractionField ); // estimate traveled distance since last volume fraction update - real_t traveledSquaredDistance( real_t(0) ); + real_t traveledSquaredDistance( 0_r ); auto mapBodyIt = lastUpdatedPositionMap_.find( body->getSystemID() ); if( mapBodyIt != lastUpdatedPositionMap_.end() ) { @@ -217,7 +217,7 @@ void BodyAndVolumeFractionMapping::updatePSMBodyAndVolumeFraction( pe::BodyID bo const real_t fraction = overlapFractionPe( *body, cellCenter, dxVec, superSamplingDepth_ ); // if the cell intersected with the body, store a pointer to that body and the corresponding volume fraction in the field - if( fraction > real_t(0) ) + if( fraction > 0_r ) { updatedBodyAndVolumeFractionField_->get(x,y,z).emplace_back( body, fraction ); } diff --git a/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.h b/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.h index 59fb8559..dedc7fd5 100644 --- a/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.h +++ b/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.h @@ -74,8 +74,8 @@ public: const BlockDataID & bodyStorageID, const BlockDataID & bodyAndVolumeFractionFieldID, const std::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectRegularBodies, - const real_t velocityUpdatingEpsilon = real_t(0), - const real_t positionUpdatingEpsilon = real_t(0), + const real_t velocityUpdatingEpsilon = 0_r, + const real_t positionUpdatingEpsilon = 0_r, const uint_t superSamplingDepth = uint_t(4) ) : blockStorage_( blockStorage), globalBodyStorage_( globalBodyStorage ), bodyStorageID_( bodyStorageID ), bodyAndVolumeFractionFieldID_( bodyAndVolumeFractionFieldID ), mappingBodySelectorFct_( mappingBodySelectorFct ), diff --git a/src/pe_coupling/partially_saturated_cells_method/PSMSweep.h b/src/pe_coupling/partially_saturated_cells_method/PSMSweep.h index 78676106..d33d5f69 100644 --- a/src/pe_coupling/partially_saturated_cells_method/PSMSweep.h +++ b/src/pe_coupling/partially_saturated_cells_method/PSMSweep.h @@ -193,11 +193,11 @@ void PSMSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut if( bodyAndVolumeFractionField->get(x,y,z).size() != size_t(0) ) { // total coverage ratio in the cell - real_t Bn = real_t(0); + real_t Bn = 0_r; // averaged solid collision operator for all intersecting bodies s // = \sum_s B_s * \Omega_s_i - std::vector< real_t > omega_n( Stencil_T::Size, real_t(0) ); + std::vector< real_t > omega_n( Stencil_T::Size, 0_r ); // get center of cell Vector3<real_t> cellCenter = blockStorage_->getBlockLocalCellCenter( *block, Cell(x,y,z)); @@ -346,11 +346,11 @@ void PSMSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut if( bodyAndVolumeFractionField->get(x,y,z).size() != size_t(0) ) { // total coverage ratio in the cell - real_t Bn = real_t(0); + real_t Bn = 0_r; // averaged solid collision operator for all intersecting bodies s // = \sum_s B_s * \Omega_s_i - std::vector< real_t > omega_n( Stencil_T::Size, real_t(0) ); + std::vector< real_t > omega_n( Stencil_T::Size, 0_r ); // get center of cell Vector3<real_t> cellCenter = blockStorage_->getBlockLocalCellCenter( *block, Cell(x,y,z)); diff --git a/src/pe_coupling/partially_saturated_cells_method/PSMUtility.h b/src/pe_coupling/partially_saturated_cells_method/PSMUtility.h index e39c3b7b..105152d6 100644 --- a/src/pe_coupling/partially_saturated_cells_method/PSMUtility.h +++ b/src/pe_coupling/partially_saturated_cells_method/PSMUtility.h @@ -55,8 +55,8 @@ Vector3<real_t> getPSMMacroscopicVelocity( const IBlock & block, const real_t ralaxationTime = real_c(1) / pdfField->latticeModel().collisionModel().omega( cell.x(), cell.y(), cell.z() ); - Vector3<real_t> velocity( real_t(0) ); - real_t totalSolidWeightingInCell = real_t(0); + Vector3<real_t> velocity( 0_r ); + real_t totalSolidWeightingInCell = 0_r; for( auto bodyFracIt = bodyAndVolumeFractionField->get( cell ).begin(); bodyFracIt != bodyAndVolumeFractionField->get( cell ).end(); ++bodyFracIt ) { @@ -110,8 +110,8 @@ void initializeDomainForPSM( StructuredBlockStorage & blockStorage, const real_t ralaxationTime = real_c(1) / pdfField->latticeModel().collisionModel().omega( cell.x(), cell.y(), cell.z() ); - Vector3<real_t> weightedAverageBodyVelocityInCell( real_t(0) ); - real_t totalSolidWeightingInCell = real_t(0); + Vector3<real_t> weightedAverageBodyVelocityInCell( 0_r ); + real_t totalSolidWeightingInCell = 0_r; for( auto bodyFracIt = bodyAndVolumeFractionField->get(cell).begin(); bodyFracIt != bodyAndVolumeFractionField->get(cell).end(); ++bodyFracIt ) { @@ -126,9 +126,9 @@ void initializeDomainForPSM( StructuredBlockStorage & blockStorage, totalSolidWeightingInCell += Bs; } - if( totalSolidWeightingInCell > real_t(0) ) + if( totalSolidWeightingInCell > 0_r ) { - Vector3< real_t > fluidVelocityInCell( real_t(0) ); + Vector3< real_t > fluidVelocityInCell( 0_r ); const real_t rho = pdfField->getDensityAndVelocity( fluidVelocityInCell, cell ); // set the PDFs to equilibrium with the density rho and the average velocity of all intersecting bodies diff --git a/src/pe_coupling/utility/ForceTorqueOnBodiesScaler.cpp b/src/pe_coupling/utility/ForceTorqueOnBodiesScaler.cpp index 677c5788..f605c2cd 100644 --- a/src/pe_coupling/utility/ForceTorqueOnBodiesScaler.cpp +++ b/src/pe_coupling/utility/ForceTorqueOnBodiesScaler.cpp @@ -29,8 +29,8 @@ namespace pe_coupling { void ForceTorqueOnBodiesScaler::operator()() { - Vector3<real_t> force(real_t(0)); - Vector3<real_t> torque(real_t(0)); + Vector3<real_t> force(0_r); + Vector3<real_t> torque(0_r); for( auto blockIt = blockStorage_->begin(); blockIt != blockStorage_->end(); ++blockIt ) { for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt ) diff --git a/src/pe_coupling/utility/LubricationCorrection.cpp b/src/pe_coupling/utility/LubricationCorrection.cpp index eaf19521..49aa9bd8 100644 --- a/src/pe_coupling/utility/LubricationCorrection.cpp +++ b/src/pe_coupling/utility/LubricationCorrection.cpp @@ -101,7 +101,7 @@ void LubricationCorrection::treatLubricationSphrSphr( const pe::SphereID sphereI real_t gap = pe::getSurfaceDistance( sphereI, sphereJ ); - if ( gap > cutOffDistance_ || gap < real_t(0) ) + if ( gap > cutOffDistance_ || gap < 0_r ) { WALBERLA_LOG_DETAIL("gap " << gap << " larger than cutOff " << cutOffDistance_ << " - ignoring pair"); return; @@ -139,7 +139,7 @@ void LubricationCorrection::treatLubricationSphrPlane( const pe::SphereID sphere real_t gap = pe::getSurfaceDistance( sphereI, planeJ ); - if ( gap > cutOffDistance_ || gap < real_t(0) ) + if ( gap > cutOffDistance_ || gap < 0_r ) { WALBERLA_LOG_DETAIL("gap " << gap << " larger than cutOff " << cutOffDistance_ << " - ignoring pair"); return; @@ -189,7 +189,7 @@ pe::Vec3 LubricationCorrection::compLubricationSphrSphr( real_t gap, const pe::S real_t radiiSQR = ( radiusSphereI * radiusSphereJ ) * ( radiusSphereI * radiusSphereJ ); real_t radiiSumSQR = ( radiusSphereI + radiusSphereJ ) * ( radiusSphereI + radiusSphereJ ); - pe::Vec3 fLub = ( -real_t(6) * dynamicViscosity_ * walberla::math::PI * radiiSQR / radiiSumSQR * ( real_t(1) / gap - real_t(1) / cutOffDistance_) * length * rIJ); + pe::Vec3 fLub = ( -6_r * dynamicViscosity_ * walberla::math::PI * radiiSQR / radiiSumSQR * ( 1_r / gap - 1_r / cutOffDistance_) * length * rIJ); WALBERLA_LOG_DETAIL_SECTION() { @@ -247,7 +247,7 @@ pe::Vec3 LubricationCorrection::compLubricationSphrPlane( real_t gap, const pe:: real_t radiiSQR = radiusSphereI * radiusSphereI; - pe::Vec3 fLub( -real_t(6) * dynamicViscosity_ * walberla::math::PI * radiiSQR * (real_t(1) / gap - real_t(1) / cutOffDistance_) * length * rIJ); + pe::Vec3 fLub( -6_r * dynamicViscosity_ * walberla::math::PI * radiiSQR * (1_r / gap - 1_r / cutOffDistance_) * length * rIJ); WALBERLA_LOG_DETAIL_SECTION() { std::stringstream ss; diff --git a/src/pe_coupling/utility/LubricationCorrection.h b/src/pe_coupling/utility/LubricationCorrection.h index b4f34181..e238c398 100644 --- a/src/pe_coupling/utility/LubricationCorrection.h +++ b/src/pe_coupling/utility/LubricationCorrection.h @@ -40,7 +40,7 @@ public: // constructor LubricationCorrection ( const shared_ptr<StructuredBlockStorage> & blockStorage, const shared_ptr<pe::BodyStorage> & globalBodyStorage, const BlockDataID & bodyStorageID, real_t dynamicViscosity, - real_t cutOffDistance = real_t(2) / real_t(3), real_t minimalGapSize = real_t(1e-5) ) + real_t cutOffDistance = 2_r / 3_r, real_t minimalGapSize = 1e-5_r ) : blockStorage_ ( blockStorage ) , globalBodyStorage_( globalBodyStorage ) , bodyStorageID_( bodyStorageID ) diff --git a/src/pe_coupling/utility/TimeStep.h b/src/pe_coupling/utility/TimeStep.h index 283282b6..c1d376fe 100644 --- a/src/pe_coupling/utility/TimeStep.h +++ b/src/pe_coupling/utility/TimeStep.h @@ -52,7 +52,7 @@ public: const BlockDataID & bodyStorageID, pe::cr::ICR & collisionResponse, const std::function<void (void)> & synchronizeFunc, - const real_t timeStepSize = real_t(1), + const real_t timeStepSize = 1_r, const uint_t numberOfSubIterations = uint_t(1), const std::function<void (void)> & forceEvaluationFunc = [](){}) : timeStepSize_( timeStepSize ) diff --git a/src/postprocessing/MarchingCubes.h b/src/postprocessing/MarchingCubes.h index c4ffeaac..c00f4b7a 100644 --- a/src/postprocessing/MarchingCubes.h +++ b/src/postprocessing/MarchingCubes.h @@ -57,9 +57,9 @@ namespace walberla { void generateIsoSurface( const Field_T & field, real_t threshold, geometry::TriangleMesh & mesh, - const Vector3<real_t> & dx = Vector3<real_t>( real_t(1) ), + const Vector3<real_t> & dx = Vector3<real_t>( 1_r ), uint_t fCoord = uint_t(0), - const Vector3<real_t> & offset = Vector3<real_t>( real_t(0) ), + const Vector3<real_t> & offset = Vector3<real_t>( 0_r ), const CellInterval & cellInterval = CellInterval(), bool calcNormals = true ); diff --git a/src/postprocessing/MarchingCubes.impl.h b/src/postprocessing/MarchingCubes.impl.h index 6f4e5ae7..f0a72125 100644 --- a/src/postprocessing/MarchingCubes.impl.h +++ b/src/postprocessing/MarchingCubes.impl.h @@ -38,7 +38,7 @@ using geometry::TriangleMesh; template<typename Field_T> static inline Vector3<real_t> calcNormal(const Field_T & f, cell_idx_t i, cell_idx_t j, cell_idx_t k, uint_t fCoord ) { - Vector3<real_t> ret( real_t(0) ); + Vector3<real_t> ret( 0_r ); if ( f.nrOfGhostLayers() >= 2 ) { @@ -399,7 +399,7 @@ void generateIsoSurface_internal( const Field_T & f, real_t threshold, for( auto i = f.beginSliceXYZ(targetInterval); i != f.end(); ++i ) { - const RealVec3 offset (- real_t(0.5)*dx[0],-real_t(0.5)*dx[1],-real_t(0.5)*dx[2]); + const RealVec3 offset (- 0.5_r*dx[0],-0.5_r*dx[1],-0.5_r*dx[2]); RealVec3 curPos = offset + i.x() * ex + i.y() * ey + i.z() * ez; real_t value [8]; @@ -479,7 +479,7 @@ void generateIsoSurface_internal( const Field_T & f, real_t threshold, { TriangleMesh::normal_t normal = calcNormal(f, i.x() + cubieOffsetX[e1], i.y() + cubieOffsetY[e1], - i.z() + cubieOffsetZ[e1], fCoord ) * (real_t(1) - mu) + i.z() + cubieOffsetZ[e1], fCoord ) * (1_r - mu) + calcNormal(f, i.x() + cubieOffsetX[e2], i.y() + cubieOffsetY[e2], i.z() + cubieOffsetZ[e2], fCoord) * (mu); diff --git a/src/stencil/Directions.h b/src/stencil/Directions.h index 4d42e24c..75801b2b 100644 --- a/src/stencil/Directions.h +++ b/src/stencil/Directions.h @@ -139,27 +139,27 @@ namespace stencil { /// The x,y,z component for each normalized direction \ingroup stencil const real_t cNorm[3][NR_OF_DIRECTIONS] = { { - real_t(0), real_t(0), real_t(0), real_t(-1), real_t(1), real_t(0), real_t(0), real_t(-1) / std::sqrt( real_t(2) ), - real_t(1) / std::sqrt( real_t(2) ), real_t(-1) / std::sqrt( real_t(2) ), real_t(1) / std::sqrt( real_t(2) ), real_t(0), real_t(0), - real_t(-1) / std::sqrt( real_t(2) ), real_t(1) / std::sqrt( real_t(2) ), real_t(0), real_t(0), real_t(-1) / std::sqrt( real_t(2) ), - real_t(1) / std::sqrt( real_t(2) ), real_t(1) / std::sqrt( real_t(3) ), real_t(-1) / std::sqrt( real_t(3) ), - real_t(1) / std::sqrt( real_t(3) ), real_t(-1) / std::sqrt( real_t(3) ), real_t(1) / std::sqrt( real_t(3) ), - real_t(-1) / std::sqrt( real_t(3) ), real_t(1) / std::sqrt( real_t(3) ), real_t(-1) / std::sqrt( real_t(3) ) + 0_r, 0_r, 0_r, -1_r, 1_r, 0_r, 0_r, -1_r / std::sqrt( 2_r ), + 1_r / std::sqrt( 2_r ), -1_r / std::sqrt( 2_r ), 1_r / std::sqrt( 2_r ), 0_r, 0_r, + -1_r / std::sqrt( 2_r ), 1_r / std::sqrt( 2_r ), 0_r, 0_r, -1_r / std::sqrt( 2_r ), + 1_r / std::sqrt( 2_r ), 1_r / std::sqrt( 3_r ), -1_r / std::sqrt( 3_r ), + 1_r / std::sqrt( 3_r ), -1_r / std::sqrt( 3_r ), 1_r / std::sqrt( 3_r ), + -1_r / std::sqrt( 3_r ), 1_r / std::sqrt( 3_r ), -1_r / std::sqrt( 3_r ) }, { - real_t(0), real_t(1), real_t(-1), real_t(0), real_t(0), real_t(0), real_t(0), real_t(1) / std::sqrt( real_t(2) ), - real_t(1) / std::sqrt( real_t(2) ), real_t(-1) / std::sqrt( real_t(2) ), real_t(-1) / std::sqrt( real_t(2) ), - real_t(1) / std::sqrt( real_t(2) ), real_t(-1) / std::sqrt( real_t(2) ), real_t(0), real_t(0), real_t(1) / std::sqrt( real_t(2) ), - real_t(-1) / std::sqrt( real_t(2) ), real_t(0), real_t(0), real_t(1) / std::sqrt( real_t(3) ), real_t(1) / std::sqrt( real_t(3) ), - real_t(-1) / std::sqrt( real_t(3) ), real_t(-1) / std::sqrt( real_t(3) ), real_t(1) / std::sqrt( real_t(3) ), - real_t(1) / std::sqrt( real_t(3) ), real_t(-1) / std::sqrt( real_t(3) ), real_t(-1) / std::sqrt( real_t(3) ) + 0_r, 1_r, -1_r, 0_r, 0_r, 0_r, 0_r, 1_r / std::sqrt( 2_r ), + 1_r / std::sqrt( 2_r ), -1_r / std::sqrt( 2_r ), -1_r / std::sqrt( 2_r ), + 1_r / std::sqrt( 2_r ), -1_r / std::sqrt( 2_r ), 0_r, 0_r, 1_r / std::sqrt( 2_r ), + -1_r / std::sqrt( 2_r ), 0_r, 0_r, 1_r / std::sqrt( 3_r ), 1_r / std::sqrt( 3_r ), + -1_r / std::sqrt( 3_r ), -1_r / std::sqrt( 3_r ), 1_r / std::sqrt( 3_r ), + 1_r / std::sqrt( 3_r ), -1_r / std::sqrt( 3_r ), -1_r / std::sqrt( 3_r ) }, { - real_t(0), real_t(0), real_t(0), real_t(0), real_t(0), real_t(1), real_t(-1), real_t(0), real_t(0), real_t(0), real_t(0), - real_t(1) / std::sqrt( real_t(2) ), real_t(1) / std::sqrt( real_t(2) ), real_t(1) / std::sqrt( real_t(2) ), - real_t(1) / std::sqrt( real_t(2) ), real_t(-1) / std::sqrt( real_t(2) ), real_t(-1) / std::sqrt( real_t(2) ), - real_t(-1) / std::sqrt( real_t(2) ), real_t(-1) / std::sqrt( real_t(2) ), real_t(1) / std::sqrt( real_t(3) ), - real_t(1) / std::sqrt( real_t(3) ), real_t(1) / std::sqrt( real_t(3) ), real_t(1) / std::sqrt( real_t(3) ), - real_t(-1) / std::sqrt( real_t(3) ), real_t(-1) / std::sqrt( real_t(3) ), real_t(-1) / std::sqrt( real_t(3) ), - real_t(-1) / std::sqrt( real_t(3) ) + 0_r, 0_r, 0_r, 0_r, 0_r, 1_r, -1_r, 0_r, 0_r, 0_r, 0_r, + 1_r / std::sqrt( 2_r ), 1_r / std::sqrt( 2_r ), 1_r / std::sqrt( 2_r ), + 1_r / std::sqrt( 2_r ), -1_r / std::sqrt( 2_r ), -1_r / std::sqrt( 2_r ), + -1_r / std::sqrt( 2_r ), -1_r / std::sqrt( 2_r ), 1_r / std::sqrt( 3_r ), + 1_r / std::sqrt( 3_r ), 1_r / std::sqrt( 3_r ), 1_r / std::sqrt( 3_r ), + -1_r / std::sqrt( 3_r ), -1_r / std::sqrt( 3_r ), -1_r / std::sqrt( 3_r ), + -1_r / std::sqrt( 3_r ) } }; @@ -186,26 +186,26 @@ namespace stencil { /// Length for each direction \ingroup stencil const real_t dirLength [NR_OF_DIRECTIONS] = { - real_t(0), real_t(1), real_t(1), real_t(1), real_t(1), real_t(1), real_t(1), - std::sqrt( real_t(2) ), std::sqrt( real_t(2) ), std::sqrt( real_t(2) ), std::sqrt( real_t(2) ), - std::sqrt( real_t(2) ), std::sqrt( real_t(2) ), std::sqrt( real_t(2) ), std::sqrt( real_t(2) ), - std::sqrt( real_t(2) ), std::sqrt( real_t(2) ), std::sqrt( real_t(2) ), std::sqrt( real_t(2) ), - std::sqrt( real_t(3) ), std::sqrt( real_t(3) ), std::sqrt( real_t(3) ), std::sqrt( real_t(3) ), - std::sqrt( real_t(3) ), std::sqrt( real_t(3) ), std::sqrt( real_t(3) ), std::sqrt( real_t(3) ) + 0_r, 1_r, 1_r, 1_r, 1_r, 1_r, 1_r, + std::sqrt( 2_r ), std::sqrt( 2_r ), std::sqrt( 2_r ), std::sqrt( 2_r ), + std::sqrt( 2_r ), std::sqrt( 2_r ), std::sqrt( 2_r ), std::sqrt( 2_r ), + std::sqrt( 2_r ), std::sqrt( 2_r ), std::sqrt( 2_r ), std::sqrt( 2_r ), + std::sqrt( 3_r ), std::sqrt( 3_r ), std::sqrt( 3_r ), std::sqrt( 3_r ), + std::sqrt( 3_r ), std::sqrt( 3_r ), std::sqrt( 3_r ), std::sqrt( 3_r ) }; const real_t gaussianWeights [NR_OF_DIRECTIONS] = { //C N S W E T B NW NE SW SE TN TS TW TE BN BS BW BE TNE TNW TSE TSW BNE BNW BSE BSW - real_t(8) / real_t(64), - real_t(4) / real_t(64), real_t(4) / real_t(64), real_t(4) / real_t(64), real_t(4) / real_t(64), - real_t(4) / real_t(64), real_t(4) / real_t(64), - real_t(2) / real_t(64), real_t(2) / real_t(64), real_t(2) / real_t(64), real_t(2) / real_t(64), - real_t(2) / real_t(64), real_t(2) / real_t(64), real_t(2) / real_t(64), real_t(2) / real_t(64), - real_t(2) / real_t(64), real_t(2) / real_t(64), real_t(2) / real_t(64), real_t(2) / real_t(64), - real_t(1) / real_t(64), real_t(1) / real_t(64), real_t(1) / real_t(64), real_t(1) / real_t(64), - real_t(1) / real_t(64), real_t(1) / real_t(64), real_t(1) / real_t(64), real_t(1) / real_t(64) + 8_r / 64_r, + 4_r / 64_r, 4_r / 64_r, 4_r / 64_r, 4_r / 64_r, + 4_r / 64_r, 4_r / 64_r, + 2_r / 64_r, 2_r / 64_r, 2_r / 64_r, 2_r / 64_r, + 2_r / 64_r, 2_r / 64_r, 2_r / 64_r, 2_r / 64_r, + 2_r / 64_r, 2_r / 64_r, 2_r / 64_r, 2_r / 64_r, + 1_r / 64_r, 1_r / 64_r, 1_r / 64_r, 1_r / 64_r, + 1_r / 64_r, 1_r / 64_r, 1_r / 64_r, 1_r / 64_r }; diff --git a/src/timeloop/PerformanceMeter.cpp b/src/timeloop/PerformanceMeter.cpp index 6efb92d9..2aebcc74 100644 --- a/src/timeloop/PerformanceMeter.cpp +++ b/src/timeloop/PerformanceMeter.cpp @@ -278,8 +278,8 @@ namespace timeloop { measureIt->counts += 1; real_t rCounts = real_c( measureIt->counts ); - measureIt->avgCellsPerTimeStep = (rCounts - real_t(1.0) ) / rCounts * measureIt->avgCellsPerTimeStep + - real_t(1.0) / rCounts * cellsLastTimeStep; + measureIt->avgCellsPerTimeStep = (rCounts - 1.0_r ) / rCounts * measureIt->avgCellsPerTimeStep + + 1.0_r / rCounts * cellsLastTimeStep; } } } diff --git a/src/vtk/VTKOutput.cpp b/src/vtk/VTKOutput.cpp index 3d3cfa15..70eb16ce 100644 --- a/src/vtk/VTKOutput.cpp +++ b/src/vtk/VTKOutput.cpp @@ -1159,9 +1159,9 @@ void VTKOutput::writeVTIPiece_sampling( std::ostream& ofs, const IBlock& block ) WALBERLA_ASSERT_NOT_NULLPTR( blockStorage_ ); WALBERLA_ASSERT_EQUAL( ghostLayers_, 0 ); - WALBERLA_ASSERT_GREATER( samplingDx_, real_t(0) ); - WALBERLA_ASSERT_GREATER( samplingDy_, real_t(0) ); - WALBERLA_ASSERT_GREATER( samplingDz_, real_t(0) ); + WALBERLA_ASSERT_GREATER( samplingDx_, 0_r ); + WALBERLA_ASSERT_GREATER( samplingDy_, 0_r ); + WALBERLA_ASSERT_GREATER( samplingDz_, 0_r ); const AABB& blockBB = block.getAABB(); const AABB& domain = blockStorage_->getDomain(); @@ -1177,9 +1177,9 @@ void VTKOutput::writeVTIPiece_sampling( std::ostream& ofs, const IBlock& block ) CellVector cells; for( auto it = cellBB.begin(); it != cellBB.end(); ++it ) { - Vector3<real_t> world( domain.xMin() + ( real_c( it->x() ) + real_t(0.5) ) * samplingDx_, - domain.yMin() + ( real_c( it->y() ) + real_t(0.5) ) * samplingDy_, - domain.zMin() + ( real_c( it->z() ) + real_t(0.5) ) * samplingDz_ ); + Vector3<real_t> world( domain.xMin() + ( real_c( it->x() ) + 0.5_r ) * samplingDx_, + domain.yMin() + ( real_c( it->y() ) + 0.5_r ) * samplingDy_, + domain.zMin() + ( real_c( it->z() ) + 0.5_r ) * samplingDz_ ); Cell cell; blockStorage_->getCell( cell, world[0], world[1], world[2], level ); @@ -1756,9 +1756,9 @@ void VTKOutput::writePVTI( const uint_t collector ) const void VTKOutput::writePVTI_sampled( const uint_t collector ) const { WALBERLA_ASSERT_NOT_NULLPTR( blockStorage_ ); - WALBERLA_ASSERT_GREATER( samplingDx_, real_t(0) ); - WALBERLA_ASSERT_GREATER( samplingDy_, real_t(0) ); - WALBERLA_ASSERT_GREATER( samplingDz_, real_t(0) ); + WALBERLA_ASSERT_GREATER( samplingDx_, 0_r ); + WALBERLA_ASSERT_GREATER( samplingDy_, 0_r ); + WALBERLA_ASSERT_GREATER( samplingDz_, 0_r ); std::ostringstream collection; collection << baseFolder_ << "/" << identifier_ << "/" << executionFolder_ << "_" << collector << ".pvti"; @@ -2038,9 +2038,9 @@ void VTKOutput::writePCellData( std::ofstream& ofs ) const CellInterval VTKOutput::getSampledCellInterval( const AABB & aabb ) const { - WALBERLA_ASSERT_GREATER( samplingDx_, real_t(0) ); - WALBERLA_ASSERT_GREATER( samplingDy_, real_t(0) ); - WALBERLA_ASSERT_GREATER( samplingDz_, real_t(0) ); + WALBERLA_ASSERT_GREATER( samplingDx_, 0_r ); + WALBERLA_ASSERT_GREATER( samplingDy_, 0_r ); + WALBERLA_ASSERT_GREATER( samplingDz_, 0_r ); const AABB& domain = blockStorage_->getDomain(); diff --git a/src/vtk/VTKOutput.h b/src/vtk/VTKOutput.h index 8d635ab4..eae3d51f 100644 --- a/src/vtk/VTKOutput.h +++ b/src/vtk/VTKOutput.h @@ -518,7 +518,7 @@ inline void VTKOutput::setSamplingResolution( const real_t dx, const real_t dy, inline uint_t determineWriteFrequency( const real_t dt_SI, const uint_t fps ) { - return uint_c( real_c(1.0) / ( dt_SI * real_c(fps) ) + real_t(0.5) ); + return uint_c( real_c(1.0) / ( dt_SI * real_c(fps) ) + 0.5_r ); } diff --git a/tests/blockforest/BlockDataIOTest.cpp b/tests/blockforest/BlockDataIOTest.cpp index 291b3322..00175bff 100644 --- a/tests/blockforest/BlockDataIOTest.cpp +++ b/tests/blockforest/BlockDataIOTest.cpp @@ -44,7 +44,7 @@ const Set<SUID> None( Set<SUID>::emptySet() ); static void refinementSelectionFunction( SetupBlockForest& forest ) { for( auto block = forest.begin(); block != forest.end(); ++block ) - if( block->getAABB().contains( Vector3<real_t>( real_t(75) ) ) ) + if( block->getAABB().contains( Vector3<real_t>( 75_r ) ) ) if( !block->hasFather() ) block->setMarker( true ); } @@ -55,7 +55,7 @@ static void workloadMemorySUIDAssignmentFunction( SetupBlockForest& forest ) { block->setMemory( memory_t(1) ); block->setWorkload( workload_t(1) ); - if( block->getAABB().contains( Vector3<real_t>( real_t(25) ) ) ) + if( block->getAABB().contains( Vector3<real_t>( 25_r ) ) ) block->addState( Empty ); } } diff --git a/tests/blockforest/StructuredBlockForestTest.cpp b/tests/blockforest/StructuredBlockForestTest.cpp index fc9ce847..a55c0396 100644 --- a/tests/blockforest/StructuredBlockForestTest.cpp +++ b/tests/blockforest/StructuredBlockForestTest.cpp @@ -421,7 +421,7 @@ static void test() { std::mt19937 eng( 23 ); for( int i = 0; i < 23; ++i ) { - const Vector3<real_t> globalPoint = forest.getDomain().getScaled( real_t(1.25) ).randomPoint( eng ); + const Vector3<real_t> globalPoint = forest.getDomain().getScaled( 1.25_r ).randomPoint( eng ); for( auto blockIt = forest.begin(); blockIt != forest.end(); ++blockIt ) { diff --git a/tests/blockforest/communication/DirectionBasedReduceCommTest.cpp b/tests/blockforest/communication/DirectionBasedReduceCommTest.cpp index 1a130a2d..0c62caff 100644 --- a/tests/blockforest/communication/DirectionBasedReduceCommTest.cpp +++ b/tests/blockforest/communication/DirectionBasedReduceCommTest.cpp @@ -58,7 +58,7 @@ class SumSweep if( init_ ){ auto itSum0 = sumField->beginGhostLayerOnly(stencil::T); for( ; itSum0 != sumField->end(); ++itSum0 ) - *itSum0 = real_t(0); + *itSum0 = 0_r; } auto itVal = valField->rbegin(); @@ -135,15 +135,15 @@ int main(int argc, char **argv) // In addition to the normal GhostLayerField's we allocated additionally a field containing the whole global simulation domain for each block // we can then check if the GhostLayer communication is correct, by comparing the small field to the corresponding part of the big field - BlockDataID valFieldLoc = field::addToStorage<ScalarField>(blocks, "Val", real_t(1) ); - BlockDataID sumFieldLoc = field::addToStorage<ScalarField>(blocks, "Sum", real_t(0) ); + BlockDataID valFieldLoc = field::addToStorage<ScalarField>(blocks, "Val", 1_r ); + BlockDataID sumFieldLoc = field::addToStorage<ScalarField>(blocks, "Sum", 0_r ); - BlockDataID valFieldGlb = blocks->addBlockData<ScalarField>( makeBlockDataInitFunction<ScalarField>( glbCellsX, glbCellsY, glbCellsZ, uint_t(1), real_t(1), layout), "Global Src" ); - BlockDataID sumFieldGlb = blocks->addBlockData<ScalarField>( makeBlockDataInitFunction<ScalarField>( glbCellsX, glbCellsY, glbCellsZ, uint_t(1), real_t(0), layout), "Global Dst" ); + BlockDataID valFieldGlb = blocks->addBlockData<ScalarField>( makeBlockDataInitFunction<ScalarField>( glbCellsX, glbCellsY, glbCellsZ, uint_t(1), 1_r, layout), "Global Src" ); + BlockDataID sumFieldGlb = blocks->addBlockData<ScalarField>( makeBlockDataInitFunction<ScalarField>( glbCellsX, glbCellsY, glbCellsZ, uint_t(1), 0_r, layout), "Global Dst" ); // small local fields blockforest::DirectionBasedReduceScheme<stencil::B> schemeB( blocks ); - schemeB.addPackInfo( make_shared<field::communication::ReducePackInfo< std::plus, ScalarField > >( sumFieldLoc, real_t(0) ) ); + schemeB.addPackInfo( make_shared<field::communication::ReducePackInfo< std::plus, ScalarField > >( sumFieldLoc, 0_r ) ); // Create TimeLoop SweepTimeloop timeLoop (blocks->getBlockStorage(), nrOfTimeSteps); diff --git a/tests/core/GridGeneratorTest.cpp b/tests/core/GridGeneratorTest.cpp index 7971b5f0..78ede4da 100644 --- a/tests/core/GridGeneratorTest.cpp +++ b/tests/core/GridGeneratorTest.cpp @@ -113,39 +113,39 @@ int main( int argc, char** argv ) WALBERLA_UNUSED(env); std::vector< Vector3<real_t> > points; - points.emplace_back( real_t(0), real_t(0), real_t(0) ); - points.emplace_back( real_t(1), real_t(0), real_t(0) ); - points.emplace_back( real_t(0), real_t(1), real_t(0) ); - points.emplace_back( real_t(1), real_t(1), real_t(0) ); - points.emplace_back( real_t(0), real_t(0), real_t(1) ); - points.emplace_back( real_t(1), real_t(0), real_t(1) ); - points.emplace_back( real_t(0), real_t(1), real_t(1) ); - points.emplace_back( real_t(1), real_t(1), real_t(1) ); + points.emplace_back( 0_r, 0_r, 0_r ); + points.emplace_back( 1_r, 0_r, 0_r ); + points.emplace_back( 0_r, 1_r, 0_r ); + points.emplace_back( 1_r, 1_r, 0_r ); + points.emplace_back( 0_r, 0_r, 1_r ); + points.emplace_back( 1_r, 0_r, 1_r ); + points.emplace_back( 0_r, 1_r, 1_r ); + points.emplace_back( 1_r, 1_r, 1_r ); auto correctPointIt = points.begin(); for (auto it = SCIterator(AABB(real_c(-0.01), real_c(-0.01), real_c(-0.01), real_c(1.9),real_c(1.9),real_c(1.9)), Vector3<real_t>(0,0,0), 1); it != SCIterator(); ++it, ++correctPointIt) WALBERLA_CHECK_FLOAT_EQUAL( *it, *correctPointIt, (*it) << "!=" << (*correctPointIt) ); points.clear(); - points.emplace_back(real_t(0),real_t(0),real_t(0) ); - points.emplace_back(real_t(1),real_t(0),real_t(0) ); - points.emplace_back(real_c(0.5), real_c(0.866025),real_t(0) ); - points.emplace_back(real_c(1.5), real_c(0.866025),real_t(0) ); - points.emplace_back(real_t(0), real_c(1.73205),real_t(0) ); - points.emplace_back(real_t(1), real_c(1.73205),real_t(0) ); + points.emplace_back(0_r,0_r,0_r ); + points.emplace_back(1_r,0_r,0_r ); + points.emplace_back(real_c(0.5), real_c(0.866025),0_r ); + points.emplace_back(real_c(1.5), real_c(0.866025),0_r ); + points.emplace_back(0_r, real_c(1.73205),0_r ); + points.emplace_back(1_r, real_c(1.73205),0_r ); points.emplace_back(real_c(0.5), real_c(0.288675), real_c(0.816497) ); points.emplace_back(real_c(1.5), real_c(0.288675), real_c(0.816497) ); - points.emplace_back(real_t(0), real_c(1.1547), real_c(0.816497) ); - points.emplace_back(real_t(1), real_c(1.1547), real_c(0.816497) ); + points.emplace_back(0_r, real_c(1.1547), real_c(0.816497) ); + points.emplace_back(1_r, real_c(1.1547), real_c(0.816497) ); - points.emplace_back(real_t(0),real_t(0), real_c(1.63299) ); - points.emplace_back(real_t(1),real_t(0), real_c(1.63299) ); + points.emplace_back(0_r,0_r, real_c(1.63299) ); + points.emplace_back(1_r,0_r, real_c(1.63299) ); points.emplace_back(real_c(0.5), real_c(0.866025), real_c(1.63299) ); points.emplace_back(real_c(1.5), real_c(0.866025), real_c(1.63299) ); - points.emplace_back(real_t(0), real_c(1.73205), real_c(1.63299) ); - points.emplace_back(real_t(1), real_c(1.73205), real_c(1.63299) ); + points.emplace_back(0_r, real_c(1.73205), real_c(1.63299) ); + points.emplace_back(1_r, real_c(1.73205), real_c(1.63299) ); correctPointIt = points.begin(); - for (auto it = HCPIterator(AABB(real_c(-0.01), real_c(-0.01), real_c(-0.01), real_c(1.9),real_c(1.9),real_c(1.9)), Vector3<real_t>(real_t(0),real_t(0),real_t(0)), 1); it != HCPIterator(); ++it, ++correctPointIt) + for (auto it = HCPIterator(AABB(real_c(-0.01), real_c(-0.01), real_c(-0.01), real_c(1.9),real_c(1.9),real_c(1.9)), Vector3<real_t>(0_r,0_r,0_r), 1); it != HCPIterator(); ++it, ++correctPointIt) { WALBERLA_CHECK( floatIsEqual((*it)[0], (*correctPointIt)[0], real_c(0.00001)), (*it) << "!=" << (*correctPointIt)); WALBERLA_CHECK( floatIsEqual((*it)[1], (*correctPointIt)[1], real_c(0.00001)), (*it) << "!=" << (*correctPointIt)); diff --git a/tests/core/load_balancing/MetisTest.cpp b/tests/core/load_balancing/MetisTest.cpp index 22038220..eda6d665 100644 --- a/tests/core/load_balancing/MetisTest.cpp +++ b/tests/core/load_balancing/MetisTest.cpp @@ -72,7 +72,7 @@ int main( int argc, char * argv[] ) auto blocks = blockforest::createUniformBlockGrid( uint_t(1), uint_t(1), uint_t(1), fieldSize[0], fieldSize[1], uint_t(1), - real_t(1), + 1_r, uint_t(1), uint_t(1), uint_t(1), true, true, false ); diff --git a/tests/core/load_balancing/ParMetisTest.cpp b/tests/core/load_balancing/ParMetisTest.cpp index fd720610..2ff1b697 100644 --- a/tests/core/load_balancing/ParMetisTest.cpp +++ b/tests/core/load_balancing/ParMetisTest.cpp @@ -77,7 +77,7 @@ int main( int argc, char * argv[] ) auto blocks = blockforest::createUniformBlockGrid( gridSize[0], gridSize[1], uint_t(1), fieldSize[0], fieldSize[1], uint_t(1), - real_t(1), + 1_r, true, true, true, false ); diff --git a/tests/core/math/Matrix3Test.cpp b/tests/core/math/Matrix3Test.cpp index 7fd6aea2..3aa6250b 100644 --- a/tests/core/math/Matrix3Test.cpp +++ b/tests/core/math/Matrix3Test.cpp @@ -59,7 +59,7 @@ void rotationTest() //also checking WALBERLA_CHECK_FLOAT_EQUAL for matrices Matrix3<real_t> cmp(2,0,0,0,4,0,0,0,6); WALBERLA_CHECK_FLOAT_EQUAL( result, cmp ); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON( result, cmp, real_t(1e-5) ); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON( result, cmp, 1e-5_r ); } void RARTTest() diff --git a/tests/core/math/PlaneTest.cpp b/tests/core/math/PlaneTest.cpp index 98cfdb45..948b2b85 100644 --- a/tests/core/math/PlaneTest.cpp +++ b/tests/core/math/PlaneTest.cpp @@ -80,7 +80,7 @@ void testStreamInput() Plane p; iss >> p; WALBERLA_CHECK( iss.good() ); - Plane p_ref( Plane::Vec3Real( real_t(1), real_t(2), real_t(3) ), Plane::Vec3Real( real_t(4), real_t(5), real_t(6) ) ); + Plane p_ref( Plane::Vec3Real( 1_r, 2_r, 3_r ), Plane::Vec3Real( 4_r, 5_r, 6_r ) ); WALBERLA_CHECK_EQUAL( p, p_ref ); } { @@ -88,7 +88,7 @@ void testStreamInput() Plane p; iss >> p; WALBERLA_CHECK( iss.good() ); - Plane p_ref( Plane::Vec3Real( real_t(1), real_t(2), real_t(3) ), real_t(4) ); + Plane p_ref( Plane::Vec3Real( 1_r, 2_r, 3_r ), 4_r ); WALBERLA_CHECK_EQUAL( p, p_ref ); } } @@ -101,25 +101,25 @@ int main(int argc, char * argv[]) using Vec3Real = Vector3<real_t>; - Plane p( Vec3Real( real_t(0), real_t(0), real_t(0) ), Vec3Real( real_t(1), real_t(0), real_t(0) ) ); + Plane p( Vec3Real( 0_r, 0_r, 0_r ), Vec3Real( 1_r, 0_r, 0_r ) ); testIOStream( p ); - for( real_t x(-10); x < real_t(11); x += real_t(0.25) ) + for( real_t x(-10); x < 11_r; x += 0.25_r ) { - Vec3Real v( x, real_t(0), real_t(0) ); + Vec3Real v( x, 0_r, 0_r ); WALBERLA_CHECK_FLOAT_EQUAL( p.signedDistance( v ), x ); WALBERLA_CHECK_FLOAT_EQUAL( p.distance( v ), std::fabs( x ) ); - WALBERLA_CHECK_EQUAL( p.signedDistance( v ) <= real_t(0), p.isInHalfSpace( v ) ); + WALBERLA_CHECK_EQUAL( p.signedDistance( v ) <= 0_r, p.isInHalfSpace( v ) ); } - for( real_t x(-10); x < real_t(11); x += real_t(0.25) ) + for( real_t x(-10); x < 11_r; x += 0.25_r ) { static const Vector3<real_t> ZERO_VECTOR {}; Plane pShifted( p ); pShifted.shift( x ); WALBERLA_CHECK_FLOAT_EQUAL( pShifted.signedDistance( ZERO_VECTOR ), -x ); - for( real_t f(-10); f < real_t(11); f += real_t(0.25) ) + for( real_t f(-10); f < 11_r; f += 0.25_r ) { Plane pShiftedScaled( pShifted ); pShiftedScaled.scale( f ); @@ -137,7 +137,7 @@ int main(int argc, char * argv[]) real_t angle = std::acos( (p1-p0) * (p2-p0) / std::sqrt( (p1-p0).sqrLength() * (p2-p0).sqrLength() ) ); - if( (p0 - p1).sqrLength() < 1e-6 || (p0 - p2).sqrLength() < 1e-6 || (p2 - p1).sqrLength() < 1e-6 || angle < math::PI / real_t(180) ) + if( (p0 - p1).sqrLength() < 1e-6 || (p0 - p2).sqrLength() < 1e-6 || (p2 - p1).sqrLength() < 1e-6 || angle < math::PI / 180_r ) { --i; continue; @@ -145,15 +145,15 @@ int main(int argc, char * argv[]) Plane plane( p0, (p0 - p1).getNormalized() % (p0 - p2).getNormalized() ); - WALBERLA_CHECK_FLOAT_EQUAL( plane.signedDistance( p0 ), real_t(0) ); - WALBERLA_CHECK_FLOAT_EQUAL( plane.distance ( p0 ), real_t(0) ); - WALBERLA_CHECK_FLOAT_EQUAL( plane.signedDistance( p1 ), real_t(0) ); - WALBERLA_CHECK_FLOAT_EQUAL( plane.distance ( p1 ), real_t(0) ); - WALBERLA_CHECK_FLOAT_EQUAL( plane.signedDistance( p2 ), real_t(0) ); - WALBERLA_CHECK_FLOAT_EQUAL( plane.distance ( p2 ), real_t(0) ); - WALBERLA_CHECK_GREATER_EQUAL( plane.distance( p0 ), real_t(0) ); - WALBERLA_CHECK_GREATER_EQUAL( plane.distance( p1 ), real_t(0) ); - WALBERLA_CHECK_GREATER_EQUAL( plane.distance( p2 ), real_t(0) ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.signedDistance( p0 ), 0_r ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.distance ( p0 ), 0_r ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.signedDistance( p1 ), 0_r ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.distance ( p1 ), 0_r ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.signedDistance( p2 ), 0_r ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.distance ( p2 ), 0_r ); + WALBERLA_CHECK_GREATER_EQUAL( plane.distance( p0 ), 0_r ); + WALBERLA_CHECK_GREATER_EQUAL( plane.distance( p1 ), 0_r ); + WALBERLA_CHECK_GREATER_EQUAL( plane.distance( p2 ), 0_r ); } testStreamInput(); diff --git a/tests/core/math/SampleTest.cpp b/tests/core/math/SampleTest.cpp index b569fc15..bc2dc7d6 100644 --- a/tests/core/math/SampleTest.cpp +++ b/tests/core/math/SampleTest.cpp @@ -77,14 +77,14 @@ void testTwoElements( const real_t r1, const real_t r2 ) WALBERLA_CHECK_FLOAT_EQUAL(sample.median(), (r1+r2)/real_c(2)); real_t mu = sample.mean(); WALBERLA_CHECK_FLOAT_EQUAL(sample.variance(), ((r1-mu)*(r1-mu) + (r2-mu)*(r2-mu)) / real_c(2) ); - WALBERLA_CHECK_FLOAT_EQUAL(sample.stdDeviation(), std::fabs(r1 - r2) / real_t(2) ); + WALBERLA_CHECK_FLOAT_EQUAL(sample.stdDeviation(), std::fabs(r1 - r2) / 2_r ); if( sample.mean() > 1e-12 ) WALBERLA_CHECK_FLOAT_EQUAL(sample.relativeStdDeviation(), sample.stdDeviation() / sample.mean() ); WALBERLA_CHECK_FLOAT_EQUAL( sample.mad(), real_c( std::fabs( r1 - r2 ) / real_c(2) ) ); - if( minR + maxR > real_t(0) ) - WALBERLA_CHECK_FLOAT_EQUAL( sample.giniCoefficient(), real_t(2) * maxR / (minR + maxR) - real_t(1) ); + if( minR + maxR > 0_r ) + WALBERLA_CHECK_FLOAT_EQUAL( sample.giniCoefficient(), 2_r * maxR / (minR + maxR) - 1_r ); WALBERLA_CHECK_FLOAT_EQUAL(sample.cummulativeDistributionFunction( minR - real_c(1)), real_c(0)); if(r1 > r2 || r1 < r2) diff --git a/tests/cuda/SimpleKernelTest.cpp b/tests/cuda/SimpleKernelTest.cpp index 6b79fa8d..ef08e176 100644 --- a/tests/cuda/SimpleKernelTest.cpp +++ b/tests/cuda/SimpleKernelTest.cpp @@ -98,7 +98,7 @@ int main( int argc, char ** argv ) cuda::fieldCpy( *cpuField, *gpuField ); - WALBERLA_ASSERT_FLOAT_EQUAL( cpuField->get(0,0,0), real_t(2) ); + WALBERLA_ASSERT_FLOAT_EQUAL( cpuField->get(0,0,0), 2_r ); } diff --git a/tests/cuda/codegen/CodegenJacobiGPU.cpp b/tests/cuda/codegen/CodegenJacobiGPU.cpp index a8ebd370..992d4407 100644 --- a/tests/cuda/codegen/CodegenJacobiGPU.cpp +++ b/tests/cuda/codegen/CodegenJacobiGPU.cpp @@ -79,7 +79,7 @@ void testJacobi2D() shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid ( uint_t(1) , uint_t(1), uint_t(1), // number of blocks in x,y,z direction xSize, ySize, uint_t(1), // how many cells per block (x,y,z) - real_t(1), // dx: length of one cell in physical coordinates + 1_r, // dx: length of one cell in physical coordinates false, // one block per process - "false" means all blocks to one process true, true, true ); // no periodicity @@ -133,7 +133,7 @@ void testJacobi3D() shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid ( uint_t(1) , uint_t(1), uint_t(1), // number of blocks in x,y,z direction xSize, ySize, zSize, // how many cells per block (x,y,z) - real_t(1), // dx: length of one cell in physical coordinates + 1_r, // dx: length of one cell in physical coordinates false, // one block per process - "false" means all blocks to one process true, true, true ); // no periodicity diff --git a/tests/domain_decomposition/MapPointToPeriodicDomain.cpp b/tests/domain_decomposition/MapPointToPeriodicDomain.cpp index ee60a114..6a853c61 100644 --- a/tests/domain_decomposition/MapPointToPeriodicDomain.cpp +++ b/tests/domain_decomposition/MapPointToPeriodicDomain.cpp @@ -37,8 +37,8 @@ int main (int argc, char** argv) WALBERLA_UNUSED(walberlaEnv); std::array<bool, 3> isPeriodic{{true, true, true}}; - math::Vector3<real_t> minCorner(real_t(2), real_t(3), real_t(4)); - math::Vector3<real_t> maxCorner(real_t(3), real_t(4), real_t(5)); + math::Vector3<real_t> minCorner(2_r, 3_r, 4_r); + math::Vector3<real_t> maxCorner(3_r, 4_r, 5_r); math::AABB domain(minCorner, maxCorner); //minCorner -> minCorner @@ -56,9 +56,9 @@ int main (int argc, char** argv) WALBERLA_CHECK_IDENTICAL( p[2], minCorner[2] ); //minCorner - epsilon -> maxCorner - epsilon - p[0] = std::nextafter(domain.xMin(), real_t(0)); - p[1] = std::nextafter(domain.yMin(), real_t(0)); - p[2] = std::nextafter(domain.zMin(), real_t(0)); + p[0] = std::nextafter(domain.xMin(), 0_r); + p[1] = std::nextafter(domain.yMin(), 0_r); + p[2] = std::nextafter(domain.zMin(), 0_r); mapPointToPeriodicDomain( isPeriodic, domain, p); WALBERLA_CHECK_IDENTICAL( p[0], std::nextafter(domain.xMax(), domain.xMin()) ); WALBERLA_CHECK_IDENTICAL( p[1], std::nextafter(domain.yMax(), domain.yMin()) ); diff --git a/tests/domain_decomposition/PeriodicIntersect.cpp b/tests/domain_decomposition/PeriodicIntersect.cpp index 6753c472..6561a825 100644 --- a/tests/domain_decomposition/PeriodicIntersect.cpp +++ b/tests/domain_decomposition/PeriodicIntersect.cpp @@ -100,19 +100,19 @@ int main( int argc, char** argv ) { real_t delta = 0; - delta = real_t(0.9); + delta = 0.9_r; box2 = box1; box2.translate( math::Vector3<real_t> (real_c(dir.cx()) * delta, real_c(dir.cy()) * delta, real_c(dir.cz()) * delta)); WALBERLA_CHECK( box1.intersects( box2 ), box1 << "\n" << box2 ); WALBERLA_CHECK( box1.intersects( box2, dx ), box1 << "\n" << box2 ); - delta = real_t(1.05); + delta = 1.05_r; box2 = box1; box2.translate( math::Vector3<real_t> (real_c(dir.cx()) * delta, real_c(dir.cy()) * delta, real_c(dir.cz()) * delta)); WALBERLA_CHECK( !box1.intersects( box2 ), box1 << "\n" << box2 ); WALBERLA_CHECK( box1.intersects( box2, dx ), box1 << "\n" << box2 ); - delta = real_t(1.15); + delta = 1.15_r; box2 = box1; box2.translate( math::Vector3<real_t> (real_c(dir.cx()) * delta, real_c(dir.cy()) * delta, real_c(dir.cz()) * delta)); WALBERLA_CHECK( !box1.intersects( box2 ), box1 << "\n" << box2 ); @@ -126,19 +126,19 @@ int main( int argc, char** argv ) { real_t delta = 0; - delta = real_t(3); + delta = 3_r; box1 = temp.getTranslated( -math::Vector3<real_t> (real_c(dir.cx()) * delta, real_c(dir.cy()) * delta, real_c(dir.cz()) * delta)); box2 = temp.getTranslated( math::Vector3<real_t> (real_c(dir.cx()) * delta, real_c(dir.cy()) * delta, real_c(dir.cz()) * delta)); WALBERLA_CHECK( !forest->periodicIntersect(box1, box2), box1 << "\n" << box2 ); WALBERLA_CHECK( !forest->periodicIntersect(box1, box2, dx), box1 << "\n" << box2 ); - delta = real_t(3.9); + delta = 3.9_r; box1 = temp.getTranslated( -math::Vector3<real_t> (real_c(dir.cx()) * delta, real_c(dir.cy()) * delta, real_c(dir.cz()) * delta)); box2 = temp.getTranslated( math::Vector3<real_t> (real_c(dir.cx()) * delta, real_c(dir.cy()) * delta, real_c(dir.cz()) * delta)); WALBERLA_CHECK( !forest->periodicIntersect(box1, box2), box1 << "\n" << box2 ); WALBERLA_CHECK( forest->periodicIntersect(box1, box2, dx), box1 << "\n" << box2 ); - delta = real_t(4.1); + delta = 4.1_r; box1 = temp.getTranslated( -math::Vector3<real_t> (real_c(dir.cx()) * delta, real_c(dir.cy()) * delta, real_c(dir.cz()) * delta)); box2 = temp.getTranslated( math::Vector3<real_t> (real_c(dir.cx()) * delta, real_c(dir.cy()) * delta, real_c(dir.cz()) * delta)); WALBERLA_CHECK( forest->periodicIntersect(box1, box2), box1 << "\n" << box2 ); diff --git a/tests/domain_decomposition/PeriodicIntersectionVolume.cpp b/tests/domain_decomposition/PeriodicIntersectionVolume.cpp index cb48e577..a50eaebf 100644 --- a/tests/domain_decomposition/PeriodicIntersectionVolume.cpp +++ b/tests/domain_decomposition/PeriodicIntersectionVolume.cpp @@ -39,18 +39,18 @@ int main( int argc, char** argv ) WALBERLA_UNUSED(walberlaEnv); std::array< bool, 3 > periodic{{true, true, true}}; - math::AABB domain(real_t(0),real_t(0),real_t(0),real_t(100),real_t(100),real_t(100)); - math::AABB box1(real_t(0),real_t(0),real_t(0),real_t(10),real_t(10),real_t(10)); - math::AABB box2(real_t(0),real_t(0),real_t(0),real_t(10),real_t(10),real_t(10)); + math::AABB domain(0_r,0_r,0_r,100_r,100_r,100_r); + math::AABB box1(0_r,0_r,0_r,10_r,10_r,10_r); + math::AABB box2(0_r,0_r,0_r,10_r,10_r,10_r); for (int multiple = 0; multiple < 3; ++multiple) { for (auto dir = stencil::D3Q27::beginNoCenter(); dir != stencil::D3Q27::end(); ++dir) { Vector3<real_t> shift( - real_c(dir.cx()) * (real_t(9) + domain.xSize() * real_c(multiple)), - real_c(dir.cy()) * (real_t(9) + domain.ySize() * real_c(multiple)), - real_c(dir.cz()) * (real_t(9) + domain.zSize() * real_c(multiple))); + real_c(dir.cx()) * (9_r + domain.xSize() * real_c(multiple)), + real_c(dir.cy()) * (9_r + domain.ySize() * real_c(multiple)), + real_c(dir.cz()) * (9_r + domain.zSize() * real_c(multiple))); box2.setCenter(shift + box1.center()); real_t vol = periodicIntersectionVolume(periodic, domain, box1, box2); @@ -64,7 +64,7 @@ int main( int argc, char** argv ) case stencil::TNW: case stencil::TSE: case stencil::TSW: - WALBERLA_CHECK_FLOAT_EQUAL(vol, real_t(1)); + WALBERLA_CHECK_FLOAT_EQUAL(vol, 1_r); break; case stencil::BN: case stencil::BW: @@ -78,7 +78,7 @@ int main( int argc, char** argv ) case stencil::NW: case stencil::SE: case stencil::SW: - WALBERLA_CHECK_FLOAT_EQUAL(vol, real_t(10)); + WALBERLA_CHECK_FLOAT_EQUAL(vol, 10_r); break; case stencil::B: case stencil::T: @@ -86,7 +86,7 @@ int main( int argc, char** argv ) case stencil::W: case stencil::S: case stencil::E: - WALBERLA_CHECK_FLOAT_EQUAL(vol, real_t(100)); + WALBERLA_CHECK_FLOAT_EQUAL(vol, 100_r); break; default: WALBERLA_CHECK(false, "Should not end up here!"); diff --git a/tests/fft/FftTest.cpp b/tests/fft/FftTest.cpp index 99e934db..10953669 100644 --- a/tests/fft/FftTest.cpp +++ b/tests/fft/FftTest.cpp @@ -11,7 +11,7 @@ using namespace walberla; typedef GhostLayerField< real_t, 1 > Field_T; -const real_t factor = real_t(2.745652); +const real_t factor = 2.745652_r; real_t greens(uint_t /* x */, uint_t /* y */, uint_t /* z */) { diff --git a/tests/fft/GreensTest.cpp b/tests/fft/GreensTest.cpp index 720640d7..cc24494a 100644 --- a/tests/fft/GreensTest.cpp +++ b/tests/fft/GreensTest.cpp @@ -29,8 +29,8 @@ int main (int argc, char** argv) WALBERLA_ASSERT_EQUAL(cells_per_block*processes, L, "Number of processes per direction must evenly divide " << L); auto blocks = blockforest::createUniformBlockGrid(num_blocks,num_blocks,num_blocks, cells_per_block,cells_per_block,cells_per_block, 1.0, processes,processes,processes, true,true,true); - BlockDataID originalFieldId = field::addToStorage<Field_T>( blocks, "original", real_t(0), field::zyxf, 1 ); - BlockDataID fftFieldId = field::addToStorage<Field_T>( blocks, "result", real_t(0), field::zyxf, 1 ); + BlockDataID originalFieldId = field::addToStorage<Field_T>( blocks, "original", 0_r, field::zyxf, 1 ); + BlockDataID fftFieldId = field::addToStorage<Field_T>( blocks, "result", 0_r, field::zyxf, 1 ); auto comm = blockforest::communication::UniformBufferedScheme< stencil::D3Q7 >( blocks ); comm.addPackInfo(make_shared< field::communication::PackInfo< Field_T > >( fftFieldId )); diff --git a/tests/field/AccuracyEvaluationTest.cpp b/tests/field/AccuracyEvaluationTest.cpp index c7656509..13652de1 100644 --- a/tests/field/AccuracyEvaluationTest.cpp +++ b/tests/field/AccuracyEvaluationTest.cpp @@ -64,7 +64,7 @@ int main( int argc, char* argv[] ) auto blocks = blockforest::createUniformBlockGrid( uint_t( 2), uint_t( 1), uint_t( 2), // blocks uint_t(10), uint_t(10), uint_t(10), // cells - real_t(1), // dx + 1_r, // dx uint_t( 2), uint_t( 1), uint_t( 2) ); // number of processes //math::seedRandomGenerator( numeric_cast<std::mt19937::result_type>( std::time(0) ) ); diff --git a/tests/field/adaptors/AdaptorTest.cpp b/tests/field/adaptors/AdaptorTest.cpp index 109c348e..04066c1f 100644 --- a/tests/field/adaptors/AdaptorTest.cpp +++ b/tests/field/adaptors/AdaptorTest.cpp @@ -136,7 +136,7 @@ int main( int argc, char ** argv ) false ); // do NOT keep global information - LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::SRT( real_t(1.4) ) ); + LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::SRT( 1.4_r ) ); BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "PdfField", latticeModel ); diff --git a/tests/field/codegen/CodegenJacobiCPU.cpp b/tests/field/codegen/CodegenJacobiCPU.cpp index 2023baeb..8b05d68d 100644 --- a/tests/field/codegen/CodegenJacobiCPU.cpp +++ b/tests/field/codegen/CodegenJacobiCPU.cpp @@ -51,12 +51,12 @@ void testJacobi2D() shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid ( uint_t(1) , uint_t(1), uint_t(1), // number of blocks in x,y,z direction xSize, ySize, uint_t(1), // how many cells per block (x,y,z) - real_t(1), // dx: length of one cell in physical coordinates + 1_r, // dx: length of one cell in physical coordinates false, // one block per process - "false" means all blocks to one process true, true, true ); // no periodicity - BlockDataID fieldID = field::addToStorage<ScalarField>(blocks, "Field", real_t(0.0)); + BlockDataID fieldID = field::addToStorage<ScalarField>(blocks, "Field", 0.0_r); // Initialize a quarter of the field with ones, the rest remains 0 // Jacobi averages the domain -> every cell should be at 0.25 at sufficiently many timesteps @@ -98,12 +98,12 @@ void testJacobi3D() shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid ( uint_t(1) , uint_t(1), uint_t(1), // number of blocks in x,y,z direction xSize, ySize, zSize, // how many cells per block (x,y,z) - real_t(1), // dx: length of one cell in physical coordinates + 1_r, // dx: length of one cell in physical coordinates false, // one block per process - "false" means all blocks to one process true, true, true ); // no periodicity - BlockDataID fieldID = field::addToStorage<ScalarField>(blocks, "Field", real_t(0.0)); + BlockDataID fieldID = field::addToStorage<ScalarField>(blocks, "Field", 0.0_r); // Initialize a quarter of the field with ones, the rest remains 0 // Jacobi averages the domain -> every cell should be at 0.25 at sufficiently many timesteps diff --git a/tests/field/distributors/DistributionTest.cpp b/tests/field/distributors/DistributionTest.cpp index daf4784b..66c7e1a7 100644 --- a/tests/field/distributors/DistributionTest.cpp +++ b/tests/field/distributors/DistributionTest.cpp @@ -62,7 +62,7 @@ void resetScalarField( const shared_ptr<StructuredBlockStorage> & blocks, { auto sField = blockIt->getData<ScalarField_T>( scalarFieldID ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ(sField, - sField->get(x,y,z) = real_t(0); + sField->get(x,y,z) = 0_r; ); } } @@ -74,7 +74,7 @@ void resetVectorField( const shared_ptr<StructuredBlockStorage> & blocks, { auto vField = blockIt->getData<Vec3Field_T>( vectorFieldID ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ(vField, - vField->get(x,y,z) = Vector3<real_t>(real_t(0)); + vField->get(x,y,z) = Vector3<real_t>(0_r); ); } } @@ -86,9 +86,9 @@ void resetMultiCompField( const shared_ptr<StructuredBlockStorage> & blocks, { auto mField = blockIt->getData<MultiComponentField_T>( multiComponentFieldID ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ(mField, - mField->get(x,y,z,0) = real_t(0); - mField->get(x,y,z,1) = real_t(0); - mField->get(x,y,z,2) = real_t(0); + mField->get(x,y,z,0) = 0_r; + mField->get(x,y,z,1) = 0_r; + mField->get(x,y,z,2) = 0_r; ); } } @@ -116,9 +116,9 @@ void getScalarFieldQuantities( const shared_ptr<StructuredBlockStorage> & blocks const BlockDataID & fieldID, real_t & summarizedValue, real_t & minValue, real_t & maxValue) { - real_t sum( real_t(0) ); - real_t min( real_t(0) ); - real_t max( real_t(0) ); + real_t sum( 0_r ); + real_t min( 0_r ); + real_t max( 0_r ); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { auto field = blockIt->getData<ScalarField_T>( fieldID ); @@ -153,9 +153,9 @@ void getVectorFieldQuantities( const shared_ptr<StructuredBlockStorage> & blocks const BlockDataID & fieldID, Vector3<real_t> & summarizedValue, Vector3<real_t> & minValue, Vector3<real_t> & maxValue) { - Vector3<real_t> sum( real_t(0) ); - Vector3<real_t> min( real_t(0) ); - Vector3<real_t> max( real_t(0) ); + Vector3<real_t> sum( 0_r ); + Vector3<real_t> min( 0_r ); + Vector3<real_t> max( 0_r ); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { auto field = blockIt->getData<Vec3Field_T>( fieldID ); @@ -246,18 +246,18 @@ void testNearestNeighborDistributor( const shared_ptr<StructuredBlockStorage> & // check scalar distribution { - Vector3<real_t> distributionPoint(real_t(1.9), real_t(2.1), real_t(2.1)); - real_t distributionValue(real_t(100)); + Vector3<real_t> distributionPoint(1.9_r, 2.1_r, 2.1_r); + real_t distributionValue(100_r); auto containingBlockID = blocks->getBlock(distributionPoint); if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } - real_t sum(real_t(0)), min(real_t(0)), max(real_t(0)); + real_t sum(0_r), min(0_r), max(0_r); getScalarFieldQuantities(blocks, flagFieldID, scalarFieldID, sum, min, max); WALBERLA_CHECK_FLOAT_EQUAL(sum, distributionValue, "NearestNeighborDistributor: Sum of scalar distribution failed!" ); - WALBERLA_CHECK_FLOAT_EQUAL(min, real_t(0), "NearestNeighborDistributor: Min of scalar distribution failed!" ); + WALBERLA_CHECK_FLOAT_EQUAL(min, 0_r, "NearestNeighborDistributor: Min of scalar distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(max, distributionValue, "NearestNeighborDistributor: Max of scalar distribution failed!" ); resetScalarField(blocks, scalarFieldID); @@ -265,24 +265,24 @@ void testNearestNeighborDistributor( const shared_ptr<StructuredBlockStorage> & // check vector distribution { - Vector3<real_t> distributionPoint(real_t(5.4),real_t(2.1),real_t(3.2)); - Vector3<real_t> distributionValue(real_t(100), real_t(-10), real_t(1)); + Vector3<real_t> distributionPoint(5.4_r,2.1_r,3.2_r); + Vector3<real_t> distributionValue(100_r, -10_r, 1_r); auto containingBlockID = blocks->getBlock(distributionPoint); if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<Vec3Distributor_T>(vectorDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } - Vector3<real_t> sum(real_t(0)), min(real_t(0)), max(real_t(0)); + Vector3<real_t> sum(0_r), min(0_r), max(0_r); getVectorFieldQuantities(blocks, flagFieldID, vectorFieldID, sum, min, max); WALBERLA_CHECK_FLOAT_EQUAL(sum[0], distributionValue[0], "NearestNeighborDistributor: Sum of vec[0] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(sum[1], distributionValue[1], "NearestNeighborDistributor: Sum of vec[1] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(sum[2], distributionValue[2], "NearestNeighborDistributor: Sum of vec[2] distribution failed!" ); - WALBERLA_CHECK_FLOAT_EQUAL(min[0], real_t(0), "NearestNeighborDistributor: Min of vec[0] distribution failed!" ); + WALBERLA_CHECK_FLOAT_EQUAL(min[0], 0_r, "NearestNeighborDistributor: Min of vec[0] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(min[1], distributionValue[1], "NearestNeighborDistributor: Min of vec[1] distribution failed!" ); - WALBERLA_CHECK_FLOAT_EQUAL(min[2], real_t(0), "NearestNeighborDistributor: Min of vec[2] distribution failed!" ); + WALBERLA_CHECK_FLOAT_EQUAL(min[2], 0_r, "NearestNeighborDistributor: Min of vec[2] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(max[0], distributionValue[0], "NearestNeighborDistributor: Max of vec[0] distribution failed!" ); - WALBERLA_CHECK_FLOAT_EQUAL(max[1], real_t(0), "NearestNeighborDistributor: Max of vec[1] distribution failed!" ); + WALBERLA_CHECK_FLOAT_EQUAL(max[1], 0_r, "NearestNeighborDistributor: Max of vec[1] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(max[2], distributionValue[2], "NearestNeighborDistributor: Max of vec[2] distribution failed!" ); resetVectorField(blocks, vectorFieldID); @@ -290,11 +290,11 @@ void testNearestNeighborDistributor( const shared_ptr<StructuredBlockStorage> & // check multi component distribution { - Vector3<real_t> distributionPoint(real_t(4.4),real_t(2.1),real_t(3.2)); + Vector3<real_t> distributionPoint(4.4_r,2.1_r,3.2_r); std::vector<real_t> distributionValue(3); - distributionValue[0] = real_t(100); - distributionValue[1] = real_t(-10); - distributionValue[2] = real_t(1); + distributionValue[0] = 100_r; + distributionValue[1] = -10_r; + distributionValue[2] = 1_r; auto containingBlockID = blocks->getBlock(distributionPoint); if( containingBlockID != nullptr ) { @@ -306,11 +306,11 @@ void testNearestNeighborDistributor( const shared_ptr<StructuredBlockStorage> & WALBERLA_CHECK_FLOAT_EQUAL(sum[0], distributionValue[0], "NearestNeighborDistributor: Sum of Multi Component[0] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(sum[1], distributionValue[1], "NearestNeighborDistributor: Sum of Multi Component[1] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(sum[2], distributionValue[2], "NearestNeighborDistributor: Sum of Multi Component[2] distribution failed!" ); - WALBERLA_CHECK_FLOAT_EQUAL(min[0], real_t(0), "NearestNeighborDistributor: Min of Multi Component[0] distribution failed!" ); + WALBERLA_CHECK_FLOAT_EQUAL(min[0], 0_r, "NearestNeighborDistributor: Min of Multi Component[0] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(min[1], distributionValue[1], "NearestNeighborDistributor: Min of Multi Component[1] distribution failed!" ); - WALBERLA_CHECK_FLOAT_EQUAL(min[2], real_t(0), "NearestNeighborDistributor: Min of Multi Component[2] distribution failed!" ); + WALBERLA_CHECK_FLOAT_EQUAL(min[2], 0_r, "NearestNeighborDistributor: Min of Multi Component[2] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(max[0], distributionValue[0], "NearestNeighborDistributor: Max of Multi Component[0] distribution failed!" ); - WALBERLA_CHECK_FLOAT_EQUAL(max[1], real_t(0), "NearestNeighborDistributor: Max of Multi Component[1] distribution failed!" ); + WALBERLA_CHECK_FLOAT_EQUAL(max[1], 0_r, "NearestNeighborDistributor: Max of Multi Component[1] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(max[2], distributionValue[2], "NearestNeighborDistributor: Max of Multi Component[2] distribution failed!" ); resetMultiCompField(blocks, multiComponentFieldID); @@ -331,18 +331,18 @@ void testKernelDistributor( const shared_ptr<StructuredBlockStorage> & blocks, c // check scalar distribution { - Vector3<real_t> distributionPoint(real_t(1.9), real_t(2.1), real_t(2.1)); - real_t distributionValue(real_t(100)); + Vector3<real_t> distributionPoint(1.9_r, 2.1_r, 2.1_r); + real_t distributionValue(100_r); auto containingBlockID = blocks->getBlock(distributionPoint); if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } - real_t sum(real_t(0)), min(real_t(0)), max(real_t(0)); + real_t sum(0_r), min(0_r), max(0_r); getScalarFieldQuantities(blocks, flagFieldID, scalarFieldID, sum, min, max); WALBERLA_CHECK_FLOAT_EQUAL(sum, distributionValue, "KernelDistributor: Sum of scalar distribution failed!" ); - WALBERLA_CHECK(min >= real_t(0), "KernelDistributor: Min of scalar distribution failed!" ); + WALBERLA_CHECK(min >= 0_r, "KernelDistributor: Min of scalar distribution failed!" ); WALBERLA_CHECK(max <= distributionValue, "KernelDistributor: Max of scalar distribution failed!" ); resetScalarField(blocks, scalarFieldID); @@ -350,24 +350,24 @@ void testKernelDistributor( const shared_ptr<StructuredBlockStorage> & blocks, c // check vector distribution { - Vector3<real_t> distributionPoint(real_t(5.4),real_t(2.1),real_t(3.2)); - Vector3<real_t> distributionValue(real_t(100), real_t(-10), real_t(1)); + Vector3<real_t> distributionPoint(5.4_r,2.1_r,3.2_r); + Vector3<real_t> distributionValue(100_r, -10_r, 1_r); auto containingBlockID = blocks->getBlock(distributionPoint); if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<Vec3Distributor_T>(vectorDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } - Vector3<real_t> sum(real_t(0)), min(real_t(0)), max(real_t(0)); + Vector3<real_t> sum(0_r), min(0_r), max(0_r); getVectorFieldQuantities(blocks, flagFieldID, vectorFieldID, sum, min, max); WALBERLA_CHECK_FLOAT_EQUAL(sum[0], distributionValue[0], "KernelDistributor: Sum of vec[0] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(sum[1], distributionValue[1], "KernelDistributor: Sum of vec[1] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(sum[2], distributionValue[2], "KernelDistributor: Sum of vec[2] distribution failed!" ); - WALBERLA_CHECK(min[0] >= real_t(0), "KernelDistributor: Min of vec[0] distribution failed!" ); + WALBERLA_CHECK(min[0] >= 0_r, "KernelDistributor: Min of vec[0] distribution failed!" ); WALBERLA_CHECK(min[1] >= distributionValue[1], "KernelDistributor: Min of vec[1] distribution failed!" ); - WALBERLA_CHECK(min[2] >= real_t(0), "KernelDistributor: Min of vec[2] distribution failed!" ); + WALBERLA_CHECK(min[2] >= 0_r, "KernelDistributor: Min of vec[2] distribution failed!" ); WALBERLA_CHECK(max[0] <= distributionValue[0], "KernelDistributor: Max of vec[0] distribution failed!" ); - WALBERLA_CHECK(max[1] <= real_t(0), "KernelDistributor: Max of vec[1] distribution failed!" ); + WALBERLA_CHECK(max[1] <= 0_r, "KernelDistributor: Max of vec[1] distribution failed!" ); WALBERLA_CHECK(max[2] <= distributionValue[2], "KernelDistributor: Max of vec[2] distribution failed!" ); resetVectorField(blocks, vectorFieldID); @@ -375,11 +375,11 @@ void testKernelDistributor( const shared_ptr<StructuredBlockStorage> & blocks, c // check multi component distribution { - Vector3<real_t> distributionPoint(real_t(4.4),real_t(2.1),real_t(3.2)); + Vector3<real_t> distributionPoint(4.4_r,2.1_r,3.2_r); std::vector<real_t> distributionValue(3); - distributionValue[0] = real_t(100); - distributionValue[1] = real_t(-10); - distributionValue[2] = real_t(1); + distributionValue[0] = 100_r; + distributionValue[1] = -10_r; + distributionValue[2] = 1_r; auto containingBlockID = blocks->getBlock(distributionPoint); if( containingBlockID != nullptr ) { @@ -391,11 +391,11 @@ void testKernelDistributor( const shared_ptr<StructuredBlockStorage> & blocks, c WALBERLA_CHECK_FLOAT_EQUAL(sum[0], distributionValue[0], "KernelDistributor: Sum of Multi Component[0] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(sum[1], distributionValue[1], "KernelDistributor: Sum of Multi Component[1] distribution failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(sum[2], distributionValue[2], "KernelDistributor: Sum of Multi Component[2] distribution failed!" ); - WALBERLA_CHECK(min[0] >= real_t(0), "KernelDistributor: Min of Multi Component[0] distribution failed!" ); + WALBERLA_CHECK(min[0] >= 0_r, "KernelDistributor: Min of Multi Component[0] distribution failed!" ); WALBERLA_CHECK(min[1] >= distributionValue[1], "KernelDistributor: Min of Multi Component[1] distribution failed!" ); - WALBERLA_CHECK(min[2] >= real_t(0), "KernelDistributor: Min of Multi Component[2] distribution failed!" ); + WALBERLA_CHECK(min[2] >= 0_r, "KernelDistributor: Min of Multi Component[2] distribution failed!" ); WALBERLA_CHECK(max[0] <= distributionValue[0], "KernelDistributor: Max of Multi Component[0] distribution failed!" ); - WALBERLA_CHECK(max[1] <= real_t(0), "KernelDistributor: Max of Multi Component[1] distribution failed!" ); + WALBERLA_CHECK(max[1] <= 0_r, "KernelDistributor: Max of Multi Component[1] distribution failed!" ); WALBERLA_CHECK(max[2] <= distributionValue[2], "KernelDistributor: Max of Multi Component[2] distribution failed!" ); resetMultiCompField(blocks, multiComponentFieldID); @@ -412,17 +412,17 @@ void testNearestNeighborDistributorAtBoundary( const shared_ptr<StructuredBlockS // check scalar interpolation close to boundary { - Vector3<real_t> distributionPoint(real_t(1.9), real_t(2.1), real_t(2.1)); - real_t distributionValue(real_t(100)); + Vector3<real_t> distributionPoint(1.9_r, 2.1_r, 2.1_r); + real_t distributionValue(100_r); auto containingBlockID = blocks->getBlock(distributionPoint); if (containingBlockID != nullptr) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } - real_t sum(real_t(0)), min(real_t(0)), max(real_t(0)); + real_t sum(0_r), min(0_r), max(0_r); getScalarFieldQuantities(blocks, flagFieldID, scalarFieldID, sum, min, max); WALBERLA_CHECK_FLOAT_EQUAL(sum, distributionValue, "NearestNeighborDistributor: Sum of scalar distribution near boundary failed!" ); - WALBERLA_CHECK_FLOAT_EQUAL(min, real_t(0), "NearestNeighborDistributor: Min of scalar distribution near boundary failed!" ); + WALBERLA_CHECK_FLOAT_EQUAL(min, 0_r, "NearestNeighborDistributor: Min of scalar distribution near boundary failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(max, distributionValue, "NearestNeighborDistributor: Max of scalar distribution near boundary failed!" ); resetScalarField(blocks, scalarFieldID); @@ -430,17 +430,17 @@ void testNearestNeighborDistributorAtBoundary( const shared_ptr<StructuredBlockS // check scalar interpolation inside boundary { - Vector3<real_t> distributionPoint(real_t(2.7), real_t(2.1), real_t(1.1)); - real_t distributionValue(real_t(100)); + Vector3<real_t> distributionPoint(2.7_r, 2.1_r, 1.1_r); + real_t distributionValue(100_r); auto containingBlockID = blocks->getBlock(distributionPoint); if (containingBlockID != nullptr) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } - real_t sum(real_t(0)), min(real_t(0)), max(real_t(0)); + real_t sum(0_r), min(0_r), max(0_r); getScalarFieldQuantities(blocks, flagFieldID, scalarFieldID, sum, min, max); WALBERLA_CHECK_FLOAT_EQUAL(sum, distributionValue, "NearestNeighborDistributor: Sum of scalar distribution inside boundary failed!" ); - WALBERLA_CHECK_FLOAT_EQUAL(min, real_t(0), "NearestNeighborDistributor: Min of scalar distribution inside boundary failed!" ); + WALBERLA_CHECK_FLOAT_EQUAL(min, 0_r, "NearestNeighborDistributor: Min of scalar distribution inside boundary failed!" ); WALBERLA_CHECK_FLOAT_EQUAL(max, distributionValue, "NearestNeighborDistributor: Max of scalar distribution inside boundary failed!" ); resetScalarField(blocks, scalarFieldID); @@ -456,17 +456,17 @@ void testKernelDistributorAtBoundary( const shared_ptr<StructuredBlockStorage> & // check scalar interpolation close to boundary { - Vector3<real_t> distributionPoint(real_t(1.9), real_t(2.1), real_t(2.1)); - real_t distributionValue(real_t(100)); + Vector3<real_t> distributionPoint(1.9_r, 2.1_r, 2.1_r); + real_t distributionValue(100_r); auto containingBlockID = blocks->getBlock(distributionPoint); if (containingBlockID != nullptr) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } - real_t sum(real_t(0)), min(real_t(0)), max(real_t(0)); + real_t sum(0_r), min(0_r), max(0_r); getScalarFieldQuantities(blocks, flagFieldID, scalarFieldID, sum, min, max); WALBERLA_CHECK_FLOAT_EQUAL(sum, distributionValue, "KernelDistributor: Sum of scalar distribution near boundary failed!" ); - WALBERLA_CHECK(min >= real_t(0), "KernelDistributor: Min of scalar distribution near boundary failed!" ); + WALBERLA_CHECK(min >= 0_r, "KernelDistributor: Min of scalar distribution near boundary failed!" ); WALBERLA_CHECK(max <= distributionValue, "KernelDistributor: Max of scalar distribution near boundary failed!" ); resetScalarField(blocks, scalarFieldID); @@ -474,17 +474,17 @@ void testKernelDistributorAtBoundary( const shared_ptr<StructuredBlockStorage> & // check scalar interpolation inside boundary { - Vector3<real_t> distributionPoint(real_t(2.7), real_t(2.1), real_t(1.1)); - real_t distributionValue(real_t(100)); + Vector3<real_t> distributionPoint(2.7_r, 2.1_r, 1.1_r); + real_t distributionValue(100_r); auto containingBlockID = blocks->getBlock(distributionPoint); if (containingBlockID != nullptr) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } - real_t sum(real_t(0)), min(real_t(0)), max(real_t(0)); + real_t sum(0_r), min(0_r), max(0_r); getScalarFieldQuantities(blocks, flagFieldID, scalarFieldID, sum, min, max); WALBERLA_CHECK_FLOAT_EQUAL(sum, distributionValue, "KernelDistributor: Sum of scalar distribution inside boundary failed!" ); - WALBERLA_CHECK(min >= real_t(0), "KernelDistributor: Min of scalar distribution inside boundary failed!" ); + WALBERLA_CHECK(min >= 0_r, "KernelDistributor: Min of scalar distribution inside boundary failed!" ); WALBERLA_CHECK(max <= distributionValue, "KernelDistributor: Max of scalar distribution inside boundary failed!" ); resetScalarField(blocks, scalarFieldID); @@ -499,7 +499,7 @@ int main(int argc, char **argv) { const uint_t numberOfBlocksInDirection = 2; const uint_t numberOfCellsPerBlockInDirection = 4; - const real_t dx = real_t(1); + const real_t dx = 1_r; // block storage auto blocks = blockforest::createUniformBlockGrid( numberOfBlocksInDirection, numberOfBlocksInDirection, numberOfBlocksInDirection, @@ -511,9 +511,9 @@ int main(int argc, char **argv) { BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers, false, initFlagField ); // data fields - BlockDataID scalarFieldID = field::addToStorage< ScalarField_T >( blocks, "scalar field", real_t(0), field::zyxf, FieldGhostLayers ); - BlockDataID vectorFieldID = field::addToStorage< Vec3Field_T >( blocks, "vec3 field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); - BlockDataID multiComponentFieldID = field::addToStorage< MultiComponentField_T >( blocks, "multi component field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID scalarFieldID = field::addToStorage< ScalarField_T >( blocks, "scalar field", 0_r, field::zyxf, FieldGhostLayers ); + BlockDataID vectorFieldID = field::addToStorage< Vec3Field_T >( blocks, "vec3 field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); + BlockDataID multiComponentFieldID = field::addToStorage< MultiComponentField_T >( blocks, "multi component field", 0_r, field::zyxf, FieldGhostLayers ); // test all distributors with domain flags everywhere, i.e. without special boundary treatment necessary testNearestNeighborDistributor(blocks, flagFieldID, scalarFieldID, vectorFieldID, multiComponentFieldID); diff --git a/tests/field/interpolators/FieldInterpolationTest.cpp b/tests/field/interpolators/FieldInterpolationTest.cpp index 3571c3fd..557c04af 100644 --- a/tests/field/interpolators/FieldInterpolationTest.cpp +++ b/tests/field/interpolators/FieldInterpolationTest.cpp @@ -61,8 +61,8 @@ void initScalarField( const shared_ptr<StructuredBlockStorage> & blocks, const B { auto field = blockIt->getData<ScalarField_T>( scalarFieldID ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ(field, - const Vector3<real_t> p = blocks->getBlockLocalCellCenter(*blockIt, Cell(x,y,z)) - Vector3<real_t>(real_t(0.5)); - //field->get(x,y,z) = real_t(2); + const Vector3<real_t> p = blocks->getBlockLocalCellCenter(*blockIt, Cell(x,y,z)) - Vector3<real_t>(0.5_r); + //field->get(x,y,z) = 2_r; field->get(x,y,z) = p[0]; ); } @@ -74,8 +74,8 @@ void initVectorField( const shared_ptr<StructuredBlockStorage> & blocks, const B { auto field = blockIt->getData<Vec3Field_T>( vectorFieldID ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ(field, - const Vector3<real_t> p = blocks->getBlockLocalCellCenter(*blockIt, Cell(x,y,z)) - Vector3<real_t>(real_t(0.5)); - field->get(x,y,z) = Vector3<real_t>(p[0], real_t(2), p[1]); + const Vector3<real_t> p = blocks->getBlockLocalCellCenter(*blockIt, Cell(x,y,z)) - Vector3<real_t>(0.5_r); + field->get(x,y,z) = Vector3<real_t>(p[0], 2_r, p[1]); ); } } @@ -86,9 +86,9 @@ void initMultiComponentField( const shared_ptr<StructuredBlockStorage> & blocks, { auto field = blockIt->getData<MultiComponentField_T>( multiComponentFieldID ); WALBERLA_FOR_ALL_CELLS_INCLUDING_GHOST_LAYER_XYZ(field, - const Vector3<real_t> p = blocks->getBlockLocalCellCenter(*blockIt, Cell(x,y,z)) - Vector3<real_t>(real_t(0.5)); + const Vector3<real_t> p = blocks->getBlockLocalCellCenter(*blockIt, Cell(x,y,z)) - Vector3<real_t>(0.5_r); field->get(x,y,z,0) = p[0]; - field->get(x,y,z,1) = real_t(2); + field->get(x,y,z,1) = 2_r; field->get(x,y,z,2) = p[1]; ); } @@ -127,42 +127,42 @@ void testNearestNeighborFieldInterpolator( const shared_ptr<StructuredBlockStora // check scalar interpolation { - Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); + Vector3<real_t> interpolationPoint(1.9_r, 2.1_r, 2.1_r); auto containingBlockID = blocks->getBlock(interpolationPoint); if( containingBlockID != nullptr ) { - real_t interpolatedValue(real_t(0)); + real_t interpolatedValue(0_r); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, real_t(1), "NearestNeighborFieldInterpolator: Scalar interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, 1_r, "NearestNeighborFieldInterpolator: Scalar interpolation failed"); } } // check vector interpolation { - Vector3<real_t> interpolationPoint(real_t(5.4),real_t(2.1),real_t(3.2)); + Vector3<real_t> interpolationPoint(5.4_r,2.1_r,3.2_r); auto containingBlockID = blocks->getBlock( interpolationPoint ); if( containingBlockID != nullptr ) { - Vector3<real_t> interpolatedValue(real_t(0)); + Vector3<real_t> interpolatedValue(0_r); auto interPtr = containingBlockID->getData<Vec3FieldInterpolator_T>(vectorFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], real_t(5), "NearestNeighborFieldInterpolator: Vec3[0] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], real_t(2), "NearestNeighborFieldInterpolator: Vec3[1] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], real_t(2), "NearestNeighborFieldInterpolator: Vec3[2] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], 5_r, "NearestNeighborFieldInterpolator: Vec3[0] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], 2_r, "NearestNeighborFieldInterpolator: Vec3[1] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], 2_r, "NearestNeighborFieldInterpolator: Vec3[2] interpolation failed"); } } // check multi component interpolation { - Vector3<real_t> interpolationPoint(real_t(4.4),real_t(2.1),real_t(3.2)); + Vector3<real_t> interpolationPoint(4.4_r,2.1_r,3.2_r); auto containingBlockID = blocks->getBlock( interpolationPoint ); if( containingBlockID != nullptr ) { - std::vector<real_t> interpolatedValue(3, real_t(0)); + std::vector<real_t> interpolatedValue(3, 0_r); auto interPtr = containingBlockID->getData<MultiComponentFieldInterpolator_T>(multiComponentFieldInterpolatorID); interPtr->get(interpolationPoint, interpolatedValue.begin()); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], real_t(4), "NearestNeighborFieldInterpolator: Multi Component[0] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], real_t(2), "NearestNeighborFieldInterpolator: Multi Component[1] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], real_t(2), "NearestNeighborFieldInterpolator: Multi Component[2] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], 4_r, "NearestNeighborFieldInterpolator: Multi Component[0] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], 2_r, "NearestNeighborFieldInterpolator: Multi Component[1] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], 2_r, "NearestNeighborFieldInterpolator: Multi Component[2] interpolation failed"); } } } @@ -180,42 +180,42 @@ void testTrilinearFieldInterpolator( const shared_ptr<StructuredBlockStorage> & // check scalar interpolation { - Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); + Vector3<real_t> interpolationPoint(1.9_r, 2.1_r, 2.1_r); auto containingBlockID = blocks->getBlock(interpolationPoint); if( containingBlockID != nullptr ) { - real_t interpolatedValue(real_t(0)); + real_t interpolatedValue(0_r); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, real_t(1.4), "TrilinearFieldInterpolator: Scalar interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, 1.4_r, "TrilinearFieldInterpolator: Scalar interpolation failed"); } } // check vector interpolation { - Vector3<real_t> interpolationPoint(real_t(5.4),real_t(2.1),real_t(3.2)); + Vector3<real_t> interpolationPoint(5.4_r,2.1_r,3.2_r); auto containingBlockID = blocks->getBlock( interpolationPoint ); if( containingBlockID != nullptr ) { - Vector3<real_t> interpolatedValue(real_t(0)); + Vector3<real_t> interpolatedValue(0_r); auto interPtr = containingBlockID->getData<Vec3FieldInterpolator_T>(vectorFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], real_t(4.9), "TrilinearFieldInterpolator: Vec3[0] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], real_t(2.0), "TrilinearFieldInterpolator: Vec3[1] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], real_t(1.6), "TrilinearFieldInterpolator: Vec3[2] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], 4.9_r, "TrilinearFieldInterpolator: Vec3[0] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], 2.0_r, "TrilinearFieldInterpolator: Vec3[1] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], 1.6_r, "TrilinearFieldInterpolator: Vec3[2] interpolation failed"); } } // check multi component interpolation { - Vector3<real_t> interpolationPoint(real_t(4.4),real_t(2.1),real_t(3.2)); + Vector3<real_t> interpolationPoint(4.4_r,2.1_r,3.2_r); auto containingBlockID = blocks->getBlock( interpolationPoint ); if( containingBlockID != nullptr ) { - std::vector<real_t> interpolatedValue(3, real_t(0)); + std::vector<real_t> interpolatedValue(3, 0_r); auto interPtr = containingBlockID->getData<MultiComponentFieldInterpolator_T>(multiComponentFieldInterpolatorID); interPtr->get(interpolationPoint, interpolatedValue.begin()); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], real_t(3.9), "TrilinearFieldInterpolator: Multi Component[0] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], real_t(2.0), "TrilinearFieldInterpolator: Multi Component[1] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], real_t(1.6), "TrilinearFieldInterpolator: Multi Component[2] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], 3.9_r, "TrilinearFieldInterpolator: Multi Component[0] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], 2.0_r, "TrilinearFieldInterpolator: Multi Component[1] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], 1.6_r, "TrilinearFieldInterpolator: Multi Component[2] interpolation failed"); } } } @@ -233,42 +233,42 @@ void testKernelFieldInterpolator( const shared_ptr<StructuredBlockStorage> & blo // check scalar interpolation { - Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); + Vector3<real_t> interpolationPoint(1.9_r, 2.1_r, 2.1_r); auto containingBlockID = blocks->getBlock(interpolationPoint); if( containingBlockID != nullptr ) { - real_t interpolatedValue(real_t(0)); + real_t interpolatedValue(0_r); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, real_t(1.4), "KernelFieldInterpolator: Scalar interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, 1.4_r, "KernelFieldInterpolator: Scalar interpolation failed"); } } // check vector interpolation { - Vector3<real_t> interpolationPoint(real_t(5.4),real_t(2.1),real_t(3.2)); + Vector3<real_t> interpolationPoint(5.4_r,2.1_r,3.2_r); auto containingBlockID = blocks->getBlock( interpolationPoint ); if( containingBlockID != nullptr ) { - Vector3<real_t> interpolatedValue(real_t(0)); + Vector3<real_t> interpolatedValue(0_r); auto interPtr = containingBlockID->getData<Vec3FieldInterpolator_T>(vectorFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], real_t(4.9), "KernelFieldInterpolator: Vec3[0] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], real_t(2.0), "KernelFieldInterpolator: Vec3[1] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], real_t(1.6), "KernelFieldInterpolator: Vec3[2] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], 4.9_r, "KernelFieldInterpolator: Vec3[0] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], 2.0_r, "KernelFieldInterpolator: Vec3[1] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], 1.6_r, "KernelFieldInterpolator: Vec3[2] interpolation failed"); } } // check multi component interpolation { - Vector3<real_t> interpolationPoint(real_t(4.4),real_t(2.1),real_t(3.2)); + Vector3<real_t> interpolationPoint(4.4_r,2.1_r,3.2_r); auto containingBlockID = blocks->getBlock( interpolationPoint ); if( containingBlockID != nullptr ) { - std::vector<real_t> interpolatedValue(3, real_t(0)); + std::vector<real_t> interpolatedValue(3, 0_r); auto interPtr = containingBlockID->getData<MultiComponentFieldInterpolator_T>(multiComponentFieldInterpolatorID); interPtr->get(interpolationPoint, interpolatedValue.begin()); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], real_t(3.9), "KernelFieldInterpolator: Multi Component[0] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], real_t(2.0), "KernelFieldInterpolator: Multi Component[1] interpolation failed"); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], real_t(1.6), "KernelFieldInterpolator: Multi Component[2] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[0], 3.9_r, "KernelFieldInterpolator: Multi Component[0] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[1], 2.0_r, "KernelFieldInterpolator: Multi Component[1] interpolation failed"); + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue[2], 1.6_r, "KernelFieldInterpolator: Multi Component[2] interpolation failed"); } } } @@ -282,26 +282,26 @@ void testNearestNeighborFieldInterpolatorAtBoundary( const shared_ptr<Structured // check scalar interpolation close to boundary { - Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); + Vector3<real_t> interpolationPoint(1.9_r, 2.1_r, 2.1_r); auto containingBlockID = blocks->getBlock(interpolationPoint); if (containingBlockID != nullptr) { - real_t interpolatedValue(real_t(0)); + real_t interpolatedValue(0_r); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, real_t(1), + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, 1_r, "NearestNeighborFieldInterpolator: Scalar interpolation near boundary failed"); } } // check scalar interpolation inside boundary { - Vector3<real_t> interpolationPoint(real_t(2.7), real_t(2.1), real_t(1.1)); + Vector3<real_t> interpolationPoint(2.7_r, 2.1_r, 1.1_r); auto containingBlockID = blocks->getBlock(interpolationPoint); if (containingBlockID != nullptr) { - real_t interpolatedValue(real_t(0)); + real_t interpolatedValue(0_r); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, real_t(3), + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, 3_r, "NearestNeighborFieldInterpolator: Scalar interpolation inside boundary failed"); } } @@ -315,26 +315,26 @@ void testTrilinearFieldInterpolatorAtBoundary( const shared_ptr<StructuredBlockS // check scalar interpolation close to boundary { - Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); + Vector3<real_t> interpolationPoint(1.9_r, 2.1_r, 2.1_r); auto containingBlockID = blocks->getBlock(interpolationPoint); if (containingBlockID != nullptr) { - real_t interpolatedValue(real_t(0)); + real_t interpolatedValue(0_r); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, real_t(1), + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, 1_r, "TrilinearFieldInterpolator: Scalar interpolation near boundary failed"); } } // check scalar interpolation inside boundary { - Vector3<real_t> interpolationPoint(real_t(2.7), real_t(2.1), real_t(1.1)); + Vector3<real_t> interpolationPoint(2.7_r, 2.1_r, 1.1_r); auto containingBlockID = blocks->getBlock(interpolationPoint); if (containingBlockID != nullptr) { - real_t interpolatedValue(real_t(0)); + real_t interpolatedValue(0_r); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); - WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, real_t(3), + WALBERLA_CHECK_FLOAT_EQUAL(interpolatedValue, 3_r, "TrilinearFieldInterpolator: Scalar interpolation inside boundary failed"); } } @@ -348,33 +348,33 @@ void testKernelFieldInterpolatorAtBoundary( const shared_ptr<StructuredBlockStor // check scalar interpolation close to boundary { - Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); + Vector3<real_t> interpolationPoint(1.9_r, 2.1_r, 2.1_r); auto containingBlockID = blocks->getBlock(interpolationPoint); if (containingBlockID != nullptr) { - real_t interpolatedValue(real_t(0)); + real_t interpolatedValue(0_r); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); // kernel interpolation can not extrapolate values from the available ones (see comments in KernelFieldInterpolator.h) // it will thus yield a value between the available ones, which are 0 and 1 - WALBERLA_CHECK(interpolatedValue < real_t(1), + WALBERLA_CHECK(interpolatedValue < 1_r, "KernelFieldInterpolator: Scalar interpolation near boundary failed"); - WALBERLA_CHECK(interpolatedValue > real_t(0), + WALBERLA_CHECK(interpolatedValue > 0_r, "KernelFieldInterpolator: Scalar interpolation near boundary failed"); } } // check scalar interpolation inside boundary { - Vector3<real_t> interpolationPoint(real_t(2.7), real_t(2.1), real_t(1.1)); + Vector3<real_t> interpolationPoint(2.7_r, 2.1_r, 1.1_r); auto containingBlockID = blocks->getBlock(interpolationPoint); if (containingBlockID != nullptr) { - real_t interpolatedValue(real_t(0)); + real_t interpolatedValue(0_r); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); // values has to be between the available ones, i.e. 1 and 3 - WALBERLA_CHECK(interpolatedValue > real_t(1), + WALBERLA_CHECK(interpolatedValue > 1_r, "KernelFieldInterpolator: Scalar interpolation inside boundary failed"); - WALBERLA_CHECK(interpolatedValue < real_t(3), + WALBERLA_CHECK(interpolatedValue < 3_r, "KernelFieldInterpolator: Scalar interpolation inside boundary failed"); } } @@ -387,7 +387,7 @@ int main(int argc, char **argv) { const uint_t numberOfBlocksInDirection = 2; const uint_t numberOfCellsPerBlockInDirection = 4; - const real_t dx = real_t(1); + const real_t dx = 1_r; // block storage auto blocks = blockforest::createUniformBlockGrid( numberOfBlocksInDirection, numberOfBlocksInDirection, numberOfBlocksInDirection, @@ -399,9 +399,9 @@ int main(int argc, char **argv) { BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers, false, initFlagField ); // data fields - BlockDataID scalarFieldID = field::addToStorage< ScalarField_T >( blocks, "scalar field", real_t(0), field::zyxf, FieldGhostLayers ); - BlockDataID vectorFieldID = field::addToStorage< Vec3Field_T >( blocks, "vec3 field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); - BlockDataID multiComponentFieldID = field::addToStorage< MultiComponentField_T >( blocks, "multi component field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID scalarFieldID = field::addToStorage< ScalarField_T >( blocks, "scalar field", 0_r, field::zyxf, FieldGhostLayers ); + BlockDataID vectorFieldID = field::addToStorage< Vec3Field_T >( blocks, "vec3 field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); + BlockDataID multiComponentFieldID = field::addToStorage< MultiComponentField_T >( blocks, "multi component field", 0_r, field::zyxf, FieldGhostLayers ); initScalarField(blocks, scalarFieldID); initVectorField(blocks, vectorFieldID ); diff --git a/tests/gather/CurveGatherTest.cpp b/tests/gather/CurveGatherTest.cpp index 362ea0fb..550be6c6 100644 --- a/tests/gather/CurveGatherTest.cpp +++ b/tests/gather/CurveGatherTest.cpp @@ -66,7 +66,7 @@ int main( int argc, char ** argv ) walberla::Environment walberlaEnv( argc, argv ); const real_t dx = real_c(0.1); - const walberla::uint_t cells = uint_c( real_t(1) / dx ); + const walberla::uint_t cells = uint_c( 1_r / dx ); const walberla::uint_t nrBlocks[] = { 2,2,1 }; using blockforest::createUniformBlockGrid; @@ -90,7 +90,7 @@ int main( int argc, char ** argv ) const char * curveZ = "0.499 * sin(t) + 0.5"; auto curvePackInfo = make_shared<CurveGatherPackInfo<GlField> >( blocks, fieldId, curveX, curveY, curveZ, - real_t(0), real_c(2 * 3.141), + 0_r, real_c(2 * 3.141), uint_t(100), gnuplotWriter ); MPIGatherScheme gatherScheme( blocks->getBlockStorage() ); diff --git a/tests/geometry/ScalarFieldFromBodyTest.cpp b/tests/geometry/ScalarFieldFromBodyTest.cpp index d6c29f3d..88c51d6a 100644 --- a/tests/geometry/ScalarFieldFromBodyTest.cpp +++ b/tests/geometry/ScalarFieldFromBodyTest.cpp @@ -47,7 +47,7 @@ using namespace geometry; const uint_t confBlockCount [] = { 1, 1, 1 }; const uint_t confCells [] = { 30, 30, 30 }; -const real_t PI = real_t(3.1415927); +const real_t PI = 3.1415927_r; const bool useGui = false; @@ -151,12 +151,12 @@ void ellipsoidTest( StructuredBlockStorage & storage, initializer::InitializationManager & manager, initializer::OverlapFieldFromBody & initializer ) { - const Vector3<real_t> midpoint ( real_t(15), real_t(15), real_t(15) ); - const Vector3<real_t> radii ( real_t(5), real_t(3), real_t(4) ); - const Vector3<real_t> axis1 ( real_t(1), real_t(1), real_t(0) ); - const Vector3<real_t> axis2 ( -real_t(1), real_t(1), real_t(0) ); + const Vector3<real_t> midpoint ( 15_r, 15_r, 15_r ); + const Vector3<real_t> radii ( 5_r, 3_r, 4_r ); + const Vector3<real_t> axis1 ( 1_r, 1_r, 0_r ); + const Vector3<real_t> axis2 ( -1_r, 1_r, 0_r ); - const real_t expectedVolume = real_t(4) / real_t(3) * radii[0] * radii[1] * radii[2] * PI; + const real_t expectedVolume = 4_r / 3_r * radii[0] * radii[1] * radii[2] * PI; resetField( storage, fieldID ); @@ -207,9 +207,9 @@ void sphereTest( StructuredBlockStorage & storage, initializer::InitializationManager & manager, initializer::OverlapFieldFromBody & initializer ) { - const Vector3<real_t> midpoint ( real_t(15), real_t(15), real_t(15) ); - const real_t radius = real_t(5); - const real_t expectedVolume = real_t(4) / real_t(3) * radius * radius * radius * PI; + const Vector3<real_t> midpoint ( 15_r, 15_r, 15_r ); + const real_t radius = 5_r; + const real_t expectedVolume = 4_r / 3_r * radius * radius * radius * PI; resetField( storage, fieldID ); diff --git a/tests/geometry/Statistics.impl.h b/tests/geometry/Statistics.impl.h index a76c43cb..adfdbb92 100644 --- a/tests/geometry/Statistics.impl.h +++ b/tests/geometry/Statistics.impl.h @@ -109,7 +109,7 @@ void ProcessStatistics<FlagFieldT>::updateOnProcess() real_t cellCount = blockStatistics_.numCells().sum(); real_t liquidCellCount = blockStatistics_.numLiquidCells().sum(); - real_t fractionLiquidCells = math::equal( cellCount, real_t(0) ) ? real_c(1) : liquidCellCount / cellCount; + real_t fractionLiquidCells = math::equal( cellCount, 0_r ) ? real_c(1) : liquidCellCount / cellCount; WALBERLA_ASSERT_GREATER_EQUAL( cellCount, liquidCellCount ); numCells_.insert( cellCount ); diff --git a/tests/gui/SimpleGuiRun.cpp b/tests/gui/SimpleGuiRun.cpp index cb8d39af..5160be17 100644 --- a/tests/gui/SimpleGuiRun.cpp +++ b/tests/gui/SimpleGuiRun.cpp @@ -73,8 +73,8 @@ int main(int argc, char **argv ) BlockDataID pdfField = lbm::addPdfFieldToStorage( blocks, "PdfField", latticeModel ); - BlockDataID scalarField1 = field::addToStorage<ScalarField>( blocks, "ScalarFieldOneGl", real_t(0), field::zyxf, 1 ); - BlockDataID scalarField2 = field::addToStorage<ScalarField>( blocks, "ScalarFieldTwoGl", real_t(0), field::zyxf, 2 ); + BlockDataID scalarField1 = field::addToStorage<ScalarField>( blocks, "ScalarFieldOneGl", 0_r, field::zyxf, 1 ); + BlockDataID scalarField2 = field::addToStorage<ScalarField>( blocks, "ScalarFieldTwoGl", 0_r, field::zyxf, 2 ); BlockDataID vectorField = field::addToStorage<VectorField>( blocks, "VectorField", Vector3<real_t>(0,0,0) ); BlockDataID flagField = field::addFlagFieldToStorage<FField>( blocks, "FlagField" ); diff --git a/tests/lbm/BoundaryHandlingCommunication.cpp b/tests/lbm/BoundaryHandlingCommunication.cpp index 781b7ca9..86ed638c 100644 --- a/tests/lbm/BoundaryHandlingCommunication.cpp +++ b/tests/lbm/BoundaryHandlingCommunication.cpp @@ -73,7 +73,7 @@ const FlagUID UBB_Flag( "velocity bounce back" ); const FlagUID NoSlip_Flag( "no slip" ); const uint_t FieldGhostLayers = uint_t(1); -const real_t GlobalOmega = real_t(1.4); +const real_t GlobalOmega = 1.4_r; @@ -148,7 +148,7 @@ MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block, const Stru // velocity bounce back ball :-) - const Vector3<real_t> center( real_t(36), real_t(27), real_t(33) ); + const Vector3<real_t> center( 36_r, 27_r, 33_r ); const real_t sqrRadius( real_t(7*7) ); for( auto cell = flagField->beginWithGhostLayer(); cell != flagField->end(); ++cell ) @@ -162,7 +162,7 @@ MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block, const Stru Vector3<real_t> distance = center - cellCenter; if( distance.sqrLength() <= sqrRadius ) - boundaryHandling->forceBoundary( UBB_Flag, x, y, z, typename UBB_T::Velocity( velocity_, real_t(0), real_t(0) ) ); + boundaryHandling->forceBoundary( UBB_Flag, x, y, z, typename UBB_T::Velocity( velocity_, 0_r, 0_r ) ); } boundaryHandling->fillWithDomain( domainBB ); @@ -255,7 +255,7 @@ int main( int argc, char ** argv ) uint_t(2), uint_t(2), uint_t(2), true, false, false ); // periodicty - const real_t velocity = real_t(0.0005); + const real_t velocity = 0.0005_r; #ifdef TEST_USES_VTK_OUTPUT SweepTimeloop timeloop( blocks->getBlockStorage(), uint_t(201) ); diff --git a/tests/lbm/DiffusionTest.cpp b/tests/lbm/DiffusionTest.cpp index c1aa8450..54c439e2 100644 --- a/tests/lbm/DiffusionTest.cpp +++ b/tests/lbm/DiffusionTest.cpp @@ -105,13 +105,13 @@ BlockDataID createAdvDiffPdfField( shared_ptr<StructuredBlockStorage> blockStora template< > BlockDataID createAdvDiffPdfField<AdvDiffLatticeModel_Corr>( shared_ptr<StructuredBlockStorage> blockStorage, const BlockDataID & oldMomDensity, real_t omega ){ AdvDiffLatticeModel_Corr advDiffLatticeModel = AdvDiffLatticeModel_Corr( lbm::collision_model::SRT( omega ), lbm::force_model::Correction<VectorField>( oldMomDensity ) ); - return lbm::addPdfFieldToStorage( blockStorage, "PDF field", advDiffLatticeModel, vec3_t(), real_t(0) ); + return lbm::addPdfFieldToStorage( blockStorage, "PDF field", advDiffLatticeModel, vec3_t(), 0_r ); } template< > BlockDataID createAdvDiffPdfField<AdvDiffLatticeModel_None>( shared_ptr<StructuredBlockStorage> blockStorage, const BlockDataID &, real_t omega ){ AdvDiffLatticeModel_None advDiffLatticeModel = AdvDiffLatticeModel_None( lbm::collision_model::SRT( omega ) ); - return lbm::addPdfFieldToStorage( blockStorage, "PDF field", advDiffLatticeModel, vec3_t(), real_t(0) ); + return lbm::addPdfFieldToStorage( blockStorage, "PDF field", advDiffLatticeModel, vec3_t(), 0_r ); } //******************************************************************************************************************************** @@ -178,8 +178,8 @@ int run( int argc, char **argv ) #endif // --- physical default values --- // - const real_t size[] = { real_t(1), real_t(1), real_t(1) }; - const real_t v = real_t(1); + const real_t size[] = { 1_r, 1_r, 1_r }; + const real_t v = 1_r; real_t time = real_t( 0.2 ); real_t err = real_t( 0 ); @@ -226,8 +226,8 @@ int run( int argc, char **argv ) if(!quiet) WALBERLA_LOG_RESULT( "Simulate " << cells[dim] << " cells in " << timesteps << " timesteps " ); const real_t D = d * dt / dx / dx; - const real_t tau = real_t(3) * D + real_c(0.5); - const real_t omega = real_t(1) / tau; + const real_t tau = 3_r * D + real_c(0.5); + const real_t omega = 1_r / tau; vec3_t u; u[dim] = u_in; @@ -236,8 +236,8 @@ int run( int argc, char **argv ) if(!quiet) WALBERLA_LOG_RESULT( " -> u = " << u ); if(!quiet) WALBERLA_LOG_RESULT( " -> tau = " << tau ); - const real_t tperiod = real_t(2) * math::PI / real_c( timesteps ); - const real_t cperiod = real_t(2) * math::PI / real_c( cells[dim] ); + const real_t tperiod = 2_r * math::PI / real_c( timesteps ); + const real_t cperiod = 2_r * math::PI / real_c( cells[dim] ); // --- create blockstorage --- // auto blockStorage = blockforest::createUniformBlockGrid( @@ -257,9 +257,9 @@ int run( int argc, char **argv ) BlockDataID flagFieldID = blockStorage->template addStructuredBlockData<MyFlagField>( &flagFieldCreationFunction, "Flag field" ); // --- additional sweep variables --- // - real_t E_mean_ ( real_t(0) ); + real_t E_mean_ ( 0_r ); uint_t timestep( uint_t(0u) ); - real_t cosi(real_t(0)), sisi(real_t(0)), sexp(real_t(0)); + real_t cosi(0_r), sisi(0_r), sexp(0_r); // --- data init --- // for( auto block = blockStorage->begin(); block != blockStorage->end(); ++block ){ @@ -325,7 +325,7 @@ int run( int argc, char **argv ) } E_mean_ /= real_c(timesteps) * real_c(cells[dim]); - if( err > real_t(0) && E_mean_ > err ){ + if( err > 0_r && E_mean_ > err ){ WALBERLA_ABORT( "E_mean = " << E_mean_ << " > " << err ); } else { if(!quiet) WALBERLA_LOG_RESULT( "E^2 = " << E_mean_ << " E^1 = " << sqrt(E_mean_) ); diff --git a/tests/lbm/Poiseuille.cpp b/tests/lbm/Poiseuille.cpp index fecccb13..6457933a 100644 --- a/tests/lbm/Poiseuille.cpp +++ b/tests/lbm/Poiseuille.cpp @@ -138,7 +138,7 @@ private: /// returns relative error per point real_t compareToAnalyticalSolution( const std::vector<std::vector<real_t> > & data ) { - real_t geometryFactor = pipeOrBox_ ? real_t(4) : real_t(2); + real_t geometryFactor = pipeOrBox_ ? 4_r : 2_r; size_t maxErrPosition = data.size()+5; real_t maxErr = -1; @@ -214,10 +214,10 @@ int main( int argc, char** argv ) real_t omega = appConfig.getParameter<real_t> ("omega"); real_t viscosity = appConfig.getParameter<real_t> ("viscosity"); uint_t nrOfCells [3] = { cellsPerDiameter + 2, cellsPerDiameter + 2, nrCellsZ +2 }; - real_t dt = ( real_t(2) - omega ) * dx * dx / ( real_t(6) * omega * viscosity ); + real_t dt = ( 2_r - omega ) * dx * dx / ( 6_r * omega * viscosity ); //real_t viscosity_l = viscosity * dt / ( dx * dx ); - //real_t requiredAccuracy = appConfig.getParameter<real_t>("requiredAccuracy", real_t(0) ); + //real_t requiredAccuracy = appConfig.getParameter<real_t>("requiredAccuracy", 0_r ); // ----------------------------- Create Block Structure --------------------------------------------- @@ -261,7 +261,7 @@ int main( int argc, char** argv ) auto latticeModel = LM ( SRT( omega ), GuoConstant( Vector3<real_t>() ) ); // force is set by initializer - BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "PdfField", latticeModel, Vector3<real_t>(0), real_t(1) ); + BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "PdfField", latticeModel, Vector3<real_t>(0), 1_r ); BlockDataID flagFieldID = field::addFlagFieldToStorage<FField>( blocks, "Flag Field" ); @@ -276,7 +276,7 @@ int main( int argc, char** argv ) const FlagUID fluidFlagUID( "Fluid" ); BlockDataID boundaryHandlingId = BHFactory::addBoundaryHandlingToStorage( blocks, "boundary handling", flagFieldID, pdfFieldID, fluidFlagUID, - Vector3<real_t>(), Vector3<real_t>(), real_t(0), real_t(0) ); + Vector3<real_t>(), Vector3<real_t>(), 0_r, 0_r ); //typedef field::ComponentExtractionAdaptor< VelocityAdaptor, 0, 2 > ZVelExtractor; diff --git a/tests/lbm/SweepEquivalenceTest.cpp b/tests/lbm/SweepEquivalenceTest.cpp index 2c8f0e15..ec5b9b03 100644 --- a/tests/lbm/SweepEquivalenceTest.cpp +++ b/tests/lbm/SweepEquivalenceTest.cpp @@ -81,9 +81,9 @@ const FlagUID NoSlip_Flag( "no slip" ); const uint_t FieldSize = uint_t(10); const uint_t FieldGhostLayers = uint_t(1); -const real_t GlobalOmega = real_t(1.4); -const real_t GlobalLambdaE = real_t(1.8); -const real_t GlobalLambdaD = real_t(1.7); +const real_t GlobalOmega = 1.4_r; +const real_t GlobalLambdaE = 1.8_r; +const real_t GlobalLambdaD = 1.7_r; @@ -166,7 +166,7 @@ void addTest( shared_ptr< StructuredBlockForest > & blocks, SweepTimeloop & time const char * fieldName ) { fieldIds.push_back( lbm::addPdfFieldToStorage( blocks, std::string("pdf field ") + std::string(fieldName), - latticeModel, Vector3<real_t>( velocity, velocity / real_t(2), velocity / real_t(4) ), real_t(1), + latticeModel, Vector3<real_t>( velocity, velocity / 2_r, velocity / 4_r ), 1_r, FieldGhostLayers, layout ) ); BlockDataID boundaryHandlingId = blocks->addStructuredBlockData< typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T >( @@ -353,7 +353,7 @@ int main( int argc, char ** argv ) std::vector< std::vector< BlockDataID > > fieldIds; - const real_t velocity = real_t(0.05); + const real_t velocity = 0.05_r; #ifdef TEST_USES_VTK_OUTPUT auto pdfFieldVTKWriter = vtk::createVTKOutput_BlockData( blocks, "pdf_field", uint_t(10) ); diff --git a/tests/lbm/boundary/DiffusionDirichlet.cpp b/tests/lbm/boundary/DiffusionDirichlet.cpp index 79cee7c4..ce0fc657 100644 --- a/tests/lbm/boundary/DiffusionDirichlet.cpp +++ b/tests/lbm/boundary/DiffusionDirichlet.cpp @@ -107,10 +107,10 @@ public: using cplx_t = std::complex<real_t>; PlugFlow( real_t L, real_t H, real_t u, real_t k ) : - period_( real_t(2)*math::PI/L ), - lambda_( period_*sqrt( cplx_t(real_t(1), u/k/period_) ) ), - emH_ ( real_t(1) - exp(-lambda_*H) ), - epH_ ( real_t(1) - exp(+lambda_*H) ), + period_( 2_r*math::PI/L ), + lambda_( period_*sqrt( cplx_t(1_r, u/k/period_) ) ), + emH_ ( 1_r - exp(-lambda_*H) ), + epH_ ( 1_r - exp(+lambda_*H) ), eeH_ ( emH_ - epH_ ){} inline real_t operator()( real_t x, real_t y ) @@ -120,10 +120,10 @@ public: const cplx_t epy = exp(+ly); #if 1 // exact solution - return std::real( exp( cplx_t(real_t(0),period_*x) ) * ( emH_*epy - epH_*emy ) / eeH_ ); + return std::real( exp( cplx_t(0_r,period_*x) ) * ( emH_*epy - epH_*emy ) / eeH_ ); #else // integral solution - return std::imag( exp( cplx_t(real_t(0),period_*x) ) * ( emH_*epy + epH_*emy ) / ( eeH_ * period_ * lambda_ ) ); + return std::imag( exp( cplx_t(0_r,period_*x) ) * ( emH_*epy + epH_*emy ) / ( eeH_ * period_ * lambda_ ) ); #endif } @@ -139,7 +139,7 @@ private: class TestSweep{ public: TestSweep( ConstBlockDataID pdfFieldID, real_t omega, real_t velocity, real_t error ) : - pdfFieldID_(pdfFieldID), k_((real_t(1)/omega-real_c(0.5))/real_t(3)), velocity_(velocity), error_(error){} + pdfFieldID_(pdfFieldID), k_((1_r/omega-real_c(0.5))/3_r), velocity_(velocity), error_(error){} void operator()( IBlock* block ); private: @@ -158,7 +158,7 @@ void TestSweep::operator()( IBlock* block ) const uint_t sy = srcPDF_->ySize(); const uint_t sz = srcPDF_->zSize(); - real_t snumerical( real_t(0) ), sanalytical( real_t(0) ); + real_t snumerical( 0_r ), sanalytical( 0_r ); PlugFlow pf( real_c(sx), real_c(sy), velocity_, k_ ); @@ -234,12 +234,12 @@ int main( int argc, char **argv ) WALBERLA_LOG_WARNING( "Ignore unknown option " << argv[i++] ); } } - vec3_t velocity( velx, real_t(0), real_t(0) ); + vec3_t velocity( velx, 0_r, 0_r ); auto blockStorage = blockforest::createUniformBlockGrid( 1, 1, 1, // blocks/processes in x/y/z direction length, length, width, // cells per block in x/y/z direction - real_t(1), // cell size + 1_r, // cell size true, // one block per process true, false, true, // periodicity false ); @@ -248,11 +248,11 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<MyFlagField>( blockStorage, "Flag field" ); LM lm = LM( lbm::collision_model::SRT( omega ) ); - BlockDataID srcFieldID = lbm::addPdfFieldToStorage( blockStorage, "PDF AdDif field", lm, vec3_t(), real_t(0) ); + BlockDataID srcFieldID = lbm::addPdfFieldToStorage( blockStorage, "PDF AdDif field", lm, vec3_t(), 0_r ); BlockDataID boundaryHandling = MyBoundaryHandling::addDefaultDiffusionBoundaryHandlingToStorage( blockStorage, "BoundaryHandling", flagFieldID, getFluidFlag(), srcFieldID ); - auto cbc = make_shared<CosBoundaryConfiguration>( real_t(2)*math::PI/real_c(length) ); + auto cbc = make_shared<CosBoundaryConfiguration>( 2_r*math::PI/real_c(length) ); geometry::initializer::BoundaryFromDomainBorder<MyBoundaryHandling::BoundaryHandling_T> bfdb( *blockStorage, boundaryHandling ); bfdb.init( MyBoundaryHandling::getDiffusionDirichletBoundaryUID(), stencil::N, cbc, -1, 1 ); bfdb.init( MyBoundaryHandling::getDiffusionDirichletBoundaryUID(), stencil::S, cbc, -1, 1 ); diff --git a/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp b/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp index 30c95b82..31b18ec5 100644 --- a/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp +++ b/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp @@ -109,7 +109,7 @@ static void refinementSelection( SetupBlockForest& forest, const uint_t levels ) { const AABB & domain = forest.getDomain(); - const real_t domainxMax = domain.xMax() / real_c( pow( real_t(2), int_c( levels - uint_t(1u) ) ) ); + const real_t domainxMax = domain.xMax() / real_c( pow( 2_r, int_c( levels - uint_t(1u) ) ) ); AABB left( domain.xMin(), domain.yMin(), domain.zMin(), domainxMax, domain.yMax(), domain.zMax() ); @@ -142,7 +142,7 @@ shared_ptr< StructuredBlockForest > makeStructuredBlockStorage( uint_t length, u sforest.addWorkloadMemorySUIDAssignmentFunction( workloadAndMemoryAssignment ); sforest.init( - AABB( real_t(0), real_t(0), real_t(0), // blocks/processes in x/y/z direction + AABB( 0_r, 0_r, 0_r, // blocks/processes in x/y/z direction real_c(cells[0]), real_c(cells[1]), real_c(cells[2]) ), // cells per block in x/y/z direction blocks[0] , blocks[1] , blocks[2], // one block per process false , true , true); // periodicity @@ -150,7 +150,7 @@ shared_ptr< StructuredBlockForest > makeStructuredBlockStorage( uint_t length, u // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); MPIManager::instance()->useWorldComm(); @@ -188,8 +188,8 @@ void setFlags( shared_ptr< StructuredBlockForest > & blocks, const BlockDataID & domainBB.zMin() -= cell_idx_c( ghostLayers ); domainBB.zMax() += cell_idx_c( ghostLayers ); - MyBoundaryHandling::SimpleDiffusionDirichlet_T::ScalarConfiguration scl( real_t(1)+dv ); - MyBoundaryHandling::SimpleDiffusionDirichlet_T::ScalarConfiguration scr( real_t(1) ); + MyBoundaryHandling::SimpleDiffusionDirichlet_T::ScalarConfiguration scl( 1_r+dv ); + MyBoundaryHandling::SimpleDiffusionDirichlet_T::ScalarConfiguration scr( 1_r ); // LEFT CellInterval left( domainBB.xMin(), domainBB.yMin(), domainBB.zMin(), @@ -231,15 +231,15 @@ public: TestSweep( ConstBlockDataID pdfFieldID, real_t omega, real_t minValue, real_t maxValue, uint_t length, uint_t time, shared_ptr<StructuredBlockForest> & blocks ) : pdfFieldID_(pdfFieldID), blocks_ (blocks), - k_((real_t(1)/omega-real_c(0.5))/real_t(3)), + k_((1_r/omega-real_c(0.5))/3_r), minValue_(minValue), maxValue_(maxValue), delta_( maxValue - minValue), length_(real_c(length)), - lengthInv_(real_t(1)/real_c(length)), + lengthInv_(1_r/real_c(length)), pi_(math::PI), - piInv_(real_t(1)/math::PI), - valid_(uint_c(std::ceil(omega*omega*omega*real_t(10)))), + piInv_(1_r/math::PI), + valid_(uint_c(std::ceil(omega*omega*omega*10_r))), time_( time ), expArray(), timestep_( uint_t(0u) ), @@ -283,14 +283,14 @@ private: { const real_t xiL = x*lengthInv_; - real_t y = real_t(0); - real_t f = real_t(1); + real_t y = 0_r; + real_t f = 1_r; for ( uint_t n = 1; n<uint_t(1000u); ++n ){ const real_t npi = real_c(n)*pi_; - f *= -real_t(1); + f *= -1_r; y += f/real_c(n) * real_c( sin(npi*xiL) ) * expArray[n-1]; } - return delta_*(real_t(2)*y*piInv_ + xiL) + minValue_; + return delta_*(2_r*y*piInv_ + xiL) + minValue_; } @@ -298,14 +298,14 @@ private: { const real_t xiL = x*lengthInv_; - real_t y = real_t(0); - real_t f = real_t(1); + real_t y = 0_r; + real_t f = 1_r; for ( uint_t n = 1; n<uint_t(1000u); ++n ){ const real_t npi = real_c(n)*pi_; - f *= -real_t(1); + f *= -1_r; y -= f*length_/(real_c(n)*npi) * real_c(cos(npi*xiL)) * expArray[n-uint_t(1u)]; } - return delta_*(real_t(2)*y*piInv_ + real_c(0.5)*x*xiL) + x*minValue_; + return delta_*(2_r*y*piInv_ + real_c(0.5)*x*xiL) + x*minValue_; } }; @@ -315,19 +315,19 @@ void TestSweep::operator()() { ++timestep_; - E_mean_ = real_t(0); - real_t E_max = real_t(0); + E_mean_ = 0_r; + real_t E_max = 0_r; uint_t blockcount = uint_t(0u); //loop block for( auto block = blocks_->begin(); block != blocks_->end(); ++block, ++blockcount ) { - real_t E_mean = real_t(0); + real_t E_mean = 0_r; Cell localCell, globalCell; const uint_t level = blocks_->getLevel(*block); const real_t ktiLL = -k_*real_c(timestep_)*lengthInv_*lengthInv_; - const real_t pow2level = real_c( pow( real_t(2), int_c(level) ) ); + const real_t pow2level = real_c( pow( 2_r, int_c(level) ) ); for ( uint_t n = 1; n<1000; ++n ){ const real_t npi = real_c(n)*pi_; @@ -383,7 +383,7 @@ void TestSweep::operator()() //WALBERLA_LOG_RESULT( "Last Analytical: " << analytical << " and Last Numerical: " << lastNumerical ); } - //E_max /= pow( real_t(8),real_c(level) ); + //E_max /= pow( 8_r,real_c(level) ); E_mean /= real_c( sx*sy*sz ) * real_c( pow( real_t( 8 ), int_c( level ) ) ); E_mean_ += E_mean; } @@ -455,7 +455,7 @@ int main( int argc, char **argv ) auto blockStorage = makeStructuredBlockStorage( length, width, levels ); LM lm = LM( lbm::collision_model::SRT( omega ) ); - BlockDataID advDiffFieldID = lbm::addPdfFieldToStorage( blockStorage, "PDF field", lm, Vector3<real_t>(), real_t(1), ghostLayers ); + BlockDataID advDiffFieldID = lbm::addPdfFieldToStorage( blockStorage, "PDF field", lm, Vector3<real_t>(), 1_r, ghostLayers ); BlockDataID flagFieldID = field::addFlagFieldToStorage<MyFlagField>( blockStorage, "Flag field", ghostLayers ); BlockDataID velFieldID = field::addToStorage<VectorField>( blockStorage, "Velocity field", Vector3<real_t>() ); @@ -465,7 +465,7 @@ int main( int argc, char **argv ) setFlags( blockStorage, boundaryHandling, ghostLayers, closed, dv ); SweepTimeloop timeloop( blockStorage->getBlockStorage(), time ); - timeloop.addFuncAfterTimeStep( TestSweep(advDiffFieldID, omega, real_t(1), real_t(1)+dv, length, time, blockStorage ),"check error! "); + timeloop.addFuncAfterTimeStep( TestSweep(advDiffFieldID, omega, 1_r, 1_r+dv, length, time, blockStorage ),"check error! "); if( levels == uint_t(1u) ) { diff --git a/tests/lbm/boundary/SimplePABTest.cpp b/tests/lbm/boundary/SimplePABTest.cpp index 31bc21a7..f207127e 100644 --- a/tests/lbm/boundary/SimplePABTest.cpp +++ b/tests/lbm/boundary/SimplePABTest.cpp @@ -92,7 +92,7 @@ shared_ptr< StructuredBlockForest > makeStructuredBlockStorage( uint_t channelWi return blockforest::createUniformBlockGrid( processes[0], processes[1], processes[2], // blocks/processes in x/y/z direction blockSize[0], blockSize[1], blockSize[2], // cells per block in x/y/z direction - real_t(1), // cell size + 1_r, // cell size true, // one block per process false, false, false, // periodicity false ); @@ -238,7 +238,7 @@ int main( int argc, char **argv ) BlockDataID boundaryHandling = blockStorage->addStructuredBlockData( "Boundary Handling" ) << StructuredBlockDataCreator<BoundaryHandlingCreator::BoundaryHandlingT>( - BoundaryHandlingCreator(flagField, pdfField, real_t(1), real_t(1) + deltaDensity, channelLength, channelWidth, omega ) ); + BoundaryHandlingCreator(flagField, pdfField, 1_r, 1_r + deltaDensity, channelLength, channelWidth, omega ) ); SweepTimeloop timeloop( blockStorage->getBlockStorage(), numTimesteps ); diff --git a/tests/lbm/codegen/SrtWithForceField.cpp b/tests/lbm/codegen/SrtWithForceField.cpp index 57e8674b..3e384e45 100644 --- a/tests/lbm/codegen/SrtWithForceField.cpp +++ b/tests/lbm/codegen/SrtWithForceField.cpp @@ -68,10 +68,10 @@ int main( int argc, char ** argv ) const double remainingTimeLoggerFrequency = parameters.getParameter< double >( "remainingTimeLoggerFrequency", 3.0 ); // in seconds // create fields - BlockDataID forceFieldId = field::addToStorage<ForceField_T>(blocks, "Force", real_t(0.0) ); + BlockDataID forceFieldId = field::addToStorage<ForceField_T>(blocks, "Force", 0.0_r ); LatticeModel_T latticeModel = LatticeModel_T( forceFieldId, omega ); - BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, real_t(1) ); + BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, 1_r ); BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" ); // create and initialize boundary handling diff --git a/tests/lbm/evaluations/PermeabilityTest.cpp b/tests/lbm/evaluations/PermeabilityTest.cpp index 022ad278..8b8bd91f 100644 --- a/tests/lbm/evaluations/PermeabilityTest.cpp +++ b/tests/lbm/evaluations/PermeabilityTest.cpp @@ -101,13 +101,13 @@ real_t permeability( Setup setup ) { // BCC implementation const real_t L = real_c(setup.length); - const real_t r = real_c(std::sqrt(real_t(3.0))) / real_t(4) * L * setup.kappa; + const real_t r = real_c(std::sqrt(3.0_r)) / 4_r * L * setup.kappa; real_t drag( 0.0 ); for( uint_t i = 0; i < 31; i++ ) drag += real_c(qs[i]) * real_c(std::pow( setup.kappa, real_c(i) )); - return ( L * L * L ) / ( real_t(6) * math::PI * r * real_t(2) * drag ); + return ( L * L * L ) / ( 6_r * math::PI * r * 2_r * drag ); } @@ -120,7 +120,7 @@ BlockDataID initPdfField< lbm::collision_model::SRT >( const shared_ptr<Structur using LatticeModel_T = lbm::D3Q19<lbm::collision_model::SRT>; LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::SRT( omega ) ); - return lbm::addPdfFieldToStorage( blocks, "PDF Field (SRT)", latticeModel, Vector3<real_t>(), real_t(1) ); + return lbm::addPdfFieldToStorage( blocks, "PDF Field (SRT)", latticeModel, Vector3<real_t>(), 1_r ); } template< > @@ -129,7 +129,7 @@ BlockDataID initPdfField< lbm::collision_model::TRT >( const shared_ptr<Structur using LatticeModel_T = lbm::D3Q19<lbm::collision_model::TRT>; LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega ) ); - return lbm::addPdfFieldToStorage( blocks, "PDF Field (TRT)", latticeModel, Vector3<real_t>(), real_t(1) ); + return lbm::addPdfFieldToStorage( blocks, "PDF Field (TRT)", latticeModel, Vector3<real_t>(), 1_r ); } template< > @@ -138,7 +138,7 @@ BlockDataID initPdfField< lbm::collision_model::D3Q19MRT >( const shared_ptr<Str using LatticeModel_T = lbm::D3Q19<lbm::collision_model::D3Q19MRT>; LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::D3Q19MRT::constructPanWithMagicNumber( omega ) ); - return lbm::addPdfFieldToStorage( blocks, "PDF Field (MRT)", latticeModel, Vector3<real_t>(), real_t(1) ); + return lbm::addPdfFieldToStorage( blocks, "PDF Field (MRT)", latticeModel, Vector3<real_t>(), 1_r ); } template< > @@ -147,7 +147,7 @@ BlockDataID initPdfField< lbm::collision_model::D3Q27Cumulant >( const shared_pt typedef lbm::D3Q27< lbm::collision_model::D3Q27Cumulant, true > LatticeModel_T; LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::D3Q27Cumulant( omega ) ); - return lbm::addPdfFieldToStorage( blocks, "PDF Field (Cumulant)", latticeModel, Vector3<real_t>(), real_t(1) ); + return lbm::addPdfFieldToStorage( blocks, "PDF Field (Cumulant)", latticeModel, Vector3<real_t>(), 1_r ); } diff --git a/tests/lbm/geometry/IntersectionRatioTest.cpp b/tests/lbm/geometry/IntersectionRatioTest.cpp index a252f9b6..b2c01b4b 100644 --- a/tests/lbm/geometry/IntersectionRatioTest.cpp +++ b/tests/lbm/geometry/IntersectionRatioTest.cpp @@ -34,7 +34,7 @@ namespace walberla { void testPointUnitSphere( const math::Vector3<real_t> & p ) { static const geometry::Sphere UNIT_SPHERE( math::Vector3<real_t>( 0, 0, 0 ), real_t( 1 ) ); - static const real_t EPSILON = real_t(1e-4); + static const real_t EPSILON = 1e-4_r; real_t q = lbm::intersectionRatioBisection( UNIT_SPHERE, p, -p, EPSILON ); @@ -75,7 +75,7 @@ void testAABB() static const math::Vector3<real_t> ZERO( real_t( 0 ), real_t( 0 ), real_t( 0 ) ); static const math::Vector3<real_t> UNIT( real_t( 1 ), real_t( 1 ), real_t( 1 ) ); - static const real_t EPSILON = real_t(1e-4); + static const real_t EPSILON = 1e-4_r; std::mt19937 randomEngine; diff --git a/tests/lbm/refinement/CommunicationEquivalence.cpp b/tests/lbm/refinement/CommunicationEquivalence.cpp index 150f7894..85437924 100644 --- a/tests/lbm/refinement/CommunicationEquivalence.cpp +++ b/tests/lbm/refinement/CommunicationEquivalence.cpp @@ -120,9 +120,9 @@ static void refinementSelection( SetupBlockForest& forest, const uint_t levels ) { AABB topCorner( domain.xMin(), domain.yMin(), - domain.zMax() - domain.zMax() / real_t(14), - domain.xMin() + domain.xMax() / real_t(14), - domain.yMin() + domain.yMax() / real_t(14), + domain.zMax() - domain.zMax() / 14_r, + domain.xMin() + domain.xMax() / 14_r, + domain.yMin() + domain.yMax() / 14_r, domain.zMax() ); for( auto block = forest.begin(); block != forest.end(); ++block ) @@ -134,13 +134,13 @@ static void refinementSelection( SetupBlockForest& forest, const uint_t levels ) } else if( testMode == MIDDLE ) { - const real_t xSpan = domain.xSize() / real_t(32); - const real_t ySpan = domain.ySize() / real_t(32); - const real_t zSpan = domain.zSize() / real_t(32); + const real_t xSpan = domain.xSize() / 32_r; + const real_t ySpan = domain.ySize() / 32_r; + const real_t zSpan = domain.zSize() / 32_r; - const real_t xMiddle = ( domain.xMin() + domain.xMax() ) / real_t(2); - const real_t yMiddle = ( domain.yMin() + domain.yMax() ) / real_t(2); - const real_t zMiddle = ( domain.zMin() + domain.zMax() ) / real_t(2); + const real_t xMiddle = ( domain.xMin() + domain.xMax() ) / 2_r; + const real_t yMiddle = ( domain.yMin() + domain.yMax() ) / 2_r; + const real_t zMiddle = ( domain.zMin() + domain.zMax() ) / 2_r; AABB middleBox( xMiddle - xSpan, yMiddle - ySpan, zMiddle - zSpan, xMiddle + xSpan, yMiddle + ySpan, zMiddle + zSpan ); @@ -193,7 +193,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const uint_t le // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); @@ -300,12 +300,12 @@ shared_ptr< vtk::VTKOutput> createFluidFieldVTKWriter( shared_ptr< StructuredBlo combine.addFilter( fluidFilter ); if( testMode == MIDDLE ) { - vtk::AABBCellFilter aabbFilter( AABB( aabb.xMin(), real_t(7), aabb.zMin(), aabb.xMax(), real_t(8), aabb.zMax() ) ); + vtk::AABBCellFilter aabbFilter( AABB( aabb.xMin(), 7_r, aabb.zMin(), aabb.xMax(), 8_r, aabb.zMax() ) ); combine.addFilter( aabbFilter ); } else { - vtk::AABBCellFilter aabbFilter( AABB( aabb.xMin(), real_t(1), aabb.zMin(), aabb.xMax(), real_t(2), aabb.zMax() ) ); + vtk::AABBCellFilter aabbFilter( AABB( aabb.xMin(), 1_r, aabb.zMin(), aabb.xMax(), 2_r, aabb.zMax() ) ); combine.addFilter( aabbFilter ); } pdfFieldVTKWriter->addCellInclusionFilter( combine ); @@ -405,9 +405,9 @@ int main( int argc, char ** argv ) auto blocks = createBlockStructure( levels, xBlocks, yBlocks, zBlocks, xCells, yCells, zCells, true, true, false ); - const real_t Re = real_t(10); + const real_t Re = 10_r; const real_t omega = ( testMode == ENTIRE_TOP || testMode == ENTIRE_BOTTOM ) ? real_c(1.9) : real_c(1.3); - const real_t nu = ( real_t(1) / omega - real_c(0.5) ) / real_t(3); + const real_t nu = ( 1_r / omega - real_c(0.5) ) / 3_r; const real_t L = real_c( zBlocks * zCells ); const real_t topVelocity = ( Re * nu ) / L; @@ -429,11 +429,11 @@ int main( int argc, char ** argv ) BlockDataID pdfFieldId1 = lbm::addPdfFieldToStorage( blocks, "pdf field (1)", latticeModel, Vector3< real_t >( topVelocity / real_c(2), real_c(0), real_c(0) ), - real_t(1), FieldGhostLayers ); + 1_r, FieldGhostLayers ); BlockDataID pdfFieldId2 = lbm::addPdfFieldToStorage( blocks, "pdf field (2)", latticeModel, Vector3< real_t >( topVelocity / real_c(2), real_c(0), real_c(0) ), - real_t(1), FieldGhostLayers ); + 1_r, FieldGhostLayers ); BlockDataID flagFieldId1 = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field (1)", FieldGhostLayers ); BlockDataID flagFieldId2 = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field (2)", FieldGhostLayers ); diff --git a/tests/lbm/refinement/NonConstantDiffusion.cpp b/tests/lbm/refinement/NonConstantDiffusion.cpp index 83ac2f98..f5912ac9 100644 --- a/tests/lbm/refinement/NonConstantDiffusion.cpp +++ b/tests/lbm/refinement/NonConstantDiffusion.cpp @@ -109,7 +109,7 @@ static void refinementSelection( SetupBlockForest& forest, const uint_t levels ) { const AABB & domain = forest.getDomain(); - const real_t domainxMax = domain.xMax() / real_c( pow( real_t(2), int_c( levels - uint_t(1u) ) ) ); + const real_t domainxMax = domain.xMax() / real_c( pow( 2_r, int_c( levels - uint_t(1u) ) ) ); AABB left( domain.xMin(), domain.yMin(), domain.zMin(), domainxMax, domain.yMax(), domain.zMax() ); @@ -142,7 +142,7 @@ shared_ptr< StructuredBlockForest > makeStructuredBlockStorage( uint_t length, u sforest.addWorkloadMemorySUIDAssignmentFunction( workloadAndMemoryAssignment ); sforest.init( - AABB( real_t(0), real_t(0), real_t(0), // blocks/processes in x/y/z direction + AABB( 0_r, 0_r, 0_r, // blocks/processes in x/y/z direction real_c(cells[0]), real_c(cells[1]), real_c(cells[2]) ), // cells per block in x/y/z direction blocks[0] , blocks[1] , blocks[2], // one block per process false , true , true); // periodicity @@ -150,7 +150,7 @@ shared_ptr< StructuredBlockForest > makeStructuredBlockStorage( uint_t length, u // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); MPIManager::instance()->useWorldComm(); diff --git a/tests/lbm/refinement/Uniformity.cpp b/tests/lbm/refinement/Uniformity.cpp index cd6eda7c..cc137b93 100644 --- a/tests/lbm/refinement/Uniformity.cpp +++ b/tests/lbm/refinement/Uniformity.cpp @@ -109,19 +109,19 @@ static void refinementSelection( SetupBlockForest& forest, const uint_t levels ) { const AABB & domain = forest.getDomain(); - const real_t xSpan = domain.xSize() / real_t(32); - const real_t ySpan = domain.ySize() / real_t(32); - const real_t zSpan = domain.zSize() / real_t(64); + const real_t xSpan = domain.xSize() / 32_r; + const real_t ySpan = domain.ySize() / 32_r; + const real_t zSpan = domain.zSize() / 64_r; - const real_t xMiddle = ( domain.xMin() + domain.xMax() ) / real_t(2); - const real_t yMiddle = ( domain.yMin() + domain.yMax() ) / real_t(2); - const real_t zMiddle = ( domain.zMin() + domain.zMax() ) / real_t(2); + const real_t xMiddle = ( domain.xMin() + domain.xMax() ) / 2_r; + const real_t yMiddle = ( domain.yMin() + domain.yMax() ) / 2_r; + const real_t zMiddle = ( domain.zMin() + domain.zMax() ) / 2_r; AABB middleBox( xMiddle - xSpan, yMiddle - ySpan, zMiddle + zSpan, - xMiddle + xSpan, yMiddle + ySpan, zMiddle + real_t(3) * zSpan ); + xMiddle + xSpan, yMiddle + ySpan, zMiddle + 3_r * zSpan ); AABB shiftedBox( xMiddle + xSpan, yMiddle + ySpan, zMiddle + zSpan, - xMiddle + real_t(3) * xSpan, yMiddle + real_t(3) * ySpan, zMiddle + real_t(3) * zSpan ); + xMiddle + 3_r * xSpan, yMiddle + 3_r * ySpan, zMiddle + 3_r * zSpan ); for( auto block = forest.begin(); block != forest.end(); ++block ) { @@ -160,7 +160,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const uint_t le // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); @@ -227,7 +227,7 @@ shared_ptr< vtk::VTKOutput> createFluidFieldVTKWriter( shared_ptr< StructuredBlo #endif const auto & aabb = blocks->getDomain(); - vtk::AABBCellFilter aabbFilter( AABB( aabb.xMin(), real_t(19), aabb.zMin(), aabb.xMax(), real_t(20), aabb.zMax() ) ); + vtk::AABBCellFilter aabbFilter( AABB( aabb.xMin(), 19_r, aabb.zMin(), aabb.xMax(), 20_r, aabb.zMax() ) ); pdfFieldVTKWriter->addCellInclusionFilter( aabbFilter ); auto velocityWriter = make_shared< lbm::VelocityVTKWriter< LatticeModel_T, float > >( pdfFieldId, "VelocityFromPDF" ); @@ -337,7 +337,7 @@ int main( int argc, char ** argv ) //LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::D3Q19MRT::constructTRT( omega, lbm::collision_model::TRT::lambda_d( omega ) ) ); //LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::D3Q19MRT( 1.19, 1.4, 1.2, omega, 1.4, 1.98 ) ); - BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, velocity, real_t(1), FieldGhostLayers ); + BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, velocity, 1_r, FieldGhostLayers ); BlockDataID tmpFieldId = lbm::addPdfFieldToStorage( blocks, "tmp field", latticeModel, FieldGhostLayers ); for( auto block = blocks->begin(); block != blocks->end(); ++block ) @@ -395,7 +395,7 @@ int main( int argc, char ** argv ) // check constant velocity //typedef GhostLayerField<real_t,1> ErrorField; - //BlockDataID errorFieldId = field::addToStorage< ErrorField >( blocks, "error field", real_t(0), field::zyxf, FieldGhostLayers ); + //BlockDataID errorFieldId = field::addToStorage< ErrorField >( blocks, "error field", 0_r, field::zyxf, FieldGhostLayers ); for( auto block = blocks->begin(); block != blocks->end(); ++block ) { @@ -407,7 +407,7 @@ int main( int argc, char ** argv ) Vector3< real_t > cellVelocity = pdfField->getVelocity( cell.x(), cell.y(), cell.z() ); Vector3< real_t > diff = cellVelocity - velocity; - WALBERLA_CHECK_FLOAT_EQUAL( diff.length() / velocity.length(), real_t(0) ); + WALBERLA_CHECK_FLOAT_EQUAL( diff.length() / velocity.length(), 0_r ); //errorField->get( cell.x(), cell.y(), cell.z() ) = diff.length() / velocity.length(); } diff --git a/tests/mesh/MatrixVectorOperationsTest.cpp b/tests/mesh/MatrixVectorOperationsTest.cpp index 6c9ae697..e5e108d2 100644 --- a/tests/mesh/MatrixVectorOperationsTest.cpp +++ b/tests/mesh/MatrixVectorOperationsTest.cpp @@ -32,12 +32,12 @@ int main( int /*argc*/, char * /*argv*/[] ) { debug::enterTestMode(); - const math::Matrix3<real_t> m( real_t(2), real_t(3), real_t(4), - real_t(5), real_t(6), real_t(7), - real_t(8), real_t(9), real_t(10) ); + const math::Matrix3<real_t> m( 2_r, 3_r, 4_r, + 5_r, 6_r, 7_r, + 8_r, 9_r, 10_r ); - const math::Vector3<real_t> vwb( real_t(2), real_t(3), real_t(4) ); - const OpenMesh::VectorT<real_t, 3> vom( real_t(2), real_t(3), real_t(4) ); + const math::Vector3<real_t> vwb( 2_r, 3_r, 4_r ); + const OpenMesh::VectorT<real_t, 3> vom( 2_r, 3_r, 4_r ); WALBERLA_CHECK_EQUAL( vwb, toWalberla( vom ) ); WALBERLA_CHECK_EQUAL( toOpenMesh(vwb), vom ); diff --git a/tests/mesh/MeshAABBIntersectionTest.cpp b/tests/mesh/MeshAABBIntersectionTest.cpp index fc471113..007dbc5c 100644 --- a/tests/mesh/MeshAABBIntersectionTest.cpp +++ b/tests/mesh/MeshAABBIntersectionTest.cpp @@ -47,11 +47,11 @@ void runTests( const uint_t numAABBs ) auto meshAABB = computeAABB( *mesh ); // works since the mesh is a cube - auto testVolume = meshAABB.getScaled( real_t(3) ); // AABB containing the test points + auto testVolume = meshAABB.getScaled( 3_r ); // AABB containing the test points TriangleDistance<MeshType> triDist( mesh ); - WALBERLA_CHECK( isIntersecting( triDist, meshAABB, real_t(0) ) ); + WALBERLA_CHECK( isIntersecting( triDist, meshAABB, 0_r ) ); std::mt19937 rng( uint32_t(42) ); @@ -59,7 +59,7 @@ void runTests( const uint_t numAABBs ) { math::GenericAABB< typename MeshType::Scalar > testAABB( testVolume.randomPoint( rng ), testVolume.randomPoint( rng ) ); - const real_t maxErr = real_t(1e-2); + const real_t maxErr = 1e-2_r; boost::tribool result = isIntersecting( triDist, testAABB, maxErr ); diff --git a/tests/mesh/MeshBlockExclusionTest.cpp b/tests/mesh/MeshBlockExclusionTest.cpp index 7685ac64..0b7b6515 100644 --- a/tests/mesh/MeshBlockExclusionTest.cpp +++ b/tests/mesh/MeshBlockExclusionTest.cpp @@ -81,7 +81,7 @@ void test(const shared_ptr< DistanceOctree< MeshType > > & distanceOctree, const domainAABB.ySize() / real_c(numBlocks[1]), domainAABB.zSize() / real_c(numBlocks[2])); - real_t maxError = blockSize.min() / real_t(10); + real_t maxError = blockSize.min() / 10_r; SetupBlockForest setupBlockforest; setupBlockforest.addRootBlockExclusionFunction(F(distanceOctree, maxError)); diff --git a/tests/mesh/MeshContainmentOctreeTest.cpp b/tests/mesh/MeshContainmentOctreeTest.cpp index 40f542dd..fd409162 100644 --- a/tests/mesh/MeshContainmentOctreeTest.cpp +++ b/tests/mesh/MeshContainmentOctreeTest.cpp @@ -95,7 +95,7 @@ int main( int argc, char * argv[] ) sLengthOld = sLength; } - auto testVolume = aabb.getScaled( real_t(1.5) ); // AABB containing the test points + auto testVolume = aabb.getScaled( 1.5_r ); // AABB containing the test points auto triDist = make_shared< mesh::TriangleDistance<mesh::TriangleMesh> >( mesh ); auto distanceOctree = make_shared< DistanceOctree<mesh::TriangleMesh> >( triDist ); diff --git a/tests/mesh/MeshDistanceCompareTest.cpp b/tests/mesh/MeshDistanceCompareTest.cpp index 4067a28e..b38c42cd 100644 --- a/tests/mesh/MeshDistanceCompareTest.cpp +++ b/tests/mesh/MeshDistanceCompareTest.cpp @@ -50,7 +50,7 @@ void testAABBDistance( const Vector3<real_t> & translationVector = Vector3<real_ auto aabb = computeAABB( *mesh ); // works since the mesh is a cube - auto testVolume = aabb.getScaled( real_t(2) ); // AABB containing the test points + auto testVolume = aabb.getScaled( 2_r ); // AABB containing the test points TriangleDistance<MeshType> triDist( mesh ); @@ -71,13 +71,13 @@ int main( int argc, char * argv[] ) mpi::MPIManager::instance()->useWorldComm(); testAABBDistance<mesh::TriangleMesh>(); - testAABBDistance<mesh::TriangleMesh>( Vector3<real_t>( real_t(-0.5), real_t(-0.5), real_t(-0.5) ) ); + testAABBDistance<mesh::TriangleMesh>( Vector3<real_t>( -0.5_r, -0.5_r, -0.5_r ) ); testAABBDistance<mesh::FloatTriangleMesh>(); - testAABBDistance<mesh::FloatTriangleMesh>( Vector3<real_t>( real_t(-0.5), real_t(-0.5), real_t(-0.5) ) ); + testAABBDistance<mesh::FloatTriangleMesh>( Vector3<real_t>( -0.5_r, -0.5_r, -0.5_r ) ); testAABBDistance<mesh::PythonTriangleMesh>(); - testAABBDistance<mesh::PythonTriangleMesh>( Vector3<real_t>( real_t(-0.5), real_t(-0.5), real_t(-0.5) ) ); + testAABBDistance<mesh::PythonTriangleMesh>( Vector3<real_t>( -0.5_r, -0.5_r, -0.5_r ) ); return EXIT_SUCCESS; } diff --git a/tests/mesh/MeshDistancePlausibilityTest.cpp b/tests/mesh/MeshDistancePlausibilityTest.cpp index 5ca33efc..181c3f6e 100644 --- a/tests/mesh/MeshDistancePlausibilityTest.cpp +++ b/tests/mesh/MeshDistancePlausibilityTest.cpp @@ -82,7 +82,7 @@ int main( int argc, char * argv[] ) auto meshAabb = computeAABB( *mesh ); - auto domainAABB = meshAabb.getScaled( real_t(1.5) ); // AABB containing the test points + auto domainAABB = meshAabb.getScaled( 1.5_r ); // AABB containing the test points WALBERLA_LOG_INFO_ON_ROOT( "Preparing distance Information..." ); auto triDist = make_shared< mesh::TriangleDistance<mesh::TriangleMesh> >( mesh ); @@ -98,7 +98,7 @@ int main( int argc, char * argv[] ) numeric_cast<uint_t>( std::ceil( domainAABB.ySize() / dx ) ), numeric_cast<uint_t>( std::ceil( domainAABB.zSize() / dx ) ) ); - domainAABB = AABB( real_t(0), real_t(0), real_t(0), real_c( cells[0] ) * dx, real_c( cells[1] ) * dx, real_c( cells[2] ) * dx ); + domainAABB = AABB( 0_r, 0_r, 0_r, real_c( cells[0] ) * dx, real_c( cells[1] ) * dx, real_c( cells[2] ) * dx ); domainAABB.translate( meshAabb.center() - domainAABB.center() ); shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid( domainAABB, @@ -110,7 +110,7 @@ int main( int argc, char * argv[] ) WALBERLA_CHECK_FLOAT_EQUAL( blocks->dx(), blocks->dy() ); WALBERLA_CHECK_FLOAT_EQUAL( blocks->dx(), blocks->dz() ); - BlockDataID distanceFieldId = field::addToStorage< DistanceField >( blocks, "DistanceField" , real_t(0) ); + BlockDataID distanceFieldId = field::addToStorage< DistanceField >( blocks, "DistanceField" , 0_r ); BlockDataID errorMarkerFieldId = field::addToStorage< ErrorMarkerField >( blocks, "ErrorMarkerField", uint8_t(0) ); BlockDataID faceHandleFieldId = field::addToStorage< FaceHandleField >( blocks, "FaceHandleField" ); @@ -131,7 +131,7 @@ int main( int argc, char * argv[] ) Cell c( x, y, z ); Vector3<real_t> p = blocks->getCellCenter( c ); real_t d = distanceOctree.sqSignedDistance( toOpenMesh( p ), faceHandleField->get( c ) ); - distanceField->get( c ) = d < real_t(0) ? -std::sqrt( -d ) : std::sqrt(d); + distanceField->get( c ) = d < 0_r ? -std::sqrt( -d ) : std::sqrt(d); } } WALBERLA_LOG_INFO( "Slice " << z + 1 << "/" << cell_idx_c( distanceField->zSize() ) + cell_idx_t(2) ); diff --git a/tests/mesh/MeshInitilizationTest.cpp b/tests/mesh/MeshInitilizationTest.cpp index 494f212f..6e273e57 100644 --- a/tests/mesh/MeshInitilizationTest.cpp +++ b/tests/mesh/MeshInitilizationTest.cpp @@ -63,7 +63,7 @@ void commInXDirection( std::vector< std::pair< const SetupBlock*, const SetupBlo auto centerdiff = aabb2.center() - aabb1.center(); - static const real_t eps = real_t(1e-8); + static const real_t eps = 1e-8_r; if( std::fabs( centerdiff[0] ) > eps && std::fabs( centerdiff[1] ) < eps && std::fabs( centerdiff[2] ) < eps ) weights[i] = int64_t(1000); @@ -87,9 +87,9 @@ void test( const std::string & meshFile, const uint_t numProcesses, const uint_t const real_t meshVolume = real_c( computeVolume( *mesh ) ); const real_t blockVolume = meshVolume / real_c( numTotalBlocks ); - static const real_t cellsPersBlock = real_t(1000); + static const real_t cellsPersBlock = 1000_r; const real_t cellVolume = blockVolume / cellsPersBlock; - const Vector3<real_t> cellSize( std::pow( cellVolume, real_t(1) / real_t(3) ) ); + const Vector3<real_t> cellSize( std::pow( cellVolume, 1_r / 3_r ) ); ComplexGeometryStructuredBlockforestCreator bfc( domainAABB, cellSize, makeExcludeMeshInterior( distanceOctree, cellSize.min() ) ); auto wl = mesh::makeMeshWorkloadMemory( distanceOctree, cellSize ); @@ -97,7 +97,7 @@ void test( const std::string & meshFile, const uint_t numProcesses, const uint_t wl.setOutsideCellWorkload(1); wl.setForceZeroMemoryOnZeroWorkload(true); bfc.setWorkloadMemorySUIDAssignmentFunction( wl ); - bfc.setRefinementSelectionFunction( makeRefinementSelection( distanceOctree, 5, cellSize[0], cellSize[0] * real_t(5) ) ); + bfc.setRefinementSelectionFunction( makeRefinementSelection( distanceOctree, 5, cellSize[0], cellSize[0] * 5_r ) ); WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with StaticLevelwiseCurveBalanceWeighted Partitioner" ); bfc.setTargetProcessAssignmentFunction( blockforest::StaticLevelwiseCurveBalanceWeighted() ); @@ -147,9 +147,9 @@ void testHelperFunctions( const std::string & meshFile, const uint_t numTotalBlo const real_t meshVolume = real_c( computeVolume( *mesh ) ); const real_t blockVolume = meshVolume / real_c( numTotalBlocks ); - static const real_t cellsPersBlock = real_t(1000); + static const real_t cellsPersBlock = 1000_r; const real_t cellVolume = blockVolume / cellsPersBlock; - const real_t dx = std::pow( cellVolume, real_t(1) / real_t(3) ); + const real_t dx = std::pow( cellVolume, 1_r / 3_r ); WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with createStructuredBlockStorageInsideMesh with block size" ); auto sbf0 = mesh::createStructuredBlockStorageInsideMesh( distanceOctree, dx, numTotalBlocks ); @@ -158,7 +158,7 @@ void testHelperFunctions( const std::string & meshFile, const uint_t numTotalBlo Vector3<uint_t> blockSize( sbf0->getNumberOfXCells(), sbf0->getNumberOfYCells(), sbf0->getNumberOfZCells() ); auto sbf1 = mesh::createStructuredBlockStorageInsideMesh( distanceOctree, dx, blockSize ); - auto exteriorAabb = computeAABB( *mesh ).getScaled( real_t(2) ); + auto exteriorAabb = computeAABB( *mesh ).getScaled( 2_r ); WALBERLA_LOG_INFO_ON_ROOT( "Creating SBF with createStructuredBlockStorageInsideMesh with block size" ); auto sbf2 = mesh::createStructuredBlockStorageOutsideMesh( exteriorAabb, distanceOctree, dx, numTotalBlocks ); diff --git a/tests/mesh/MeshOperationsTest.cpp b/tests/mesh/MeshOperationsTest.cpp index 91af5d0b..5562a2a3 100644 --- a/tests/mesh/MeshOperationsTest.cpp +++ b/tests/mesh/MeshOperationsTest.cpp @@ -92,9 +92,9 @@ void testCube() WALBERLA_CHECK_FLOAT_EQUAL( centroid[2], aabbCenter[2] ); Matrix3<Scalar> inertiaTensor = computeInertiaTensor(mesh); - WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(0,0), ( aabb.ySize() * aabb.ySize() + aabb.zSize() * aabb.zSize() ) / ( real_t(12) * aabb.volume() ) ); - WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(1,1), ( aabb.xSize() * aabb.xSize() + aabb.zSize() * aabb.zSize() ) / ( real_t(12) * aabb.volume() ) ); - WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(2,2), ( aabb.xSize() * aabb.xSize() + aabb.ySize() * aabb.ySize() ) / ( real_t(12) * aabb.volume() ) ); + WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(0,0), ( aabb.ySize() * aabb.ySize() + aabb.zSize() * aabb.zSize() ) / ( 12_r * aabb.volume() ) ); + WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(1,1), ( aabb.xSize() * aabb.xSize() + aabb.zSize() * aabb.zSize() ) / ( 12_r * aabb.volume() ) ); + WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(2,2), ( aabb.xSize() * aabb.xSize() + aabb.ySize() * aabb.ySize() ) / ( 12_r * aabb.volume() ) ); scale( mesh, Vector3<Scalar>( Scalar(2), Scalar(3), Scalar(0.5) ) ); aabb = computeAABB( mesh ); @@ -117,9 +117,9 @@ void testCube() WALBERLA_CHECK_FLOAT_EQUAL( centroid[2], aabbCenter[2] ); inertiaTensor = computeInertiaTensor(mesh); - WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(0,0), aabb.volume() * ( aabb.ySize() * aabb.ySize() + aabb.zSize() * aabb.zSize() ) / real_t(12) ); - WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(1,1), aabb.volume() * ( aabb.xSize() * aabb.xSize() + aabb.zSize() * aabb.zSize() ) / real_t(12) ); - WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(2,2), aabb.volume() * ( aabb.xSize() * aabb.xSize() + aabb.ySize() * aabb.ySize() ) / real_t(12) ); + WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(0,0), aabb.volume() * ( aabb.ySize() * aabb.ySize() + aabb.zSize() * aabb.zSize() ) / 12_r ); + WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(1,1), aabb.volume() * ( aabb.xSize() * aabb.xSize() + aabb.zSize() * aabb.zSize() ) / 12_r ); + WALBERLA_CHECK_FLOAT_EQUAL( inertiaTensor(2,2), aabb.volume() * ( aabb.xSize() * aabb.xSize() + aabb.ySize() * aabb.ySize() ) / 12_r ); } int main( int argc, char * argv[] ) diff --git a/tests/mesh/MeshPeRaytracing.cpp b/tests/mesh/MeshPeRaytracing.cpp index 7fecb85a..661754ef 100644 --- a/tests/mesh/MeshPeRaytracing.cpp +++ b/tests/mesh/MeshPeRaytracing.cpp @@ -43,13 +43,13 @@ int CpRayIntersectionTest(const int resolution = 10) using namespace walberla::pe::raytracing; std::vector<Vector3<real_t>> points; - points.emplace_back( real_t(-1), real_t(-1), real_t(-1) ); - points.emplace_back( real_t(-1), real_t(-1), real_t( 1) ); - points.emplace_back( real_t(-1), real_t( 1), real_t(-1) ); - points.emplace_back( real_t(-1), real_t( 1), real_t( 1) ); - points.emplace_back( real_t( 1), real_t(-1), real_t(-1) ); - points.emplace_back( real_t( 1), real_t(-1), real_t( 1) ); - points.emplace_back( real_t( 1), real_t( 1), real_t(-1) ); + points.emplace_back( -1_r, -1_r, -1_r ); + points.emplace_back( -1_r, -1_r, real_t( 1) ); + points.emplace_back( -1_r, real_t( 1), -1_r ); + points.emplace_back( -1_r, real_t( 1), real_t( 1) ); + points.emplace_back( real_t( 1), -1_r, -1_r ); + points.emplace_back( real_t( 1), -1_r, real_t( 1) ); + points.emplace_back( real_t( 1), real_t( 1), -1_r ); points.emplace_back( real_t( 1), real_t( 1), real_t( 1) ); shared_ptr< TriangleMesh > mesh = make_shared<TriangleMesh>(); @@ -59,11 +59,11 @@ int CpRayIntersectionTest(const int resolution = 10) const Vec3 center(1,2,3); ConvexPolyhedron cp(0, 0, center, Vec3(0,0,0), Quat(), *mesh, Material::find("iron"), false, true, true); - cp.rotate(real_t(1), real_t(2), real_t(3)); + cp.rotate(1_r, 2_r, 3_r); Box bx(0, 0, center, Vec3(0,0,0), Quat(), Vec3(2,2,2), Material::find("iron"), false, true, true); - bx.rotate(real_t(1), real_t(2), real_t(3)); + bx.rotate(1_r, 2_r, 3_r); - real_t dx = real_t(1.0) / static_cast<real_t>(resolution); + real_t dx = 1.0_r / static_cast<real_t>(resolution); //rays pointed at center of body for (int x = 0; x < resolution; ++x) { @@ -72,11 +72,11 @@ int CpRayIntersectionTest(const int resolution = 10) for (int y = 0; y < resolution; ++y) { const real_t rand2 = real_c(y) * dx; - real_t theta = real_t(2) * M_PI * rand1; - real_t phi = std::acos(real_t(1) - real_t(2) * rand2); + real_t theta = 2_r * M_PI * rand1; + real_t phi = std::acos(1_r - 2_r * rand2); Vec3 dir(std::sin(phi) * std::cos(theta), std::sin(phi) * std::sin(theta), std::cos(phi)); - Ray ray( center + dir*real_t(5), -dir); + Ray ray( center + dir*5_r, -dir); real_t bx_t, cp_t; Vec3 bx_n, cp_n; WALBERLA_CHECK( intersects(&bx, ray, bx_t, bx_n) ); @@ -94,11 +94,11 @@ int CpRayIntersectionTest(const int resolution = 10) for (int y = 0; y < resolution; ++y) { const real_t rand2 = real_c(y) * dx; - real_t theta = real_t(2) * M_PI * rand1; - real_t phi = std::acos(real_t(1) - real_t(2) * rand2); + real_t theta = 2_r * M_PI * rand1; + real_t phi = std::acos(1_r - 2_r * rand2); Vec3 dir(std::sin(phi) * std::cos(theta), std::sin(phi) * std::sin(theta), std::cos(phi)); - Ray ray( Vec3(real_t(5),real_t(5),real_t(5)), -dir); + Ray ray( Vec3(5_r,5_r,5_r), -dir); real_t bx_t, cp_t; Vec3 bx_n, cp_n; const bool bx_intersects = intersects(&bx, ray, bx_t, bx_n); diff --git a/tests/mesh/NumericIntegrationTest.cpp b/tests/mesh/NumericIntegrationTest.cpp index fe706b74..a67a8653 100644 --- a/tests/mesh/NumericIntegrationTest.cpp +++ b/tests/mesh/NumericIntegrationTest.cpp @@ -44,7 +44,7 @@ namespace mesh { template< typename ContainmentT > real_t volumeNumeric( const ContainmentT & body, const AABB & aabb, const real_t spacing ) { - Vector3<real_t> pointOfReference = aabb.min() + Vector3<real_t>( real_t(0.5) * spacing ); + Vector3<real_t> pointOfReference = aabb.min() + Vector3<real_t>( 0.5_r * spacing ); uint_t volume = 0; @@ -61,7 +61,7 @@ real_t volumeNumeric( const ContainmentT & body, const AABB & aabb, const real_t template< typename ContainmentT > Vector3<real_t> centroidNumeric( const ContainmentT & body, const AABB & aabb, const real_t spacing ) { - Vector3<real_t> pointOfReference = aabb.min() + Vector3<real_t>( real_t(0.5) * spacing ); + Vector3<real_t> pointOfReference = aabb.min() + Vector3<real_t>( 0.5_r * spacing ); math::KahanAccumulator<real_t> centroid[3]; uint_t numPoints = 0; @@ -84,7 +84,7 @@ Vector3<real_t> centroidNumeric( const ContainmentT & body, const AABB & aabb, c template< typename ContainmentT > Matrix3<real_t> inertiaTensorNumeric( const ContainmentT & body, const AABB & aabb, const real_t spacing ) { - Vector3<real_t> pointOfReference = aabb.min() + Vector3<real_t>( real_t(0.5) * spacing ); + Vector3<real_t> pointOfReference = aabb.min() + Vector3<real_t>( 0.5_r * spacing ); math::KahanAccumulator<real_t> inertiaTensor[6]; uint_t numPoints = 0; @@ -123,7 +123,7 @@ void testNumeric( const shared_ptr<MeshType> & mesh ) AABB aabb = computeAABB(*mesh); uint_t numPoints = 1000000; - real_t spacing = std::pow( aabb.volume() / real_t(numPoints), real_t(1) / real_t(3) ); + real_t spacing = std::pow( aabb.volume() / real_t(numPoints), 1_r / 3_r ); WALBERLA_LOG_INFO("Computing numeric volume"); real_t numericVolume = volumeNumeric(*containmentOctree, aabb, spacing ); @@ -132,7 +132,7 @@ void testNumeric( const shared_ptr<MeshType> & mesh ) WALBERLA_LOG_INFO("Numerical volume: " << numericVolume << "\n" << "Geometrical volume: " << geometricalVolume << "\n" << "Difference: " << numericVolume - geometricalVolume ); - WALBERLA_CHECK( std::fabs( numericVolume - geometricalVolume ) < real_t(0.001) || std::fabs( real_t(1) - numericVolume / geometricalVolume ) < real_t(0.001) ); + WALBERLA_CHECK( std::fabs( numericVolume - geometricalVolume ) < 0.001_r || std::fabs( 1_r - numericVolume / geometricalVolume ) < 0.001_r ); WALBERLA_LOG_INFO("Computing numeric centroid"); @@ -143,9 +143,9 @@ void testNumeric( const shared_ptr<MeshType> & mesh ) "Geometrical centroid: " << geometricalCentroid << "\n" << "Difference: " << numericCentroid - geometricalCentroid ); - WALBERLA_CHECK( std::fabs( numericCentroid[0] - geometricalCentroid[0] ) < real_t(0.001) || std::fabs( real_t(1) - numericCentroid[0] / geometricalCentroid[0] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericCentroid[0] - geometricalCentroid[0] ) < real_t(0.001) || std::fabs( real_t(1) - numericCentroid[1] / geometricalCentroid[1] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericCentroid[0] - geometricalCentroid[0] ) < real_t(0.001) || std::fabs( real_t(1) - numericCentroid[2] / geometricalCentroid[2] ) < real_t(0.001) ); + WALBERLA_CHECK( std::fabs( numericCentroid[0] - geometricalCentroid[0] ) < 0.001_r || std::fabs( 1_r - numericCentroid[0] / geometricalCentroid[0] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericCentroid[0] - geometricalCentroid[0] ) < 0.001_r || std::fabs( 1_r - numericCentroid[1] / geometricalCentroid[1] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericCentroid[0] - geometricalCentroid[0] ) < 0.001_r || std::fabs( 1_r - numericCentroid[2] / geometricalCentroid[2] ) < 0.001_r ); WALBERLA_LOG_INFO("Computing numeric inertia tensor"); Matrix3<real_t> numericTensor = inertiaTensorNumeric(*containmentOctree, aabb, spacing ); @@ -155,15 +155,15 @@ void testNumeric( const shared_ptr<MeshType> & mesh ) "Geometrical tensor:\n" << geometricalTensor << "\n" << "Difference:\n" << numericTensor - geometricalTensor ); - WALBERLA_CHECK( std::fabs( numericTensor[0] - geometricalTensor[0] ) < real_t(0.001) || std::fabs( real_t(1) - numericTensor[0] / geometricalTensor[0] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericTensor[1] - geometricalTensor[1] ) < real_t(0.001) || std::fabs( real_t(1) - numericTensor[1] / geometricalTensor[1] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericTensor[2] - geometricalTensor[2] ) < real_t(0.001) || std::fabs( real_t(1) - numericTensor[2] / geometricalTensor[2] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericTensor[3] - geometricalTensor[3] ) < real_t(0.001) || std::fabs( real_t(1) - numericTensor[3] / geometricalTensor[3] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericTensor[4] - geometricalTensor[4] ) < real_t(0.001) || std::fabs( real_t(1) - numericTensor[4] / geometricalTensor[4] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericTensor[5] - geometricalTensor[5] ) < real_t(0.001) || std::fabs( real_t(1) - numericTensor[5] / geometricalTensor[5] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericTensor[6] - geometricalTensor[6] ) < real_t(0.001) || std::fabs( real_t(1) - numericTensor[6] / geometricalTensor[6] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericTensor[7] - geometricalTensor[7] ) < real_t(0.001) || std::fabs( real_t(1) - numericTensor[7] / geometricalTensor[7] ) < real_t(0.001) ); - WALBERLA_CHECK( std::fabs( numericTensor[8] - geometricalTensor[8] ) < real_t(0.001) || std::fabs( real_t(1) - numericTensor[8] / geometricalTensor[8] ) < real_t(0.001) ); + WALBERLA_CHECK( std::fabs( numericTensor[0] - geometricalTensor[0] ) < 0.001_r || std::fabs( 1_r - numericTensor[0] / geometricalTensor[0] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericTensor[1] - geometricalTensor[1] ) < 0.001_r || std::fabs( 1_r - numericTensor[1] / geometricalTensor[1] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericTensor[2] - geometricalTensor[2] ) < 0.001_r || std::fabs( 1_r - numericTensor[2] / geometricalTensor[2] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericTensor[3] - geometricalTensor[3] ) < 0.001_r || std::fabs( 1_r - numericTensor[3] / geometricalTensor[3] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericTensor[4] - geometricalTensor[4] ) < 0.001_r || std::fabs( 1_r - numericTensor[4] / geometricalTensor[4] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericTensor[5] - geometricalTensor[5] ) < 0.001_r || std::fabs( 1_r - numericTensor[5] / geometricalTensor[5] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericTensor[6] - geometricalTensor[6] ) < 0.001_r || std::fabs( 1_r - numericTensor[6] / geometricalTensor[6] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericTensor[7] - geometricalTensor[7] ) < 0.001_r || std::fabs( 1_r - numericTensor[7] / geometricalTensor[7] ) < 0.001_r ); + WALBERLA_CHECK( std::fabs( numericTensor[8] - geometricalTensor[8] ) < 0.001_r || std::fabs( 1_r - numericTensor[8] / geometricalTensor[8] ) < 0.001_r ); } diff --git a/tests/mesh/PeVTKMeshWriterTest.cpp b/tests/mesh/PeVTKMeshWriterTest.cpp index b3b704a9..24b338ed 100644 --- a/tests/mesh/PeVTKMeshWriterTest.cpp +++ b/tests/mesh/PeVTKMeshWriterTest.cpp @@ -55,13 +55,13 @@ typedef boost::tuple<ConvexPolyhedron, Plane> BodyTuple ; std::vector<Vector3<real_t>> generatePointCloudCube() { std::vector<Vector3<real_t>> points; - points.emplace_back( real_t(-1), real_t(-1), real_t(-1) ); - points.emplace_back( real_t(-1), real_t(-1), real_t( 1) ); - points.emplace_back( real_t(-1), real_t( 1), real_t(-1) ); - points.emplace_back( real_t(-1), real_t( 1), real_t( 1) ); - points.emplace_back( real_t( 1), real_t(-1), real_t(-1) ); - points.emplace_back( real_t( 1), real_t(-1), real_t( 1) ); - points.emplace_back( real_t( 1), real_t( 1), real_t(-1) ); + points.emplace_back( -1_r, -1_r, -1_r ); + points.emplace_back( -1_r, -1_r, real_t( 1) ); + points.emplace_back( -1_r, real_t( 1), -1_r ); + points.emplace_back( -1_r, real_t( 1), real_t( 1) ); + points.emplace_back( real_t( 1), -1_r, -1_r ); + points.emplace_back( real_t( 1), -1_r, real_t( 1) ); + points.emplace_back( real_t( 1), real_t( 1), -1_r ); points.emplace_back( real_t( 1), real_t( 1), real_t( 1) ); return points; @@ -71,8 +71,8 @@ std::vector<Vector3<real_t>> generatePointCloudDodecahedron() { std::vector<Vector3<real_t>> points = generatePointCloudCube(); - static const real_t PHI = ( real_t(1) + std::sqrt( real_t(5) ) ) / real_t(2); - static const real_t PHI_INV = real_t(1) / PHI; + static const real_t PHI = ( 1_r + std::sqrt( 5_r ) ) / 2_r; + static const real_t PHI_INV = 1_r / PHI; for( auto phi : {-PHI, PHI} ) for( auto piv : {-PHI_INV, PHI_INV} ) @@ -95,7 +95,7 @@ std::vector<Vector3<real_t>> generatPointCloudOnSphere( const real_t radius, con for( auto & p : pointCloud ) { real_t theta = 2 * math::PI * distribution(rng); - real_t phi = std::acos( real_t(1.0) - real_t(2.0) * distribution(rng) ); + real_t phi = std::acos( 1.0_r - 2.0_r * distribution(rng) ); p[0] = std::sin(phi) * std::cos(theta) * radius; p[1] = std::sin(phi) * std::sin(theta) * radius; p[2] = std::cos(phi) * radius; @@ -128,7 +128,7 @@ int main( int argc, char ** argv ) shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); - shared_ptr< BlockForest > forest = createBlockForest( AABB( real_t(0), real_t(0), real_t(0), real_t(6), real_t(6), real_t(6) ), + shared_ptr< BlockForest > forest = createBlockForest( AABB( 0_r, 0_r, 0_r, 6_r, 6_r, 6_r ), Vector3<uint_t>( uint_t(2) ), Vector3<bool>( false ) ); SetBodyTypeIDs<BodyTuple>::execute(); @@ -141,7 +141,7 @@ int main( int argc, char ** argv ) cr::HCSITS cr(globalBodyStorage, forest, storageID, ccdID, fcdID); cr.setMaxIterations( 10 ); cr.setRelaxationModel( cr::HardContactSemiImplicitTimesteppingSolvers::ApproximateInelasticCoulombContactByDecoupling ); - cr.setRelaxationParameter( real_t(0.7) ); + cr.setRelaxationParameter( 0.7_r ); cr.setGlobalLinearAcceleration( Vec3(0,0,5) ); std::function<void(void)> syncCall = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(*forest), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.0), false ); diff --git a/tests/mesh/QHullTest.cpp b/tests/mesh/QHullTest.cpp index ddb4d46e..b7679b32 100644 --- a/tests/mesh/QHullTest.cpp +++ b/tests/mesh/QHullTest.cpp @@ -116,13 +116,13 @@ void test( const std::string & testName, const std::vector<Vector3<real_t>> & po std::vector<Vector3<real_t>> generatePointCloudCube() { std::vector<Vector3<real_t>> points; - points.emplace_back( real_t(-1), real_t(-1), real_t(-1) ); - points.emplace_back( real_t(-1), real_t(-1), real_t( 1) ); - points.emplace_back( real_t(-1), real_t( 1), real_t(-1) ); - points.emplace_back( real_t(-1), real_t( 1), real_t( 1) ); - points.emplace_back( real_t( 1), real_t(-1), real_t(-1) ); - points.emplace_back( real_t( 1), real_t(-1), real_t( 1) ); - points.emplace_back( real_t( 1), real_t( 1), real_t(-1) ); + points.emplace_back( -1_r, -1_r, -1_r ); + points.emplace_back( -1_r, -1_r, real_t( 1) ); + points.emplace_back( -1_r, real_t( 1), -1_r ); + points.emplace_back( -1_r, real_t( 1), real_t( 1) ); + points.emplace_back( real_t( 1), -1_r, -1_r ); + points.emplace_back( real_t( 1), -1_r, real_t( 1) ); + points.emplace_back( real_t( 1), real_t( 1), -1_r ); points.emplace_back( real_t( 1), real_t( 1), real_t( 1) ); return points; @@ -132,10 +132,10 @@ std::vector<Vector3<real_t>> generatePointCloudCube() std::vector<Vector3<real_t>> generatePointCloudTetrahedron() { std::vector<Vector3<real_t>> points; - points.emplace_back( real_t( 1), real_t( 1), real_t(-1) ); - points.emplace_back( real_t(-1), real_t(-1), real_t(-1) ); - points.emplace_back( real_t(-1), real_t( 1), real_t( 1) ); - points.emplace_back( real_t( 1), real_t(-1), real_t( 1) ); + points.emplace_back( real_t( 1), real_t( 1), -1_r ); + points.emplace_back( -1_r, -1_r, -1_r ); + points.emplace_back( -1_r, real_t( 1), real_t( 1) ); + points.emplace_back( real_t( 1), -1_r, real_t( 1) ); return points; } @@ -144,7 +144,7 @@ std::vector<Vector3<real_t>> generatePointCloudOctahedron() { std::vector<Vector3<real_t>> points; - for( auto one : {real_t(-1), real_t(1)} ) + for( auto one : {-1_r, 1_r} ) { points.emplace_back( one, 0, 0 ); points.emplace_back( 0, one, 0 ); @@ -158,9 +158,9 @@ std::vector<Vector3<real_t>> generatePointCloudIcosahedron() { std::vector<Vector3<real_t>> points; - static const real_t PHI = ( real_t(1) + std::sqrt( real_t(5) ) ) / real_t(2); + static const real_t PHI = ( 1_r + std::sqrt( 5_r ) ) / 2_r; - for( auto one : {real_t(-1), real_t(1)} ) + for( auto one : {-1_r, 1_r} ) for( auto phi : {-PHI, PHI} ) { points.emplace_back( real_t( 0), real_t(one), real_t(phi) ); @@ -175,8 +175,8 @@ std::vector<Vector3<real_t>> generatePointCloudDodecahedron() { std::vector<Vector3<real_t>> points = generatePointCloudCube(); - static const real_t PHI = ( real_t(1) + std::sqrt( real_t(5) ) ) / real_t(2); - static const real_t PHI_INV = real_t(1) / PHI; + static const real_t PHI = ( 1_r + std::sqrt( 5_r ) ) / 2_r; + static const real_t PHI_INV = 1_r / PHI; for( auto phi : {-PHI, PHI} ) for( auto piv : {-PHI_INV, PHI_INV} ) @@ -210,7 +210,7 @@ std::vector<Vector3<real_t>> generatPointCloudOnSphere( const real_t radius, con for( auto & p : pointCloud ) { real_t theta = 2 * math::PI * distribution(rng); - real_t phi = std::acos( real_t(1.0) - real_t(2.0) * distribution(rng) ); + real_t phi = std::acos( 1.0_r - 2.0_r * distribution(rng) ); p[0] = std::sin(phi) * std::cos(theta) * radius; p[1] = std::sin(phi) * std::sin(theta) * radius; p[2] = std::cos(phi) * radius; @@ -229,10 +229,10 @@ void runTests( const uint_t numPoints, const bool doVTKOutput ) test<MeshType>( "icosahedron", generatePointCloudIcosahedron(), doVTKOutput ); test<MeshType>( "dodecahedron", generatePointCloudDodecahedron(), doVTKOutput ); - math::AABB aabb( real_t(-1), real_t(-1), real_t(-1), real_t(1), real_t(1), real_t(1) ); + math::AABB aabb( -1_r, -1_r, -1_r, 1_r, 1_r, 1_r ); test<MeshType>( "aabb", generatePointCloudInAABB(aabb, numPoints), doVTKOutput ); - test<MeshType>( "sphere", generatPointCloudOnSphere(real_t(1), numPoints), doVTKOutput ); + test<MeshType>( "sphere", generatPointCloudOnSphere(1_r, numPoints), doVTKOutput ); } diff --git a/tests/pde/CGTest.cpp b/tests/pde/CGTest.cpp index eecd1c6a..0e0b12f6 100644 --- a/tests/pde/CGTest.cpp +++ b/tests/pde/CGTest.cpp @@ -65,7 +65,7 @@ void initU( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData for( auto cell = xyz.begin(); cell != xyz.end(); ++cell ) { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); - u->get( *cell ) = std::sin( real_t(2) * math::PI * p[0] ) * std::sinh( real_t(2) * math::PI * p[1] ); + u->get( *cell ) = std::sin( 2_r * math::PI * p[0] ) * std::sinh( 2_r * math::PI * p[1] ); } } } @@ -82,7 +82,7 @@ void initF( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData for( auto cell = xyz.begin(); cell != xyz.end(); ++cell ) { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); - f->get( *cell ) = real_t(4) * math::PI * math::PI * std::sin( real_t(2) * math::PI * p[0] ) * std::sinh( real_t(2) * math::PI * p[1] ); + f->get( *cell ) = 4_r * math::PI * math::PI * std::sin( 2_r * math::PI * p[0] ) * std::sinh( 2_r * math::PI * p[1] ); } } } @@ -136,25 +136,25 @@ int main( int argc, char** argv ) const uint_t yBlocks = ( processes == uint_t(1) ) ? uint_t(1) : uint_t(2); const uint_t xCells = ( processes == uint_t(1) ) ? uint_t(200) : ( ( processes == uint_t(4) ) ? uint_t(100) : uint_t(50) ); const uint_t yCells = ( processes == uint_t(1) ) ? uint_t(100) : uint_t(50); - const real_t xSize = real_t(2); - const real_t ySize = real_t(1); + const real_t xSize = 2_r; + const real_t ySize = 1_r; const real_t dx = xSize / real_c( xBlocks * xCells + uint_t(1) ); const real_t dy = ySize / real_c( yBlocks * yCells + uint_t(1) ); - auto blocks = blockforest::createUniformBlockGrid( math::AABB( real_t(0.5) * dx, real_t(0.5) * dy, real_t(0), - xSize - real_t(0.5) * dx, ySize - real_t(0.5) * dy, dx ), + auto blocks = blockforest::createUniformBlockGrid( math::AABB( 0.5_r * dx, 0.5_r * dy, 0_r, + xSize - 0.5_r * dx, ySize - 0.5_r * dy, dx ), xBlocks, yBlocks, uint_t(1), xCells, yCells, uint_t(1), true, false, false, false ); - BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", real_t(0), field::zyxf, uint_t(1) ); - BlockDataID rId = field::addToStorage< PdeField_T >( blocks, "r", real_t(0), field::zyxf, uint_t(1) ); - BlockDataID dId = field::addToStorage< PdeField_T >( blocks, "d", real_t(0), field::zyxf, uint_t(1) ); - BlockDataID zId = field::addToStorage< PdeField_T >( blocks, "z", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", 0_r, field::zyxf, uint_t(1) ); + BlockDataID rId = field::addToStorage< PdeField_T >( blocks, "r", 0_r, field::zyxf, uint_t(1) ); + BlockDataID dId = field::addToStorage< PdeField_T >( blocks, "d", 0_r, field::zyxf, uint_t(1) ); + BlockDataID zId = field::addToStorage< PdeField_T >( blocks, "z", 0_r, field::zyxf, uint_t(1) ); initU( blocks, uId ); - BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", 0_r, field::zyxf, uint_t(1) ); initF( blocks, fId ); @@ -164,11 +164,11 @@ int main( int argc, char** argv ) synchronizeD.addPackInfo( make_shared< field::communication::PackInfo< PdeField_T > >( dId ) ); std::vector< real_t > weights( Stencil_T::Size ); - weights[ Stencil_T::idx[ stencil::C ] ] = real_t(2) / ( blocks->dx() * blocks->dx() ) + real_t(2) / ( blocks->dy() * blocks->dy() ) + real_t(4) * math::PI * math::PI; - weights[ Stencil_T::idx[ stencil::N ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::S ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::E ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); - weights[ Stencil_T::idx[ stencil::W ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::C ] ] = 2_r / ( blocks->dx() * blocks->dx() ) + 2_r / ( blocks->dy() * blocks->dy() ) + 4_r * math::PI * math::PI; + weights[ Stencil_T::idx[ stencil::N ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::S ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::E ] ] = -1_r / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::W ] ] = -1_r / ( blocks->dx() * blocks->dx() ); timeloop.addFuncBeforeTimeStep( pde::CGFixedStencilIteration< Stencil_T >( blocks->getBlockStorage(), uId, rId, dId, zId, fId, weights, shortrun ? uint_t(10) : uint_t(10000), synchronizeD, real_c(1e-6) ), "CG iteration" ); diff --git a/tests/pde/JacobiTest.cpp b/tests/pde/JacobiTest.cpp index 275cbf8d..b8ebbfd3 100644 --- a/tests/pde/JacobiTest.cpp +++ b/tests/pde/JacobiTest.cpp @@ -69,8 +69,8 @@ void initU( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData for( auto cell = xyz.begin(); cell != xyz.end(); ++cell ) { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); - src->get( *cell ) = std::sin( real_t(2) * math::PI * p[0] ) * std::sinh( real_t(2) * math::PI * p[1] ); - dst->get( *cell ) = std::sin( real_t(2) * math::PI * p[0] ) * std::sinh( real_t(2) * math::PI * p[1] ); + src->get( *cell ) = std::sin( 2_r * math::PI * p[0] ) * std::sinh( 2_r * math::PI * p[1] ); + dst->get( *cell ) = std::sin( 2_r * math::PI * p[0] ) * std::sinh( 2_r * math::PI * p[1] ); } } } @@ -87,7 +87,7 @@ void initF( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData for( auto cell = xyz.begin(); cell != xyz.end(); ++cell ) { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); - f->get( *cell ) = real_t(4) * math::PI * math::PI * std::sin( real_t(2) * math::PI * p[0] ) * std::sinh( real_t(2) * math::PI * p[1] ); + f->get( *cell ) = 4_r * math::PI * math::PI * std::sin( 2_r * math::PI * p[0] ) * std::sinh( 2_r * math::PI * p[1] ); } } } @@ -141,23 +141,23 @@ int main( int argc, char** argv ) const uint_t yBlocks = ( processes == uint_t(1) ) ? uint_t(1) : uint_t(2); const uint_t xCells = ( processes == uint_t(1) ) ? uint_t(200) : ( ( processes == uint_t(4) ) ? uint_t(100) : uint_t(50) ); const uint_t yCells = ( processes == uint_t(1) ) ? uint_t(100) : uint_t(50); - const real_t xSize = real_t(2); - const real_t ySize = real_t(1); + const real_t xSize = 2_r; + const real_t ySize = 1_r; const real_t dx = xSize / real_c( xBlocks * xCells + uint_t(1) ); const real_t dy = ySize / real_c( yBlocks * yCells + uint_t(1) ); - auto blocks = blockforest::createUniformBlockGrid( math::AABB( real_t(0.5) * dx, real_t(0.5) * dy, real_t(0), - xSize - real_t(0.5) * dx, ySize - real_t(0.5) * dy, dx ), + auto blocks = blockforest::createUniformBlockGrid( math::AABB( 0.5_r * dx, 0.5_r * dy, 0_r, + xSize - 0.5_r * dx, ySize - 0.5_r * dy, dx ), xBlocks, yBlocks, uint_t(1), xCells, yCells, uint_t(1), true, false, false, false ); - BlockDataID srcId = field::addToStorage< PdeField_T >( blocks, "u (src)", real_t(0), field::zyxf, uint_t(1) ); - BlockDataID dstId = field::addToStorage< PdeField_T >( blocks, "u (dst)", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID srcId = field::addToStorage< PdeField_T >( blocks, "u (src)", 0_r, field::zyxf, uint_t(1) ); + BlockDataID dstId = field::addToStorage< PdeField_T >( blocks, "u (dst)", 0_r, field::zyxf, uint_t(1) ); initU( blocks, srcId, dstId ); - BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", 0_r, field::zyxf, uint_t(1) ); initF( blocks, fId ); @@ -167,11 +167,11 @@ int main( int argc, char** argv ) communication.addPackInfo( make_shared< field::communication::PackInfo< PdeField_T > >( srcId ) ); std::vector< real_t > weights( Stencil_T::Size ); - weights[ Stencil_T::idx[ stencil::C ] ] = real_t(2) / ( blocks->dx() * blocks->dx() ) + real_t(2) / ( blocks->dy() * blocks->dy() ) + real_t(4) * math::PI * math::PI; - weights[ Stencil_T::idx[ stencil::N ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::S ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::E ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); - weights[ Stencil_T::idx[ stencil::W ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::C ] ] = 2_r / ( blocks->dx() * blocks->dx() ) + 2_r / ( blocks->dy() * blocks->dy() ) + 4_r * math::PI * math::PI; + weights[ Stencil_T::idx[ stencil::N ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::S ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::E ] ] = -1_r / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::W ] ] = -1_r / ( blocks->dx() * blocks->dx() ); timeloop.addFuncBeforeTimeStep( pde::JacobiIteration( blocks->getBlockStorage(), shortrun ? uint_t(10) : uint_t(10000), communication, diff --git a/tests/pde/MGConvergenceTest.cpp b/tests/pde/MGConvergenceTest.cpp index f9643a83..f35a18d2 100644 --- a/tests/pde/MGConvergenceTest.cpp +++ b/tests/pde/MGConvergenceTest.cpp @@ -75,7 +75,7 @@ void initU( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); math::seedRandomGenerator( static_cast<unsigned int>( (p[0] * real_t(blocks->getNumberOfXCells()) + p[1]) * real_t(blocks->getNumberOfYCells()) + p[2]) ); - u->get( *cell ) = math::realRandom( real_t(-10), real_t(10) ); + u->get( *cell ) = math::realRandom( -10_r, 10_r ); } } @@ -144,8 +144,8 @@ void initURect( const shared_ptr< StructuredBlockStorage > & blocks, const Block WALBERLA_LOG_RESULT_ON_ROOT("Cuboid size: " << cuboidSize[0] << ", " << cuboidSize[1] << ", " << cuboidSize[2] ); - AABB cuboidAABB( real_t(0.5)*(real_c(globalNumCells[0]) - cuboidSize[0]), real_t(0.5)*(real_c(globalNumCells[1]) - cuboidSize[1]), real_t(0.5)*(real_c(globalNumCells[2]) - cuboidSize[2]), - real_t(0.5)*(real_c(globalNumCells[0]) + cuboidSize[0]), real_t(0.5)*(real_c(globalNumCells[1]) + cuboidSize[1]), real_t(0.5)*(real_c(globalNumCells[2]) + cuboidSize[2]) + AABB cuboidAABB( 0.5_r*(real_c(globalNumCells[0]) - cuboidSize[0]), 0.5_r*(real_c(globalNumCells[1]) - cuboidSize[1]), 0.5_r*(real_c(globalNumCells[2]) - cuboidSize[2]), + 0.5_r*(real_c(globalNumCells[0]) + cuboidSize[0]), 0.5_r*(real_c(globalNumCells[1]) + cuboidSize[1]), 0.5_r*(real_c(globalNumCells[2]) + cuboidSize[2]) ); pde::Zeroize(blocks, uId); @@ -257,7 +257,7 @@ real_t runConvergenceConstStencil(const real_t xDomainSize, const real_t yDomain const real_t dx = xDomainSize / real_c( xBlocks * xCells ); const real_t dy = yDomainSize / real_c( yBlocks * yCells ); const real_t dz = zDomainSize / real_c( zBlocks * zCells ); - auto blocks = blockforest::createUniformBlockGrid( math::AABB( real_t(0), real_t(0), real_t(0), + auto blocks = blockforest::createUniformBlockGrid( math::AABB( 0_r, 0_r, 0_r, xDomainSize, yDomainSize, zDomainSize ), xBlocks, yBlocks, zBlocks, // number of blocks xCells, yCells, zCells, // number of cells per block @@ -267,23 +267,23 @@ real_t runConvergenceConstStencil(const real_t xDomainSize, const real_t yDomain WALBERLA_LOG_RESULT_ON_ROOT("Discretization dx: " << dx << ", " << dy << ", " << dz); - BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", 0_r, field::zyxf, uint_t(1) ); initU(blocks, uId); // initURect( blocks, uId ); - BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", 0_r, field::zyxf, uint_t(1) ); SweepTimeloop timeloop( blocks, uint_t(1) ); std::vector< real_t > weights( Stencil_T::Size ); - weights[ Stencil_T::idx[ stencil::C ] ] = real_t(2) / ( blocks->dx() * blocks->dx() ) + real_t(2) / ( blocks->dy() * blocks->dy() ) + real_t(2) / ( blocks->dz() * blocks->dz() ); - weights[ Stencil_T::idx[ stencil::N ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::S ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::E ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); - weights[ Stencil_T::idx[ stencil::W ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); - weights[ Stencil_T::idx[ stencil::T ] ] = real_t(-1) / ( blocks->dx() * blocks->dz() ); - weights[ Stencil_T::idx[ stencil::B ] ] = real_t(-1) / ( blocks->dx() * blocks->dz() ); + weights[ Stencil_T::idx[ stencil::C ] ] = 2_r / ( blocks->dx() * blocks->dx() ) + 2_r / ( blocks->dy() * blocks->dy() ) + 2_r / ( blocks->dz() * blocks->dz() ); + weights[ Stencil_T::idx[ stencil::N ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::S ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::E ] ] = -1_r / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::W ] ] = -1_r / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::T ] ] = -1_r / ( blocks->dx() * blocks->dz() ); + weights[ Stencil_T::idx[ stencil::B ] ] = -1_r / ( blocks->dx() * blocks->dz() ); for (uint_t i = 0; i < Stencil_T::Size; ++i) WALBERLA_LOG_RESULT_ON_ROOT("Weights on finest level (" << i << ") = " << weights[i] ); @@ -311,7 +311,7 @@ real_t runConvergenceConstStencil(const real_t xDomainSize, const real_t yDomain for (uint_t i = 1; i < convrate.size(); ++i) { WALBERLA_LOG_RESULT_ON_ROOT("Convergence rate in iteration " << i << ": " << convrate[i]); - WALBERLA_CHECK_LESS(convrate[i], real_t(0.1)); + WALBERLA_CHECK_LESS(convrate[i], 0.1_r); } // computing average convergence rate of last few V-cycles diff --git a/tests/pde/MGTest.cpp b/tests/pde/MGTest.cpp index 275a2ecc..29867d63 100644 --- a/tests/pde/MGTest.cpp +++ b/tests/pde/MGTest.cpp @@ -67,7 +67,7 @@ void initU( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); math::seedRandomGenerator( static_cast<unsigned int>( (p[0] * real_t(blocks->getNumberOfXCells()) + p[1]) * real_t(blocks->getNumberOfYCells()) + p[2] ) ); - u->get( *cell ) = math::realRandom( real_t(-10), real_t(10) ); + u->get( *cell ) = math::realRandom( -10_r, 10_r ); sum += u->get( *cell ); } } @@ -125,7 +125,7 @@ void checkProlongateRestrict( const shared_ptr< StructuredBlockStorage > & block coarse->set( orig ); c2f( &*block ); - coarse->set( real_t(0.0) ); + coarse->set( 0.0_r ); f2c( &*block ); CellInterval xyz = coarse->xyzSize(); @@ -174,8 +174,8 @@ int main( int argc, char** argv ) const real_t dx = xSize / real_c( xBlocks * xCells + uint_t(1) ); const real_t dy = ySize / real_c( yBlocks * yCells + uint_t(1) ); const real_t dz = zSize / real_c( zBlocks * zCells + uint_t(1) ); - auto blocks = blockforest::createUniformBlockGrid( math::AABB( real_t(0.5) * dx, real_t(0.5) * dy, real_t(0.5) * dz, - xSize - real_t(0.5) * dx, ySize - real_t(0.5) * dy, zSize - real_t(0.5) * dz ), + auto blocks = blockforest::createUniformBlockGrid( math::AABB( 0.5_r * dx, 0.5_r * dy, 0.5_r * dz, + xSize - 0.5_r * dx, ySize - 0.5_r * dy, zSize - 0.5_r * dz ), xBlocks, yBlocks, zBlocks, xCells, yCells, zCells, true, @@ -186,22 +186,22 @@ int main( int argc, char** argv ) // run the main test - BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", 0_r, field::zyxf, uint_t(1) ); initU( blocks, uId ); - BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", 0_r, field::zyxf, uint_t(1) ); SweepTimeloop timeloop( blocks, uint_t(1) ); std::vector< real_t > weights( Stencil_T::Size ); - weights[ Stencil_T::idx[ stencil::C ] ] = real_t(2) / ( blocks->dx() * blocks->dx() ) + real_t(2) / ( blocks->dy() * blocks->dy() ) + real_t(2) / ( blocks->dz() * blocks->dz() ); - weights[ Stencil_T::idx[ stencil::N ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::S ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::E ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); - weights[ Stencil_T::idx[ stencil::W ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); - weights[ Stencil_T::idx[ stencil::T ] ] = real_t(-1) / ( blocks->dx() * blocks->dz() ); - weights[ Stencil_T::idx[ stencil::B ] ] = real_t(-1) / ( blocks->dx() * blocks->dz() ); + weights[ Stencil_T::idx[ stencil::C ] ] = 2_r / ( blocks->dx() * blocks->dx() ) + 2_r / ( blocks->dy() * blocks->dy() ) + 2_r / ( blocks->dz() * blocks->dz() ); + weights[ Stencil_T::idx[ stencil::N ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::S ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::E ] ] = -1_r / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::W ] ] = -1_r / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::T ] ] = -1_r / ( blocks->dx() * blocks->dz() ); + weights[ Stencil_T::idx[ stencil::B ] ] = -1_r / ( blocks->dx() * blocks->dz() ); auto solverDCA = walberla::make_shared<pde::VCycles< Stencil_T > >( blocks, uId, fId, weights, shortrun ? uint_t(1) : uint_t(20), // iterations @@ -219,7 +219,7 @@ int main( int argc, char** argv ) for (uint_t i = 1; i < convrate.size(); ++i) { WALBERLA_LOG_RESULT_ON_ROOT("Convergence rate in iteration " << i << ": " << convrate[i]); - WALBERLA_CHECK_LESS(convrate[i], real_t(0.1)); + WALBERLA_CHECK_LESS(convrate[i], 0.1_r); } vtk::writeDomainDecomposition( blocks ); @@ -256,7 +256,7 @@ int main( int argc, char** argv ) for (uint_t i = 1; i < convrate.size(); ++i) { WALBERLA_LOG_RESULT_ON_ROOT("Convergence rate in iteration " << i << ": " << convrate[i]); - WALBERLA_CHECK_LESS(convrate[i], real_t(0.1)); + WALBERLA_CHECK_LESS(convrate[i], 0.1_r); } } @@ -267,7 +267,7 @@ int main( int argc, char** argv ) SweepTimeloop timeloop3( blocks, uint_t(1) ); - pde::CoarsenStencilFieldsGCA<Stencil_T> coarsenWithGCA( blocks, numLvl, real_t(2)); // Set up GCA object with overrelaxation factor 2 (only valid for Poisson equation) + pde::CoarsenStencilFieldsGCA<Stencil_T> coarsenWithGCA( blocks, numLvl, 2_r); // Set up GCA object with overrelaxation factor 2 (only valid for Poisson equation) auto solverGCA = walberla::make_shared<pde::VCycles< Stencil_T, decltype(coarsenWithGCA) > >( blocks, uId, fId, stencilId, coarsenWithGCA, @@ -286,7 +286,7 @@ int main( int argc, char** argv ) for (uint_t i = 1; i < convrate.size(); ++i) { WALBERLA_LOG_RESULT_ON_ROOT("Convergence rate in iteration " << i << ": " << convrate[i]); - WALBERLA_CHECK_LESS(convrate[i], real_t(0.1)); + WALBERLA_CHECK_LESS(convrate[i], 0.1_r); } } diff --git a/tests/pde/RBGSTest.cpp b/tests/pde/RBGSTest.cpp index c3a922ea..6200b456 100644 --- a/tests/pde/RBGSTest.cpp +++ b/tests/pde/RBGSTest.cpp @@ -68,7 +68,7 @@ void initU( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData for( auto cell = xyz.begin(); cell != xyz.end(); ++cell ) { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); - u->get( *cell ) = std::sin( real_t(2) * math::PI * p[0] ) * std::sinh( real_t(2) * math::PI * p[1] ); + u->get( *cell ) = std::sin( 2_r * math::PI * p[0] ) * std::sinh( 2_r * math::PI * p[1] ); } } } @@ -85,7 +85,7 @@ void initF( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData for( auto cell = xyz.begin(); cell != xyz.end(); ++cell ) { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); - f->get( *cell ) = real_t(4) * math::PI * math::PI * std::sin( real_t(2) * math::PI * p[0] ) * std::sinh( real_t(2) * math::PI * p[1] ); + f->get( *cell ) = 4_r * math::PI * math::PI * std::sin( 2_r * math::PI * p[0] ) * std::sinh( 2_r * math::PI * p[1] ); } } } @@ -139,22 +139,22 @@ int main( int argc, char** argv ) const uint_t yBlocks = ( processes == uint_t(1) ) ? uint_t(1) : uint_t(2); const uint_t xCells = ( processes == uint_t(1) ) ? uint_t(200) : ( ( processes == uint_t(4) ) ? uint_t(100) : uint_t(50) ); const uint_t yCells = ( processes == uint_t(1) ) ? uint_t(100) : uint_t(50); - const real_t xSize = real_t(2); - const real_t ySize = real_t(1); + const real_t xSize = 2_r; + const real_t ySize = 1_r; const real_t dx = xSize / real_c( xBlocks * xCells + uint_t(1) ); const real_t dy = ySize / real_c( yBlocks * yCells + uint_t(1) ); - auto blocks = blockforest::createUniformBlockGrid( math::AABB( real_t(0.5) * dx, real_t(0.5) * dy, real_t(0), - xSize - real_t(0.5) * dx, ySize - real_t(0.5) * dy, dx ), + auto blocks = blockforest::createUniformBlockGrid( math::AABB( 0.5_r * dx, 0.5_r * dy, 0_r, + xSize - 0.5_r * dx, ySize - 0.5_r * dy, dx ), xBlocks, yBlocks, uint_t(1), xCells, yCells, uint_t(1), true, false, false, false ); - BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", 0_r, field::zyxf, uint_t(1) ); initU( blocks, uId ); - BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", 0_r, field::zyxf, uint_t(1) ); initF( blocks, fId ); @@ -164,11 +164,11 @@ int main( int argc, char** argv ) communication.addPackInfo( make_shared< field::communication::PackInfo< PdeField_T > >( uId ) ); std::vector< real_t > weights( Stencil_T::Size ); - weights[ Stencil_T::idx[ stencil::C ] ] = real_t(2) / ( blocks->dx() * blocks->dx() ) + real_t(2) / ( blocks->dy() * blocks->dy() ) + real_t(4) * math::PI * math::PI; - weights[ Stencil_T::idx[ stencil::N ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::S ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::E ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); - weights[ Stencil_T::idx[ stencil::W ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::C ] ] = 2_r / ( blocks->dx() * blocks->dx() ) + 2_r / ( blocks->dy() * blocks->dy() ) + 4_r * math::PI * math::PI; + weights[ Stencil_T::idx[ stencil::N ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::S ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::E ] ] = -1_r / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::W ] ] = -1_r / ( blocks->dx() * blocks->dx() ); auto RBGSFixedSweep = pde::RBGSFixedStencil< Stencil_T >( blocks, uId, fId, weights ); diff --git a/tests/pde/SORTest.cpp b/tests/pde/SORTest.cpp index 520df1cf..65afc026 100644 --- a/tests/pde/SORTest.cpp +++ b/tests/pde/SORTest.cpp @@ -68,7 +68,7 @@ void initU( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData for( auto cell = xyz.begin(); cell != xyz.end(); ++cell ) { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); - u->get( *cell ) = std::sin( real_t(2) * math::PI * p[0] ) * std::sinh( real_t(2) * math::PI * p[1] ); + u->get( *cell ) = std::sin( 2_r * math::PI * p[0] ) * std::sinh( 2_r * math::PI * p[1] ); } } } @@ -85,7 +85,7 @@ void initF( const shared_ptr< StructuredBlockStorage > & blocks, const BlockData for( auto cell = xyz.begin(); cell != xyz.end(); ++cell ) { const Vector3< real_t > p = blocks->getBlockLocalCellCenter( *block, *cell ); - f->get( *cell ) = real_t(4) * math::PI * math::PI * std::sin( real_t(2) * math::PI * p[0] ) * std::sinh( real_t(2) * math::PI * p[1] ); + f->get( *cell ) = 4_r * math::PI * math::PI * std::sin( 2_r * math::PI * p[0] ) * std::sinh( 2_r * math::PI * p[1] ); } } } @@ -139,26 +139,26 @@ int main( int argc, char** argv ) const uint_t yBlocks = ( processes == uint_t(1) ) ? uint_t(1) : uint_t(2); const uint_t xCells = ( processes == uint_t(1) ) ? uint_t(200) : ( ( processes == uint_t(4) ) ? uint_t(100) : uint_t(50) ); const uint_t yCells = ( processes == uint_t(1) ) ? uint_t(100) : uint_t(50); - const real_t xSize = real_t(2); - const real_t ySize = real_t(1); + const real_t xSize = 2_r; + const real_t ySize = 1_r; const real_t dx = xSize / real_c( xBlocks * xCells + uint_t(1) ); const real_t dy = ySize / real_c( yBlocks * yCells + uint_t(1) ); - auto blocks = blockforest::createUniformBlockGrid( math::AABB( real_t(0.5) * dx, real_t(0.5) * dy, real_t(0), - xSize - real_t(0.5) * dx, ySize - real_t(0.5) * dy, dx ), + auto blocks = blockforest::createUniformBlockGrid( math::AABB( 0.5_r * dx, 0.5_r * dy, 0_r, + xSize - 0.5_r * dx, ySize - 0.5_r * dy, dx ), xBlocks, yBlocks, uint_t(1), xCells, yCells, uint_t(1), true, false, false, false ); - BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID uId = field::addToStorage< PdeField_T >( blocks, "u", 0_r, field::zyxf, uint_t(1) ); initU( blocks, uId ); - BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", real_t(0), field::zyxf, uint_t(1) ); + BlockDataID fId = field::addToStorage< PdeField_T >( blocks, "f", 0_r, field::zyxf, uint_t(1) ); initF( blocks, fId ); - real_t omega = real_t(1.9); + real_t omega = 1.9_r; SweepTimeloop timeloop( blocks, uint_t(1) ); @@ -166,11 +166,11 @@ int main( int argc, char** argv ) communication.addPackInfo( make_shared< field::communication::PackInfo< PdeField_T > >( uId ) ); std::vector< real_t > weights( Stencil_T::Size ); - weights[ Stencil_T::idx[ stencil::C ] ] = real_t(2) / ( blocks->dx() * blocks->dx() ) + real_t(2) / ( blocks->dy() * blocks->dy() ) + real_t(4) * math::PI * math::PI; - weights[ Stencil_T::idx[ stencil::N ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::S ] ] = real_t(-1) / ( blocks->dy() * blocks->dy() ); - weights[ Stencil_T::idx[ stencil::E ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); - weights[ Stencil_T::idx[ stencil::W ] ] = real_t(-1) / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::C ] ] = 2_r / ( blocks->dx() * blocks->dx() ) + 2_r / ( blocks->dy() * blocks->dy() ) + 4_r * math::PI * math::PI; + weights[ Stencil_T::idx[ stencil::N ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::S ] ] = -1_r / ( blocks->dy() * blocks->dy() ); + weights[ Stencil_T::idx[ stencil::E ] ] = -1_r / ( blocks->dx() * blocks->dx() ); + weights[ Stencil_T::idx[ stencil::W ] ] = -1_r / ( blocks->dx() * blocks->dx() ); auto SORFixedSweep = pde::SORFixedStencil< Stencil_T >( blocks, uId, fId, weights, omega ); diff --git a/tests/pe/BodyIterators.cpp b/tests/pe/BodyIterators.cpp index e53b44a6..a6c0918d 100644 --- a/tests/pe/BodyIterators.cpp +++ b/tests/pe/BodyIterators.cpp @@ -73,13 +73,13 @@ int main( int argc, char **argv ) uint_t sphereCount = 0; - if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(25), real_t(25), real_t(50) ), 1) != nullptr) + if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( 25_r, 25_r, 50_r ), 1) != nullptr) ++sphereCount; - if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(99), real_t(25), real_t(50) ), 2) != nullptr) + if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( 99_r, 25_r, 50_r ), 2) != nullptr) ++sphereCount; - if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(101), real_t(25), real_t(50) ), 2) != nullptr) + if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( 101_r, 25_r, 50_r ), 2) != nullptr) ++sphereCount; - if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(125), real_t(25), real_t(50) ), 1) != nullptr) + if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( 125_r, 25_r, 50_r ), 1) != nullptr) ++sphereCount; syncShadowOwners<BodyTuple>( blocks->getBlockForest(), storageID); diff --git a/tests/pe/Collision.cpp b/tests/pe/Collision.cpp index 958b4de9..d06039c5 100644 --- a/tests/pe/Collision.cpp +++ b/tests/pe/Collision.cpp @@ -56,9 +56,9 @@ void SphereTest() { MaterialID iron = Material::find("iron"); Sphere sp1(123, 1, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); - Sphere sp2(124, 2, Vec3(real_t(1.5),0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); - Sphere sp3(125, 3, Vec3(real_t(3.0),0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); - Sphere sp4(124, 2, Vec3(0,real_t(1.5),0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); + Sphere sp2(124, 2, Vec3(1.5_r,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); + Sphere sp3(125, 3, Vec3(3.0_r,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); + Sphere sp4(124, 2, Vec3(0,1.5_r,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); Plane pl1(223, 1, Vec3(0,0,0), Vec3(1,1,1).getNormalized(), 0, iron); CylindricalBoundary cb1(333, 0, Vec3(-100,0,0), 2, iron); @@ -70,7 +70,7 @@ void SphereTest() WALBERLA_CHECK( !collideFunc(&sp1, &sp3) ); WALBERLA_CHECK( collideFunc(&sp1, &sp2) ); checkContact( contacts.at(0), - Contact( &sp1, &sp2, Vec3(real_t(0.75), 0, 0), Vec3(-1, 0, 0), real_t(-0.5)) ); + Contact( &sp1, &sp2, Vec3(0.75_r, 0, 0), Vec3(-1, 0, 0), -0.5_r) ); // SPHERE <-> PLANE @@ -79,12 +79,12 @@ void SphereTest() WALBERLA_CHECK( collideFunc(&sp1, &pl1) ); WALBERLA_CHECK( collideFunc(&sp2, &pl1) ); checkContact( contacts.at(1), - Contact( &sp2, &pl1, Vec3(1,real_t(-0.5),real_t(-0.5)), Vec3(1, 1, 1).getNormalized(), real_t(-0.133974596215561181)) ); + Contact( &sp2, &pl1, Vec3(1,-0.5_r,-0.5_r), Vec3(1, 1, 1).getNormalized(), -0.133974596215561181_r) ); // ORDER INVARIANCE contacts.clear(); WALBERLA_CHECK( collideFunc(&pl1, &sp2) ); checkContact( contacts.at(0), - Contact( &sp2, &pl1, Vec3(1,real_t(-0.5),real_t(-0.5)), Vec3(1, 1, 1).getNormalized(), real_t(-0.133974596215561181)) ); + Contact( &sp2, &pl1, Vec3(1,-0.5_r,-0.5_r), Vec3(1, 1, 1).getNormalized(), -0.133974596215561181_r) ); WALBERLA_CHECK( !collideFunc(&sp3, &pl1) ); @@ -95,14 +95,14 @@ void SphereTest() WALBERLA_CHECK( !collideFunc(&sp2, &cb1) ); WALBERLA_CHECK( collideFunc(&sp4, &cb1) ); checkContact( contacts.at(0), - Contact( &sp4, &cb1, Vec3(0,real_t(2),real_t(0)), Vec3(0, -1, 0).getNormalized(), real_t(-0.5)) ); - cb1.rotateAroundOrigin( Vec3( 0,0,1), math::M_PI * real_t(0.25) ); + Contact( &sp4, &cb1, Vec3(0,2_r,0_r), Vec3(0, -1, 0).getNormalized(), -0.5_r) ); + cb1.rotateAroundOrigin( Vec3( 0,0,1), math::M_PI * 0.25_r ); WALBERLA_CHECK( !collideFunc(&sp1, &cb1) ); WALBERLA_CHECK( collideFunc(&sp2, &cb1) ); WALBERLA_CHECK( collideFunc(&sp4, &cb1) ); - const real_t xPos = real_t(3) / real_t(4) + real_t(2) / real_c(sqrt(real_t(2))); - const real_t yPos = xPos - real_t(4) / real_c(sqrt(real_t(2))); - const real_t dist = real_c(sqrt((xPos - real_t(1.5)) * (xPos - real_t(1.5)) + yPos * yPos)) - sp4.getRadius(); + const real_t xPos = 3_r / 4_r + 2_r / real_c(sqrt(2_r)); + const real_t yPos = xPos - 4_r / real_c(sqrt(2_r)); + const real_t dist = real_c(sqrt((xPos - 1.5_r) * (xPos - 1.5_r) + yPos * yPos)) - sp4.getRadius(); checkContact( contacts.at(1), Contact( &sp2, &cb1, Vec3(xPos, yPos, 0), Vec3(-1, +1, 0).getNormalized(), dist) ); checkContact( contacts.at(2), @@ -113,8 +113,8 @@ void BoxTest() { MaterialID iron = Material::find("iron"); Box b1(123, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), Vec3(2,2,2), iron, false, true, false); - Box b2(124, 0, Vec3(real_t(1.5),0,0), Vec3(0,0,0), Quat(), Vec3(2,2,2), iron, false, true, false); - Box b3(125, 0, Vec3(real_t(3.0),0,0), Vec3(0,0,0), Quat(), Vec3(2,2,2), iron, false, true, false); + Box b2(124, 0, Vec3(1.5_r,0,0), Vec3(0,0,0), Quat(), Vec3(2,2,2), iron, false, true, false); + Box b3(125, 0, Vec3(3.0_r,0,0), Vec3(0,0,0), Quat(), Vec3(2,2,2), iron, false, true, false); Box b4(123, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), Vec3(2,2,2), iron, false, true, false); b4.rotate( Vec3(1,1,0), real_t(atan(sqrt(2))) ); @@ -157,7 +157,7 @@ void BoxTest() b5.setPosition( (Vec3(0,0,1) * real_t(sqrt(3)) + Vec3(0,0,1)) * 1.01); WALBERLA_CHECK( !collideFunc(&b1, &b5) ); - Sphere s1(126, 0, Vec3(real_t(1.5), real_t(1.5), real_t(1.5)), Vec3(0,0,0), Quat(), 1, iron, false, true, false); + Sphere s1(126, 0, Vec3(1.5_r, 1.5_r, 1.5_r), Vec3(0,0,0), Quat(), 1, iron, false, true, false); WALBERLA_CHECK( collideFunc(&b1, &s1) ); // WALBERLA_LOG_WARNING("contactPoint : " << contactPoint); // WALBERLA_LOG_WARNING("contactNormal : " << contactNormal); @@ -176,43 +176,43 @@ void CapsuleTest() // CAPSULE <-> SPHERE WALBERLA_LOG_INFO("CAPSULE <-> SPHERE"); - sp1.setPosition(0, real_t(1.9), 0); + sp1.setPosition(0, 1.9_r, 0); WALBERLA_CHECK( collideFunc(&c1, &sp1) ); // WALBERLA_LOG_WARNING("contactPoint : " << contacts.at(1).getPosition()); // WALBERLA_LOG_WARNING("contactNormal : " << contacts.at(1).getNormal()); // WALBERLA_LOG_WARNING("penetrationDepth: " << contacts.at(1).getDistance()); - sp1.setPosition(0, real_t(2.1), 0); + sp1.setPosition(0, 2.1_r, 0); WALBERLA_CHECK( !collideFunc(&c1, &sp1) ); // CAPSULE <-> PLANE WALBERLA_LOG_INFO("CAPSULE <-> PLANE"); - Plane pl1(124, 124, Vec3(0,0,real_t(-0.9)), Vec3(0,0,1), 0, iron); + Plane pl1(124, 124, Vec3(0,0,-0.9_r), Vec3(0,0,1), 0, iron); WALBERLA_CHECK( collideFunc(&c1, &pl1) ); // WALBERLA_LOG_WARNING("contactPoint : " << contacts.at(2).getPosition()); // WALBERLA_LOG_WARNING("contactNormal : " << contacts.at(2).getNormal()); // WALBERLA_LOG_WARNING("penetrationDepth: " << contacts.at(2).getDistance()); - pl1.setPosition(0,0, real_t(-1.1)); + pl1.setPosition(0,0, -1.1_r); WALBERLA_CHECK( !collideFunc(&c1, &pl1) ); - Plane pl2(124, 124, Vec3(real_t(1.9),0,0), Vec3(-1,0,0), 0, iron); + Plane pl2(124, 124, Vec3(1.9_r,0,0), Vec3(-1,0,0), 0, iron); WALBERLA_CHECK( collideFunc(&c1, &pl2) ); // WALBERLA_LOG_WARNING("contactPoint : " << contacts.at(3).getPosition()); // WALBERLA_LOG_WARNING("contactNormal : " << contacts.at(3).getNormal()); // WALBERLA_LOG_WARNING("penetrationDepth: " << contacts.at(3).getDistance()); - pl2.setPosition(real_t(2.1),0, 0); + pl2.setPosition(2.1_r,0, 0); WALBERLA_CHECK( !collideFunc(&c1, &pl2) ); } void CapsuleTest2() { - const real_t static_cof ( real_t(0.1) / 2 ); // Coefficient of static friction. Roughly 0.85 with high variation depending on surface roughness for low stresses. Note: pe doubles the input coefficient of friction for material-material contacts. + const real_t static_cof ( 0.1_r / 2 ); // Coefficient of static friction. Roughly 0.85 with high variation depending on surface roughness for low stresses. Note: pe doubles the input coefficient of friction for material-material contacts. const real_t dynamic_cof ( static_cof ); // Coefficient of dynamic friction. Similar to static friction for low speed friction. MaterialID material = createMaterial( "granular", real_t( 1.0 ), 0, static_cof, dynamic_cof, real_t( 0.5 ), 1, 1, 0, 0 ); //create obstacle Capsule c1(100, 100, Vec3(10,10,0), Vec3(0,0,0), Quat(), 3, 40, material, false, true, false); - c1.rotate( Vec3(0,1,0), math::M_PI * real_t(0.5) ); - Sphere sp1(123, 123, Vec3(real_t(6.5316496854295262864), real_t(10.099999999999999645), real_t(0.46999999991564372914) ), Vec3(0,0,0), Quat(), real_t(0.47), material, false, true, false); + c1.rotate( Vec3(0,1,0), math::M_PI * 0.5_r ); + Sphere sp1(123, 123, Vec3(6.5316496854295262864_r, 10.099999999999999645_r, 0.46999999991564372914_r ), Vec3(0,0,0), Quat(), 0.47_r, material, false, true, false); std::vector<Contact> contacts; @@ -237,9 +237,9 @@ void UnionTest() { using UnionT = Union<boost::tuple<Sphere> >; UnionT un1(120, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), false, true, false); - UnionT un2(121, 0, Vec3(real_t(1.5),0,0), Vec3(0,0,0), Quat(), false, true, false); + UnionT un2(121, 0, Vec3(1.5_r,0,0), Vec3(0,0,0), Quat(), false, true, false); auto sp1 = createSphere(&un1, 123, Vec3(0,0,0), 1); - auto sp2 = createSphere(&un2, 124, Vec3(real_t(1.5),0,0), 1); + auto sp2 = createSphere(&un2, 124, Vec3(1.5_r,0,0), 1); std::vector<Contact> contacts; @@ -250,7 +250,7 @@ void UnionTest() func(&un1, &un2); checkContact( contacts.at(0), - Contact( sp1, sp2, Vec3(real_t(0.75), 0, 0), Vec3(-1, 0, 0), real_t(-0.5)) ); + Contact( sp1, sp2, Vec3(0.75_r, 0, 0), Vec3(-1, 0, 0), -0.5_r) ); } typedef boost::tuple<Box, Capsule, Plane, Sphere> BodyTuple ; diff --git a/tests/pe/CollisionTobiasGJK.cpp b/tests/pe/CollisionTobiasGJK.cpp index c6915d86..d20f79d0 100644 --- a/tests/pe/CollisionTobiasGJK.cpp +++ b/tests/pe/CollisionTobiasGJK.cpp @@ -58,7 +58,7 @@ bool gjkEPAcollideHybrid(GeomPrimitive &geom1, GeomPrimitive &geom2, Vec3& norma // Environments" by Gino van den Bergen. //1. Run GJK with considerably enlarged objects. - real_t margin = real_t(1e-4); + real_t margin = 1e-4_r; GJK gjk; if(gjk.doGJKmargin(geom1, geom2, margin)){ //2. If collision is possible perform EPA. @@ -74,12 +74,12 @@ bool gjkEPAcollideHybrid(GeomPrimitive &geom1, GeomPrimitive &geom2, Vec3& norma //Define Test values for different precision levels #ifdef WALBERLA_DOUBLE_ACCURACY static const int distancecount = 6; -static const real_t depth[distancecount] = {real_t(-1e-5), real_t(1e-5), real_t(1e-4), real_t(1e-2), real_t(0.1), real_t(1.0)}; -static const real_t test_accuracy = real_t(1e-3); +static const real_t depth[distancecount] = {-1e-5_r, 1e-5_r, 1e-4_r, 1e-2_r, 0.1_r, 1.0_r}; +static const real_t test_accuracy = 1e-3_r; #else static const int distancecount = 3; -static const real_t depth[distancecount] = {real_t(1e-2), real_t(0.1), real_t(1.0)}; -static const real_t test_accuracy = real_t(1e-2); //Single Precision is v. bad! +static const real_t depth[distancecount] = {1e-2_r, 0.1_r, 1.0_r}; +static const real_t test_accuracy = 1e-2_r; //Single Precision is v. bad! #endif @@ -96,11 +96,11 @@ void checkContact(const Contact& c1, const Contact& c2, const Vec3& planeNormal, WALBERLA_CHECK_LESS( fabs(c1.getDistance()- c2.getDistance()), accuracy ); //Unfortunately position accuracy is one-two orders of magnitude lower... - if(floatIsEqual(planeNormal.sqrLength(), real_t(0.0))){ - WALBERLA_CHECK_LESS( fabs((c1.getPosition()- c2.getPosition()).sqrLength()), real_t(1e4)*accuracy*accuracy ); + if(floatIsEqual(planeNormal.sqrLength(), 0.0_r)){ + WALBERLA_CHECK_LESS( fabs((c1.getPosition()- c2.getPosition()).sqrLength()), 1e4_r*accuracy*accuracy ); }else{ //check for containment in plane only. - WALBERLA_CHECK_LESS( fabs(c1.getPosition()*planeNormal-c2.getPosition()*planeNormal), real_t(1e2)*accuracy ); + WALBERLA_CHECK_LESS( fabs(c1.getPosition()*planeNormal-c2.getPosition()*planeNormal), 1e2_r*accuracy ); } } @@ -137,16 +137,16 @@ void runCollisionDataTest(GeomPrimitive &rb1, GeomPrimitive &rb2, const Vec3& di WALBERLA_LOG_DEVEL( normal1 << " " << pos1 << " " << comp_pen_depth1); bool result2 = gjkEPAcollideHybrid(rb2, rb1, normal2, pos2, comp_pen_depth2); WALBERLA_LOG_DEVEL( normal2 << " " << pos2 << " " << comp_pen_depth2); - if(depth[j] > real_t(0.0)){ + if(depth[j] > 0.0_r){ WALBERLA_CHECK(result1); WALBERLA_CHECK(result2); //Check contact information checkContact( Contact( &rb1, &rb2, pos1, normal1, comp_pen_depth1), Contact( &rb1, &rb2, witnesspoint + depth[j] * witnessmove, real_axis, -depth[j] * penetration_factor ), planeNormal, accuracy ); checkContact( Contact( &rb2, &rb1, pos2, normal2, comp_pen_depth2), - Contact( &rb2, &rb1, witnesspoint + depth[j] * witnessmove, real_t(-1.0)*real_axis, -depth[j] * penetration_factor ), planeNormal, accuracy ); + Contact( &rb2, &rb1, witnesspoint + depth[j] * witnessmove, -1.0_r*real_axis, -depth[j] * penetration_factor ), planeNormal, accuracy ); } - if(depth[j] < real_t(0.0)){ + if(depth[j] < 0.0_r){ WALBERLA_CHECK(!result1); WALBERLA_CHECK(!result2); } @@ -161,8 +161,8 @@ void MainTest() // Original SPHERE <-> SPHERE Sphere sp1(123, 1, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); - Sphere sp2(124, 2, Vec3(real_t(1.5),0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); - Sphere sp3(125, 3, Vec3(real_t(3.0),0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); + Sphere sp2(124, 2, Vec3(1.5_r,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); + Sphere sp3(125, 3, Vec3(3.0_r,0,0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); Vec3 normal; Vec3 contactPoint; @@ -173,113 +173,113 @@ void MainTest() WALBERLA_CHECK( !gjkEPAcollideHybrid(sp1, sp3, normal, contactPoint, penetrationDepth) ); WALBERLA_CHECK( gjkEPAcollideHybrid(sp1, sp2, normal, contactPoint, penetrationDepth) ); checkContact( Contact( &sp1, &sp2, contactPoint, normal, penetrationDepth), - Contact( &sp1, &sp2, Vec3(real_t(0.75), 0, 0), Vec3(real_t(-1.0), 0, 0), real_t(-0.5)), Vec3(0,0,0) ); + Contact( &sp1, &sp2, Vec3(0.75_r, 0, 0), Vec3(-1.0_r, 0, 0), -0.5_r), Vec3(0,0,0) ); //Testcase 01 Box Sphere WALBERLA_LOG_INFO("Test 01: BOX <-> SPHERE"); - real_t sqr3_inv = real_t(1.0)/std::sqrt(real_t(3.0)); - real_t coordinate= real_t(5.0)* sqr3_inv + real_t(5.0); // 5*(1+ (1/sqrt(3))) + real_t sqr3_inv = 1.0_r/std::sqrt(3.0_r); + real_t coordinate= 5.0_r* sqr3_inv + 5.0_r; // 5*(1+ (1/sqrt(3))) Box box1_1(127, 5, Vec3(0, 0, 0), Vec3(0,0,0), Quat(), Vec3(10, 10, 10), iron, false, true, false); Sphere sphere1_2(130, 8, Vec3(coordinate, coordinate, coordinate), Vec3(0,0,0), Quat(), 5, iron, false, true, false); - Vec3 wp1(real_t(5.0), real_t(5.0), real_t(5.0)); - Vec3 wpm1(sqr3_inv*real_t(-0.5), sqr3_inv*real_t(-0.5), sqr3_inv*real_t(-0.5)); + Vec3 wp1(5.0_r, 5.0_r, 5.0_r); + Vec3 wpm1(sqr3_inv*-0.5_r, sqr3_inv*-0.5_r, sqr3_inv*-0.5_r); Vec3 axis1(-sqr3_inv, -sqr3_inv, -sqr3_inv); - runCollisionDataTest(box1_1, sphere1_2, axis1, real_t(1.0), axis1, wp1, wpm1, Vec3(0,0,0)); + runCollisionDataTest(box1_1, sphere1_2, axis1, 1.0_r, axis1, wp1, wpm1, Vec3(0,0,0)); //Testcase 02 Box LongBox (touching plane) //Reuse box1_1 WALBERLA_LOG_INFO("Test 02: BOX <-> LONG BOX"); - Box box2_1(131, 9, Vec3(real_t(20.0),0,0), Vec3(0,0,0), Quat(), Vec3(real_t(30.0),1,1), iron, false, true, false); + Box box2_1(131, 9, Vec3(20.0_r,0,0), Vec3(0,0,0), Quat(), Vec3(30.0_r,1,1), iron, false, true, false); Vec3 wp2(5, 0, 0); - Vec3 wpm2(real_t(-0.5),0,0); + Vec3 wpm2(-0.5_r,0,0); Vec3 axis2(-1,0,0); - runCollisionDataTest(box1_1, box2_1, axis2, real_t(1.0), axis2, wp2, wpm2, axis2); + runCollisionDataTest(box1_1, box2_1, axis2, 1.0_r, axis2, wp2, wpm2, axis2); //Testcase 03 Sphere Sphere WALBERLA_LOG_INFO("Test 03: SPHERE <-> SPHERE"); Sphere sphere3_1(129, 7, Vec3(0,0,0), Vec3(0,0,0), Quat(), 5, iron, false, true, false); - Sphere sphere3_2(128, 6, Vec3(real_t(10.0),0,0), Vec3(0,0,0), Quat(), 5, iron, false, true, false); + Sphere sphere3_2(128, 6, Vec3(10.0_r,0,0), Vec3(0,0,0), Quat(), 5, iron, false, true, false); Vec3 wp3(5, 0, 0); - Vec3 wpm3(real_t(-0.5),0,0); + Vec3 wpm3(-0.5_r,0,0); Vec3 axis3(-1,0,0); - runCollisionDataTest(sphere3_1, sphere3_2, axis3, real_t(1.0), axis3, wp3, wpm3, Vec3(0,0,0)); + runCollisionDataTest(sphere3_1, sphere3_2, axis3, 1.0_r, axis3, wp3, wpm3, Vec3(0,0,0)); //Testcase 04 Cube with turned Cube WALBERLA_LOG_INFO("Test 04: CUBE <-> TURNED CUBE"); //compute rotation. - real_t angle = walberla::math::M_PI/real_t(4.0); + real_t angle = walberla::math::M_PI/4.0_r; Vec3 zaxis(0, 0, 1); Quat q4(zaxis, angle); //create turned box - real_t sqr2 = std::sqrt(real_t(2.0)); - Box box4_1(132, 10, Vec3(real_t(5.0)*(real_t(1.0)+sqr2), real_t(-5.0), 0), Vec3(0,0,0), q4, Vec3(10, 10, 10), iron, false, true, false); + real_t sqr2 = std::sqrt(2.0_r); + Box box4_1(132, 10, Vec3(5.0_r*(1.0_r+sqr2), -5.0_r, 0), Vec3(0,0,0), q4, Vec3(10, 10, 10), iron, false, true, false); Box box4_2(133, 11, Vec3(0, 0, 0), Vec3(0,0,0), Quat(), Vec3(10, 10, 10), iron, false, true, false); Vec3 wp4(5, -5, 0); - Vec3 wpm4(real_t(-0.25),real_t(+0.25),0); - Vec3 collision_axis4(-sqr2/real_t(2.0),+sqr2/real_t(2.0),0); + Vec3 wpm4(-0.25_r,+0.25_r,0); + Vec3 collision_axis4(-sqr2/2.0_r,+sqr2/2.0_r,0); Vec3 axis4(-1, 0, 0); - runCollisionDataTest(box4_2, box4_1, axis4, sqr2/real_t(2.0), collision_axis4, wp4, wpm4, Vec3(0,real_t(1.0),0)); + runCollisionDataTest(box4_2, box4_1, axis4, sqr2/2.0_r, collision_axis4, wp4, wpm4, Vec3(0,1.0_r,0)); //Testcase 05 Cube and Long Box non-centric (touching plane) WALBERLA_LOG_INFO("Test 05: CUBE <-> LONG BOX (NON_CENTRIC)"); Box box5_1(133, 12, Vec3(0, 0, 0), Vec3(0,0,0), Quat(), Vec3(10, 10, 10), iron, false, true, false); - Box box5_2(134, 13, Vec3(real_t(15.0),real_t(5.5), 0), Vec3(0,0,0), Quat(), Vec3(real_t(30.0),1,1), iron, false, true, false); - Vec3 wp5(real_t(3.75), 5, 0); - Vec3 wpm5(0, real_t(-0.5), 0); + Box box5_2(134, 13, Vec3(15.0_r,5.5_r, 0), Vec3(0,0,0), Quat(), Vec3(30.0_r,1,1), iron, false, true, false); + Vec3 wp5(3.75_r, 5, 0); + Vec3 wpm5(0, -0.5_r, 0); Vec3 axis5(0, -1, 0); - runCollisionDataTest(box5_1, box5_2, axis5, real_t(1.0), axis5, wp5, wpm5, axis5); //check only for containment in plane. + runCollisionDataTest(box5_1, box5_2, axis5, 1.0_r, axis5, wp5, wpm5, axis5); //check only for containment in plane. //Testcase 06: WALBERLA_LOG_INFO("Test 06: CUBE <-> TURNED CUBE 2"); //compute rotation. - real_t sqr6_2 = std::sqrt(real_t(2.0)); - real_t sqr6_3 = std::sqrt(real_t(3.0)); - real_t angle6 = std::acos(real_t(1.0)/sqr6_3); //acos(1/sqrt(3)) - Vec3 rot_axis6(0, real_t(1.0)/sqr6_2, -real_t(1.0)/sqr6_2); + real_t sqr6_2 = std::sqrt(2.0_r); + real_t sqr6_3 = std::sqrt(3.0_r); + real_t angle6 = std::acos(1.0_r/sqr6_3); //acos(1/sqrt(3)) + Vec3 rot_axis6(0, 1.0_r/sqr6_2, -1.0_r/sqr6_2); Quat q6(rot_axis6, angle6); //create turned box with pos = (5*(1+sqrt(3)), 0, 0) - Box box6_1(136, 14, Vec3(real_t(5.0)*(real_t(1.0)+sqr6_3), 0, 0), Vec3(0,0,0), q6, Vec3(10, 10, 10), iron, false, true, false); + Box box6_1(136, 14, Vec3(5.0_r*(1.0_r+sqr6_3), 0, 0), Vec3(0,0,0), q6, Vec3(10, 10, 10), iron, false, true, false); Box box6_2(136, 15, Vec3(0, 0, 0), Vec3(0,0,0), Quat(), Vec3(10, 10, 10), iron, false, true, false); Vec3 wp6(5, 0, 0); - Vec3 wpm6(real_t(-0.5), 0, 0); + Vec3 wpm6(-0.5_r, 0, 0); Vec3 axis6(-1, 0, 0); - runCollisionDataTest(box6_2, box6_1, axis6, real_t(1.0), axis6, wp6, wpm6, Vec3(0,0,0)); + runCollisionDataTest(box6_2, box6_1, axis6, 1.0_r, axis6, wp6, wpm6, Vec3(0,0,0)); //Testcase 07: // BOX <-> SPHERE WALBERLA_LOG_INFO("Test 07: BOX <-> SPHERE"); Sphere sphere7_1(137, 16, Vec3(0,0,0), Vec3(0,0,0), Quat(), 5, iron, false, true, false); - Box box7_2(138, 17, Vec3(0, 0,real_t(7.5)), Vec3(0,0,0), Quat(), Vec3(5, 5, 5), iron, false, true, false); - Vec3 wpm7(0, 0, real_t(-0.5)); - Vec3 wp7(0, 0, real_t(5.0)); - Vec3 axis7(0, 0, real_t(-1.0)); - runCollisionDataTest(sphere7_1, box7_2, axis7, real_t(1.0), axis7, wp7, wpm7, Vec3(0,0,0)); + Box box7_2(138, 17, Vec3(0, 0,7.5_r), Vec3(0,0,0), Quat(), Vec3(5, 5, 5), iron, false, true, false); + Vec3 wpm7(0, 0, -0.5_r); + Vec3 wp7(0, 0, 5.0_r); + Vec3 axis7(0, 0, -1.0_r); + runCollisionDataTest(sphere7_1, box7_2, axis7, 1.0_r, axis7, wp7, wpm7, Vec3(0,0,0)); //Testcase 08: // CAPSULE <-> CAPSULE WALBERLA_LOG_INFO("Test 08: CAPSULE <-> CAPSULE"); - Quat q8(Vec3(0,1,0), walberla::math::M_PI/real_t(2.0)); //creates a y-axis aligned capsule - Capsule cap8_1(139, 18, Vec3(0,0,0), Vec3(0,0,0), Quat(), real_t(4.0), real_t(10.0), iron, false, true, false); - Capsule cap8_2(140, 19, Vec3(0,0, real_t(13.0)), Vec3(0,0,0), q8, real_t(4.0), real_t(10.0), iron, false, true, false); - Vec3 wpm8(0, 0, real_t(-0.5)); - Vec3 wp8(0, 0, real_t(4.0)); - Vec3 axis8(0, 0, real_t(-1.0)); - runCollisionDataTest(cap8_1, cap8_2, axis8, real_t(1.0), axis8, wp8, wpm8, Vec3(0,0,0)); + Quat q8(Vec3(0,1,0), walberla::math::M_PI/2.0_r); //creates a y-axis aligned capsule + Capsule cap8_1(139, 18, Vec3(0,0,0), Vec3(0,0,0), Quat(), 4.0_r, 10.0_r, iron, false, true, false); + Capsule cap8_2(140, 19, Vec3(0,0, 13.0_r), Vec3(0,0,0), q8, 4.0_r, 10.0_r, iron, false, true, false); + Vec3 wpm8(0, 0, -0.5_r); + Vec3 wp8(0, 0, 4.0_r); + Vec3 axis8(0, 0, -1.0_r); + runCollisionDataTest(cap8_1, cap8_2, axis8, 1.0_r, axis8, wp8, wpm8, Vec3(0,0,0)); //Testcase 09: // ELLIPSOID <-> ELLIPSOID WALBERLA_LOG_INFO("Test 09: ELLIPSOID <-> ELLIPSOID"); Ellipsoid ell9_1(141, 20, Vec3(0,0,0), Vec3(0,0,0), Quat(), Vec3(10,5,5), iron, false, true, false); Ellipsoid ell9_2(142, 21, Vec3(15,0,0), Vec3(0,0,0), Quat(), Vec3(5,10,5), iron, false, true, false); - Vec3 wpm9(real_t(-0.5), 0, 0); - Vec3 wp9(real_t(10), 0, 0); - Vec3 axis9(real_t(-1.0), 0, 0); - runCollisionDataTest(ell9_1, ell9_2, axis9, real_t(1.0), axis9, wp9, wpm9, Vec3(0,0,0)); + Vec3 wpm9(-0.5_r, 0, 0); + Vec3 wp9(10_r, 0, 0); + Vec3 axis9(-1.0_r, 0, 0); + runCollisionDataTest(ell9_1, ell9_2, axis9, 1.0_r, axis9, wp9, wpm9, Vec3(0,0,0)); } @@ -291,9 +291,9 @@ void PlaneTest() MaterialID iron = Material::find("iron"); fcd::GenericFCD<BodyTuple, fcd::GJKEPACollideFunctor> testFCD; - Plane pl(1, 1, Vec3(0, 1, 0), Vec3(0, 1, 0), real_t(1.0), iron ); - Sphere sphere(2, 2, Vec3(0, real_t(1.9), 0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); - Sphere sphere2(3, 3, Vec3(0, real_t(0.1), 0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); + Plane pl(1, 1, Vec3(0, 1, 0), Vec3(0, 1, 0), 1.0_r, iron ); + Sphere sphere(2, 2, Vec3(0, 1.9_r, 0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); + Sphere sphere2(3, 3, Vec3(0, 0.1_r, 0), Vec3(0,0,0), Quat(), 1, iron, false, true, false); PossibleContacts pcs; @@ -305,9 +305,9 @@ void PlaneTest() // WALBERLA_LOG_DEVEL( c.getDistance() << " " << c.getNormal() << " " << c.getPosition() ); if(c.getBody1()->getID() == 2) { - checkContact( c, Contact(&sphere, &sphere2, Vec3(0, real_t(1), 0), Vec3(0, 1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(&sphere, &sphere2, Vec3(0, 1_r, 0), Vec3(0, 1, 0), -0.2_r), Vec3(0,0,0)); } else if (c.getBody1()->getID() == 3) { - checkContact( c, Contact(&sphere2, &sphere, Vec3(0, real_t(1), 0), Vec3(0, -1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(&sphere2, &sphere, Vec3(0, 1_r, 0), Vec3(0, -1, 0), -0.2_r), Vec3(0,0,0)); } else { WALBERLA_ABORT("Unknown ID!"); } @@ -321,9 +321,9 @@ void PlaneTest() // WALBERLA_LOG_DEVEL( c.getDistance() << " " << c.getNormal() << " " << c.getPosition() ); if(c.getBody1()->getID() == 1) { - checkContact( c, Contact(&pl, &sphere, Vec3(0, real_t(0.95), 0), Vec3(0, -1, 0), real_t(-0.1)), Vec3(0,0,0)); + checkContact( c, Contact(&pl, &sphere, Vec3(0, 0.95_r, 0), Vec3(0, -1, 0), -0.1_r), Vec3(0,0,0)); } else if (c.getBody1()->getID() == 2) { - checkContact( c, Contact(&sphere, &pl, Vec3(0, real_t(0.95), 0), Vec3(0, 1, 0), real_t(-0.1)), Vec3(0,0,0)); + checkContact( c, Contact(&sphere, &pl, Vec3(0, 0.95_r, 0), Vec3(0, 1, 0), -0.1_r), Vec3(0,0,0)); } else { WALBERLA_ABORT("Unknown ID!"); } @@ -337,9 +337,9 @@ void PlaneTest() WALBERLA_LOG_DEVEL( c.getDistance() << " " << c.getNormal() << " " << c.getPosition() ); if(c.getBody1()->getID() == 1) { - checkContact( c, Contact(&pl, &sphere, Vec3(0, real_t(0.95), 0), Vec3(0, -1, 0), real_t(-0.1)), Vec3(0,0,0)); + checkContact( c, Contact(&pl, &sphere, Vec3(0, 0.95_r, 0), Vec3(0, -1, 0), -0.1_r), Vec3(0,0,0)); } else if (c.getBody1()->getID() == 2) { - checkContact( c, Contact(&sphere, &pl, Vec3(0, real_t(0.95), 0), Vec3(0, 1, 0), real_t(-0.1)), Vec3(0,0,0)); + checkContact( c, Contact(&sphere, &pl, Vec3(0, 0.95_r, 0), Vec3(0, 1, 0), -0.1_r), Vec3(0,0,0)); } else { WALBERLA_ABORT("Unknown ID!"); } @@ -353,18 +353,18 @@ void UnionTest(){ fcd::GenericFCD<BodyTuple, fcd::GJKEPACollideFunctor> testFCD; //A recursive union of three spheres is dropped on a box. - Box box(179, 179, Vec3(0,0,0), Vec3(0,0,0), Quat(), Vec3(real_t(10),real_t(2), real_t(10)), iron, false, true, false); + Box box(179, 179, Vec3(0,0,0), Vec3(0,0,0), Quat(), Vec3(10_r,2_r, 10_r), iron, false, true, false); using UnionT = Union<boost::tuple<Sphere>>; - auto unsub = std::make_unique<UnionT>(192, 192, Vec3(0,real_t(3.8),0), Vec3(0,0,0), Quat(), false, true, false); + auto unsub = std::make_unique<UnionT>(192, 192, Vec3(0,3.8_r,0), Vec3(0,0,0), Quat(), false, true, false); - auto sp1 = createSphere(unsub.get(), 180, Vec3(-3,real_t(3.8),0), real_t(3.0)); - auto sp2 = createSphere(unsub.get(), 181, Vec3(3,real_t(3.8),0), real_t(3.0)); + auto sp1 = createSphere(unsub.get(), 180, Vec3(-3,3.8_r,0), 3.0_r); + auto sp2 = createSphere(unsub.get(), 181, Vec3(3,3.8_r,0), 3.0_r); //Create another union, and add sub union Union<boost::tuple<Sphere, Union<boost::tuple<Sphere>>>> un(193, 193, Vec3(0, 0, 0), Vec3(0,0,0), Quat(), false, true, false); - createSphere(&un, 182, Vec3(0,real_t(6),0), real_t(3.0)); + createSphere(&un, 182, Vec3(0,6_r,0), 3.0_r); un.add(std::move(unsub)); @@ -376,9 +376,9 @@ void UnionTest(){ Contact &c = container.back(); WALBERLA_LOG_DEVEL( c.getDistance() << " " << c.getNormal() << " " << c.getPosition() ); if(c.getBody1()->getID() == 181) { - checkContact( c, Contact(sp2, &box, Vec3(real_t(3), real_t(0.9), 0), Vec3(0, 1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(sp2, &box, Vec3(3_r, 0.9_r, 0), Vec3(0, 1, 0), -0.2_r), Vec3(0,0,0)); } else if (c.getBody1()->getID() == 179) { - checkContact( c, Contact(&box, sp2, Vec3(real_t(3), real_t(0.9), 0), Vec3(0, -1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(&box, sp2, Vec3(3_r, 0.9_r, 0), Vec3(0, -1, 0), -0.2_r), Vec3(0,0,0)); } else { WALBERLA_ABORT("Unknown ID!"); } @@ -388,9 +388,9 @@ void UnionTest(){ c = container.back(); WALBERLA_LOG_DEVEL( c.getDistance() << " " << c.getNormal() << " " << c.getPosition() ); if(c.getBody1()->getID() == 180) { - checkContact( c, Contact(sp1, &box, Vec3(real_t(-3), real_t(0.9), 0), Vec3(0, 1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(sp1, &box, Vec3(-3_r, 0.9_r, 0), Vec3(0, 1, 0), -0.2_r), Vec3(0,0,0)); } else if (c.getBody1()->getID() == 179) { - checkContact( c, Contact(&box, sp1, Vec3(real_t(-3), real_t(0.9), 0), Vec3(0, -1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(&box, sp1, Vec3(-3_r, 0.9_r, 0), Vec3(0, -1, 0), -0.2_r), Vec3(0,0,0)); } else { WALBERLA_ABORT("Unknown ID!"); } @@ -404,9 +404,9 @@ void UnionTest(){ c = container.back(); WALBERLA_LOG_DEVEL( c.getDistance() << " " << c.getNormal() << " " << c.getPosition() ); if(c.getBody1()->getID() == 181) { - checkContact( c, Contact(sp2, &box, Vec3(real_t(3), real_t(0.9), 0), Vec3(0, 1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(sp2, &box, Vec3(3_r, 0.9_r, 0), Vec3(0, 1, 0), -0.2_r), Vec3(0,0,0)); } else if (c.getBody1()->getID() == 179) { - checkContact( c, Contact(&box, sp2, Vec3(real_t(3), real_t(0.9), 0), Vec3(0, -1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(&box, sp2, Vec3(3_r, 0.9_r, 0), Vec3(0, -1, 0), -0.2_r), Vec3(0,0,0)); } else { WALBERLA_ABORT("Unknown ID!"); } @@ -415,9 +415,9 @@ void UnionTest(){ c = container.back(); WALBERLA_LOG_DEVEL( c.getDistance() << " " << c.getNormal() << " " << c.getPosition() ); if(c.getBody1()->getID() == 180) { - checkContact( c, Contact(sp1, &box, Vec3(real_t(-3), real_t(0.9), 0), Vec3(0, 1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(sp1, &box, Vec3(-3_r, 0.9_r, 0), Vec3(0, 1, 0), -0.2_r), Vec3(0,0,0)); } else if (c.getBody1()->getID() == 179) { - checkContact( c, Contact(&box, sp1, Vec3(real_t(-3), real_t(0.9), 0), Vec3(0, -1, 0), real_t(-0.2)), Vec3(0,0,0)); + checkContact( c, Contact(&box, sp1, Vec3(-3_r, 0.9_r, 0), Vec3(0, -1, 0), -0.2_r), Vec3(0,0,0)); } else { WALBERLA_ABORT("Unknown ID!"); } diff --git a/tests/pe/DynamicRefinement.cpp b/tests/pe/DynamicRefinement.cpp index 07ce98b8..1ddbe16c 100644 --- a/tests/pe/DynamicRefinement.cpp +++ b/tests/pe/DynamicRefinement.cpp @@ -117,7 +117,7 @@ int main( int argc, char** argv ) for (auto blkIt = forest->begin(); blkIt != forest->end(); ++blkIt) { IBlock & currentBlock = *blkIt; - for (auto it = grid_generator::SCIterator(currentBlock.getAABB(), Vector3<real_t>(spacing) * real_t(0.5), spacing); it != grid_generator::SCIterator(); ++it) + for (auto it = grid_generator::SCIterator(currentBlock.getAABB(), Vector3<real_t>(spacing) * 0.5_r, spacing); it != grid_generator::SCIterator(); ++it) { createSphere( *globalBodyStorage, forest->getBlockStorage(), storageID, 0, *it, 1 ); } diff --git a/tests/pe/GJK_EPA.cpp b/tests/pe/GJK_EPA.cpp index 931d14fd..53ba6d6f 100644 --- a/tests/pe/GJK_EPA.cpp +++ b/tests/pe/GJK_EPA.cpp @@ -44,7 +44,7 @@ int main( int argc, char ** argv ) real_t radius = real_c(1); real_t overlap = real_c(0.2); unsigned long iterations = 100; - real_t epaTolerance = real_t(0.000001); + real_t epaTolerance = 0.000001_r; if (argc != 5) { @@ -62,7 +62,7 @@ int main( int argc, char ** argv ) Sphere s0( 0, 0, Vec3( 0, 0, 0 ), Vec3(), Quat(), real_t( radius ), 0, false, true, false ); - Sphere s1( 1, 0, Vec3( 1, 1, 1 ).getNormalized() * ( real_t(2) - overlap ) * radius, Vec3(), Quat(), real_t( radius ), 0, false, true, false ); + Sphere s1( 1, 0, Vec3( 1, 1, 1 ).getNormalized() * ( 2_r - overlap ) * radius, Vec3(), Quat(), real_t( radius ), 0, false, true, false ); Vec3 contactPoint; Vec3 normal; @@ -80,7 +80,7 @@ int main( int argc, char ** argv ) WcTimer timer; timer.start(); timer.end(); - while (timer.last() < real_t(1)) + while (timer.last() < 1_r) { iter *= 2; timer.start(); @@ -94,7 +94,7 @@ int main( int argc, char ** argv ) iter = 1000; timer.start(); timer.end(); - while (timer.last() < real_t(1)) + while (timer.last() < 1_r) { iter *= 2; timer.start(); @@ -108,7 +108,7 @@ int main( int argc, char ** argv ) for (auto dir = stencil::D3Q27::beginNoCenter(); dir != stencil::D3Q27::end(); ++dir) { - Vec3 pos = Vec3( real_c(dir.cx()), real_c(dir.cy()), real_c(dir.cz()) ).getNormalized() * ( real_t(2) - overlap ) * radius; + Vec3 pos = Vec3( real_c(dir.cx()), real_c(dir.cy()), real_c(dir.cz()) ).getNormalized() * ( 2_r - overlap ) * radius; s1.setPosition(pos); if (!collide(&s0, &s1, contactPoint, normal, penetrationDepth)) @@ -124,7 +124,7 @@ int main( int argc, char ** argv ) WALBERLA_ABORT("no collision detected! (GJK & EPA)"); } - WALBERLA_ASSERT_FLOAT_EQUAL( normalGJK.length(), real_t(1)); + WALBERLA_ASSERT_FLOAT_EQUAL( normalGJK.length(), 1_r); // WALBERLA_LOG_INFO("**** (" << dir.cx() << ", " << dir.cy() << ", " << dir.cz() << ") ****"); // WALBERLA_LOG_INFO("deltaPoint : |" << contactPoint - contactPointGJK << "| = " << (contactPoint - contactPointGJK).length() ); diff --git a/tests/pe/HCSITS.cpp b/tests/pe/HCSITS.cpp index 5b8deb15..62bfb061 100644 --- a/tests/pe/HCSITS.cpp +++ b/tests/pe/HCSITS.cpp @@ -39,84 +39,84 @@ void normalReactionTest(cr::HCSITS& cr, SphereID sp) // radius 1.1 sp->setPosition( Vec3(5,5,6) ); sp->setLinearVel( Vec3(0,0,0) ); - cr.setErrorReductionParameter( real_t(1.0) ); - cr.timestep( real_c( real_t(1.0) ) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,real_t(6.1)) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,real_t(0.1)) ); + cr.setErrorReductionParameter( 1.0_r ); + cr.timestep( real_c( 1.0_r ) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6.1_r) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,0.1_r) ); sp->setPosition( Vec3(5,5,6) ); sp->setLinearVel( Vec3(0,0,0) ); - cr.setErrorReductionParameter( real_t(0.5) ); - cr.timestep( real_c( real_t(1.0) ) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,real_t(6.05)) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,real_t(0.05)) ); + cr.setErrorReductionParameter( 0.5_r ); + cr.timestep( real_c( 1.0_r ) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6.05_r) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,0.05_r) ); sp->setPosition( Vec3(5,5,6) ); sp->setLinearVel( Vec3(0,0,0) ); - cr.setErrorReductionParameter( real_t(0.0) ); - cr.timestep( real_c( real_t(1.0) ) ); + cr.setErrorReductionParameter( 0.0_r ); + cr.timestep( real_c( 1.0_r ) ); WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6) ); WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,0) ); sp->setPosition( Vec3(5,5,6) ); sp->setLinearVel( Vec3(0,0,-1) ); - cr.setErrorReductionParameter( real_t(1.0) ); - cr.timestep( real_c( real_t(1.0) ) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,real_t(6.1)) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,real_t(0.1)) ); + cr.setErrorReductionParameter( 1.0_r ); + cr.timestep( real_c( 1.0_r ) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6.1_r) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,0.1_r) ); sp->setPosition( Vec3(5,5,6) ); sp->setLinearVel( Vec3(0,0,-1) ); - cr.setErrorReductionParameter( real_t(0.5) ); - cr.timestep( real_c( real_t(1.0) ) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,real_t(6.05)) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,real_t(0.05)) ); + cr.setErrorReductionParameter( 0.5_r ); + cr.timestep( real_c( 1.0_r ) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6.05_r) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,0.05_r) ); sp->setPosition( Vec3(5,5,6) ); sp->setLinearVel( Vec3(0,0,-1) ); - cr.setErrorReductionParameter( real_t(0.0) ); - cr.timestep( real_c( real_t(1.0) ) ); + cr.setErrorReductionParameter( 0.0_r ); + cr.timestep( real_c( 1.0_r ) ); WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6) ); WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,0) ); - sp->setPosition( Vec3(5,5,real_t(6.2)) ); - sp->setLinearVel( Vec3(0,0,real_t(-0.2)) ); - cr.setErrorReductionParameter( real_t(1.0) ); - cr.timestep( real_c( real_t(1.0) ) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,real_t(6.0)) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,real_t(-0.2)) ); - - contactThreshold = real_t(1.0); - sp->setPosition( Vec3(5,5,real_t(6.2)) ); - sp->setLinearVel( Vec3(0,0,real_t(-0.2)) ); - cr.setErrorReductionParameter( real_t(1.0) ); - cr.timestep( real_c( real_t(1.0) ) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,real_t(6.1)) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,real_t(-0.1)) ); - - cr.timestep( real_c( real_t(1.0) ) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,real_t(6.1)) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,real_t(0)) ); + sp->setPosition( Vec3(5,5,6.2_r) ); + sp->setLinearVel( Vec3(0,0,-0.2_r) ); + cr.setErrorReductionParameter( 1.0_r ); + cr.timestep( real_c( 1.0_r ) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6.0_r) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,-0.2_r) ); + + contactThreshold = 1.0_r; + sp->setPosition( Vec3(5,5,6.2_r) ); + sp->setLinearVel( Vec3(0,0,-0.2_r) ); + cr.setErrorReductionParameter( 1.0_r ); + cr.timestep( real_c( 1.0_r ) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6.1_r) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,-0.1_r) ); + + cr.timestep( real_c( 1.0_r ) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6.1_r) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,0_r) ); contactThreshold = Thresholds<real_t>::contactThreshold(); } void speedLimiterTest(cr::HCSITS& cr, SphereID sp) { - cr.setErrorReductionParameter( real_t(1.0) ); + cr.setErrorReductionParameter( 1.0_r ); sp->setPosition( Vec3(5,5,6) ); sp->setLinearVel( Vec3(0,0,0) ); - cr.setSpeedLimiter( true, real_t(0.2) ); - cr.timestep( real_c( real_t(1.0) ) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,real_t(6.1)) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,real_t(0.1)) ); + cr.setSpeedLimiter( true, 0.2_r ); + cr.timestep( real_c( 1.0_r ) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,6.1_r) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,0.1_r) ); sp->setPosition( Vec3(5,5,5.5) ); sp->setLinearVel( Vec3(0,0,0) ); - cr.setSpeedLimiter( true, real_t(0.2) ); - cr.timestep( real_c( real_t(1.0) ) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,real_t(5.94)) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,real_t(0.44)) ); + cr.setSpeedLimiter( true, 0.2_r ); + cr.timestep( real_c( 1.0_r ) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getPosition() , Vec3(5,5,5.94_r) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(0,0,0.44_r) ); } int main( int argc, char** argv ) @@ -142,8 +142,8 @@ int main( int argc, char** argv ) auto fcdID = forest->addBlockData(fcd::createGenericFCDDataHandling<BodyTuple, fcd::AnalyticCollideFunctor>(), "FCD"); cr::HCSITS cr(globalBodyStorage, forest->getBlockStoragePointer(), storageID, hccdID, fcdID); cr.setMaxIterations( 10 ); - cr.setRelaxationParameter ( real_t(0.7) ); - cr.setErrorReductionParameter( real_t(1.0) ); + cr.setRelaxationParameter ( 0.7_r ); + cr.setErrorReductionParameter( 1.0_r ); cr.setGlobalLinearAcceleration( Vec3(0,0,0) ); pe::createPlane( *globalBodyStorage, 0, Vec3(0, 0, 1), Vec3(5, 5, 5) ); diff --git a/tests/pe/LoadFromConfig.cpp b/tests/pe/LoadFromConfig.cpp index 7e323620..68b30190 100644 --- a/tests/pe/LoadFromConfig.cpp +++ b/tests/pe/LoadFromConfig.cpp @@ -71,8 +71,8 @@ int main( int argc, char ** argv ) //! [Config HCSITS] WALBERLA_CHECK_EQUAL( hcsits.getRelaxationModel(), cr::HCSITS::RelaxationModel::ApproximateInelasticCoulombContactByDecoupling ); WALBERLA_CHECK_EQUAL( hcsits.getMaxIterations(), 123 ); - WALBERLA_CHECK_FLOAT_EQUAL( hcsits.getRelaxationParameter(), real_t(0.123) ); - WALBERLA_CHECK_FLOAT_EQUAL( hcsits.getErrorReductionParameter(), real_t(0.123) ); + WALBERLA_CHECK_FLOAT_EQUAL( hcsits.getRelaxationParameter(), 0.123_r ); + WALBERLA_CHECK_FLOAT_EQUAL( hcsits.getErrorReductionParameter(), 0.123_r ); WALBERLA_CHECK_FLOAT_EQUAL( hcsits.getGlobalLinearAcceleration(), Vec3(1,-2,3) ); return EXIT_SUCCESS; diff --git a/tests/pe/MinMaxRefinement.cpp b/tests/pe/MinMaxRefinement.cpp index 34cde5d2..efba66b5 100644 --- a/tests/pe/MinMaxRefinement.cpp +++ b/tests/pe/MinMaxRefinement.cpp @@ -149,7 +149,7 @@ int main( int argc, char ** argv ) for (unsigned int i = 0; i < 30; ++i) { - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(real_t(2.1), real_t(2.1), real_t(2.1)), 1); + createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(2.1_r, 2.1_r, 2.1_r), 1); } WALBERLA_MPI_BARRIER(); diff --git a/tests/pe/ParallelEquivalence.cpp b/tests/pe/ParallelEquivalence.cpp index a8fd5bff..a8f4b7f0 100644 --- a/tests/pe/ParallelEquivalence.cpp +++ b/tests/pe/ParallelEquivalence.cpp @@ -207,7 +207,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const uint_t nu // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( balance, uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( balance, uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); diff --git a/tests/pe/PeDocumentationSnippets.cpp b/tests/pe/PeDocumentationSnippets.cpp index d9b3396b..b122d5b8 100644 --- a/tests/pe/PeDocumentationSnippets.cpp +++ b/tests/pe/PeDocumentationSnippets.cpp @@ -85,8 +85,8 @@ int main( int argc, char ** argv ) cr::HCSITS hcsits(globalBodyStorage, forest->getBlockStoragePointer(), storageID, ccdID, fcdID); hcsits.setMaxIterations ( uint_c(10) ); hcsits.setRelaxationModel ( cr::HCSITS::InelasticGeneralizedMaximumDissipationContact ); - hcsits.setRelaxationParameter ( real_t(0.7) ); - hcsits.setErrorReductionParameter ( real_t(0.8) ); + hcsits.setRelaxationParameter ( 0.7_r ); + hcsits.setErrorReductionParameter ( 0.8_r ); hcsits.setGlobalLinearAcceleration( Vec3(0,0,-1) ); //! [Setup HCSITS] @@ -103,7 +103,7 @@ int main( int argc, char ** argv ) //! [Create a Capsule] // Create a capsule and rotate it after successfull creation. - CapsuleID capsule = createCapsule( *globalBodyStorage, forest->getBlockStorage(), storageID, 1, Vec3(2,3,4), real_t(1), real_t(1) ); + CapsuleID capsule = createCapsule( *globalBodyStorage, forest->getBlockStorage(), storageID, 1, Vec3(2,3,4), 1_r, 1_r ); if (capsule != nullptr) capsule->rotate( 0.0, real_c(math::PI/3.0), 0.0 ); //! [Create a Capsule] @@ -116,7 +116,7 @@ int main( int argc, char ** argv ) //! [Create a Sphere] // Create a sphere and rotate it after successfull creation. - SphereID sphere = createSphere( *globalBodyStorage, forest->getBlockStorage(), storageID, 1, Vec3(2,3,4), real_t(1) ); + SphereID sphere = createSphere( *globalBodyStorage, forest->getBlockStorage(), storageID, 1, Vec3(2,3,4), 1_r ); if (sphere != nullptr) sphere->rotate( 0.0, real_c(math::PI/3.0), 0.0 ); //! [Create a Sphere] @@ -127,8 +127,8 @@ int main( int argc, char ** argv ) if (un != nullptr) { createBox ( un, 1, Vec3(2,3,4), Vec3(2.5,2.5,2.5) ); - createCapsule( un, 1, Vec3(3,3,4), real_t(1), real_t(1) ); - createSphere ( un, 1, Vec3(4,3,4), real_t(1) ); + createCapsule( un, 1, Vec3(3,3,4), 1_r, 1_r ); + createSphere ( un, 1, Vec3(4,3,4), 1_r ); } //! [Create a Union] diff --git a/tests/pe/Raytracing.cpp b/tests/pe/Raytracing.cpp index 16b27ed2..bc8afd61 100644 --- a/tests/pe/Raytracing.cpp +++ b/tests/pe/Raytracing.cpp @@ -51,13 +51,13 @@ void SphereIntersectsTest() WALBERLA_LOG_INFO("RAY -> SPHERE"); WALBERLA_CHECK(intersects(&sp1, ray1, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(6)); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(0)); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(-1)); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 6_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], 0_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], -1_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r); // ray tangential - Ray ray2(Vec3(3,-5,3), Vec3(0,7.5,real_t(std::sqrt(real_t(15))/real_t(2))).getNormalized()); + Ray ray2(Vec3(3,-5,3), Vec3(0,7.5,real_t(std::sqrt(15_r)/2_r)).getNormalized()); WALBERLA_CHECK(intersects(&sp1, ray2, t, n)); // sphere behind ray origin @@ -67,13 +67,13 @@ void SphereIntersectsTest() // sphere around ray origin Sphere sp3(123, 1, Vec3(3,-5,3), Vec3(0,0,0), Quat(), 2, iron, false, true, false); WALBERLA_CHECK(intersects(&sp3, ray1, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(2)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 2_r); } void PlaneIntersectsTest() { MaterialID iron = Material::find("iron"); // plane with center 3,3,3 and parallel to y-z plane - Plane pl1(1, 1, Vec3(3, 3, 3), Vec3(1, 0, 0), real_t(1.0), iron); + Plane pl1(1, 1, Vec3(3, 3, 3), Vec3(1, 0, 0), 1.0_r, iron); Ray ray1(Vec3(-5,3,3), Vec3(1,0,0)); real_t t; @@ -81,43 +81,43 @@ void PlaneIntersectsTest() { WALBERLA_LOG_INFO("RAY -> PLANE"); WALBERLA_CHECK(intersects(&pl1, ray1, t, n), "ray through center did not hit"); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(8), "distance between ray and plane is incorrect"); + WALBERLA_CHECK_FLOAT_EQUAL(t, 8_r, "distance between ray and plane is incorrect"); Ray ray2(Vec3(-5,3,3), Vec3(1,0,-1).getNormalized()); WALBERLA_CHECK(intersects(&pl1, ray2, t, n), "ray towards random point on plane didn't hit"); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(sqrt(real_t(128))), "distance between ray and plane is incorrect"); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(-1), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(0), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0), "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(sqrt(128_r)), "distance between ray and plane is incorrect"); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], -1_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], 0_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r, "incorrect normal calculated"); - Plane pl1neg(1, 1, Vec3(3, 3, 3), Vec3(-1, 0, 0), real_t(1.0), iron); + Plane pl1neg(1, 1, Vec3(3, 3, 3), Vec3(-1, 0, 0), 1.0_r, iron); WALBERLA_CHECK(intersects(&pl1neg, ray2, t, n), "ray towards random point on plane didn't hit"); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(-1), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(0), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0), "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], -1_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], 0_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r, "incorrect normal calculated"); Ray ray3(Vec3(-5,3,3), Vec3(-1,0,0).getNormalized()); - Plane pl5(1, 1, Vec3(-7, 3, 3), Vec3(1, 0, 0), real_t(1.0), iron); + Plane pl5(1, 1, Vec3(-7, 3, 3), Vec3(1, 0, 0), 1.0_r, iron); WALBERLA_CHECK(intersects(&pl5, ray3, t, n), "ray towards random point on plane didn't hit"); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(2), "distance between ray and plane is incorrect"); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(1), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(0), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0), "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(t, 2_r, "distance between ray and plane is incorrect"); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], 1_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], 0_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r, "incorrect normal calculated"); // plane with center 3,3,3 and parallel to x-z plane - Plane pl2(1, 1, Vec3(3, 3, 3), Vec3(0, 1, 0), real_t(1.0), iron); + Plane pl2(1, 1, Vec3(3, 3, 3), Vec3(0, 1, 0), 1.0_r, iron); WALBERLA_CHECK(!intersects(&pl2, ray1, t, n), "ray parallel to plane shouldnt hit"); // plane with center -10,3,3 and parallel to y-z plane - Plane pl4(1, 1, Vec3(-10, 3, 3), Vec3(1, 0, 0), real_t(1.0), iron); + Plane pl4(1, 1, Vec3(-10, 3, 3), Vec3(1, 0, 0), 1.0_r, iron); WALBERLA_CHECK(!intersects(&pl4, ray1, t, n), "ray hit plane behind origin"); - Plane pl6(1, 1, Vec3(3, 3, 0), Vec3(-1, 0, 0), real_t(1.0), iron); + Plane pl6(1, 1, Vec3(3, 3, 0), Vec3(-1, 0, 0), 1.0_r, iron); Ray ray4(Vec3(0,0,5), Vec3(1, 0, -1).getNormalized()); WALBERLA_CHECK(intersects(&pl6, ray4, t, n), "ray didnt hit"); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(-1), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(0), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0), "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], -1_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], 0_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r, "incorrect normal calculated"); } void BoxIntersectsTest() { @@ -133,47 +133,47 @@ void BoxIntersectsTest() { Box box2(128, 5, Vec3(0, -2, 0), Vec3(0, 0, 0), Quat(), Vec3(10, 10, 10), iron, false, true, false); WALBERLA_CHECK(intersects(&box2, ray1, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, real_t(8), real_t(1e-7)); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, 8_r, 1e-7_r); Box box3(128, 5, Vec3(0, 5, 0), Vec3(0, 0, 0), Quat(), Vec3(10, 10, 10), iron, false, true, false); WALBERLA_CHECK(intersects(&box3, ray1, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(5)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 5_r); Ray ray6(Vec3(-8,5,0), Vec3(1,0,0)); WALBERLA_CHECK(intersects(&box3, ray6, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(3)); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(-1), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(0), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0), "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(t, 3_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], -1_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], 0_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r, "incorrect normal calculated"); Ray ray7(Vec3(8,5,0), Vec3(-1,0,0)); WALBERLA_CHECK(intersects(&box3, ray7, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(3)); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(1), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(0), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0), "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(t, 3_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], 1_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], 0_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r, "incorrect normal calculated"); // ray origin within box Ray ray2(Vec3(-2,0,0), Vec3(1,0,1).getNormalized()); WALBERLA_CHECK(intersects(&box3, ray2, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, real_t(7.0710), real_t(1e-4)); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, 7.0710_r, 1e-4_r); - Ray ray3(Vec3(3,-5,3), Vec3(2, real_t(-1.5), real_t(0.5)).getNormalized()); + Ray ray3(Vec3(3,-5,3), Vec3(2, -1.5_r, 0.5_r).getNormalized()); Box box4(128, 5, Vec3(0, 8, 0), Vec3(0, 0, 0), Quat(), Vec3(10, 10, 10), iron, false, true, false); WALBERLA_CHECK(!intersects(&box4, ray3, t, n)); - Ray ray4(Vec3(3,-5,3), Vec3(-2, 3, real_t(0.5)).getNormalized()); + Ray ray4(Vec3(3,-5,3), Vec3(-2, 3, 0.5_r).getNormalized()); WALBERLA_CHECK(intersects(&box4, ray4, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, real_t(9.7068), real_t(1e-4)); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, 9.7068_r, 1e-4_r); Box box5(128, 5, Vec3(4, 0, 0), Vec3(0, 0, 0), Quat(), Vec3(4, 4, 4), iron, false, true, false); box5.rotate(0,0,math::M_PI/4); Ray ray5(Vec3(0,1.5,0), Vec3(1,0,0)); WALBERLA_CHECK(intersects(&box5, ray5, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, real_t(2.67157), real_t(1e-4)); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[0], real_t(-0.707107), real_t(1e-5), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[1], real_t(0.707107), real_t(1e-5), "incorrect normal calculated"); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0), "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, 2.67157_r, 1e-4_r); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[0], -0.707107_r, 1e-5_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[1], 0.707107_r, 1e-5_r, "incorrect normal calculated"); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r, "incorrect normal calculated"); } void AABBIntersectsTest() { @@ -186,14 +186,14 @@ void AABBIntersectsTest() { 10,10,10); WALBERLA_CHECK(intersects(aabb, ray1, t)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(5)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 5_r); WALBERLA_CHECK(intersects(aabb, ray1, t, 1.0)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(4)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 4_r); Ray ray2(Vec3(-5,5,10.5), Vec3(1,0,0)); // ray shooting over aabb, but within padding passed to intersects WALBERLA_CHECK(intersects(aabb, ray1, t, 1.0)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(4)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 4_r); } void CapsuleIntersectsTest() { @@ -201,24 +201,24 @@ void CapsuleIntersectsTest() { real_t t; Vec3 n; - Capsule cp1(0, 0, Vec3(2,3,3), Vec3(0,0,0), Quat(), real_t(2), real_t(2), iron, false, true, false); + Capsule cp1(0, 0, Vec3(2,3,3), Vec3(0,0,0), Quat(), 2_r, 2_r, iron, false, true, false); // ray through the center Ray ray1(Vec3(3,-5,3), Vec3(0,1,0)); WALBERLA_LOG_INFO("RAY -> CAPSULE"); WALBERLA_CHECK(intersects(&cp1, ray1, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(6)); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(0)); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(-1)); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 6_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], 0_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], -1_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r); Ray ray2(Vec3(-5,3,3), Vec3(1,0,0)); WALBERLA_CHECK(intersects(&cp1, ray2, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(4)); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(-1)); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(0)); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 4_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], -1_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], 0_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r); } void EllipsoidTest() { @@ -232,27 +232,27 @@ void EllipsoidTest() { Ray ray1(Vec3(-2,3,3), Vec3(1,0,0).getNormalized()); WALBERLA_CHECK(intersects(&el1, ray1, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(2)); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(-1)); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(0)); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(0)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 2_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], -1_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], 0_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 0_r); Ray ray2(Vec3(2,3,0), Vec3(0,0,-1).getNormalized()); WALBERLA_CHECK(!intersects(&el1, ray2, t, n)); Ray ray3(Vec3(2,3,5), Vec3(0,0,-1).getNormalized()); WALBERLA_CHECK(intersects(&el1, ray3, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL(t, real_t(1)); - WALBERLA_CHECK_FLOAT_EQUAL(n[0], real_t(0)); - WALBERLA_CHECK_FLOAT_EQUAL(n[1], real_t(0)); - WALBERLA_CHECK_FLOAT_EQUAL(n[2], real_t(1)); + WALBERLA_CHECK_FLOAT_EQUAL(t, 1_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[0], 0_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[1], 0_r); + WALBERLA_CHECK_FLOAT_EQUAL(n[2], 1_r); - Ray ray4(Vec3(-2,real_t(2),real_t(2)), Vec3(1,real_t(0),real_t(0.5)).getNormalized()); + Ray ray4(Vec3(-2,2_r,2_r), Vec3(1,0_r,0.5_r).getNormalized()); WALBERLA_CHECK(intersects(&el1, ray4, t, n)); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, real_t(2.36809), real_t(1e-5)); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[0], real_t(-0.78193), real_t(1e-5)); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[1], real_t(-0.62324), real_t(1e-5)); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[2], real_t(0.012265), real_t(1e-5)); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(t, 2.36809_r, 1e-5_r); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[0], -0.78193_r, 1e-5_r); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[1], -0.62324_r, 1e-5_r); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON(n[2], 0.012265_r, 1e-5_r); } ShadingParameters customBodyToShadingParams(const BodyID body) { @@ -279,13 +279,13 @@ void RaytracerTest(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RAYTRAC Lighting lighting(Vec3(0, 5, 8), // 8, 5, 9.5 gut für ebenen, 0,5,8 Color(1, 1, 1), //diffuse Color(1, 1, 1), //specular - Color(real_t(0.4), real_t(0.4), real_t(0.4))); //ambient + Color(0.4_r, 0.4_r, 0.4_r)); //ambient Raytracer raytracer(forest, storageID, globalBodyStorage, ccdID, size_t(640), size_t(480), - real_t(49.13), antiAliasFactor, + 49.13_r, antiAliasFactor, Vec3(-5,5,5), Vec3(-1,5,5), Vec3(0,0,1), //-5,5,5; -1,5,5 lighting, - Color(real_t(0.2), real_t(0.2), real_t(0.2)), + Color(0.2_r, 0.2_r, 0.2_r), customBodyToShadingParams); MaterialID iron = Material::find("iron"); @@ -305,24 +305,24 @@ void RaytracerTest(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RAYTRAC createPlane(*globalBodyStorage, 0, Vec3(-1,1,1), Vec3(8,2,2), iron); // tilted plane in right bottom back corner - createSphere(*globalBodyStorage, *forest, storageID, 2, Vec3(6,real_t(9.5),real_t(9.5)), real_t(0.5)); - createSphere(*globalBodyStorage, *forest, storageID, 3, Vec3(4,real_t(5.5),5), real_t(1)); - createSphere(*globalBodyStorage, *forest, storageID, 6, Vec3(3,real_t(8.5),5), real_t(1)); - BoxID box = createBox(*globalBodyStorage, *forest, storageID, 7, Vec3(5,real_t(6.5),5), Vec3(2,4,3)); + createSphere(*globalBodyStorage, *forest, storageID, 2, Vec3(6,9.5_r,9.5_r), 0.5_r); + createSphere(*globalBodyStorage, *forest, storageID, 3, Vec3(4,5.5_r,5), 1_r); + createSphere(*globalBodyStorage, *forest, storageID, 6, Vec3(3,8.5_r,5), 1_r); + BoxID box = createBox(*globalBodyStorage, *forest, storageID, 7, Vec3(5,6.5_r,5), Vec3(2,4,3)); if (box != nullptr) box->rotate(0,math::M_PI/4,math::M_PI/4); createBox(*globalBodyStorage, *forest, storageID, 8, Vec3(5,1,8), Vec3(2,2,2)); // Test scene v1 end // Test scene v2 additions start createBox(*globalBodyStorage, *forest, storageID, 9, Vec3(9,9,5), Vec3(1,1,10)); - createCapsule(*globalBodyStorage, *forest, storageID, 10, Vec3(3, 9, 1), real_t(0.5), real_t(7), iron); - CapsuleID capsule = createCapsule(*globalBodyStorage, *forest, storageID, 11, Vec3(7, real_t(3.5), real_t(7.5)), real_t(1), real_t(2), iron); + createCapsule(*globalBodyStorage, *forest, storageID, 10, Vec3(3, 9, 1), 0.5_r, 7_r, iron); + CapsuleID capsule = createCapsule(*globalBodyStorage, *forest, storageID, 11, Vec3(7, 3.5_r, 7.5_r), 1_r, 2_r, iron); if (capsule != nullptr) capsule->rotate(0,math::M_PI/3,math::M_PI/4-math::M_PI/8); // Test scene v2 end // Test scene v3 additions start - EllipsoidID ellipsoid = createEllipsoid(*globalBodyStorage, *forest, storageID, 12, Vec3(6,2,real_t(2.5)), Vec3(3,2,real_t(1.2))); - ellipsoid->rotate(0, math::M_PI/real_t(6), 0); + EllipsoidID ellipsoid = createEllipsoid(*globalBodyStorage, *forest, storageID, 12, Vec3(6,2,2.5_r), Vec3(3,2,1.2_r)); + ellipsoid->rotate(0, math::M_PI/6_r, 0); // Test scene v3 end //raytracer.setTBufferOutputDirectory("tbuffer"); @@ -385,13 +385,13 @@ void RaytracerSpheresTestScene(Raytracer::Algorithm raytracingAlgorithm = Raytra Lighting lighting(Vec3(0, 5, 8), // 8, 5, 9.5 gut für ebenen, 0,5,8 Color(1, 1, 1), //diffuse Color(1, 1, 1), //specular - Color(real_t(0.4), real_t(0.4), real_t(0.4))); //ambient + Color(0.4_r, 0.4_r, 0.4_r)); //ambient Raytracer raytracer(forest, storageID, globalBodyStorage, ccdID, size_t(640), size_t(480), - real_t(49.13), antiAliasFactor, + 49.13_r, antiAliasFactor, Vec3(-5,5,5), Vec3(-1,5,5), Vec3(0,0,1), //-5,5,5; -1,5,5 lighting, - Color(real_t(0.2),real_t(0.2),real_t(0.2)), + Color(0.2_r,0.2_r,0.2_r), customSpheresBodyToShadingParams); MaterialID iron = Material::find("iron"); @@ -406,7 +406,7 @@ void RaytracerSpheresTestScene(Raytracer::Algorithm raytracingAlgorithm = Raytra walberla::id_t id=0; for (int j=0; j<4; j++) { for (int i=0; i<4; i++) { - createSphere(*globalBodyStorage, *forest, storageID, id, Vec3(6,real_c(i+1)*real_t(2),real_c(j+1)*real_t(2)), real_t(0.9)); + createSphere(*globalBodyStorage, *forest, storageID, id, Vec3(6,real_c(i+1)*2_r,real_c(j+1)*2_r), 0.9_r); id++; } } @@ -428,9 +428,9 @@ ShadingParameters customHashGridsBodyToShadingParams(const BodyID body) { void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t antiAliasFactor, size_t boxes, size_t capsules, size_t spheres, size_t numberOfViews = 1, - real_t boxLenMin = real_t(0.1), real_t boxLenMax = real_t(0.2), bool boxRotation = false, - real_t capRadiusMin = real_t(0.1), real_t capRadiusMax = real_t(0.2), real_t capLenMin = real_t(0.1), real_t capLenMax = real_t(0.3), - real_t sphereRadiusMin = real_t(0.1), real_t sphereRadiusMax = real_t(0.3)) { + real_t boxLenMin = 0.1_r, real_t boxLenMax = 0.2_r, bool boxRotation = false, + real_t capRadiusMin = 0.1_r, real_t capRadiusMax = 0.2_r, real_t capLenMin = 0.1_r, real_t capLenMax = 0.3_r, + real_t sphereRadiusMin = 0.1_r, real_t sphereRadiusMax = 0.3_r) { WALBERLA_LOG_INFO("Generating " << boxes << " boxes, " << capsules << " capsules and " << spheres << " spheres"); using namespace walberla::pe::ccd; @@ -459,7 +459,7 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t a BoxID box_ = createBox(*globalBodyStorage, *forest, storageID, id, Vec3(x, y, z), Vec3(len, len, len)); WALBERLA_CHECK(box_ != nullptr); if (boxRotation) { - box_->rotate(0, math::realRandom(real_t(0), real_t(1))*math::M_PI, math::realRandom(real_t(0), real_t(1))*math::M_PI); + box_->rotate(0, math::realRandom(0_r, 1_r)*math::M_PI, math::realRandom(0_r, 1_r)*math::M_PI); } bodies.push_back(box_); bodySIDs.push_back(box_->getSystemID()); @@ -474,7 +474,7 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t a walberla::id_t id = walberla::id_t(boxes+i); CapsuleID capsule = createCapsule(*globalBodyStorage, *forest, storageID, id, Vec3(x, y, z), radius, len); WALBERLA_CHECK(capsule != nullptr); - capsule->rotate(0, math::realRandom(real_t(0), real_t(1))*math::M_PI, math::realRandom(real_t(0), real_t(1))*math::M_PI); + capsule->rotate(0, math::realRandom(0_r, 1_r)*math::M_PI, math::realRandom(0_r, 1_r)*math::M_PI); bodies.push_back(capsule); bodySIDs.push_back(capsule->getSystemID()); } @@ -513,51 +513,51 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t a std::vector<std::tuple<Vec3, Vec3, Vec3>> viewVectors; // y up, in negative z direction - viewVectors.emplace_back(Vec3(2, real_t(2.1), 7), - Vec3(real_t(2.1), 2, 4), + viewVectors.emplace_back(Vec3(2, 2.1_r, 7), + Vec3(2.1_r, 2, 4), Vec3(0,1,0)); // y up, in positive z direction viewVectors.emplace_back(Vec3(2, 2, -3), - Vec3(2, real_t(2.1), real_t(0.1)), + Vec3(2, 2.1_r, 0.1_r), Vec3(0,1,0)); // x up, in positive z direction viewVectors.emplace_back(Vec3(2, 2, -3), - Vec3(2, real_t(2.1), real_t(0.1)), + Vec3(2, 2.1_r, 0.1_r), Vec3(1,0,0)); // y and x up, in positive z direction viewVectors.emplace_back(Vec3(2, 2, -3), - Vec3(2, real_t(2.1), real_t(0.1)), + Vec3(2, 2.1_r, 0.1_r), Vec3(1,1,0)); // y and x up, in negative z direction viewVectors.emplace_back(Vec3(2, 2, 6.5), - Vec3(real_t(2.1), real_t(2.1), 4), - Vec3(real_t(0.5),1,0)); + Vec3(2.1_r, 2.1_r, 4), + Vec3(0.5_r,1,0)); // z up, in positive x direction - viewVectors.emplace_back(Vec3(-3, 2, real_t(1.9)), - Vec3(0, real_t(2.1), 2), + viewVectors.emplace_back(Vec3(-3, 2, 1.9_r), + Vec3(0, 2.1_r, 2), Vec3(0,0,1)); // z up, in negative x direction - viewVectors.emplace_back(Vec3(7, 2, real_t(1.9)), - Vec3(4, real_t(2.1), 2), + viewVectors.emplace_back(Vec3(7, 2, 1.9_r), + Vec3(4, 2.1_r, 2), Vec3(0,0,1)); // z and y up, in negative x direction - viewVectors.emplace_back(Vec3(7, 2, real_t(1.9)), - Vec3(4, real_t(2.1), 2), + viewVectors.emplace_back(Vec3(7, 2, 1.9_r), + Vec3(4, 2.1_r, 2), Vec3(0,1,1)); // z and x up, in negative y direction - viewVectors.emplace_back(Vec3(2, 6, real_t(1.9)), - Vec3(real_t(2.3), 4, 2), + viewVectors.emplace_back(Vec3(2, 6, 1.9_r), + Vec3(2.3_r, 4, 2), Vec3(1,0,1)); // z up, in positive y direction - viewVectors.emplace_back(Vec3(2, real_t(-3.6), real_t(1.9)), - Vec3(real_t(2.3), 0, real_t(2.1)), + viewVectors.emplace_back(Vec3(2, -3.6_r, 1.9_r), + Vec3(2.3_r, 0, 2.1_r), Vec3(0,0,1)); - Lighting lighting0(Vec3(forestAABB.xSize()/real_t(2)+1, forestAABB.ySize()/real_t(2), - real_t(2)*forestAABB.zMax()+2), // 8, 5, 9.5 gut für ebenen, 0,5,8 + Lighting lighting0(Vec3(forestAABB.xSize()/2_r+1, forestAABB.ySize()/2_r, + 2_r*forestAABB.zMax()+2), // 8, 5, 9.5 gut für ebenen, 0,5,8 Color(1, 1, 1), //diffuse Color(1, 1, 1), //specular - Color(real_t(0.4), real_t(0.4), real_t(0.4))); //ambient + Color(0.4_r, 0.4_r, 0.4_r)); //ambient tt.stop("Setup"); size_t i = 0; @@ -568,12 +568,12 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t a Raytracer raytracer(forest, storageID, globalBodyStorage, ccdID, size_t(640), size_t(480), - real_t(49.13), antiAliasFactor, + 49.13_r, antiAliasFactor, std::get<0>(vector), std::get<1>(vector), std::get<2>(vector), lighting0, - Color(real_t(0.2),real_t(0.2),real_t(0.2)), + Color(0.2_r,0.2_r,0.2_r), customHashGridsBodyToShadingParams); raytracer.setImageOutputEnabled(true); raytracer.setFilenameTimestepWidth(12); @@ -607,16 +607,16 @@ void raytraceArtifactsForest(Raytracer::Algorithm raytracingAlgorithm, walberla: Lighting lighting(cameraPosition, Color(1, 1, 1), //diffuse Color(1, 1, 1), //specular - Color(real_t(0.4), real_t(0.4), real_t(0.4))); //ambient + Color(0.4_r, 0.4_r, 0.4_r)); //ambient Raytracer raytracer(forest, storageID, globalBodyStorage, ccdID, size_t(640), size_t(480), - real_t(49.13), antiAliasFactor, + 49.13_r, antiAliasFactor, cameraPosition, lookAtPoint, upVector, lighting, - Color(real_t(0.2),real_t(0.2),real_t(0.2)), + Color(0.2_r,0.2_r,0.2_r), customArtifactsBodyToShadingParams); raytracer.setImageOutputEnabled(true); raytracer.setFilenameTimestepWidth(timestepWidth); @@ -631,7 +631,7 @@ void raytraceArtifactsForest(Raytracer::Algorithm raytracingAlgorithm, walberla: } void HashGridsArtifactsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t antiAliasFactor, - size_t boxes, real_t boxLenMin = real_t(0.1), real_t boxLenMax = real_t(0.2)) { + size_t boxes, real_t boxLenMin = 0.1_r, real_t boxLenMax = 0.2_r) { WALBERLA_LOG_INFO_ON_ROOT("HashGrids Artifacts Test - In negative Z direction"); WALBERLA_LOG_INFO(" Generating " << boxes << " boxes"); @@ -646,19 +646,19 @@ void HashGridsArtifactsTest(Raytracer::Algorithm raytracingAlgorithm, walberla:: // generate bodies for test for (size_t i = 0; i < boxes; i++) { real_t len = math::realRandom(boxLenMin, boxLenMax); //0.2 0.5 - real_t x_min = math::realRandom(forestAABB.xMin()+len/real_t(2), forestAABB.xMax()); - real_t y_min = math::realRandom(forestAABB.yMin()+len/real_t(2), forestAABB.yMax()); - real_t z_min = math::realRandom(forestAABB.zMin()+len/real_t(2), forestAABB.zMax()); + real_t x_min = math::realRandom(forestAABB.xMin()+len/2_r, forestAABB.xMax()); + real_t y_min = math::realRandom(forestAABB.yMin()+len/2_r, forestAABB.yMax()); + real_t z_min = math::realRandom(forestAABB.zMin()+len/2_r, forestAABB.zMax()); if (i%5 == 0) { - x_min = forestAABB.xMax() - math::realRandom(len/real_t(2), len); + x_min = forestAABB.xMax() - math::realRandom(len/2_r, len); } else if (i%5 == 1){ - x_min = forestAABB.xMin() + math::realRandom(real_t(0), len/real_t(2)); + x_min = forestAABB.xMin() + math::realRandom(0_r, len/2_r); } else if (i%5 == 2){ - y_min = forestAABB.yMax() - math::realRandom(len/real_t(2), len); + y_min = forestAABB.yMax() - math::realRandom(len/2_r, len); } else if (i%5 == 3){ - y_min = forestAABB.yMin() + math::realRandom(real_t(0), len/real_t(2)); + y_min = forestAABB.yMin() + math::realRandom(0_r, len/2_r); } else if (i%5 == 4){ - z_min = forestAABB.zMin() + math::realRandom(real_t(0), len/real_t(2)); + z_min = forestAABB.zMin() + math::realRandom(0_r, len/2_r); } walberla::id_t id = walberla::id_t(i); BoxID box_ = createBox(*globalBodyStorage, *forest, storageID, id, Vec3(x_min, y_min, z_min), Vec3(len, len, len)); @@ -672,7 +672,7 @@ void HashGridsArtifactsTest(Raytracer::Algorithm raytracingAlgorithm, walberla:: } void HashGridsFromNegativeArtifactsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t antiAliasFactor, - size_t boxes, real_t boxLenMin = real_t(0.1), real_t boxLenMax = real_t(0.2)) { + size_t boxes, real_t boxLenMin = 0.1_r, real_t boxLenMax = 0.2_r) { WALBERLA_LOG_INFO_ON_ROOT("HashGrids Artifacts Test - In positive Z direction"); WALBERLA_LOG_INFO_ON_ROOT(" Generating " << boxes << " boxes"); @@ -688,20 +688,20 @@ void HashGridsFromNegativeArtifactsTest(Raytracer::Algorithm raytracingAlgorithm std::vector<BodyID> bodies; for (size_t i = 0; i < boxes; i++) { real_t len = math::realRandom(boxLenMin, boxLenMax); //0.2 0.5 - real_t x_min = math::realRandom(forestAABB.xMin()+len/real_t(2), forestAABB.xMax()); - real_t y_min = math::realRandom(forestAABB.yMin()+len/real_t(2), forestAABB.yMax()); - real_t z_min = math::realRandom(forestAABB.zMin()+len/real_t(2), forestAABB.zMax()); + real_t x_min = math::realRandom(forestAABB.xMin()+len/2_r, forestAABB.xMax()); + real_t y_min = math::realRandom(forestAABB.yMin()+len/2_r, forestAABB.yMax()); + real_t z_min = math::realRandom(forestAABB.zMin()+len/2_r, forestAABB.zMax()); if (i%5 == 0) { - x_min = forestAABB.xMax() - math::realRandom(len/real_t(2), len); + x_min = forestAABB.xMax() - math::realRandom(len/2_r, len); } else if (i%5 == 1){ - x_min = forestAABB.xMin() + math::realRandom(real_t(0), len/real_t(2)); + x_min = forestAABB.xMin() + math::realRandom(0_r, len/2_r); } else if (i%5 == 2){ - y_min = forestAABB.yMax() - math::realRandom(len/real_t(2), len); + y_min = forestAABB.yMax() - math::realRandom(len/2_r, len); } else if (i%5 == 3){ - y_min = forestAABB.yMin() + math::realRandom(real_t(0), len/real_t(2)); + y_min = forestAABB.yMin() + math::realRandom(0_r, len/2_r); } else if (i%5 == 4){ - z_min = forestAABB.zMax() - math::realRandom(len/real_t(2), len); + z_min = forestAABB.zMax() - math::realRandom(len/2_r, len); } //real_t z_min = len+0.1; @@ -717,7 +717,7 @@ void HashGridsFromNegativeArtifactsTest(Raytracer::Algorithm raytracingAlgorithm } void HashGridsFromNegativeXArtifactsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t antiAliasFactor, - size_t boxes, real_t boxLenMin = real_t(0.1), real_t boxLenMax = real_t(0.2)) { + size_t boxes, real_t boxLenMin = 0.1_r, real_t boxLenMax = 0.2_r) { WALBERLA_LOG_INFO_ON_ROOT("HashGrids Artifacts Test - In positive X direction"); WALBERLA_LOG_INFO_ON_ROOT(" Generating " << boxes << " boxes"); @@ -731,20 +731,20 @@ void HashGridsFromNegativeXArtifactsTest(Raytracer::Algorithm raytracingAlgorith // generate bodies for test for (size_t i = 0; i < boxes; i++) { real_t len = math::realRandom(boxLenMin, boxLenMax); //0.2 0.5 - real_t x_min = math::realRandom(forestAABB.xMin()+len/real_t(2), forestAABB.xMax()); - real_t y_min = math::realRandom(forestAABB.yMin()+len/real_t(2), forestAABB.yMax()); - real_t z_min = math::realRandom(forestAABB.zMin()+len/real_t(2), forestAABB.zMax()); + real_t x_min = math::realRandom(forestAABB.xMin()+len/2_r, forestAABB.xMax()); + real_t y_min = math::realRandom(forestAABB.yMin()+len/2_r, forestAABB.yMax()); + real_t z_min = math::realRandom(forestAABB.zMin()+len/2_r, forestAABB.zMax()); if (i%5 == 0) { - z_min = forestAABB.zMax() - math::realRandom(len/real_t(2), len); + z_min = forestAABB.zMax() - math::realRandom(len/2_r, len); } else if (i%5 == 1){ - z_min = forestAABB.zMin() + math::realRandom(real_t(0), len/real_t(2)); + z_min = forestAABB.zMin() + math::realRandom(0_r, len/2_r); } else if (i%5 == 2){ - y_min = forestAABB.yMax() - math::realRandom(len/real_t(2), len); + y_min = forestAABB.yMax() - math::realRandom(len/2_r, len); } else if (i%5 == 3){ - y_min = forestAABB.yMin() + math::realRandom(real_t(0), len/real_t(2)); + y_min = forestAABB.yMin() + math::realRandom(0_r, len/2_r); } else if (i%5 == 4){ - x_min = forestAABB.xMax() - math::realRandom(len/real_t(2), len); + x_min = forestAABB.xMax() - math::realRandom(len/2_r, len); } //real_t z_min = len+0.1; @@ -778,11 +778,11 @@ void HashGridsTestScene(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RA // create bodies size_t id = 0; - real_t len = real_t(0.6); + real_t len = 0.6_r; real_t x_min = 0, y_min = 0; - len = real_t(1.2); - real_t gap = real_t(0.4); + len = 1.2_r; + real_t gap = 0.4_r; // cubes on z = 0 plane for (int i = 0; ; ++i) { @@ -844,18 +844,18 @@ void HashGridsTestScene(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RA Lighting lighting(Vec3(1,2,15), Color(1, 1, 1), //diffuse Color(1, 1, 1), //specular - Color(real_t(0.4), real_t(0.4), real_t(0.4))); //ambient + Color(0.4_r, 0.4_r, 0.4_r)); //ambient int i = 0; for (auto& vector: viewVectors) { Raytracer raytracer(forest, storageID, globalBodyStorage, ccdID, size_t(640), size_t(480), - real_t(49.13), antiAliasFactor, + 49.13_r, antiAliasFactor, std::get<0>(vector), std::get<1>(vector), std::get<2>(vector), lighting, - Color(real_t(0.2),real_t(0.2),real_t(0.2))); + Color(0.2_r,0.2_r,0.2_r)); raytracer.setRaytracingAlgorithm(raytracingAlgorithm); raytracer.setImageOutputEnabled(true); @@ -900,12 +900,12 @@ int main( int argc, char** argv ) HashGridsTest(algorithm, antiAliasFactor, 60, 60, 3, 1, - real_t(0.1), real_t(0.3), true, - real_t(0.1), real_t(0.2), real_t(0.1), real_t(0.2), - real_t(0.5), real_t(0.6)); - HashGridsArtifactsTest(algorithm, antiAliasFactor, 750, real_t(0.2), real_t(0.3)); - HashGridsFromNegativeArtifactsTest(algorithm, antiAliasFactor, 750, real_t(0.2), real_t(0.3)); - HashGridsFromNegativeXArtifactsTest(algorithm, antiAliasFactor, 750, real_t(0.2), real_t(0.3)); + 0.1_r, 0.3_r, true, + 0.1_r, 0.2_r, 0.1_r, 0.2_r, + 0.5_r, 0.6_r); + HashGridsArtifactsTest(algorithm, antiAliasFactor, 750, 0.2_r, 0.3_r); + HashGridsFromNegativeArtifactsTest(algorithm, antiAliasFactor, 750, 0.2_r, 0.3_r); + HashGridsFromNegativeXArtifactsTest(algorithm, antiAliasFactor, 750, 0.2_r, 0.3_r); } return EXIT_SUCCESS; diff --git a/tests/pe/RigidBody.cpp b/tests/pe/RigidBody.cpp index f72d9ce0..28625d4e 100644 --- a/tests/pe/RigidBody.cpp +++ b/tests/pe/RigidBody.cpp @@ -82,26 +82,26 @@ void move( BodyStorage& storage, real_t dt ) void checkRotationFunctions() { MaterialID iron = Material::find("iron"); - auto sp1 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), real_t(1), iron, false, true, false ); - auto sp2 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), real_t(1), iron, false, true, false ); - auto sp3 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), real_t(1), iron, false, true, false ); - auto sp4 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), real_t(1), iron, false, true, false ); + auto sp1 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1_r, iron, false, true, false ); + auto sp2 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1_r, iron, false, true, false ); + auto sp3 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1_r, iron, false, true, false ); + auto sp4 = std::make_shared<Sphere>( 0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1_r, iron, false, true, false ); - sp1->rotate( 1, 0, 0, math::M_PI * real_t(0.5)); - sp1->rotate( 0, 1, 0, math::M_PI * real_t(0.5)); - sp1->rotate( 0, 0, 1, math::M_PI * real_t(0.5)); + sp1->rotate( 1, 0, 0, math::M_PI * 0.5_r); + sp1->rotate( 0, 1, 0, math::M_PI * 0.5_r); + sp1->rotate( 0, 0, 1, math::M_PI * 0.5_r); - sp2->rotate( 1, 0, 0, math::M_PI * real_t(0.5)); - sp2->rotate( 0, 1, 0, math::M_PI * real_t(0.5)); - sp2->rotate( 0, 0, 1, math::M_PI * real_t(0.5)); + sp2->rotate( 1, 0, 0, math::M_PI * 0.5_r); + sp2->rotate( 0, 1, 0, math::M_PI * 0.5_r); + sp2->rotate( 0, 0, 1, math::M_PI * 0.5_r); - sp3->rotate( math::M_PI * real_t(0.5), math::M_PI * real_t(0.5), math::M_PI * real_t(0.5) ); - sp4->rotate( Vec3(math::M_PI * real_t(0.5), math::M_PI * real_t(0.5), math::M_PI * real_t(0.5)) ); + sp3->rotate( math::M_PI * 0.5_r, math::M_PI * 0.5_r, math::M_PI * 0.5_r ); + sp4->rotate( Vec3(math::M_PI * 0.5_r, math::M_PI * 0.5_r, math::M_PI * 0.5_r) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp1->getQuaternion(), Quat(math::M_SQRT2 * real_t(0.5), 0, math::M_SQRT2 * real_t(0.5), 0) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp2->getQuaternion(), Quat(math::M_SQRT2 * real_t(0.5), 0, math::M_SQRT2 * real_t(0.5), 0) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp3->getQuaternion(), Quat(math::M_SQRT2 * real_t(0.5), 0, math::M_SQRT2 * real_t(0.5), 0) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp4->getQuaternion(), Quat(math::M_SQRT2 * real_t(0.5), 0, math::M_SQRT2 * real_t(0.5), 0) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp1->getQuaternion(), Quat(math::M_SQRT2 * 0.5_r, 0, math::M_SQRT2 * 0.5_r, 0) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp2->getQuaternion(), Quat(math::M_SQRT2 * 0.5_r, 0, math::M_SQRT2 * 0.5_r, 0) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp3->getQuaternion(), Quat(math::M_SQRT2 * 0.5_r, 0, math::M_SQRT2 * 0.5_r, 0) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp4->getQuaternion(), Quat(math::M_SQRT2 * 0.5_r, 0, math::M_SQRT2 * 0.5_r, 0) ); WALBERLA_CHECK_FLOAT_EQUAL( sp1->getPosition(), Vec3(0, 0, 0) ); WALBERLA_CHECK_FLOAT_EQUAL( sp2->getPosition(), Vec3(0, 0, 0) ); @@ -121,7 +121,7 @@ void checkRotationFunctions() void checkPointFunctions() { MaterialID iron = Material::find("iron"); - auto sp1 = std::make_shared<Sphere>( 0, 0, Vec3(10,10,10), Vec3(0,0,0), Quat(), real_t(1), iron, false, true, false ); + auto sp1 = std::make_shared<Sphere>( 0, 0, Vec3(10,10,10), Vec3(0,0,0), Quat(), 1_r, iron, false, true, false ); WALBERLA_CHECK( sp1->containsPoint( 10, 10, 10 ) ); WALBERLA_CHECK( sp1->containsPoint( real_c(10.9), 10, 10 ) ); @@ -148,7 +148,7 @@ int main( int argc, char** argv ) MaterialID iron = Material::find("iron"); BodyStorage storage; - SpherePtr spPtr = std::make_unique<Sphere>(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), real_t(1), iron, false, true, false); + SpherePtr spPtr = std::make_unique<Sphere>(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1_r, iron, false, true, false); SphereID sphere = static_cast<SphereID>(&storage.add(std::move(spPtr))); Vec3 x0 = Vec3(-2,2,0); diff --git a/tests/pe/ShadowCopy.cpp b/tests/pe/ShadowCopy.cpp index bf3f39c9..44e1a4ca 100644 --- a/tests/pe/ShadowCopy.cpp +++ b/tests/pe/ShadowCopy.cpp @@ -93,7 +93,7 @@ int main( int argc, char** argv ) forest->getBlockStorage(), storageID, 999999999, - Vec3(real_t(4.9),2,2), + Vec3(4.9_r,2,2), real_c(1.2)); auto sid = sp->getSystemID(); sp->setLinearVel(1,2,3); @@ -105,7 +105,7 @@ int main( int argc, char** argv ) WALBERLA_CHECK_NOT_NULLPTR(sp); WALBERLA_CHECK_FLOAT_EQUAL( sp->getLinearVel(), Vec3(1,2,3) ); WALBERLA_CHECK_FLOAT_EQUAL( sp->getAngularVel(), Vec3(1,2,3) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp->getRadius(), real_t(1.2) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp->getRadius(), 1.2_r ); destroyBodyBySID( *globalBodyStorage, forest->getBlockStorage(), storageID, sid ); WALBERLA_LOG_PROGRESS_ON_ROOT( " *** SPHERE AT BLOCK EDGE *** "); @@ -127,15 +127,15 @@ int main( int argc, char** argv ) WALBERLA_LOG_PROGRESS_ON_ROOT( " *** UNION *** "); UnionT* un = createUnion< boost::tuple<Sphere> >( *globalBodyStorage, forest->getBlockStorage(), storageID, 0, Vec3(2,2,2) ); - auto sp1 = createSphere(un, 10, Vec3(real_t(4.9),2,2), real_t(1)); - auto sp2 = createSphere(un, 11, Vec3(3,2,2), real_t(1.5)); - un->setPosition( Vec3( real_t(4.9), 2, 2) ); + auto sp1 = createSphere(un, 10, Vec3(4.9_r,2,2), 1_r); + auto sp2 = createSphere(un, 11, Vec3(3,2,2), 1.5_r); + un->setPosition( Vec3( 4.9_r, 2, 2) ); auto relPosSp1 = sp1->getRelPosition(); auto relPosSp2 = sp2->getRelPosition(); sid = un->getSystemID(); syncCall(); - un->setPosition( Vec3( real_t(5.9), 2, 2) ); + un->setPosition( Vec3( 5.9_r, 2, 2) ); WALBERLA_LOG_PROGRESS_ON_ROOT( un->getPosition() ); auto posUnion = un->getPosition(); syncCall(); @@ -147,38 +147,38 @@ int main( int argc, char** argv ) WALBERLA_CHECK_NOT_NULLPTR(sp2); WALBERLA_CHECK_EQUAL( sp1->getTypeID(), Sphere::getStaticTypeID() ); WALBERLA_CHECK_EQUAL( sp2->getTypeID(), Sphere::getStaticTypeID() ); - WALBERLA_CHECK_FLOAT_EQUAL( sp1->getRadius(), real_t(1.0) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp2->getRadius(), real_t(1.5) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp1->getRadius(), 1.0_r ); + WALBERLA_CHECK_FLOAT_EQUAL( sp2->getRadius(), 1.5_r ); WALBERLA_CHECK_FLOAT_EQUAL( un->getPosition(), posUnion ); WALBERLA_CHECK_FLOAT_EQUAL( relPosSp1, sp1->getRelPosition() ); WALBERLA_CHECK_FLOAT_EQUAL( relPosSp2, sp2->getRelPosition() ); - un->setPosition(real_t(7.5),2,2); + un->setPosition(7.5_r,2,2); WALBERLA_LOG_PROGRESS_ON_ROOT( un->getPosition() ); syncCall(); - un->setPosition(real_t(9.9),2,2); + un->setPosition(9.9_r,2,2); WALBERLA_LOG_PROGRESS_ON_ROOT( un->getPosition() ); syncCall(); - un->setPosition(real_t(10.9),2,2); + un->setPosition(10.9_r,2,2); WALBERLA_LOG_PROGRESS_ON_ROOT( un->getPosition() ); syncCall(); un = static_cast<UnionT*> (getBody( *globalBodyStorage, forest->getBlockStorage(), storageID, sid, StorageSelect::LOCAL )); - un->setPosition(real_t(12.5),2,2); + un->setPosition(12.5_r,2,2); WALBERLA_LOG_PROGRESS_ON_ROOT( un->getPosition() ); syncCall(); - un->setPosition(real_t(14.9),2,2); + un->setPosition(14.9_r,2,2); WALBERLA_LOG_PROGRESS_ON_ROOT( un->getPosition() ); syncCall(); - un->setPosition(real_t(15.9),2,2); + un->setPosition(15.9_r,2,2); WALBERLA_LOG_PROGRESS_ON_ROOT( un->getPosition() ); syncCall(); - posUnion = Vec3(real_t(0.9),2,2); + posUnion = Vec3(0.9_r,2,2); un = static_cast<UnionT*> (getBody( *globalBodyStorage, forest->getBlockStorage(), storageID, sid, StorageSelect::LOCAL )); sp1 = static_cast<SphereID> (un->begin().getBodyID()); sp2 = static_cast<SphereID> ((++(un->begin())).getBodyID()); @@ -186,8 +186,8 @@ int main( int argc, char** argv ) WALBERLA_CHECK_NOT_NULLPTR(sp2); WALBERLA_CHECK_EQUAL( sp1->getTypeID(), Sphere::getStaticTypeID() ); WALBERLA_CHECK_EQUAL( sp2->getTypeID(), Sphere::getStaticTypeID() ); - WALBERLA_CHECK_FLOAT_EQUAL( sp1->getRadius(), real_t(1.0) ); - WALBERLA_CHECK_FLOAT_EQUAL( sp2->getRadius(), real_t(1.5) ); + WALBERLA_CHECK_FLOAT_EQUAL( sp1->getRadius(), 1.0_r ); + WALBERLA_CHECK_FLOAT_EQUAL( sp2->getRadius(), 1.5_r ); WALBERLA_CHECK_FLOAT_EQUAL( un->getPosition(), posUnion ); WALBERLA_CHECK_FLOAT_EQUAL( relPosSp1, sp1->getRelPosition() ); WALBERLA_CHECK_FLOAT_EQUAL( relPosSp2, sp2->getRelPosition() ); diff --git a/tests/pe/SimpleCCD.cpp b/tests/pe/SimpleCCD.cpp index b1388dab..4f0bac75 100644 --- a/tests/pe/SimpleCCD.cpp +++ b/tests/pe/SimpleCCD.cpp @@ -60,7 +60,7 @@ int main( int argc, char** argv ) math::seedRandomGenerator(1337); for (uint_t i = 0; i < 100; ++i) - storage[0].add( std::make_unique<Sphere>(UniqueID<Sphere>::createGlobal(), 0, Vec3( math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10))), Vec3(0,0,0), Quat(), real_t(1), iron, false, false, false) ); + storage[0].add( std::make_unique<Sphere>(UniqueID<Sphere>::createGlobal(), 0, Vec3( math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10))), Vec3(0,0,0), Quat(), 1_r, iron, false, false, false) ); sccd.generatePossibleContacts(); @@ -84,14 +84,14 @@ int main( int argc, char** argv ) bs.clear(); - bs.add( std::make_unique<Sphere>(UniqueID<Sphere>::createGlobal(), 0, Vec3( math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10))), Vec3(0,0,0), Quat(), real_t(1), iron, false, false, false) ); + bs.add( std::make_unique<Sphere>(UniqueID<Sphere>::createGlobal(), 0, Vec3( math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10))), Vec3(0,0,0), Quat(), 1_r, iron, false, false, false) ); WcTimingPool pool; for (int runs = 0; runs < 10; ++runs) { auto oldSize = bs.size(); for (uint_t i = 0; i < oldSize; ++i) - bs.add( std::make_unique<Sphere>(UniqueID<Sphere>::createGlobal(), 0, Vec3( math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10))), Vec3(0,0,0), Quat(), real_t(0.5), iron, false, false, false) ); + bs.add( std::make_unique<Sphere>(UniqueID<Sphere>::createGlobal(), 0, Vec3( math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10)), math::realRandom(real_c(0), real_c(10))), Vec3(0,0,0), Quat(), 0.5_r, iron, false, false, false) ); pool["SCCD"].start(); sccd.generatePossibleContacts(); pool["SCCD"].end(); diff --git a/tests/pe/Union.cpp b/tests/pe/Union.cpp index 91db8412..2766d36c 100644 --- a/tests/pe/Union.cpp +++ b/tests/pe/Union.cpp @@ -69,15 +69,15 @@ void SnowManFallingOnPlane() cr::HCSITS cr(globalBodyStorage, forest->getBlockStoragePointer(), storageID, ccdID, fcdID); cr.setMaxIterations( uint_c(10) ); cr.setRelaxationModel( cr::HCSITS::InelasticGeneralizedMaximumDissipationContact ); - cr.setRelaxationParameter( real_t(0.7) ); - cr.setErrorReductionParameter( real_t(0.8) ); + cr.setRelaxationParameter( 0.7_r ); + cr.setErrorReductionParameter( 0.8_r ); cr.setGlobalLinearAcceleration( Vec3(0,0,-1) ); createPlane( *globalBodyStorage, 0, Vec3(0,0,1), Vec3(0,0,0) ); UnionType* un = createUnion< boost::tuple<Sphere> >( *globalBodyStorage, forest->getBlockStorage(), storageID, 0, Vec3(5,5,5) ); - auto sp1 = createSphere(un, 10, Vec3(5,5,1), real_t(1)); - auto sp2 = createSphere(un, 11, Vec3(real_t(6.7),5,real_t(1.2)), real_t(1.1)); + auto sp1 = createSphere(un, 10, Vec3(5,5,1), 1_r); + auto sp2 = createSphere(un, 11, Vec3(6.7_r,5,1.2_r), 1.1_r); auto distance = (sp1->getPosition() - sp2->getPosition()).length(); @@ -87,13 +87,13 @@ void SnowManFallingOnPlane() for (unsigned int i = 0; i < 1000; ++i) { //vtkWriter->write( true ); - cr.timestep( real_t(0.1) ); + cr.timestep( 0.1_r ); } - //WALBERLA_CHECK_FLOAT_EQUAL( sp1->getLinearVel().length(), real_t(0) ); - //WALBERLA_CHECK_FLOAT_EQUAL( sp2->getLinearVel().length(), real_t(0) ); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON( sp1->getPosition()[2], real_t(1) , real_t(0.001) ); - WALBERLA_CHECK_FLOAT_EQUAL_EPSILON( sp2->getPosition()[2], real_t(1.1), real_t(0.001) ); + //WALBERLA_CHECK_FLOAT_EQUAL( sp1->getLinearVel().length(), 0_r ); + //WALBERLA_CHECK_FLOAT_EQUAL( sp2->getLinearVel().length(), 0_r ); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON( sp1->getPosition()[2], 1_r , 0.001_r ); + WALBERLA_CHECK_FLOAT_EQUAL_EPSILON( sp2->getPosition()[2], 1.1_r, 0.001_r ); WALBERLA_CHECK_FLOAT_EQUAL( (sp1->getPosition() - sp2->getPosition()).length(), distance ); //WALBERLA_LOG_DEVEL(un); @@ -104,8 +104,8 @@ void ImpulsCarryover() MaterialID iron = Material::find("iron"); auto un = std::make_unique<UnionType>(12, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), false, true, false); - auto sp1 = std::make_unique<Sphere>( 10, 0, Vec3( 1,0,0), Vec3(0,0,0), Quat(), real_t(1), iron, false, true, false ); - auto sp2 = std::make_unique<Sphere>( 11, 0, Vec3(-1,0,0), Vec3(0,0,0), Quat(), real_t(1), iron, false, true, false ); + auto sp1 = std::make_unique<Sphere>( 10, 0, Vec3( 1,0,0), Vec3(0,0,0), Quat(), 1_r, iron, false, true, false ); + auto sp2 = std::make_unique<Sphere>( 11, 0, Vec3(-1,0,0), Vec3(0,0,0), Quat(), 1_r, iron, false, true, false ); sp1->setLinearVel(Vec3(0,real_c(+1),0)); sp2->setLinearVel(Vec3(0,real_c(-1),0)); @@ -115,9 +115,9 @@ void ImpulsCarryover() WALBERLA_CHECK_FLOAT_EQUAL( un->getPosition(), Vec3(0,0,0) ); WALBERLA_CHECK_FLOAT_EQUAL( un->getLinearVel(), Vec3(0,0,0) ); - WALBERLA_CHECK_FLOAT_EQUAL( un->getAngularVel() * Vec3(1,0,0), real_t(0) ); - WALBERLA_CHECK_FLOAT_EQUAL( un->getAngularVel() * Vec3(0,1,0), real_t(0) ); - WALBERLA_CHECK_GREATER( un->getAngularVel() * Vec3(0,0,1), real_t(0) ); + WALBERLA_CHECK_FLOAT_EQUAL( un->getAngularVel() * Vec3(1,0,0), 0_r ); + WALBERLA_CHECK_FLOAT_EQUAL( un->getAngularVel() * Vec3(0,1,0), 0_r ); + WALBERLA_CHECK_GREATER( un->getAngularVel() * Vec3(0,0,1), 0_r ); } int main( int argc, char ** argv ) diff --git a/tests/pe/VolumeInertia.cpp b/tests/pe/VolumeInertia.cpp index 6deebada..7da217c0 100644 --- a/tests/pe/VolumeInertia.cpp +++ b/tests/pe/VolumeInertia.cpp @@ -32,7 +32,7 @@ using namespace walberla::pe; template< typename ContainmentT > void calcNumeric( const ContainmentT & body, const AABB & aabb, const real_t spacing, real_t& outVolume, Vec3& outCOM, Mat3& outInertia ) { - Vector3<real_t> pointOfReference = aabb.min() + Vector3<real_t>( real_t(0.5) * spacing ); + Vector3<real_t> pointOfReference = aabb.min() + Vector3<real_t>( 0.5_r * spacing ); uint_t volume = 0; math::KahanAccumulator<real_t> centroid[3]; @@ -97,37 +97,37 @@ int main( int argc, char ** argv ) Vec3 COM; Mat3 inertia; - Sphere sp(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), real_t(2.34), material, false, true, false); - calcNumeric(sp, sp.getAABB(), real_t(0.01), volume, COM, inertia); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(sp.getVolume(), volume, real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(Sphere::calcVolume( real_t(2.34) ), volume, real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(sp.getInertia(), inertia, real_t(10)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(sp.getMass(), volume * Material::getDensity(material), real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(COM, Vec3(0), real_t(10e-4)) ); - - Box bx(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), Vec3(real_t(1.5), real_t(2.5), real_t(3.5)), material, false, true, false); - calcNumeric(bx, bx.getAABB(), real_t(0.01), volume, COM, inertia); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(bx.getVolume(), volume, real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(Box::calcVolume( Vec3(real_t(1.5), real_t(2.5), real_t(3.5)) ), volume, real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(bx.getInertia(), inertia, real_t(10)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(bx.getMass(), volume * Material::getDensity(material), real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(COM, Vec3(0), real_t(10e-4)) ); - - Ellipsoid el(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), Vec3(real_t(1.5), real_t(2.5), real_t(3.5)), material, false, true, false); - calcNumeric(el, el.getAABB(), real_t(0.01), volume, COM, inertia); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(el.getVolume(), volume, real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(Ellipsoid::calcVolume( Vec3(real_t(1.5), real_t(2.5), real_t(3.5)) ), volume, real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(el.getInertia(), inertia, real_t(10)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(el.getMass(), volume * Material::getDensity(material), real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(COM, Vec3(0), real_t(10e-4)) ); - - Capsule cp(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), real_t(1.5), real_t(2.5), material, false, true, false); - calcNumeric(cp, cp.getAABB(), real_t(0.01), volume, COM, inertia); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(cp.getVolume(), volume, real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(Capsule::calcVolume( real_t(1.5), real_t(2.5) ), volume, real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(cp.getInertia(), inertia, real_t(10)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(cp.getMass(), volume * Material::getDensity(material), real_t(10e-4)) ); - WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(COM, Vec3(0), real_t(10e-4)) ); + Sphere sp(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 2.34_r, material, false, true, false); + calcNumeric(sp, sp.getAABB(), 0.01_r, volume, COM, inertia); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(sp.getVolume(), volume, 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(Sphere::calcVolume( 2.34_r ), volume, 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(sp.getInertia(), inertia, 10_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(sp.getMass(), volume * Material::getDensity(material), 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(COM, Vec3(0), 10e-4_r) ); + + Box bx(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), Vec3(1.5_r, 2.5_r, 3.5_r), material, false, true, false); + calcNumeric(bx, bx.getAABB(), 0.01_r, volume, COM, inertia); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(bx.getVolume(), volume, 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(Box::calcVolume( Vec3(1.5_r, 2.5_r, 3.5_r) ), volume, 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(bx.getInertia(), inertia, 10_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(bx.getMass(), volume * Material::getDensity(material), 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(COM, Vec3(0), 10e-4_r) ); + + Ellipsoid el(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), Vec3(1.5_r, 2.5_r, 3.5_r), material, false, true, false); + calcNumeric(el, el.getAABB(), 0.01_r, volume, COM, inertia); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(el.getVolume(), volume, 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(Ellipsoid::calcVolume( Vec3(1.5_r, 2.5_r, 3.5_r) ), volume, 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(el.getInertia(), inertia, 10_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(el.getMass(), volume * Material::getDensity(material), 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(COM, Vec3(0), 10e-4_r) ); + + Capsule cp(0, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1.5_r, 2.5_r, material, false, true, false); + calcNumeric(cp, cp.getAABB(), 0.01_r, volume, COM, inertia); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(cp.getVolume(), volume, 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(Capsule::calcVolume( 1.5_r, 2.5_r ), volume, 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(cp.getInertia(), inertia, 10_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(cp.getMass(), volume * Material::getDensity(material), 10e-4_r) ); + WALBERLA_CHECK( walberla::debug::check_functions_detail::check_float_equal_eps(COM, Vec3(0), 10e-4_r) ); return EXIT_SUCCESS; } diff --git a/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp b/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp index 1a4293fe..77e91682 100644 --- a/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp +++ b/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp @@ -248,12 +248,12 @@ uint_t createSpheresRandomly( StructuredBlockForest & forest, pe::BodyStorage & { real_t domainVolume = generationDomain.volume(); real_t totalSphereVolume = domainVolume * solidVolumeFraction; - real_t sphereVolume = diameter * diameter * diameter * math::M_PI / real_t(6); + real_t sphereVolume = diameter * diameter * diameter * math::M_PI / 6_r; uint_t numberOfSpheres = uint_c( totalSphereVolume / sphereVolume ); - real_t xParticle = real_t(0); - real_t yParticle = real_t(0); - real_t zParticle = real_t(0); + real_t xParticle = 0_r; + real_t yParticle = 0_r; + real_t zParticle = 0_r; for( uint_t nSphere = 0; nSphere < numberOfSpheres; ++nSphere ) { @@ -273,10 +273,10 @@ uint_t createSpheresRandomly( StructuredBlockForest & forest, pe::BodyStorage & } - pe::SphereID sp = pe::createSphere( globalBodyStorage, forest.getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( xParticle, yParticle, zParticle ), diameter * real_t(0.5), material ); + pe::SphereID sp = pe::createSphere( globalBodyStorage, forest.getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( xParticle, yParticle, zParticle ), diameter * 0.5_r, material ); if( sp != nullptr ) { - sp->setLinearVel(Vector3<real_t>(real_t(0),real_t(0),initialZVelocity)); + sp->setLinearVel(Vector3<real_t>(0_r,0_r,initialZVelocity)); } } @@ -287,7 +287,7 @@ uint_t createSphereLattice( StructuredBlockForest & forest, pe::BodyStorage & gl const BlockDataID & bodyStorageID, const AABB & generationDomain, real_t diameter, real_t solidVolumeFraction, pe::MaterialID & material, real_t initialZVelocity ) { - real_t sphereVolume = math::M_PI * diameter * diameter * diameter / real_t(6); + real_t sphereVolume = math::M_PI * diameter * diameter * diameter / 6_r; real_t numSpheresDesired = solidVolumeFraction * generationDomain.volume() / sphereVolume; uint_t spheresPerDirection = uint_c(std::cbrt(numSpheresDesired) ); @@ -295,17 +295,17 @@ uint_t createSphereLattice( StructuredBlockForest & forest, pe::BodyStorage & gl WALBERLA_ASSERT( spacing >= diameter ); - Vector3<real_t> generationOrigin( generationDomain.xMin() + spacing * real_t(0.5), generationDomain.yMin() + spacing * real_t(0.5), generationDomain.zMin() + spacing * real_t(0.5)); + Vector3<real_t> generationOrigin( generationDomain.xMin() + spacing * 0.5_r, generationDomain.yMin() + spacing * 0.5_r, generationDomain.zMin() + spacing * 0.5_r); uint_t numSpheres( 0 ); for( auto it = grid_generator::SCIterator(generationDomain, generationOrigin, spacing); it != grid_generator::SCIterator(); ++it ) { - pe::SphereID sp = pe::createSphere( globalBodyStorage, forest.getBlockStorage(), bodyStorageID, 0, *it, diameter * real_t(0.5), material ); + pe::SphereID sp = pe::createSphere( globalBodyStorage, forest.getBlockStorage(), bodyStorageID, 0, *it, diameter * 0.5_r, material ); if( sp != nullptr ) { - sp->setLinearVel(Vector3<real_t>(real_t(0),real_t(0),initialZVelocity)); + sp->setLinearVel(Vector3<real_t>(0_r,0_r,initialZVelocity)); ++numSpheres; } } @@ -315,7 +315,7 @@ uint_t createSphereLattice( StructuredBlockForest & forest, pe::BodyStorage & gl mpi::allReduceInplace( numSpheres, mpi::SUM ); } - WALBERLA_LOG_INFO_ON_ROOT("Created spheres in lattice arrangement with a center-to-center spacing of " << spacing << " ( " << real_t(100)*spacing/diameter << "% of diameter )" ); + WALBERLA_LOG_INFO_ON_ROOT("Created spheres in lattice arrangement with a center-to-center spacing of " << spacing << " ( " << 100_r*spacing/diameter << "% of diameter )" ); return numSpheres; } @@ -326,7 +326,7 @@ void resetSphereVelocities( const shared_ptr<StructuredBlockForest> & blocks, co { for( auto bodyIt = pe::BodyIterator::begin< pe::Sphere >( *blockIt, bodyStorageID); bodyIt != pe::BodyIterator::end<pe::Sphere>(); ++bodyIt ) { - bodyIt->setAngularVel(real_t(0),real_t(0),real_t(0)); + bodyIt->setAngularVel(0_r,0_r,0_r); bodyIt->setLinearVel(vel); } } @@ -493,14 +493,14 @@ private: Vector3<real_t> getGNSMeanFluidVelocity( const shared_ptr<StructuredBlockStorage> & blocks, BlockDataID pdfFieldID, BlockDataID svfFieldID, real_t domainVolume ) { - Vector3<real_t> velocity( real_t(0) ); + Vector3<real_t> velocity( 0_r ); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { PdfField_T* pdfField = blockIt->getData< PdfField_T >( pdfFieldID ); ScalarField_T* svfField = blockIt->getData< ScalarField_T >( svfFieldID ); WALBERLA_FOR_ALL_CELLS_XYZ( pdfField, real_t svf = svfField->get(x,y,z); - velocity += pdfField->getVelocity(x,y,z) / (real_t(1) - svf ); + velocity += pdfField->getVelocity(x,y,z) / (1_r - svf ); ); } WALBERLA_MPI_SECTION() @@ -530,7 +530,7 @@ void logSingleResultToFile( const std::string & fileName, const real_t & solidVo class CollisionPropertiesEvaluator { public: - CollisionPropertiesEvaluator( pe::cr::ICR & collisionResponse ) : collisionResponse_( collisionResponse ), maximumPenetration_(real_t(0)) + CollisionPropertiesEvaluator( pe::cr::ICR & collisionResponse ) : collisionResponse_( collisionResponse ), maximumPenetration_(0_r) {} void operator()() @@ -548,7 +548,7 @@ public: } void resetMaximumPenetration() { - maximumPenetration_ = real_t(0); + maximumPenetration_ = 0_r; } private: pe::cr::ICR & collisionResponse_; @@ -634,12 +634,12 @@ int main( int argc, char **argv ) uint_t vtkWriteFrequency = 0; std::string baseFolder = "vtk_out_HinderedSettlingDPM"; - real_t densityRatio = real_t(2500) / real_t(1000); - real_t gravity = real_t(0.002); // has to be small enough to keep settling velocities small - real_t diameter = real_t(0.5); + real_t densityRatio = 2500_r / 1000_r; + real_t gravity = 0.002_r; // has to be small enough to keep settling velocities small + real_t diameter = 0.5_r; uint_t interactionSubCycles = uint_t(1); // number of subcycles that involve evaluation of the interaction force -> around 3 for stability with added mass uint_t peSubSteps = uint_t(1); // number of pe only calls in each subcycle - real_t solidVolumeFraction = real_t(0.05); + real_t solidVolumeFraction = 0.05_r; DPMethod dpm = DPMethod::GNS; Interpolation interpol = Interpolation::IKernel; @@ -650,17 +650,17 @@ int main( int argc, char **argv ) EffectiveViscosity effVisc = EffectiveViscosity::None; bool useTurbulenceModel = false; - const real_t smagorinskyConstant = real_t(0.1); //for turbulence model + const real_t smagorinskyConstant = 0.1_r; //for turbulence model - real_t lubricationCutOffDistance = real_t(0); //0 switches it off + real_t lubricationCutOffDistance = 0_r; //0 switches it off bool useLubricationCorrection = false; // false: use full lubrication force, true: use only correction part bool createSpheresInLattice = false; bool initialSimulationToAdjustFluidForcing = false; - real_t initialSphereVelocityZ( real_t(0) ); + real_t initialSphereVelocityZ( 0_r ); - real_t relativeVelDiffLimit( real_t(1e-5) ); //set negative to avoid convergence before 30 dimensionless timesteps + real_t relativeVelDiffLimit( 1e-5_r ); //set negative to avoid convergence before 30 dimensionless timesteps for( int i = 1; i < argc; ++i ) { @@ -692,11 +692,11 @@ int main( int argc, char **argv ) if( vtkWriteFrequency > 0 ) vtkIO = true; - WALBERLA_CHECK( diameter <= real_t(1), "Diameter is not allowed to be > 1!" ); - WALBERLA_CHECK( solidVolumeFraction <= real_t(0.65), "Solid volume fraction is not allowed to be > 0.65!" ); + WALBERLA_CHECK( diameter <= 1_r, "Diameter is not allowed to be > 1!" ); + WALBERLA_CHECK( solidVolumeFraction <= 0.65_r, "Solid volume fraction is not allowed to be > 0.65!" ); WALBERLA_CHECK( interactionSubCycles > uint_t(0), "Number of interaction sub cycles has to be at least 1!"); WALBERLA_CHECK( peSubSteps > uint_t(0), "Number of pe sub steps has to be at least 1!"); - WALBERLA_CHECK( lubricationCutOffDistance >= real_t(0), "Lubrication cut off distance has to be non-negative!"); + WALBERLA_CHECK( lubricationCutOffDistance >= 0_r, "Lubrication cut off distance has to be non-negative!"); if( funcTest ) { @@ -716,50 +716,50 @@ int main( int argc, char **argv ) // // /////////////////////////////// - const uint_t xlength = uint_c( real_t(32) * diameter ) ; + const uint_t xlength = uint_c( 32_r * diameter ) ; const uint_t ylength = xlength; const uint_t zlength = xlength; - if( solidVolumeFraction < real_t(1e-10) ) + if( solidVolumeFraction < 1e-10_r ) { // create only a single sphere - solidVolumeFraction = math::M_PI * diameter * diameter * diameter / ( real_t(6) * real_c( xlength * ylength * zlength)); + solidVolumeFraction = math::M_PI * diameter * diameter * diameter / ( 6_r * real_c( xlength * ylength * zlength)); } - const real_t diameter_SI = real_t(0.00035); // m, Finn et al, Tab 5 - const real_t gravity_SI = real_t(9.81); // m/s^2 + const real_t diameter_SI = 0.00035_r; // m, Finn et al, Tab 5 + const real_t gravity_SI = 9.81_r; // m/s^2 const real_t dx_SI = diameter_SI / diameter; - const real_t dx = real_t(1); - const real_t viscosity_SI = real_t(1e-3); // kg/(ms) - const real_t densityFluid_SI = real_t(1e3); // kg/m^3 + const real_t dx = 1_r; + const real_t viscosity_SI = 1e-3_r; // kg/(ms) + const real_t densityFluid_SI = 1e3_r; // kg/m^3 const real_t dt_SI = std::sqrt(gravity * dx_SI / gravity_SI); const real_t viscosity = ( viscosity_SI/densityFluid_SI ) * dt_SI / ( dx_SI * dx_SI ); - const real_t tau = real_t(1) / lbm::collision_model::omegaFromViscosity( viscosity ); + const real_t tau = 1_r / lbm::collision_model::omegaFromViscosity( viscosity ); - real_t gravitationalForce = - gravity * ( densityRatio - real_t(1) ) * diameter * diameter * diameter * math::PI / real_t(6); + real_t gravitationalForce = - gravity * ( densityRatio - 1_r ) * diameter * diameter * diameter * math::PI / 6_r; // unhindered settling velocity of a single sphere in infinite fluid, would come from experiments or DNS, NOT Stokes settling velocity, from Finn et al, Tab 5 - const real_t velUnhindered_SI = real_t(-0.048); // m/s + const real_t velUnhindered_SI = -0.048_r; // m/s - const real_t velStokes = -( densityRatio - real_t(1) ) * diameter * diameter * gravity / ( real_t(18) * viscosity ); + const real_t velStokes = -( densityRatio - 1_r ) * diameter * diameter * gravity / ( 18_r * viscosity ); const real_t velUnhindered = velUnhindered_SI * dt_SI / dx_SI; - const real_t dt_DEM = real_t(1) / real_c(interactionSubCycles * peSubSteps); + const real_t dt_DEM = 1_r / real_c(interactionSubCycles * peSubSteps); - const real_t dt = real_t(1); + const real_t dt = 1_r; const real_t dtInteractionSubCycle = dt / real_c(interactionSubCycles); const real_t dtBodyVelocityTimeDerivativeEvaluation = dtInteractionSubCycle; - const uint_t tStokes = uint_c(densityRatio * diameter * diameter / ( real_t(18) * viscosity )); + const uint_t tStokes = uint_c(densityRatio * diameter * diameter / ( 18_r * viscosity )); const uint_t timesteps = (funcTest) ? uint_t(10) : uint_t(30) * tStokes; // total number of time steps for the whole simulation - const Vector3<real_t> initialFluidVelocity( real_t(0) ); + const Vector3<real_t> initialFluidVelocity( 0_r ); - const std::string fileNameLoggingInit = baseFolder+"/evalHinderedSettlingDynamicsSubgrid_eps"+std::to_string(uint_c(real_t(100) * solidVolumeFraction))+"_d"+std::to_string(uint_c(real_t(100) * diameter))+"_init.txt"; - const std::string fileNameLogging = baseFolder+"/evalHinderedSettlingDynamicsSubgrid_eps"+std::to_string(uint_c(real_t(100) * solidVolumeFraction))+"_d"+std::to_string(uint_c(real_t(100) * diameter))+".txt"; + const std::string fileNameLoggingInit = baseFolder+"/evalHinderedSettlingDynamicsSubgrid_eps"+std::to_string(uint_c(100_r * solidVolumeFraction))+"_d"+std::to_string(uint_c(100_r * diameter))+"_init.txt"; + const std::string fileNameLogging = baseFolder+"/evalHinderedSettlingDynamicsSubgrid_eps"+std::to_string(uint_c(100_r * solidVolumeFraction))+"_d"+std::to_string(uint_c(100_r * diameter))+".txt"; if( !funcTest ) { WALBERLA_LOG_INFO_ON_ROOT("Lx x Ly x Lz = " << xlength << " x " << ylength << " x " << zlength); @@ -781,7 +781,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT("pe sub steps = " << peSubSteps); WALBERLA_LOG_INFO_ON_ROOT("lubrication cut off distance = " << lubricationCutOffDistance); WALBERLA_LOG_INFO_ON_ROOT("use lubrication correction term instead of full formula = " << (useLubricationCorrection ? "yes" : "no")); - WALBERLA_LOG_INFO_ON_ROOT("Ga = " << std::sqrt((densityRatio - real_t(1)) * gravity * diameter * diameter * diameter) / viscosity); + WALBERLA_LOG_INFO_ON_ROOT("Ga = " << std::sqrt((densityRatio - 1_r) * gravity * diameter * diameter * diameter) / viscosity); WALBERLA_LOG_INFO_ON_ROOT("dx_SI = " << dx_SI << ", dt_SI = " << dt_SI); WALBERLA_LOG_INFO_ON_ROOT("dt_DEM = " << dt_DEM); WALBERLA_LOG_INFO_ON_ROOT("t_ref = " << tStokes << " simulation steps"); @@ -824,18 +824,18 @@ int main( int argc, char **argv ) pe::cr::DEM cr_dem(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID ); cr = &cr_dem; - const real_t restitutionCoeff = real_t(0.88); - const real_t frictionCoeff = real_t(0.25); + const real_t restitutionCoeff = 0.88_r; + const real_t frictionCoeff = 0.25_r; - real_t sphereVolume = diameter * diameter * diameter * math::M_PI / real_t(6); + real_t sphereVolume = diameter * diameter * diameter * math::M_PI / 6_r; const real_t particleMass = densityRatio * sphereVolume; - const real_t Mij = particleMass * particleMass / ( real_t(2) * particleMass ); + const real_t Mij = particleMass * particleMass / ( 2_r * particleMass ); const real_t lnDryResCoeff = std::log(restitutionCoeff); - const real_t collisionTime = real_t(0.5); - const real_t stiffnessCoeff = math::M_PI * math::M_PI * Mij / ( collisionTime * collisionTime * ( real_t(1) - lnDryResCoeff * lnDryResCoeff / ( math::M_PI * math::M_PI + lnDryResCoeff* lnDryResCoeff ) ) ); - const real_t dampingCoeff = - real_t(2) * std::sqrt( Mij * stiffnessCoeff ) * + const real_t collisionTime = 0.5_r; + const real_t stiffnessCoeff = math::M_PI * math::M_PI * Mij / ( collisionTime * collisionTime * ( 1_r - lnDryResCoeff * lnDryResCoeff / ( math::M_PI * math::M_PI + lnDryResCoeff* lnDryResCoeff ) ) ); + const real_t dampingCoeff = - 2_r * std::sqrt( Mij * stiffnessCoeff ) * ( std::log(restitutionCoeff) / std::sqrt( math::M_PI * math::M_PI + (std::log(restitutionCoeff) * std::log(restitutionCoeff) ) ) ); - const real_t contactDuration = real_t(2) * math::M_PI * Mij / ( std::sqrt( real_t(4) * Mij * stiffnessCoeff - dampingCoeff * dampingCoeff )); //formula from Uhlman + const real_t contactDuration = 2_r * math::M_PI * Mij / ( std::sqrt( 4_r * Mij * stiffnessCoeff - dampingCoeff * dampingCoeff )); //formula from Uhlman if( !funcTest ) { WALBERLA_LOG_INFO_ON_ROOT("Created sediment material with:\n" @@ -845,7 +845,7 @@ int main( int argc, char **argv ) << " - damping coefficient cdn = " << dampingCoeff << "\n" << " - contact time Tc = " << contactDuration); } - auto peMaterial = pe::createMaterial( "sedimentMat", densityRatio, restitutionCoeff, frictionCoeff, frictionCoeff, real_t(0), real_t(200), stiffnessCoeff, dampingCoeff, dampingCoeff ); + auto peMaterial = pe::createMaterial( "sedimentMat", densityRatio, restitutionCoeff, frictionCoeff, frictionCoeff, 0_r, 200_r, stiffnessCoeff, dampingCoeff, dampingCoeff ); ///////////////// // PE COUPLING // @@ -861,20 +861,20 @@ int main( int argc, char **argv ) if ( createSpheresInLattice ) { - numSpheres = createSphereLattice( *blocks, *globalBodyStorage, bodyStorageID, AABB( real_t(0), real_t(0), real_t(0), real_c(xlength), real_c(ylength), real_c(zlength) ), - diameter, solidVolumeFraction, peMaterial, real_t(0) ); + numSpheres = createSphereLattice( *blocks, *globalBodyStorage, bodyStorageID, AABB( 0_r, 0_r, 0_r, real_c(xlength), real_c(ylength), real_c(zlength) ), + diameter, solidVolumeFraction, peMaterial, 0_r ); syncCall(); } else { - numSpheres = createSpheresRandomly( *blocks, *globalBodyStorage, bodyStorageID, AABB( real_t(0), real_t(0), real_t(0), real_c(xlength), real_c(ylength), real_c(zlength) ), - diameter, solidVolumeFraction, peMaterial, real_t(0) ); + numSpheres = createSpheresRandomly( *blocks, *globalBodyStorage, bodyStorageID, AABB( 0_r, 0_r, 0_r, real_c(xlength), real_c(ylength), real_c(zlength) ), + diameter, solidVolumeFraction, peMaterial, 0_r ); syncCall(); const uint_t initialPeSteps = uint_t(50000); - const real_t dt_DEM_init = collisionTime / real_t(10); - const real_t overlapLimit = real_t(0.05) * diameter; + const real_t dt_DEM_init = collisionTime / 10_r; + const real_t overlapLimit = 0.05_r * diameter; - WALBERLA_LOG_INFO_ON_ROOT("Sphere creation done --- resolving overlaps with goal all < " << overlapLimit / diameter * real_t(100) << "%"); + WALBERLA_LOG_INFO_ON_ROOT("Sphere creation done --- resolving overlaps with goal all < " << overlapLimit / diameter * 100_r << "%"); for( uint_t pet = uint_t(1); pet <= initialPeSteps; ++pet ) { @@ -889,43 +889,43 @@ int main( int argc, char **argv ) }else{ if( pet % uint_t(200) == uint_t(0) ) { - WALBERLA_LOG_INFO_ON_ROOT(pet << " - current max overlap = " << maxPen / diameter * real_t(100) << "%"); + WALBERLA_LOG_INFO_ON_ROOT(pet << " - current max overlap = " << maxPen / diameter * 100_r << "%"); } } collisionPropertiesEvaluator->resetMaximumPenetration(); } } - Vector3<real_t> initialSphereVelocity(real_t(0), real_t(0), initialSphereVelocityZ); + Vector3<real_t> initialSphereVelocity(0_r, 0_r, initialSphereVelocityZ); WALBERLA_LOG_INFO_ON_ROOT("Resetting sphere velocity to " << initialSphereVelocity ); resetSphereVelocities( blocks, bodyStorageID, initialSphereVelocity ); const real_t domainVolume = real_c( xlength * ylength * zlength ); - real_t actualSolidVolumeFraction = real_c( numSpheres ) * diameter * diameter * diameter * math::M_PI / ( real_t(6) * domainVolume ); + real_t actualSolidVolumeFraction = real_c( numSpheres ) * diameter * diameter * diameter * math::M_PI / ( 6_r * domainVolume ); real_t ReynoldsNumber = std::fabs(velUnhindered) * diameter / viscosity; // apply external forcing on fluid to approximately balance the force from the settling particles to avoid too large fluid or particle velocities - const real_t extForceZ = actualSolidVolumeFraction * gravity * (densityRatio - real_t(1)); - Vector3<real_t> extForce = Vector3<real_t>(real_t(0), real_t(0), extForceZ ); + const real_t extForceZ = actualSolidVolumeFraction * gravity * (densityRatio - 1_r); + Vector3<real_t> extForce = Vector3<real_t>(0_r, 0_r, extForceZ ); // apply estimate by Richardson & Zaki (1954) for unbounded flow (DomainLength->infty) real_t n = 0; - if( ReynoldsNumber < real_t(0.2) ) + if( ReynoldsNumber < 0.2_r ) { - n = real_t(4.65); - } else if ( ReynoldsNumber < real_t(1) ) + n = 4.65_r; + } else if ( ReynoldsNumber < 1_r ) { - n = real_t(4.35) * std::pow( ReynoldsNumber, real_t(-0.03) ); - } else if ( ReynoldsNumber < real_t(500) ) + n = 4.35_r * std::pow( ReynoldsNumber, -0.03_r ); + } else if ( ReynoldsNumber < 500_r ) { - n = real_t(4.45) * std::pow( ReynoldsNumber, real_t(-0.1) ); + n = 4.45_r * std::pow( ReynoldsNumber, -0.1_r ); } else { - n = real_t(2.39); + n = 2.39_r; } - real_t expectedVelocity = velUnhindered * std::pow( ( real_t(1) - actualSolidVolumeFraction ), n ); + real_t expectedVelocity = velUnhindered * std::pow( ( 1_r - actualSolidVolumeFraction ), n ); WALBERLA_LOG_INFO_ON_ROOT("solid volume fraction = " << actualSolidVolumeFraction ); WALBERLA_LOG_INFO_ON_ROOT("number of spheres = " << numSpheres ); @@ -934,7 +934,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT("Re = " << ReynoldsNumber ); WALBERLA_LOG_INFO_ON_ROOT("expected settling velocity = " << expectedVelocity <<" = " << expectedVelocity * dx_SI / dt_SI << " m/s" ); WALBERLA_LOG_INFO_ON_ROOT("external forcing on fluid = " << extForce ); - WALBERLA_LOG_INFO_ON_ROOT("total external forcing applied on all fluid cells = " << extForce[2] * (real_t(1) - actualSolidVolumeFraction) * real_c( xlength * ylength * zlength ) ); + WALBERLA_LOG_INFO_ON_ROOT("total external forcing applied on all fluid cells = " << extForce[2] * (1_r - actualSolidVolumeFraction) * real_c( xlength * ylength * zlength ) ); WALBERLA_LOG_INFO_ON_ROOT("total external (gravity & buoyancy) force on all spheres = " << gravitationalForce * real_c(numSpheres) ); ////////////////////// @@ -944,20 +944,20 @@ int main( int argc, char **argv ) ////////////////////// // create force field - BlockDataID forceFieldID = field::addToStorage< Vec3Field_T >( blocks, "force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); + BlockDataID forceFieldID = field::addToStorage< Vec3Field_T >( blocks, "force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); - BlockDataID dragForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "drag force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); - BlockDataID amForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "am force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); - BlockDataID liftForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "lift force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); + BlockDataID dragForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "drag force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); + BlockDataID amForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "am force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); + BlockDataID liftForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "lift force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); // create omega field - BlockDataID omegaFieldID = field::addToStorage< ScalarField_T >( blocks, "omega field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID omegaFieldID = field::addToStorage< ScalarField_T >( blocks, "omega field", 0_r, field::zyxf, FieldGhostLayers ); // create the lattice model LatticeModel_T latticeModel = LatticeModel_T( omegaFieldID, ForceModel_T( forceFieldID ) ); // add PDF field - BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, initialFluidVelocity, real_t(1), FieldGhostLayers, field::zyxf ); + BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, initialFluidVelocity, 1_r, FieldGhostLayers, field::zyxf ); // add flag field BlockDataID flagFieldID = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" ); @@ -971,10 +971,10 @@ int main( int argc, char **argv ) BlockDataID swappedOldVelocityFieldID = field::addToStorage< Vec3Field_T >( blocks, "swapped old velocity field", initialFluidVelocity, field::zyxf, FieldGhostLayers ); // create pressure field - BlockDataID pressureFieldID = field::addToStorage< ScalarField_T >( blocks, "pressure field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID pressureFieldID = field::addToStorage< ScalarField_T >( blocks, "pressure field", 0_r, field::zyxf, FieldGhostLayers ); // create solid volume fraction field - BlockDataID svfFieldID = field::addToStorage< ScalarField_T >( blocks, "svf field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID svfFieldID = field::addToStorage< ScalarField_T >( blocks, "svf field", 0_r, field::zyxf, FieldGhostLayers ); // field to store pressure gradient BlockDataID pressureGradientFieldID = field::addToStorage< Vec3Field_T >( blocks, "pressure gradient field", Vector3<real_t>(real_c(0)), field::zyxf, FieldGhostLayers ); @@ -1325,7 +1325,7 @@ int main( int argc, char **argv ) // function to evaluate lubrication forces std::function<void(void)> lubricationEvaluationFunction; - if( lubricationCutOffDistance > real_t(0) ) + if( lubricationCutOffDistance > 0_r ) { if( useLubricationCorrection ) { @@ -1358,7 +1358,7 @@ int main( int argc, char **argv ) // if this force is approximately converged, see if it matches the gravitational force // if not, change the external force accordingly - if( solidVolumeFraction > real_t(0.01) && initialSimulationToAdjustFluidForcing ) + if( solidVolumeFraction > 0.01_r && initialSimulationToAdjustFluidForcing ) { WALBERLA_LOG_INFO_ON_ROOT("===================================================================================" ); WALBERLA_LOG_INFO_ON_ROOT("Starting initial simulation to equilibrate fluid forcing and interaction force"); @@ -1470,9 +1470,9 @@ int main( int argc, char **argv ) // execute simulation WcTimingPool timeloopInitTiming; - real_t oldInteractionForce( real_t(0) ); - real_t curInteractionForce( real_t(0) ); - real_t relativeForceDiffLimit( real_t(1e-4) ); + real_t oldInteractionForce( 0_r ); + real_t curInteractionForce( 0_r ); + real_t relativeForceDiffLimit( 1e-4_r ); real_t relativeForceConvergenceLimit( real_t( 1e-3 ) ); for( uint_t t = 0; t <= timesteps; ++t ) { @@ -1488,9 +1488,9 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT("initial simulation ended with relative difference of interaction forces of " << relativeForceDiffLimit << " after " << t << " time steps."); - real_t actingExternalForceOnSpheres = real_c(numSpheres) * ( ( - gravity * densityRatio * diameter * diameter * diameter * math::PI / real_t(6) ) + - ( gravity * real_t(1) * diameter * diameter * diameter * math::PI / real_t(6) ) + - ( extForce[2] * real_t(1) * diameter * diameter * diameter * math::PI / real_t(6) ) ); + real_t actingExternalForceOnSpheres = real_c(numSpheres) * ( ( - gravity * densityRatio * diameter * diameter * diameter * math::PI / 6_r ) + + ( gravity * 1_r * diameter * diameter * diameter * math::PI / 6_r ) + + ( extForce[2] * 1_r * diameter * diameter * diameter * math::PI / 6_r ) ); WALBERLA_LOG_INFO_ON_ROOT("f_interaction_z = " << curInteractionForce << ", f_ext_z = " << actingExternalForceOnSpheres ); if( std::fabs( ( std::fabs( curInteractionForce ) - std::fabs( actingExternalForceOnSpheres ) )/ std::fabs( curInteractionForce ) ) < relativeForceConvergenceLimit ) { @@ -1504,7 +1504,7 @@ int main( int argc, char **argv ) extForce[2] = extForce[2] * ( std::fabs( actingExternalForceOnSpheres ) / std::fabs( curInteractionForce ) ); gnsExternalForceOnForceFieldAdder->reset(extForce); WALBERLA_LOG_INFO_ON_ROOT("restarting initial simulation with new external force = " << extForce[2]); - curInteractionForce = real_t(0); + curInteractionForce = 0_r; } } oldInteractionForce = curInteractionForce; @@ -1521,7 +1521,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT("===================================================================================" ); WALBERLA_LOG_INFO_ON_ROOT("Starting simulation with:" ); WALBERLA_LOG_INFO_ON_ROOT("external forcing on fluid = " << extForce ); - WALBERLA_LOG_INFO_ON_ROOT("total external forces on all particles = " << real_c(numSpheres) * ( - gravity * ( densityRatio - real_t(1) ) + extForce[2] ) * diameter * diameter * diameter * math::PI / real_t(6) ); + WALBERLA_LOG_INFO_ON_ROOT("total external forces on all particles = " << real_c(numSpheres) * ( - gravity * ( densityRatio - 1_r ) + extForce[2] ) * diameter * diameter * diameter * math::PI / 6_r ); WALBERLA_LOG_INFO_ON_ROOT("simulating " << timesteps << " time steps" ); @@ -1539,7 +1539,7 @@ int main( int argc, char **argv ) { (*collisionPropertiesEvaluator)(); real_t maxPen = collisionPropertiesEvaluator->getMaximumPenetrationInSimulation(); - WALBERLA_LOG_INFO_ON_ROOT("maximum penetration before the simulation (maxPen) = " << maxPen << ", maxPen / D = " << real_t(100) * maxPen / diameter << "%"); + WALBERLA_LOG_INFO_ON_ROOT("maximum penetration before the simulation (maxPen) = " << maxPen << ", maxPen / D = " << 100_r * maxPen / diameter << "%"); } collisionPropertiesEvaluator->resetMaximumPenetration(); @@ -1642,9 +1642,9 @@ int main( int argc, char **argv ) // ext forces on bodies timeloop.add() << Sweep( DummySweep(), "Dummy Sweep ") - << AfterFunction( pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, Vector3<real_t>(0,0,- gravity * densityRatio * diameter * diameter * diameter * math::PI / real_t(6) ) ), "Gravitational Force Add" ) - << AfterFunction( pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, Vector3<real_t>(0,0,gravity * real_t(1) * diameter * diameter * diameter * math::PI / real_t(6) ) ), "Buoyancy Force (due to gravity) Add" ) - << AfterFunction( pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, Vector3<real_t>(0,0,extForce[2] * real_t(1) * diameter * diameter * diameter * math::PI / real_t(6) ) ), "Buoyancy Force (due to external fluid force) Add" ) + << AfterFunction( pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, Vector3<real_t>(0,0,- gravity * densityRatio * diameter * diameter * diameter * math::PI / 6_r ) ), "Gravitational Force Add" ) + << AfterFunction( pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, Vector3<real_t>(0,0,gravity * 1_r * diameter * diameter * diameter * math::PI / 6_r ) ), "Buoyancy Force (due to gravity) Add" ) + << AfterFunction( pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, Vector3<real_t>(0,0,extForce[2] * 1_r * diameter * diameter * diameter * math::PI / 6_r ) ), "Buoyancy Force (due to external fluid force) Add" ) << AfterFunction( pe_coupling::TimeStep( blocks, bodyStorageID, *cr, syncCall, dtInteractionSubCycle, peSubSteps, lubricationEvaluationFunction ), "Pe Time Step" ); timeloop.add() << Sweep( DummySweep(), "Dummy Sweep ") @@ -1707,8 +1707,8 @@ int main( int argc, char **argv ) // execute simulation WcTimingPool timeloopTiming; - real_t oldSettlingVel( real_t(0) ); - real_t curSettlingVel( real_t(0) ); + real_t oldSettlingVel( 0_r ); + real_t curSettlingVel( 0_r ); for( uint_t t = 0; t < timesteps; ++t ) { timeloop.singleStep( timeloopTiming ); @@ -1737,13 +1737,13 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT(" - simulated settling velocity = " << curSettlingVel << ", us/uT = " << curSettlingVel / velUnhindered); WALBERLA_LOG_INFO_ON_ROOT(" - expected settling velocity = " << expectedVelocity << ", ue/uT = " << expectedVelocity / velUnhindered); WALBERLA_LOG_INFO_ON_ROOT("detailed overview:"); - WALBERLA_LOG_INFO_ON_ROOT(" - mean particle velocity = " << meanParticleVel << " = " << meanParticleVel * dx_SI/dt_SI << " m/s ( " << std::fabs(meanParticleVel/curSettlingVel)*real_t(100) << "% of settling vel)"); - WALBERLA_LOG_INFO_ON_ROOT(" - mean fluid velocity = " << meanFluidVel << " = " << meanFluidVel * dx_SI/dt_SI << " m/s ( " << std::fabs(meanFluidVel/curSettlingVel)*real_t(100) << "% of settling vel)"); + WALBERLA_LOG_INFO_ON_ROOT(" - mean particle velocity = " << meanParticleVel << " = " << meanParticleVel * dx_SI/dt_SI << " m/s ( " << std::fabs(meanParticleVel/curSettlingVel)*100_r << "% of settling vel)"); + WALBERLA_LOG_INFO_ON_ROOT(" - mean fluid velocity = " << meanFluidVel << " = " << meanFluidVel * dx_SI/dt_SI << " m/s ( " << std::fabs(meanFluidVel/curSettlingVel)*100_r << "% of settling vel)"); WALBERLA_LOG_INFO_ON_ROOT(" - mean relative velocity = " << curSettlingVel << " = " << curSettlingVel * dx_SI/dt_SI << " m/s"); WALBERLA_LOG_INFO_ON_ROOT(" - expected velocity (R&Z) = " << expectedVelocity << " = " << expectedVelocity * dx_SI/dt_SI << " m/s"); real_t maxPen = collisionPropertiesEvaluator->getMaximumPenetrationInSimulation(); - WALBERLA_LOG_INFO_ON_ROOT(" - maximum penetration (maxPen) = " << maxPen << ", maxPen / D = " << real_t(100) * maxPen / diameter << "%"); + WALBERLA_LOG_INFO_ON_ROOT(" - maximum penetration (maxPen) = " << maxPen << ", maxPen / D = " << 100_r * maxPen / diameter << "%"); if ( fileIO ) { diff --git a/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp b/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp index f40e6156..15dcb40d 100644 --- a/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp +++ b/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp @@ -277,7 +277,7 @@ public: { if( writeLogging_ ) { - fileName_ = baseFolder+"/evalCollisionBehaviorDPM_"+std::to_string(uint_c(real_t(10) * densityRatio))+"_"+std::to_string(uint_c(real_t(10) * Galileo))+"_"+std::to_string(uint_c(real_t(10) * diameter))+".txt"; + fileName_ = baseFolder+"/evalCollisionBehaviorDPM_"+std::to_string(uint_c(10_r * densityRatio))+"_"+std::to_string(uint_c(10_r * Galileo))+"_"+std::to_string(uint_c(10_r * diameter))+".txt"; std::ofstream file; file.open( fileName_.c_str() ); file << "#t z velz x y velx vely fx fy fz\n"; @@ -332,7 +332,7 @@ public: file << "# t position velocity\n"; for(uint_t t = 0; t < positionsOverTime_.size(); ++t) { - file << (real_c(t) - real_c(tImpact)) * terminalVelocity / diameter_ << " " << ( positionsOverTime_[t] - real_t(0.5) * diameter_ ) / diameter_ << " " << velocitiesOverTime_[t] / terminalVelocity << "\n"; + file << (real_c(t) - real_c(tImpact)) * terminalVelocity / diameter_ << " " << ( positionsOverTime_[t] - 0.5_r * diameter_ ) / diameter_ << " " << velocitiesOverTime_[t] / terminalVelocity << "\n"; } file.close(); @@ -440,7 +440,7 @@ private: class CollisionPropertiesEvaluator { public: - CollisionPropertiesEvaluator( pe::cr::ICR & collisionResponse ) : collisionResponse_( collisionResponse ), maximumPenetration_(real_t(0)) + CollisionPropertiesEvaluator( pe::cr::ICR & collisionResponse ) : collisionResponse_( collisionResponse ), maximumPenetration_(0_r) {} void operator()() @@ -537,13 +537,13 @@ int main( int argc, char **argv ) bool fileIO = false; std::string baseFolder = "vtk_out_SphereWallDPM"; - real_t gravity = real_t(1e-4); - real_t densityRatio = real_t(2.0); - real_t diameter = real_t(0.5); - real_t GalileoNumber = real_t(30.9); + real_t gravity = 1e-4_r; + real_t densityRatio = 2.0_r; + real_t diameter = 0.5_r; + real_t GalileoNumber = 30.9_r; uint_t interactionSubCycles = uint_t(1); // number of subcycles that involve evaluation of the interaction force uint_t peSubSteps = uint_t(1); // number of pe only calls in each subcycle - real_t collisionTime = real_t(1); + real_t collisionTime = 1_r; DPMethod dpm = DPMethod::GNS; Interpolation interpol = Interpolation::IKernel; @@ -553,9 +553,9 @@ int main( int argc, char **argv ) AddedMassCorrelation addedMassCorr = AddedMassCorrelation::NoAM; EffectiveViscosity effVisc = EffectiveViscosity::None; bool useTurbulenceModel = false; - real_t lubricationCutOffDistance = real_t(0); //0 switches it off, should be <= diameter for sphere-wall collision, and <= diameter/2 for sphere-sphere collision + real_t lubricationCutOffDistance = 0_r; //0 switches it off, should be <= diameter for sphere-wall collision, and <= diameter/2 for sphere-sphere collision bool useLubricationCorrection = false; // false: use full lubrication force, true: use only correction part - const real_t smagorinskyConstant = real_t(0.1); //for turbulence model + const real_t smagorinskyConstant = 0.1_r; //for turbulence model uint_t dimlessTimesteps = uint_t(500); @@ -585,10 +585,10 @@ int main( int argc, char **argv ) else WALBERLA_ABORT("Found invalid command line argument: \"" << argv[i] << "\" - aborting..."); } - WALBERLA_CHECK( diameter <= real_t(1), "Diameter is not allowed to be > 1!" ); + WALBERLA_CHECK( diameter <= 1_r, "Diameter is not allowed to be > 1!" ); WALBERLA_CHECK( interactionSubCycles > uint_t(0), "Number of interaction sub cycles has to be at least 1!"); WALBERLA_CHECK( peSubSteps > uint_t(0), "Number of pe sub steps has to be at least 1!"); - WALBERLA_CHECK( lubricationCutOffDistance >= real_t(0), "Lubrication cut off distance has to be non-negative!"); + WALBERLA_CHECK( lubricationCutOffDistance >= 0_r, "Lubrication cut off distance has to be non-negative!"); if( funcTest ) { @@ -609,17 +609,17 @@ int main( int argc, char **argv ) /////////////////////////////// // roughly resembles the experimental setup from Gondret et al (2002) - const uint_t xlength = uint_t( real_t(32) * diameter); - const uint_t ylength = uint_t( real_t(32) * diameter); - const uint_t zlength = uint_t(real_t(512) * diameter); - const real_t dx = real_t(1); + const uint_t xlength = uint_t( 32_r * diameter); + const uint_t ylength = uint_t( 32_r * diameter); + const uint_t zlength = uint_t(512_r * diameter); + const real_t dx = 1_r; - const real_t ug = std::sqrt(( densityRatio - real_t(1)) * gravity * diameter ); + const real_t ug = std::sqrt(( densityRatio - 1_r) * gravity * diameter ); const real_t viscosity = ug * diameter / GalileoNumber; - const real_t tau = real_t(1) / lbm::collision_model::omegaFromViscosity(viscosity); + const real_t tau = 1_r / lbm::collision_model::omegaFromViscosity(viscosity); - const real_t sphereVolume = math::M_PI * diameter * diameter * diameter / real_t(6); - Vector3<real_t> gravitationalForce ( real_t(0), real_t(0), ( densityRatio - real_t(1) ) * sphereVolume * gravity ); + const real_t sphereVolume = math::M_PI * diameter * diameter * diameter / 6_r; + Vector3<real_t> gravitationalForce ( 0_r, 0_r, ( densityRatio - 1_r ) * sphereVolume * gravity ); if( !funcTest ) { @@ -645,16 +645,16 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT("pe sub steps = " << peSubSteps ); WALBERLA_LOG_INFO_ON_ROOT("lubrication cut off distance = " << lubricationCutOffDistance ); WALBERLA_LOG_INFO_ON_ROOT("use lubrication correction term instead of full formula = " << ( useLubricationCorrection ? "yes" : "no" ) ); - WALBERLA_LOG_INFO_ON_ROOT("dt_DEM = " << real_t(1) / real_c(interactionSubCycles * peSubSteps) ); + WALBERLA_LOG_INFO_ON_ROOT("dt_DEM = " << 1_r / real_c(interactionSubCycles * peSubSteps) ); } - const real_t dt = real_t(1); + const real_t dt = 1_r; const real_t dtInteractionSubCycle = dt / real_c(interactionSubCycles); const real_t dtBodyVelocityTimeDerivativeEvaluation = dtInteractionSubCycle; - const real_t tStokes = densityRatio * diameter * diameter / ( real_t(18) * viscosity ); + const real_t tStokes = densityRatio * diameter * diameter / ( 18_r * viscosity ); const uint_t timesteps = (funcTest) ? uint_t(3) : dimlessTimesteps * uint_c(tStokes); // total number of time steps for the whole simulation @@ -703,20 +703,20 @@ int main( int argc, char **argv ) auto syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create the sphere - const real_t restitutionCoeff = real_t(0.97); - const real_t frictionCoeff = real_t(0.1); + const real_t restitutionCoeff = 0.97_r; + const real_t frictionCoeff = 0.1_r; const real_t scaledCollisionTime = collisionTime * diameter / dx; // smaller diameter -> smaller collision time to keep maximum penetration small -> more pe substeps to resolve it const real_t particleMass = densityRatio * sphereVolume; - const real_t Mij = particleMass; // * particleMass / ( real_t(2) * particleMass ); // Mij = M for sphere-wall collision + const real_t Mij = particleMass; // * particleMass / ( 2_r * particleMass ); // Mij = M for sphere-wall collision const real_t lnDryResCoeff = std::log(restitutionCoeff); - const real_t stiffnessCoeff = math::M_PI * math::M_PI * Mij / ( scaledCollisionTime * scaledCollisionTime * ( real_t(1) - lnDryResCoeff * lnDryResCoeff / ( math::M_PI * math::M_PI + lnDryResCoeff* lnDryResCoeff ) ) ); - const real_t normalizedStiffnessCoeff = stiffnessCoeff / ( ( densityRatio - real_t(1) ) * gravity * sphereVolume / diameter ); + const real_t stiffnessCoeff = math::M_PI * math::M_PI * Mij / ( scaledCollisionTime * scaledCollisionTime * ( 1_r - lnDryResCoeff * lnDryResCoeff / ( math::M_PI * math::M_PI + lnDryResCoeff* lnDryResCoeff ) ) ); + const real_t normalizedStiffnessCoeff = stiffnessCoeff / ( ( densityRatio - 1_r ) * gravity * sphereVolume / diameter ); - const real_t dampingCoeff = - real_t(2) * std::sqrt( Mij * stiffnessCoeff ) * + const real_t dampingCoeff = - 2_r * std::sqrt( Mij * stiffnessCoeff ) * ( std::log(restitutionCoeff) / std::sqrt( math::M_PI * math::M_PI + (std::log(restitutionCoeff) * std::log(restitutionCoeff) ) ) ); - const real_t contactDuration = real_t(2) * math::M_PI * Mij / ( std::sqrt( real_t(4) * Mij * stiffnessCoeff - dampingCoeff * dampingCoeff )); //formula from Uhlman + const real_t contactDuration = 2_r * math::M_PI * Mij / ( std::sqrt( 4_r * Mij * stiffnessCoeff - dampingCoeff * dampingCoeff )); //formula from Uhlman const real_t contactDuration2 = std::sqrt(( math::M_PI * math::M_PI + std::log(restitutionCoeff) * std::log(restitutionCoeff)) / ( stiffnessCoeff / Mij)); //formula from Finn if( !funcTest ) @@ -731,9 +731,9 @@ int main( int argc, char **argv ) << " - contact time Tc2 = " << contactDuration2); } - auto peMaterial = pe::createMaterial( "sedimentMat", densityRatio, restitutionCoeff, frictionCoeff, frictionCoeff, real_t(0), real_t(200), stiffnessCoeff, dampingCoeff, dampingCoeff ); - real_t zPosition = real_c(zlength) - real_t(3) * diameter; - pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>(real_c(xlength) * real_t(0.5), real_c(ylength) * real_t(0.5), zPosition), diameter * real_t(0.5), peMaterial ); + auto peMaterial = pe::createMaterial( "sedimentMat", densityRatio, restitutionCoeff, frictionCoeff, frictionCoeff, 0_r, 200_r, stiffnessCoeff, dampingCoeff, dampingCoeff ); + real_t zPosition = real_c(zlength) - 3_r * diameter; + pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>(real_c(xlength) * 0.5_r, real_c(ylength) * 0.5_r, zPosition), diameter * 0.5_r, peMaterial ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>( 0, 0, 1 ), Vector3<real_t>( 0, 0, 0 ), peMaterial ); @@ -744,20 +744,20 @@ int main( int argc, char **argv ) ////////////////////// // create force field - BlockDataID forceFieldID = field::addToStorage< Vec3Field_T >( blocks, "force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); + BlockDataID forceFieldID = field::addToStorage< Vec3Field_T >( blocks, "force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); - BlockDataID dragForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "drag force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); - BlockDataID amForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "am force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); - BlockDataID liftForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "lift force field", Vector3<real_t>(real_t(0)), field::zyxf, FieldGhostLayers ); + BlockDataID dragForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "drag force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); + BlockDataID amForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "am force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); + BlockDataID liftForceFieldID = field::addToStorage< Vec3Field_T >( blocks, "lift force field", Vector3<real_t>(0_r), field::zyxf, FieldGhostLayers ); // create omega field - BlockDataID omegaFieldID = field::addToStorage< ScalarField_T >( blocks, "omega field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID omegaFieldID = field::addToStorage< ScalarField_T >( blocks, "omega field", 0_r, field::zyxf, FieldGhostLayers ); // create the lattice model LatticeModel_T latticeModel = LatticeModel_T( omegaFieldID, ForceModel_T( forceFieldID ) ); // add PDF field - BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, Vector3<real_t>(0), real_t(1), FieldGhostLayers, field::zyxf ); + BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, Vector3<real_t>(0), 1_r, FieldGhostLayers, field::zyxf ); // add flag field BlockDataID flagFieldID = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" ); @@ -770,10 +770,10 @@ int main( int argc, char **argv ) BlockDataID swappedOldVelocityFieldID = field::addToStorage< Vec3Field_T >( blocks, "swapped old velocity field", Vector3<real_t>(0), field::zyxf, FieldGhostLayers ); // create pressure field - BlockDataID pressureFieldID = field::addToStorage< ScalarField_T >( blocks, "pressure field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID pressureFieldID = field::addToStorage< ScalarField_T >( blocks, "pressure field", 0_r, field::zyxf, FieldGhostLayers ); // create solid volume fraction field - BlockDataID svfFieldID = field::addToStorage< ScalarField_T >( blocks, "svf field", real_t(0), field::zyxf, FieldGhostLayers ); + BlockDataID svfFieldID = field::addToStorage< ScalarField_T >( blocks, "svf field", 0_r, field::zyxf, FieldGhostLayers ); // field to store pressure gradient BlockDataID pressureGradientFieldID = field::addToStorage< Vec3Field_T >( blocks, "pressure gradient field", Vector3<real_t>(real_c(0)), field::zyxf, FieldGhostLayers ); @@ -1122,7 +1122,7 @@ int main( int argc, char **argv ) // function to evaluate lubrication forces std::function<void(void)> lubricationEvaluationFunction; - if( lubricationCutOffDistance > real_t(0) ) + if( lubricationCutOffDistance > 0_r ) { if( useLubricationCorrection ) { @@ -1289,12 +1289,12 @@ int main( int argc, char **argv ) uint_t countedBounces = uint_t(0); uint_t tImpact = uint_t(0); real_t terminalVelocity(0); - real_t maxPositionAfterBounce = real_t(0); + real_t maxPositionAfterBounce = 0_r; // three different evaluation times for the rebound velocity (see Kidanemariam, Uhlmann (2014) ) - real_t evalOffsetFactorS = real_t(0.05); - real_t evalOffsetFactorM = real_t(0.1); - real_t evalOffsetFactorL = real_t(0.15); + real_t evalOffsetFactorS = 0.05_r; + real_t evalOffsetFactorM = 0.1_r; + real_t evalOffsetFactorL = 0.15_r; real_t reboundVelocityS( 0. ); real_t reboundVelocityM( 0. ); real_t reboundVelocityL( 0. ); @@ -1306,7 +1306,7 @@ int main( int argc, char **argv ) { timeloop.singleStep(timeloopTiming); currentVelocity = quantityEvaluator->getVelocity(); - if( currentVelocity > real_t(0) && oldVelocity < real_t(0) ) + if( currentVelocity > 0_r && oldVelocity < 0_r ) { ++countedBounces; if( countedBounces == 1 ) @@ -1320,7 +1320,7 @@ int main( int argc, char **argv ) } WALBERLA_LOG_INFO_ON_ROOT("----------- " << countedBounces << ". bounce detected ----------------") } - if( currentVelocity > oldVelocity && oldVelocity > real_t(0) && countedBounces == 1) + if( currentVelocity > oldVelocity && oldVelocity > 0_r && countedBounces == 1) { // impact was wrongly detected in an intermediate step, but should be the time when the collision is fully resolved and maximal velocity is reached ++tImpact; @@ -1333,12 +1333,12 @@ int main( int argc, char **argv ) { maxPositionAfterBounce = std::max(maxPositionAfterBounce, quantityEvaluator->getPosition()); } - if( countedBounces >= 1 && ( real_c(t-tImpact) * terminalVelocity / diameter ) > real_t(100) ) break; + if( countedBounces >= 1 && ( real_c(t-tImpact) * terminalVelocity / diameter ) > 100_r ) break; oldVelocity = currentVelocity; } - maxPositionAfterBounce -= diameter / real_t(2); + maxPositionAfterBounce -= diameter / 2_r; timeloopTiming.logResultOnRoot(); @@ -1347,7 +1347,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT("v_T = " << terminalVelocity); real_t Re = terminalVelocity * diameter / viscosity; WALBERLA_LOG_INFO_ON_ROOT("Re_T = " << Re); - real_t St = densityRatio * Re / real_t(9); + real_t St = densityRatio * Re / 9_r; WALBERLA_LOG_INFO_ON_ROOT("density ratio = " << densityRatio); WALBERLA_LOG_INFO_ON_ROOT("St = " << St); @@ -1368,7 +1368,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT("maximum position after first bounce (zMax) = " << maxPositionAfterBounce << ", zMax / D = " << maxPositionAfterBounce / diameter ); real_t maxPen = collisionPropertiesEvaluator->getMaximumPenetrationInSimulation(); - WALBERLA_LOG_INFO_ON_ROOT("maximum penetration (maxPen) = " << maxPen << ", maxPen / D = " << real_t(100) * maxPen / diameter << "%"); + WALBERLA_LOG_INFO_ON_ROOT("maximum penetration (maxPen) = " << maxPen << ", maxPen / D = " << 100_r * maxPen / diameter << "%"); if( fileIO ) quantityEvaluator->writeScaledOutputToFile(tImpact, terminalVelocity); diff --git a/tests/pe_coupling/geometry/PeIntersectionRatioTest.cpp b/tests/pe_coupling/geometry/PeIntersectionRatioTest.cpp index 1ad42338..5e5f4a16 100644 --- a/tests/pe_coupling/geometry/PeIntersectionRatioTest.cpp +++ b/tests/pe_coupling/geometry/PeIntersectionRatioTest.cpp @@ -56,13 +56,13 @@ int main( int argc, char **argv ) pe::SetBodyTypeIDs<BodyTypeTuple>::execute(); //important to be able to compare static body types in intersection function! - const real_t epsilon( real_t(1e-5) ); + const real_t epsilon( 1e-5_r ); walberla::id_t sid = 0; walberla::id_t uid = 0; - Vector3<real_t> rPos( real_t(0)); - Vector3<real_t> rotationAngles( real_t(0)); + Vector3<real_t> rPos( 0_r); + Vector3<real_t> rotationAngles( 0_r); Quaternion<real_t> quat( rotationAngles ); pe::MaterialID material = pe::Material::find("iron"); @@ -71,30 +71,30 @@ int main( int argc, char **argv ) // SPHERE // //////////// { - Vector3<real_t> bodyPos(real_t(1), real_t(0), real_t(0)); - real_t radius = real_t(1); + Vector3<real_t> bodyPos(1_r, 0_r, 0_r); + real_t radius = 1_r; pe::Sphere sphere(++sid, ++uid, bodyPos, rPos, quat, radius, material, false, false, false); pe::RigidBody & rb = sphere; // otherwise not the pe_coupling/geometry version is matched - Vector3<real_t> pos1(real_t(-0.5), real_t(0), real_t(0)); - Vector3<real_t> dir1(real_t(1), real_t(0), real_t(0)); + Vector3<real_t> pos1(-0.5_r, 0_r, 0_r); + Vector3<real_t> dir1(1_r, 0_r, 0_r); real_t delta1 = walberla::lbm::intersectionRatio(rb, pos1, dir1, epsilon ); - WALBERLA_CHECK_FLOAT_EQUAL(delta1, real_t(0.5), "Intersection ratio with sphere wrong!"); + WALBERLA_CHECK_FLOAT_EQUAL(delta1, 0.5_r, "Intersection ratio with sphere wrong!"); - Vector3<real_t> pos2(real_t(1), real_t(1), real_t(1)); - Vector3<real_t> dir2(real_t(0), -real_t(1), -real_t(1)); + Vector3<real_t> pos2(1_r, 1_r, 1_r); + Vector3<real_t> dir2(0_r, -1_r, -1_r); real_t delta2 = walberla::lbm::intersectionRatio(rb, pos2, dir2, epsilon ); - WALBERLA_CHECK_FLOAT_EQUAL(delta2, (std::sqrt(2) - real_t(1)) / std::sqrt(2), "Intersection ratio with sphere wrong!"); + WALBERLA_CHECK_FLOAT_EQUAL(delta2, (std::sqrt(2) - 1_r) / std::sqrt(2), "Intersection ratio with sphere wrong!"); } /////////// // PLANE // /////////// { - Vector3<real_t> bodyPos(real_t(1), real_t(0), real_t(0)); - Vector3<real_t> bodyNormal(real_t(0), real_t(1), real_t(1)); + Vector3<real_t> bodyPos(1_r, 0_r, 0_r); + Vector3<real_t> bodyNormal(0_r, 1_r, 1_r); bodyNormal = bodyNormal.getNormalized(); @@ -102,50 +102,50 @@ int main( int argc, char **argv ) pe::RigidBody & rb = plane; // otherwise not the pe_coupling/geometry version is matched - Vector3<real_t> pos1(real_t(1), real_t(0.5), real_t(0.5)); - Vector3<real_t> dir1(real_t(0), -real_t(1), -real_t(1)); + Vector3<real_t> pos1(1_r, 0.5_r, 0.5_r); + Vector3<real_t> dir1(0_r, -1_r, -1_r); real_t delta1 = walberla::lbm::intersectionRatio(rb, pos1, dir1, epsilon ); - WALBERLA_CHECK_FLOAT_EQUAL(delta1, real_t(0.5), "Intersection ratio with plane wrong!"); + WALBERLA_CHECK_FLOAT_EQUAL(delta1, 0.5_r, "Intersection ratio with plane wrong!"); - Vector3<real_t> dir2(real_t(0), real_t(0), -real_t(2)); + Vector3<real_t> dir2(0_r, 0_r, -2_r); real_t delta2 = walberla::lbm::intersectionRatio(rb, pos1, dir2, epsilon ); - WALBERLA_CHECK_FLOAT_EQUAL(delta2, real_t(0.5), "Intersection ratio with plane wrong!"); + WALBERLA_CHECK_FLOAT_EQUAL(delta2, 0.5_r, "Intersection ratio with plane wrong!"); - Vector3<real_t> dir3(real_t(0), -real_t(3), real_t(0)); + Vector3<real_t> dir3(0_r, -3_r, 0_r); real_t delta3 = walberla::lbm::intersectionRatio(rb, pos1, dir3, epsilon ); - WALBERLA_CHECK_FLOAT_EQUAL(delta3, real_t(1)/real_t(3), "Intersection ratio with plane wrong!"); + WALBERLA_CHECK_FLOAT_EQUAL(delta3, 1_r/3_r, "Intersection ratio with plane wrong!"); } /////////////// // ELLIPSOID // /////////////// { - Vector3<real_t> bodyPos(real_t(1), real_t(0), real_t(0)); - Vector3<real_t> semiAxes1(real_t(1), real_t(1), real_t(1)); + Vector3<real_t> bodyPos(1_r, 0_r, 0_r); + Vector3<real_t> semiAxes1(1_r, 1_r, 1_r); pe::Ellipsoid ellip1(++sid, ++uid, bodyPos, rPos, quat, semiAxes1, material, false, false, false); pe::RigidBody & rb1 = ellip1; // otherwise not the pe_coupling/geometry version is matched - Vector3<real_t> pos1(real_t(-0.5), real_t(0), real_t(0)); - Vector3<real_t> dir1(real_t(1), real_t(0), real_t(0)); + Vector3<real_t> pos1(-0.5_r, 0_r, 0_r); + Vector3<real_t> dir1(1_r, 0_r, 0_r); real_t delta1 = walberla::lbm::intersectionRatio(rb1, pos1, dir1, epsilon ); - WALBERLA_CHECK_FLOAT_EQUAL(delta1, real_t(0.5), "Intersection ratio with ellipsoid wrong!"); + WALBERLA_CHECK_FLOAT_EQUAL(delta1, 0.5_r, "Intersection ratio with ellipsoid wrong!"); - Vector3<real_t> pos2(real_t(1), real_t(1), real_t(1)); - Vector3<real_t> dir2(real_t(0), -real_t(1), -real_t(1)); + Vector3<real_t> pos2(1_r, 1_r, 1_r); + Vector3<real_t> dir2(0_r, -1_r, -1_r); real_t delta2 = walberla::lbm::intersectionRatio(rb1, pos2, dir2, epsilon ); - WALBERLA_CHECK_FLOAT_EQUAL(delta2, (std::sqrt(2) - real_t(1)) / std::sqrt(2), "Intersection ratio with ellipsoid wrong!"); + WALBERLA_CHECK_FLOAT_EQUAL(delta2, (std::sqrt(2) - 1_r) / std::sqrt(2), "Intersection ratio with ellipsoid wrong!"); - Vector3<real_t> semiAxes2(real_t(2), real_t(0.5), real_t(2)); + Vector3<real_t> semiAxes2(2_r, 0.5_r, 2_r); pe::Ellipsoid ellip2(++sid, ++uid, bodyPos, rPos, quat, semiAxes2, material, false, false, false); pe::RigidBody & rb2 = ellip2; // otherwise not the pe_coupling/geometry version is matched - Vector3<real_t> pos3(real_t(1), real_t(1), real_t(0)); - Vector3<real_t> dir3(real_t(0), real_t(-1), real_t(0)); + Vector3<real_t> pos3(1_r, 1_r, 0_r); + Vector3<real_t> dir3(0_r, -1_r, 0_r); real_t delta3 = walberla::lbm::intersectionRatio(rb2, pos3, dir3, epsilon ); - WALBERLA_CHECK_FLOAT_EQUAL(delta3, real_t(0.5), "Intersection ratio with ellipsoid wrong!"); + WALBERLA_CHECK_FLOAT_EQUAL(delta3, 0.5_r, "Intersection ratio with ellipsoid wrong!"); } diff --git a/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp b/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp index c7ac8a32..1be27b0e 100644 --- a/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp +++ b/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp @@ -143,7 +143,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( AABB domainAABB // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); diff --git a/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp b/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp index 695b8740..0d265f17 100644 --- a/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp +++ b/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp @@ -138,7 +138,7 @@ public: const BlockDataID & boundaryHandlingID, const BlockDataID & bodyFieldID, real_t sphereRadius) : blocks_( blocks ), bodyStorageID_( bodyStorageID ), globalBodyStorage_( globalBodyStorage ), boundaryHandlingID_( boundaryHandlingID ), bodyFieldID_( bodyFieldID ), - sphereVolume_( math::M_PI * real_t(4) / real_t(3) * sphereRadius * sphereRadius * sphereRadius ) + sphereVolume_( math::M_PI * 4_r / 3_r * sphereRadius * sphereRadius * sphereRadius ) { } // check the mapping in the inner domain of the block and check mapped volume against real sphere volume @@ -200,7 +200,7 @@ public: } // mapped volume has to be - approximately - the same as the real volume real_t mappedVolume = real_c(cellCounter); // dx=1 - WALBERLA_CHECK(std::fabs( mappedVolume - sphereVolume_ ) / sphereVolume_ <= real_t(0.1), + WALBERLA_CHECK(std::fabs( mappedVolume - sphereVolume_ ) / sphereVolume_ <= 0.1_r, "Mapped volume " << mappedVolume << " does not fit to real sphere volume " << sphereVolume_ << "."); } @@ -425,9 +425,9 @@ int main( int argc, char **argv ) /////////////////////////// bool writeVTK = false; - const real_t omega = real_t(1); - const real_t dx = real_t(1); - const real_t radius = real_t(5); + const real_t omega = 1_r; + const real_t dx = 1_r; + const real_t radius = 5_r; /////////////////////////// // DATA STRUCTURES SETUP // @@ -450,7 +450,7 @@ int main( int argc, char **argv ) // add PDF field ( uInit = <0.1,0,0>, rhoInit = 1 ) BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, - Vector3<real_t>(real_t(0)), real_t(1), + Vector3<real_t>(0_r), 1_r, FieldGhostLayers, field::zyxf ); // add flag field @@ -466,7 +466,7 @@ int main( int argc, char **argv ) pe::SetBodyTypeIDs<BodyTypeTuple>::execute(); shared_ptr<pe::BodyStorage> globalBodyStorage = make_shared<pe::BodyStorage>(); auto bodyStorageID = blocks->addBlockData(pe::createStorageDataHandling<BodyTypeTuple>(), "Storage"); - auto sphereMaterialID = pe::createMaterial( "sphereMat", real_t(1) , real_t(0.3), real_t(0.2), real_t(0.2), real_t(0.24), real_t(200), real_t(200), real_t(0), real_t(0) ); + auto sphereMaterialID = pe::createMaterial( "sphereMat", 1_r , 0.3_r, 0.2_r, 0.2_r, 0.24_r, 200_r, 200_r, 0_r, 0_r ); // pe coupling const real_t overlap = real_t( 1.5 ) * dx; @@ -483,9 +483,9 @@ int main( int argc, char **argv ) // sphere positions for test scenarios - Vector3<real_t> positionInsideBlock(real_t(10), real_t(10), real_t(10)); - Vector3<real_t> positionAtBlockBoarder(real_t(19), real_t(10), real_t(10)); - Vector3<real_t> positionAtPeriodicBoarder(real_t(1), real_t(10), real_t(10)); + Vector3<real_t> positionInsideBlock(10_r, 10_r, 10_r); + Vector3<real_t> positionAtBlockBoarder(19_r, 10_r, 10_r); + Vector3<real_t> positionAtPeriodicBoarder(1_r, 10_r, 10_r); ///////////////////// // NO SLIP MAPPING // @@ -689,7 +689,7 @@ int main( int argc, char **argv ) //NOTE: global bodies are not communicated, thus they do not follow periodicity!!! //workaround: create the periodic copy explicitly - Vector3<real_t> positionAtPeriodicBoarderCopy(real_t(1) + real_c(blocksPerDirection[0]) * real_c(cellsPerBlock[0]), real_t(10), real_t(10)); + Vector3<real_t> positionAtPeriodicBoarderCopy(1_r + real_c(blocksPerDirection[0]) * real_c(cellsPerBlock[0]), 10_r, 10_r); pe::SphereID sp2 = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtPeriodicBoarderCopy, radius, sphereMaterialID, true, false, true); @@ -1074,7 +1074,7 @@ int main( int argc, char **argv ) //NOTE: global bodies are not communicated, thus they do not follow periodicity!!! //workaround: create the periodic copy explicitly - Vector3<real_t> positionAtPeriodicBoarderCopy(real_t(1) + real_c(blocksPerDirection[0]) * real_c(cellsPerBlock[0]), real_t(10), real_t(10)); + Vector3<real_t> positionAtPeriodicBoarderCopy(1_r + real_c(blocksPerDirection[0]) * real_c(cellsPerBlock[0]), 10_r, 10_r); pe::SphereID sp2 = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtPeriodicBoarderCopy, radius, sphereMaterialID, true, false, true); diff --git a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp index 2e449157..5dd5aed8 100644 --- a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp @@ -286,7 +286,7 @@ private: // calculate the average velocity in forcing direction (here: x) inside the domain (assuming dx=1) real_t computeAverageVel() { - real_t velocity_sum = real_t(0); + real_t velocity_sum = 0_r; // iterate all blocks stored locally on this process for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { diff --git a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp index 358d165b..bbc93300 100644 --- a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp @@ -176,7 +176,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const Setup & s // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); @@ -343,7 +343,7 @@ class ForceEval // calculate the average velocity in forcing direction (here: x) inside the domain real_t getAverageVel() { - real_t velocity_sum = real_t(0); + real_t velocity_sum = 0_r; // iterate all blocks stored locally on this process for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { diff --git a/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp index b494339b..adb80ba1 100644 --- a/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp @@ -110,7 +110,7 @@ const FlagUID MO_SBB_Flag( "moving obstacle SBB" ); static void refinementSelection( SetupBlockForest& forest, uint_t levels, AABB refinementBox ) { - real_t dx = real_t(1); // dx on finest level + real_t dx = 1_r; // dx on finest level for( auto block = forest.begin(); block != forest.end(); ++block ) { uint_t blockLevel = block->getLevel(); @@ -163,7 +163,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const AABB & do // refinement box is in the left lower corner of the domain AABB refinementBox( domainAABB.xMin(), domainAABB.yMin(), domainAABB.zMin(), - domainAABB.xMin()+real_t(1), domainAABB.yMin()+real_t(1), domainAABB.zMin()+real_t(1) ); + domainAABB.xMin()+1_r, domainAABB.yMin()+1_r, domainAABB.zMin()+1_r ); WALBERLA_LOG_INFO_ON_ROOT(" - refinement box: " << refinementBox); @@ -175,7 +175,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const AABB & do // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); @@ -309,8 +309,8 @@ int main( int argc, char **argv ) Vector3<uint_t> domainSize( 32, 16, 16 ); const uint_t numberOfLevels = uint_t(2); - const real_t relaxationTime = real_t(1); - const real_t wallVelocity = real_t(0.01); + const real_t relaxationTime = 1_r; + const real_t wallVelocity = 0.01_r; std::string baseFolder = "vtk_out"; @@ -328,7 +328,7 @@ int main( int argc, char **argv ) domainSize[1] / ( coarseBlocksPerDirection[1] * levelScalingFactor ), domainSize[2] / ( coarseBlocksPerDirection[2] * levelScalingFactor ) ); - AABB simulationDomain( real_t(0), real_t(0), real_t(0), real_c(domainSize[0]), real_c(domainSize[1]), real_c(domainSize[2]) ); + AABB simulationDomain( 0_r, 0_r, 0_r, real_c(domainSize[0]), real_c(domainSize[1]), real_c(domainSize[2]) ); auto blocks = createBlockStructure( simulationDomain, blockSizeInCells, numberOfLevels ); //write domain decomposition to file @@ -350,7 +350,7 @@ int main( int argc, char **argv ) // create pe bodies // bounding planes (global) - const auto planeMaterial = pe::createMaterial( "myPlaneMat", real_t(8920), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(0) ); + const auto planeMaterial = pe::createMaterial( "myPlaneMat", 8920_r, 0_r, 1_r, 1_r, 0_r, 1_r, 1_r, 0_r, 0_r ); // planes in E and W direction pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(1,0,0), Vector3<real_t>(0,0,0), planeMaterial ); @@ -363,18 +363,18 @@ int main( int argc, char **argv ) // planes in B and T direction pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,0,1), Vector3<real_t>(0,0,0), planeMaterial ); auto topPlane = pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,0,-1), Vector3<real_t>(0,0,real_c(domainSize[2])), planeMaterial ); - topPlane->setLinearVel(wallVelocity, real_t(0), real_t(0)); + topPlane->setLinearVel(wallVelocity, 0_r, 0_r); /////////////////////// // ADD DATA TO BLOCKS // //////////////////////// // create the lattice model - LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( real_t(1) / relaxationTime, lbm::collision_model::TRT::threeSixteenth, finestLevel ) ); + LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( 1_r / relaxationTime, lbm::collision_model::TRT::threeSixteenth, finestLevel ) ); // add PDF field BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( real_t(0) ), real_t(1), + Vector3< real_t >( 0_r ), 1_r, FieldGhostLayers, field::zyxf ); // add flag field diff --git a/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp b/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp index 2ebe21f5..a3db454f 100644 --- a/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp @@ -266,7 +266,7 @@ private: // in this geometry setup the relative error is 0.1246489711 % real_t analytical = real_c(3.0)/real_c(2.0) * walberla::math::PI * real_c(1.0) * nu_L_ * real_c(2.0) * real_c(vel_[0]) * radius_ * radius_ * real_c(1.0)/gap; real_t relErr = std::fabs( analytical - forceSphr2[0] ) / analytical * real_c(100.0); - WALBERLA_CHECK_LESS( relErr, real_t(1) ); + WALBERLA_CHECK_LESS( relErr, 1_r ); } } } @@ -362,7 +362,7 @@ private: // in this geometry setup the relative error is 0.183515322065561 % real_t analytical = real_c(6.0) * walberla::math::PI * real_c(1.0) * nu_L_ * real_c(-vel_[0]) * radius_ * radius_ * real_c(1.0)/gap; real_t relErr = std::fabs( analytical - forceSphr1[0] ) / analytical * real_c(100.0); - WALBERLA_CHECK_LESS( relErr, real_t(1) ); + WALBERLA_CHECK_LESS( relErr, 1_r ); } } @@ -706,12 +706,12 @@ int main( int argc, char **argv ) if ( sphSphTest ) { timesteps = uint_c(1000); - nu_L = real_t(2); + nu_L = 2_r; dt_SI = real_c(0.3); periodicX = true; - radius = real_t(6); - velocity = pe::Vec3( real_c(0.008), real_t(0), real_t(0) ); + radius = 6_r; + velocity = pe::Vec3( real_c(0.008), 0_r, 0_r ); id1 = uint_c(1); id2 = uint_c(2); } @@ -720,11 +720,11 @@ int main( int argc, char **argv ) if ( sphWallTest ) { timesteps = uint_c(26399); // uint_c(13199); // uint_c(17599); // uint_c(19800); - nu_L = real_t(1)/real_t(4); // real_t(1)/real_t(8); // real_t(1)/real_t(6); // real_t(3)/real_t(16); + nu_L = 1_r/4_r; // 1_r/8_r; // 1_r/6_r; // 3_r/16_r; dt_SI = real_c(0.125); periodicX = false; - radius = real_t(12); - velocity = pe::Vec3 (real_c(-0.001),real_t(0),real_t(0) ); + radius = 12_r; + velocity = pe::Vec3 (real_c(-0.001),0_r,0_r ); id1 = uint_c(1); id2 = uint_c(56); } @@ -736,7 +736,7 @@ int main( int argc, char **argv ) // parameters equal for all test cases real_t rho_SI = real_c(1000); // rho [kg/m^3] real_t dx_SI = real_c(1e-3); // dx [m] - real_t dx = real_t(1); // lattice dx + real_t dx = 1_r; // lattice dx uint_t length = uint_c(192); // length of the domain in x-direction in cells uint_t width = uint_c(128); // width (and height) of the domain in y- and z-direction in cells @@ -748,12 +748,12 @@ int main( int argc, char **argv ) timesteps = uint_c(1); length = uint_c(24); width = uint_c(12); - nu_L = real_t(2); + nu_L = 2_r; dt_SI = real_c(0.3); periodicX = true; - radius = real_t(2); - velocity = pe::Vec3 ( real_c(0.0001),real_t(0),real_t(0) ); + radius = 2_r; + velocity = pe::Vec3 ( real_c(0.0001),0_r,0_r ); id1 = uint_c(1); id2 = uint_c(2); } @@ -764,8 +764,8 @@ int main( int argc, char **argv ) // Perform missing variable calculations real_t nu_SI = dx_SI * dx_SI / dt_SI * nu_L; // kinematic viscosity [m^2/s] - real_t tau = real_c(0.5) * ( real_t(6) * nu_L + real_t(1) ); - real_t omega = real_t(1) / tau; + real_t tau = real_c(0.5) * ( 6_r * nu_L + 1_r ); + real_t omega = 1_r / tau; /////////////////////////// @@ -794,7 +794,7 @@ int main( int argc, char **argv ) std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create the material - const auto myMat = pe::createMaterial( "myMat", real_c(1.4), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(0) ); + const auto myMat = pe::createMaterial( "myMat", real_c(1.4), 0_r, 1_r, 1_r, 0_r, 1_r, 1_r, 0_r, 0_r ); // sphere-sphere test if ( sphSphTest ) @@ -897,10 +897,10 @@ int main( int argc, char **argv ) LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega ) ); BlockDataID pdfFieldID = useFZYX ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel, - Vector3< real_t >( real_t(0), real_t(0), real_t(0) ), real_t(1), + Vector3< real_t >( 0_r, 0_r, 0_r ), 1_r, uint_t(1), field::fzyx ) : lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( real_t(0), real_t(0), real_t(0) ), real_t(1), + Vector3< real_t >( 0_r, 0_r, 0_r ), 1_r, uint_t(1), field::zyxf ); // add flag field diff --git a/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp b/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp index 678aa582..4e3cb433 100644 --- a/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp @@ -364,7 +364,7 @@ int main( int argc, char **argv ) //const real_t rho_SI = real_c(1000); // density of water [ kg / m^3 ] const real_t L_SI = real_c(0.04); // length of channel [ m ] - const real_t nu_L = ( real_t(1) / omega - real_c(0.5) ) / real_t(3); + const real_t nu_L = ( 1_r / omega - real_c(0.5) ) / 3_r; const real_t dx_SI = L_SI / real_c( length ); // dx in [ m ] const real_t dt_SI = ( nu_L * dx_SI * dx_SI ) / nu_SI; // dt in [ s ] @@ -386,7 +386,7 @@ int main( int argc, char **argv ) const uint_t yCells = width / blockDist[1]; const uint_t zCells = width / blockDist[2]; - const real_t dx = real_t(1); + const real_t dx = 1_r; auto blocks = blockforest::createUniformBlockGrid( blockDist[0], blockDist[1], blockDist[2], xCells, yCells, zCells, dx, ( processes != 1 ), @@ -426,42 +426,42 @@ int main( int argc, char **argv ) // spheres as obstacles std::vector<pe::BodyID> globalBodiesToBeMapped; - auto globalSphere1 = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>(real_c(length) / real_t(2), real_t(50), real_t(110)), real_t(60), material, true, false, true ); + auto globalSphere1 = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>(real_c(length) / 2_r, 50_r, 110_r), 60_r, material, true, false, true ); globalBodiesToBeMapped.push_back(globalSphere1); - auto globalSphere2 = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(0), real_t(50), -real_t(60)), real_t(80), material, true, false, true ); + auto globalSphere2 = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 0_r, 50_r, -60_r), 80_r, material, true, false, true ); globalBodiesToBeMapped.push_back(globalSphere2); - auto globalSphere3 = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_c(length), real_t(50), -real_t(60)), real_t(80), material, true, false, true ); + auto globalSphere3 = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_c(length), 50_r, -60_r), 80_r, material, true, false, true ); globalBodiesToBeMapped.push_back(globalSphere3); // local bodies: moving spheres - const real_t radius = real_t(10); + const real_t radius = 10_r; - auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(15), real_t(50), real_t(35) ), radius, material ); - if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 15_r, 50_r, 35_r ), radius, material ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, 0_r, 0_r ); - sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(15), real_t(35), real_t(50) ), radius, material ); - if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 15_r, 35_r, 50_r ), radius, material ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, 0_r, 0_r ); - sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(15), real_t(65), real_t(50) ), radius, material ); - if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 15_r, 65_r, 50_r ), radius, material ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, 0_r, 0_r ); - sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(15), real_t(50), real_t(65) ), radius, material ); - if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 15_r, 50_r, 65_r ), radius, material ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, 0_r, 0_r ); - sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(35), real_t(35), real_t(35) ), radius, material ); - if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 35_r, 35_r, 35_r ), radius, material ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, 0_r, 0_r ); - sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(35), real_t(65), real_t(35) ), radius, material ); - if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 35_r, 65_r, 35_r ), radius, material ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, 0_r, 0_r ); - sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(35), real_t(35), real_t(65) ), radius, material ); - if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 35_r, 35_r, 65_r ), radius, material ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, 0_r, 0_r ); - sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(35), real_t(65), real_t(65) ), radius, material ); - if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 35_r, 65_r, 65_r ), radius, material ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, 0_r, 0_r ); - sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(50), real_t(50), real_t(50) ), radius, material ); - if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( 50_r, 50_r, 50_r ), radius, material ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, 0_r, 0_r ); //synchronize the pe set up on all processes syncCall(); @@ -474,10 +474,10 @@ int main( int argc, char **argv ) LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega ) ); BlockDataID pdfFieldID = useFZYX ? lbm::addPdfFieldToStorage( blocks, "pdf field (fzyx)", latticeModel, - Vector3< real_t >( velocity, real_t(0), real_t(0) ), real_t(1), + Vector3< real_t >( velocity, 0_r, 0_r ), 1_r, uint_t(1), field::fzyx ) : lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( velocity, real_t(0), real_t(0) ), real_t(1), + Vector3< real_t >( velocity, 0_r, 0_r ), 1_r, uint_t(1), field::zyxf ); // add flag field diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp index 482bc188..0dd0c792 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp @@ -167,7 +167,7 @@ public: real_t dx_SI, real_t dt_SI, real_t diameter) : timeloop_( timeloop ), blocks_( blocks ), bodyStorageID_( bodyStorageID ), fileName_( fileName ), fileIO_(fileIO), dx_SI_( dx_SI ), dt_SI_( dt_SI ), diameter_( diameter ), - position_( real_t(0) ), maxVelocity_( real_t(0) ) + position_( 0_r ), maxVelocity_( 0_r ) { if ( fileIO_ ) { @@ -185,8 +185,8 @@ public: { const uint_t timestep (timeloop_->getCurrentTimeStep()); - Vector3<real_t> pos(real_t(0)); - Vector3<real_t> transVel(real_t(0)); + Vector3<real_t> pos(0_r); + Vector3<real_t> transVel(0_r); for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { @@ -238,7 +238,7 @@ private: file << timestep << "\t" << real_c(timestep) * dt_SI_ << "\t" - << "\t" << scaledPosition[0] << "\t" << scaledPosition[1] << "\t" << scaledPosition[2] - real_t(0.5) + << "\t" << scaledPosition[0] << "\t" << scaledPosition[1] << "\t" << scaledPosition[2] - 0.5_r << "\t" << velocity_SI[0] << "\t" << velocity_SI[1] << "\t" << velocity_SI[2] << "\n"; file.close(); @@ -324,8 +324,8 @@ int main( int argc, char **argv ) ////////////////////////////////////// // values are mainly taken from the reference paper - const real_t diameter_SI = real_t(15e-3); - const real_t densitySphere_SI = real_t(1120); + const real_t diameter_SI = 15e-3_r; + const real_t densitySphere_SI = 1120_r; real_t densityFluid_SI, dynamicViscosityFluid_SI; real_t expectedSettlingVelocity_SI; @@ -333,37 +333,37 @@ int main( int argc, char **argv ) { case 1: // Re_p around 1.5 - densityFluid_SI = real_t(970); - dynamicViscosityFluid_SI = real_t(373e-3); - expectedSettlingVelocity_SI = real_t(0.035986); + densityFluid_SI = 970_r; + dynamicViscosityFluid_SI = 373e-3_r; + expectedSettlingVelocity_SI = 0.035986_r; break; case 2: // Re_p around 4.1 - densityFluid_SI = real_t(965); - dynamicViscosityFluid_SI = real_t(212e-3); - expectedSettlingVelocity_SI = real_t(0.05718); + densityFluid_SI = 965_r; + dynamicViscosityFluid_SI = 212e-3_r; + expectedSettlingVelocity_SI = 0.05718_r; break; case 3: // Re_p around 11.6 - densityFluid_SI = real_t(962); - dynamicViscosityFluid_SI = real_t(113e-3); - expectedSettlingVelocity_SI = real_t(0.087269); + densityFluid_SI = 962_r; + dynamicViscosityFluid_SI = 113e-3_r; + expectedSettlingVelocity_SI = 0.087269_r; break; case 4: // Re_p around 31.9 - densityFluid_SI = real_t(960); - dynamicViscosityFluid_SI = real_t(58e-3); - expectedSettlingVelocity_SI = real_t(0.12224); + densityFluid_SI = 960_r; + dynamicViscosityFluid_SI = 58e-3_r; + expectedSettlingVelocity_SI = 0.12224_r; break; default: WALBERLA_ABORT("Only four different fluids are supported! Choose type between 1 and 4."); } const real_t kinematicViscosityFluid_SI = dynamicViscosityFluid_SI / densityFluid_SI; - const real_t gravitationalAcceleration_SI = real_t(9.81); - Vector3<real_t> domainSize_SI(real_t(100e-3), real_t(100e-3), real_t(160e-3)); + const real_t gravitationalAcceleration_SI = 9.81_r; + Vector3<real_t> domainSize_SI(100e-3_r, 100e-3_r, 160e-3_r); //shift starting gap a bit upwards to match the reported (plotted) values - const real_t startingGapSize_SI = real_t(120e-3) + real_t(0.25) * diameter_SI; + const real_t startingGapSize_SI = 120e-3_r + 0.25_r * diameter_SI; WALBERLA_LOG_INFO_ON_ROOT("Setup (in SI units):"); WALBERLA_LOG_INFO_ON_ROOT(" - domain size = " << domainSize_SI ); @@ -378,24 +378,24 @@ int main( int argc, char **argv ) const real_t dx_SI = domainSize_SI[0] / real_c(numberOfCellsInHorizontalDirection); - const Vector3<uint_t> domainSize( uint_c(floor(domainSize_SI[0] / dx_SI + real_t(0.5)) ), - uint_c(floor(domainSize_SI[1] / dx_SI + real_t(0.5)) ), - uint_c(floor(domainSize_SI[2] / dx_SI + real_t(0.5)) ) ); + const Vector3<uint_t> domainSize( uint_c(floor(domainSize_SI[0] / dx_SI + 0.5_r) ), + uint_c(floor(domainSize_SI[1] / dx_SI + 0.5_r) ), + uint_c(floor(domainSize_SI[2] / dx_SI + 0.5_r) ) ); const real_t diameter = diameter_SI / dx_SI; - const real_t sphereVolume = math::M_PI / real_t(6) * diameter * diameter * diameter; + const real_t sphereVolume = math::M_PI / 6_r * diameter * diameter * diameter; - const real_t expectedSettlingVelocity = real_t(0.01); + const real_t expectedSettlingVelocity = 0.01_r; const real_t dt_SI = expectedSettlingVelocity / expectedSettlingVelocity_SI * dx_SI; const real_t viscosity = kinematicViscosityFluid_SI * dt_SI / ( dx_SI * dx_SI ); - const real_t relaxationTime = real_t(1) / lbm::collision_model::omegaFromViscosity(viscosity); + const real_t relaxationTime = 1_r / lbm::collision_model::omegaFromViscosity(viscosity); const real_t gravitationalAcceleration = gravitationalAcceleration_SI * dt_SI * dt_SI / dx_SI; - const real_t densityFluid = real_t(1); + const real_t densityFluid = 1_r; const real_t densitySphere = densityFluid * densitySphere_SI / densityFluid_SI; - const real_t dx = real_t(1); + const real_t dx = 1_r; const uint_t timesteps = funcTest ? 1 : ( shortrun ? uint_t(200) : uint_t( 250000 ) ); const uint_t numPeSubCycles = uint_t(1); @@ -465,7 +465,7 @@ int main( int argc, char **argv ) // create pe bodies // bounding planes (global) - const auto planeMaterial = pe::createMaterial( "myPlaneMat", real_t(8920), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(0) ); + const auto planeMaterial = pe::createMaterial( "myPlaneMat", 8920_r, 0_r, 1_r, 1_r, 0_r, 1_r, 1_r, 0_r, 0_r ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(1,0,0), Vector3<real_t>(0,0,0), planeMaterial ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(-1,0,0), Vector3<real_t>(real_c(domainSize[0]),0,0), planeMaterial ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,1,0), Vector3<real_t>(0,0,0), planeMaterial ); @@ -474,9 +474,9 @@ int main( int argc, char **argv ) pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,0,-1), Vector3<real_t>(0,0,real_c(domainSize[2])), planeMaterial ); // add the sphere - const auto sphereMaterial = pe::createMaterial( "mySphereMat", densitySphere , real_t(0.5), real_t(0.1), real_t(0.1), real_t(0.24), real_t(200), real_t(200), real_t(0), real_t(0) ); - Vector3<real_t> initialPosition( real_t(0.5) * real_c(domainSize[0]), real_t(0.5) * real_c(domainSize[1]), startingGapSize_SI / dx_SI + real_t(0.5) * diameter); - pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, initialPosition, real_t(0.5) * diameter, sphereMaterial ); + const auto sphereMaterial = pe::createMaterial( "mySphereMat", densitySphere , 0.5_r, 0.1_r, 0.1_r, 0.24_r, 200_r, 200_r, 0_r, 0_r ); + Vector3<real_t> initialPosition( 0.5_r * real_c(domainSize[0]), 0.5_r * real_c(domainSize[1]), startingGapSize_SI / dx_SI + 0.5_r * diameter); + pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, initialPosition, 0.5_r * diameter, sphereMaterial ); syncCall(); @@ -485,11 +485,11 @@ int main( int argc, char **argv ) //////////////////////// // create the lattice model - LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( real_t(1) / relaxationTime ) ); + LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( 1_r / relaxationTime ) ); // add PDF field BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( real_t(0) ), real_t(1), + Vector3< real_t >( 0_r ), 1_r, uint_t(1), field::zyxf ); // add flag field BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); @@ -535,8 +535,8 @@ int main( int argc, char **argv ) std::function<void(void)> storeForceTorqueInCont1 = std::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer2 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); std::function<void(void)> setForceTorqueOnBodiesFromCont2 = std::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); - shared_ptr<pe_coupling::ForceTorqueOnBodiesScaler> forceScaler = make_shared<pe_coupling::ForceTorqueOnBodiesScaler>(blocks, bodyStorageID, real_t(1)); - std::function<void(void)> setForceScalingFactorToHalf = std::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(0.5)); + shared_ptr<pe_coupling::ForceTorqueOnBodiesScaler> forceScaler = make_shared<pe_coupling::ForceTorqueOnBodiesScaler>(blocks, bodyStorageID, 1_r); + std::function<void(void)> setForceScalingFactorToHalf = std::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,0.5_r); if( averageForceTorqueOverTwoTimSteps ) { bodiesFTContainer2->store(); @@ -569,11 +569,11 @@ int main( int argc, char **argv ) } - Vector3<real_t> gravitationalForce( real_t(0), real_t(0), -(densitySphere - densityFluid) * gravitationalAcceleration * sphereVolume ); + Vector3<real_t> gravitationalForce( 0_r, 0_r, -(densitySphere - densityFluid) * gravitationalAcceleration * sphereVolume ); timeloop.addFuncAfterTimeStep( pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, gravitationalForce ), "Gravitational force" ); // add pe timesteps - timeloop.addFuncAfterTimeStep( pe_coupling::TimeStep( blocks, bodyStorageID, cr, syncCall, real_t(1), numPeSubCycles ), "pe Time Step" ); + timeloop.addFuncAfterTimeStep( pe_coupling::TimeStep( blocks, bodyStorageID, cr, syncCall, 1_r, numPeSubCycles ), "pe Time Step" ); // check for convergence of the particle position std::string loggingFileName( baseFolder + "/LoggingSettlingSphere_"); @@ -625,7 +625,7 @@ int main( int argc, char **argv ) WcTimingPool timeloopTiming; - real_t terminationPosition = real_t(0.51) * diameter; // right before sphere touches the bottom wall + real_t terminationPosition = 0.51_r * diameter; // right before sphere touches the bottom wall // time loop for (uint_t i = 0; i < timesteps; ++i ) @@ -651,7 +651,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT( "Relative error: " << relErr ); // the relative error has to be below 10% - WALBERLA_CHECK_LESS( relErr, real_t(0.1) ); + WALBERLA_CHECK_LESS( relErr, 0.1_r ); } return EXIT_SUCCESS; diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp index 558747d9..0be920bd 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp @@ -123,7 +123,7 @@ const FlagUID FormerMO_Flag( "former moving obstacle" ); static void refinementSelection( SetupBlockForest& forest, uint_t levels, const AABB & refinementBox ) { - real_t dx = real_t(1); // dx on finest level + real_t dx = 1_r; // dx on finest level for( auto block = forest.begin(); block != forest.end(); ++block ) { uint_t blockLevel = block->getLevel(); @@ -174,12 +174,12 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const AABB & do "Domain can not be refined in direction " << i << " according to the specified number of levels!" ); } - AABB refinementBox( std::floor(spherePosition[0] - real_t(0.5) * diameter), - std::floor(spherePosition[1] - real_t(0.5) * diameter), - std::floor(spherePosition[2] - real_t(0.5) * diameter), - std::ceil( spherePosition[0] + real_t(0.5) * diameter), - std::ceil( spherePosition[1] + real_t(0.5) * diameter), - std::ceil( spherePosition[2] + real_t(0.5) * diameter) ); + AABB refinementBox( std::floor(spherePosition[0] - 0.5_r * diameter), + std::floor(spherePosition[1] - 0.5_r * diameter), + std::floor(spherePosition[2] - 0.5_r * diameter), + std::ceil( spherePosition[0] + 0.5_r * diameter), + std::ceil( spherePosition[1] + 0.5_r * diameter), + std::ceil( spherePosition[2] + 0.5_r * diameter) ); WALBERLA_LOG_INFO_ON_ROOT(" - refinement box: " << refinementBox); @@ -191,7 +191,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const AABB & do // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); @@ -269,7 +269,7 @@ public: real_t dx_SI, real_t dt_SI, real_t diameter, uint_t lbmTimeStepsPerTimeLoopIteration) : timeloop_( timeloop ), blocks_( blocks ), bodyStorageID_( bodyStorageID ), fileName_( fileName ), fileIO_(fileIO), dx_SI_( dx_SI ), dt_SI_( dt_SI ), diameter_( diameter ), lbmTimeStepsPerTimeLoopIteration_( lbmTimeStepsPerTimeLoopIteration ), - position_( real_t(0) ), maxVelocity_( real_t(0) ) + position_( 0_r ), maxVelocity_( 0_r ) { if ( fileIO_ ) { @@ -287,8 +287,8 @@ public: { const uint_t timestep (timeloop_->getCurrentTimeStep() * lbmTimeStepsPerTimeLoopIteration_ ); - Vector3<real_t> pos(real_t(0)); - Vector3<real_t> transVel(real_t(0)); + Vector3<real_t> pos(0_r); + Vector3<real_t> transVel(0_r); for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { @@ -340,7 +340,7 @@ private: file << timestep << "\t" << real_c(timestep) * dt_SI_ << "\t" - << "\t" << scaledPosition[0] << "\t" << scaledPosition[1] << "\t" << scaledPosition[2] - real_t(0.5) + << "\t" << scaledPosition[0] << "\t" << scaledPosition[1] << "\t" << scaledPosition[2] - 0.5_r << "\t" << velocity_SI[0] << "\t" << velocity_SI[1] << "\t" << velocity_SI[2] << "\n"; file.close(); @@ -458,8 +458,8 @@ int main( int argc, char **argv ) ////////////////////////////////////// // values are mainly taken from the reference paper - const real_t diameter_SI = real_t(15e-3); - const real_t densitySphere_SI = real_t(1120); + const real_t diameter_SI = 15e-3_r; + const real_t densitySphere_SI = 1120_r; real_t densityFluid_SI, dynamicViscosityFluid_SI; real_t expectedSettlingVelocity_SI; @@ -467,37 +467,37 @@ int main( int argc, char **argv ) { case 1: // Re_p around 1.5 - densityFluid_SI = real_t(970); - dynamicViscosityFluid_SI = real_t(373e-3); - expectedSettlingVelocity_SI = real_t(0.035986); + densityFluid_SI = 970_r; + dynamicViscosityFluid_SI = 373e-3_r; + expectedSettlingVelocity_SI = 0.035986_r; break; case 2: // Re_p around 4.1 - densityFluid_SI = real_t(965); - dynamicViscosityFluid_SI = real_t(212e-3); - expectedSettlingVelocity_SI = real_t(0.05718); + densityFluid_SI = 965_r; + dynamicViscosityFluid_SI = 212e-3_r; + expectedSettlingVelocity_SI = 0.05718_r; break; case 3: // Re_p around 11.6 - densityFluid_SI = real_t(962); - dynamicViscosityFluid_SI = real_t(113e-3); - expectedSettlingVelocity_SI = real_t(0.087269); + densityFluid_SI = 962_r; + dynamicViscosityFluid_SI = 113e-3_r; + expectedSettlingVelocity_SI = 0.087269_r; break; case 4: // Re_p around 31.9 - densityFluid_SI = real_t(960); - dynamicViscosityFluid_SI = real_t(58e-3); - expectedSettlingVelocity_SI = real_t(0.12224); + densityFluid_SI = 960_r; + dynamicViscosityFluid_SI = 58e-3_r; + expectedSettlingVelocity_SI = 0.12224_r; break; default: WALBERLA_ABORT("Only four different fluids are supported! Choose type between 1 and 4."); } const real_t kinematicViscosityFluid_SI = dynamicViscosityFluid_SI / densityFluid_SI; - const real_t gravitationalAcceleration_SI = real_t(9.81); - Vector3<real_t> domainSize_SI(real_t(100e-3), real_t(100e-3), real_t(160e-3)); + const real_t gravitationalAcceleration_SI = 9.81_r; + Vector3<real_t> domainSize_SI(100e-3_r, 100e-3_r, 160e-3_r); //shift starting gap a bit upwards to match the reported (plotted) values - const real_t startingGapSize_SI = real_t(120e-3) + real_t(0.25) * diameter_SI; + const real_t startingGapSize_SI = 120e-3_r + 0.25_r * diameter_SI; WALBERLA_LOG_INFO_ON_ROOT("Setup (in SI units):"); WALBERLA_LOG_INFO_ON_ROOT(" - domain size = " << domainSize_SI ); @@ -512,29 +512,29 @@ int main( int argc, char **argv ) const real_t dx_SI = domainSize_SI[0] / real_c(numberOfCellsInHorizontalDirection); - const Vector3<uint_t> domainSize( uint_c(floor(domainSize_SI[0] / dx_SI + real_t(0.5)) ), - uint_c(floor(domainSize_SI[1] / dx_SI + real_t(0.5)) ), - uint_c(floor(domainSize_SI[2] / dx_SI + real_t(0.5)) ) ); + const Vector3<uint_t> domainSize( uint_c(floor(domainSize_SI[0] / dx_SI + 0.5_r) ), + uint_c(floor(domainSize_SI[1] / dx_SI + 0.5_r) ), + uint_c(floor(domainSize_SI[2] / dx_SI + 0.5_r) ) ); const real_t diameter = diameter_SI / dx_SI; - const real_t sphereVolume = math::M_PI / real_t(6) * diameter * diameter * diameter; + const real_t sphereVolume = math::M_PI / 6_r * diameter * diameter * diameter; - const real_t expectedSettlingVelocity = real_t(0.01); + const real_t expectedSettlingVelocity = 0.01_r; const real_t dt_SI = expectedSettlingVelocity / expectedSettlingVelocity_SI * dx_SI; const real_t viscosity = kinematicViscosityFluid_SI * dt_SI / ( dx_SI * dx_SI ); - const real_t relaxationTime = real_t(1) / lbm::collision_model::omegaFromViscosity(viscosity); + const real_t relaxationTime = 1_r / lbm::collision_model::omegaFromViscosity(viscosity); const real_t gravitationalAcceleration = gravitationalAcceleration_SI * dt_SI * dt_SI / dx_SI; - const real_t densityFluid = real_t(1); + const real_t densityFluid = 1_r; const real_t densitySphere = densityFluid * densitySphere_SI / densityFluid_SI; - const real_t dx = real_t(1); + const real_t dx = 1_r; const uint_t timesteps = funcTest ? 1 : ( shortrun ? uint_t(200) : uint_t( 250000 ) ); const uint_t numPeSubCycles = uint_t(1); - Vector3<real_t> initialSpherePosition( real_t(0.5) * real_c(domainSize[0]), real_t(0.5) * real_c(domainSize[1]), startingGapSize_SI / dx_SI + real_t(0.5) * diameter); + Vector3<real_t> initialSpherePosition( 0.5_r * real_c(domainSize[0]), 0.5_r * real_c(domainSize[1]), startingGapSize_SI / dx_SI + 0.5_r * diameter); WALBERLA_LOG_INFO_ON_ROOT(" - dx_SI = " << dx_SI << ", dt_SI = " << dt_SI); WALBERLA_LOG_INFO_ON_ROOT("Setup (in simulation, i.e. lattice, units):"); @@ -563,7 +563,7 @@ int main( int argc, char **argv ) domainSize[1] / ( coarseBlocksPerDirection[1] * levelScalingFactor ), domainSize[2] / ( coarseBlocksPerDirection[2] * levelScalingFactor ) ); - AABB simulationDomain( real_t(0), real_t(0), real_t(0), real_c(domainSize[0]), real_c(domainSize[1]), real_c(domainSize[2]) ); + AABB simulationDomain( 0_r, 0_r, 0_r, real_c(domainSize[0]), real_c(domainSize[1]), real_c(domainSize[2]) ); auto blocks = createBlockStructure( simulationDomain, blockSizeInCells, numberOfLevels, diameter, initialSpherePosition ); //write domain decomposition to file @@ -613,7 +613,7 @@ int main( int argc, char **argv ) // create pe bodies // bounding planes (global) - const auto planeMaterial = pe::createMaterial( "myPlaneMat", real_t(8920), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(0) ); + const auto planeMaterial = pe::createMaterial( "myPlaneMat", 8920_r, 0_r, 1_r, 1_r, 0_r, 1_r, 1_r, 0_r, 0_r ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(1,0,0), Vector3<real_t>(0,0,0), planeMaterial ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(-1,0,0), Vector3<real_t>(real_c(domainSize[0]),0,0), planeMaterial ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,1,0), Vector3<real_t>(0,0,0), planeMaterial ); @@ -622,8 +622,8 @@ int main( int argc, char **argv ) pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,0,-1), Vector3<real_t>(0,0,real_c(domainSize[2])), planeMaterial ); // add the sphere - const auto sphereMaterial = pe::createMaterial( "mySphereMat", densitySphere , real_t(0.5), real_t(0.1), real_t(0.1), real_t(0.24), real_t(200), real_t(200), real_t(0), real_t(0) ); - pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, initialSpherePosition, real_t(0.5) * diameter, sphereMaterial ); + const auto sphereMaterial = pe::createMaterial( "mySphereMat", densitySphere , 0.5_r, 0.1_r, 0.1_r, 0.24_r, 200_r, 200_r, 0_r, 0_r ); + pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, initialSpherePosition, 0.5_r * diameter, sphereMaterial ); uint_t minBlockSizeInCells = blockSizeInCells.min(); for( uint_t i = 0; i < uint_c(diameter / real_c(minBlockSizeInCells)) + 1; ++i) @@ -634,11 +634,11 @@ int main( int argc, char **argv ) //////////////////////// // create the lattice model - LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( real_t(1) / relaxationTime, lbm::collision_model::TRT::threeSixteenth, finestLevel ) ); + LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( 1_r / relaxationTime, lbm::collision_model::TRT::threeSixteenth, finestLevel ) ); // add PDF field BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( real_t(0) ), real_t(1), + Vector3< real_t >( 0_r ), 1_r, FieldGhostLayers, field::zyxf ); // add flag field BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); @@ -662,9 +662,9 @@ int main( int argc, char **argv ) std::function<void(void)> storeForceTorqueInCont1 = std::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer2 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); std::function<void(void)> setForceTorqueOnBodiesFromCont2 = std::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); - shared_ptr<pe_coupling::ForceTorqueOnBodiesScaler> forceScaler = make_shared<pe_coupling::ForceTorqueOnBodiesScaler>(blocks, bodyStorageID, real_t(0.5)); - std::function<void(void)> setForceScalingFactorToOne = std::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(1)); - std::function<void(void)> setForceScalingFactorToHalf = std::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(0.5)); + shared_ptr<pe_coupling::ForceTorqueOnBodiesScaler> forceScaler = make_shared<pe_coupling::ForceTorqueOnBodiesScaler>(blocks, bodyStorageID, 0.5_r); + std::function<void(void)> setForceScalingFactorToOne = std::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,1_r); + std::function<void(void)> setForceScalingFactorToHalf = std::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,0.5_r); if( averageForceTorqueOverTwoTimSteps ) { bodiesFTContainer2->store(); @@ -707,11 +707,11 @@ int main( int argc, char **argv ) } - Vector3<real_t> gravitationalForce( real_t(0), real_t(0), -(densitySphere - densityFluid) * gravitationalAcceleration * sphereVolume ); + Vector3<real_t> gravitationalForce( 0_r, 0_r, -(densitySphere - densityFluid) * gravitationalAcceleration * sphereVolume ); refinementTimestep->addPostStreamVoidFunction(lbm::refinement::FunctorWrapper(pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, gravitationalForce )), "Gravitational force", finestLevel ); // add pe timesteps - refinementTimestep->addPostStreamVoidFunction(lbm::refinement::FunctorWrapper(pe_coupling::TimeStep( blocks, bodyStorageID, cr, syncCall, real_t(1), numPeSubCycles)), + refinementTimestep->addPostStreamVoidFunction(lbm::refinement::FunctorWrapper(pe_coupling::TimeStep( blocks, bodyStorageID, cr, syncCall, 1_r, numPeSubCycles)), "pe Time Step", finestLevel ); // add sweep for updating the pe body mapping into the LBM simulation @@ -780,7 +780,7 @@ int main( int argc, char **argv ) WcTimingPool timeloopTiming; - real_t terminationPosition = real_t(0.51) * diameter; // right before sphere touches the bottom wall + real_t terminationPosition = 0.51_r * diameter; // right before sphere touches the bottom wall uint_t refinementCheckFrequency = uint_t(100); @@ -862,7 +862,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT( "Relative error: " << relErr ); // the relative error has to be below 10% - WALBERLA_CHECK_LESS( relErr, real_t(0.1) ); + WALBERLA_CHECK_LESS( relErr, 0.1_r ); } return EXIT_SUCCESS; diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp index f0863496..bf520205 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp @@ -118,7 +118,7 @@ const FlagUID FormerMO_Flag( "former moving obstacle" ); static void refinementSelection( SetupBlockForest& forest, uint_t levels, AABB refinementBox ) { - real_t dx = real_t(1); // dx on finest level + real_t dx = 1_r; // dx on finest level for( auto block = forest.begin(); block != forest.end(); ++block ) { uint_t blockLevel = block->getLevel(); @@ -169,8 +169,8 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const AABB & do "Domain can not be refined in direction " << i << " according to the specified number of levels!" ); } - AABB refinementBox( std::floor(real_t(0.5) * (domainAABB.size(0)-diameter)), std::floor(real_t(0.5) * (domainAABB.size(1)-diameter)), real_t(0), - std::ceil( real_t(0.5) * (domainAABB.size(0)+diameter)), std::ceil( real_t(0.5) * (domainAABB.size(1)+diameter)), domainAABB.size(2) ); + AABB refinementBox( std::floor(0.5_r * (domainAABB.size(0)-diameter)), std::floor(0.5_r * (domainAABB.size(1)-diameter)), 0_r, + std::ceil( 0.5_r * (domainAABB.size(0)+diameter)), std::ceil( 0.5_r * (domainAABB.size(1)+diameter)), domainAABB.size(2) ); WALBERLA_LOG_INFO_ON_ROOT(" - refinement box: " << refinementBox); @@ -182,7 +182,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const AABB & do // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); @@ -255,7 +255,7 @@ public: real_t dx_SI, real_t dt_SI, real_t diameter, uint_t lbmTimeStepsPerTimeLoopIteration) : timeloop_( timeloop ), blocks_( blocks ), bodyStorageID_( bodyStorageID ), fileName_( fileName ), fileIO_(fileIO), dx_SI_( dx_SI ), dt_SI_( dt_SI ), diameter_( diameter ), lbmTimeStepsPerTimeLoopIteration_( lbmTimeStepsPerTimeLoopIteration ), - position_( real_t(0) ), maxVelocity_( real_t(0) ) + position_( 0_r ), maxVelocity_( 0_r ) { if ( fileIO_ ) { @@ -273,8 +273,8 @@ public: { const uint_t timestep (timeloop_->getCurrentTimeStep() * lbmTimeStepsPerTimeLoopIteration_ ); - Vector3<real_t> pos(real_t(0)); - Vector3<real_t> transVel(real_t(0)); + Vector3<real_t> pos(0_r); + Vector3<real_t> transVel(0_r); for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { @@ -326,7 +326,7 @@ private: file << timestep << "\t" << real_c(timestep) * dt_SI_ << "\t" - << "\t" << scaledPosition[0] << "\t" << scaledPosition[1] << "\t" << scaledPosition[2] - real_t(0.5) + << "\t" << scaledPosition[0] << "\t" << scaledPosition[1] << "\t" << scaledPosition[2] - 0.5_r << "\t" << velocity_SI[0] << "\t" << velocity_SI[1] << "\t" << velocity_SI[2] << "\n"; file.close(); @@ -419,8 +419,8 @@ int main( int argc, char **argv ) ////////////////////////////////////// // values are mainly taken from the reference paper - const real_t diameter_SI = real_t(15e-3); - const real_t densitySphere_SI = real_t(1120); + const real_t diameter_SI = 15e-3_r; + const real_t densitySphere_SI = 1120_r; real_t densityFluid_SI, dynamicViscosityFluid_SI; real_t expectedSettlingVelocity_SI; @@ -428,37 +428,37 @@ int main( int argc, char **argv ) { case 1: // Re_p around 1.5 - densityFluid_SI = real_t(970); - dynamicViscosityFluid_SI = real_t(373e-3); - expectedSettlingVelocity_SI = real_t(0.035986); + densityFluid_SI = 970_r; + dynamicViscosityFluid_SI = 373e-3_r; + expectedSettlingVelocity_SI = 0.035986_r; break; case 2: // Re_p around 4.1 - densityFluid_SI = real_t(965); - dynamicViscosityFluid_SI = real_t(212e-3); - expectedSettlingVelocity_SI = real_t(0.05718); + densityFluid_SI = 965_r; + dynamicViscosityFluid_SI = 212e-3_r; + expectedSettlingVelocity_SI = 0.05718_r; break; case 3: // Re_p around 11.6 - densityFluid_SI = real_t(962); - dynamicViscosityFluid_SI = real_t(113e-3); - expectedSettlingVelocity_SI = real_t(0.087269); + densityFluid_SI = 962_r; + dynamicViscosityFluid_SI = 113e-3_r; + expectedSettlingVelocity_SI = 0.087269_r; break; case 4: // Re_p around 31.9 - densityFluid_SI = real_t(960); - dynamicViscosityFluid_SI = real_t(58e-3); - expectedSettlingVelocity_SI = real_t(0.12224); + densityFluid_SI = 960_r; + dynamicViscosityFluid_SI = 58e-3_r; + expectedSettlingVelocity_SI = 0.12224_r; break; default: WALBERLA_ABORT("Only four different fluids are supported! Choose type between 1 and 4."); } const real_t kinematicViscosityFluid_SI = dynamicViscosityFluid_SI / densityFluid_SI; - const real_t gravitationalAcceleration_SI = real_t(9.81); - Vector3<real_t> domainSize_SI(real_t(100e-3), real_t(100e-3), real_t(160e-3)); + const real_t gravitationalAcceleration_SI = 9.81_r; + Vector3<real_t> domainSize_SI(100e-3_r, 100e-3_r, 160e-3_r); //shift starting gap a bit upwards to match the reported (plotted) values - const real_t startingGapSize_SI = real_t(120e-3) + real_t(0.25) * diameter_SI; + const real_t startingGapSize_SI = 120e-3_r + 0.25_r * diameter_SI; WALBERLA_LOG_INFO_ON_ROOT("Setup (in SI units):"); WALBERLA_LOG_INFO_ON_ROOT(" - domain size = " << domainSize_SI ); @@ -473,24 +473,24 @@ int main( int argc, char **argv ) const real_t dx_SI = domainSize_SI[0] / real_c(numberOfCellsInHorizontalDirection); - const Vector3<uint_t> domainSize( uint_c(floor(domainSize_SI[0] / dx_SI + real_t(0.5)) ), - uint_c(floor(domainSize_SI[1] / dx_SI + real_t(0.5)) ), - uint_c(floor(domainSize_SI[2] / dx_SI + real_t(0.5)) ) ); + const Vector3<uint_t> domainSize( uint_c(floor(domainSize_SI[0] / dx_SI + 0.5_r) ), + uint_c(floor(domainSize_SI[1] / dx_SI + 0.5_r) ), + uint_c(floor(domainSize_SI[2] / dx_SI + 0.5_r) ) ); const real_t diameter = diameter_SI / dx_SI; - const real_t sphereVolume = math::M_PI / real_t(6) * diameter * diameter * diameter; + const real_t sphereVolume = math::M_PI / 6_r * diameter * diameter * diameter; - const real_t expectedSettlingVelocity = real_t(0.01); + const real_t expectedSettlingVelocity = 0.01_r; const real_t dt_SI = expectedSettlingVelocity / expectedSettlingVelocity_SI * dx_SI; const real_t viscosity = kinematicViscosityFluid_SI * dt_SI / ( dx_SI * dx_SI ); - const real_t relaxationTime = real_t(1) / lbm::collision_model::omegaFromViscosity(viscosity); + const real_t relaxationTime = 1_r / lbm::collision_model::omegaFromViscosity(viscosity); const real_t gravitationalAcceleration = gravitationalAcceleration_SI * dt_SI * dt_SI / dx_SI; - const real_t densityFluid = real_t(1); + const real_t densityFluid = 1_r; const real_t densitySphere = densityFluid * densitySphere_SI / densityFluid_SI; - const real_t dx = real_t(1); + const real_t dx = 1_r; const uint_t timesteps = funcTest ? 1 : ( shortrun ? uint_t(200) : uint_t( 250000 ) ); const uint_t numPeSubCycles = uint_t(1); @@ -521,7 +521,7 @@ int main( int argc, char **argv ) domainSize[1] / ( coarseBlocksPerDirection[1] * levelScalingFactor ), domainSize[2] / ( coarseBlocksPerDirection[2] * levelScalingFactor ) ); - AABB simulationDomain( real_t(0), real_t(0), real_t(0), real_c(domainSize[0]), real_c(domainSize[1]), real_c(domainSize[2]) ); + AABB simulationDomain( 0_r, 0_r, 0_r, real_c(domainSize[0]), real_c(domainSize[1]), real_c(domainSize[2]) ); auto blocks = createBlockStructure( simulationDomain, blockSizeInCells, numberOfLevels, diameter ); //write domain decomposition to file @@ -554,7 +554,7 @@ int main( int argc, char **argv ) // create pe bodies // bounding planes (global) - const auto planeMaterial = pe::createMaterial( "myPlaneMat", real_t(8920), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(0) ); + const auto planeMaterial = pe::createMaterial( "myPlaneMat", 8920_r, 0_r, 1_r, 1_r, 0_r, 1_r, 1_r, 0_r, 0_r ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(1,0,0), Vector3<real_t>(0,0,0), planeMaterial ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(-1,0,0), Vector3<real_t>(real_c(domainSize[0]),0,0), planeMaterial ); pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,1,0), Vector3<real_t>(0,0,0), planeMaterial ); @@ -563,9 +563,9 @@ int main( int argc, char **argv ) pe::createPlane( *globalBodyStorage, 0, Vector3<real_t>(0,0,-1), Vector3<real_t>(0,0,real_c(domainSize[2])), planeMaterial ); // add the sphere - const auto sphereMaterial = pe::createMaterial( "mySphereMat", densitySphere , real_t(0.5), real_t(0.1), real_t(0.1), real_t(0.24), real_t(200), real_t(200), real_t(0), real_t(0) ); - Vector3<real_t> initialPosition( real_t(0.5) * real_c(domainSize[0]), real_t(0.5) * real_c(domainSize[1]), startingGapSize_SI / dx_SI + real_t(0.5) * diameter); - pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, initialPosition, real_t(0.5) * diameter, sphereMaterial ); + const auto sphereMaterial = pe::createMaterial( "mySphereMat", densitySphere , 0.5_r, 0.1_r, 0.1_r, 0.24_r, 200_r, 200_r, 0_r, 0_r ); + Vector3<real_t> initialPosition( 0.5_r * real_c(domainSize[0]), 0.5_r * real_c(domainSize[1]), startingGapSize_SI / dx_SI + 0.5_r * diameter); + pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, initialPosition, 0.5_r * diameter, sphereMaterial ); uint_t minBlockSizeInCells = blockSizeInCells.min(); for( uint_t i = 0; i < uint_c(diameter / real_c(minBlockSizeInCells)) + 1; ++i) @@ -576,11 +576,11 @@ int main( int argc, char **argv ) //////////////////////// // create the lattice model - LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( real_t(1) / relaxationTime, lbm::collision_model::TRT::threeSixteenth, finestLevel ) ); + LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( 1_r / relaxationTime, lbm::collision_model::TRT::threeSixteenth, finestLevel ) ); // add PDF field BlockDataID pdfFieldID = lbm::addPdfFieldToStorage< LatticeModel_T >( blocks, "pdf field (zyxf)", latticeModel, - Vector3< real_t >( real_t(0) ), real_t(1), + Vector3< real_t >( 0_r ), 1_r, FieldGhostLayers, field::zyxf ); // add flag field BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); @@ -602,8 +602,8 @@ int main( int argc, char **argv ) std::function<void(void)> storeForceTorqueInCont1 = std::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer2 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); std::function<void(void)> setForceTorqueOnBodiesFromCont2 = std::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); - shared_ptr<pe_coupling::ForceTorqueOnBodiesScaler> forceScaler = make_shared<pe_coupling::ForceTorqueOnBodiesScaler>(blocks, bodyStorageID, real_t(1)); - std::function<void(void)> setForceScalingFactorToHalf = std::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(0.5)); + shared_ptr<pe_coupling::ForceTorqueOnBodiesScaler> forceScaler = make_shared<pe_coupling::ForceTorqueOnBodiesScaler>(blocks, bodyStorageID, 1_r); + std::function<void(void)> setForceScalingFactorToHalf = std::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,0.5_r); if( averageForceTorqueOverTwoTimSteps ) { bodiesFTContainer2->store(); @@ -644,11 +644,11 @@ int main( int argc, char **argv ) } - Vector3<real_t> gravitationalForce( real_t(0), real_t(0), -(densitySphere - densityFluid) * gravitationalAcceleration * sphereVolume ); + Vector3<real_t> gravitationalForce( 0_r, 0_r, -(densitySphere - densityFluid) * gravitationalAcceleration * sphereVolume ); refinementTimestep->addPostStreamVoidFunction(lbm::refinement::FunctorWrapper(pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, gravitationalForce )), "Gravitational force", finestLevel ); // add pe timesteps - refinementTimestep->addPostStreamVoidFunction(lbm::refinement::FunctorWrapper(pe_coupling::TimeStep( blocks, bodyStorageID, cr, syncCall, real_t(1), numPeSubCycles)), + refinementTimestep->addPostStreamVoidFunction(lbm::refinement::FunctorWrapper(pe_coupling::TimeStep( blocks, bodyStorageID, cr, syncCall, 1_r, numPeSubCycles)), "pe Time Step", finestLevel ); // add sweep for updating the pe body mapping into the LBM simulation @@ -715,7 +715,7 @@ int main( int argc, char **argv ) WcTimingPool timeloopTiming; - real_t terminationPosition = real_t(0.51) * diameter; // right before sphere touches the bottom wall + real_t terminationPosition = 0.51_r * diameter; // right before sphere touches the bottom wall // time loop for (uint_t i = 0; i < timesteps; ++i ) @@ -741,7 +741,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_INFO_ON_ROOT( "Relative error: " << relErr ); // the relative error has to be below 10% - WALBERLA_CHECK_LESS( relErr, real_t(0.1) ); + WALBERLA_CHECK_LESS( relErr, 0.1_r ); } return EXIT_SUCCESS; diff --git a/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp b/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp index 1d3bab50..39a06e6d 100644 --- a/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp @@ -293,8 +293,8 @@ int main(int argc, char **argv) { std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); - const auto myMat = pe::createMaterial("myMat", real_c(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), - real_t(1), real_t(0), real_t(0)); + const auto myMat = pe::createMaterial("myMat", real_c(1), 0_r, 1_r, 1_r, 0_r, 1_r, + 1_r, 0_r, 0_r); // create the squirmer in the middle of the domain const Vector3<real_t> position(real_c(L) * real_c(0.5), real_c(L) * real_c(0.5), real_c(L) * real_c(0.5)); diff --git a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp index b654d5df..57e4c333 100644 --- a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp @@ -115,11 +115,11 @@ public: { } real_t getMaximumRelativeError() { - Vector3<real_t> midPoint( domainLength_ * real_t(0.5), domainWidth_ * real_t(0.5), domainWidth_ * real_t(0.5) ); + Vector3<real_t> midPoint( domainLength_ * 0.5_r, domainWidth_ * 0.5_r, domainWidth_ * 0.5_r ); Cell midCell = blocks_->getCell( midPoint ); CellInterval evaluationCells( midCell.x(), midCell.y(), midCell.z(), midCell.x(), blocks_->getDomainCellBB().yMax(), midCell.z() ); - real_t maxError = real_t(0); + real_t maxError = 0_r; for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { @@ -262,10 +262,10 @@ int main( int argc, char **argv ) const uint_t timesteps = shortrun ? uint_c(10) : uint_c(5000); - const real_t radius1 = real_c(width) * real_t(0.25); // radius of internal cylinder - const real_t radius2 = real_c(width) * real_t(0.45); // radius of external cylinder - const real_t angularVel1 = real_t(0.001); // angular velocity of internal cylinder - const real_t angularVel2 = real_t(-0.001); // angular velocity of external cylinder + const real_t radius1 = real_c(width) * 0.25_r; // radius of internal cylinder + const real_t radius2 = real_c(width) * 0.45_r; // radius of external cylinder + const real_t angularVel1 = 0.001_r; // angular velocity of internal cylinder + const real_t angularVel2 = -0.001_r; // angular velocity of external cylinder /////////////////////////// // BLOCK STRUCTURE SETUP // @@ -283,7 +283,7 @@ int main( int argc, char **argv ) const uint_t yCells = width / blockDist[1]; const uint_t zCells = width / blockDist[2]; - const real_t dx = real_t(1); + const real_t dx = 1_r; auto blocks = blockforest::createUniformBlockGrid( blockDist[0], blockDist[1], blockDist[2], xCells, yCells, zCells, dx, ( processes != 1 ), @@ -306,13 +306,13 @@ int main( int argc, char **argv ) std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create pe bodies - const auto material = pe::createMaterial( "granular", real_t(1.2), real_t(0.25), real_t(0.4), real_t(0.4), real_t(0.35), real_t(1.39e11), real_t(5.18e7), real_t(1.07e2), real_t(1.07e2) ); + const auto material = pe::createMaterial( "granular", 1.2_r, 0.25_r, 0.4_r, 0.4_r, 0.35_r, 1.39e11_r, 5.18e7_r, 1.07e2_r, 1.07e2_r ); // instead of a cylinder, we use the capsule and make sure it extends the computational domain in x-direction to effectively get a cylinder - auto cap = pe::createCapsule( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, pe::Vec3(real_c(length),real_c(width),real_c(width)) * real_t(0.5), radius1, real_c(length)*real_t(2), material, true, false, true ); + auto cap = pe::createCapsule( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, pe::Vec3(real_c(length),real_c(width),real_c(width)) * 0.5_r, radius1, real_c(length)*2_r, material, true, false, true ); cap->setAngularVel( pe::Vec3(1,0,0) * angularVel1 ); - auto cb = pe::createCylindricalBoundary( *globalBodyStorage, 0, pe::Vec3(real_c(length),real_c(width),real_c(width))*real_t(0.5), radius2 ); + auto cb = pe::createCylindricalBoundary( *globalBodyStorage, 0, pe::Vec3(real_c(length),real_c(width),real_c(width))*0.5_r, radius2 ); cb->setAngularVel( pe::Vec3(1,0,0) * angularVel2 ); //synchronize the pe set up on all processes @@ -325,7 +325,7 @@ int main( int argc, char **argv ) // add pdf field LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega ) ); - BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, Vector3< real_t >( real_t(0) ), real_t(1), uint_t(1), field::zyxf ); + BlockDataID pdfFieldID = lbm::addPdfFieldToStorage( blocks, "pdf field (zyxf)", latticeModel, Vector3< real_t >( 0_r ), 1_r, uint_t(1), field::zyxf ); // add flag field BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); @@ -408,7 +408,7 @@ int main( int argc, char **argv ) timeloopTiming.logResultOnRoot(); WALBERLA_LOG_RESULT_ON_ROOT("Maximum relative error in velocity in angular direction: " << maxError ); // error has to be below 10% - WALBERLA_CHECK_LESS( maxError, real_t(0.1) ); + WALBERLA_CHECK_LESS( maxError, 0.1_r ); } return 0; diff --git a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp index b5e53a23..c82cdd3d 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp @@ -240,7 +240,7 @@ private: // calculate the average velocity in forcing direction (here: x) inside the domain (assuming dx=1) real_t computeAverageVel() { - real_t velocity_sum = real_t(0); + real_t velocity_sum = 0_r; for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { diff --git a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp index b0ca02da..889f8502 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp @@ -196,7 +196,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const Setup & s // calculate process distribution const memory_t memoryLimit = math::Limits< memory_t >::inf(); - sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), real_t(0), memoryLimit, true ); + sforest.balanceLoad( blockforest::StaticLevelwiseCurveBalance(true), uint_c( MPIManager::instance()->numProcesses() ), 0_r, memoryLimit, true ); WALBERLA_LOG_INFO_ON_ROOT( sforest ); @@ -359,7 +359,7 @@ private: // calculate the average velocity in forcing direction (here: x) inside the domain (assuming dx=1) real_t computeAverageVel() { - real_t velocity_sum = real_t(0); + real_t velocity_sum = 0_r; for( auto blockIt = blocks_->begin(); blockIt != blocks_->end(); ++blockIt ) { diff --git a/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp b/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp index 935a0c1d..ded23eb1 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp @@ -616,7 +616,7 @@ int main( int argc, char **argv ) } // average the forces acting on the bodies over the number of LBM steps - timeloop.addFuncAfterTimeStep( pe_coupling::ForceTorqueOnBodiesScaler( blocks, bodyStorageID, real_t(1)/real_c(numLbmSubCycles) ), "Force averaging for several LBM steps" ); + timeloop.addFuncAfterTimeStep( pe_coupling::ForceTorqueOnBodiesScaler( blocks, bodyStorageID, 1_r/real_c(numLbmSubCycles) ), "Force averaging for several LBM steps" ); // add pressure force contribution // The flow in the channel is here driven by a body force and is periodic @@ -624,8 +624,8 @@ int main( int argc, char **argv ) // The buoyancy force on the body due to this pressure gradient has to be added 'artificially' // F_{buoyancy} = - V_{body} * grad ( p ) = V_{body} * \rho_{fluid} * a // ( V_{body} := volume of body, a := acceleration driving the flow ) - Vector3<real_t> buoyancyForce(math::M_PI / real_t(6) * setup.forcing * setup.particleDiam * setup.particleDiam * setup.particleDiam , - real_t(0), real_t(0)); + Vector3<real_t> buoyancyForce(math::M_PI / 6_r * setup.forcing * setup.particleDiam * setup.particleDiam * setup.particleDiam , + 0_r, 0_r); timeloop.addFuncAfterTimeStep( pe_coupling::ForceOnBodiesAdder( blocks, bodyStorageID, buoyancyForce ), "Buoyancy force" ); // add pe timesteps diff --git a/tests/pe_coupling/utility/BodiesForceTorqueContainerTest.cpp b/tests/pe_coupling/utility/BodiesForceTorqueContainerTest.cpp index bf84cbe0..84003ed2 100644 --- a/tests/pe_coupling/utility/BodiesForceTorqueContainerTest.cpp +++ b/tests/pe_coupling/utility/BodiesForceTorqueContainerTest.cpp @@ -62,8 +62,8 @@ int main( int argc, char **argv ) // uncomment to have logging //logging::Logging::instance()->setLogLevel(logging::Logging::LogLevel::DETAIL); - const real_t dx = real_t(1); - const real_t radius = real_t(5); + const real_t dx = 1_r; + const real_t radius = 5_r; /////////////////////////// // DATA STRUCTURES SETUP // @@ -86,23 +86,23 @@ int main( int argc, char **argv ) pe::SetBodyTypeIDs<BodyTypeTuple>::execute(); shared_ptr<pe::BodyStorage> globalBodyStorage = make_shared<pe::BodyStorage>(); auto bodyStorageID = blocks->addBlockData(pe::createStorageDataHandling<BodyTypeTuple>(), "Storage"); - auto sphereMaterialID = pe::createMaterial( "sphereMat", real_t(1) , real_t(0.3), real_t(0.2), real_t(0.2), real_t(0.24), real_t(200), real_t(200), real_t(0), real_t(0) ); + auto sphereMaterialID = pe::createMaterial( "sphereMat", 1_r , 0.3_r, 0.2_r, 0.2_r, 0.24_r, 200_r, 200_r, 0_r, 0_r ); // pe coupling const real_t overlap = real_t( 1.5 ) * dx; std::function<void(void)> syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // sphere positions for test scenarios - Vector3<real_t> positionInsideBlock(real_t(10), real_t(10), real_t(10)); - Vector3<real_t> positionAtBlockBorder(real_t(19.5), real_t(10), real_t(10)); - Vector3<real_t> positionAtBlockBorderUpdated(real_t(20.5), real_t(10), real_t(10)); + Vector3<real_t> positionInsideBlock(10_r, 10_r, 10_r); + Vector3<real_t> positionAtBlockBorder(19.5_r, 10_r, 10_r); + Vector3<real_t> positionAtBlockBorderUpdated(20.5_r, 10_r, 10_r); - Vector3<real_t> positionAtBlockBorder2(real_t(20) + radius + overlap - real_t(0.5), real_t(10), real_t(10)); - Vector3<real_t> positionAtBlockBorderUpdated2(real_t(20) + radius + overlap + real_t(0.5), real_t(10), real_t(10)); + Vector3<real_t> positionAtBlockBorder2(20_r + radius + overlap - 0.5_r, 10_r, 10_r); + Vector3<real_t> positionAtBlockBorderUpdated2(20_r + radius + overlap + 0.5_r, 10_r, 10_r); - Vector3<real_t> testForce(real_t(2), real_t(1), real_t(0)); - Vector3<real_t> torqueOffset = Vector3<real_t>(real_t(1), real_t(0), real_t(0)); + Vector3<real_t> testForce(2_r, 1_r, 0_r); + Vector3<real_t> torqueOffset = Vector3<real_t>(1_r, 0_r, 0_r); pe_coupling::ForceTorqueOnBodiesResetter resetter(blocks, bodyStorageID); shared_ptr<pe_coupling::BodiesForceTorqueContainer> container1 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); @@ -147,8 +147,8 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL_ON_ROOT(" - expecting force: " << expectedForce); WALBERLA_LOG_DEVEL_ON_ROOT(" - expecting torque: " << expectedTorque); - Vector3<real_t> actingForce(real_t(0)); - Vector3<real_t> actingTorque(real_t(0)); + Vector3<real_t> actingForce(0_r); + Vector3<real_t> actingTorque(0_r); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID); bodyIt != pe::BodyIterator::end(); ++bodyIt ) @@ -233,8 +233,8 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL_ON_ROOT(" - expecting force: " << expectedForce); WALBERLA_LOG_DEVEL_ON_ROOT(" - expecting torque: " << expectedTorque); - Vector3<real_t> actingForce(real_t(0)); - Vector3<real_t> actingTorque(real_t(0)); + Vector3<real_t> actingForce(0_r); + Vector3<real_t> actingTorque(0_r); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID); bodyIt != pe::BodyIterator::end(); ++bodyIt ) @@ -325,8 +325,8 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL_ON_ROOT(" - expecting force: " << expectedForce); WALBERLA_LOG_DEVEL_ON_ROOT(" - expecting torque: " << expectedTorque); - Vector3<real_t> actingForce(real_t(0)); - Vector3<real_t> actingTorque(real_t(0)); + Vector3<real_t> actingForce(0_r); + Vector3<real_t> actingTorque(0_r); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID); bodyIt != pe::BodyIterator::end(); ++bodyIt ) @@ -429,8 +429,8 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL_ON_ROOT(" - expecting force: " << expectedForce); WALBERLA_LOG_DEVEL_ON_ROOT(" - expecting torque: " << expectedTorque); - Vector3<real_t> actingForce(real_t(0)); - Vector3<real_t> actingTorque(real_t(0)); + Vector3<real_t> actingForce(0_r); + Vector3<real_t> actingTorque(0_r); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID); bodyIt != pe::BodyIterator::end(); ++bodyIt ) diff --git a/tests/pe_coupling/utility/PeSubCyclingTest.cpp b/tests/pe_coupling/utility/PeSubCyclingTest.cpp index 54268c11..32445a58 100644 --- a/tests/pe_coupling/utility/PeSubCyclingTest.cpp +++ b/tests/pe_coupling/utility/PeSubCyclingTest.cpp @@ -67,8 +67,8 @@ int main( int argc, char **argv ) // uncomment to have logging //logging::Logging::instance()->setLogLevel(logging::Logging::LogLevel::DETAIL); - const real_t dx = real_t(1); - const real_t radius = real_t(5); + const real_t dx = 1_r; + const real_t radius = 5_r; /////////////////////////// // DATA STRUCTURES SETUP // @@ -91,7 +91,7 @@ int main( int argc, char **argv ) pe::SetBodyTypeIDs<BodyTypeTuple>::execute(); shared_ptr<pe::BodyStorage> globalBodyStorage = make_shared<pe::BodyStorage>(); auto bodyStorageID = blocks->addBlockData(pe::createStorageDataHandling<BodyTypeTuple>(), "Storage"); - auto sphereMaterialID = pe::createMaterial( "sphereMat", real_t(1) , real_t(0.3), real_t(0.2), real_t(0.2), real_t(0.24), real_t(200), real_t(200), real_t(0), real_t(0) ); + auto sphereMaterialID = pe::createMaterial( "sphereMat", 1_r , 0.3_r, 0.2_r, 0.2_r, 0.24_r, 200_r, 200_r, 0_r, 0_r ); auto ccdID = blocks->addBlockData(pe::ccd::createHashGridsDataHandling( globalBodyStorage, bodyStorageID ), "CCD"); auto fcdID = blocks->addBlockData(pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, pe::fcd::AnalyticCollideFunctor>(), "FCD"); @@ -103,15 +103,15 @@ int main( int argc, char **argv ) // sphere positions for test scenarios - Vector3<real_t> positionInsideBlock(real_t(10), real_t(10), real_t(10)); - Vector3<real_t> positionAtBlockBorder(real_t(19.9), real_t(10), real_t(10)); - Vector3<real_t> positionAtBlockBorder2(real_t(20) + radius + overlap - real_t(0.1), real_t(10), real_t(10)); + Vector3<real_t> positionInsideBlock(10_r, 10_r, 10_r); + Vector3<real_t> positionAtBlockBorder(19.9_r, 10_r, 10_r); + Vector3<real_t> positionAtBlockBorder2(20_r + radius + overlap - 0.1_r, 10_r, 10_r); - Vector3<real_t> testForce(real_t(2), real_t(1), real_t(0)); - Vector3<real_t> torqueOffset = Vector3<real_t>(real_t(1), real_t(0), real_t(0)); + Vector3<real_t> testForce(2_r, 1_r, 0_r); + Vector3<real_t> torqueOffset = Vector3<real_t>(1_r, 0_r, 0_r); uint_t peSubCycles( 10 ); - real_t dtPe( real_t(10) ); + real_t dtPe( 10_r ); real_t dtPeSubCycle = dtPe / real_c(peSubCycles); pe_coupling::TimeStep timestep(blocks, bodyStorageID, cr, syncCall, dtPe, peSubCycles); @@ -119,9 +119,9 @@ int main( int argc, char **argv ) // evaluate how far the sphere will travel with a specific force applied which is the reference distance for later // (depends on the chosen time integrator in the DEM and thus can not generally be computed a priori here) - Vector3<real_t> expectedPosOffset(real_t(0)); - Vector3<real_t> expectedLinearVel(real_t(0)); - Vector3<real_t> expectedAngularVel(real_t(0)); + Vector3<real_t> expectedPosOffset(0_r); + Vector3<real_t> expectedLinearVel(0_r); + Vector3<real_t> expectedAngularVel(0_r); { const Vector3<real_t>& startPos = positionInsideBlock; @@ -204,9 +204,9 @@ int main( int argc, char **argv ) timestep(); - Vector3<real_t> curPosOffset(real_t(0)); - Vector3<real_t> curLinearVel(real_t(0)); - Vector3<real_t> curAngularVel(real_t(0)); + Vector3<real_t> curPosOffset(0_r); + Vector3<real_t> curLinearVel(0_r); + Vector3<real_t> curAngularVel(0_r); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { for( auto bodyIt = pe::LocalBodyIterator::begin( *blockIt, bodyStorageID); bodyIt != pe::LocalBodyIterator::end(); ++bodyIt ) @@ -271,9 +271,9 @@ int main( int argc, char **argv ) timestep(); - Vector3<real_t> curPosOffset(real_t(0)); - Vector3<real_t> curLinearVel(real_t(0)); - Vector3<real_t> curAngularVel(real_t(0)); + Vector3<real_t> curPosOffset(0_r); + Vector3<real_t> curLinearVel(0_r); + Vector3<real_t> curAngularVel(0_r); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { for( auto bodyIt = pe::LocalBodyIterator::begin( *blockIt, bodyStorageID); bodyIt != pe::LocalBodyIterator::end(); ++bodyIt ) @@ -331,16 +331,16 @@ int main( int argc, char **argv ) for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID); bodyIt != pe::BodyIterator::end(); ++bodyIt ) { auto pos = bodyIt->getPosition(); - bodyIt->addForceAtPos(real_t(0.5)*testForce, pos+torqueOffset); + bodyIt->addForceAtPos(0.5_r*testForce, pos+torqueOffset); } } timestep(); - Vector3<real_t> curPosOffset(real_t(0)); - Vector3<real_t> curLinearVel(real_t(0)); - Vector3<real_t> curAngularVel(real_t(0)); + Vector3<real_t> curPosOffset(0_r); + Vector3<real_t> curLinearVel(0_r); + Vector3<real_t> curAngularVel(0_r); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { for( auto bodyIt = pe::LocalBodyIterator::begin( *blockIt, bodyStorageID); bodyIt != pe::LocalBodyIterator::end(); ++bodyIt ) @@ -404,9 +404,9 @@ int main( int argc, char **argv ) timestep(); - Vector3<real_t> curPosOffset(real_t(0)); - Vector3<real_t> curLinearVel(real_t(0)); - Vector3<real_t> curAngularVel(real_t(0)); + Vector3<real_t> curPosOffset(0_r); + Vector3<real_t> curLinearVel(0_r); + Vector3<real_t> curAngularVel(0_r); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) { for( auto bodyIt = pe::LocalBodyIterator::begin( *blockIt, bodyStorageID); bodyIt != pe::LocalBodyIterator::end(); ++bodyIt ) diff --git a/tests/postprocessing/SphereTriangulate.cpp b/tests/postprocessing/SphereTriangulate.cpp index 325f0ad4..16959715 100644 --- a/tests/postprocessing/SphereTriangulate.cpp +++ b/tests/postprocessing/SphereTriangulate.cpp @@ -136,11 +136,11 @@ void multipleFields() TriangleMesh m; for( Field<shared_ptr<GlF>,1 >::iterator i = arr->begin(); i != arr->end(); ++i) { Vector3<real_t> offset(0); - offset[0] = i.x() ? fieldSize * real_c(0.5) : real_t(0); - offset[1] = i.y() ? fieldSize * real_c(0.5) : real_t(0); - offset[2] = i.z() ? fieldSize * real_c(0.5) : real_t(0); + offset[0] = i.x() ? fieldSize * real_c(0.5) : 0_r; + offset[1] = i.y() ? fieldSize * real_c(0.5) : 0_r; + offset[2] = i.z() ? fieldSize * real_c(0.5) : 0_r; - generateIsoSurface( **i, real_c(0.5), m, Vector3<real_t>(real_t(1)), uint_t(0), offset ); + generateIsoSurface( **i, real_c(0.5), m, Vector3<real_t>(1_r), uint_t(0), offset ); } //ofstream file1("meshWithDoubles.obj"); diff --git a/tests/python_coupling/ConfigFromPythonTest.cpp b/tests/python_coupling/ConfigFromPythonTest.cpp index 527cc3e5..12bd3d52 100644 --- a/tests/python_coupling/ConfigFromPythonTest.cpp +++ b/tests/python_coupling/ConfigFromPythonTest.cpp @@ -41,7 +41,7 @@ int main( int argc, char** argv ) config->listParameters(); WALBERLA_CHECK_EQUAL ( int ( config->getParameter<int> ("testInt") ), 4 ); WALBERLA_CHECK_EQUAL ( std::string( config->getParameter<std::string>("testString")), "someString" ); - WALBERLA_CHECK_FLOAT_EQUAL( double ( config->getParameter<real_t> ("testDouble")), real_t(42.42)); + WALBERLA_CHECK_FLOAT_EQUAL( double ( config->getParameter<real_t> ("testDouble")), 42.42_r); auto subBlock = config->getBlock("subBlock"); diff --git a/tests/python_coupling/FieldExportTest.cpp b/tests/python_coupling/FieldExportTest.cpp index 05997b58..c1451727 100644 --- a/tests/python_coupling/FieldExportTest.cpp +++ b/tests/python_coupling/FieldExportTest.cpp @@ -59,7 +59,7 @@ int main( int argc, char ** argv ) pythonManager->addExporterFunction( blockforest::exportModuleToPython<Stencils> ); - shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid( 1,1,1, 20,20,1, real_t(1.0), false, true,true,true ); + shared_ptr< StructuredBlockForest > blocks = blockforest::createUniformBlockGrid( 1,1,1, 20,20,1, 1.0_r, false, true,true,true ); auto sca2FieldID = field::addToStorage< GhostLayerField<int,2> >( blocks, "sca2Field", int(0), field::fzyx, 1 ); auto sca3FieldID = field::addToStorage< GhostLayerField<int,3> >( blocks, "sca3Field", int(0), field::fzyx, 1 ); -- GitLab