diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp index 9e6a33c45520add8fbd725fe621c67bf63e4367e..45fcf30aaacfe4e1de48c43d5da901062a34f7f4 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp @@ -63,8 +63,6 @@ void ComponentTransportProcess::assembleConcreteProcess( GlobalVector& b) { DBUG("Assemble ComponentTransportProcess."); - if (!_use_monolithic_scheme) - setCoupledSolutionsOfPreviousTimeStep(); // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( @@ -79,9 +77,6 @@ void ComponentTransportProcess::assembleWithJacobianConcreteProcess( { DBUG("AssembleWithJacobian ComponentTransportProcess."); - if (!_use_monolithic_scheme) - setCoupledSolutionsOfPreviousTimeStep(); - // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, diff --git a/ProcessLib/HT/HTProcess.cpp b/ProcessLib/HT/HTProcess.cpp index 8689a67a9b9e76b4289fdde54ffade542f86bf0c..1ef758b9f1c22634498d6b895b76429776361bdf 100644 --- a/ProcessLib/HT/HTProcess.cpp +++ b/ProcessLib/HT/HTProcess.cpp @@ -189,5 +189,29 @@ NumLib::LocalToGlobalIndexMap* HTProcess::getDOFTableForExtrapolatorData( NumLib::ComponentOrder::BY_LOCATION); } +void HTProcess::setCoupledSolutionsOfPreviousTimeStep() +{ + const auto number_of_coupled_solutions = + _coupled_solutions->coupled_xs.size(); + _coupled_solutions->coupled_xs_t0.reserve(number_of_coupled_solutions); + const int process_id = _coupled_solutions->process_id; + for (std::size_t i = 0; i < number_of_coupled_solutions; i++) + { + const auto x_t0 = _xs_previous_timestep[process_id].get(); + if (x_t0 == nullptr) + { + OGS_FATAL( + "Memory is not allocated for the global vector " + "of the solution of the previous time step for the ." + "staggered scheme.\n It can be done by overloading " + "Process::preTimestepConcreteProcess" + "(ref. HTProcess::preTimestepConcreteProcess) "); + } + + MathLib::LinAlg::setLocalAccessibleVector(*x_t0); + _coupled_solutions->coupled_xs_t0.emplace_back(x_t0); + } +} + } // namespace HT } // namespace ProcessLib diff --git a/ProcessLib/HT/HTProcess.h b/ProcessLib/HT/HTProcess.h index 55aba2df2824280e8cd7db36033c7256a1e63b62..e0398f08e290a33016bd06d0b2829d8d2d5c5230 100644 --- a/ProcessLib/HT/HTProcess.h +++ b/ProcessLib/HT/HTProcess.h @@ -67,13 +67,6 @@ public: bool isLinear() const override { return false; } //! @} - // Get the solution of the previous time step. - GlobalVector* getPreviousTimeStepSolution( - const int process_id) const override - { - return _xs_previous_timestep[process_id].get(); - } - void setCoupledTermForTheStaggeredSchemeToLocalAssemblers() override; private: @@ -95,6 +88,10 @@ private: double const dt, const int process_id) override; + /// Set the solutions of the previous time step to the coupled term. + /// It only performs for the staggered scheme. + void setCoupledSolutionsOfPreviousTimeStep(); + NumLib::LocalToGlobalIndexMap* getDOFTableForExtrapolatorData( bool& manage_storage) const override; diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess-impl.h b/ProcessLib/HydroMechanics/HydroMechanicsProcess-impl.h index d584ad7e5a766986f02141f7b54f8440d7256cb7..bbb0eb26652e81539cca3916f04be88fef527d8d 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess-impl.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess-impl.h @@ -289,7 +289,6 @@ void HydroMechanicsProcess<DisplacementDim>:: } // For the staggered scheme - setCoupledSolutionsOfPreviousTimeStep(); // For the equations of displacement if (_coupled_solutions->process_id == 1) { diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp index 5e7ec8894c66bc83e0e49e692770574dc46ebf3d..b2ea3a4503a69661fe98dd02ab08092a1bf99ff0 100644 --- a/ProcessLib/Process.cpp +++ b/ProcessLib/Process.cpp @@ -375,27 +375,4 @@ NumLib::IterationResult Process::postIteration(const GlobalVector& x) return postIterationConcreteProcess(x); } -void Process::setCoupledSolutionsOfPreviousTimeStep() -{ - const auto number_of_coupled_solutions = - _coupled_solutions->coupled_xs.size(); - _coupled_solutions->coupled_xs_t0.reserve(number_of_coupled_solutions); - for (std::size_t i = 0; i < number_of_coupled_solutions; i++) - { - const auto x_t0 = getPreviousTimeStepSolution(i); - if (x_t0 == nullptr) - { - OGS_FATAL( - "Memory is not allocated for the global vector " - "of the solution of the previous time step for the ." - "staggered scheme.\n It can be done by overloading " - "Process::preTimestepConcreteProcess" - "(ref. HTProcess::preTimestepConcreteProcess) "); - } - - MathLib::LinAlg::setLocalAccessibleVector(*x_t0); - _coupled_solutions->coupled_xs_t0.emplace_back(x_t0); - } -} - } // namespace ProcessLib diff --git a/ProcessLib/Process.h b/ProcessLib/Process.h index 971dcd957658ec5376d23351dc6caf985c46ccfa..3ca1e200efd9bc09ea8d18ebb843a0cf27db8b45 100644 --- a/ProcessLib/Process.h +++ b/ProcessLib/Process.h @@ -118,14 +118,6 @@ public: return _secondary_variables; } - // Get the solution of the previous time step. - - virtual GlobalVector* getPreviousTimeStepSolution( - const int /*process_id*/) const - { - return nullptr; - } - // Used as a call back for CalculateSurfaceFlux process. virtual std::vector<double> getFlux(std::size_t /*element_id*/, @@ -238,10 +230,6 @@ protected: /// references to the solutions of the coupled processes. CoupledSolutionsForStaggeredScheme* _coupled_solutions; - /// Set the solutions of the previous time step to the coupled term. - /// It only performs for the staggered scheme. - void setCoupledSolutionsOfPreviousTimeStep(); - /// Order of the integration method for element-wise integration. /// The Gauss-Legendre integration method and available orders is /// implemented in MathLib::GaussLegendre.