From 1744fc9472fc28f6af9ecad65fabf11ce965df3f Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Tue, 11 Jul 2023 23:52:52 +0200 Subject: [PATCH] [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 @@ public: virtual void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector<double> const& local_x, - std::vector<double> const& local_xdot, + std::vector<double> const& local_x_prev, std::vector<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& local_b_data, @@ -40,7 +40,7 @@ public: 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<double>& /*local_M_data*/, std::vector<double>& /*local_K_data*/, std::vector<double>& /*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<double> const& local_x, std::vector<double> const& local_xdot, + std::vector<double> const& local_x, std::vector<double> const& local_x_prev, std::vector<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& local_b_data, std::vector<double>& 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<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& local_b_data, std::vector<double>& 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 @@ public: void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector<double> const& local_x, - std::vector<double> const& local_xdot, + std::vector<double> const& local_x_prev, std::vector<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& local_b_data, @@ -43,7 +43,7 @@ public: 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<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& local_b_data, std::vector<double>& 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<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& local_b_data, std::vector<double>& local_Jac_data, std::vector<GlobalIndexType>& 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<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> const& dof_tables, const double t, double const dt, std::vector<GlobalVector*> const& xs, - std::vector<GlobalVector*> const& xdots, int const process_id, + std::vector<GlobalVector*> 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 @@ public: std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> const& dof_tables, const double t, double const dt, std::vector<GlobalVector*> const& xs, - std::vector<GlobalVector*> const& xdots, int const process_id, + std::vector<GlobalVector*> 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 @@ public: // cppcheck-suppress functionStatic void assemble(const double /*t*/, double const /*dt*/, std::vector<GlobalVector*> const& /*x*/, - std::vector<GlobalVector*> const& /*xdot*/, + std::vector<GlobalVector*> const& /*x_prev*/, int const /*process_id*/, GlobalMatrix& /*M*/, GlobalMatrix& /*K*/, GlobalVector& /*b*/) { @@ -153,14 +153,14 @@ public: 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<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, + std::vector<GlobalVector*> const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) @@ -170,7 +170,7 @@ public: 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 @@ private: template <typename Method, typename... Jac> void assembleGeneric(Method global_assembler_method, const double t, double const dt, std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, + std::vector<GlobalVector*> const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, Jac&... jac_or_not_jac) { @@ -206,7 +206,7 @@ private: (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 @@ private: 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 @@ public: void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector<double> const& local_x_data, - std::vector<double> const& local_xdot_data, + std::vector<double> const& local_x_prev_data, std::vector<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& 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 @@ public: void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector<double> const& local_x, - std::vector<double> const& local_xdot, + std::vector<double> const& local_x_prev, std::vector<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& 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 @@ public: void assembleWithJacobian(LocalAssemblerInterface& local_assembler, double const t, double const dt, std::vector<double> const& local_x_data, - std::vector<double> const& local_xdot_data, + std::vector<double> const& local_x_prev_data, std::vector<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& 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<double> const& /*local_x*/, - std::vector<double> const& /*local_xdot*/, + std::vector<double> const& /*local_x_prev*/, std::vector<double>& /*local_M_data*/, std::vector<double>& /*local_K_data*/, std::vector<double>& /*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<double>& /*local_M_data*/, std::vector<double>& /*local_K_data*/, std::vector<double>& /*local_b_data*/) @@ -46,7 +46,7 @@ void LocalAssemblerInterface::assembleForStaggeredScheme( void LocalAssemblerInterface::assembleWithJacobian( double const /*t*/, double const /*dt*/, std::vector<double> const& /*local_x*/, - std::vector<double> const& /*local_xdot*/, + std::vector<double> const& /*local_x_prev*/, std::vector<double>& /*local_M_data*/, std::vector<double>& /*local_K_data*/, std::vector<double>& /*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<double>& /*local_M_data*/, std::vector<double>& /*local_K_data*/, std::vector<double>& /*local_b_data*/, @@ -74,7 +74,7 @@ void LocalAssemblerInterface::computeSecondaryVariable( std::size_t const mesh_item_id, std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables, double const t, double const dt, std::vector<GlobalVector*> const& x, - GlobalVector const& x_dot, int const process_id) + GlobalVector const& x_prev, int const process_id) { std::vector<double> 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<NumLib::LocalToGlobalIndexMap const*> const& dof_tables, std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& x_dot, double const t, double const dt, + std::vector<GlobalVector*> const& x_prev, double const t, double const dt, bool const use_monolithic_scheme, int const process_id) { std::vector<double> local_x_vec; - std::vector<double> local_x_dot_vec; + std::vector<double> 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 @@ public: virtual void assemble(double const t, double const dt, std::vector<double> const& local_x, - std::vector<double> const& local_xdot, + std::vector<double> const& local_x_prev, std::vector<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& 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<double>& local_M_data, std::vector<double>& local_K_data, @@ -64,7 +64,7 @@ public: virtual void assembleWithJacobian(double const t, double const dt, std::vector<double> const& local_x, - std::vector<double> const& local_xdot, + std::vector<double> const& local_x_prev, std::vector<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& local_b_data, @@ -72,7 +72,7 @@ public: 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<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& local_b_data, std::vector<double>& local_Jac_data); @@ -80,7 +80,7 @@ public: std::size_t const mesh_item_id, std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables, double const t, double const dt, std::vector<GlobalVector*> 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 @@ public: std::size_t const mesh_item_id, std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables, std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& x_dot, double const t, + std::vector<GlobalVector*> 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 @@ private: } 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 @@ private: virtual void postNonLinearSolverConcrete( std::vector<double> const& /*local_x*/, - std::vector<double> const& /*local_xdot*/, double const /*t*/, + std::vector<double> const& /*local_x_prev*/, double const /*t*/, double const /*dt*/, bool const /*use_monolithic_scheme*/, int const /*process_id*/) { @@ -156,7 +156,7 @@ private: 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<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, + std::vector<GlobalVector*> 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<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, + std::vector<GlobalVector*> 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<GlobalVector*> const& x, const double t, } void Process::postTimestep(std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& x_dot, + std::vector<GlobalVector*> const& x_prev, const double t, const double delta_t, int const process_id) { @@ -403,36 +403,36 @@ void Process::postTimestep(std::vector<GlobalVector*> 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<GlobalVector*> 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 @@ public: /// Postprocessing after a complete timestep. void postTimestep(std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& x_dot, const double t, + std::vector<GlobalVector*> 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 @@ public: void computeSecondaryVariable(double const t, double const dt, std::vector<GlobalVector*> 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 @@ public: void assemble(const double t, double const dt, std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, int const process_id, - GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) final; + std::vector<GlobalVector*> const& x_prev, + int const process_id, GlobalMatrix& M, GlobalMatrix& K, + GlobalVector& b) final; void assembleWithJacobian(const double t, double const dt, std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, + std::vector<GlobalVector*> const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) final; @@ -230,15 +231,14 @@ private: { } - virtual void assembleConcreteProcess(const double t, double const dt, - std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, - int const process_id, GlobalMatrix& M, - GlobalMatrix& K, GlobalVector& b) = 0; + virtual void assembleConcreteProcess( + const double t, double const dt, std::vector<GlobalVector*> const& x, + std::vector<GlobalVector*> 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<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, int const process_id, + std::vector<GlobalVector*> const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) = 0; @@ -252,7 +252,7 @@ private: virtual void postTimestepConcreteProcess( std::vector<GlobalVector*> const& /*x*/, - std::vector<GlobalVector*> const& /*x_dot*/, + std::vector<GlobalVector*> const& /*x_prev*/, const double /*t*/, const double /*dt*/, int const /*process_id*/) @@ -260,7 +260,7 @@ private: } 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 @@ private: double const /*t*/, double const /*dt*/, std::vector<GlobalVector*> 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<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> const& dof_tables, const double t, double const dt, std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, int const process_id, + std::vector<GlobalVector*> const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b) { std::vector<std::vector<GlobalIndexType>> 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<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> const& dof_tables, const double t, double const dt, std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, int const process_id, + std::vector<GlobalVector*> const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) { std::vector<std::vector<GlobalIndexType>> 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 @@ public: NumLib::LocalToGlobalIndexMap>> const& dof_tables, double const t, double const dt, std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, int const process_id, - GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b); + std::vector<GlobalVector*> 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 @@ public: std::reference_wrapper<NumLib::LocalToGlobalIndexMap>> const& dof_tables, const double t, double const dt, std::vector<GlobalVector*> const& x, - std::vector<GlobalVector*> const& xdot, int const process_id, + std::vector<GlobalVector*> const& x_prev, int const process_id, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac); private: -- GitLab