From 51e1f4cd0355f5fa9cec123ce814798e60e9fa8e Mon Sep 17 00:00:00 2001 From: Katharina Heck Date: Wed, 10 Oct 2018 13:06:24 +0200 Subject: [PATCH 1/2] [cleanup] cleanup heavyoil, introduce posttimestep in all problems --- lecture/mm/heavyoil/sagd/CMakeLists.txt | 4 +- lecture/mm/heavyoil/sagd/problem.hh | 65 +++++++++++---- lecture/mm/heavyoil/sagd/sagd.cc | 10 +++ lecture/mm/heavyoil/sagd/sagd.input | 2 +- lecture/mm/heavyoil/sagd/spatialparams.hh | 1 - lecture/mm/heavyoil/sagdcyclic/CMakeLists.txt | 2 +- lecture/mm/heavyoil/sagdcyclic/problem.hh | 80 ++++++++++++------- lecture/mm/heavyoil/sagdcyclic/sagd_cyclic.cc | 21 +++-- .../mm/heavyoil/sagdcyclic/sagd_cyclic.input | 2 +- .../mm/heavyoil/sagdcyclic/spatialparams.hh | 1 - .../mm/heavyoil/sagdcyclichyst/CMakeLists.txt | 2 +- lecture/mm/heavyoil/sagdcyclichyst/problem.hh | 58 +++++--------- .../sagdcyclichyst/sagd_cyclic_hyst.cc | 11 ++- .../heavyoil/sagdcyclichyst/spatialparams.hh | 2 - 14 files changed, 156 insertions(+), 105 deletions(-) diff --git a/lecture/mm/heavyoil/sagd/CMakeLists.txt b/lecture/mm/heavyoil/sagd/CMakeLists.txt index 4639c54..8a7c8bc 100644 --- a/lecture/mm/heavyoil/sagd/CMakeLists.txt +++ b/lecture/mm/heavyoil/sagd/CMakeLists.txt @@ -1,7 +1,7 @@ # headers for installation and headercheck -add_dumux_test(sagd sagd sagd.cc "${CMAKE_CURRENT_BINARY_DIR}/sagd" "-TimeManager.TEnd" "43200" "-TimeManager.MaxTimeStepSize" "21600") - +add_dumux_test(sagd sagd sagd.cc "${CMAKE_CURRENT_BINARY_DIR}/sagd" "-TimeLoop.TEnd" "43200" "-TimeLoop.MaxTimeStepSize" "21600") +set_tests_properties(sagd PROPERTIES TIMEOUT 30000) install(FILES sagdproblem.hh sagdspatialparams.hh diff --git a/lecture/mm/heavyoil/sagd/problem.hh b/lecture/mm/heavyoil/sagd/problem.hh index 6a36e1c..0bb354a 100644 --- a/lecture/mm/heavyoil/sagd/problem.hh +++ b/lecture/mm/heavyoil/sagd/problem.hh @@ -133,7 +133,7 @@ class SagdProblem : public PorousMediumFlowProblem public: SagdProblem(std::shared_ptr fvGridGeometry) - : ParentType(fvGridGeometry), pOut_(4e6) + : ParentType(fvGridGeometry) { maxDepth_ = 400.0; // [m] FluidSystem::init(); @@ -230,16 +230,17 @@ public: const Scalar wellRadius = 0.50 * 0.3048; // 0.50 ft as specified by SPE9 - const Scalar gridHeight_ = 0.5; - const Scalar effectiveRadius_ = 0.208 * gridHeight_; //Peaceman's Well Model + const Scalar gridHeight = 0.5; + const Scalar effectiveRadius = 0.208 * gridHeight; //Peaceman's Well Model + const Scalar pOut = 4e6; using std::log; //divided by molarMass() of water to convert from kg/m s to mol/m s - const Scalar qW = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius_/wellRadius))) * - densityW * elemMobW * ( elemPressW-pOut_))/0.01801528; + const Scalar qW = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius/wellRadius))) * + densityW * elemMobW * ( elemPressW-pOut))/0.01801528; //divided by molarMass() of HeavyOil to convert from kg/m s to mol/m s - const Scalar qN = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius_/wellRadius))) * - densityN * elemMobN * (elemPressN-pOut_))/0.35; + const Scalar qN = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius/wellRadius))) * + densityN * elemMobN * (elemPressN-pOut))/0.35; Scalar qE; //without cooling: @@ -251,10 +252,9 @@ public: { qE = qW*0.018*enthW + qN*enthN*0.350 + (wT-495.)*5000.; // ~3x injected enthalpy std::cout<< "Cooling now! Extracted enthalpy: " << qE << std::endl; - } else { + } + else qE = qW*0.018*enthW + qN*enthN*0.350; - } - values[contiWEqIdx] = qW; values[contiNEqIdx] = qN; @@ -277,11 +277,44 @@ public: * * \param globalPos The position for which the initial condition should be evaluated */ - PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const + PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const { return initial_(globalPos); } + template + void postTimeStep(const TimeLoop& timeLoop, const PrimaryVariables& storage, const SolutionVector& x) + { + const Scalar time = timeLoop.time(); + const Scalar dt = timeLoop.timeStepSize(); + + // print storage terms + std::cout<<"Storage: " << storage << " Time: " << time+dt << std::endl; + massBalance.open ("massBalance.txt", std::ios::out | std::ios::app ); + massBalance << " Storage " << storage + << " Time " << time+dt + << std::endl; + massBalance.close(); + + //mass of Oil + Scalar newMassProducedOil = massProducedOil_; + //mass of Water + Scalar newMassProducedWater = massProducedWater_; + + totalMassProducedOil_ += newMassProducedOil; + totalMassProducedWater_ += newMassProducedWater; + + const int timeStepIndex = timeLoop.timeStepIndex(); + if (timeStepIndex == 0 || + timeStepIndex % 100 == 0 || //after every 1000000 secs + timeLoop.willBeFinished()) + + { + std::cout<<" totalMassProducedOil_ : "<< totalMassProducedOil_ << " Time: " << time+dt << std::endl; + std::cout<<" totalMassProducedWater_ : "<< totalMassProducedWater_ << " Time: " << time+dt << std::endl; + } + } + private: // internal method for the initial condition (reused for the // dirichlet conditions!) @@ -299,16 +332,14 @@ private: Scalar maxDepth_; static constexpr Scalar eps_ = 1e-6; - Scalar pIn_; - Scalar pOut_; + std::string name_; + + int episodeIdx_; + Scalar totalMassProducedOil_; Scalar totalMassProducedWater_; - mutable Scalar massProducedOil_; mutable Scalar massProducedWater_; - - std::string name_; - std::ofstream massBalance; }; } //end namespace diff --git a/lecture/mm/heavyoil/sagd/sagd.cc b/lecture/mm/heavyoil/sagd/sagd.cc index 63447a3..dbb7bf5 100644 --- a/lecture/mm/heavyoil/sagd/sagd.cc +++ b/lecture/mm/heavyoil/sagd/sagd.cc @@ -165,6 +165,16 @@ int main(int argc, char** argv) try // solve the non-linear system with time step control nonLinearSolver.solve(x, *timeLoop); + using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); + PrimaryVariables storage(0); + const auto& localResidual = assembler->localResidual(); + for (const auto& element : elements(leafGridView, Dune::Partitions::interior)) + { + auto storageVec = localResidual.evalStorage(*problem, element, *fvGridGeometry, *gridVariables, x); + storage += storageVec[0]; + } + problem->postTimeStep(*timeLoop, storage, x); + // make the new solution the old solution xOld = x; gridVariables->advanceTimeStep(); diff --git a/lecture/mm/heavyoil/sagd/sagd.input b/lecture/mm/heavyoil/sagd/sagd.input index ca3f2c0..10b4ff7 100644 --- a/lecture/mm/heavyoil/sagd/sagd.input +++ b/lecture/mm/heavyoil/sagd/sagd.input @@ -14,7 +14,7 @@ Name = sagd # name passed to the output routines MaxTimeStepDivisions = 100 [Newton] -MaxRelativeShift = 1.e-3 +MaxRelativeShift = 1.e-2 MaxSteps = 8 [Component] diff --git a/lecture/mm/heavyoil/sagd/spatialparams.hh b/lecture/mm/heavyoil/sagd/spatialparams.hh index 8e43b62..1cd28b9 100644 --- a/lecture/mm/heavyoil/sagd/spatialparams.hh +++ b/lecture/mm/heavyoil/sagd/spatialparams.hh @@ -171,7 +171,6 @@ public: return coarseMaterialParams_; } - private: bool isFineMaterial_(const GlobalPosition &pos) const { diff --git a/lecture/mm/heavyoil/sagdcyclic/CMakeLists.txt b/lecture/mm/heavyoil/sagdcyclic/CMakeLists.txt index 98eb6dd..90a3e08 100644 --- a/lecture/mm/heavyoil/sagdcyclic/CMakeLists.txt +++ b/lecture/mm/heavyoil/sagdcyclic/CMakeLists.txt @@ -1,6 +1,6 @@ # headers for installation and headercheck -add_dumux_test(sagd_cyclic sagd_cyclic sagd_cyclic.cc "${CMAKE_CURRENT_BINARY_DIR}/sagd_cyclic" "-TimeManager.TEnd" "43200" "-TimeManager.MaxTimeStepSize" "21600") +add_dumux_test(sagd_cyclic sagd_cyclic sagd_cyclic.cc "${CMAKE_CURRENT_BINARY_DIR}/sagd_cyclic" "-TimeLoop.TEnd" "43200" "-TimeLoop.MaxTimeStepSize" "21600") install(FILES problem.hh diff --git a/lecture/mm/heavyoil/sagdcyclic/problem.hh b/lecture/mm/heavyoil/sagdcyclic/problem.hh index c282fdd..6e25f04 100644 --- a/lecture/mm/heavyoil/sagdcyclic/problem.hh +++ b/lecture/mm/heavyoil/sagdcyclic/problem.hh @@ -123,18 +123,19 @@ class SagdCyclicProblem : public PorousMediumFlowProblem using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); + using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); + using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables)::LocalView; using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); using Element = typename GridView::template Codim<0>::Entity; using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GlobalPosition = typename SubControlVolumeFace::GlobalPosition; - using TimeLoopPtr = std::shared_ptr>; public: SagdCyclicProblem(std::shared_ptr fvGridGeometry) - : ParentType(fvGridGeometry), pOut_(4e6) + : ParentType(fvGridGeometry) { maxDepth_ = 400.0; // [m] FluidSystem::init(); @@ -142,17 +143,11 @@ public: totalMassProducedWater_ = 0.0; } - void setEpisodeIdx( Scalar epiIdx ) + void setEpisodeIdx(Scalar epiIdx ) { episodeIdx_ = epiIdx; } - void setTimeLoop(TimeLoopPtr timeLoop) - { - timeLoop_ = timeLoop; - } - - /*! * \name Boundary conditions */ @@ -250,17 +245,17 @@ public: const Scalar wellRadius = 0.50 * 0.3048; // 0.50 ft as specified by SPE9 - - const Scalar gridHeight_ = 0.5; - const Scalar effectiveRadius_ = 0.208 * gridHeight_; //Peaceman's Well Model + const Scalar gridHeight = 0.5; + const Scalar effectiveRadius = 0.208 * gridHeight; //Peaceman's Well Model + const Scalar pOut = 4e6; using std::log; //divided by molarMass() of water to convert from kg/m s to mol/m s - const Scalar qW = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius_/wellRadius))) * - densityW * elemMobW * ( elemPressW-pOut_))/0.01801528; + const Scalar qW = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius/wellRadius))) * + densityW * elemMobW * ( elemPressW-pOut))/0.01801528; //divided by molarMass() of HeavyOil to convert from kg/m s to mol/m s - const Scalar qN = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius_/wellRadius))) * - densityN * elemMobN * (elemPressN-pOut_))/0.35; + const Scalar qN = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius/wellRadius))) * + densityN * elemMobN * (elemPressN-pOut))/0.35; Scalar qE; //without cooling: @@ -272,10 +267,9 @@ public: { qE = qW*0.018*enthW + qN*enthN*0.350 + (wT-495.)*5000.; // ~3x injected enthalpy std::cout<< "Cooling now! Extracted enthalpy: " << qE << std::endl; - } else { + } + else qE = qW*0.018*enthW + qN*enthN*0.350; - } - values[contiWEqIdx] = qW; values[contiNEqIdx] = qN; @@ -298,11 +292,44 @@ public: * * \param globalPos The position for which the initial condition should be evaluated */ - PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const + PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const { return initial_(globalPos); } + template + void postTimeStep(const TimeLoop& timeLoop, const PrimaryVariables& storage, const SolutionVector& x) + { + const Scalar time = timeLoop.time(); + const Scalar dt = timeLoop.timeStepSize(); + + // print storage terms + std::cout<<"Storage: " << storage << " Time: " << time+dt << std::endl; + massBalance.open ("massBalanceCyclic.txt", std::ios::out | std::ios::app ); + massBalance << " Storage " << storage + << " Time " << time+dt + << std::endl; + massBalance.close(); + + //mass of Oil + Scalar newMassProducedOil = massProducedOil_; + //mass of Water + Scalar newMassProducedWater = massProducedWater_; + + totalMassProducedOil_ += newMassProducedOil; + totalMassProducedWater_ += newMassProducedWater; + + const int timeStepIndex = timeLoop.timeStepIndex(); + if (timeStepIndex == 0 || + timeStepIndex % 100 == 0 || //after every 1000000 secs + timeLoop.willBeFinished()) + + { + std::cout<<" totalMassProducedOil_ : "<< totalMassProducedOil_ << " Time: " << time+dt << std::endl; + std::cout<<" totalMassProducedWater_ : "<< totalMassProducedWater_ << " Time: " << time+dt << std::endl; + } + } + private: // internal method for the initial condition (reused for the // dirichlet conditions!) @@ -320,19 +347,16 @@ private: Scalar maxDepth_; static constexpr Scalar eps_ = 1e-6; - Scalar pIn_; - Scalar pOut_; - Scalar totalMassProducedOil_; - Scalar totalMassProducedWater_; + std::string name_; + int episodeIdx_; - TimeLoopPtr timeLoop_; + Scalar totalMassProducedOil_; + Scalar totalMassProducedWater_; mutable Scalar massProducedOil_; mutable Scalar massProducedWater_; - - std::string name_; - std::ofstream massBalance; + }; } //end namespace diff --git a/lecture/mm/heavyoil/sagdcyclic/sagd_cyclic.cc b/lecture/mm/heavyoil/sagdcyclic/sagd_cyclic.cc index 03863c1..60cd207 100644 --- a/lecture/mm/heavyoil/sagdcyclic/sagd_cyclic.cc +++ b/lecture/mm/heavyoil/sagdcyclic/sagd_cyclic.cc @@ -140,10 +140,9 @@ int main(int argc, char** argv) try vtkWriter.write(0.0); // instantiate time loop - int episodeIdx_ = 0; + auto episodeIdx = 0.0; auto timeLoop = std::make_shared>(0, dt, tEnd); - problem->setTimeLoop(timeLoop); - problem->setEpisodeIdx(episodeIdx_); + problem->setEpisodeIdx(episodeIdx); timeLoop->setMaxTimeStepSize(maxDt); timeLoop->setPeriodicCheckPoint(getParam("TimeLoop.EpisodeLength", std::numeric_limits::max())); @@ -168,6 +167,16 @@ int main(int argc, char** argv) try // solve the non-linear system with time step control nonLinearSolver.solve(x, *timeLoop); + using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); + PrimaryVariables storage(0); + const auto& localResidual = assembler->localResidual(); + for (const auto& element : elements(leafGridView, Dune::Partitions::interior)) + { + auto storageVec = localResidual.evalStorage(*problem, element, *fvGridGeometry, *gridVariables, x); + storage += storageVec[0]; + } + problem->postTimeStep(*timeLoop, storage, x); + // make the new solution the old solution xOld = x; gridVariables->advanceTimeStep(); @@ -182,10 +191,10 @@ int main(int argc, char** argv) try if (hasParam("TimeLoop.EpisodeLength")) if(timeLoop->isCheckPoint()) { - std::cout << "\n Episode " << episodeIdx_ << " done \n" << std::endl; + std::cout << "\n Episode " << episodeIdx << " done \n" << std::endl; - episodeIdx_++; - problem->setEpisodeIdx(episodeIdx_); + episodeIdx++; + problem->setEpisodeIdx(episodeIdx); } // set new dt as suggested by the newton solver diff --git a/lecture/mm/heavyoil/sagdcyclic/sagd_cyclic.input b/lecture/mm/heavyoil/sagdcyclic/sagd_cyclic.input index 4506ac7..9721557 100644 --- a/lecture/mm/heavyoil/sagdcyclic/sagd_cyclic.input +++ b/lecture/mm/heavyoil/sagdcyclic/sagd_cyclic.input @@ -15,7 +15,7 @@ Name = sagdCyclic # name passed to the output routines MaxTimeStepDivisions = 100 [Newton] -MaxRelativeShift = 1.e-3 +MaxRelativeShift = 1.e-2 MaxSteps = 8 [Component] diff --git a/lecture/mm/heavyoil/sagdcyclic/spatialparams.hh b/lecture/mm/heavyoil/sagdcyclic/spatialparams.hh index 8e43b62..1cd28b9 100644 --- a/lecture/mm/heavyoil/sagdcyclic/spatialparams.hh +++ b/lecture/mm/heavyoil/sagdcyclic/spatialparams.hh @@ -171,7 +171,6 @@ public: return coarseMaterialParams_; } - private: bool isFineMaterial_(const GlobalPosition &pos) const { diff --git a/lecture/mm/heavyoil/sagdcyclichyst/CMakeLists.txt b/lecture/mm/heavyoil/sagdcyclichyst/CMakeLists.txt index 65de4c8..64ffa5b 100644 --- a/lecture/mm/heavyoil/sagdcyclichyst/CMakeLists.txt +++ b/lecture/mm/heavyoil/sagdcyclichyst/CMakeLists.txt @@ -1,6 +1,6 @@ # headers for installation and headercheck -add_dumux_test(sagd_cyclic_hyst sagd_cyclic_hyst sagd_cyclic_hyst.cc "${CMAKE_CURRENT_BINARY_DIR}/sagd_cyclic_hyst" "-TimeManager.TEnd" "43200" "-TimeManager.MaxTimeStepSize" "21600") +add_dumux_test(sagd_cyclic_hyst sagd_cyclic_hyst sagd_cyclic_hyst.cc "${CMAKE_CURRENT_BINARY_DIR}/sagd_cyclic_hyst" "-TimeLoop.TEnd" "43200" "-TimeLoop.MaxTimeStepSize" "21600") install(FILES problem.hh diff --git a/lecture/mm/heavyoil/sagdcyclichyst/problem.hh b/lecture/mm/heavyoil/sagdcyclichyst/problem.hh index d3c2b99..0428c7a 100644 --- a/lecture/mm/heavyoil/sagdcyclichyst/problem.hh +++ b/lecture/mm/heavyoil/sagdcyclichyst/problem.hh @@ -131,12 +131,11 @@ class SagdCyclicHystProblem : public PorousMediumFlowProblem using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using GlobalPosition = typename SubControlVolumeFace::GlobalPosition; - using TimeLoopPtr = std::shared_ptr>; public: SagdCyclicHystProblem(std::shared_ptr fvGridGeometry) - : ParentType(fvGridGeometry), pOut_(4e6) + : ParentType(fvGridGeometry) { maxDepth_ = 400.0; // [m] FluidSystem::init(); @@ -144,17 +143,11 @@ public: totalMassProducedWater_ = 0.0; } - void setEpisodeIdx( Scalar epiIdx ) + void setEpisodeIdx(Scalar epiIdx ) { episodeIdx_ = epiIdx; } - void setTimeLoop(TimeLoopPtr timeLoop) - { - timeLoop_ = timeLoop; - } - - /*! * \name Boundary conditions */ @@ -237,7 +230,6 @@ public: } else if (globalPos[1] > 2.5 - eps_ && globalPos[1] < 3.5 + eps_) // production well { - const Scalar elemPressW = elemVolVars[scvf.insideScvIdx()].pressure(wPhaseIdx); //Pressures const Scalar elemPressN = elemVolVars[scvf.insideScvIdx()].pressure(nPhaseIdx); @@ -252,17 +244,17 @@ public: const Scalar wellRadius = 0.50 * 0.3048; // 0.50 ft as specified by SPE9 - - const Scalar gridHeight_ = 0.5; - const Scalar effectiveRadius_ = 0.208 * gridHeight_; //Peaceman's Well Model + const Scalar pOut = 4e6; + const Scalar gridHeight = 0.5; + const Scalar effectiveRadius = 0.208 * gridHeight; //Peaceman's Well Model using std::log; //divided by molarMass() of water to convert from kg/m s to mol/m s - const Scalar qW = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius_/wellRadius))) * - densityW * elemMobW * ( elemPressW-pOut_))/0.01801528; + const Scalar qW = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius/wellRadius))) * + densityW * elemMobW * ( elemPressW-pOut))/0.01801528; //divided by molarMass() of HeavyOil to convert from kg/m s to mol/m s - const Scalar qN = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius_/wellRadius))) * - densityN * elemMobN * (elemPressN-pOut_))/0.35; + const Scalar qN = (((2*3.1415*0.5*4e-14)/(log(effectiveRadius/wellRadius))) * + densityN * elemMobN * (elemPressN-pOut))/0.35; Scalar qE; //without cooling: @@ -270,14 +262,13 @@ public: //with cooling: see Diplomarbeit Stefan Roll, Sept. 2015 Scalar wT = elemVolVars[scvf.insideScvIdx()].temperature(); // well temperature - if ( wT > 495. ) + if (wT > 495. ) { qE = qW*0.018*enthW + qN*enthN*0.350 + (wT-495.)*5000.; // ~3x injected enthalpy std::cout<< "Cooling now! Extracted enthalpy: " << qE << std::endl; - } else { + } + else qE = qW*0.018*enthW + qN*enthN*0.350; - } - values[contiWEqIdx] = qW; values[contiNEqIdx] = qN; @@ -300,7 +291,7 @@ public: * * \param globalPos The position for which the initial condition should be evaluated */ - PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const + PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const { return initial_(globalPos); } @@ -322,14 +313,8 @@ public: this->spatialParams().template getMaxSaturation(*this, x); this->spatialParams().template trappedSat(*this, x); - //mass of Oil - const Scalar newMassProducedOil_ = massProducedOil_; - - totalMassProducedOil_ += newMassProducedOil_; - //mass of Water - Scalar newMassProducedWater_ = massProducedWater_; - - totalMassProducedWater_ += newMassProducedWater_; + totalMassProducedOil_ += massProducedOil_; + totalMassProducedWater_ += massProducedWater_; const int timeStepIndex = timeLoop.timeStepIndex(); if (timeStepIndex == 0 || @@ -359,19 +344,16 @@ private: Scalar maxDepth_; static constexpr Scalar eps_ = 1e-6; - Scalar pIn_; - Scalar pOut_; - Scalar totalMassProducedOil_; - Scalar totalMassProducedWater_; + std::string name_; + int episodeIdx_; - TimeLoopPtr timeLoop_; + Scalar totalMassProducedOil_; + Scalar totalMassProducedWater_; mutable Scalar massProducedOil_; mutable Scalar massProducedWater_; - - std::string name_; - std::ofstream massBalance; + }; } //end namespace diff --git a/lecture/mm/heavyoil/sagdcyclichyst/sagd_cyclic_hyst.cc b/lecture/mm/heavyoil/sagdcyclichyst/sagd_cyclic_hyst.cc index ca562e4..c595ccc 100644 --- a/lecture/mm/heavyoil/sagdcyclichyst/sagd_cyclic_hyst.cc +++ b/lecture/mm/heavyoil/sagdcyclichyst/sagd_cyclic_hyst.cc @@ -140,10 +140,9 @@ int main(int argc, char** argv) try vtkWriter.write(0.0); // instantiate time loop - int episodeIdx_ = 0; + auto episodeIdx = 0.0; auto timeLoop = std::make_shared>(0, dt, tEnd); - problem->setTimeLoop(timeLoop); - problem->setEpisodeIdx(episodeIdx_); + problem->setEpisodeIdx(episodeIdx); timeLoop->setMaxTimeStepSize(maxDt); timeLoop->setPeriodicCheckPoint(getParam("TimeLoop.EpisodeLength", std::numeric_limits::max())); @@ -192,10 +191,10 @@ int main(int argc, char** argv) try if (hasParam("TimeLoop.EpisodeLength")) if(timeLoop->isCheckPoint()) { - std::cout << "\n Episode " << episodeIdx_ << " done \n" << std::endl; + std::cout << "\n Episode " << episodeIdx << " done \n" << std::endl; - episodeIdx_++; - problem->setEpisodeIdx(episodeIdx_); + episodeIdx++; + problem->setEpisodeIdx(episodeIdx); } // set new dt as suggested by the newton solver diff --git a/lecture/mm/heavyoil/sagdcyclichyst/spatialparams.hh b/lecture/mm/heavyoil/sagdcyclichyst/spatialparams.hh index 23689c0..9ce2402 100644 --- a/lecture/mm/heavyoil/sagdcyclichyst/spatialparams.hh +++ b/lecture/mm/heavyoil/sagdcyclichyst/spatialparams.hh @@ -244,8 +244,6 @@ public: } } - - private: bool isFineMaterial_(const GlobalPosition &pos) const { -- GitLab From 643ebdbf2dcdb9efdb2cb3c251c483d75fbc75fd Mon Sep 17 00:00:00 2001 From: Katharina Heck Date: Wed, 10 Oct 2018 13:11:31 +0200 Subject: [PATCH 2/2] [cleanup] remove unnecessary timeout setting in cmakelist --- lecture/mm/heavyoil/sagd/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/lecture/mm/heavyoil/sagd/CMakeLists.txt b/lecture/mm/heavyoil/sagd/CMakeLists.txt index 8a7c8bc..1f614da 100644 --- a/lecture/mm/heavyoil/sagd/CMakeLists.txt +++ b/lecture/mm/heavyoil/sagd/CMakeLists.txt @@ -1,7 +1,6 @@ # headers for installation and headercheck add_dumux_test(sagd sagd sagd.cc "${CMAKE_CURRENT_BINARY_DIR}/sagd" "-TimeLoop.TEnd" "43200" "-TimeLoop.MaxTimeStepSize" "21600") -set_tests_properties(sagd PROPERTIES TIMEOUT 30000) install(FILES sagdproblem.hh sagdspatialparams.hh -- GitLab