From 9b16ddac7c57d45bda5ae00657c59225904bf6c2 Mon Sep 17 00:00:00 2001 From: alena <akaranchuk@list.ru> Date: Wed, 23 Aug 2023 11:52:52 +0200 Subject: [PATCH] fix MPI type for restarting --- .../Parallel/MPIIODataStructures.h | 52 +++++++------------ .../MPIIOMigrationBESimulationObserver.cpp | 18 +++---- .../MPIIOMigrationSimulationObserver.cpp | 40 +++++--------- .../MPIIOMigrationSimulationObserver.h | 9 ++-- .../MPIIORestartSimulationObserver.cpp | 18 +++---- 5 files changed, 54 insertions(+), 83 deletions(-) diff --git a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h index e0f526889..dd5b9935a 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h +++ b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h @@ -9,8 +9,8 @@ namespace MPIIODataStructures //! \brief Structure describes parameters of the grid //! \details The structure is nessasary to restore the grid correctly struct GridParam { - real trafoParams[33]; - real deltaX; + double trafoParams[33]; // not float!!! + double deltaX; // not float!!! int blockNx1; int blockNx2; int blockNx3; @@ -59,18 +59,11 @@ struct dataSetParam { //! \brief Structure describes parameters of the dataSet in MPIIORestartSimulationObserver format //! \details The structure is used when reading from the file struct DataSetRestart { - real collFactor; - real deltaT; - real collFactorL; // for Multiphase model - real collFactorG; // for Multiphase model - real densityRatio;// for Multiphase model - real sigma; // for Multiphase model - real contactAngle; // for Multiphase model - real phiL; // for Multiphase model - real phiH; // for Multiphase model - real tauH; // for Multiphase model - real mob; // for Multiphase model - real interfaceWidth; // for Multiphase model + double collFactor; // not float!!! + double deltaT; // not float!!! + double collFactorL; // for Multiphase model // not float!!! + double collFactorG; // for Multiphase model // not float!!! + double densityRatio;// for Multiphase model // not float!!! int x1; int x2; int x3; @@ -84,18 +77,11 @@ struct DataSetRestart { //! \brief Structure describes parameters of the dataSet in MPIIOMigrationSimulationObserver format //! \details The structure is used to find the needed block in the grid when restoring a dataSet struct DataSetMigration { - real collFactor; - real deltaT; - real collFactorL; // for Multiphase model - real collFactorG; // for Multiphase model - real densityRatio;// for Multiphase model - real sigma; // for Multiphase model - real contactAngle; // for Multiphase model - real phiL; // for Multiphase model - real phiH; // for Multiphase model - real tauH; // for Multiphase model - real mob; // for Multiphase model - real interfaceWidth; // for Multiphase model + double collFactor; // not float!!! + double deltaT; // not float!!! + double collFactorL; // for Multiphase model + double collFactorG; // for Multiphase model + double densityRatio;// for Multiphase model int globalID; int ghostLayerWidth; bool compressible; @@ -129,14 +115,14 @@ struct BoundaryCondition { long long densityBoundaryFlags; long long wallModelBoundaryFlags; - real bcVelocityX1; - real bcVelocityX2; - real bcVelocityX3; - real bcDensity; - real bcPhaseField; + float bcVelocityX1; // not double!!! + float bcVelocityX2; // not double!!! + float bcVelocityX3; // not double!!! + float bcDensity; // not double!!! + float bcPhaseField; // not double!!! - real nx1, nx2, nx3; - real q[26]; + float nx1, nx2, nx3; // not double!!! + float q[26]; // not double!!! char algorithmType; }; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp index 5cdc87c68..c6bed523e 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp @@ -695,16 +695,16 @@ void MPIIOMigrationBESimulationObserver::writeBoundaryConds(int step) bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = (real)bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcPhaseField = (real)bcArr->bcvector[bc]->getBoundaryPhaseField(); - bouCond->nx1 = (real)bcArr->bcvector[bc]->nx1; - bouCond->nx2 = (real)bcArr->bcvector[bc]->nx2; - bouCond->nx3 = (real)bcArr->bcvector[bc]->nx3; + bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); + bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); + bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); + bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); + bouCond->bcPhaseField = bcArr->bcvector[bc]->getBoundaryPhaseField(); + bouCond->nx1 = bcArr->bcvector[bc]->nx1; + bouCond->nx2 = bcArr->bcvector[bc]->nx2; + bouCond->nx3 = bcArr->bcvector[bc]->nx3; for (int iq = 0; iq < 26; iq++) - bouCond->q[iq] = (real)bcArr->bcvector[bc]->getQ(iq); + bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); bouCond->algorithmType = bcArr->bcvector[bc]->getBCStrategyType(); } diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp index cb36362df..9fcc3c9b8 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp @@ -31,7 +31,7 @@ MPIIOMigrationSimulationObserver::MPIIOMigrationSimulationObserver(SPtr<Grid3D> //------------------------- define MPI types --------------------------------- MPI_Datatype typesDataSet[3] = { MPI_DOUBLE, MPI_INT, MPI_CHAR }; - int blocksDataSet[3] = { 12, 2, 2 }; + int blocksDataSet[3] = { 5, 2, 2 }; MPI_Aint offsetsDatatSet[3], lbDataSet, extentDataSet; offsetsDatatSet[0] = 0; @@ -173,14 +173,6 @@ void MPIIOMigrationSimulationObserver::writeDataSet(int step) dataSetArray[ic].collFactorG = kernel->getCollisionFactorG(); dataSetArray[ic].densityRatio = kernel->getDensityRatio(); - dataSetArray[ic].sigma = kernel->getSigma(); - dataSetArray[ic].contactAngle = kernel->getContactAngle(); - dataSetArray[ic].phiL = kernel->getPhiL(); - dataSetArray[ic].phiH = kernel->getPhiH(); - dataSetArray[ic].tauH = kernel->getPhaseFieldRelaxation(); - dataSetArray[ic].mob = kernel->getMobility(); - dataSetArray[ic].interfaceWidth = kernel->getInterfaceWidth(); - D3Q27EsoTwist3DSplittedVectorPtrF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(block->getKernel()->getDataSet()->getFdistributions()); localDistributionsF = D3Q27EsoTwist3DSplittedVectorPtrF->getLocalDistributions(); nonLocalDistributionsF = D3Q27EsoTwist3DSplittedVectorPtrF->getNonLocalDistributions(); @@ -784,23 +776,23 @@ void MPIIOMigrationSimulationObserver::writeBoundaryConds(int step) bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = (real)bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcPhaseField = (real)bcArr->bcvector[bc]->getBoundaryPhaseField(); - bouCond->nx1 = (real)bcArr->bcvector[bc]->nx1; - bouCond->nx2 = (real)bcArr->bcvector[bc]->nx2; - bouCond->nx3 = (real)bcArr->bcvector[bc]->nx3; + bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); + bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); + bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); + bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); + bouCond->bcPhaseField = bcArr->bcvector[bc]->getBoundaryPhaseField(); + bouCond->nx1 = bcArr->bcvector[bc]->nx1; + bouCond->nx2 = bcArr->bcvector[bc]->nx2; + bouCond->nx3 = bcArr->bcvector[bc]->nx3; for (int iq = 0; iq < 26; iq++) - bouCond->q[iq] = (real)bcArr->bcvector[bc]->getQ(iq); + bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); bouCond->algorithmType = bcArr->bcvector[bc]->getBCStrategyType(); } bcVector[ic].push_back(*bouCond); bcAddArray[ic].boundCond_count++; bytesCount[ic] += sizeof(BoundaryCondition); - } + } if (bcindexmatrixCountNotInit) { @@ -1162,15 +1154,7 @@ void MPIIOMigrationSimulationObserver::readDataSet(int step) kernel->setCollisionFactorMultiphase(dataSetArray[n].collFactorL, dataSetArray[n].collFactorG); kernel->setDensityRatio(dataSetArray[n].densityRatio); - kernel->setSigma(dataSetArray[n].sigma); - kernel->setContactAngle(dataSetArray[n].contactAngle); - kernel->setPhiL(dataSetArray[n].phiL); - kernel->setPhiH(dataSetArray[n].phiH); - kernel->setPhaseFieldRelaxation(dataSetArray[n].tauH); - kernel->setMobility(dataSetArray[n].mob); - kernel->setInterfaceWidth(dataSetArray[n].interfaceWidth); - - SPtr<DataSet3D> dataSetPtr = SPtr<DataSet3D>(new DataSet3D()); + SPtr<DataSet3D> dataSetPtr = SPtr<DataSet3D>(new DataSet3D()); dataSetPtr->setFdistributions(mFdistributions); if (multiPhase1) dataSetPtr->setHdistributions(mH1distributions); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h index 588366a64..7466e02a2 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h @@ -25,10 +25,10 @@ public: AverageFluktuations = 3, AverageTriple = 4, ShearStressVal = 5, - RelaxationFactor = 6, - PhaseField1 = 7, - PhaseField2 = 8, - PressureField = 9 + RelaxationFactor = 6, + PhaseField1 = 7, + PhaseField2 = 8, + PressureField = 9 }; MPIIOMigrationSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); @@ -82,6 +82,7 @@ private: SPtr<LBMKernel> lbmKernel; SPtr<BCSet> bcSet; SPtr<Grid3DVisitor> metisVisitor; + }; #endif diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp index fdc3f4d43..fd73d6160 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp @@ -849,16 +849,16 @@ void MPIIORestartSimulationObserver::writeBoundaryConds(int step) bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = (real)bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcPhaseField = (real)bcArr->bcvector[bc]->getBoundaryPhaseField(); - bouCond->nx1 = (real)bcArr->bcvector[bc]->nx1; - bouCond->nx2 = (real)bcArr->bcvector[bc]->nx2; - bouCond->nx3 = (real)bcArr->bcvector[bc]->nx3; + bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); + bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); + bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); + bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); + bouCond->bcPhaseField = bcArr->bcvector[bc]->getBoundaryPhaseField(); + bouCond->nx1 = bcArr->bcvector[bc]->nx1; + bouCond->nx2 = bcArr->bcvector[bc]->nx2; + bouCond->nx3 = bcArr->bcvector[bc]->nx3; for (int iq = 0; iq < 26; iq++) - bouCond->q[iq] = (real)bcArr->bcvector[bc]->getQ(iq); + bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); bouCond->algorithmType = bcArr->bcvector[bc]->getBCStrategyType(); } -- GitLab