From 00c488b85d235ccd5563178beb977f03d8829593 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Thu, 27 Jul 2023 15:28:18 +0200 Subject: [PATCH 01/47] [NL] Replace x_dot with x_prev Updated several methods requiring x_dot, now computing it from the x, x_prev, dt triple. --- NumLib/ODESolver/MatrixTranslator.cpp | 16 ++++-- NumLib/ODESolver/MatrixTranslator.h | 8 +-- NumLib/ODESolver/ODESystem.h | 4 +- NumLib/ODESolver/TimeDiscretizedODESystem.cpp | 56 ++----------------- NumLib/ODESolver/TimeDiscretizedODESystem.h | 5 -- 5 files changed, 21 insertions(+), 68 deletions(-) diff --git a/NumLib/ODESolver/MatrixTranslator.cpp b/NumLib/ODESolver/MatrixTranslator.cpp index f1e3d4a35b0..ad8afd2651b 100644 --- a/NumLib/ODESolver/MatrixTranslator.cpp +++ b/NumLib/ODESolver/MatrixTranslator.cpp @@ -45,16 +45,20 @@ void MatrixTranslatorGeneral:: void MatrixTranslatorGeneral:: computeResidual(GlobalMatrix const& M, GlobalMatrix const& K, - GlobalVector const& b, GlobalVector const& x_curr, - GlobalVector const& xdot, GlobalVector& res) const + GlobalVector const& b, double const dt, + GlobalVector const& x_curr, GlobalVector const& x_prev, + GlobalVector& res) const { namespace LinAlg = MathLib::LinAlg; // res = M * x_dot + K * x_curr - b - LinAlg::matMult(M, xdot, res); // the local vector x_dot seems to be - // necessary because of this multiplication - LinAlg::matMultAdd(K, x_curr, res, res); - LinAlg::axpy(res, -1.0, b); + GlobalVector x_dot; + LinAlg::copy(x_curr, x_dot); // x_dot = x + LinAlg::axpy(x_dot, -1., x_prev); // x_dot = x - x_prev + LinAlg::scale(x_dot, 1. / dt); // x_dot = (x - x_prev)/dt + LinAlg::matMult(M, x_dot, res); // res = M*x_dot + LinAlg::matMultAdd(K, x_curr, res, res); // res = M*x_dot + K*x + LinAlg::axpy(res, -1., b); // res = M*x_dot + X*x - b } void MatrixTranslatorGeneral:: diff --git a/NumLib/ODESolver/MatrixTranslator.h b/NumLib/ODESolver/MatrixTranslator.h index da5f69463b5..cce47f2efbd 100644 --- a/NumLib/ODESolver/MatrixTranslator.h +++ b/NumLib/ODESolver/MatrixTranslator.h @@ -54,9 +54,9 @@ class MatrixTranslator * \ref concept_time_discretization "time discretization". */ virtual void computeResidual(GlobalMatrix const& M, GlobalMatrix const& K, - GlobalVector const& b, + GlobalVector const& b, double dt, GlobalVector const& x_curr, - GlobalVector const& xdot, + GlobalVector const& x_prev, GlobalVector& res) const = 0; //! Computes the Jacobian of the residual and writes it to \c Jac_out. @@ -107,8 +107,8 @@ class MatrixTranslatorGeneral //! Computes \f$ r = M \cdot \hat x + K \cdot x_C - b \f$. void computeResidual(GlobalMatrix const& M, GlobalMatrix const& K, - GlobalVector const& b, GlobalVector const& x_curr, - GlobalVector const& xdot, + GlobalVector const& b, double dt, + GlobalVector const& x_curr, GlobalVector const& x_prev, GlobalVector& res) const override; //! Writes \c Jac_in to \c Jac_out. diff --git a/NumLib/ODESolver/ODESystem.h b/NumLib/ODESolver/ODESystem.h index d5fb018996b..f98a1131081 100644 --- a/NumLib/ODESolver/ODESystem.h +++ b/NumLib/ODESolver/ODESystem.h @@ -59,7 +59,7 @@ class ODESystem const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) = 0; @@ -141,7 +141,7 @@ class ODESystem const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) = 0; diff --git a/NumLib/ODESolver/TimeDiscretizedODESystem.cpp b/NumLib/ODESolver/TimeDiscretizedODESystem.cpp index f00c53ff121..5f316ddb6f7 100644 --- a/NumLib/ODESolver/TimeDiscretizedODESystem.cpp +++ b/NumLib/ODESolver/TimeDiscretizedODESystem.cpp @@ -82,44 +82,19 @@ void TimeDiscretizedODESystem xdot(x_new_timestep.size()); - _xdot_ids.resize(x_new_timestep.size()); - for (std::size_t i = 0; i < xdot.size(); i++) - { - xdot[i] = - &NumLib::GlobalVectorProvider::provider.getVector(_xdot_ids[i]); - _time_disc.getXdot(*x_new_timestep[i], *x_prev[i], *xdot[i]); - } - _M->setZero(); _K->setZero(); _b->setZero(); _Jac->setZero(); _ode.preAssemble(t, dt, x_curr); - try - { - _ode.assembleWithJacobian(t, dt, x_new_timestep, xdot, process_id, *_M, - *_K, *_b, *_Jac); - } - catch (AssemblyException const&) - { - for (auto& v : xdot) - { - NumLib::GlobalVectorProvider::provider.releaseVector(*v); - } - throw; - } + _ode.assembleWithJacobian(t, dt, x_new_timestep, x_prev, process_id, *_M, + *_K, *_b, *_Jac); LinAlg::finalizeAssembly(*_M); LinAlg::finalizeAssembly(*_K); LinAlg::finalizeAssembly(*_b); MathLib::LinAlg::finalizeAssembly(*_Jac); - - for (auto& v : xdot) - { - NumLib::GlobalVectorProvider::provider.releaseVector(*v); - } } void TimeDiscretizedODESystem< @@ -128,15 +103,8 @@ void TimeDiscretizedODESystem< GlobalVector const& x_prev, GlobalVector& res) const { - // TODO Maybe the duplicate calculation of xdot here and in assembleJacobian - // can be optimized. However, that would make the interface a bit more - // fragile. - auto& xdot = NumLib::GlobalVectorProvider::provider.getVector(_xdot_id); - _time_disc.getXdot(x_new_timestep, x_prev, xdot); - - _mat_trans->computeResidual(*_M, *_K, *_b, x_new_timestep, xdot, res); - - NumLib::GlobalVectorProvider::provider.releaseVector(xdot); + double const dt = _time_disc.getCurrentTimeIncrement(); + _mat_trans->computeResidual(*_M, *_K, *_b, dt, x_new_timestep, x_prev, res); } void TimeDiscretizedODESystem< @@ -220,31 +188,17 @@ void TimeDiscretizedODESystem xdot(x_new_timestep.size()); - _xdot_ids.resize(x_new_timestep.size()); - - for (std::size_t i = 0; i < xdot.size(); i++) - { - xdot[i] = - &NumLib::GlobalVectorProvider::provider.getVector(_xdot_ids[i]); - _time_disc.getXdot(*x_new_timestep[i], *x_prev[i], *xdot[i]); - } _M->setZero(); _K->setZero(); _b->setZero(); _ode.preAssemble(t, dt, x_curr); - _ode.assemble(t, dt, x_new_timestep, xdot, process_id, *_M, *_K, *_b); + _ode.assemble(t, dt, x_new_timestep, x_prev, process_id, *_M, *_K, *_b); LinAlg::finalizeAssembly(*_M); LinAlg::finalizeAssembly(*_K); LinAlg::finalizeAssembly(*_b); - - for (auto& v : xdot) - { - NumLib::GlobalVectorProvider::provider.releaseVector(*v); - } } void TimeDiscretizedODESystem< diff --git a/NumLib/ODESolver/TimeDiscretizedODESystem.h b/NumLib/ODESolver/TimeDiscretizedODESystem.h index ac4a97290b4..eeed8a7ea18 100644 --- a/NumLib/ODESolver/TimeDiscretizedODESystem.h +++ b/NumLib/ODESolver/TimeDiscretizedODESystem.h @@ -153,10 +153,6 @@ class TimeDiscretizedODESystem _xdot_ids; }; /*! Time discretized first order implicit quasi-linear ODE; @@ -256,7 +252,6 @@ class TimeDiscretizedODESystem _xdot_ids; }; //! @} From 1744fc9472fc28f6af9ecad65fabf11ce965df3f Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 11 Jul 2023 23:52:52 +0200 Subject: [PATCH 02/47] [PL] Common functions. Rename x_dot to x_prev --- ProcessLib/AbstractJacobianAssembler.h | 4 +- ProcessLib/AnalyticalJacobianAssembler.cpp | 8 ++-- ProcessLib/AnalyticalJacobianAssembler.h | 4 +- .../ParallelVectorMatrixAssembler.cpp | 20 +++++----- .../Assembly/ParallelVectorMatrixAssembler.h | 2 +- ProcessLib/AssemblyMixin.h | 16 ++++---- .../CentralDifferencesJacobianAssembler.h | 2 +- .../CompareJacobiansJacobianAssembler.h | 2 +- .../ForwardDifferencesJacobianAssembler.h | 2 +- ProcessLib/LocalAssemblerInterface.cpp | 40 +++++++++---------- ProcessLib/LocalAssemblerInterface.h | 20 +++++----- ProcessLib/Process.cpp | 34 ++++++++-------- ProcessLib/Process.h | 30 +++++++------- ProcessLib/VectorMatrixAssembler.cpp | 28 ++++++------- ProcessLib/VectorMatrixAssembler.h | 7 ++-- 15 files changed, 110 insertions(+), 109 deletions(-) diff --git a/ProcessLib/AbstractJacobianAssembler.h b/ProcessLib/AbstractJacobianAssembler.h index d10ed2f4bc1..3fae9d17602 100644 --- a/ProcessLib/AbstractJacobianAssembler.h +++ b/ProcessLib/AbstractJacobianAssembler.h @@ -29,7 +29,7 @@ class AbstractJacobianAssembler virtual void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, @@ -40,7 +40,7 @@ class AbstractJacobianAssembler virtual void assembleWithJacobianForStaggeredScheme( LocalAssemblerInterface& /*local_assembler*/, double const /*t*/, double const /*dt*/, Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_xdot*/, int const /*process_id*/, + Eigen::VectorXd const& /*local_x_prev*/, int const /*process_id*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/, diff --git a/ProcessLib/AnalyticalJacobianAssembler.cpp b/ProcessLib/AnalyticalJacobianAssembler.cpp index 61a1f91d12a..843b7b010a9 100644 --- a/ProcessLib/AnalyticalJacobianAssembler.cpp +++ b/ProcessLib/AnalyticalJacobianAssembler.cpp @@ -17,24 +17,24 @@ namespace ProcessLib { void AnalyticalJacobianAssembler::assembleWithJacobian( LocalAssemblerInterface& local_assembler, double const t, double const dt, - std::vector const& local_x, std::vector const& local_xdot, + std::vector const& local_x, std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) { - local_assembler.assembleWithJacobian(t, dt, local_x, local_xdot, + local_assembler.assembleWithJacobian(t, dt, local_x, local_x_prev, local_M_data, local_K_data, local_b_data, local_Jac_data); } void AnalyticalJacobianAssembler::assembleWithJacobianForStaggeredScheme( LocalAssemblerInterface& local_assembler, double const t, double const dt, - Eigen::VectorXd const& local_x, Eigen::VectorXd const& local_xdot, + Eigen::VectorXd const& local_x, Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) { local_assembler.assembleWithJacobianForStaggeredScheme( - t, dt, local_x, local_xdot, process_id, local_M_data, local_K_data, + t, dt, local_x, local_x_prev, process_id, local_M_data, local_K_data, local_b_data, local_Jac_data); } diff --git a/ProcessLib/AnalyticalJacobianAssembler.h b/ProcessLib/AnalyticalJacobianAssembler.h index b0204790f77..a7ca44b46fd 100644 --- a/ProcessLib/AnalyticalJacobianAssembler.h +++ b/ProcessLib/AnalyticalJacobianAssembler.h @@ -34,7 +34,7 @@ class AnalyticalJacobianAssembler final : public AbstractJacobianAssembler void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, @@ -43,7 +43,7 @@ class AnalyticalJacobianAssembler final : public AbstractJacobianAssembler void assembleWithJacobianForStaggeredScheme( LocalAssemblerInterface& local_assembler, double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) override; diff --git a/ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp b/ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp index ce7cf3cac52..1b2567275ef 100644 --- a/ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp +++ b/ProcessLib/Assembly/ParallelVectorMatrixAssembler.cpp @@ -26,7 +26,7 @@ void assembleWithJacobianOneElement( const std::size_t mesh_item_id, ProcessLib::LocalAssemblerInterface& local_assembler, const NumLib::LocalToGlobalIndexMap& dof_table, const double t, - const double dt, const GlobalVector& x, const GlobalVector& xdot, + const double dt, const GlobalVector& x, const GlobalVector& x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data, std::vector& indices, @@ -41,10 +41,10 @@ void assembleWithJacobianOneElement( local_Jac_data.clear(); auto const local_x = x.get(indices); - auto const local_xdot = xdot.get(indices); + auto const local_x_prev = x_prev.get(indices); jacobian_assembler.assembleWithJacobian( - local_assembler, t, dt, local_x, local_xdot, local_M_data, local_K_data, - local_b_data, local_Jac_data); + local_assembler, t, dt, local_x, local_x_prev, local_M_data, + local_K_data, local_b_data, local_Jac_data); if (local_Jac_data.empty()) { @@ -121,7 +121,7 @@ void ParallelVectorMatrixAssembler::assembleWithJacobian( std::vector> const& dof_tables, const double t, double const dt, std::vector const& xs, - std::vector const& xdots, int const process_id, + std::vector const& x_prevs, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { // checks ////////////////////////////////////////////////////////////////// @@ -142,11 +142,11 @@ void ParallelVectorMatrixAssembler::assembleWithJacobian( } auto const& x = *xs.front(); - if (xdots.size() != 1) + if (x_prevs.size() != 1) { - OGS_FATAL("More than 1 xdot vector"); + OGS_FATAL("More than 1 x_prev vector"); } - auto const& xdot = *xdots.front(); + auto const& x_prev = *x_prevs.front(); // algorithm /////////////////////////////////////////////////////////////// @@ -204,7 +204,7 @@ void ParallelVectorMatrixAssembler::assembleWithJacobian( try { assembleWithJacobianOneElement( - element_id, loc_asm, dof_table, t, dt, x, xdot, + element_id, loc_asm, dof_table, t, dt, x, x_prev, local_M_data, local_K_data, local_b_data, local_Jac_data, indices, *jac_asm, cache); } @@ -242,7 +242,7 @@ void ParallelVectorMatrixAssembler::assembleWithJacobian( try { assembleWithJacobianOneElement( - element_id, loc_asm, dof_table, t, dt, x, xdot, + element_id, loc_asm, dof_table, t, dt, x, x_prev, local_M_data, local_K_data, local_b_data, local_Jac_data, indices, *jac_asm, cache); } diff --git a/ProcessLib/Assembly/ParallelVectorMatrixAssembler.h b/ProcessLib/Assembly/ParallelVectorMatrixAssembler.h index 0f87c1f55c5..bd89275a65c 100644 --- a/ProcessLib/Assembly/ParallelVectorMatrixAssembler.h +++ b/ProcessLib/Assembly/ParallelVectorMatrixAssembler.h @@ -31,7 +31,7 @@ class ParallelVectorMatrixAssembler std::reference_wrapper> const& dof_tables, const double t, double const dt, std::vector const& xs, - std::vector const& xdots, int const process_id, + std::vector const& x_prevs, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac); private: diff --git a/ProcessLib/AssemblyMixin.h b/ProcessLib/AssemblyMixin.h index fc17e2ba97d..705acc3dd41 100644 --- a/ProcessLib/AssemblyMixin.h +++ b/ProcessLib/AssemblyMixin.h @@ -144,7 +144,7 @@ class AssemblyMixin : private AssemblyMixinBase // cppcheck-suppress functionStatic void assemble(const double /*t*/, double const /*dt*/, std::vector const& /*x*/, - std::vector const& /*xdot*/, + std::vector const& /*x_prev*/, int const /*process_id*/, GlobalMatrix& /*M*/, GlobalMatrix& /*K*/, GlobalVector& /*b*/) { @@ -153,14 +153,14 @@ class AssemblyMixin : private AssemblyMixinBase process_id); assembleGeneric(&Assembly::ParallelVectorMatrixAssembler::assemble, t, - dt, x, xdot, process_id, M, K, b); + dt, x, x_prev, process_id, M, K, b); */ OGS_FATAL("Not yet implemented."); } void assembleWithJacobian(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) @@ -170,7 +170,7 @@ class AssemblyMixin : private AssemblyMixinBase assembleGeneric( &Assembly::ParallelVectorMatrixAssembler::assembleWithJacobian, t, - dt, x, xdot, process_id, M, K, b, Jac); + dt, x, x_prev, process_id, M, K, b, Jac); } private: @@ -185,7 +185,7 @@ class AssemblyMixin : private AssemblyMixinBase template void assembleGeneric(Method global_assembler_method, const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, Jac&... jac_or_not_jac) { @@ -206,7 +206,7 @@ class AssemblyMixin : private AssemblyMixinBase (pvma_.*global_assembler_method)( loc_asms, sad.active_element_ids, dof_tables, t, dt, x, - xdot, process_id, M, K, b_submesh, jac_or_not_jac...); + x_prev, process_id, M, K, b_submesh, jac_or_not_jac...); MathLib::LinAlg::axpy(b, 1.0, b_submesh); @@ -224,8 +224,8 @@ class AssemblyMixin : private AssemblyMixinBase derived().getProcessVariables(process_id)[0]; (pvma_.*global_assembler_method)( - loc_asms, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, - process_id, M, K, b, jac_or_not_jac...); + loc_asms, pv.getActiveElementIDs(), dof_tables, t, dt, x, + x_prev, process_id, M, K, b, jac_or_not_jac...); } AssemblyMixinBase::copyResiduumVectorsToBulkMesh( diff --git a/ProcessLib/CentralDifferencesJacobianAssembler.h b/ProcessLib/CentralDifferencesJacobianAssembler.h index 320abf69084..e7193658155 100644 --- a/ProcessLib/CentralDifferencesJacobianAssembler.h +++ b/ProcessLib/CentralDifferencesJacobianAssembler.h @@ -54,7 +54,7 @@ class CentralDifferencesJacobianAssembler final void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector const& local_x_data, - std::vector const& local_xdot_data, + std::vector const& local_x_prev_data, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, diff --git a/ProcessLib/CompareJacobiansJacobianAssembler.h b/ProcessLib/CompareJacobiansJacobianAssembler.h index 74b85599fa8..a86309582f5 100644 --- a/ProcessLib/CompareJacobiansJacobianAssembler.h +++ b/ProcessLib/CompareJacobiansJacobianAssembler.h @@ -55,7 +55,7 @@ class CompareJacobiansJacobianAssembler final : public AbstractJacobianAssembler void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, diff --git a/ProcessLib/ForwardDifferencesJacobianAssembler.h b/ProcessLib/ForwardDifferencesJacobianAssembler.h index c8e695702da..5eca026379b 100644 --- a/ProcessLib/ForwardDifferencesJacobianAssembler.h +++ b/ProcessLib/ForwardDifferencesJacobianAssembler.h @@ -46,7 +46,7 @@ class ForwardDifferencesJacobianAssembler final void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector const& local_x_data, - std::vector const& local_xdot_data, + std::vector const& local_x_prev_data, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, diff --git a/ProcessLib/LocalAssemblerInterface.cpp b/ProcessLib/LocalAssemblerInterface.cpp index 28e3a937e25..def554c2e3a 100644 --- a/ProcessLib/LocalAssemblerInterface.cpp +++ b/ProcessLib/LocalAssemblerInterface.cpp @@ -22,7 +22,7 @@ void LocalAssemblerInterface::assemble( double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/) @@ -33,7 +33,7 @@ void LocalAssemblerInterface::assemble( void LocalAssemblerInterface::assembleForStaggeredScheme( double const /*t*/, double const /*dt*/, Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_xdot*/, int const /*process_id*/, + Eigen::VectorXd const& /*local_x_prev*/, int const /*process_id*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/) @@ -46,7 +46,7 @@ void LocalAssemblerInterface::assembleForStaggeredScheme( void LocalAssemblerInterface::assembleWithJacobian( double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/, @@ -59,7 +59,7 @@ void LocalAssemblerInterface::assembleWithJacobian( void LocalAssemblerInterface::assembleWithJacobianForStaggeredScheme( double const /*t*/, double const /*dt*/, Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_xdot*/, int const /*process_id*/, + Eigen::VectorXd const& /*local_x_prev*/, int const /*process_id*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/, @@ -74,7 +74,7 @@ void LocalAssemblerInterface::computeSecondaryVariable( std::size_t const mesh_item_id, std::vector const& dof_tables, double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, int const process_id) + GlobalVector const& x_prev, int const process_id) { std::vector local_x_vec; @@ -90,13 +90,13 @@ void LocalAssemblerInterface::computeSecondaryVariable( } auto const local_x = MathLib::toVector(local_x_vec); - // Todo: A more decent way is to directly pass x_dots as done for x + // Todo: A more decent way is to directly pass x_prevs as done for x auto const indices = NumLib::getIndices(mesh_item_id, *dof_tables[process_id]); - auto const local_x_dot_vec = x_dot.get(indices); - auto const local_x_dot = MathLib::toVector(local_x_dot_vec); + auto const local_x_prev_vec = x_prev.get(indices); + auto const local_x_prev = MathLib::toVector(local_x_prev_vec); - computeSecondaryVariableConcrete(t, dt, local_x, local_x_dot); + computeSecondaryVariableConcrete(t, dt, local_x, local_x_prev); } void LocalAssemblerInterface::setInitialConditions( @@ -132,11 +132,11 @@ void LocalAssemblerInterface::postTimestep( std::size_t const mesh_item_id, std::vector const& dof_tables, std::vector const& x, - std::vector const& x_dot, double const t, double const dt, + std::vector const& x_prev, double const t, double const dt, bool const use_monolithic_scheme, int const process_id) { std::vector local_x_vec; - std::vector local_x_dot_vec; + std::vector local_x_prev_vec; auto const n_processes = x.size(); for (std::size_t process_id = 0; process_id < n_processes; ++process_id) @@ -148,29 +148,29 @@ void LocalAssemblerInterface::postTimestep( local_x_vec.insert(std::end(local_x_vec), std::begin(local_solution), std::end(local_solution)); - auto const local_solution_dot = x_dot[process_id]->get(indices); - local_x_dot_vec.insert(std::end(local_x_dot_vec), - std::begin(local_solution_dot), - std::end(local_solution_dot)); + auto const local_solution_prev = x_prev[process_id]->get(indices); + local_x_prev_vec.insert(std::end(local_x_prev_vec), + std::begin(local_solution_prev), + std::end(local_solution_prev)); } auto const local_x = MathLib::toVector(local_x_vec); - auto const local_x_dot = MathLib::toVector(local_x_dot_vec); + auto const local_x_prev = MathLib::toVector(local_x_prev_vec); - postTimestepConcrete(local_x, local_x_dot, t, dt, use_monolithic_scheme, + postTimestepConcrete(local_x, local_x_prev, t, dt, use_monolithic_scheme, process_id); } void LocalAssemblerInterface::postNonLinearSolver( std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const& dof_table, GlobalVector const& x, - GlobalVector const& xdot, double const t, double const dt, + GlobalVector const& x_prev, double const t, double const dt, bool const use_monolithic_scheme, int const process_id) { auto const indices = NumLib::getIndices(mesh_item_id, dof_table); auto const local_x = x.get(indices); - auto const local_xdot = xdot.get(indices); + auto const local_x_prev = x_prev.get(indices); - postNonLinearSolverConcrete(local_x, local_xdot, t, dt, + postNonLinearSolverConcrete(local_x, local_x_prev, t, dt, use_monolithic_scheme, process_id); } diff --git a/ProcessLib/LocalAssemblerInterface.h b/ProcessLib/LocalAssemblerInterface.h index 5073bbd7bb5..0034cecce20 100644 --- a/ProcessLib/LocalAssemblerInterface.h +++ b/ProcessLib/LocalAssemblerInterface.h @@ -49,14 +49,14 @@ class LocalAssemblerInterface virtual void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data); virtual void assembleForStaggeredScheme(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, @@ -64,7 +64,7 @@ class LocalAssemblerInterface virtual void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, @@ -72,7 +72,7 @@ class LocalAssemblerInterface virtual void assembleWithJacobianForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data); @@ -80,7 +80,7 @@ class LocalAssemblerInterface std::size_t const mesh_item_id, std::vector const& dof_tables, double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, int const process_id); + GlobalVector const& x_prev, int const process_id); virtual void preTimestep(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const& dof_table, @@ -91,13 +91,13 @@ class LocalAssemblerInterface std::size_t const mesh_item_id, std::vector const& dof_tables, std::vector const& x, - std::vector const& x_dot, double const t, + std::vector const& x_prev, double const t, double const dt, bool const use_monolithic_scheme, int const process_id); void postNonLinearSolver(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const& dof_table, - GlobalVector const& x, GlobalVector const& xdot, + GlobalVector const& x, GlobalVector const& x_prev, double const t, double const dt, bool const use_monolithic_scheme, int const process_id); @@ -137,7 +137,7 @@ class LocalAssemblerInterface } virtual void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) @@ -146,7 +146,7 @@ class LocalAssemblerInterface virtual void postNonLinearSolverConcrete( std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, double const /*t*/, + std::vector const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) { @@ -156,7 +156,7 @@ class LocalAssemblerInterface double const /*t*/, double const /*dt*/, Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/) + Eigen::VectorXd const& /*local_x_prev*/) { } diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp index 0319ed445af..e4b44bb6a94 100644 --- a/ProcessLib/Process.cpp +++ b/ProcessLib/Process.cpp @@ -211,18 +211,18 @@ void Process::preAssemble(const double t, double const dt, void Process::assemble(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { - assert(x.size() == xdot.size()); + assert(x.size() == x_prev.size()); for (std::size_t i = 0; i < x.size(); i++) { MathLib::LinAlg::setLocalAccessibleVector(*x[i]); - MathLib::LinAlg::setLocalAccessibleVector(*xdot[i]); + MathLib::LinAlg::setLocalAccessibleVector(*x_prev[i]); } - assembleConcreteProcess(t, dt, x, xdot, process_id, M, K, b); + assembleConcreteProcess(t, dt, x, x_prev, process_id, M, K, b); // the last argument is for the jacobian, nullptr is for a unused jacobian _boundary_conditions[process_id].applyNaturalBC(t, x, process_id, K, b, @@ -235,19 +235,19 @@ void Process::assemble(const double t, double const dt, void Process::assembleWithJacobian(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { - assert(x.size() == xdot.size()); + assert(x.size() == x_prev.size()); for (std::size_t i = 0; i < x.size(); i++) { MathLib::LinAlg::setLocalAccessibleVector(*x[i]); - MathLib::LinAlg::setLocalAccessibleVector(*xdot[i]); + MathLib::LinAlg::setLocalAccessibleVector(*x_prev[i]); } - assembleWithJacobianConcreteProcess(t, dt, x, xdot, process_id, M, K, b, + assembleWithJacobianConcreteProcess(t, dt, x, x_prev, process_id, M, K, b, Jac); // TODO: apply BCs to Jacobian. @@ -395,7 +395,7 @@ void Process::preTimestep(std::vector const& x, const double t, } void Process::postTimestep(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double delta_t, int const process_id) { @@ -403,36 +403,36 @@ void Process::postTimestep(std::vector const& x, { MathLib::LinAlg::setLocalAccessibleVector(*solution); } - for (auto* const solution : x_dot) + for (auto* const solution : x_prev) { MathLib::LinAlg::setLocalAccessibleVector(*solution); } - postTimestepConcreteProcess(x, x_dot, t, delta_t, process_id); + postTimestepConcreteProcess(x, x_prev, t, delta_t, process_id); _boundary_conditions[process_id].postTimestep(t, x, process_id); } void Process::postNonLinearSolver(GlobalVector const& x, - GlobalVector const& xdot, const double t, + GlobalVector const& x_prev, const double t, double const dt, int const process_id) { MathLib::LinAlg::setLocalAccessibleVector(x); - MathLib::LinAlg::setLocalAccessibleVector(xdot); - postNonLinearSolverConcreteProcess(x, xdot, t, dt, process_id); + MathLib::LinAlg::setLocalAccessibleVector(x_prev); + postNonLinearSolverConcreteProcess(x, x_prev, t, dt, process_id); } void Process::computeSecondaryVariable(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) { for (auto const* solution : x) MathLib::LinAlg::setLocalAccessibleVector(*solution); - MathLib::LinAlg::setLocalAccessibleVector(x_dot); + MathLib::LinAlg::setLocalAccessibleVector(x_prev); - computeSecondaryVariableConcrete(t, dt, x, x_dot, process_id); + computeSecondaryVariableConcrete(t, dt, x, x_prev, process_id); } void Process::preIteration(const unsigned iter, const GlobalVector& x) diff --git a/ProcessLib/Process.h b/ProcessLib/Process.h index 33984634e69..f02a2cc6a70 100644 --- a/ProcessLib/Process.h +++ b/ProcessLib/Process.h @@ -67,12 +67,12 @@ class Process /// Postprocessing after a complete timestep. void postTimestep(std::vector const& x, - std::vector const& x_dot, const double t, + std::vector const& x_prev, const double t, const double delta_t, int const process_id); /// Calculates secondary variables, e.g. stress and strain for deformation /// analysis, only after nonlinear solver being successfully conducted. - void postNonLinearSolver(GlobalVector const& x, GlobalVector const& xdot, + void postNonLinearSolver(GlobalVector const& x, GlobalVector const& x_prev, const double t, double const dt, int const process_id); @@ -82,7 +82,7 @@ class Process void computeSecondaryVariable(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id); NumLib::IterationResult postIteration(GlobalVector const& x) final; @@ -127,12 +127,13 @@ class Process void assemble(const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, - GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) final; + std::vector const& x_prev, + int const process_id, GlobalMatrix& M, GlobalMatrix& K, + GlobalVector& b) final; void assembleWithJacobian(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) final; @@ -230,15 +231,14 @@ class Process { } - virtual void assembleConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b) = 0; + virtual void assembleConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) = 0; virtual void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) = 0; @@ -252,7 +252,7 @@ class Process virtual void postTimestepConcreteProcess( std::vector const& /*x*/, - std::vector const& /*x_dot*/, + std::vector const& /*x_prev*/, const double /*t*/, const double /*dt*/, int const /*process_id*/) @@ -260,7 +260,7 @@ class Process } virtual void postNonLinearSolverConcreteProcess( - GlobalVector const& /*x*/, GlobalVector const& /*xdot*/, + GlobalVector const& /*x*/, GlobalVector const& /*x_prev*/, const double /*t*/, double const /*dt*/, int const /*process_id*/) { } @@ -274,7 +274,7 @@ class Process double const /*t*/, double const /*dt*/, std::vector const& /*x*/, - GlobalVector const& /*x_dot*/, + GlobalVector const& /*x_prev*/, int const /*process_id*/) { } diff --git a/ProcessLib/VectorMatrixAssembler.cpp b/ProcessLib/VectorMatrixAssembler.cpp index 2998ba40c98..ea0fc1f0deb 100644 --- a/ProcessLib/VectorMatrixAssembler.cpp +++ b/ProcessLib/VectorMatrixAssembler.cpp @@ -42,7 +42,7 @@ void VectorMatrixAssembler::assemble( std::vector> const& dof_tables, const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { std::vector> indices_of_processes; @@ -62,8 +62,8 @@ void VectorMatrixAssembler::assemble( if (number_of_processes == 1) { auto const local_x = x[process_id]->get(indices); - auto const local_xdot = xdot[process_id]->get(indices); - local_assembler.assemble(t, dt, local_x, local_xdot, _local_M_data, + auto const local_x_prev = x_prev[process_id]->get(indices); + local_assembler.assemble(t, dt, local_x, local_x_prev, _local_M_data, _local_K_data, _local_b_data); } else // Staggered scheme @@ -72,12 +72,12 @@ void VectorMatrixAssembler::assemble( getCoupledLocalSolutions(x, indices_of_processes); auto const local_x = MathLib::toVector(local_coupled_xs); - auto local_coupled_xdots = - getCoupledLocalSolutions(xdot, indices_of_processes); - auto const local_xdot = MathLib::toVector(local_coupled_xdots); + auto local_coupled_x_prevs = + getCoupledLocalSolutions(x_prev, indices_of_processes); + auto const local_x_prev = MathLib::toVector(local_coupled_x_prevs); local_assembler.assembleForStaggeredScheme( - t, dt, local_x, local_xdot, process_id, _local_M_data, + t, dt, local_x, local_x_prev, process_id, _local_M_data, _local_K_data, _local_b_data); } @@ -110,7 +110,7 @@ void VectorMatrixAssembler::assembleWithJacobian( std::vector> const& dof_tables, const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { std::vector> indices_of_processes; @@ -132,9 +132,9 @@ void VectorMatrixAssembler::assembleWithJacobian( if (number_of_processes == 1) { auto const local_x = x[process_id]->get(indices); - auto const local_xdot = xdot[process_id]->get(indices); + auto const local_x_prev = x_prev[process_id]->get(indices); _jacobian_assembler.assembleWithJacobian( - local_assembler, t, dt, local_x, local_xdot, _local_M_data, + local_assembler, t, dt, local_x, local_x_prev, _local_M_data, _local_K_data, _local_b_data, _local_Jac_data); } else // Staggered scheme @@ -143,12 +143,12 @@ void VectorMatrixAssembler::assembleWithJacobian( getCoupledLocalSolutions(x, indices_of_processes); auto const local_x = MathLib::toVector(local_coupled_xs); - auto local_coupled_xdots = - getCoupledLocalSolutions(xdot, indices_of_processes); - auto const local_xdot = MathLib::toVector(local_coupled_xdots); + auto local_coupled_x_prevs = + getCoupledLocalSolutions(x_prev, indices_of_processes); + auto const local_x_prev = MathLib::toVector(local_coupled_x_prevs); _jacobian_assembler.assembleWithJacobianForStaggeredScheme( - local_assembler, t, dt, local_x, local_xdot, process_id, + local_assembler, t, dt, local_x, local_x_prev, process_id, _local_M_data, _local_K_data, _local_b_data, _local_Jac_data); } diff --git a/ProcessLib/VectorMatrixAssembler.h b/ProcessLib/VectorMatrixAssembler.h index e6a871a06da..23cc368a6d0 100644 --- a/ProcessLib/VectorMatrixAssembler.h +++ b/ProcessLib/VectorMatrixAssembler.h @@ -49,8 +49,9 @@ class VectorMatrixAssembler final NumLib::LocalToGlobalIndexMap>> const& dof_tables, double const t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, - GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b); + std::vector const& x_prev, + int const process_id, GlobalMatrix& M, GlobalMatrix& K, + GlobalVector& b); //! Assembles \c M, \c K, \c b, and the Jacobian \c Jac of the residual. //! \note The Jacobian must be assembled. @@ -61,7 +62,7 @@ class VectorMatrixAssembler final std::reference_wrapper> const& dof_tables, const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac); private: From b3078158da205847af93d13260a055d5fd1d47f5 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 12:45:34 +0200 Subject: [PATCH 03/47] [PL] Rewrite jacobians to use x_prev --- .../CentralDifferencesJacobianAssembler.cpp | 27 +++++++-------- .../CentralDifferencesJacobianAssembler.h | 1 - .../CompareJacobiansJacobianAssembler.cpp | 18 +++++----- .../ForwardDifferencesJacobianAssembler.cpp | 33 ++++++++----------- .../ForwardDifferencesJacobianAssembler.h | 1 - 5 files changed, 34 insertions(+), 46 deletions(-) diff --git a/ProcessLib/CentralDifferencesJacobianAssembler.cpp b/ProcessLib/CentralDifferencesJacobianAssembler.cpp index 4796bf5d2dc..af586bbd41b 100644 --- a/ProcessLib/CentralDifferencesJacobianAssembler.cpp +++ b/ProcessLib/CentralDifferencesJacobianAssembler.cpp @@ -30,7 +30,7 @@ CentralDifferencesJacobianAssembler::CentralDifferencesJacobianAssembler( void CentralDifferencesJacobianAssembler::assembleWithJacobian( LocalAssemblerInterface& local_assembler, const double t, double const dt, const std::vector& local_x_data, - const std::vector& local_xdot_data, + const std::vector& local_x_prev_data, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) { @@ -49,13 +49,13 @@ void CentralDifferencesJacobianAssembler::assembleWithJacobian( auto const local_x = MathLib::toVector(local_x_data, num_r_c); - auto const local_xdot = - MathLib::toVector(local_xdot_data, num_r_c); + auto const local_x_prev = + MathLib::toVector(local_x_prev_data, num_r_c); + Eigen::VectorXd const local_xdot = (local_x - local_x_prev) / dt; auto local_Jac = MathLib::createZeroedMatrix(local_Jac_data, num_r_c, num_r_c); _local_x_perturbed_data = local_x_data; - _local_xdot_perturbed_data = local_xdot_data; auto const num_dofs_per_component = local_x_data.size() / _absolute_epsilons.size(); @@ -75,19 +75,16 @@ void CentralDifferencesJacobianAssembler::assembleWithJacobian( auto const eps = _absolute_epsilons[component]; _local_x_perturbed_data[i] += eps; - _local_xdot_perturbed_data[i] = local_xdot_data[i] + eps / dt; local_assembler.assemble(t, dt, _local_x_perturbed_data, - _local_xdot_perturbed_data, local_M_data, - local_K_data, local_b_data); + local_x_prev_data, local_M_data, local_K_data, + local_b_data); _local_x_perturbed_data[i] = local_x_data[i] - eps; - _local_xdot_perturbed_data[i] = local_xdot_data[i] - eps / dt; local_assembler.assemble(t, dt, _local_x_perturbed_data, - _local_xdot_perturbed_data, _local_M_data, + local_x_prev_data, _local_M_data, _local_K_data, _local_b_data); _local_x_perturbed_data[i] = local_x_data[i]; - _local_xdot_perturbed_data[i] = local_xdot_data[i]; if (!local_M_data.empty()) { @@ -128,8 +125,8 @@ void CentralDifferencesJacobianAssembler::assembleWithJacobian( } // Assemble with unperturbed local x. - local_assembler.assemble(t, dt, local_x_data, local_xdot_data, local_M_data, - local_K_data, local_b_data); + local_assembler.assemble(t, dt, local_x_data, local_x_prev_data, + local_M_data, local_K_data, local_b_data); // Compute remaining terms of the Jacobian. if (!local_M_data.empty()) @@ -159,15 +156,13 @@ void CentralDifferencesJacobianAssembler::assembleWithJacobian( if (!local_M_data.empty()) { auto M = MathLib::toMatrix(local_M_data, num_r_c, num_r_c); - auto x_dot = MathLib::toVector(local_xdot_data); - b -= M * x_dot; + b -= M * local_xdot; local_M_data.clear(); } if (!local_K_data.empty()) { auto K = MathLib::toMatrix(local_K_data, num_r_c, num_r_c); - auto x = MathLib::toVector(local_x_data); - b -= K * x; + b -= K * local_x; local_K_data.clear(); } } diff --git a/ProcessLib/CentralDifferencesJacobianAssembler.h b/ProcessLib/CentralDifferencesJacobianAssembler.h index e7193658155..e6c4fc37693 100644 --- a/ProcessLib/CentralDifferencesJacobianAssembler.h +++ b/ProcessLib/CentralDifferencesJacobianAssembler.h @@ -71,7 +71,6 @@ class CentralDifferencesJacobianAssembler final std::vector _local_K_data; std::vector _local_b_data; std::vector _local_x_perturbed_data; - std::vector _local_xdot_perturbed_data; }; std::unique_ptr diff --git a/ProcessLib/CompareJacobiansJacobianAssembler.cpp b/ProcessLib/CompareJacobiansJacobianAssembler.cpp index 0c8388b9dba..a6f58bcf0f4 100644 --- a/ProcessLib/CompareJacobiansJacobianAssembler.cpp +++ b/ProcessLib/CompareJacobiansJacobianAssembler.cpp @@ -126,7 +126,7 @@ namespace ProcessLib { void CompareJacobiansJacobianAssembler::assembleWithJacobian( LocalAssemblerInterface& local_assembler, double const t, double const dt, - std::vector const& local_x, std::vector const& local_xdot, + std::vector const& local_x, std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) { @@ -147,7 +147,7 @@ void CompareJacobiansJacobianAssembler::assembleWithJacobian( // First assembly -- the one whose results will be added to the global // equation system finally. - _asm1->assembleWithJacobian(local_assembler, t, dt, local_x, local_xdot, + _asm1->assembleWithJacobian(local_assembler, t, dt, local_x, local_x_prev, local_M_data, local_K_data, local_b_data, local_Jac_data); @@ -161,7 +161,7 @@ void CompareJacobiansJacobianAssembler::assembleWithJacobian( std::vector local_Jac_data2; // Second assembly -- used for checking only. - _asm2->assembleWithJacobian(local_assembler, t, dt, local_x, local_xdot, + _asm2->assembleWithJacobian(local_assembler, t, dt, local_x, local_x_prev, local_M_data2, local_K_data2, local_b_data2, local_Jac_data2); @@ -247,13 +247,15 @@ void CompareJacobiansJacobianAssembler::assembleWithJacobian( check_equality(local_b1, local_b2); Eigen::VectorXd res1 = Eigen::VectorXd::Zero(num_dof); + auto const x = MathLib::toVector(local_x); + auto const x_dot = ((x - MathLib::toVector(local_x_prev)) / dt).eval(); if (local_M1.size() != 0) { - res1.noalias() += local_M1 * MathLib::toVector(local_xdot); + res1.noalias() += local_M1 * x_dot; } if (local_K1.size() != 0) { - res1.noalias() += local_K1 * MathLib::toVector(local_x); + res1.noalias() += local_K1 * x; } if (local_b1.size() != 0) { @@ -263,11 +265,11 @@ void CompareJacobiansJacobianAssembler::assembleWithJacobian( Eigen::VectorXd res2 = Eigen::VectorXd::Zero(num_dof); if (local_M2.size() != 0) { - res2.noalias() += local_M2 * MathLib::toVector(local_xdot); + res2.noalias() += local_M2 * x_dot; } if (local_K2.size() != 0) { - res2.noalias() += local_K2 * MathLib::toVector(local_x); + res2.noalias() += local_K2 * x; } if (local_b2.size() != 0) { @@ -321,7 +323,7 @@ void CompareJacobiansJacobianAssembler::assembleWithJacobian( _log_file << '\n'; dump_py(_log_file, "local_x", local_x); - dump_py(_log_file, "local_x_dot", local_xdot); + dump_py(_log_file, "local_x_prev", local_x_prev); dump_py(_log_file, "dt", dt); _log_file << '\n'; diff --git a/ProcessLib/ForwardDifferencesJacobianAssembler.cpp b/ProcessLib/ForwardDifferencesJacobianAssembler.cpp index 2a22c064454..20a4ad6ec86 100644 --- a/ProcessLib/ForwardDifferencesJacobianAssembler.cpp +++ b/ProcessLib/ForwardDifferencesJacobianAssembler.cpp @@ -28,7 +28,7 @@ ForwardDifferencesJacobianAssembler::ForwardDifferencesJacobianAssembler( void ForwardDifferencesJacobianAssembler::assembleWithJacobian( LocalAssemblerInterface& local_assembler, const double t, double const dt, const std::vector& local_x_data, - const std::vector& local_xdot_data, + const std::vector& local_x_prev_data, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) { @@ -45,10 +45,9 @@ void ForwardDifferencesJacobianAssembler::assembleWithJacobian( auto const num_r_c = static_cast(local_x_data.size()); - auto const local_x = - MathLib::toVector(local_x_data, num_r_c); - auto const local_xdot = - MathLib::toVector(local_xdot_data, num_r_c); + auto const x = MathLib::toVector(local_x_data, num_r_c); + auto const x_prev = + MathLib::toVector(local_x_prev_data, num_r_c); auto local_Jac = MathLib::createZeroedMatrix(local_Jac_data, num_r_c, num_r_c); @@ -58,8 +57,8 @@ void ForwardDifferencesJacobianAssembler::assembleWithJacobian( // Assemble with unperturbed local x to get M0, K0, and b0 used in the // finite differences below. - local_assembler.assemble(t, dt, local_x_data, local_xdot_data, local_M_data, - local_K_data, local_b_data); + local_assembler.assemble(t, dt, local_x_data, local_x_prev_data, + local_M_data, local_K_data, local_b_data); // Residual res := M xdot + K x - b // Computing Jac := dres/dx @@ -76,13 +75,8 @@ void ForwardDifferencesJacobianAssembler::assembleWithJacobian( auto const x_p = MathLib::toVector( _local_x_perturbed_data, num_r_c); - _local_xdot_perturbed_data = local_xdot_data; - _local_xdot_perturbed_data[i] = local_xdot_data[i] + eps / dt; - auto const xdot_p = MathLib::toVector( - _local_xdot_perturbed_data, num_r_c); - local_assembler.assemble(t, dt, _local_x_perturbed_data, - _local_xdot_perturbed_data, _local_M_data, + local_x_prev_data, _local_M_data, _local_K_data, _local_b_data); if (!local_M_data.empty() && !_local_M_data.empty()) @@ -92,7 +86,8 @@ void ForwardDifferencesJacobianAssembler::assembleWithJacobian( auto const local_M_p = MathLib::toMatrix(_local_M_data, num_r_c, num_r_c); local_Jac.col(i).noalias() += - (local_M_p * xdot_p - local_M_0 * local_xdot) / eps; + (local_M_p * (x_p - x_prev) - local_M_0 * (x - x_prev)) / + (dt * eps); _local_M_data.clear(); } if (!local_K_data.empty() && !_local_K_data.empty()) @@ -102,7 +97,7 @@ void ForwardDifferencesJacobianAssembler::assembleWithJacobian( auto const local_K_p = MathLib::toMatrix(_local_K_data, num_r_c, num_r_c); local_Jac.col(i).noalias() += - (local_K_p * x_p - local_K_0 * local_x) / eps; + (local_K_p * x_p - local_K_0 * x) / eps; _local_K_data.clear(); } if (!local_b_data.empty() && !_local_b_data.empty()) @@ -121,8 +116,8 @@ void ForwardDifferencesJacobianAssembler::assembleWithJacobian( local_b_data.clear(); // Assemble with unperturbed local x to keep the internal assembler state // for next iteration or time step. - local_assembler.assemble(t, dt, local_x_data, local_xdot_data, local_M_data, - local_K_data, local_b_data); + local_assembler.assemble(t, dt, local_x_data, local_x_prev_data, + local_M_data, local_K_data, local_b_data); // Move the M and K contributions to the residuum for evaluation of nodal // forces, flow rates, and the like. Cleaning up the M's and K's storage so @@ -140,14 +135,12 @@ void ForwardDifferencesJacobianAssembler::assembleWithJacobian( if (!local_M_data.empty()) { auto M = MathLib::toMatrix(local_M_data, num_r_c, num_r_c); - auto x_dot = MathLib::toVector(local_xdot_data); - b -= M * x_dot; + b -= M * (x - x_prev) / dt; local_M_data.clear(); } if (!local_K_data.empty()) { auto K = MathLib::toMatrix(local_K_data, num_r_c, num_r_c); - auto x = MathLib::toVector(local_x_data); b -= K * x; local_K_data.clear(); } diff --git a/ProcessLib/ForwardDifferencesJacobianAssembler.h b/ProcessLib/ForwardDifferencesJacobianAssembler.h index 5eca026379b..5d48214622a 100644 --- a/ProcessLib/ForwardDifferencesJacobianAssembler.h +++ b/ProcessLib/ForwardDifferencesJacobianAssembler.h @@ -63,7 +63,6 @@ class ForwardDifferencesJacobianAssembler final std::vector _local_K_data; std::vector _local_b_data; std::vector _local_x_perturbed_data; - std::vector _local_xdot_perturbed_data; }; } // namespace ProcessLib From 6af09cc94059d28316da11737d5a61c6822fdc94 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 12 Jul 2023 21:54:02 +0200 Subject: [PATCH 04/47] [PL] Rewrite computeResiduum for x_prev --- ProcessLib/Utils/ComputeResiduum.cpp | 18 +++++++++++------- ProcessLib/Utils/ComputeResiduum.h | 6 +++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ProcessLib/Utils/ComputeResiduum.cpp b/ProcessLib/Utils/ComputeResiduum.cpp index 76d04020439..79b2d5b4a67 100644 --- a/ProcessLib/Utils/ComputeResiduum.cpp +++ b/ProcessLib/Utils/ComputeResiduum.cpp @@ -13,16 +13,20 @@ namespace ProcessLib { -GlobalVector computeResiduum(GlobalVector const& x, GlobalVector const& xdot, - GlobalMatrix const& M, GlobalMatrix const& K, - GlobalVector const& b) +GlobalVector computeResiduum(double const dt, GlobalVector const& x, + GlobalVector const& x_prev, GlobalMatrix const& M, + GlobalMatrix const& K, GlobalVector const& b) { using namespace MathLib::LinAlg; GlobalVector residuum; - matMult(M, xdot, residuum); - matMultAdd(K, x, residuum, residuum); - axpy(residuum, -1, b); - scale(residuum, -1); + GlobalVector x_dot; + copy(x, x_dot); // tmp = x + axpy(x_dot, -1., x_prev); // tmp = x - x_prev + scale(x_dot, 1. / dt); // tmp = (x - x_prev)/dt + matMult(M, x_dot, residuum); // r = M*x_dot + matMultAdd(K, x, residuum, residuum); // r = M*x_dot + K*x + axpy(residuum, -1., b); // r = M*x_dot + K*x - b + scale(residuum, -1.); // r = -r return residuum; } } // namespace ProcessLib diff --git a/ProcessLib/Utils/ComputeResiduum.h b/ProcessLib/Utils/ComputeResiduum.h index 07612699b16..483466da0b5 100644 --- a/ProcessLib/Utils/ComputeResiduum.h +++ b/ProcessLib/Utils/ComputeResiduum.h @@ -15,8 +15,8 @@ namespace ProcessLib { /// Computes the residuum r = -M*x_dot - K*x + b. Negation for consistency with /// the Newton scheme. -GlobalVector computeResiduum(GlobalVector const& x, GlobalVector const& xdot, - GlobalMatrix const& M, GlobalMatrix const& K, - GlobalVector const& b); +GlobalVector computeResiduum(double const dt, GlobalVector const& x, + GlobalVector const& x_prev, GlobalMatrix const& M, + GlobalMatrix const& K, GlobalVector const& b); } // namespace ProcessLib From 060924922342deb77ba321cdb87cc385f08ed6ee Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 11 Jul 2023 23:53:38 +0200 Subject: [PATCH 05/47] [PL] TimeLoop; remove x_dot and its computation Pass x_prev to all solve, computeResiduum, etc. functions. --- ProcessLib/TimeLoop.cpp | 86 +++++++++-------------------------------- ProcessLib/TimeLoop.h | 5 --- 2 files changed, 18 insertions(+), 73 deletions(-) diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp index 779ef5f51ae..28633f000de 100644 --- a/ProcessLib/TimeLoop.cpp +++ b/ProcessLib/TimeLoop.cpp @@ -59,29 +59,8 @@ void postTimestepForAllProcesses( double const t, double const dt, std::vector> const& per_process_data, std::vector const& process_solutions, - std::vector const& process_solutions_prev, - std::vector& xdot_vector_ids) + std::vector const& process_solutions_prev) { - std::vector x_dots; - x_dots.reserve(per_process_data.size()); - xdot_vector_ids.resize(per_process_data.size()); - - std::size_t cnt = 0; - for (auto& process_data : per_process_data) - { - auto const process_id = process_data->process_id; - auto const& ode_sys = *process_data->tdisc_ode_sys; - auto const& time_discretization = *process_data->time_disc; - - x_dots.emplace_back(&NumLib::GlobalVectorProvider::provider.getVector( - ode_sys.getMatrixSpecifications(process_id), xdot_vector_ids[cnt])); - cnt++; - - time_discretization.getXdot(*process_solutions[process_id], - *process_solutions_prev[process_id], - *x_dots[process_id]); - } - // All _per_process_data share the first process. bool const is_staggered_coupling = !isMonolithicProcess(*per_process_data[0]); @@ -97,14 +76,11 @@ void postTimestepForAllProcesses( process_solutions); pcs.setCoupledSolutionsForStaggeredScheme(&coupled_solutions); } - auto& x_dot = *x_dots[process_id]; - pcs.computeSecondaryVariable(t, dt, process_solutions, x_dot, + pcs.computeSecondaryVariable(t, dt, process_solutions, + *process_solutions_prev[process_id], process_id); - pcs.postTimestep(process_solutions, x_dots, t, dt, process_id); - } - for (auto& x_dot : x_dots) - { - NumLib::GlobalVectorProvider::provider.releaseVector(*x_dot); + pcs.postTimestep(process_solutions, process_solutions_prev, t, dt, + process_id); } } @@ -222,13 +198,11 @@ void calculateNonEquilibriumInitialResiduum( NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess( std::vector& x, std::vector const& x_prev, std::size_t const timestep, double const t, double const delta_t, - ProcessData const& process_data, std::vector const& outputs, - std::size_t& xdot_id) + ProcessData const& process_data, std::vector const& outputs) { auto& process = process_data.process; int const process_id = process_data.process_id; auto& time_disc = *process_data.time_disc; - auto& ode_sys = *process_data.tdisc_ode_sys; auto& nonlinear_solver = process_data.nonlinear_solver; setEquationSystem(process_data); @@ -258,13 +232,8 @@ NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess( return nonlinear_solver_status; } - GlobalVector& x_dot = NumLib::GlobalVectorProvider::provider.getVector( - ode_sys.getMatrixSpecifications(process_id), xdot_id); - - time_disc.getXdot(*x[process_id], *x_prev[process_id], x_dot); - - process.postNonLinearSolver(*x[process_id], x_dot, t, delta_t, process_id); - NumLib::GlobalVectorProvider::provider.releaseVector(x_dot); + process.postNonLinearSolver(*x[process_id], *x_prev[process_id], t, delta_t, + process_id); return nonlinear_solver_status; } @@ -655,8 +624,8 @@ bool TimeLoop::doNonlinearIteration(double const t, double const dt, if (nonlinear_solver_status.error_norms_met) { postTimestepForAllProcesses(t, dt, _per_process_data, - _process_solutions, _process_solutions_prev, - _xdot_vector_ids); + _process_solutions, + _process_solutions_prev); } return nonlinear_solver_status.error_norms_met; } @@ -665,13 +634,13 @@ static NumLib::NonlinearSolverStatus solveMonolithicProcess( const double t, const double dt, const std::size_t timestep_id, ProcessData const& process_data, std::vector& x, std::vector const& x_prev, - std::vector const& outputs, std::size_t& xdot_id) + std::vector const& outputs) { BaseLib::RunTime time_timestep_process; time_timestep_process.start(); auto const nonlinear_solver_status = solveOneTimeStepOneProcess( - x, x_prev, timestep_id, t, dt, process_data, outputs, xdot_id); + x, x_prev, timestep_id, t, dt, process_data, outputs); INFO("[time] Solving process #{:d} took {:g} s in time step #{:d}", process_data.process_id, time_timestep_process.elapsed(), timestep_id); @@ -687,16 +656,12 @@ NumLib::NonlinearSolverStatus TimeLoop::solveUncoupledEquationSystems( { NumLib::NonlinearSolverStatus nonlinear_solver_status; - _xdot_vector_ids.resize(_per_process_data.size()); - std::size_t cnt = 0; - for (auto& process_data : _per_process_data) { auto const process_id = process_data->process_id; nonlinear_solver_status = solveMonolithicProcess( t, dt, timestep_id, *process_data, _process_solutions, - _process_solutions_prev, _outputs, _xdot_vector_ids[cnt]); - cnt++; + _process_solutions_prev, _outputs); process_data->nonlinear_solver_status = nonlinear_solver_status; if (!nonlinear_solver_status.error_norms_met) @@ -756,8 +721,6 @@ TimeLoop::solveCoupledEquationSystemsByStaggeredScheme( { // TODO(wenqing): use process name coupling_iteration_converged = true; - _xdot_vector_ids.resize(_per_process_data.size()); - std::size_t cnt = 0; for (auto const& process_data : _per_process_data) { auto const process_id = process_data->process_id; @@ -776,8 +739,7 @@ TimeLoop::solveCoupledEquationSystemsByStaggeredScheme( nonlinear_solver_status = solveOneTimeStepOneProcess( _process_solutions, _process_solutions_prev, timestep_id, t, dt, - *process_data, _outputs, _xdot_vector_ids[cnt]); - cnt++; + *process_data, _outputs); process_data->nonlinear_solver_status = nonlinear_solver_status; INFO( @@ -878,23 +840,17 @@ void TimeLoop::outputSolutions(bool const output_initial_condition, if (!is_staggered_coupling && output_initial_condition) { - auto const& ode_sys = *process_data->tdisc_ode_sys; // dummy value to handle the time derivative terms more or less // correctly, i.e. to ignore them. double const dt = 1; process_data->time_disc->nextTimestep(t, dt); - auto& x_dot = NumLib::GlobalVectorProvider::provider.getVector( - ode_sys.getMatrixSpecifications(process_id)); - x_dot.setZero(); - pcs.preTimestep(_process_solutions, _start_time, dt, process_id); // Update secondary variables, which might be uninitialized, before // output. pcs.computeSecondaryVariable(_start_time, dt, _process_solutions, - x_dot, process_id); - - NumLib::GlobalVectorProvider::provider.releaseVector(x_dot); + *_process_solutions_prev[process_id], + process_id); } if (is_staggered_coupling && output_initial_condition) { @@ -907,23 +863,17 @@ void TimeLoop::outputSolutions(bool const output_initial_condition, .setCoupledTermForTheStaggeredSchemeToLocalAssemblers( process_id); - auto const& ode_sys = *process_data->tdisc_ode_sys; // dummy value to handle the time derivative terms more or less // correctly, i.e. to ignore them. double const dt = 1; process_data->time_disc->nextTimestep(t, dt); - auto& x_dot = NumLib::GlobalVectorProvider::provider.getVector( - ode_sys.getMatrixSpecifications(process_id)); - x_dot.setZero(); - pcs.preTimestep(_process_solutions, _start_time, dt, process_id); // Update secondary variables, which might be uninitialized, before // output. pcs.computeSecondaryVariable(_start_time, dt, _process_solutions, - x_dot, process_id); - - NumLib::GlobalVectorProvider::provider.releaseVector(x_dot); + *_process_solutions_prev[process_id], + process_id); } for (auto const& output_object : _outputs) { diff --git a/ProcessLib/TimeLoop.h b/ProcessLib/TimeLoop.h index 5c74901e88d..ec149029477 100644 --- a/ProcessLib/TimeLoop.h +++ b/ProcessLib/TimeLoop.h @@ -145,10 +145,5 @@ class TimeLoop /// Solutions of the previous coupling iteration for the convergence /// criteria of the coupling iteration. std::vector _solutions_of_last_cpl_iteration; - - /// store the ids of the global xdot vectors in the global vector - /// provider for reuse, needed in postTimestepForAllProcesses - /// the length of the vector is the size of _per_process_data - std::vector _xdot_vector_ids; }; } // namespace ProcessLib From f1884f944bdb2bd5fb569722145195d5d122ec38 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 25 Jul 2023 12:02:27 +0200 Subject: [PATCH 06/47] [NL] Remove no longer needed getXdot() --- NumLib/ODESolver/TimeDiscretization.cpp | 13 ------------- NumLib/ODESolver/TimeDiscretization.h | 6 ------ 2 files changed, 19 deletions(-) diff --git a/NumLib/ODESolver/TimeDiscretization.cpp b/NumLib/ODESolver/TimeDiscretization.cpp index 21765469c00..9982bc89616 100644 --- a/NumLib/ODESolver/TimeDiscretization.cpp +++ b/NumLib/ODESolver/TimeDiscretization.cpp @@ -48,19 +48,6 @@ double computeRelativeChangeFromPreviousTimestep(GlobalVector const& x, return norm_dx / std::numeric_limits::epsilon(); } -void TimeDiscretization::getXdot(GlobalVector const& x_at_new_timestep, - GlobalVector const& x_old, - GlobalVector& xdot) const -{ - namespace LinAlg = MathLib::LinAlg; - - double const dt = getCurrentTimeIncrement(); - - // xdot = 1/dt * x_at_new_timestep - x_old - getWeightedOldX(xdot, x_old); - LinAlg::axpby(xdot, 1. / dt, -1.0, x_at_new_timestep); -} - void BackwardEuler::getWeightedOldX(GlobalVector& y, GlobalVector const& x_old) const { diff --git a/NumLib/ODESolver/TimeDiscretization.h b/NumLib/ODESolver/TimeDiscretization.h index 196fa67a2f8..fe6b71d8f50 100644 --- a/NumLib/ODESolver/TimeDiscretization.h +++ b/NumLib/ODESolver/TimeDiscretization.h @@ -128,12 +128,6 @@ class TimeDiscretization //! assembled. virtual double getCurrentTimeIncrement() const = 0; - //! Returns \f$ \hat x \f$, i.e. the discretized approximation of \f$ \dot x - //! \f$. - void getXdot(GlobalVector const& x_at_new_timestep, - GlobalVector const& x_old, - GlobalVector& xdot) const; - //! Returns \f$ x_O \f$. virtual void getWeightedOldX( GlobalVector& y, GlobalVector const& x_old) const = 0; // = x_old From 4dcd28c0efb293c699a09cc8f0a9e084dd20c43e Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 11 Jul 2023 23:53:07 +0200 Subject: [PATCH 07/47] [PL/THM] Rename x_dot to x_prev --- .../ThermoHydroMechanicsFEM-impl.h | 18 ++++++------- .../ThermoHydroMechanicsFEM.h | 10 +++---- .../ThermoHydroMechanicsProcess.cpp | 26 +++++++++---------- .../ThermoHydroMechanicsProcess.h | 8 +++--- 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h index 6cea2120244..d613b497851 100644 --- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h +++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h @@ -150,7 +150,7 @@ ConstitutiveRelationsValues ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim>:: updateConstitutiveRelations( Eigen::Ref const local_x, - Eigen::Ref const local_xdot, + Eigen::Ref const local_x_prev, ParameterLib::SpatialPosition const& x_position, double const t, double const dt, IpData& ip_data, IntegrationPointDataForOutput& ip_data_output) const @@ -159,7 +159,7 @@ ConstitutiveRelationsValues ThermoHydroMechanicsLocalAssembler< pressure_size + displacement_size + temperature_size); auto const [T, p, u] = localDOF(local_x); - auto const [T_dot, p_dot, u_dot] = localDOF(local_xdot); + auto const [T_prev, p_prev, u_prev] = localDOF(local_x_prev); auto const& solid_material = MaterialLib::Solids::selectSolidConstitutiveRelation( @@ -481,7 +481,7 @@ void ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim>:: assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -492,11 +492,11 @@ void ThermoHydroMechanicsLocalAssembler< auto const x = Eigen::Map(local_x.data(), local_x.size()); - auto const xdot = - Eigen::Map(local_xdot.data(), local_xdot.size()); + auto const x_prev = Eigen::Map(local_x_prev.data(), + local_x_prev.size()); auto const [T, p, u] = localDOF(local_x); - auto const [T_dot, p_dot, u_dot] = localDOF(local_xdot); + auto const [T_prev, p_prev, u_prev] = localDOF(local_x_prev); auto local_Jac = MathLib::createZeroedMatrix< typename ShapeMatricesTypeDisplacement::template MatrixType< @@ -560,7 +560,7 @@ void ThermoHydroMechanicsLocalAssembler< _element, N_u))}; auto const crv = updateConstitutiveRelations( - x, xdot, x_position, t, dt, _ip_data[ip], _ip_data_output[ip]); + x, x_prev, x_position, t, dt, _ip_data[ip], _ip_data_output[ip]); auto const& w = _ip_data[ip].integration_weight; @@ -847,7 +847,7 @@ void ThermoHydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim>:: computeSecondaryVariableConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) + Eigen::VectorXd const& local_x_prev) { auto const p = local_x.template segment(pressure_index); auto const T = @@ -874,7 +874,7 @@ void ThermoHydroMechanicsLocalAssembler< ShapeMatricesTypeDisplacement>( _element, N_u))}; - updateConstitutiveRelations(local_x, local_x_dot, x_position, t, dt, + updateConstitutiveRelations(local_x, local_x_prev, x_position, t, dt, _ip_data[ip], _ip_data_output[ip]); fluid_density_avg += _ip_data_output[ip].fluid_density; diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h index 3b8cc830725..22ba85c4721 100644 --- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h +++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h @@ -95,7 +95,7 @@ class ThermoHydroMechanicsLocalAssembler : public LocalAssemblerInterface void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_rhs_data*/) override @@ -107,7 +107,7 @@ class ThermoHydroMechanicsLocalAssembler : public LocalAssemblerInterface void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -164,7 +164,7 @@ class ThermoHydroMechanicsLocalAssembler : public LocalAssemblerInterface } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override @@ -180,7 +180,7 @@ class ThermoHydroMechanicsLocalAssembler : public LocalAssemblerInterface void computeSecondaryVariableConcrete( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) override; + Eigen::VectorXd const& local_x_prev) override; Eigen::Map getShapeMatrix( const unsigned integration_point) const override @@ -233,7 +233,7 @@ class ThermoHydroMechanicsLocalAssembler : public LocalAssemblerInterface private: ConstitutiveRelationsValues updateConstitutiveRelations( Eigen::Ref const local_x, - Eigen::Ref const local_xdot, + Eigen::Ref const local_x_prev, ParameterLib::SpatialPosition const& x_position, double const t, double const dt, IpData& ip_data, IntegrationPointDataForOutput& ip_data_output) const; diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp index b4c30add6b8..cd76a07de88 100644 --- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp +++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp @@ -292,7 +292,7 @@ void ThermoHydroMechanicsProcess< template void ThermoHydroMechanicsProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble the equations for ThermoHydroMechanics"); @@ -304,18 +304,16 @@ void ThermoHydroMechanicsProcess::assembleConcreteProcess( GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } template void ThermoHydroMechanicsProcess:: - assembleWithJacobianConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac) + assembleWithJacobianConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { std::vector> dof_tables; @@ -357,8 +355,8 @@ void ThermoHydroMechanicsProcess:: GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, + x_prev, process_id, M, K, b, Jac); auto copyRhs = [&](int const variable_id, auto& output_vector) { @@ -407,7 +405,7 @@ void ThermoHydroMechanicsProcess::preTimestepConcreteProcess( template void ThermoHydroMechanicsProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, double const t, double const dt, + std::vector const& x_prev, double const t, double const dt, const int process_id) { if (process_id != 0) @@ -428,7 +426,7 @@ void ThermoHydroMechanicsProcess::postTimestepConcreteProcess( GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::postTimestep, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt, + pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } @@ -436,7 +434,7 @@ template void ThermoHydroMechanicsProcess:: computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, const int process_id) { if (process_id != 0) @@ -456,7 +454,7 @@ void ThermoHydroMechanicsProcess:: ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::computeSecondaryVariable, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, t, dt, x, x_dot, process_id); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id); } template diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.h b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.h index b5c34f3e91d..ee09d0bd757 100644 --- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.h +++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.h @@ -76,13 +76,13 @@ class ThermoHydroMechanicsProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; @@ -91,7 +91,7 @@ class ThermoHydroMechanicsProcess final : public Process const int process_id) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) override; @@ -119,7 +119,7 @@ class ThermoHydroMechanicsProcess final : public Process void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, const int process_id) override; /** * @copydoc ProcessLib::Process::getDOFTableForExtrapolatorData() From 4f0e55f0600c96ea04a996f90df9be0c94b103b9 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 12:48:35 +0200 Subject: [PATCH 08/47] [PL/THM] Rewrite FEM-impl to use x_prev --- .../ThermoHydroMechanicsFEM-impl.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h index d613b497851..5a2e80bc183 100644 --- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h +++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h @@ -181,7 +181,8 @@ ConstitutiveRelationsValues ThermoHydroMechanicsLocalAssembler< auto const& dNdx = ip_data.dNdx; auto const T_int_pt = N.dot(T); - double const dT_int_pt = N.dot(T_dot) * dt; + auto const T_prev_int_pt = N.dot(T_prev); + double const dT_int_pt = T_int_pt - T_prev_int_pt; auto const x_coord = NumLib::interpolateXCoordinate ThermoHydroMechanicsLocalAssembler< eps_m); crv.C = ip_data.updateConstitutiveRelation(vars, t, x_position, dt, - T_int_pt - dT_int_pt); + T_prev_int_pt); crv.rho = solid_density * (1 - porosity) + porosity * fluid_density; @@ -442,7 +443,7 @@ ConstitutiveRelationsValues ThermoHydroMechanicsLocalAssembler< eps_m_ice); auto const C_IR = ip_data.updateConstitutiveRelationIce( *_process_data.ice_constitutive_relation, vars_ice, t, x_position, - dt, T_int_pt - dT_int_pt); + dt, T_prev_int_pt); crv.effective_volumetric_heat_capacity += -phi_fr * fluid_density * crv.c_f + phi_fr * rho_fr * c_fr - l_fr * rho_fr * dphi_fr_dT; @@ -468,7 +469,7 @@ ConstitutiveRelationsValues ThermoHydroMechanicsLocalAssembler< crv.J_TT_fr = ((rho_fr * c_fr - fluid_density * crv.c_f) * dphi_fr_dT + l_fr * rho_fr * d2phi_fr_dT2) * - N.dot(T_dot); + dT_int_pt / dt; } return crv; } @@ -770,8 +771,8 @@ void ThermoHydroMechanicsLocalAssembler< // pressure equation (f_p) local_rhs.template segment(pressure_index).noalias() -= - laplace_p * p + laplace_T * T + storage_p * p_dot - storage_T * T_dot + - Kup.transpose() * u_dot; + laplace_p * p + laplace_T * T + storage_p * (p - p_prev) / dt - + storage_T * (T - T_prev) / dt + Kup.transpose() * (u - u_prev) / dt; // displacement equation (f_u) local_rhs.template segment(displacement_index) @@ -779,7 +780,7 @@ void ThermoHydroMechanicsLocalAssembler< // temperature equation (f_T) local_rhs.template segment(temperature_index).noalias() -= - KTT * T + MTT * T_dot; + KTT * T + MTT * (T - T_prev) / dt; local_rhs.template segment(temperature_index).noalias() -= KTp * p; From 20662e078560b0611211ef7f4042643a323e873e Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 12 Jul 2023 21:12:17 +0200 Subject: [PATCH 09/47] [PL/SD] Rename x_dot to x_prev --- .../SmallDeformation/SmallDeformationFEM.h | 18 ++++++------- .../SmallDeformationProcess.cpp | 26 +++++++++---------- .../SmallDeformationProcess.h | 8 +++--- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/ProcessLib/SmallDeformation/SmallDeformationFEM.h b/ProcessLib/SmallDeformation/SmallDeformationFEM.h index 532ebd77e00..f240ca57389 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationFEM.h +++ b/ProcessLib/SmallDeformation/SmallDeformationFEM.h @@ -267,7 +267,7 @@ class SmallDeformationLocalAssembler MathLib::KelvinVector::KelvinMatrixType updateConstitutiveRelations( Eigen::Ref const& u, - Eigen::Ref const& u_dot, + Eigen::Ref const& u_prev, ParameterLib::SpatialPosition const& x_position, double const t, double const dt, IntegrationPointData& @@ -329,7 +329,7 @@ class SmallDeformationLocalAssembler void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/) override @@ -341,7 +341,7 @@ class SmallDeformationLocalAssembler void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_x_dot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, @@ -356,7 +356,7 @@ class SmallDeformationLocalAssembler local_b_data, local_matrix_size); auto [u] = localDOF(local_x); - auto [u_dot] = localDOF(local_x_dot); + auto [u_prev] = localDOF(local_x_prev); unsigned const n_integration_points = _integration_method.getNumberOfPoints(); @@ -383,7 +383,7 @@ class SmallDeformationLocalAssembler auto const& sigma = _ip_data[ip].sigma; - auto const C = updateConstitutiveRelations(u, u_dot, x_position, t, + auto const C = updateConstitutiveRelations(u, u_prev, x_position, t, dt, _ip_data[ip]); auto const rho = _process_data.solid_density(t, x_position)[0]; @@ -394,7 +394,7 @@ class SmallDeformationLocalAssembler } void postTimestepConcrete(Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot, + Eigen::VectorXd const& local_x_prev, double const t, double const dt, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override @@ -409,8 +409,8 @@ class SmallDeformationLocalAssembler { x_position.setIntegrationPoint(ip); - updateConstitutiveRelations(local_x, local_x_dot, x_position, t, dt, - _ip_data[ip]); + updateConstitutiveRelations(local_x, local_x_prev, x_position, t, + dt, _ip_data[ip]); auto& eps = _ip_data[ip].eps; auto& sigma = _ip_data[ip].sigma; @@ -529,7 +529,7 @@ class SmallDeformationLocalAssembler void computeSecondaryVariableConcrete( double const /*t*/, double const /*dt*/, Eigen::VectorXd const& /*x*/, - Eigen::VectorXd const& /*x_dot*/) override + Eigen::VectorXd const& /*x_prev*/) override { int const elem_id = _element.getID(); ParameterLib::SpatialPosition x_position; diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp index 1b7fdf3e04e..fef518075af 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp @@ -144,7 +144,7 @@ void SmallDeformationProcess::initializeConcreteProcess( template void SmallDeformationProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble SmallDeformationProcess."); @@ -156,7 +156,7 @@ void SmallDeformationProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); _global_output(t, process_id, M, K, b); @@ -164,12 +164,10 @@ void SmallDeformationProcess::assembleConcreteProcess( template void SmallDeformationProcess:: - assembleWithJacobianConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac) + assembleWithJacobianConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian SmallDeformationProcess."); @@ -180,8 +178,8 @@ void SmallDeformationProcess:: // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); transformVariableFromGlobalVector(b, 0, *_local_to_global_index_map, *_nodal_forces, std::negate()); @@ -192,7 +190,7 @@ void SmallDeformationProcess:: template void SmallDeformationProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, const double t, const double dt, + std::vector const& x_prev, const double t, const double dt, int const process_id) { DBUG("PostTimestep SmallDeformationProcess."); @@ -204,7 +202,7 @@ void SmallDeformationProcess::postTimestepConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::postTimestep, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt, + pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); std::unique_ptr material_forces; @@ -218,7 +216,7 @@ void SmallDeformationProcess::postTimestepConcreteProcess( template void SmallDeformationProcess::computeSecondaryVariableConcrete( double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, const int process_id) + GlobalVector const& x_prev, const int process_id) { DBUG("Compute the secondary variables for SmallDeformationProcess."); std::vector dof_tables; @@ -229,7 +227,7 @@ void SmallDeformationProcess::computeSecondaryVariableConcrete( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::computeSecondaryVariable, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, t, dt, x, x_dot, process_id); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id); } template class SmallDeformationProcess<2>; template class SmallDeformationProcess<3>; diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.h b/ProcessLib/SmallDeformation/SmallDeformationProcess.h index 92e4d875a23..4618f7baeaa 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess.h +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.h @@ -51,24 +51,24 @@ class SmallDeformationProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) override; void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, const int process_id) override; private: From 98943f7f0b7e5559f290ad9115af5e74b0bad10f Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 12:51:19 +0200 Subject: [PATCH 10/47] [PL/SD] Rewrite FEM-impl to use x_prev --- ProcessLib/SmallDeformation/SmallDeformationFEM.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProcessLib/SmallDeformation/SmallDeformationFEM.h b/ProcessLib/SmallDeformation/SmallDeformationFEM.h index f240ca57389..9099d2e4599 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationFEM.h +++ b/ProcessLib/SmallDeformation/SmallDeformationFEM.h @@ -300,7 +300,7 @@ class SmallDeformationLocalAssembler sigma_prev); variables_prev.mechanical_strain .emplace>( - B * (u - u_dot * dt)); + B * u_prev); double const T_ref = _process_data.reference_temperature From f28789c5344bc97cd144a4395ae6190c3741307f Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 12 Jul 2023 22:12:38 +0200 Subject: [PATCH 11/47] [PL/HC] Rename x_dot to x_prev --- ProcessLib/HeatConduction/HeatConductionFEM.h | 8 ++++---- .../HeatConduction/HeatConductionProcess.cpp | 16 ++++++++-------- .../HeatConduction/HeatConductionProcess.h | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ProcessLib/HeatConduction/HeatConductionFEM.h b/ProcessLib/HeatConduction/HeatConductionFEM.h index 26b72ad8b7b..425c21e30f2 100644 --- a/ProcessLib/HeatConduction/HeatConductionFEM.h +++ b/ProcessLib/HeatConduction/HeatConductionFEM.h @@ -83,7 +83,7 @@ class LocalAssemblerData : public HeatConductionLocalAssemblerInterface void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& /*local_b_data*/) override @@ -151,7 +151,7 @@ class LocalAssemblerData : public HeatConductionLocalAssemblerInterface void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -165,8 +165,8 @@ class LocalAssemblerData : public HeatConductionLocalAssemblerInterface auto x = Eigen::Map(local_x.data(), local_matrix_size); - auto x_dot = Eigen::Map(local_xdot.data(), - local_matrix_size); + auto x_prev = Eigen::Map(local_x_prev.data(), + local_matrix_size); auto local_Jac = MathLib::createZeroedMatrix( local_Jac_data, local_matrix_size, local_matrix_size); diff --git a/ProcessLib/HeatConduction/HeatConductionProcess.cpp b/ProcessLib/HeatConduction/HeatConductionProcess.cpp index f7bde46a760..f3c45396dfa 100644 --- a/ProcessLib/HeatConduction/HeatConductionProcess.cpp +++ b/ProcessLib/HeatConduction/HeatConductionProcess.cpp @@ -63,7 +63,7 @@ void HeatConductionProcess::initializeConcreteProcess( void HeatConductionProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble HeatConductionProcess."); @@ -75,14 +75,14 @@ void HeatConductionProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); MathLib::finalizeMatrixAssembly(M); MathLib::finalizeMatrixAssembly(K); MathLib::finalizeVectorAssembly(b); - auto const residuum = computeResiduum(*x[0], *xdot[0], M, K, b); + auto const residuum = computeResiduum(dt, *x[0], *x_prev[0], M, K, b); transformVariableFromGlobalVector(residuum, 0 /*variable id*/, *_local_to_global_index_map, *_heat_flux, std::negate()); @@ -90,7 +90,7 @@ void HeatConductionProcess::assembleConcreteProcess( void HeatConductionProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian HeatConductionProcess."); @@ -102,8 +102,8 @@ void HeatConductionProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); transformVariableFromGlobalVector(b, 0 /*variable id*/, *_local_to_global_index_map, *_heat_flux, @@ -112,7 +112,7 @@ void HeatConductionProcess::assembleWithJacobianConcreteProcess( void HeatConductionProcess::computeSecondaryVariableConcrete( double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, int const process_id) + GlobalVector const& x_prev, int const process_id) { DBUG("Compute heat flux for HeatConductionProcess."); @@ -125,7 +125,7 @@ void HeatConductionProcess::computeSecondaryVariableConcrete( GlobalExecutor::executeSelectedMemberOnDereferenced( &HeatConductionLocalAssemblerInterface::computeSecondaryVariable, _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, - x_dot, process_id); + x_prev, process_id); } } // namespace HeatConduction diff --git a/ProcessLib/HeatConduction/HeatConductionProcess.h b/ProcessLib/HeatConduction/HeatConductionProcess.h index c243cfba844..92957418215 100644 --- a/ProcessLib/HeatConduction/HeatConductionProcess.h +++ b/ProcessLib/HeatConduction/HeatConductionProcess.h @@ -42,7 +42,7 @@ class HeatConductionProcess final : public Process void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) override; private: @@ -53,14 +53,14 @@ class HeatConductionProcess final : public Process void assembleConcreteProcess(const double t, double const /*dt*/, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const /*dt*/, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From 6fdc7797fa722a031b25cbe5ebd90ddd61c0b846 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 12:53:16 +0200 Subject: [PATCH 12/47] [PL/HC] Rewrite FEM-impl to use x_prev --- ProcessLib/HeatConduction/HeatConductionFEM.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProcessLib/HeatConduction/HeatConductionFEM.h b/ProcessLib/HeatConduction/HeatConductionFEM.h index 425c21e30f2..74cb85a0fce 100644 --- a/ProcessLib/HeatConduction/HeatConductionFEM.h +++ b/ProcessLib/HeatConduction/HeatConductionFEM.h @@ -226,7 +226,7 @@ class LocalAssemblerData : public HeatConductionLocalAssemblerInterface } local_Jac.noalias() += laplace + storage / dt; - local_rhs.noalias() -= laplace * x + storage * x_dot; + local_rhs.noalias() -= laplace * x + storage * (x - x_prev) / dt; } Eigen::Map getShapeMatrix( From ea2cda444655da589edce2295017fec54ca8c0e1 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 12 Jul 2023 22:35:14 +0200 Subject: [PATCH 13/47] [PL/HT] Rename x_dot to x_prev --- ProcessLib/HT/HTProcess.cpp | 21 ++++++++++----------- ProcessLib/HT/HTProcess.h | 6 +++--- ProcessLib/HT/MonolithicHTFEM.h | 2 +- ProcessLib/HT/StaggeredHTFEM-impl.h | 10 +++++----- ProcessLib/HT/StaggeredHTFEM.h | 4 ++-- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/ProcessLib/HT/HTProcess.cpp b/ProcessLib/HT/HTProcess.cpp index bd28fb52c98..bf723e15912 100644 --- a/ProcessLib/HT/HTProcess.cpp +++ b/ProcessLib/HT/HTProcess.cpp @@ -72,11 +72,10 @@ void HTProcess::initializeConcreteProcess( &HTLocalAssemblerInterface::getIntPtDarcyVelocity)); } -void HTProcess::assembleConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b) +void HTProcess::assembleConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { std::vector> dof_tables; @@ -107,13 +106,13 @@ void HTProcess::assembleConcreteProcess(const double t, double const dt, // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, process_id, M, K, - b); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id, M, + K, b); } void HTProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian HTProcess."); @@ -134,8 +133,8 @@ void HTProcess::assembleWithJacobianConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, + x_prev, process_id, M, K, b, Jac); } void HTProcess::setCoupledTermForTheStaggeredSchemeToLocalAssemblers( @@ -193,7 +192,7 @@ Eigen::Vector3d HTProcess::getFlux(std::size_t element_id, // this is almost a copy of the implementation in the GroundwaterFlow void HTProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& /*x_dot*/, + std::vector const& /*x_prev*/, const double t, const double /*delta_t*/, int const process_id) diff --git a/ProcessLib/HT/HTProcess.h b/ProcessLib/HT/HTProcess.h index 99f26904f8b..5e090e13365 100644 --- a/ProcessLib/HT/HTProcess.h +++ b/ProcessLib/HT/HTProcess.h @@ -81,7 +81,7 @@ class HTProcess final : public Process int const process_id) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double delta_t, int const process_id) override; @@ -95,13 +95,13 @@ class HTProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; diff --git a/ProcessLib/HT/MonolithicHTFEM.h b/ProcessLib/HT/MonolithicHTFEM.h index 6a9e6077b31..40e6cb9e473 100644 --- a/ProcessLib/HT/MonolithicHTFEM.h +++ b/ProcessLib/HT/MonolithicHTFEM.h @@ -68,7 +68,7 @@ class MonolithicHTFEM : public HTFEM void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) override diff --git a/ProcessLib/HT/StaggeredHTFEM-impl.h b/ProcessLib/HT/StaggeredHTFEM-impl.h index 068ae10b364..06728a1bae1 100644 --- a/ProcessLib/HT/StaggeredHTFEM-impl.h +++ b/ProcessLib/HT/StaggeredHTFEM-impl.h @@ -25,7 +25,7 @@ namespace HT template void StaggeredHTFEM::assembleForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) { @@ -36,14 +36,14 @@ void StaggeredHTFEM::assembleForStaggeredScheme( return; } - assembleHydraulicEquation(t, dt, local_x, local_xdot, local_M_data, + assembleHydraulicEquation(t, dt, local_x, local_x_prev, local_M_data, local_K_data, local_b_data); } template void StaggeredHTFEM::assembleHydraulicEquation( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_M_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) { auto const local_p = @@ -51,8 +51,8 @@ void StaggeredHTFEM::assembleHydraulicEquation( auto const local_T = local_x.template segment(temperature_index); - auto const local_Tdot = - local_xdot.template segment(temperature_index); + auto const local_T_prev = + local_x_prev.template segment(temperature_index); auto local_M = MathLib::createZeroedMatrix( local_M_data, pressure_size, pressure_size); diff --git a/ProcessLib/HT/StaggeredHTFEM.h b/ProcessLib/HT/StaggeredHTFEM.h index 7248739059e..1aff984bca3 100644 --- a/ProcessLib/HT/StaggeredHTFEM.h +++ b/ProcessLib/HT/StaggeredHTFEM.h @@ -68,7 +68,7 @@ class StaggeredHTFEM : public HTFEM void assembleForStaggeredScheme(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, @@ -83,7 +83,7 @@ class StaggeredHTFEM : public HTFEM private: void assembleHydraulicEquation(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, + Eigen::VectorXd const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data); From b2fa8bee56d0115d8b2348095a81db7be2268af6 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 12:56:54 +0200 Subject: [PATCH 14/47] [PL/HT] Rewrite FEM-impl to use x_prev --- ProcessLib/HT/StaggeredHTFEM-impl.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ProcessLib/HT/StaggeredHTFEM-impl.h b/ProcessLib/HT/StaggeredHTFEM-impl.h index 06728a1bae1..053e96b8359 100644 --- a/ProcessLib/HT/StaggeredHTFEM-impl.h +++ b/ProcessLib/HT/StaggeredHTFEM-impl.h @@ -159,8 +159,7 @@ void StaggeredHTFEM::assembleHydraulicEquation( .template dValue( vars, MaterialPropertyLib::Variable::temperature, pos, t, dt); - double Tdot_int_pt = 0.; - NumLib::shapeFunctionInterpolate(local_Tdot, N, Tdot_int_pt); + double const Tdot_int_pt = (T_int_pt - local_T_prev.dot(N)) / dt; auto const biot_constant = process_data.biot_constant(t, pos)[0]; const double eff_thermal_expansion = 3.0 * (biot_constant - porosity) * solid_thermal_expansion - From b0e5835bcd19ac457272549bb669e64d47c3b676 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 12 Jul 2023 22:48:24 +0200 Subject: [PATCH 15/47] [PL/HM] Rename x_dot to x_prev --- .../HydroMechanics/HydroMechanicsFEM-impl.h | 30 ++++++++--------- ProcessLib/HydroMechanics/HydroMechanicsFEM.h | 16 +++++----- .../HydroMechanics/HydroMechanicsProcess.cpp | 32 +++++++++---------- .../HydroMechanics/HydroMechanicsProcess.h | 10 +++--- 4 files changed, 43 insertions(+), 45 deletions(-) diff --git a/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h b/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h index 0b0d6f16803..59a3b3668f1 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h @@ -103,7 +103,7 @@ void HydroMechanicsLocalAssembler:: assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -119,13 +119,13 @@ void HydroMechanicsLocalAssembler const>(local_x.data() + displacement_index, displacement_size); - auto p_dot = + auto p_prev = Eigen::Map const>(local_xdot.data() + pressure_index, + pressure_size> const>(local_x_prev.data() + pressure_index, pressure_size); - auto u_dot = + auto u_prev = Eigen::Map const>(local_xdot.data() + displacement_index, + displacement_size> const>(local_x_prev.data() + displacement_index, displacement_size); auto local_Jac = MathLib::createZeroedMatrix< @@ -489,7 +489,7 @@ void HydroMechanicsLocalAssembler:: assembleWithJacobianForPressureEquations( const double t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data) { auto local_rhs = @@ -502,8 +502,8 @@ void HydroMechanicsLocalAssembler(pressure_index); - auto const p_dot = - local_xdot.template segment(pressure_index); + auto const p_prev = + local_x_prev.template segment(pressure_index); auto local_Jac = MathLib::createZeroedMatrix< typename ShapeMatricesTypeDisplacement::template MatrixType< @@ -783,7 +783,7 @@ void HydroMechanicsLocalAssembler:: assembleWithJacobianForStaggeredScheme( const double t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, std::vector& local_Jac_data) @@ -791,7 +791,7 @@ void HydroMechanicsLocalAssembler:: postNonLinearSolverConcrete(std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, double const t, double const dt, bool const /*use_monolithic_scheme*/, int const process_id) { - // Note: local_x and local_xdot only contain the solutions of current + // Note: local_x and local_x_prev only contain the solutions of current // process in the staggered scheme. This has to be changed according to the // same two arguments in postTimestepConcrete. @@ -950,8 +950,8 @@ template void HydroMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, - DisplacementDim>::postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& local_x_dot, + DisplacementDim>::postTimestepConcrete(Eigen::VectorXd const& local_x, + Eigen::VectorXd const& local_x_prev, double const t, double const dt, bool const /*use_monolithic_scheme*/, int const process_id) @@ -1134,7 +1134,7 @@ void HydroMechanicsLocalAssembler:: computeSecondaryVariableConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& /*local_x_dot*/) + Eigen::VectorXd const& /*local_x_prev*/) { auto const p = local_x.template segment(pressure_index); diff --git a/ProcessLib/HydroMechanics/HydroMechanicsFEM.h b/ProcessLib/HydroMechanics/HydroMechanicsFEM.h index 5ac89f4b5df..27fc9727591 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsFEM.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsFEM.h @@ -202,7 +202,7 @@ class HydroMechanicsLocalAssembler void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_rhs_data*/) override @@ -214,7 +214,7 @@ class HydroMechanicsLocalAssembler void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -222,7 +222,7 @@ class HydroMechanicsLocalAssembler void assembleWithJacobianForStaggeredScheme( const double t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) override; @@ -263,17 +263,17 @@ class HydroMechanicsLocalAssembler } void postTimestepConcrete(Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot, + Eigen::VectorXd const& local_x_prev, double const t, double const dt, bool const use_monolithic_scheme, int const process_id) override; void computeSecondaryVariableConcrete( double const t, double const dt, Eigen::VectorXd const& local_xs, - Eigen::VectorXd const& local_x_dot) override; + Eigen::VectorXd const& local_x_prev) override; void postNonLinearSolverConcrete(std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, double const t, double const dt, bool const use_monolithic_scheme, int const process_id) override; @@ -367,7 +367,7 @@ class HydroMechanicsLocalAssembler * @param dt Time increment * @param local_x Nodal values of \f$x\f$ of an element of all * coupled processes. - * @param local_xdot Nodal values of \f$\dot{x}\f$ of an element of + * @param local_x_prev Nodal values of \f$x^{t-1}\f$ of an element of * all coupled processes. * @param local_b_data Right hand side vector of an element. * @param local_Jac_data Element Jacobian matrix for the Newton-Raphson @@ -375,7 +375,7 @@ class HydroMechanicsLocalAssembler */ void assembleWithJacobianForPressureEquations( const double t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data); unsigned getNumberOfIntegrationPoints() const override; diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp index c9e00d3f2e1..080acb15611 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp @@ -283,7 +283,7 @@ void HydroMechanicsProcess::initializeBoundaryConditions() template void HydroMechanicsProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble the equations for HydroMechanics"); @@ -299,18 +299,16 @@ void HydroMechanicsProcess::assembleConcreteProcess( GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } template void HydroMechanicsProcess:: - assembleWithJacobianConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac) + assembleWithJacobianConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { std::vector> dof_tables; @@ -346,8 +344,8 @@ void HydroMechanicsProcess:: GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, + x_prev, process_id, M, K, b, Jac); auto copyRhs = [&](int const variable_id, auto& output_vector) { @@ -395,7 +393,7 @@ void HydroMechanicsProcess::preTimestepConcreteProcess( template void HydroMechanicsProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, double const t, double const dt, + std::vector const& x_prev, double const t, double const dt, const int process_id) { if (process_id != _process_data.hydraulic_process_id) @@ -415,13 +413,13 @@ void HydroMechanicsProcess::postTimestepConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerIF::postTimestep, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt, false /*unused*/, - process_id); + pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, + false /*unused*/, process_id); } template void HydroMechanicsProcess::postNonLinearSolverConcreteProcess( - GlobalVector const& x, GlobalVector const& xdot, const double t, + GlobalVector const& x, GlobalVector const& x_prev, const double t, double const dt, const int process_id) { DBUG("PostNonLinearSolver HydroMechanicsProcess."); @@ -430,7 +428,7 @@ void HydroMechanicsProcess::postNonLinearSolverConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerIF::postNonLinearSolver, _local_assemblers, - pv.getActiveElementIDs(), getDOFTable(process_id), x, xdot, t, dt, + pv.getActiveElementIDs(), getDOFTable(process_id), x, x_prev, t, dt, false /*unused*/, process_id); } @@ -457,7 +455,7 @@ void HydroMechanicsProcess:: template void HydroMechanicsProcess::computeSecondaryVariableConcrete( double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, const int process_id) + GlobalVector const& x_prev, const int process_id) { if (process_id != _process_data.hydraulic_process_id) { @@ -476,7 +474,7 @@ void HydroMechanicsProcess::computeSecondaryVariableConcrete( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerIF::computeSecondaryVariable, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, t, dt, x, x_dot, process_id); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id); } template diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.h b/ProcessLib/HydroMechanics/HydroMechanicsProcess.h index 9388da66cd2..3d9cd9c8e61 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.h @@ -75,14 +75,14 @@ class HydroMechanicsProcess final : public Process void assembleConcreteProcess(const double t, double const /*dt*/, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const /*dt*/, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; @@ -91,12 +91,12 @@ class HydroMechanicsProcess final : public Process const int process_id) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) override; void postNonLinearSolverConcreteProcess(GlobalVector const& x, - GlobalVector const& xdot, + GlobalVector const& x_prev, const double t, double const dt, int const process_id) override; @@ -133,7 +133,7 @@ class HydroMechanicsProcess final : public Process void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, const int process_id) override; /** * @copydoc ProcessLib::Process::getDOFTableForExtrapolatorData() From 4e86917b4a957beb1bb534b6bcae2d3cf8334d54 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 12:58:31 +0200 Subject: [PATCH 16/47] [PL/HM] Rewrite FEM-impl to use x_prev --- .../HydroMechanics/HydroMechanicsFEM-impl.h | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h b/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h index 59a3b3668f1..1fd0979fc11 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h @@ -372,7 +372,7 @@ void HydroMechanicsLocalAssembler(pressure_index).noalias() -= - laplace_p * p + storage_p * p_dot + Kpu * u_dot; + laplace_p * p + storage_p * (p - p_prev) / dt + Kpu * (u - u_prev) / dt; // displacement equation local_rhs.template segment(displacement_index) @@ -663,7 +663,7 @@ void HydroMechanicsLocalAssemblerfixed_stress_over_time_step) { - auto const p_dot = + auto const p = Eigen::Map const>( - local_xdot.data(), pressure_size); + local_x.data(), pressure_size); + + auto const p_prev = + Eigen::Map const>( + local_x_prev.data(), pressure_size); for (int ip = 0; ip < n_integration_points; ip++) { @@ -891,7 +896,7 @@ void HydroMechanicsLocalAssemblerfixed_stress_stabilization_parameter; - auto const p_dot = - local_x_dot.template segment(pressure_index); + auto const p = + local_x.template segment(pressure_index); + auto const p_prev = + local_x_prev.template segment(pressure_index); ParameterLib::SpatialPosition x_position; x_position.setElementID(_element.getID()); @@ -1011,7 +1018,7 @@ void HydroMechanicsLocalAssembler< ip_data.strain_rate_variable = eps_v_dot - fixed_stress_stabilization_parameter * alpha_b * - N_p.dot(p_dot) / K_S; + N_p.dot(p - p_prev) / dt / K_S; } } } From 43c2433c2ebcbc55420a9d390fa99223011aa4b3 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Sat, 22 Jul 2023 18:35:19 +0200 Subject: [PATCH 17/47] [PL/CT] Rename x_dot to x_prev --- .../ComponentTransportFEM.h | 46 +++++++++---------- .../ComponentTransportProcess.cpp | 24 +++++----- .../ComponentTransportProcess.h | 8 ++-- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/ProcessLib/ComponentTransport/ComponentTransportFEM.h b/ProcessLib/ComponentTransport/ComponentTransportFEM.h index 01b9cacc0ca..c1b798b1d9e 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportFEM.h +++ b/ProcessLib/ComponentTransport/ComponentTransportFEM.h @@ -438,7 +438,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) override @@ -769,7 +769,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface void assembleForStaggeredScheme(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, @@ -777,13 +777,13 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface { if (process_id == _process_data.hydraulic_process_id) { - assembleHydraulicEquation(t, dt, local_x, local_xdot, local_M_data, - local_K_data, local_b_data); + assembleHydraulicEquation(t, dt, local_x, local_x_prev, + local_M_data, local_K_data, local_b_data); } else { // Go for assembling in an order of transport process id. - assembleComponentTransportEquation(t, dt, local_x, local_xdot, + assembleComponentTransportEquation(t, dt, local_x, local_x_prev, local_M_data, local_K_data, local_b_data, process_id); } @@ -792,7 +792,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface void assembleHydraulicEquation(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, + Eigen::VectorXd const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) @@ -801,8 +801,8 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface local_x.template segment(pressure_index); auto const local_C = local_x.template segment( first_concentration_index); - auto const local_Cdot = - local_xdot.segment(first_concentration_index); + auto const local_C_prev = + local_x_prev.segment(first_concentration_index); auto local_M = MathLib::createZeroedMatrix( local_M_data, pressure_size, pressure_size); @@ -914,7 +914,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface void assembleComponentTransportEquation( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_M_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& /*local_b_data*/, int const transport_process_id) { @@ -923,8 +923,8 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface auto const local_C = local_x.template segment( first_concentration_index + (transport_process_id - 1) * concentration_size); - auto const local_pdot = - local_xdot.segment(pressure_index); + auto const local_p_prev = + local_x_prev.segment(pressure_index); NodalVectorType local_T; if (_process_data.temperature) @@ -1115,7 +1115,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface void assembleWithJacobianForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, @@ -1123,30 +1123,30 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface { if (process_id == _process_data.hydraulic_process_id) { - assembleWithJacobianHydraulicEquation(t, dt, local_x, local_xdot, + assembleWithJacobianHydraulicEquation(t, dt, local_x, local_x_prev, local_b_data, local_Jac_data); } else { int const component_id = process_id - 1; assembleWithJacobianComponentTransportEquation( - t, dt, local_x, local_xdot, local_b_data, local_Jac_data, + t, dt, local_x, local_x_prev, local_b_data, local_Jac_data, component_id); } } void assembleWithJacobianHydraulicEquation( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data) { auto const p = local_x.template segment(pressure_index); auto const c = local_x.template segment( first_concentration_index); - auto const pdot = local_xdot.segment(pressure_index); - auto const cdot = - local_xdot.segment(first_concentration_index); + auto const p_prev = local_x_prev.segment(pressure_index); + auto const c_prev = + local_x_prev.segment(first_concentration_index); auto local_Jac = MathLib::createZeroedMatrix( local_Jac_data, pressure_size, pressure_size); @@ -1241,7 +1241,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface void assembleWithJacobianComponentTransportEquation( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data, int const component_id) { auto const concentration_index = @@ -1250,8 +1250,8 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface auto const p = local_x.template segment(pressure_index); auto const c = local_x.template segment(concentration_index); - auto const cdot = - local_xdot.segment(concentration_index); + auto const c_prev = + local_x_prev.segment(concentration_index); NodalVectorType T; if (_process_data.temperature) @@ -1647,7 +1647,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface double const t, double const /*dt*/, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& /*local_x_dot*/) override + Eigen::VectorXd const& /*local_x_prev*/) override { auto const local_p = local_x.template segment(pressure_index); @@ -1808,7 +1808,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp index f96c617a11e..94058ab7e90 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp @@ -171,7 +171,7 @@ void ComponentTransportProcess::setInitialConditionsConcreteProcess( void ComponentTransportProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble ComponentTransportProcess."); @@ -193,8 +193,8 @@ void ComponentTransportProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, process_id, M, K, - b); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id, M, + K, b); MathLib::finalizeMatrixAssembly(M); MathLib::finalizeMatrixAssembly(K); @@ -202,7 +202,7 @@ void ComponentTransportProcess::assembleConcreteProcess( if (_use_monolithic_scheme) { - auto const residuum = computeResiduum(*x[0], *xdot[0], M, K, b); + auto const residuum = computeResiduum(dt, *x[0], *x_prev[0], M, K, b); for (std::size_t variable_id = 0; variable_id < _residua.size(); ++variable_id) { @@ -214,7 +214,7 @@ void ComponentTransportProcess::assembleConcreteProcess( else { auto const residuum = - computeResiduum(*x[process_id], *xdot[process_id], M, K, b); + computeResiduum(dt, *x[process_id], *x_prev[process_id], M, K, b); transformVariableFromGlobalVector(residuum, 0, dof_tables[process_id], *_residua[process_id], std::negate()); @@ -223,7 +223,7 @@ void ComponentTransportProcess::assembleConcreteProcess( void ComponentTransportProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian ComponentTransportProcess."); @@ -246,8 +246,8 @@ void ComponentTransportProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, + x_prev, process_id, M, K, b, Jac); // b is the negated residumm used in the Newton's method. // Here negating b is to recover the primitive residuum. @@ -391,7 +391,7 @@ void ComponentTransportProcess::computeSecondaryVariableConcrete( double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) { if (process_id != 0) @@ -408,7 +408,7 @@ void ComponentTransportProcess::computeSecondaryVariableConcrete( GlobalExecutor::executeSelectedMemberOnDereferenced( &ComponentTransportLocalAssemblerInterface::computeSecondaryVariable, _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, - x_dot, process_id); + x_prev, process_id); if (!_chemical_solver_interface) { @@ -423,7 +423,7 @@ void ComponentTransportProcess::computeSecondaryVariableConcrete( void ComponentTransportProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) @@ -441,7 +441,7 @@ void ComponentTransportProcess::postTimestepConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &ComponentTransportLocalAssemblerInterface::postTimestep, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_dot, t, + _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); if (!_surfaceflux) // computing the surfaceflux is optional diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.h b/ProcessLib/ComponentTransport/ComponentTransportProcess.h index d6298c610ba..02a4f5d5d19 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.h +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.h @@ -130,11 +130,11 @@ class ComponentTransportProcess final : public Process void computeSecondaryVariableConcrete(double const /*t*/, double const /*dt*/, std::vector const& x, - GlobalVector const& /*x_dot*/, + GlobalVector const& /*x_prev*/, int const /*process_id*/) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) override; @@ -151,13 +151,13 @@ class ComponentTransportProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From 547e3156372a70cb102553d8fce3bb79b52b666d Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 13:00:59 +0200 Subject: [PATCH 18/47] [PL/CT] Rewrite FEM-impl to use x_prev --- .../ComponentTransport/ComponentTransportFEM.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ProcessLib/ComponentTransport/ComponentTransportFEM.h b/ProcessLib/ComponentTransport/ComponentTransportFEM.h index c1b798b1d9e..ce87c55479b 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportFEM.h +++ b/ProcessLib/ComponentTransport/ComponentTransportFEM.h @@ -903,11 +903,10 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface // coupling term { - double dot_C_int_pt = 0.0; - NumLib::shapeFunctionInterpolate(local_Cdot, N, dot_C_int_pt); + double const C_dot = (C_int_pt - N.dot(local_C_prev)) / dt; local_b.noalias() -= - w * N.transpose() * porosity * drho_dC * dot_C_int_pt; + w * N.transpose() * porosity * drho_dC * C_dot; } } } @@ -1074,9 +1073,8 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface // coupling term if (_process_data.non_advective_form) { - double dot_p_int_pt = 0.0; + double const p_dot = (p_int_pt - N.dot(local_p_prev)) / dt; - NumLib::shapeFunctionInterpolate(local_pdot, N, dot_p_int_pt); const double drho_dp = phase[MaterialPropertyLib::PropertyType::density] .template dValue( @@ -1084,7 +1082,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface pos, t, dt); local_K.noalias() += - N_t_N * ((R_times_phi * drho_dp * dot_p_int_pt) * w) - + N_t_N * ((R_times_phi * drho_dp * p_dot) * w) - dNdx.transpose() * velocity * N * (density * w); } else @@ -1183,7 +1181,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface double const p_ip = N.dot(p); double const c_ip = N.dot(c); - double const cdot_ip = N.dot(cdot); + double const cdot_ip = (c_ip - N.dot(c_prev)) / dt; vars.phase_pressure = p_ip; vars.concentration = c_ip; @@ -1228,7 +1226,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface local_rhs.noalias() -= w * N.transpose() * phi * - (drho_dp * N * pdot + drho_dc * cdot_ip) + + (drho_dp * N * p_prev + drho_dc * cdot_ip) + w * rho * dNdx.transpose() * k / mu * dNdx * p; if (_process_data.has_gravity) @@ -1366,6 +1364,7 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface KCC_Laplacian.noalias() += w * rho * dNdx.transpose() * D * dNdx; + auto const cdot = (c - c_prev) / dt; local_rhs.noalias() -= w * rho * N.transpose() * phi * R * N * (cdot + alpha * c); From 9b0709e0b8a9af82b0f3ac4b79228f1bd175b3ff Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Sun, 23 Jul 2023 13:14:50 +0200 Subject: [PATCH 19/47] [PL/TRF] Rename x_dot to x_prev --- .../ThermoRichardsFlowFEM-impl.h | 33 ++++++++++--------- .../ThermoRichardsFlowFEM.h | 16 ++++----- .../ThermoRichardsFlowProcess.cpp | 18 +++++----- .../ThermoRichardsFlowProcess.h | 8 ++--- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM-impl.h b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM-impl.h index f282dac53d2..e845477930a 100644 --- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM-impl.h +++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM-impl.h @@ -154,7 +154,7 @@ template void ThermoRichardsFlowLocalAssembler:: assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -170,13 +170,13 @@ void ThermoRichardsFlowLocalAssembler:: typename ShapeMatricesType::template VectorType const>( local_x.data() + pressure_index, pressure_size); - auto const T_dot = + auto const T_prev = Eigen::Map const>(local_xdot.data() + temperature_index, + temperature_size> const>(local_x_prev.data() + temperature_index, temperature_size); - auto const p_L_dot = Eigen::Map< + auto const p_L_prev = Eigen::Map< typename ShapeMatricesType::template VectorType const>( - local_xdot.data() + pressure_index, pressure_size); + local_x_prev.data() + pressure_index, pressure_size); auto local_Jac = MathLib::createZeroedMatrix< typename ShapeMatricesType::template MatrixType:: double p_cap_ip; NumLib::shapeFunctionInterpolate(-p_L, N, p_cap_ip); - double p_cap_dot_ip; - NumLib::shapeFunctionInterpolate(-p_L_dot, N, p_cap_dot_ip); + double p_cap_prev_ip; + NumLib::shapeFunctionInterpolate(-p_L_prev, N, p_cap_prev_ip); variables.capillary_pressure = p_cap_ip; variables.phase_pressure = -p_cap_ip; @@ -687,7 +687,7 @@ void ThermoRichardsFlowLocalAssembler:: template void ThermoRichardsFlowLocalAssembler::assemble( double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, std::vector& local_M_data, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_rhs_data) { auto const local_matrix_dim = pressure_size + temperature_size; @@ -704,9 +704,9 @@ void ThermoRichardsFlowLocalAssembler::assemble( Eigen::Map const>(local_xdot.data() + temperature_index, temperature_size); - auto const p_L_dot = Eigen::Map< + auto const p_L_prev = Eigen::Map< typename ShapeMatricesType::template VectorType const>( - local_xdot.data() + pressure_index, pressure_size); + local_x_prev.data() + pressure_index, pressure_size); auto local_K = MathLib::createZeroedMatrix< typename ShapeMatricesType::template MatrixType::assemble( double p_cap_ip; NumLib::shapeFunctionInterpolate(-p_L, N, p_cap_ip); - double p_cap_dot_ip; - NumLib::shapeFunctionInterpolate(-p_L_dot, N, p_cap_dot_ip); + double p_cap_prev_ip; + NumLib::shapeFunctionInterpolate(-p_L_prev, N, p_cap_prev_ip); variables.capillary_pressure = p_cap_ip; variables.phase_pressure = -p_cap_ip; @@ -1204,7 +1204,7 @@ template void ThermoRichardsFlowLocalAssembler:: computeSecondaryVariableConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) + Eigen::VectorXd const& local_x_prev) { auto const T = local_x.template segment(temperature_index); @@ -1214,7 +1214,8 @@ void ThermoRichardsFlowLocalAssembler:: auto const p_L = local_x.template segment(pressure_index); - auto p_L_dot = local_x_dot.template segment(pressure_index); + auto p_L_prev = + local_x_prev.template segment(pressure_index); auto const& medium = *_process_data.media_map->getMedium(_element.getID()); auto const& liquid_phase = medium.phase("AqueousLiquid"); @@ -1246,8 +1247,8 @@ void ThermoRichardsFlowLocalAssembler:: double p_cap_ip; NumLib::shapeFunctionInterpolate(-p_L, N, p_cap_ip); - double p_cap_dot_ip; - NumLib::shapeFunctionInterpolate(-p_L_dot, N, p_cap_dot_ip); + double p_cap_prev_ip; + NumLib::shapeFunctionInterpolate(-p_L_prev, N, p_cap_prev_ip); variables.capillary_pressure = p_cap_ip; variables.phase_pressure = -p_cap_ip; diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM.h b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM.h index 8478acdc518..c1fc4c51db0 100644 --- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM.h +++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM.h @@ -70,18 +70,18 @@ class ThermoRichardsFlowLocalAssembler : public LocalAssemblerInterface void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, std::vector& local_Jac_data) override; void assemble(double const t, double const dt, - std::vector const& local_x, - std::vector const& local_xdot, - std::vector& local_M_data, - std::vector& local_K_data, - std::vector& local_rhs_data) override; + std::vector const& local_x, + std::vector const& local_x_prev, + std::vector& local_M_data, + std::vector& local_K_data, + std::vector& local_rhs_data) override; void initializeConcrete() override { @@ -96,7 +96,7 @@ class ThermoRichardsFlowLocalAssembler : public LocalAssemblerInterface } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override @@ -112,7 +112,7 @@ class ThermoRichardsFlowLocalAssembler : public LocalAssemblerInterface void computeSecondaryVariableConcrete( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) override; + Eigen::VectorXd const& local_x_prev) override; Eigen::Map getShapeMatrix( const unsigned integration_point) const override diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp index 5d74dbeefc0..b52981c5ea1 100644 --- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp +++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp @@ -127,7 +127,7 @@ void ThermoRichardsFlowProcess::setInitialConditionsConcreteProcess( void ThermoRichardsFlowProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble the equations for ThermoRichardsFlowProcess."); @@ -139,13 +139,13 @@ void ThermoRichardsFlowProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } void ThermoRichardsFlowProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { std::vector> @@ -159,8 +159,8 @@ void ThermoRichardsFlowProcess::assembleWithJacobianConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; _pvma.assembleWithJacobian(_local_assemblers, pv.getActiveElementIDs(), - dof_tables, t, dt, x, xdot, process_id, M, K, b, - Jac); + dof_tables, t, dt, x, x_prev, process_id, M, K, + b, Jac); auto copyRhs = [&](int const variable_id, auto& output_vector) { @@ -174,7 +174,7 @@ void ThermoRichardsFlowProcess::assembleWithJacobianConcreteProcess( void ThermoRichardsFlowProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, double const t, double const dt, + std::vector const& x_prev, double const t, double const dt, const int process_id) { if (process_id != 0) @@ -189,13 +189,13 @@ void ThermoRichardsFlowProcess::postTimestepConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerIF::postTimestep, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt, + pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } void ThermoRichardsFlowProcess::computeSecondaryVariableConcrete( const double t, const double dt, std::vector const& x, - GlobalVector const& x_dot, int const process_id) + GlobalVector const& x_prev, int const process_id) { if (process_id != 0) { @@ -209,7 +209,7 @@ void ThermoRichardsFlowProcess::computeSecondaryVariableConcrete( GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerIF::computeSecondaryVariable, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, t, dt, x, x_dot, process_id); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id); } std::vector diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.h b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.h index 8b1eb63d4d4..2f26326caab 100644 --- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.h +++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.h @@ -115,18 +115,18 @@ class ThermoRichardsFlowProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, double const t, double const dt, const int process_id) override; @@ -145,7 +145,7 @@ class ThermoRichardsFlowProcess final : public Process void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) override; std::vector getDOFTables( const int number_of_processes) const; From 6d5589fd8caae5006e9fe9f71fd6faab08736101 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 13:05:50 +0200 Subject: [PATCH 20/47] [PL/TRF] Rewrite FEM-impl to use x_prev Remove some unused T_dot variables as well. --- .../ThermoRichardsFlowFEM-impl.h | 43 +++++++------------ 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM-impl.h b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM-impl.h index e845477930a..e353ec4515b 100644 --- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM-impl.h +++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM-impl.h @@ -244,8 +244,6 @@ void ThermoRichardsFlowLocalAssembler:: double T_ip; NumLib::shapeFunctionInterpolate(T, N, T_ip); - double T_dot_ip; - NumLib::shapeFunctionInterpolate(T_dot, N, T_dot_ip); double p_cap_ip; NumLib::shapeFunctionInterpolate(-p_L, N, p_cap_ip); @@ -296,8 +294,9 @@ void ThermoRichardsFlowLocalAssembler:: // secant derivative from time discretization for storage // use tangent, if secant is not available double const DeltaS_L_Deltap_cap = - (p_cap_dot_ip == 0) ? dS_L_dp_cap - : (S_L - S_L_prev) / (dt * p_cap_dot_ip); + (p_cap_ip == p_cap_prev_ip) + ? dS_L_dp_cap + : (S_L - S_L_prev) / (p_cap_ip - p_cap_prev_ip); auto chi_S_L = S_L; auto chi_S_L_prev = S_L_prev; @@ -325,8 +324,7 @@ void ThermoRichardsFlowLocalAssembler:: // variables.solid_grain_pressure = p_FR; variables.effective_pore_pressure = -chi_S_L * p_cap_ip; - variables_prev.effective_pore_pressure = - -chi_S_L_prev * (p_cap_ip - p_cap_dot_ip * dt); + variables_prev.effective_pore_pressure = -chi_S_L_prev * p_cap_prev_ip; auto& phi = _ip_data[ip].porosity; { // Porosity update @@ -417,8 +415,8 @@ void ThermoRichardsFlowLocalAssembler:: local_Jac .template block(pressure_index, pressure_index) - .noalias() += N.transpose() * p_cap_dot_ip * rho_LR * - dspecific_storage_a_p_dp_cap * N * w; + .noalias() += N.transpose() * (p_cap_ip - p_cap_prev_ip) / dt * + rho_LR * dspecific_storage_a_p_dp_cap * N * w; storage_p_a_S_Jpp.noalias() -= N.transpose() * rho_LR * @@ -662,14 +660,15 @@ void ThermoRichardsFlowLocalAssembler:: // // temperature equation local_rhs.template segment(temperature_index).noalias() -= - M_TT * T_dot + K_TT * T; + M_TT * (T - T_prev) / dt + K_TT * T; local_rhs.template segment(temperature_index).noalias() -= K_Tp * p_L; // pressure equation local_rhs.template segment(pressure_index).noalias() -= laplace_p * p_L + laplace_T * T + - (storage_p_a_p + storage_p_a_S) * p_L_dot + M_pT * T_dot; + (storage_p_a_p + storage_p_a_S) * (p_L - p_L_prev) / dt + + M_pT * (T - T_prev) / dt; if (liquid_phase.hasProperty(MPL::PropertyType::vapour_diffusion) && liquid_phase.hasProperty(MPL::PropertyType::latent_heat)) { @@ -680,7 +679,7 @@ void ThermoRichardsFlowLocalAssembler:: .noalias() += M_Tp / dt; // RHS: temperature part local_rhs.template segment(temperature_index) - .noalias() -= M_Tp * p_L_dot; + .noalias() -= M_Tp * (p_L - p_L_prev) / dt; } } @@ -700,10 +699,6 @@ void ThermoRichardsFlowLocalAssembler::assemble( typename ShapeMatricesType::template VectorType const>( local_x.data() + pressure_index, pressure_size); - auto const T_dot = - Eigen::Map const>(local_xdot.data() + temperature_index, - temperature_size); auto const p_L_prev = Eigen::Map< typename ShapeMatricesType::template VectorType const>( local_x_prev.data() + pressure_index, pressure_size); @@ -747,8 +742,6 @@ void ThermoRichardsFlowLocalAssembler::assemble( double T_ip; NumLib::shapeFunctionInterpolate(T, N, T_ip); - double T_dot_ip; - NumLib::shapeFunctionInterpolate(T_dot, N, T_dot_ip); double p_cap_ip; NumLib::shapeFunctionInterpolate(-p_L, N, p_cap_ip); @@ -798,8 +791,9 @@ void ThermoRichardsFlowLocalAssembler::assemble( // secant derivative from time discretization for storage // use tangent, if secant is not available double const DeltaS_L_Deltap_cap = - (p_cap_dot_ip == 0) ? dS_L_dp_cap - : (S_L - S_L_prev) / (dt * p_cap_dot_ip); + (p_cap_ip == p_cap_prev_ip) + ? dS_L_dp_cap + : (S_L - S_L_prev) / (p_cap_ip - p_cap_prev_ip); auto chi_S_L = S_L; auto chi_S_L_prev = S_L_prev; @@ -821,8 +815,7 @@ void ThermoRichardsFlowLocalAssembler::assemble( // variables.solid_grain_pressure = p_FR; variables.effective_pore_pressure = -chi_S_L * p_cap_ip; - variables_prev.effective_pore_pressure = - -chi_S_L_prev * (p_cap_ip - p_cap_dot_ip * dt); + variables_prev.effective_pore_pressure = -chi_S_L_prev * p_cap_prev_ip; auto& phi = _ip_data[ip].porosity; { // Porosity update @@ -1209,9 +1202,6 @@ void ThermoRichardsFlowLocalAssembler:: auto const T = local_x.template segment(temperature_index); - auto const T_dot = - local_x_dot.template segment(temperature_index); - auto const p_L = local_x.template segment(pressure_index); auto p_L_prev = @@ -1241,8 +1231,6 @@ void ThermoRichardsFlowLocalAssembler:: double T_ip; NumLib::shapeFunctionInterpolate(T, N, T_ip); - double T_dot_ip; - NumLib::shapeFunctionInterpolate(T_dot, N, T_dot_ip); double p_cap_ip; NumLib::shapeFunctionInterpolate(-p_L, N, p_cap_ip); @@ -1277,8 +1265,7 @@ void ThermoRichardsFlowLocalAssembler:: chi_S_L_prev = chi(S_L_prev); } variables.effective_pore_pressure = -chi_S_L * p_cap_ip; - variables_prev.effective_pore_pressure = - -chi_S_L_prev * (p_cap_ip - p_cap_dot_ip * dt); + variables_prev.effective_pore_pressure = -chi_S_L_prev * p_cap_prev_ip; auto const alpha = medium[MPL::PropertyType::biot_coefficient].template value( From dc9b2c9d1784cde7dc328263a416b7c6124a68ff Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Sun, 23 Jul 2023 21:43:12 +0200 Subject: [PATCH 21/47] [PL/LIE/SD] Rename x_dot to x_prev --- .../SmallDeformationLocalAssemblerFracture.h | 2 +- .../SmallDeformationLocalAssemblerInterface.h | 4 ++-- ...mallDeformationLocalAssemblerMatrix-impl.h | 2 +- .../SmallDeformationLocalAssemblerMatrix.h | 4 ++-- ...ormationLocalAssemblerMatrixNearFracture.h | 2 +- .../SmallDeformationProcess.cpp | 22 +++++++++---------- .../SmallDeformationProcess.h | 6 ++--- 7 files changed, 20 insertions(+), 22 deletions(-) diff --git a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerFracture.h b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerFracture.h index fff4ccad50a..82edefc0a21 100644 --- a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerFracture.h +++ b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerFracture.h @@ -64,7 +64,7 @@ class SmallDeformationLocalAssemblerFracture void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/) override diff --git a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerInterface.h b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerInterface.h index 801b5d32262..1aeb8196b81 100644 --- a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerInterface.h +++ b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerInterface.h @@ -41,7 +41,7 @@ class SmallDeformationLocalAssemblerInterface void assembleWithJacobian(double const t, double const dt, std::vector const& local_x_, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, @@ -88,7 +88,7 @@ class SmallDeformationLocalAssemblerInterface void computeSecondaryVariableConcrete( double const t, double const /*dt*/, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& /*local_x_dot*/) override + Eigen::VectorXd const& /*local_x_prev*/) override { if (!_dofIndex_to_localIndex.empty()) { diff --git a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrix-impl.h b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrix-impl.h index a4c616ed74b..a026e2d42d3 100644 --- a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrix-impl.h +++ b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrix-impl.h @@ -91,7 +91,7 @@ template void SmallDeformationLocalAssemblerMatrix:: assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, diff --git a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrix.h b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrix.h index 244c1a28437..44c4cad3d04 100644 --- a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrix.h +++ b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrix.h @@ -61,7 +61,7 @@ class SmallDeformationLocalAssemblerMatrix void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/) override @@ -73,7 +73,7 @@ class SmallDeformationLocalAssemblerMatrix void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, diff --git a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrixNearFracture.h b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrixNearFracture.h index 117b8ca9ea6..d39b8d842a4 100644 --- a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrixNearFracture.h +++ b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerMatrixNearFracture.h @@ -67,7 +67,7 @@ class SmallDeformationLocalAssemblerMatrixNearFracture void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/) override diff --git a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp index 8f5ff3e2a63..a7f644f8b99 100644 --- a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp +++ b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp @@ -530,7 +530,7 @@ void SmallDeformationProcess::initializeConcreteProcess( template void SmallDeformationProcess::computeSecondaryVariableConcrete( double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, int const process_id) + GlobalVector const& x_prev, int const process_id) { DBUG("Compute the secondary variables for SmallDeformationProcess."); std::vector dof_tables; @@ -542,7 +542,7 @@ void SmallDeformationProcess::computeSecondaryVariableConcrete( GlobalExecutor::executeSelectedMemberOnDereferenced( &SmallDeformationLocalAssemblerInterface::computeSecondaryVariable, _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, - x_dot, process_id); + x_prev, process_id); } template @@ -554,7 +554,7 @@ bool SmallDeformationProcess::isLinear() const template void SmallDeformationProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble SmallDeformationProcess."); @@ -566,17 +566,15 @@ void SmallDeformationProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } template void SmallDeformationProcess:: - assembleWithJacobianConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac) + assembleWithJacobianConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian SmallDeformationProcess."); @@ -587,8 +585,8 @@ void SmallDeformationProcess:: dof_table = {std::ref(*_local_to_global_index_map)}; GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } template void SmallDeformationProcess::preTimestepConcreteProcess( diff --git a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.h b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.h index 8677f2f6e4e..068367f35b1 100644 --- a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.h +++ b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.h @@ -48,7 +48,7 @@ class SmallDeformationProcess final : public Process void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) override; private: @@ -63,13 +63,13 @@ class SmallDeformationProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From cfde757aa2043828bf0932ca2a69c9515104a9ca Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 13:14:23 +0200 Subject: [PATCH 22/47] [PL/LIE/HM] Rename x_dot to x_prev --- .../HydroMechanics/HydroMechanicsProcess.cpp | 14 +++++----- .../HydroMechanics/HydroMechanicsProcess.h | 6 ++--- ...ydroMechanicsLocalAssemblerFracture-impl.h | 26 +++++++++---------- .../HydroMechanicsLocalAssemblerFracture.h | 6 ++--- .../HydroMechanicsLocalAssemblerInterface.h | 25 +++++++++--------- .../HydroMechanicsLocalAssemblerMatrix-impl.h | 26 +++++++++---------- .../HydroMechanicsLocalAssemblerMatrix.h | 7 +++-- ...icsLocalAssemblerMatrixNearFracture-impl.h | 23 ++++++++-------- ...echanicsLocalAssemblerMatrixNearFracture.h | 2 +- 9 files changed, 67 insertions(+), 68 deletions(-) diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp index 1384f331e74..657c8db8dfb 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp @@ -451,7 +451,7 @@ void HydroMechanicsProcess::initializeConcreteProcess( template void HydroMechanicsProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, const double t, double const dt, + std::vector const& x_prev, const double t, double const dt, int const process_id) { if (process_id == 0) @@ -469,7 +469,7 @@ void HydroMechanicsProcess::postTimestepConcreteProcess( getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &HydroMechanicsLocalAssemblerInterface::postTimestep, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_dot, + _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } @@ -574,7 +574,7 @@ bool HydroMechanicsProcess::isLinear() const template void HydroMechanicsProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble HydroMechanicsProcess."); @@ -584,13 +584,13 @@ void HydroMechanicsProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - dof_table, t, dt, x, xdot, process_id, M, K, b); + dof_table, t, dt, x, x_prev, process_id, M, K, b); } template void HydroMechanicsProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian HydroMechanicsProcess."); @@ -602,8 +602,8 @@ void HydroMechanicsProcess::assembleWithJacobianConcreteProcess( dof_table = {std::ref(*_local_to_global_index_map)}; GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); auto copyRhs = [&](int const variable_id, auto& output_vector) { diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h index cb9d275dd98..0cc7e433d0a 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h @@ -51,7 +51,7 @@ class HydroMechanicsProcess final : public Process //! @} void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, double const t, double const dt, int const process_id) override; @@ -67,13 +67,13 @@ class HydroMechanicsProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; void preTimestepConcreteProcess(std::vector const& x, diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture-impl.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture-impl.h index 6694e2a1a2f..5310f19be8e 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture-impl.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture-impl.h @@ -125,19 +125,19 @@ HydroMechanicsLocalAssemblerFracture -void HydroMechanicsLocalAssemblerFracture< - ShapeFunctionDisplacement, ShapeFunctionPressure, - GlobalDim>::assembleWithJacobianConcrete(double const t, double const dt, - Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, - Eigen::VectorXd& local_b, - Eigen::MatrixXd& local_J) +void HydroMechanicsLocalAssemblerFracture:: + assembleWithJacobianConcrete(double const t, double const dt, + Eigen::VectorXd const& local_x, + Eigen::VectorXd const& local_x_prev, + Eigen::VectorXd& local_b, + Eigen::MatrixXd& local_J) { auto const p = local_x.segment(pressure_index, pressure_size); - auto const p_dot = local_xdot.segment(pressure_index, pressure_size); + auto const p_prev = local_x_prev.segment(pressure_index, pressure_size); auto const g = local_x.segment(displacement_index, displacement_size); - auto const g_dot = - local_xdot.segment(displacement_index, displacement_size); + auto const g_prev = + local_x_prev.segment(displacement_index, displacement_size); auto rhs_p = local_b.segment(pressure_index, pressure_size); auto rhs_g = local_b.segment(displacement_index, displacement_size); @@ -150,7 +150,7 @@ void HydroMechanicsLocalAssemblerFracture< auto J_gg = local_J.block(displacement_index, displacement_index, displacement_size, displacement_size); - assembleBlockMatricesWithJacobian(t, dt, p, p_dot, g, g_dot, rhs_p, rhs_g, + assembleBlockMatricesWithJacobian(t, dt, p, p_prev, g, g_prev, rhs_p, rhs_g, J_pp, J_pg, J_gg, J_gp); } @@ -161,9 +161,9 @@ void HydroMechanicsLocalAssemblerFracture const& p, - Eigen::Ref const& p_dot, + Eigen::Ref const& p_prev, Eigen::Ref const& g, - Eigen::Ref const& g_dot, + Eigen::Ref const& g_prev, Eigen::Ref rhs_p, Eigen::Ref rhs_g, Eigen::Ref J_pp, Eigen::Ref J_pg, Eigen::Ref J_gg, Eigen::Ref J_gp) diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture.h index b5589d69c3f..68c0e2ebf6b 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture.h @@ -63,16 +63,16 @@ class HydroMechanicsLocalAssemblerFracture private: void assembleWithJacobianConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, + Eigen::VectorXd const& local_x_prev, Eigen::VectorXd& local_b, Eigen::MatrixXd& local_J) override; void assembleBlockMatricesWithJacobian( double const t, double const dt, Eigen::Ref const& p, - Eigen::Ref const& p_dot, + Eigen::Ref const& p_prev, Eigen::Ref const& g, - Eigen::Ref const& g_dot, + Eigen::Ref const& g_prev, Eigen::Ref rhs_p, Eigen::Ref rhs_g, Eigen::Ref J_pp, Eigen::Ref J_pg, Eigen::Ref J_gg, Eigen::Ref J_gp); diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h index 8abab69a84d..b49bfa4bfd4 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h @@ -39,14 +39,14 @@ class HydroMechanicsLocalAssemblerInterface _dofIndex_to_localIndex(std::move(dofIndex_to_localIndex)) { _local_u.resize(n_local_size); - _local_udot.resize(n_local_size); + _local_u_prev.resize(n_local_size); _local_b.resize(_local_u.size()); _local_J.resize(_local_u.size(), _local_u.size()); } void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_rhs_data*/) override @@ -58,7 +58,7 @@ class HydroMechanicsLocalAssemblerInterface void assembleWithJacobian(double const t, double const dt, std::vector const& local_x_, - std::vector const& local_xdot_, + std::vector const& local_x_prev_, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, @@ -71,15 +71,15 @@ class HydroMechanicsLocalAssemblerInterface { _local_u[_dofIndex_to_localIndex[i]] = local_x_[i]; } - _local_udot.setZero(); + _local_u_prev.setZero(); for (unsigned i = 0; i < local_dof_size; i++) { - _local_udot[_dofIndex_to_localIndex[i]] = local_xdot_[i]; + _local_u_prev[_dofIndex_to_localIndex[i]] = local_x_prev_[i]; } _local_b.setZero(); _local_J.setZero(); - assembleWithJacobianConcrete(t, dt, _local_u, _local_udot, _local_b, + assembleWithJacobianConcrete(t, dt, _local_u, _local_u_prev, _local_b, _local_J); local_b_data.resize(local_dof_size); @@ -100,7 +100,7 @@ class HydroMechanicsLocalAssemblerInterface } void postTimestepConcrete(Eigen::VectorXd const& local_x_, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, const double t, double const dt, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override @@ -115,11 +115,10 @@ class HydroMechanicsLocalAssemblerInterface } protected: - virtual void assembleWithJacobianConcrete(double const t, double const dt, - Eigen::VectorXd const& local_u, - Eigen::VectorXd const& local_udot, - Eigen::VectorXd& local_b, - Eigen::MatrixXd& local_J) = 0; + virtual void assembleWithJacobianConcrete( + double const t, double const dt, Eigen::VectorXd const& local_u, + Eigen::VectorXd const& local_u_prev, Eigen::VectorXd& local_b, + Eigen::MatrixXd& local_J) = 0; virtual void postTimestepConcreteWithVector( double const t, double const dt, Eigen::VectorXd const& local_u) = 0; @@ -129,7 +128,7 @@ class HydroMechanicsLocalAssemblerInterface private: Eigen::VectorXd _local_u; - Eigen::VectorXd _local_udot; + Eigen::VectorXd _local_u_prev; Eigen::VectorXd _local_b; Eigen::MatrixXd _local_J; // a vector for mapping the index in the local DoF vector to the index in diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrix-impl.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrix-impl.h index a1fa05c0b73..d8e12c80c70 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrix-impl.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrix-impl.h @@ -110,18 +110,18 @@ HydroMechanicsLocalAssemblerMatrix -void HydroMechanicsLocalAssemblerMatrix< - ShapeFunctionDisplacement, ShapeFunctionPressure, - GlobalDim>::assembleWithJacobianConcrete(double const t, double const dt, - Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot, - Eigen::VectorXd& local_rhs, - Eigen::MatrixXd& local_Jac) +void HydroMechanicsLocalAssemblerMatrix:: + assembleWithJacobianConcrete(double const t, double const dt, + Eigen::VectorXd const& local_x, + Eigen::VectorXd const& local_x_prev, + Eigen::VectorXd& local_rhs, + Eigen::MatrixXd& local_Jac) { auto p = const_cast(local_x).segment(pressure_index, pressure_size); - auto p_dot = const_cast(local_x_dot) - .segment(pressure_index, pressure_size); + auto p_prev = const_cast(local_x_prev) + .segment(pressure_index, pressure_size); if (_process_data.deactivate_matrix_in_flow) { @@ -130,7 +130,7 @@ void HydroMechanicsLocalAssemblerMatrix< } auto u = local_x.segment(displacement_index, displacement_size); - auto u_dot = local_x_dot.segment(displacement_index, displacement_size); + auto u_prev = local_x_prev.segment(displacement_index, displacement_size); auto rhs_p = local_rhs.template segment(pressure_index); auto rhs_u = @@ -145,7 +145,7 @@ void HydroMechanicsLocalAssemblerMatrix< auto J_up = local_Jac.template block( displacement_index, pressure_index); - assembleBlockMatricesWithJacobian(t, dt, p, p_dot, u, u_dot, rhs_p, rhs_u, + assembleBlockMatricesWithJacobian(t, dt, p, p_prev, u, u_prev, rhs_p, rhs_u, J_pp, J_pu, J_uu, J_up); } @@ -156,9 +156,9 @@ void HydroMechanicsLocalAssemblerMatrix const& p, - Eigen::Ref const& p_dot, + Eigen::Ref const& p_prev, Eigen::Ref const& u, - Eigen::Ref const& u_dot, + Eigen::Ref const& u_prev, Eigen::Ref rhs_p, Eigen::Ref rhs_u, Eigen::Ref J_pp, Eigen::Ref J_pu, Eigen::Ref J_uu, Eigen::Ref J_up) diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrix.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrix.h index 8df4a70b128..57b130b9f12 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrix.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrix.h @@ -60,16 +60,16 @@ class HydroMechanicsLocalAssemblerMatrix protected: void assembleWithJacobianConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot, + Eigen::VectorXd const& local_x_prev, Eigen::VectorXd& local_rhs, Eigen::MatrixXd& local_Jac) override; void assembleBlockMatricesWithJacobian( double const t, double const dt, Eigen::Ref const& p, - Eigen::Ref const& p_dot, + Eigen::Ref const& p_prev, Eigen::Ref const& u, - Eigen::Ref const& u_dot, + Eigen::Ref const& u_prev, Eigen::Ref rhs_p, Eigen::Ref rhs_u, Eigen::Ref J_pp, Eigen::Ref J_pu, Eigen::Ref J_uu, Eigen::Ref J_up); @@ -85,7 +85,6 @@ class HydroMechanicsLocalAssemblerMatrix void setPressureOfInactiveNodes( double const t, Eigen::Ref p); - void setPressureDotOfInactiveNodes(Eigen::Ref p_dot); // Types for displacement. using ShapeMatricesTypeDisplacement = diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture-impl.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture-impl.h index 7c80bcd2cc4..8b1728a3a9b 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture-impl.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture-impl.h @@ -47,22 +47,23 @@ void HydroMechanicsLocalAssemblerMatrixNearFracture< ShapeFunctionDisplacement, ShapeFunctionPressure, GlobalDim>::assembleWithJacobianConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot, + Eigen::VectorXd const& + local_x_prev, Eigen::VectorXd& local_b, Eigen::MatrixXd& local_J) { auto p = const_cast(local_x).segment(pressure_index, pressure_size); - auto p_dot = const_cast(local_x_dot) - .segment(pressure_index, pressure_size); + auto p_prev = const_cast(local_x_prev) + .segment(pressure_index, pressure_size); if (_process_data.deactivate_matrix_in_flow) { Base::setPressureOfInactiveNodes(t, p); Base::setPressureDotOfInactiveNodes(p_dot); } auto const u = local_x.segment(displacement_index, displacement_size); - auto const u_dot = - local_x_dot.segment(displacement_index, displacement_size); + auto const u_prev = + local_x_prev.segment(displacement_index, displacement_size); auto rhs_p = local_b.segment(pressure_index, pressure_size); auto rhs_u = local_b.segment(displacement_index, displacement_size); @@ -86,7 +87,7 @@ void HydroMechanicsLocalAssemblerMatrixNearFracture< { // no DoF exists for displacement jumps. do the normal assembly Base::assembleBlockMatricesWithJacobian( - t, dt, p, p_dot, u, u_dot, rhs_p, rhs_u, J_pp, J_pu, J_uu, J_up); + t, dt, p, p_prev, u, u_prev, rhs_p, rhs_u, J_pp, J_pu, J_uu, J_up); return; } @@ -94,14 +95,14 @@ void HydroMechanicsLocalAssemblerMatrixNearFracture< // compute true displacements auto const g = local_x.segment(displacement_jump_index, displacement_size); - auto const g_dot = - local_x_dot.segment(displacement_jump_index, displacement_size); + auto const g_prev = + local_x_prev.segment(displacement_jump_index, displacement_size); Eigen::VectorXd const total_u = u + ele_levelset * g; - Eigen::VectorXd const total_u_dot = u_dot + ele_levelset * g_dot; + Eigen::VectorXd const total_u_prev = u_prev + ele_levelset * g_prev; // evaluate residuals and Jacobians for pressure and displacements - Base::assembleBlockMatricesWithJacobian(t, dt, p, p_dot, total_u, - total_u_dot, rhs_p, rhs_u, J_pp, + Base::assembleBlockMatricesWithJacobian(t, dt, p, p_prev, total_u, + total_u_prev, rhs_p, rhs_u, J_pp, J_pu, J_uu, J_up); // compute residuals and Jacobians for displacement jumps diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture.h index 55e04aca431..7eda7e6e194 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture.h @@ -56,7 +56,7 @@ class HydroMechanicsLocalAssemblerMatrixNearFracture private: void assembleWithJacobianConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot, + Eigen::VectorXd const& local_x_prev, Eigen::VectorXd& local_b, Eigen::MatrixXd& local_J) override; From 1c8a3dc424e548ccf315aa20236d66030f9dd9be Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 13:09:08 +0200 Subject: [PATCH 23/47] [PL/LIE/HM] Rewrite FEM-impl to use x_prev --- ...ydroMechanicsLocalAssemblerFracture-impl.h | 7 +++--- .../HydroMechanicsLocalAssemblerMatrix-impl.h | 22 ++----------------- ...icsLocalAssemblerMatrixNearFracture-impl.h | 1 - 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture-impl.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture-impl.h index 5310f19be8e..9bc993bb05a 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture-impl.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture-impl.h @@ -293,7 +293,8 @@ void HydroMechanicsLocalAssemblerFracture -void HydroMechanicsLocalAssemblerMatrix< - ShapeFunctionDisplacement, ShapeFunctionPressure, - GlobalDim>::setPressureDotOfInactiveNodes(Eigen::Ref p_dot) -{ - for (unsigned i = 0; i < pressure_size; i++) - { - // only inactive nodes - if (_process_data.p_element_status->isActiveNode(_element.getNode(i))) - { - continue; - } - p_dot[i] = 0; - } -} - } // namespace HydroMechanics } // namespace LIE } // namespace ProcessLib diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture-impl.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture-impl.h index 8b1728a3a9b..3b52485d735 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture-impl.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture-impl.h @@ -59,7 +59,6 @@ void HydroMechanicsLocalAssemblerMatrixNearFracture< if (_process_data.deactivate_matrix_in_flow) { Base::setPressureOfInactiveNodes(t, p); - Base::setPressureDotOfInactiveNodes(p_dot); } auto const u = local_x.segment(displacement_index, displacement_size); auto const u_prev = From 3f2728a7ebb25e993275857c4977d679fb3a7124 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Thu, 27 Jul 2023 13:45:11 +0200 Subject: [PATCH 24/47] [PL/TM] Rename x_dot to x_prev --- .../ThermoMechanics/ThermoMechanicsFEM-impl.h | 20 ++++++++--------- .../ThermoMechanics/ThermoMechanicsFEM.h | 16 +++++++------- .../ThermoMechanicsProcess.cpp | 22 +++++++++---------- .../ThermoMechanics/ThermoMechanicsProcess.h | 6 ++--- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h index 4063e154731..9e2873e797c 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h @@ -115,7 +115,7 @@ template void ThermoMechanicsLocalAssembler:: assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -133,8 +133,8 @@ void ThermoMechanicsLocalAssembler:: displacement_size); bool const is_u_non_zero = u.norm() > 0.0; - auto T_dot = Eigen::Map const>(local_xdot.data() + temperature_index, + auto T_prev = Eigen::Map const>(local_x_prev.data() + temperature_index, temperature_size); auto local_Jac = MathLib::createZeroedMatrix( @@ -331,7 +331,7 @@ template void ThermoMechanicsLocalAssembler:: assembleWithJacobianForStaggeredScheme( const double t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, std::vector& local_Jac_data) @@ -340,12 +340,12 @@ void ThermoMechanicsLocalAssembler:: if (process_id == _process_data.heat_conduction_process_id) { assembleWithJacobianForHeatConductionEquations( - t, dt, local_x, local_xdot, local_b_data, local_Jac_data); + t, dt, local_x, local_x_prev, local_b_data, local_Jac_data); return; } // For the equations with deformation - assembleWithJacobianForDeformationEquations(t, dt, local_x, local_xdot, + assembleWithJacobianForDeformationEquations(t, dt, local_x, local_x_prev, local_b_data, local_Jac_data); } @@ -353,14 +353,14 @@ template void ThermoMechanicsLocalAssembler:: assembleWithJacobianForDeformationEquations( const double t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data) { auto const local_T = local_x.template segment(temperature_index); - auto const local_Tdot = - local_xdot.template segment(temperature_index); + auto const local_T_prev = + local_x_prev.template segment(temperature_index); auto const local_u = local_x.template segment(displacement_index); @@ -492,7 +492,7 @@ template void ThermoMechanicsLocalAssembler:: assembleWithJacobianForHeatConductionEquations( const double t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data) { auto const local_T = diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM.h b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM.h index 374c7e51c80..bfa195374e3 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM.h +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM.h @@ -169,7 +169,7 @@ class ThermoMechanicsLocalAssembler void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_rhs_data*/) override @@ -181,14 +181,14 @@ class ThermoMechanicsLocalAssembler void assembleWithJacobianForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) override; void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_rhs_data, @@ -229,7 +229,7 @@ class ThermoMechanicsLocalAssembler } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override @@ -268,7 +268,7 @@ class ThermoMechanicsLocalAssembler * @param dt Time increment * @param local_x Nodal values of \f$x\f$ of all processes of an * element. - * @param local_xdot Nodal values of \f$\dot{x}\f$ of all processes of + * @param local_x_prev Nodal values of \f$x_{prev}\f$ of all processes of * an element. * @param local_b_data Right hand side vector of an element. * @param local_Jac_data Element Jacobian matrix for the Newton-Raphson @@ -277,7 +277,7 @@ class ThermoMechanicsLocalAssembler void assembleWithJacobianForDeformationEquations( const double t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data); /** @@ -294,7 +294,7 @@ class ThermoMechanicsLocalAssembler * @param dt Time increment * @param local_x Nodal values of \f$x\f$ of all processes of an * element. - * @param local_xdot Nodal values of \f$\dot{x}\f$ of all processes of + * @param local_x_prev Nodal values of \f$x_{prev}\f$ of all processes of * an element. * @param local_b_data Right hand side vector of an element. * @param local_Jac_data Element Jacobian matrix for the Newton-Raphson @@ -302,7 +302,7 @@ class ThermoMechanicsLocalAssembler */ void assembleWithJacobianForHeatConductionEquations( const double t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data); std::size_t setSigma(double const* values); diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp index 3a6208beb36..65251dd5cec 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp @@ -204,7 +204,7 @@ void ThermoMechanicsProcess::initializeBoundaryConditions() template void ThermoMechanicsProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble ThermoMechanicsProcess."); @@ -216,18 +216,16 @@ void ThermoMechanicsProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } template void ThermoMechanicsProcess:: - assembleWithJacobianConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac) + assembleWithJacobianConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleJacobian ThermoMechanicsProcess."); @@ -277,8 +275,8 @@ void ThermoMechanicsProcess:: GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, + x_prev, process_id, M, K, b, Jac); // TODO (naumov): Refactor the copy rhs part. This is copy from HM. auto copyRhs = [&](int const variable_id, auto& output_vector) @@ -332,7 +330,7 @@ void ThermoMechanicsProcess::preTimestepConcreteProcess( template void ThermoMechanicsProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, double const t, double const dt, + std::vector const& x_prev, double const t, double const dt, int const process_id) { if (process_id != 0) @@ -352,7 +350,7 @@ void ThermoMechanicsProcess::postTimestepConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::postTimestep, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt, + pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.h b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.h index fc1046dcce1..c4b2e6624c2 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.h +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.h @@ -69,13 +69,13 @@ class ThermoMechanicsProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; @@ -84,7 +84,7 @@ class ThermoMechanicsProcess final : public Process const int process_id) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) override; From 793a324c734391f79e23714e0d94f1f7ea2c5428 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 13:11:00 +0200 Subject: [PATCH 25/47] [PL/TM] Rewrite FEM-impl to use x_prev --- .../ThermoMechanics/ThermoMechanicsFEM-impl.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h index 9e2873e797c..7521b60d07e 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h @@ -193,7 +193,7 @@ void ThermoMechanicsLocalAssembler:: auto& state = _ip_data[ip].material_state_variables; const double T_ip = N.dot(T); // T at integration point - double const dT = N.dot(T_dot) * dt; + double const T_prev_ip = N.dot(T_prev); // Consider also anisotropic thermal expansion. auto const solid_linear_thermal_expansivity_vector = @@ -204,8 +204,8 @@ void ThermoMechanicsLocalAssembler:: .value(variables, x_position, t, dt)); MathLib::KelvinVector::KelvinVectorType const - dthermal_strain = - solid_linear_thermal_expansivity_vector.eval() * dT; + dthermal_strain = solid_linear_thermal_expansivity_vector.eval() * + (T_ip - T_prev_ip); // // displacement equation, displacement part @@ -324,7 +324,7 @@ void ThermoMechanicsLocalAssembler:: .noalias() -= KuT; local_rhs.template block(temperature_index, 0) - .noalias() -= KTT * T + DTT * T_dot; + .noalias() -= KTT * T + DTT * (T - T_prev) / dt; } template @@ -413,8 +413,8 @@ void ThermoMechanicsLocalAssembler:: auto& state = _ip_data[ip].material_state_variables; const double T_ip = N.dot(local_T); // T at integration point - double const dT_ip = N.dot(local_Tdot) * dt; variables.temperature = T_ip; + double const dT_ip = T_ip - N.dot(local_T_prev); // // displacement equation, displacement part @@ -498,8 +498,8 @@ void ThermoMechanicsLocalAssembler:: auto const local_T = local_x.template segment(temperature_index); - auto const local_dT = - local_xdot.template segment(temperature_index) * dt; + auto const local_T_prev = + local_x_prev.template segment(temperature_index); auto local_Jac = MathLib::createZeroedMatrix< typename ShapeMatricesType::template MatrixType:: } local_Jac.noalias() += laplace + mass / dt; - local_rhs.noalias() -= laplace * local_T + mass * local_dT / dt; + local_rhs.noalias() -= + laplace * local_T + mass * (local_T - local_T_prev) / dt; } template From 72d0ed4c3ae752f1bd347fdd0466aa3eabf83fda Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Sun, 23 Jul 2023 23:13:06 +0200 Subject: [PATCH 26/47] [PL/TH2M] Rename x_dot to x_prev --- ProcessLib/TH2M/TH2MFEM-impl.h | 53 +++++++++++++++++---------------- ProcessLib/TH2M/TH2MFEM.h | 10 +++---- ProcessLib/TH2M/TH2MProcess.cpp | 16 +++++----- ProcessLib/TH2M/TH2MProcess.h | 8 ++--- 4 files changed, 44 insertions(+), 43 deletions(-) diff --git a/ProcessLib/TH2M/TH2MFEM-impl.h b/ProcessLib/TH2M/TH2MFEM-impl.h index 8259c29c8c0..b96c828df37 100644 --- a/ProcessLib/TH2M/TH2MFEM-impl.h +++ b/ProcessLib/TH2M/TH2MFEM-impl.h @@ -90,7 +90,7 @@ template > TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim>:: updateConstitutiveVariables(Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot, + Eigen::VectorXd const& local_x_prev, double const t, double const dt) { [[maybe_unused]] auto const matrix_size = @@ -107,8 +107,8 @@ std::vector> TH2MLocalAssembler< auto const temperature = local_x.template segment(temperature_index); - auto const temperature_dot = - local_x_dot.template segment(temperature_index); + auto const temperature_prev = + local_x_prev.template segment(temperature_index); auto const displacement = local_x.template segment(displacement_index); @@ -148,8 +148,7 @@ std::vector> TH2MLocalAssembler< _element, Nu); double const T = NT.dot(temperature); - double const T_dot = NT.dot(temperature_dot); - double const T_prev = T - T_dot * dt; + double const T_prev = NT.dot(temperature_prev); double const pGR = Np.dot(gas_pressure); double const pCap = Np.dot(capillary_pressure); double const pLR = pGR - pCap; @@ -1005,7 +1004,7 @@ void TH2MLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim>::assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& local_x_dot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_rhs_data) @@ -1018,9 +1017,9 @@ void TH2MLocalAssembler< Eigen::Map const>( local_x.data() + capillary_pressure_index, capillary_pressure_size); - auto const capillary_pressure_dot = + auto const capillary_pressure_prev = Eigen::Map const>( - local_x_dot.data() + capillary_pressure_index, + local_x_prev.data() + capillary_pressure_index, capillary_pressure_size); // pointer to local_M_data vector @@ -1105,8 +1104,8 @@ void TH2MLocalAssembler< auto const ip_constitutive_variables = updateConstitutiveVariables( Eigen::Map(local_x.data(), local_x.size()), - Eigen::Map(local_x_dot.data(), - local_x_dot.size()), + Eigen::Map(local_x_prev.data(), + local_x_prev.size()), t, dt); for (unsigned int_point = 0; int_point < n_integration_points; int_point++) @@ -1154,7 +1153,7 @@ void TH2MLocalAssembler< auto const BuT = Bu.transpose().eval(); double const pCap = Np.dot(capillary_pressure); - double const pCap_dot = Np.dot(capillary_pressure_dot); + double const pCap_prev = Np.dot(capillary_pressure_prev); auto& beta_T_SR = ip.beta_T_SR; @@ -1414,7 +1413,7 @@ void TH2MLocalAssembler:: assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -1434,21 +1433,22 @@ void TH2MLocalAssembler const>( local_x.data() + capillary_pressure_index, capillary_pressure_size); - auto const gas_pressure_dot = + auto const gas_pressure_prev = Eigen::Map const>( - local_xdot.data() + gas_pressure_index, gas_pressure_size); + local_x_prev.data() + gas_pressure_index, gas_pressure_size); - auto const capillary_pressure_dot = + auto const capillary_pressure_prev = Eigen::Map const>( - local_xdot.data() + capillary_pressure_index, + local_x_prev.data() + capillary_pressure_index, capillary_pressure_size); - auto const temperature_dot = Eigen::Map const>( - local_xdot.data() + temperature_index, temperature_size); + auto const temperature_prev = + Eigen::Map const>( + local_x_prev.data() + temperature_index, temperature_size); - auto const displacement_dot = + auto const displacement_prev = Eigen::Map const>( - local_xdot.data() + displacement_index, displacement_size); + local_x_prev.data() + displacement_index, displacement_size); auto local_Jac = MathLib::createZeroedMatrix>( @@ -1532,7 +1532,8 @@ void TH2MLocalAssembler(local_x.data(), local_x.size()), - Eigen::Map(local_xdot.data(), local_xdot.size()), + Eigen::Map(local_x_prev.data(), + local_x_prev.size()), t, dt); for (unsigned int_point = 0; int_point < n_integration_points; int_point++) @@ -1586,9 +1587,9 @@ void TH2MLocalAssembler:: computeSecondaryVariableConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) + Eigen::VectorXd const& local_x_prev) { auto const gas_pressure = local_x.template segment(gas_pressure_index); @@ -2377,7 +2378,7 @@ void TH2MLocalAssembler void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_rhs_data*/) override; void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -153,7 +153,7 @@ class TH2MLocalAssembler : public LocalAssemblerInterface } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override @@ -169,7 +169,7 @@ class TH2MLocalAssembler : public LocalAssemblerInterface void computeSecondaryVariableConcrete( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) override; + Eigen::VectorXd const& local_x_prev) override; Eigen::Map getShapeMatrix( const unsigned integration_point) const override @@ -213,7 +213,7 @@ class TH2MLocalAssembler : public LocalAssemblerInterface std::vector> updateConstitutiveVariables(Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot, + Eigen::VectorXd const& local_x_prev, double const t, double const dt); std::size_t setSigma(double const* values) diff --git a/ProcessLib/TH2M/TH2MProcess.cpp b/ProcessLib/TH2M/TH2MProcess.cpp index 57c2071bc87..5eccd6975f1 100644 --- a/ProcessLib/TH2M/TH2MProcess.cpp +++ b/ProcessLib/TH2M/TH2MProcess.cpp @@ -353,19 +353,19 @@ void TH2MProcess::setInitialConditionsConcreteProcess( template void TH2MProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble the equations for TH2M"); - AssemblyMixin>::assemble(t, dt, x, xdot, + AssemblyMixin>::assemble(t, dt, x, x_prev, process_id, M, K, b); } template void TH2MProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { if (!_use_monolithic_scheme) @@ -374,7 +374,7 @@ void TH2MProcess::assembleWithJacobianConcreteProcess( } AssemblyMixin>::assembleWithJacobian( - t, dt, x, xdot, process_id, M, K, b, Jac); + t, dt, x, x_prev, process_id, M, K, b, Jac); } template @@ -402,7 +402,7 @@ void TH2MProcess::preTimestepConcreteProcess( template void TH2MProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, double const t, double const dt, + std::vector const& x_prev, double const t, double const dt, const int process_id) { DBUG("PostTimestep TH2MProcess."); @@ -410,14 +410,14 @@ void TH2MProcess::postTimestepConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::postTimestep, - local_assemblers_, pv.getActiveElementIDs(), dof_tables, x, x_dot, t, + local_assemblers_, pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } template void TH2MProcess::computeSecondaryVariableConcrete( double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, const int process_id) + GlobalVector const& x_prev, const int process_id) { if (process_id != 0) { @@ -431,7 +431,7 @@ void TH2MProcess::computeSecondaryVariableConcrete( GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::computeSecondaryVariable, local_assemblers_, pv.getActiveElementIDs(), dof_tables, t, dt, x, - x_dot, process_id); + x_prev, process_id); } template diff --git a/ProcessLib/TH2M/TH2MProcess.h b/ProcessLib/TH2M/TH2MProcess.h index 31444130faa..ea41d7e5d53 100644 --- a/ProcessLib/TH2M/TH2MProcess.h +++ b/ProcessLib/TH2M/TH2MProcess.h @@ -82,13 +82,13 @@ class TH2MProcess final : public Process, void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; @@ -97,7 +97,7 @@ class TH2MProcess final : public Process, const int process_id) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const /*process_id*/) override; @@ -133,7 +133,7 @@ class TH2MProcess final : public Process, void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, const int process_id) override; /** * @copydoc ProcessLib::Process::getDOFTableForExtrapolatorData() From bf8f227ca363c7b0cff67808c277936bca2aabe1 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 14:17:44 +0200 Subject: [PATCH 27/47] [PL/TH2M] Rewrite FEM-impl to use x_prev --- ProcessLib/TH2M/TH2MFEM-impl.h | 56 +++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/ProcessLib/TH2M/TH2MFEM-impl.h b/ProcessLib/TH2M/TH2MFEM-impl.h index b96c828df37..03b9175f787 100644 --- a/ProcessLib/TH2M/TH2MFEM-impl.h +++ b/ProcessLib/TH2M/TH2MFEM-impl.h @@ -280,7 +280,7 @@ std::vector> TH2MLocalAssembler< ip_data.beta_T_SR = Invariants::trace(ip_data.alpha_T_SR); MathLib::KelvinVector::KelvinVectorType const - dthermal_strain = ip_data.alpha_T_SR * T_dot * dt; + dthermal_strain = ip_data.alpha_T_SR * (T - T_prev); auto& eps_prev = ip_data.eps_prev; auto& eps_m = ip_data.eps_m; @@ -988,8 +988,8 @@ void TH2MLocalAssembler const>( local_x.data() + capillary_pressure_index, capillary_pressure_size); + auto const displacement = Eigen::Map const>( + local_x.data() + displacement_index, displacement_size); + auto const gas_pressure_prev = Eigen::Map const>( local_x_prev.data() + gas_pressure_index, gas_pressure_size); @@ -1579,9 +1582,12 @@ void TH2MLocalAssembler(C_index, temperature_index) - .noalias() += NpT * ip_cv.dfC_4_MCT_dT * T_dot * NT * w; + .noalias() += NpT * ip_cv.dfC_4_MCT_dT * (T - T_prev) / dt * NT * w; MCu.noalias() += NpT * rho_C_FR * alpha_B * mT * Bu * w; // d (fC_4_MCu * u_dot)/d T @@ -1724,13 +1730,14 @@ void TH2MLocalAssembler(C_index, C_index).noalias() += - NpT * ip_cv.dfC_4_MCpG_dp_GR * pGR_dot * Np * w; + NpT * ip_cv.dfC_4_MCpG_dp_GR * (pGR - pGR_prev) / dt * Np * w; // d (fC_4_MCpG * p_GR_dot)/d T local_Jac .template block(C_index, temperature_index) - .noalias() += NpT * ip_cv.dfC_4_MCpG_dT * pGR_dot * NT * w; + .noalias() += + NpT * ip_cv.dfC_4_MCpG_dT * (pGR - pGR_prev) / dt * NT * w; LCpC.noalias() -= gradNpT * (advection_C_L + diffusion_C_L_p) * gradNp * w; @@ -1824,13 +1831,13 @@ void TH2MLocalAssembler(C_index, C_index).noalias() += LCpG + MCpG / dt; @@ -2139,9 +2148,11 @@ void TH2MLocalAssembler(W_index, W_index).noalias() += LWpC + MWpC / dt; @@ -2156,7 +2167,8 @@ void TH2MLocalAssembler(temperature_index, From 70d40fb9f7388b413d27e3cf7bcdb2ea7f861303 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Sun, 23 Jul 2023 23:13:32 +0200 Subject: [PATCH 28/47] [PL/TRM] Rename x_dot to x_prev --- .../ConstitutiveCommon/Base.h | 4 +- .../ConstitutiveCommon/TRMStorage.cpp | 2 +- .../LocalAssemblerInterface.h | 2 +- .../ThermoRichardsMechanicsFEM-impl.h | 40 +++++++++---------- .../ThermoRichardsMechanicsFEM.h | 8 ++-- .../ThermoRichardsMechanicsProcess.cpp | 22 +++++----- .../ThermoRichardsMechanicsProcess.h | 8 ++-- 7 files changed, 42 insertions(+), 44 deletions(-) diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Base.h b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Base.h index 2966a2c8226..0b0ffbbf812 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Base.h +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Base.h @@ -100,7 +100,7 @@ template struct TemperatureData { double T; - double T_dot; + double T_prev; Eigen::Vector grad_T; }; @@ -108,7 +108,7 @@ template struct CapillaryPressureData { double p_cap; - double p_cap_dot; + double p_cap_prev; Eigen::Vector grad_p_cap; }; diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.cpp index d72e2299d78..f2efc3766d2 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.cpp @@ -23,7 +23,7 @@ void TRMStorageModel::eval( TRMStorageData& out) const { double const p_cap = p_cap_data.p_cap; - double const p_cap_dot = p_cap_data.p_cap_dot; + double const p_cap_prev = p_cap_data.p_cap_prev; double const phi = poro_data.phi; double const alphaB_minus_phi = biot_data() - phi; diff --git a/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h b/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h index 00df335d690..8946a30b6f5 100644 --- a/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h +++ b/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h @@ -144,7 +144,7 @@ struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface, } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h index 63922804232..f2b7866c6f1 100644 --- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h +++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h @@ -160,7 +160,7 @@ void ThermoRichardsMechanicsLocalAssembler:: assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -187,8 +187,8 @@ void ThermoRichardsMechanicsLocalAssemblerelement_, ip_data_[ip].N_u))}; assembleWithJacobianSingleIP( - t, dt, x_position, // - local_x, local_xdot, // + t, dt, x_position, // + local_x, local_x_prev, // ip_data_[ip], constitutive_setting, medium, // loc_mat_current_ip, // @@ -199,7 +199,7 @@ void ThermoRichardsMechanicsLocalAssembler const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, typename ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, DisplacementDim, ConstitutiveTraits>::LocalMatrices const& loc_mat, @@ -271,7 +271,7 @@ void ThermoRichardsMechanicsLocalAssembler const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, typename ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, DisplacementDim, ConstitutiveTraits>::IpData const& ip_data, @@ -322,7 +322,7 @@ void ThermoRichardsMechanicsLocalAssembleris_axially_symmetric_); auto const [T, p_L, u] = localDOF(local_x); - auto const [T_dot, p_L_dot, u_dot] = localDOF(local_xdot); + auto const [T_prev, p_L_prev, u_prev] = localDOF(local_x_prev); GlobalDimVectorType const grad_T_ip = dNdx * T; @@ -333,10 +333,10 @@ void ThermoRichardsMechanicsLocalAssembler:: computeSecondaryVariableConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) + Eigen::VectorXd const& local_x_prev) { auto const T = block_T(local_x); auto const p_L = block_p(local_x); auto const u = block_u(local_x); - auto const T_dot = block_T(local_x_dot); - auto const p_L_dot = block_p(local_x_dot); - auto const u_dot = block_u(local_x_dot); + auto const T_prev = block_T(local_x_prev); + auto const p_L_prev = block_p(local_x_prev); + auto const u_prev = block_u(local_x_prev); auto const e_id = this->element_.getID(); auto const& process_data = this->process_data_; @@ -511,11 +511,11 @@ void ThermoRichardsMechanicsLocalAssembleris_axially_symmetric_); double const T_ip = N * T; - double const T_dot_ip = N * T_dot; + double const T_prev_ip = N * T_prev; GlobalDimVectorType const grad_T_ip = dNdx * T; double const p_cap_ip = -N * p_L; - double const p_cap_dot_ip = -N * p_L_dot; + double const p_cap_prev_ip = -N * p_L_prev; GlobalDimVectorType const grad_p_cap_ip = -dNdx * p_L; KelvinVectorType eps = B * u; diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM.h b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM.h index 3d01685f427..b5845a806db 100644 --- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM.h +++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM.h @@ -242,7 +242,7 @@ class ThermoRichardsMechanicsLocalAssembler void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -253,7 +253,7 @@ class ThermoRichardsMechanicsLocalAssembler double const t, double const dt, ParameterLib::SpatialPosition const& x_position, std::vector const& local_x, - std::vector const& local_xdot, IpData const& ip_data, + std::vector const& local_x_prev, IpData const& ip_data, typename ConstitutiveTraits::ConstitutiveSetting& CS, MaterialPropertyLib::Medium& medium, LocalMatrices& out, typename ConstitutiveTraits::StatefulData& current_state, @@ -263,7 +263,7 @@ class ThermoRichardsMechanicsLocalAssembler void addToLocalMatrixData(double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, LocalMatrices const& loc_mat, std::vector& local_rhs_data, std::vector& local_Jac_data) const; @@ -334,7 +334,7 @@ class ThermoRichardsMechanicsLocalAssembler void computeSecondaryVariableConcrete( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) override; + Eigen::VectorXd const& local_x_prev) override; Eigen::Map getShapeMatrix( const unsigned integration_point) const override diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp index e0f37329c63..63755251188 100644 --- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp @@ -224,7 +224,7 @@ template void ThermoRichardsMechanicsProcess:: assembleConcreteProcess(const double /*t*/, double const /*dt*/, std::vector const& /*x*/, - std::vector const& /*xdot*/, + std::vector const& /*x_prev*/, int const /*process_id*/, GlobalMatrix& /*M*/, GlobalMatrix& /*K*/, GlobalVector& /*b*/) { @@ -236,16 +236,14 @@ void ThermoRichardsMechanicsProcess:: template void ThermoRichardsMechanicsProcess:: - assembleWithJacobianConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac) + assembleWithJacobianConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { AssemblyMixin>::assembleWithJacobian(t, dt, x, - xdot, + x_prev, process_id, M, K, b, Jac); @@ -283,7 +281,7 @@ ThermoRichardsMechanicsProcess:: template void ThermoRichardsMechanicsProcess:: postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, double const t, double const dt, const int process_id) { @@ -294,7 +292,7 @@ void ThermoRichardsMechanicsProcess:: ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerIF::postTimestep, local_assemblers_, - pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt, + pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } @@ -302,7 +300,7 @@ template void ThermoRichardsMechanicsProcess:: computeSecondaryVariableConcrete(const double t, const double dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) { DBUG("Compute the secondary variables for ThermoRichardsMechanicsProcess."); @@ -313,7 +311,7 @@ void ThermoRichardsMechanicsProcess:: GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerIF::computeSecondaryVariable, local_assemblers_, - pv.getActiveElementIDs(), dof_tables, t, dt, x, x_dot, process_id); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id); } template diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.h b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.h index c25db50b506..aaba5800317 100644 --- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.h +++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.h @@ -175,13 +175,13 @@ class ThermoRichardsMechanicsProcess final void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; @@ -191,7 +191,7 @@ class ThermoRichardsMechanicsProcess final const int /*process_id*/) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, double const t, double const dt, const int process_id) override; @@ -224,7 +224,7 @@ class ThermoRichardsMechanicsProcess final void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) override; /** * @copydoc ProcessLib::Process::getDOFTableForExtrapolatorData() From a11f581c7ff861241bd3324cdf14c7f61ba50500 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 14:20:36 +0200 Subject: [PATCH 29/47] [PL/TRM] Rewrite FEM-impl/const.rels to use x_prev --- .../ConstitutiveCommon/Porosity.cpp | 3 +- .../ConstitutiveCommon/TRMStorage.cpp | 8 +++--- .../ConstitutiveCommon/TransportPorosity.cpp | 3 +- .../ElasticTangentStiffnessModel.cpp | 4 +-- .../SolidMechanics.cpp | 9 ++---- .../ElasticTangentStiffnessModel.cpp | 4 +-- .../SolidMechanics.cpp | 4 +-- .../ThermoRichardsMechanicsFEM-impl.h | 28 ++++++++++--------- 8 files changed, 27 insertions(+), 36 deletions(-) diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Porosity.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Porosity.cpp index 3fb541021ff..876f811aac8 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Porosity.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/Porosity.cpp @@ -43,8 +43,7 @@ void PorosityModel::eval( // Used in MaterialLib/MPL/Properties/PorosityFromMassBalance.cpp // and MaterialLib/MPL/Properties/TransportPorosityFromMassBalance.cpp variables_prev.effective_pore_pressure = - -bishops_data_prev.chi_S_L * - (p_cap_data.p_cap - p_cap_data.p_cap_dot * x_t.dt); + -bishops_data_prev.chi_S_L * p_cap_data.p_cap_prev; // Used in MaterialLib/MPL/Properties/PorosityFromMassBalance.cpp // and MaterialLib/MPL/Properties/TransportPorosityFromMassBalance.cpp diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.cpp index f2efc3766d2..d15c51bba4f 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TRMStorage.cpp @@ -44,15 +44,15 @@ void TRMStorageModel::eval( // secant derivative from time discretization for storage // use tangent, if secant is not available double const DeltaS_L_Deltap_cap = - (p_cap_dot == 0) + (p_cap == p_cap_prev) ? dS_L_data.dS_L_dp_cap - : (S_L_data.S_L - S_L_prev_data.S_L) / (x_t.dt * p_cap_dot); + : (S_L_data.S_L - S_L_prev_data.S_L) / (p_cap - p_cap_prev); out.storage_p_a_p = rho_L_data.rho_LR * specific_storage_a_p; out.storage_p_a_S_X_NTN = -rho_L_data.rho_LR * specific_storage_a_S * DeltaS_L_Deltap_cap; - out.J_pp_X_NTN = - p_cap_dot * rho_L_data.rho_LR * dspecific_storage_a_p_dp_cap; + out.J_pp_X_NTN = (p_cap - p_cap_prev) / x_t.dt * rho_L_data.rho_LR * + dspecific_storage_a_p_dp_cap; out.storage_p_a_S_Jpp_X_NTN = -rho_L_data.rho_LR * ((S_L_data.S_L - S_L_prev_data.S_L) * dspecific_storage_a_S_dp_cap + diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TransportPorosity.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TransportPorosity.cpp index be18fd70a13..9c9f81f43e8 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TransportPorosity.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveCommon/TransportPorosity.cpp @@ -58,8 +58,7 @@ void TransportPorosityModel::eval( // Used in MaterialLib/MPL/Properties/PorosityFromMassBalance.cpp // and MaterialLib/MPL/Properties/TransportPorosityFromMassBalance.cpp variables_prev.effective_pore_pressure = - -bishops_data_prev.chi_S_L * - (p_cap_data.p_cap - p_cap_data.p_cap_dot * x_t.dt); + -bishops_data_prev.chi_S_L * p_cap_data.p_cap_prev; transport_poro_data.phi = medium.property(MPL::PropertyType::transport_porosity) diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ElasticTangentStiffnessModel.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ElasticTangentStiffnessModel.cpp index 846595e7e79..d100fa99b5c 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ElasticTangentStiffnessModel.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/ElasticTangentStiffnessModel.cpp @@ -49,9 +49,7 @@ void ElasticTangentStiffnessModel::eval( variable_array_prev.liquid_phase_pressure = 0.0; // external state variables - // Compute previous temperature by linearly following T_dot over the - // past timestep. - variable_array_prev.temperature = T_data.T - T_data.T_dot * x_t.dt; + variable_array_prev.temperature = T_data.T_prev; } auto&& solution = solid_material_.integrateStress( diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/SolidMechanics.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/SolidMechanics.cpp index 735c2a9924a..3e123e6b6a9 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/SolidMechanics.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStressSaturation_StrainPressureTemperature/SolidMechanics.cpp @@ -32,12 +32,7 @@ void SolidMechanicsModel::eval( { namespace MPL = MaterialPropertyLib; - double const dT = T_data.T_dot * x_t.dt; - double const T_prev = T_data.T - dT; - - double const dp_cap = p_cap_data.p_cap_dot * x_t.dt; - double const p_cap_prev = p_cap_data.p_cap - dp_cap; - double const p_L_prev = -p_cap_prev; + double const T_prev = T_data.T_prev; // This constitutive setting does not need eps_m. But eps_m is there, // because it is set in setInitialConditionsConcrete() @@ -70,7 +65,7 @@ void SolidMechanicsModel::eval( // gradients // TODO currently we always pass strain via mechanical_strain variables_prev.mechanical_strain = eps_total_prev; - variables_prev.liquid_phase_pressure = p_L_prev; + variables_prev.liquid_phase_pressure = -p_cap_data.p_cap_prev; // external state variables variables_prev.temperature = T_prev; diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/ElasticTangentStiffnessModel.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/ElasticTangentStiffnessModel.cpp index 9b29a24479e..27c2e77ea86 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/ElasticTangentStiffnessModel.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/ElasticTangentStiffnessModel.cpp @@ -37,9 +37,7 @@ void ElasticTangentStiffnessModel::eval( variable_array_prev.stress.emplace(KV::Zero()); variable_array_prev.mechanical_strain.emplace(KV::Zero()); - // Compute previous temperature by linearly following T_dot over the past - // timestep. - variable_array_prev.temperature = T_data.T - T_data.T_dot * x_t.dt; + variable_array_prev.temperature = T_data.T_prev; auto&& solution = solid_material_.integrateStress( variable_array_prev, variable_array, x_t.t, x_t.x, x_t.dt, *null_state); diff --git a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/SolidMechanics.cpp b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/SolidMechanics.cpp index 4b7320f7a44..b262489a0fa 100644 --- a/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/SolidMechanics.cpp +++ b/ProcessLib/ThermoRichardsMechanics/ConstitutiveStress_StrainTemperature/SolidMechanics.cpp @@ -36,8 +36,8 @@ void SolidMechanicsModel::eval( namespace MPL = MaterialPropertyLib; MPL::VariableArray variables; - double const dT = T_data.T_dot * x_t.dt; - double const T_prev = T_data.T - dT; + double const T_prev = T_data.T_prev; + double const dT = T_data.T - T_prev; current_state.eps_m.noalias() = prev_state.eps_m + eps_data.eps - eps_prev_data.eps - diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h index f2b7866c6f1..90686b76ee8 100644 --- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h +++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM-impl.h @@ -273,12 +273,14 @@ void ThermoRichardsMechanicsLocalAssemblerprev_states_[ip], this->material_states_[ip], tmp, output_data, CD); From 0a4934a6c452d9f77df69437d63349a2be652939 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Mon, 24 Jul 2023 09:38:55 +0200 Subject: [PATCH 30/47] [PL/RM] Rename x_dot to x_prev --- .../RichardsMechanicsFEM-impl.h | 51 ++++++++++--------- .../RichardsMechanics/RichardsMechanicsFEM.h | 18 +++---- .../RichardsMechanicsProcess.cpp | 26 +++++----- .../RichardsMechanicsProcess.h | 8 +-- 4 files changed, 51 insertions(+), 52 deletions(-) diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h index 6bcdd9710f9..62dc7d38b65 100644 --- a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h +++ b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h @@ -356,7 +356,7 @@ void RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim>::assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_rhs_data) @@ -373,14 +373,14 @@ void RichardsMechanicsLocalAssembler< displacement_size> const>(local_x.data() + displacement_index, displacement_size); - auto p_L_dot = + auto p_L_prev = Eigen::Map const>(local_xdot.data() + pressure_index, + pressure_size> const>(local_x_prev.data() + pressure_index, pressure_size); - auto u_dot = + auto u_prev = Eigen::Map const>(local_xdot.data() + displacement_index, + displacement_size> const>(local_x_prev.data() + displacement_index, displacement_size); auto K = MathLib::createZeroedMatrix< @@ -448,8 +448,8 @@ void RichardsMechanicsLocalAssembler< double p_cap_ip; NumLib::shapeFunctionInterpolate(-p_L, N_p, p_cap_ip); - double p_cap_dot_ip; - NumLib::shapeFunctionInterpolate(-p_L_dot, N_p, p_cap_dot_ip); + double p_cap_prev_ip; + NumLib::shapeFunctionInterpolate(-p_L_prev, N_p, p_cap_prev_ip); variables.capillary_pressure = p_cap_ip; variables.phase_pressure = -p_cap_ip; @@ -690,7 +690,7 @@ void RichardsMechanicsLocalAssembler:: assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -708,13 +708,13 @@ void RichardsMechanicsLocalAssembler const>(local_x.data() + displacement_index, displacement_size); - auto p_L_dot = + auto p_L_prev = Eigen::Map const>(local_xdot.data() + pressure_index, + pressure_size> const>(local_x_prev.data() + pressure_index, pressure_size); - auto u_dot = + auto u_prev = Eigen::Map const>(local_xdot.data() + displacement_index, + displacement_size> const>(local_x_prev.data() + displacement_index, displacement_size); auto local_Jac = MathLib::createZeroedMatrix< @@ -796,8 +796,8 @@ void RichardsMechanicsLocalAssembler& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/, @@ -1476,7 +1476,7 @@ void RichardsMechanicsLocalAssembler& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/, @@ -1491,21 +1491,21 @@ void RichardsMechanicsLocalAssembler:: assembleWithJacobianForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) { // For the equations with pressure if (process_id == 0) { - assembleWithJacobianForPressureEquations(t, dt, local_x, local_xdot, + assembleWithJacobianForPressureEquations(t, dt, local_x, local_x_prev, local_M_data, local_K_data, local_b_data, local_Jac_data); return; } // For the equations with deformation - assembleWithJacobianForDeformationEquations(t, dt, local_x, local_xdot, + assembleWithJacobianForDeformationEquations(t, dt, local_x, local_x_prev, local_M_data, local_K_data, local_b_data, local_Jac_data); } @@ -1516,14 +1516,15 @@ void RichardsMechanicsLocalAssembler:: computeSecondaryVariableConcrete(double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) + Eigen::VectorXd const& local_x_prev) { auto p_L = local_x.template segment(pressure_index); auto u = local_x.template segment(displacement_index); - auto p_L_dot = local_x_dot.template segment(pressure_index); - auto u_dot = - local_x_dot.template segment(displacement_index); + auto p_L_prev = + local_x_prev.template segment(pressure_index); + auto u_prev = + local_x_prev.template segment(displacement_index); auto const& identity2 = MathLib::KelvinVector::Invariants< MathLib::KelvinVector::kelvin_vector_dimensions( @@ -1567,8 +1568,8 @@ void RichardsMechanicsLocalAssembler const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_rhs_data) override; void assembleWithJacobian(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_rhs_data, @@ -116,7 +116,7 @@ class RichardsMechanicsLocalAssembler void assembleWithJacobianForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) override; @@ -157,7 +157,7 @@ class RichardsMechanicsLocalAssembler } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override @@ -173,7 +173,7 @@ class RichardsMechanicsLocalAssembler void computeSecondaryVariableConcrete( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_x_dot) override; + Eigen::VectorXd const& local_x_prev) override; Eigen::Map getShapeMatrix( const unsigned integration_point) const override @@ -275,7 +275,7 @@ class RichardsMechanicsLocalAssembler * @param t Time * @param dt Time increment * @param local_x Nodal values of \f$x\f$ of an element. - * @param local_xdot Nodal values of \f$\dot{x}\f$ of an element. + * @param local_x_prev Nodal values of \f$x_{prev}\f$ of an element. * @param local_M_data Mass matrix of an element, which takes the form of * \f$ \int N^T N\mathrm{d}\Omega\f$. Not used. * @param local_K_data Laplacian matrix of an element, which takes the @@ -287,7 +287,7 @@ class RichardsMechanicsLocalAssembler */ void assembleWithJacobianForDeformationEquations( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_M_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data); @@ -307,7 +307,7 @@ class RichardsMechanicsLocalAssembler * @param t Time * @param dt Time increment * @param local_x Nodal values of \f$x\f$ of an element. - * @param local_xdot Nodal values of \f$\dot{x}\f$ of an element. + * @param local_x_prev Nodal values of \f$x_{prev}\f$ of an element. * @param local_M_data Mass matrix of an element, which takes the form of * \f$ \int N^T N\mathrm{d}\Omega\f$. Not used. * @param local_K_data Laplacian matrix of an element, which takes the @@ -319,7 +319,7 @@ class RichardsMechanicsLocalAssembler */ void assembleWithJacobianForPressureEquations( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_M_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data); diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp index 10c0f89debe..e33faf1f1d9 100644 --- a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp +++ b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp @@ -336,7 +336,7 @@ void RichardsMechanicsProcess:: template void RichardsMechanicsProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble the equations for RichardsMechanics"); @@ -348,18 +348,16 @@ void RichardsMechanicsProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } template void RichardsMechanicsProcess:: - assembleWithJacobianConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac) + assembleWithJacobianConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { std::vector> dof_tables; @@ -394,8 +392,8 @@ void RichardsMechanicsProcess:: GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, + x_prev, process_id, M, K, b, Jac); auto copyRhs = [&](int const variable_id, auto& output_vector) { @@ -425,7 +423,7 @@ void RichardsMechanicsProcess:: template void RichardsMechanicsProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, double const t, double const dt, + std::vector const& x_prev, double const t, double const dt, const int process_id) { if (hasMechanicalProcess(process_id)) @@ -437,7 +435,7 @@ void RichardsMechanicsProcess::postTimestepConcreteProcess( getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerIF::postTimestep, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt, + pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } } @@ -446,7 +444,7 @@ template void RichardsMechanicsProcess:: computeSecondaryVariableConcrete(const double t, const double dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) { if (process_id != 0) @@ -460,7 +458,7 @@ void RichardsMechanicsProcess:: ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerIF::computeSecondaryVariable, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, t, dt, x, x_dot, process_id); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id); } template diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.h b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.h index 0c694f62696..76c8b8d71e4 100644 --- a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.h +++ b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.h @@ -79,18 +79,18 @@ class RichardsMechanicsProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, double const t, double const dt, const int process_id) override; @@ -121,7 +121,7 @@ class RichardsMechanicsProcess final : public Process void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) override; /** * @copydoc ProcessLib::Process::getDOFTableForExtrapolatorData() From da83ddfa68cfa3361d176a1fb75e2170f0e7585a Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 14:22:12 +0200 Subject: [PATCH 31/47] [PL/RM] Rewrite FEM-impl to use x_prev --- .../RichardsMechanicsFEM-impl.h | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h index 62dc7d38b65..c6f55bb5bfa 100644 --- a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h +++ b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h @@ -491,8 +491,9 @@ void RichardsMechanicsLocalAssembler< // secant derivative from time discretization for storage // use tangent, if secant is not available double const DeltaS_L_Deltap_cap = - (p_cap_dot_ip == 0) ? dS_L_dp_cap - : (S_L - S_L_prev) / (dt * p_cap_dot_ip); + (p_cap_ip == p_cap_prev_ip) + ? dS_L_dp_cap + : (S_L - S_L_prev) / (p_cap_ip - p_cap_prev_ip); auto const chi = [medium, x_position, t, dt](double const S_L) { @@ -506,13 +507,11 @@ void RichardsMechanicsLocalAssembler< double const p_FR = -chi_S_L * p_cap_ip; variables.effective_pore_pressure = p_FR; - variables_prev.effective_pore_pressure = - -chi_S_L_prev * (p_cap_ip - p_cap_dot_ip * dt); + variables_prev.effective_pore_pressure = -chi_S_L_prev * p_cap_prev_ip; // Set volumetric strain rate for the general case without swelling. variables.volumetric_strain = Invariants::trace(_ip_data[ip].eps); - variables_prev.volumetric_strain = - Invariants::trace(B * (u - u_dot * dt)); + variables_prev.volumetric_strain = Invariants::trace(B * u_prev); auto& phi = _ip_data[ip].porosity; { // Porosity update @@ -845,8 +844,9 @@ void RichardsMechanicsLocalAssemblerhasProperty(MPL::PropertyType::saturation_micro) && solid_phase.hasProperty(MPL::PropertyType::swelling_stress_rate)) @@ -1067,8 +1065,8 @@ void RichardsMechanicsLocalAssembler(pressure_index, pressure_index) - .noalias() += N_p.transpose() * p_cap_dot_ip * rho_LR * - dspecific_storage_a_p_dp_cap * N_p * w; + .noalias() += N_p.transpose() * (p_cap_ip - p_cap_prev_ip) / dt * + rho_LR * dspecific_storage_a_p_dp_cap * N_p * w; storage_p_a_S_Jpp.noalias() -= N_p.transpose() * rho_LR * @@ -1082,7 +1080,8 @@ void RichardsMechanicsLocalAssembler(pressure_index, pressure_index) .noalias() -= N_p.transpose() * rho_LR * dS_L_dp_cap * alpha * - identity2.transpose() * B * u_dot * N_p * w; + identity2.transpose() * B * (u - u_prev) / dt * + N_p * w; } double const dk_rel_dS_l = @@ -1120,15 +1119,15 @@ void RichardsMechanicsLocalAssembler(pressure_index, pressure_index) .noalias() += N_p.transpose() * alpha_bar / mu * N_p * w; - if (p_cap_dot_ip != 0) + if (p_cap_ip != p_cap_prev_ip) { double const p_L_m_prev = _ip_data[ip].liquid_pressure_m_prev; local_Jac .template block( pressure_index, pressure_index) .noalias() += N_p.transpose() * alpha_bar / mu * - (p_L_m - p_L_m_prev) / (dt * p_cap_dot_ip) * - N_p * w; + (p_L_m - p_L_m_prev) / + (p_cap_ip - p_cap_prev_ip) * N_p * w; } } } @@ -1155,8 +1154,9 @@ void RichardsMechanicsLocalAssembler(pressure_index).noalias() -= - laplace_p * p_L + (storage_p_a_p + storage_p_a_S) * p_L_dot + - Kpu * u_dot; + laplace_p * p_L + + (storage_p_a_p + storage_p_a_S) * (p_L - p_L_prev) / dt + + Kpu * (u - u_prev) / dt; // displacement equation local_rhs.template segment(displacement_index) @@ -1612,13 +1612,11 @@ void RichardsMechanicsLocalAssembler Date: Tue, 25 Jul 2023 23:16:21 +0200 Subject: [PATCH 32/47] [PL/TPhF] Rename x_dot to x_prev --- .../ThermoMechanicalPhaseFieldFEM-impl.h | 10 +++---- .../ThermoMechanicalPhaseFieldFEM.h | 8 ++--- .../ThermoMechanicalPhaseFieldProcess.cpp | 29 +++++++++---------- .../ThermoMechanicalPhaseFieldProcess.h | 8 ++--- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h index a88630fc220..ea85306ea7a 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h +++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h @@ -22,7 +22,7 @@ template void ThermoMechanicalPhaseFieldLocalAssembler:: assembleWithJacobianForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, std::vector& local_Jac_data) @@ -37,7 +37,7 @@ void ThermoMechanicalPhaseFieldLocalAssembler:: if (process_id == _heat_conduction_process_id) { assembleWithJacobianForHeatConductionEquations( - t, dt, local_x, local_xdot, local_b_data, local_Jac_data); + t, dt, local_x, local_x_prev, local_b_data, local_Jac_data); return; } @@ -138,7 +138,7 @@ template void ThermoMechanicalPhaseFieldLocalAssembler:: assembleWithJacobianForHeatConductionEquations( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data) { assert(local_x.size() == @@ -147,8 +147,8 @@ void ThermoMechanicalPhaseFieldLocalAssembler:: auto const d = local_x.template segment(phasefield_index); auto const T = local_x.template segment(temperature_index); - auto const T_dot = - local_xdot.template segment(temperature_index); + auto const T_prev = + local_x_prev.template segment(temperature_index); auto local_Jac = MathLib::createZeroedMatrix< typename ShapeMatricesType::template MatrixType>( diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM.h b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM.h index 86871960948..a978d0005a1 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM.h +++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM.h @@ -224,7 +224,7 @@ class ThermoMechanicalPhaseFieldLocalAssembler void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_rhs_data*/) override @@ -236,7 +236,7 @@ class ThermoMechanicalPhaseFieldLocalAssembler void assembleWithJacobianForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) override; @@ -253,7 +253,7 @@ class ThermoMechanicalPhaseFieldLocalAssembler } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override @@ -333,7 +333,7 @@ class ThermoMechanicalPhaseFieldLocalAssembler void assembleWithJacobianForHeatConductionEquations( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, std::vector& local_b_data, + Eigen::VectorXd const& local_x_prev, std::vector& local_b_data, std::vector& local_Jac_data); void assembleWithJacobianForPhaseFieldEquations( diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp index 429eab48971..1dca4fc1691 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp +++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp @@ -190,7 +190,7 @@ template void ThermoMechanicalPhaseFieldProcess:: assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { @@ -203,18 +203,16 @@ void ThermoMechanicalPhaseFieldProcess:: // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } template void ThermoMechanicalPhaseFieldProcess:: - assembleWithJacobianConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac) + assembleWithJacobianConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { std::vector> dof_tables; @@ -249,8 +247,8 @@ void ThermoMechanicalPhaseFieldProcess:: GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, + x_prev, process_id, M, K, b, Jac); } template @@ -278,7 +276,7 @@ void ThermoMechanicalPhaseFieldProcess:: template void ThermoMechanicalPhaseFieldProcess:: postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, double const t, double const dt, int const process_id) @@ -300,15 +298,16 @@ void ThermoMechanicalPhaseFieldProcess:: ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &ThermoMechanicalPhaseFieldLocalAssemblerInterface::postTimestep, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_dot, t, + _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } template void ThermoMechanicalPhaseFieldProcess:: postNonLinearSolverConcreteProcess(GlobalVector const& x, - GlobalVector const& xdot, const double t, - double const dt, const int process_id) + GlobalVector const& x_prev, + const double t, double const dt, + const int process_id) { if (process_id != _mechanics_related_process_id) { @@ -322,7 +321,7 @@ void ThermoMechanicalPhaseFieldProcess:: GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::postNonLinearSolver, _local_assemblers, - pv.getActiveElementIDs(), getDOFTable(process_id), x, xdot, t, dt, + pv.getActiveElementIDs(), getDOFTable(process_id), x, x_prev, t, dt, use_monolithic_scheme, process_id); } diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h index 0bc74f00845..3a9ac0b3b28 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h +++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h @@ -93,13 +93,13 @@ class ThermoMechanicalPhaseFieldProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; @@ -108,12 +108,12 @@ class ThermoMechanicalPhaseFieldProcess final : public Process const int process_id) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, double const t, double const dt, int const process_id) override; void postNonLinearSolverConcreteProcess(GlobalVector const& x, - GlobalVector const& xdot, + GlobalVector const& x_prev, const double t, double const dt, int const process_id) override; From 02c85989b090856b61186b5b583611bd1b29e92f Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 1 Aug 2023 14:23:01 +0200 Subject: [PATCH 33/47] [PL/TPhF] Rewrite FEM-impl to use x_prev --- .../ThermoMechanicalPhaseFieldFEM-impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h index ea85306ea7a..f39c809835e 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h +++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h @@ -184,7 +184,7 @@ void ThermoMechanicalPhaseFieldLocalAssembler:: double const d_ip = N.dot(d); double const T_ip = N.dot(T); - double const T_dot_ip = N.dot(T_dot); + double const T_dot_ip = (T_ip - N.dot(T_prev)) / dt; double const delta_T = T_ip - T0; // calculate real density double const rho_s = rho_sr / (1 + 3 * alpha * delta_T); From 04a8fec8003d57abad9a489d2243de59636604c6 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 12 Jul 2023 21:34:59 +0200 Subject: [PATCH 34/47] [PL/SSD] Rename x_dot to x_prev --- .../SteadyStateDiffusion/SteadyStateDiffusion.cpp | 10 +++++----- ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.h | 6 +++--- .../SteadyStateDiffusion/SteadyStateDiffusionFEM.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.cpp b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.cpp index d68c1fdc885..126ca3b9791 100644 --- a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.cpp +++ b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.cpp @@ -57,7 +57,7 @@ void SteadyStateDiffusion::initializeConcreteProcess( void SteadyStateDiffusion::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble SteadyStateDiffusion."); @@ -68,13 +68,13 @@ void SteadyStateDiffusion::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } void SteadyStateDiffusion::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian SteadyStateDiffusion."); @@ -85,8 +85,8 @@ void SteadyStateDiffusion::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } } // namespace SteadyStateDiffusion diff --git a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.h b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.h index f8bbd8298c2..cd8a86a81f0 100644 --- a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.h +++ b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.h @@ -60,7 +60,7 @@ class SteadyStateDiffusion final : public Process void postTimestepConcreteProcess( std::vector const& x, - std::vector const& /*x_dot*/, + std::vector const& /*x_prev*/, const double t, const double /*delta_t*/, int const process_id) override @@ -92,13 +92,13 @@ class SteadyStateDiffusion final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; diff --git a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusionFEM.h b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusionFEM.h index c653ad13b86..e48ebc875c8 100644 --- a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusionFEM.h +++ b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusionFEM.h @@ -80,7 +80,7 @@ class LocalAssemblerData : public SteadyStateDiffusionLocalAssemblerInterface void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& local_K_data, std::vector& /*local_b_data*/) override From 9fd70b8398351021ab79eb64f19c48f504a91c79 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 12 Jul 2023 21:35:22 +0200 Subject: [PATCH 35/47] [PL/LF] Rename x_dot to x_prev --- .../LiquidFlow/LiquidFlowLocalAssembler-impl.h | 2 +- .../LiquidFlow/LiquidFlowLocalAssembler.h | 2 +- ProcessLib/LiquidFlow/LiquidFlowProcess.cpp | 18 +++++++++--------- ProcessLib/LiquidFlow/LiquidFlowProcess.h | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ProcessLib/LiquidFlow/LiquidFlowLocalAssembler-impl.h b/ProcessLib/LiquidFlow/LiquidFlowLocalAssembler-impl.h index 114e8234c61..3f74cb05240 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowLocalAssembler-impl.h +++ b/ProcessLib/LiquidFlow/LiquidFlowLocalAssembler-impl.h @@ -25,7 +25,7 @@ namespace LiquidFlow template void LiquidFlowLocalAssembler::assemble( double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) { diff --git a/ProcessLib/LiquidFlow/LiquidFlowLocalAssembler.h b/ProcessLib/LiquidFlow/LiquidFlowLocalAssembler.h index a0f05acf263..f8adea17fb5 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowLocalAssembler.h +++ b/ProcessLib/LiquidFlow/LiquidFlowLocalAssembler.h @@ -121,7 +121,7 @@ class LiquidFlowLocalAssembler : public LiquidFlowLocalAssemblerInterface void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) override; diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp index b63fdf00c4f..273d37ab4cb 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp +++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp @@ -70,7 +70,7 @@ void LiquidFlowProcess::initializeConcreteProcess( void LiquidFlowProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble LiquidFlowProcess."); @@ -83,14 +83,14 @@ void LiquidFlowProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); MathLib::finalizeMatrixAssembly(M); MathLib::finalizeMatrixAssembly(K); MathLib::finalizeVectorAssembly(b); - auto const residuum = computeResiduum(*x[0], *xdot[0], M, K, b); + auto const residuum = computeResiduum(dt, *x[0], *x_prev[0], M, K, b); transformVariableFromGlobalVector(residuum, 0 /*variable id*/, *_local_to_global_index_map, *_hydraulic_flow, std::negate()); @@ -98,7 +98,7 @@ void LiquidFlowProcess::assembleConcreteProcess( void LiquidFlowProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian LiquidFlowProcess."); @@ -110,13 +110,13 @@ void LiquidFlowProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } void LiquidFlowProcess::computeSecondaryVariableConcrete( double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, int const process_id) + GlobalVector const& x_prev, int const process_id) { DBUG("Compute the velocity for LiquidFlowProcess."); std::vector dof_tables; @@ -128,7 +128,7 @@ void LiquidFlowProcess::computeSecondaryVariableConcrete( GlobalExecutor::executeSelectedMemberOnDereferenced( &LiquidFlowLocalAssemblerInterface::computeSecondaryVariable, _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, - x_dot, process_id); + x_prev, process_id); } Eigen::Vector3d LiquidFlowProcess::getFlux( @@ -150,7 +150,7 @@ Eigen::Vector3d LiquidFlowProcess::getFlux( // this is almost a copy of the implementation in the GroundwaterFlow void LiquidFlowProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& /*x_dot*/, + std::vector const& /*x_prev*/, const double t, const double /*dt*/, int const process_id) diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.h b/ProcessLib/LiquidFlow/LiquidFlowProcess.h index a5f301c17f1..a64c4e3148f 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowProcess.h +++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.h @@ -70,7 +70,7 @@ class LiquidFlowProcess final : public Process void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) override; bool isLinear() const override { return _is_linear; } @@ -81,7 +81,7 @@ class LiquidFlowProcess final : public Process std::vector const& x) const override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) override; @@ -93,13 +93,13 @@ class LiquidFlowProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From e083144f978b7bda8078efd3309e4193e57f6224 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Sat, 22 Jul 2023 22:06:06 +0200 Subject: [PATCH 36/47] [PL/HHPrho] Rename x_dot to x_prev --- .../TwoPhaseFlowWithPrhoLocalAssembler-impl.h | 2 +- .../TwoPhaseFlowWithPrhoLocalAssembler.h | 2 +- .../TwoPhaseFlowWithPrhoProcess.cpp | 10 +++++----- .../TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoLocalAssembler-impl.h b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoLocalAssembler-impl.h index e8d98f33186..d21f4096725 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoLocalAssembler-impl.h +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoLocalAssembler-impl.h @@ -23,7 +23,7 @@ namespace TwoPhaseFlowWithPrho template void TwoPhaseFlowWithPrhoLocalAssembler::assemble( double const t, double const /*dt*/, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) { diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoLocalAssembler.h b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoLocalAssembler.h index 1c175831450..cdadbdbf0b4 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoLocalAssembler.h +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoLocalAssembler.h @@ -136,7 +136,7 @@ class TwoPhaseFlowWithPrhoLocalAssembler void assemble(double const t, double const /*dt*/, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) override; diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp index 7aa3887723e..c0c404a4518 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp @@ -64,7 +64,7 @@ void TwoPhaseFlowWithPrhoProcess::initializeConcreteProcess( void TwoPhaseFlowWithPrhoProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble TwoPhaseFlowWithPrhoProcess."); @@ -76,13 +76,13 @@ void TwoPhaseFlowWithPrhoProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } void TwoPhaseFlowWithPrhoProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian TwoPhaseFlowWithPrhoProcess."); @@ -94,8 +94,8 @@ void TwoPhaseFlowWithPrhoProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } void TwoPhaseFlowWithPrhoProcess::preTimestepConcreteProcess( std::vector const& x, double const t, double const dt, diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.h b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.h index d2f7946bb66..27f5388e71d 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.h +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.h @@ -61,13 +61,13 @@ class TwoPhaseFlowWithPrhoProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From 01b9d8ace2d3a10d1b178fcbeb6394bca6049f98 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Sat, 22 Jul 2023 22:05:52 +0200 Subject: [PATCH 37/47] [PL/HHPP] Rename x_dot to x_prev --- .../TwoPhaseFlowWithPPLocalAssembler-impl.h | 2 +- .../TwoPhaseFlowWithPPLocalAssembler.h | 2 +- .../TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp | 10 +++++----- .../TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler-impl.h b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler-impl.h index 08aa5a51dfe..e3239bf3fc2 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler-impl.h +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler-impl.h @@ -45,7 +45,7 @@ namespace MPL = MaterialPropertyLib; template void TwoPhaseFlowWithPPLocalAssembler::assemble( double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) { diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler.h b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler.h index ea0feb6509c..96615f5d340 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler.h +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler.h @@ -125,7 +125,7 @@ class TwoPhaseFlowWithPPLocalAssembler void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) override; diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp index 0325c9715ad..efbaf07e40c 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp @@ -63,7 +63,7 @@ void TwoPhaseFlowWithPPProcess::initializeConcreteProcess( void TwoPhaseFlowWithPPProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble TwoPhaseFlowWithPPProcess."); @@ -75,13 +75,13 @@ void TwoPhaseFlowWithPPProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } void TwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian TwoPhaseFlowWithPPProcess."); @@ -93,8 +93,8 @@ void TwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } } // namespace TwoPhaseFlowWithPP diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.h b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.h index c5ed09e8870..b5983d746a2 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.h +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.h @@ -63,13 +63,13 @@ class TwoPhaseFlowWithPPProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From c8977cbbbf054f109a45d9aae38a8ea460b1f706 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 26 Jul 2023 22:47:34 +0200 Subject: [PATCH 38/47] [PL/THHPP] Rename x_dot to x_prev --- .../ThermalTwoPhaseFlowWithPPLocalAssembler-impl.h | 2 +- .../ThermalTwoPhaseFlowWithPPLocalAssembler.h | 2 +- .../ThermalTwoPhaseFlowWithPPProcess.cpp | 10 +++++----- .../ThermalTwoPhaseFlowWithPPProcess.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPLocalAssembler-impl.h b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPLocalAssembler-impl.h index 98350d372e9..fd2371eaa96 100644 --- a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPLocalAssembler-impl.h +++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPLocalAssembler-impl.h @@ -27,7 +27,7 @@ template void ThermalTwoPhaseFlowWithPPLocalAssembler:: assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPLocalAssembler.h b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPLocalAssembler.h index 4c5fb8c5214..c85526091c1 100644 --- a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPLocalAssembler.h +++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPLocalAssembler.h @@ -155,7 +155,7 @@ class ThermalTwoPhaseFlowWithPPLocalAssembler void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) override; diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp index 6d5ec24c896..cc5fe8a16ba 100644 --- a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.cpp @@ -87,7 +87,7 @@ void ThermalTwoPhaseFlowWithPPProcess::initializeConcreteProcess( void ThermalTwoPhaseFlowWithPPProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble ThermalTwoPhaseFlowWithPPProcess."); @@ -99,13 +99,13 @@ void ThermalTwoPhaseFlowWithPPProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } void ThermalTwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian ThermalTwoPhaseFlowWithPPProcess."); @@ -117,8 +117,8 @@ void ThermalTwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } void ThermalTwoPhaseFlowWithPPProcess::preTimestepConcreteProcess( std::vector const& x, double const t, double const delta_t, diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.h b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.h index 3c61a15a20f..1a1bd286217 100644 --- a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.h +++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcess.h @@ -67,13 +67,13 @@ class ThermalTwoPhaseFlowWithPPProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From d6076ed81e33db1496623a0104fc594012524974 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Thu, 27 Jul 2023 13:44:57 +0200 Subject: [PATCH 39/47] [PL/RF] Rename x_dot to x_prev --- ProcessLib/RichardsFlow/RichardsFlowFEM.h | 2 +- ProcessLib/RichardsFlow/RichardsFlowProcess.cpp | 10 +++++----- ProcessLib/RichardsFlow/RichardsFlowProcess.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ProcessLib/RichardsFlow/RichardsFlowFEM.h b/ProcessLib/RichardsFlow/RichardsFlowFEM.h index e007643ae2f..846d6f9c3ea 100644 --- a/ProcessLib/RichardsFlow/RichardsFlowFEM.h +++ b/ProcessLib/RichardsFlow/RichardsFlowFEM.h @@ -135,7 +135,7 @@ class LocalAssemblerData : public RichardsFlowLocalAssemblerInterface void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) override diff --git a/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp b/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp index 0878652ab9f..c7e2d118a27 100644 --- a/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp +++ b/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp @@ -60,7 +60,7 @@ void RichardsFlowProcess::initializeConcreteProcess( void RichardsFlowProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble RichardsFlowProcess."); @@ -72,13 +72,13 @@ void RichardsFlowProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } void RichardsFlowProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian RichardsFlowProcess."); @@ -90,8 +90,8 @@ void RichardsFlowProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } } // namespace RichardsFlow diff --git a/ProcessLib/RichardsFlow/RichardsFlowProcess.h b/ProcessLib/RichardsFlow/RichardsFlowProcess.h index 83aac3a0036..8ecca2ddf90 100644 --- a/ProcessLib/RichardsFlow/RichardsFlowProcess.h +++ b/ProcessLib/RichardsFlow/RichardsFlowProcess.h @@ -50,13 +50,13 @@ class RichardsFlowProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From 69a6ca9dbf040a99d5dca56935f7d598407939f0 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Mon, 24 Jul 2023 21:49:41 +0200 Subject: [PATCH 40/47] [PL/SDN] Rename x_dot to x_prev --- .../SmallDeformationNonlocalFEM.h | 6 ++--- .../SmallDeformationNonlocalProcess.cpp | 22 +++++++++---------- .../SmallDeformationNonlocalProcess.h | 6 ++--- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h index 402d34b43b8..416b4a89a1f 100644 --- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h +++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h @@ -311,7 +311,7 @@ class SmallDeformationNonlocalLocalAssembler void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/) override @@ -439,7 +439,7 @@ class SmallDeformationNonlocalLocalAssembler void assembleWithJacobian(double const t, double const /*dt*/, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, @@ -543,7 +543,7 @@ class SmallDeformationNonlocalLocalAssembler } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp index 093424c03bd..99eab39854b 100644 --- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp +++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp @@ -208,7 +208,7 @@ void SmallDeformationNonlocalProcess:: template void SmallDeformationNonlocalProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble SmallDeformationNonlocalProcess."); @@ -221,7 +221,7 @@ void SmallDeformationNonlocalProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } @@ -245,12 +245,10 @@ void SmallDeformationNonlocalProcess< template void SmallDeformationNonlocalProcess:: - assembleWithJacobianConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac) + assembleWithJacobianConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian SmallDeformationNonlocalProcess."); @@ -262,8 +260,8 @@ void SmallDeformationNonlocalProcess:: // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); b.copyValues(*_nodal_forces); std::transform(_nodal_forces->begin(), _nodal_forces->end(), @@ -273,7 +271,7 @@ void SmallDeformationNonlocalProcess:: template void SmallDeformationNonlocalProcess:: postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, double const t, double const dt, int const process_id) @@ -287,7 +285,7 @@ void SmallDeformationNonlocalProcess:: ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::postTimestep, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt, + pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.h b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.h index 20de29e33f8..0a0e52a3620 100644 --- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.h +++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.h @@ -53,7 +53,7 @@ class SmallDeformationNonlocalProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; @@ -62,12 +62,12 @@ class SmallDeformationNonlocalProcess final : public Process void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, double const t, double const dt, int const process_id) override; From 648b0315c560916035435f742e057d43fb6c291c Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Mon, 24 Jul 2023 23:36:12 +0200 Subject: [PATCH 41/47] [PL/PhF] Rename x_dot to x_prev --- ProcessLib/PhaseField/PhaseFieldFEM-impl.h | 2 +- ProcessLib/PhaseField/PhaseFieldFEM.h | 6 +++--- ProcessLib/PhaseField/PhaseFieldProcess.cpp | 16 ++++++++-------- ProcessLib/PhaseField/PhaseFieldProcess.h | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ProcessLib/PhaseField/PhaseFieldFEM-impl.h b/ProcessLib/PhaseField/PhaseFieldFEM-impl.h index bcb618cf957..f0193f8318d 100644 --- a/ProcessLib/PhaseField/PhaseFieldFEM-impl.h +++ b/ProcessLib/PhaseField/PhaseFieldFEM-impl.h @@ -21,7 +21,7 @@ template void PhaseFieldLocalAssembler:: assembleWithJacobianForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& /*local_xdot*/, int const process_id, + Eigen::VectorXd const& /*local_x_prev*/, int const process_id, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& local_b_data, std::vector& local_Jac_data) diff --git a/ProcessLib/PhaseField/PhaseFieldFEM.h b/ProcessLib/PhaseField/PhaseFieldFEM.h index 3701d42a32e..7f94728b848 100644 --- a/ProcessLib/PhaseField/PhaseFieldFEM.h +++ b/ProcessLib/PhaseField/PhaseFieldFEM.h @@ -264,7 +264,7 @@ class PhaseFieldLocalAssembler : public PhaseFieldLocalAssemblerInterface void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_rhs_data*/) override @@ -276,7 +276,7 @@ class PhaseFieldLocalAssembler : public PhaseFieldLocalAssemblerInterface void assembleWithJacobianForStaggeredScheme( double const t, double const dt, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& local_xdot, int const process_id, + Eigen::VectorXd const& local_x_prev, int const process_id, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data, std::vector& local_Jac_data) override; @@ -293,7 +293,7 @@ class PhaseFieldLocalAssembler : public PhaseFieldLocalAssemblerInterface } void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/, - Eigen::VectorXd const& /*local_x_dot*/, + Eigen::VectorXd const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) override diff --git a/ProcessLib/PhaseField/PhaseFieldProcess.cpp b/ProcessLib/PhaseField/PhaseFieldProcess.cpp index d34971c4ec2..82f4f8a775e 100644 --- a/ProcessLib/PhaseField/PhaseFieldProcess.cpp +++ b/ProcessLib/PhaseField/PhaseFieldProcess.cpp @@ -182,7 +182,7 @@ void PhaseFieldProcess::initializeBoundaryConditions() template void PhaseFieldProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble PhaseFieldProcess."); @@ -211,14 +211,14 @@ void PhaseFieldProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, process_id, M, K, - b); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id, M, + K, b); } template void PhaseFieldProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { std::vector> @@ -245,8 +245,8 @@ void PhaseFieldProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, + x_prev, process_id, M, K, b, Jac); if (process_id == 0) { @@ -279,7 +279,7 @@ void PhaseFieldProcess::preTimestepConcreteProcess( template void PhaseFieldProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& /*x_dot*/, const double t, + std::vector const& /*x_prev*/, const double t, const double /*delta_t*/, int const process_id) { if (isPhaseFieldProcess(process_id)) @@ -331,7 +331,7 @@ void PhaseFieldProcess::postTimestepConcreteProcess( template void PhaseFieldProcess::postNonLinearSolverConcreteProcess( - GlobalVector const& x, GlobalVector const& /*xdot*/, const double t, + GlobalVector const& x, GlobalVector const& /*x_prev*/, const double t, double const /*dt*/, const int process_id) { _process_data.crack_volume = 0.0; diff --git a/ProcessLib/PhaseField/PhaseFieldProcess.h b/ProcessLib/PhaseField/PhaseFieldProcess.h index da2a453a98d..68caf7ce5d9 100644 --- a/ProcessLib/PhaseField/PhaseFieldProcess.h +++ b/ProcessLib/PhaseField/PhaseFieldProcess.h @@ -61,13 +61,13 @@ class PhaseFieldProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; @@ -76,12 +76,12 @@ class PhaseFieldProcess final : public Process const int process_id) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double delta_t, int const process_id) override; void postNonLinearSolverConcreteProcess(GlobalVector const& x, - GlobalVector const& xdot, + GlobalVector const& x_prev, const double t, double const dt, int const process_id) override; From 2aefbe56e79a25fa9105c1de7cb51baa30b33672 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Thu, 27 Jul 2023 13:47:31 +0200 Subject: [PATCH 42/47] [PL/Stokes] Rename x_dot to x_prev --- ProcessLib/StokesFlow/StokesFlowFEM.h | 4 ++-- ProcessLib/StokesFlow/StokesFlowProcess.cpp | 16 ++++++++-------- ProcessLib/StokesFlow/StokesFlowProcess.h | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ProcessLib/StokesFlow/StokesFlowFEM.h b/ProcessLib/StokesFlow/StokesFlowFEM.h index 3cb2194d6da..1d02dfbf934 100644 --- a/ProcessLib/StokesFlow/StokesFlowFEM.h +++ b/ProcessLib/StokesFlow/StokesFlowFEM.h @@ -112,7 +112,7 @@ class LocalAssemblerData : public StokesFlowLocalAssemblerInterface void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& local_K_data, std::vector& local_b_data) override @@ -239,7 +239,7 @@ class LocalAssemblerData : public StokesFlowLocalAssemblerInterface double const /*t*/, double const /*dt*/, Eigen::VectorXd const& local_x, - Eigen::VectorXd const& /*local_x_dot*/) override + Eigen::VectorXd const& /*local_x_prev*/) override { auto const local_p = local_x.template segment(pressure_index); diff --git a/ProcessLib/StokesFlow/StokesFlowProcess.cpp b/ProcessLib/StokesFlow/StokesFlowProcess.cpp index 61bdc07230b..1d48cd9089b 100644 --- a/ProcessLib/StokesFlow/StokesFlowProcess.cpp +++ b/ProcessLib/StokesFlow/StokesFlowProcess.cpp @@ -128,7 +128,7 @@ StokesFlowProcess::getMatrixSpecifications( template void StokesFlowProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble StokesFlowProcess."); @@ -144,15 +144,15 @@ void StokesFlowProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, process_id, M, K, - b); + pv.getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id, M, + K, b); } template void StokesFlowProcess::assembleWithJacobianConcreteProcess( const double /*t*/, double const /*dt*/, std::vector const& /*x*/, - std::vector const& /*xdot*/, int const /*process_id*/, + std::vector const& /*x_prev*/, int const /*process_id*/, GlobalMatrix& /*M*/, GlobalMatrix& /*K*/, GlobalVector& /*b*/, GlobalMatrix& /*Jac*/) { @@ -166,7 +166,7 @@ void StokesFlowProcess::computeSecondaryVariableConcrete( double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) { if (process_id != 0) @@ -185,13 +185,13 @@ void StokesFlowProcess::computeSecondaryVariableConcrete( GlobalExecutor::executeSelectedMemberOnDereferenced( &StokesFlowLocalAssemblerInterface::computeSecondaryVariable, _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, - x_dot, process_id); + x_prev, process_id); } template void StokesFlowProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) @@ -211,7 +211,7 @@ void StokesFlowProcess::postTimestepConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &StokesFlowLocalAssemblerInterface::postTimestep, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt, + pv.getActiveElementIDs(), dof_tables, x, x_prev, t, dt, _use_monolithic_scheme, process_id); } diff --git a/ProcessLib/StokesFlow/StokesFlowProcess.h b/ProcessLib/StokesFlow/StokesFlowProcess.h index 68d7e21b93f..7430b895237 100644 --- a/ProcessLib/StokesFlow/StokesFlowProcess.h +++ b/ProcessLib/StokesFlow/StokesFlowProcess.h @@ -51,11 +51,11 @@ class StokesFlowProcess final : public Process void computeSecondaryVariableConcrete(double const /*t*/, double const /*dt*/, std::vector const& x, - GlobalVector const& /*x_dot*/, + GlobalVector const& /*x_prev*/, int const /*process_id*/) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) override; @@ -72,13 +72,13 @@ class StokesFlowProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From 52f431e2c3bd1b53ad24cc30854e0689f6863e8a Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 25 Jul 2023 23:11:21 +0200 Subject: [PATCH 43/47] [PL/TES] Rename x_dot to x_prev --- ProcessLib/TES/TESLocalAssembler-impl.h | 2 +- ProcessLib/TES/TESLocalAssembler.h | 2 +- ProcessLib/TES/TESProcess.cpp | 17 ++++++++--------- ProcessLib/TES/TESProcess.h | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ProcessLib/TES/TESLocalAssembler-impl.h b/ProcessLib/TES/TESLocalAssembler-impl.h index 8848f8c29bf..ee1e70feba8 100644 --- a/ProcessLib/TES/TESLocalAssembler-impl.h +++ b/ProcessLib/TES/TESLocalAssembler-impl.h @@ -134,7 +134,7 @@ TESLocalAssembler::TESLocalAssembler( template void TESLocalAssembler::assemble( double const /*t*/, double const /*dt*/, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) { diff --git a/ProcessLib/TES/TESLocalAssembler.h b/ProcessLib/TES/TESLocalAssembler.h index 7b2710013ea..46339ab59bb 100644 --- a/ProcessLib/TES/TESLocalAssembler.h +++ b/ProcessLib/TES/TESLocalAssembler.h @@ -82,7 +82,7 @@ class TESLocalAssembler final : public TESLocalAssemblerInterface void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) override; diff --git a/ProcessLib/TES/TESProcess.cpp b/ProcessLib/TES/TESProcess.cpp index 708b06956b2..79da903218f 100644 --- a/ProcessLib/TES/TESProcess.cpp +++ b/ProcessLib/TES/TESProcess.cpp @@ -203,11 +203,10 @@ void TESProcess::initializeSecondaryVariables() nullptr}); } -void TESProcess::assembleConcreteProcess(const double t, double const dt, - std::vector const& x, - std::vector const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b) +void TESProcess::assembleConcreteProcess( + const double t, double const dt, std::vector const& x, + std::vector const& x_prev, int const process_id, + GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble TESProcess."); @@ -218,13 +217,13 @@ void TESProcess::assembleConcreteProcess(const double t, double const dt, // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } void TESProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { std::vector> @@ -234,8 +233,8 @@ void TESProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } void TESProcess::preTimestepConcreteProcess(std::vector const& x, diff --git a/ProcessLib/TES/TESProcess.h b/ProcessLib/TES/TESProcess.h index 1196fad272c..efdbdd43339 100644 --- a/ProcessLib/TES/TESProcess.h +++ b/ProcessLib/TES/TESProcess.h @@ -60,7 +60,7 @@ class TESProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; @@ -68,7 +68,7 @@ class TESProcess final : public Process void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From a96d34302bab8ab098b00d99c2d1b33539815ef2 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 26 Jul 2023 22:46:12 +0200 Subject: [PATCH 44/47] [PL/HT-BHE] Rename x_dot to x_prev --- .../HeatTransportBHE/HeatTransportBHEProcess.cpp | 16 ++++++++-------- .../HeatTransportBHE/HeatTransportBHEProcess.h | 8 ++++---- .../HeatTransportBHELocalAssemblerBHE-impl.h | 2 +- .../HeatTransportBHELocalAssemblerBHE.h | 2 +- .../HeatTransportBHELocalAssemblerSoil-impl.h | 2 +- .../HeatTransportBHELocalAssemblerSoil.h | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp index 763adec3d29..a4fd2540c67 100644 --- a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp +++ b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp @@ -160,7 +160,7 @@ void HeatTransportBHEProcess::initializeConcreteProcess( void HeatTransportBHEProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble HeatTransportBHE process."); @@ -172,13 +172,13 @@ void HeatTransportBHEProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } void HeatTransportBHEProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian HeatTransportBHE process."); @@ -190,13 +190,13 @@ void HeatTransportBHEProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } void HeatTransportBHEProcess::computeSecondaryVariableConcrete( double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, int const process_id) + GlobalVector const& x_prev, int const process_id) { DBUG("Compute heat flux for HeatTransportBHE process."); @@ -209,7 +209,7 @@ void HeatTransportBHEProcess::computeSecondaryVariableConcrete( GlobalExecutor::executeSelectedMemberOnDereferenced( &HeatTransportBHELocalAssemblerInterface::computeSecondaryVariable, _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x, - x_dot, process_id); + x_prev, process_id); } NumLib::IterationResult HeatTransportBHEProcess::postIterationConcreteProcess( @@ -307,7 +307,7 @@ void HeatTransportBHEProcess::preTimestepConcreteProcess( void HeatTransportBHEProcess::postTimestepConcreteProcess( std::vector const& x, - std::vector const& /*x_dot*/, const double t, + std::vector const& /*x_prev*/, const double t, const double dt, int const process_id) { if (_process_data.py_bc_object == nullptr || diff --git a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.h b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.h index 3107910139a..cf7992a35fd 100644 --- a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.h +++ b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.h @@ -43,7 +43,7 @@ class HeatTransportBHEProcess final : public Process void computeSecondaryVariableConcrete(double const t, double const dt, std::vector const& x, - GlobalVector const& x_dot, + GlobalVector const& x_prev, int const process_id) override; private: @@ -56,13 +56,13 @@ class HeatTransportBHEProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; @@ -73,7 +73,7 @@ class HeatTransportBHEProcess final : public Process int const process_id) override; void postTimestepConcreteProcess(std::vector const& x, - std::vector const& x_dot, + std::vector const& x_prev, const double t, const double dt, int const process_id) override; diff --git a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerBHE-impl.h b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerBHE-impl.h index f1e32c3714b..a17e42e5385 100644 --- a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerBHE-impl.h +++ b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerBHE-impl.h @@ -122,7 +122,7 @@ template void HeatTransportBHELocalAssemblerBHE::assemble( double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& /*local_b_data*/) // local b vector is not touched { diff --git a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerBHE.h b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerBHE.h index a1a6af3a630..e9c2dbb150f 100644 --- a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerBHE.h +++ b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerBHE.h @@ -60,7 +60,7 @@ class HeatTransportBHELocalAssemblerBHE void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/) override; diff --git a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil-impl.h b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil-impl.h index d5820cf1b8e..ab7aa2aaa59 100644 --- a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil-impl.h +++ b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil-impl.h @@ -70,7 +70,7 @@ HeatTransportBHELocalAssemblerSoil:: template void HeatTransportBHELocalAssemblerSoil::assemble( double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& /*local_b_data*/) { diff --git a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil.h b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil.h index 79fae5c438b..4c86cc84246 100644 --- a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil.h +++ b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil.h @@ -54,7 +54,7 @@ class HeatTransportBHELocalAssemblerSoil void assemble(double const /*t*/, double const /*dt*/, std::vector const& /*local_x*/, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& /*local_M_data*/, std::vector& /*local_K_data*/, std::vector& /*local_b_data*/) override; From 2b0a248c339dab771e6aa8d595b3d4cf3ac980c6 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Wed, 26 Jul 2023 22:47:03 +0200 Subject: [PATCH 45/47] [PL/RCT] Rename x_dot to x_prev --- .../RichardsComponentTransportFEM-impl.h | 2 +- .../RichardsComponentTransportFEM.h | 2 +- .../RichardsComponentTransportProcess.cpp | 10 +++++----- .../RichardsComponentTransportProcess.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportFEM-impl.h b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportFEM-impl.h index 65fe5f2c2ca..5ce660c1f86 100644 --- a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportFEM-impl.h +++ b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportFEM-impl.h @@ -61,7 +61,7 @@ LocalAssemblerData::LocalAssemblerData( template void LocalAssemblerData::assemble( double const t, double const dt, std::vector const& local_x, - std::vector const& /*local_xdot*/, + std::vector const& /*local_x_prev*/, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) { diff --git a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportFEM.h b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportFEM.h index 122e130ce49..6da02fb6abf 100644 --- a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportFEM.h +++ b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportFEM.h @@ -107,7 +107,7 @@ class LocalAssemblerData void assemble(double const t, double const dt, std::vector const& local_x, - std::vector const& local_xdot, + std::vector const& local_x_prev, std::vector& local_M_data, std::vector& local_K_data, std::vector& local_b_data) override; diff --git a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp index 3c3d8bb7963..ea0e85664fb 100644 --- a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp +++ b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.cpp @@ -66,7 +66,7 @@ void RichardsComponentTransportProcess::initializeConcreteProcess( void RichardsComponentTransportProcess::assembleConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { DBUG("Assemble RichardsComponentTransportProcess."); @@ -78,13 +78,13 @@ void RichardsComponentTransportProcess::assembleConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, process_id, M, K, + pv.getActiveElementIDs(), dof_table, t, dt, x, x_prev, process_id, M, K, b); } void RichardsComponentTransportProcess::assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { DBUG("AssembleWithJacobian RichardsComponentTransportProcess."); @@ -96,8 +96,8 @@ void RichardsComponentTransportProcess::assembleWithJacobianConcreteProcess( // Call global assembler for each local assembly item. GlobalExecutor::executeSelectedMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, - _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, xdot, - process_id, M, K, b, Jac); + _local_assemblers, pv.getActiveElementIDs(), dof_table, t, dt, x, + x_prev, process_id, M, K, b, Jac); } } // namespace RichardsComponentTransport diff --git a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.h b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.h index 5f094344641..b2c0e15ed9a 100644 --- a/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.h +++ b/ProcessLib/RichardsComponentTransport/RichardsComponentTransportProcess.h @@ -130,13 +130,13 @@ class RichardsComponentTransportProcess final : public Process void assembleConcreteProcess(const double t, double const dt, std::vector const& x, - std::vector const& xdot, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) override; void assembleWithJacobianConcreteProcess( const double t, double const dt, std::vector const& x, - std::vector const& xdot, int const process_id, + std::vector const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override; From 93f3440ff9d29189e2f823f58cf433f740feab2d Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Mon, 24 Jul 2023 21:49:56 +0200 Subject: [PATCH 46/47] [T/PL] Relax ctests' tolerances --- ProcessLib/HT/Tests.cmake | 2 +- ProcessLib/HeatConduction/Tests.cmake | 4 ++-- ProcessLib/ThermoMechanics/Tests.cmake | 6 +++--- ProcessLib/ThermoRichardsMechanics/Tests.cmake | 4 ++-- .../THM_confined_compression_liquid.prj | 2 +- Tests/Data/ThermoHydroMechanics/A2/A2.prj | 2 +- .../ThermoHydroMechanics/ColumnDeformationFreezing/TM.prj | 6 +++--- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ProcessLib/HT/Tests.cmake b/ProcessLib/HT/Tests.cmake index 0f944f23fc2..c11c27e6081 100644 --- a/ProcessLib/HT/Tests.cmake +++ b/ProcessLib/HT/Tests.cmake @@ -353,7 +353,7 @@ AddTest( REQUIREMENTS NOT OGS_USE_MPI DIFF_DATA ThermalConvection_ts_1_t_0.000000_expected.vtu ThermalConvection_ts_1_t_0.000000.vtu T T 1e-10 1e-16 - ThermalConvection_ts_1_t_0.000000_expected.vtu ThermalConvection_ts_1_t_0.000000.vtu p p 7e-7 1e-12 + ThermalConvection_ts_1_t_0.000000_expected.vtu ThermalConvection_ts_1_t_0.000000.vtu p p 3e-6 1e-12 ThermalConvection_ts_1_t_0.000000_expected.vtu ThermalConvection_ts_1_t_0.000000.vtu darcy_velocity darcy_velocity 1e-8 1e-13 ) diff --git a/ProcessLib/HeatConduction/Tests.cmake b/ProcessLib/HeatConduction/Tests.cmake index c9bebeb84c9..de94fa63d1e 100644 --- a/ProcessLib/HeatConduction/Tests.cmake +++ b/ProcessLib/HeatConduction/Tests.cmake @@ -59,9 +59,9 @@ AddTest( newton_ts_405_t_31640625.000000.vtu newton_ts_405_t_31640625.000000.vtu temperature temperature 1e-12 1e-16 newton_ts_500_t_39062500.000000.vtu newton_ts_500_t_39062500.000000.vtu temperature temperature 1e-12 1e-16 newton_ts_1_t_78125.000000.vtu newton_ts_1_t_78125.000000.vtu HeatFlowRate HeatFlowRate 1e-12 1e-16 - newton_ts_3_t_234375.000000.vtu newton_ts_3_t_234375.000000.vtu HeatFlowRate HeatFlowRate 2e-12 0 + newton_ts_3_t_234375.000000.vtu newton_ts_3_t_234375.000000.vtu HeatFlowRate HeatFlowRate 3e-12 0 newton_ts_65_t_5078125.000000.vtu newton_ts_65_t_5078125.000000.vtu HeatFlowRate HeatFlowRate 2e-12 0 - newton_ts_405_t_31640625.000000.vtu newton_ts_405_t_31640625.000000.vtu HeatFlowRate HeatFlowRate 2e-12 0 + newton_ts_405_t_31640625.000000.vtu newton_ts_405_t_31640625.000000.vtu HeatFlowRate HeatFlowRate 3e-12 0 newton_ts_500_t_39062500.000000.vtu newton_ts_500_t_39062500.000000.vtu HeatFlowRate HeatFlowRate 2e-12 0 temperature_analytical.vtu newton_ts_1_t_78125.000000.vtu temperature_78125s temperature 8e-2 1e-4 temperature_analytical.vtu newton_ts_3_t_234375.000000.vtu temperature_234375s temperature 6e-2 1e-4 diff --git a/ProcessLib/ThermoMechanics/Tests.cmake b/ProcessLib/ThermoMechanics/Tests.cmake index 5129d9bad2e..df2056e0dc9 100644 --- a/ProcessLib/ThermoMechanics/Tests.cmake +++ b/ProcessLib/ThermoMechanics/Tests.cmake @@ -330,9 +330,9 @@ AddTest( cthex_ref.vtu cube_1e0_lin_ts_5_t_5.000000.vtu sigma_5 sigma 1e-8 0 cthex_ref.vtu cube_1e0_lin_ts_6_t_6.000000.vtu sigma_6 sigma 1e-8 0 cthex_ref.vtu cube_1e0_lin_ts_7_t_7.000000.vtu sigma_7 sigma 1e-8 0 - cthex_ref.vtu cube_1e0_lin_ts_8_t_8.000000.vtu sigma_8 sigma 1e-8 0 - cthex_ref.vtu cube_1e0_lin_ts_9_t_9.000000.vtu sigma_9 sigma 1e-8 0 - cthex_ref.vtu cube_1e0_lin_ts_10_t_10.000000.vtu sigma_10 sigma 1e-8 0 + cthex_ref.vtu cube_1e0_lin_ts_8_t_8.000000.vtu sigma_8 sigma 2e-8 0 + cthex_ref.vtu cube_1e0_lin_ts_9_t_9.000000.vtu sigma_9 sigma 2e-8 0 + cthex_ref.vtu cube_1e0_lin_ts_10_t_10.000000.vtu sigma_10 sigma 2e-8 0 ) # Test of a creep law. diff --git a/ProcessLib/ThermoRichardsMechanics/Tests.cmake b/ProcessLib/ThermoRichardsMechanics/Tests.cmake index 8aa65ff6af3..533881f6e76 100644 --- a/ProcessLib/ThermoRichardsMechanics/Tests.cmake +++ b/ProcessLib/ThermoRichardsMechanics/Tests.cmake @@ -211,14 +211,14 @@ AddTest( PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu sigma sigma 7e-8 0 PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu HeatFlowRate HeatFlowRate 4e-11 0 PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu MassFlowRate MassFlowRate 1e-15 0 - PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu NodalForces NodalForces 4.3e-8 0 + PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu NodalForces NodalForces 6e-8 0 # submesh residuum output quarter_002_2nd_r_lt_2 PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu displacement displacement 1e-15 0 PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu pressure pressure 5e-7 0 PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu temperature temperature 3e-11 0 PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu epsilon epsilon 1e-15 0 PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu sigma sigma 1.1e-5 0 - PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu HeatFlowRate HeatFlowRate 6.1e-12 0 + PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu HeatFlowRate HeatFlowRate 6.2e-12 0 PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu MassFlowRate MassFlowRate 1e-15 0 PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_lt_2_ts_10_t_50000.000000.vtu NodalForces NodalForces 2.1e-8 0 ) diff --git a/Tests/Data/TH2M/THM/Confined_Compression/THM_confined_compression_liquid.prj b/Tests/Data/TH2M/THM/Confined_Compression/THM_confined_compression_liquid.prj index 47df0cf8dcd..41787ac2644 100644 --- a/Tests/Data/TH2M/THM/Confined_Compression/THM_confined_compression_liquid.prj +++ b/Tests/Data/TH2M/THM/Confined_Compression/THM_confined_compression_liquid.prj @@ -534,7 +534,7 @@ THM_confined_compression_liquid_ts_.*.vtu HeatFlowRate - 3e-13 + 4e-13 0 diff --git a/Tests/Data/ThermoHydroMechanics/A2/A2.prj b/Tests/Data/ThermoHydroMechanics/A2/A2.prj index d17d973322a..ddf021e09b7 100644 --- a/Tests/Data/ThermoHydroMechanics/A2/A2.prj +++ b/Tests/Data/ThermoHydroMechanics/A2/A2.prj @@ -462,7 +462,7 @@ A2_ts_.*.vtu pressure - 5e-8 + 6e-8 1e-15 diff --git a/Tests/Data/ThermoHydroMechanics/ColumnDeformationFreezing/TM.prj b/Tests/Data/ThermoHydroMechanics/ColumnDeformationFreezing/TM.prj index ebf1db3c227..6e9d5d2e461 100644 --- a/Tests/Data/ThermoHydroMechanics/ColumnDeformationFreezing/TM.prj +++ b/Tests/Data/ThermoHydroMechanics/ColumnDeformationFreezing/TM.prj @@ -389,7 +389,7 @@ TM_.*.vtu sigma - 5e-6 + 7e-6 1e-15 @@ -431,13 +431,13 @@ TM_.*.vtu HeatFlowRate - 6e-13 + 3e-11 0 TM_.*.vtu NodalForces - 6e-6 + 7e-6 0 From 699ef8d415de3c032dd55baf48ccf3f32ce8734a Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Thu, 3 Aug 2023 23:50:27 +0200 Subject: [PATCH 47/47] [PL/TM] Remove unnecessary .eval() calls --- ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h index 7521b60d07e..d188ac47300 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM-impl.h @@ -204,8 +204,8 @@ void ThermoMechanicsLocalAssembler:: .value(variables, x_position, t, dt)); MathLib::KelvinVector::KelvinVectorType const - dthermal_strain = solid_linear_thermal_expansivity_vector.eval() * - (T_ip - T_prev_ip); + dthermal_strain = + solid_linear_thermal_expansivity_vector * (T_ip - T_prev_ip); // // displacement equation, displacement part @@ -275,8 +275,8 @@ void ThermoMechanicsLocalAssembler:: // The computation of KuT can be ignored. auto const alpha_T_tensor = MathLib::KelvinVector::kelvinVectorToSymmetricTensor( - solid_linear_thermal_expansivity_vector.eval()); - KuT.noalias() += B.transpose() * (C * alpha_T_tensor.eval()) * N * w; + solid_linear_thermal_expansivity_vector); + KuT.noalias() += B.transpose() * (C * alpha_T_tensor) * N * w; if (_ip_data[ip].solid_material.getConstitutiveModel() == MaterialLib::Solids::ConstitutiveModel::CreepBGRa) @@ -436,8 +436,7 @@ void ThermoMechanicsLocalAssembler:: .value(variables, x_position, t, dt)); MathLib::KelvinVector::KelvinVectorType const - dthermal_strain = - solid_linear_thermal_expansivity_vector.eval() * dT_ip; + dthermal_strain = solid_linear_thermal_expansivity_vector * dT_ip; eps_m.noalias() = eps_m_prev + eps - eps_prev - dthermal_strain;