diff --git a/ProcessLib/AbstractJacobianAssembler.h b/ProcessLib/AbstractJacobianAssembler.h index 3fae9d17602..2861351a53d 100644 --- a/ProcessLib/AbstractJacobianAssembler.h +++ b/ProcessLib/AbstractJacobianAssembler.h @@ -18,7 +18,6 @@ namespace ProcessLib { class LocalAssemblerInterface; -struct LocalCoupledSolutions; //! Base class for Jacobian assemblers. class AbstractJacobianAssembler diff --git a/ProcessLib/AnalyticalJacobianAssembler.cpp b/ProcessLib/AnalyticalJacobianAssembler.cpp index 843b7b010a9..a535ffccfe6 100644 --- a/ProcessLib/AnalyticalJacobianAssembler.cpp +++ b/ProcessLib/AnalyticalJacobianAssembler.cpp @@ -10,7 +10,6 @@ #include "AnalyticalJacobianAssembler.h" -#include "CoupledSolutionsForStaggeredScheme.h" #include "LocalAssemblerInterface.h" namespace ProcessLib diff --git a/ProcessLib/AnalyticalJacobianAssembler.h b/ProcessLib/AnalyticalJacobianAssembler.h index a7ca44b46fd..84134442719 100644 --- a/ProcessLib/AnalyticalJacobianAssembler.h +++ b/ProcessLib/AnalyticalJacobianAssembler.h @@ -20,8 +20,6 @@ class ConfigTree; namespace ProcessLib { -struct LocalCoupledSolutions; - //! Assembles the Jacobian matrix using a provided "analytical" method from the //! local assembler. class AnalyticalJacobianAssembler final : public AbstractJacobianAssembler diff --git a/ProcessLib/ComponentTransport/ComponentTransportFEM.h b/ProcessLib/ComponentTransport/ComponentTransportFEM.h index 6bfb29afcbc..8a5ab0d6a18 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportFEM.h +++ b/ProcessLib/ComponentTransport/ComponentTransportFEM.h @@ -30,7 +30,6 @@ #include "NumLib/NumericalStability/AdvectionMatrixAssembler.h" #include "NumLib/NumericalStability/HydrodynamicDispersion.h" #include "ParameterLib/Parameter.h" -#include "ProcessLib/CoupledSolutionsForStaggeredScheme.h" #include "ProcessLib/LocalAssemblerInterface.h" #include "ProcessLib/ProcessVariable.h" diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp index 1072847134e..05c45b478e8 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp @@ -22,6 +22,7 @@ #include "MeshLib/Utils/getOrCreateMeshProperty.h" #include "NumLib/DOF/ComputeSparsityPattern.h" #include "NumLib/ODESolver/NonlinearSystem.h" +#include "ProcessLib/CoupledSolutionsForStaggeredScheme.h" #include "ProcessLib/SurfaceFlux/SurfaceFlux.h" #include "ProcessLib/SurfaceFlux/SurfaceFluxData.h" #include "ProcessLib/Utils/ComputeResiduum.h" diff --git a/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp b/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp index 0b7031bf4fd..cf59fd3839e 100644 --- a/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp +++ b/ProcessLib/CoupledSolutionsForStaggeredScheme.cpp @@ -18,16 +18,6 @@ namespace ProcessLib { -CoupledSolutionsForStaggeredScheme::CoupledSolutionsForStaggeredScheme( - std::vector const& coupled_xs_) - : coupled_xs(coupled_xs_) -{ - for (auto const* coupled_x : coupled_xs) - { - MathLib::LinAlg::setLocalAccessibleVector(*coupled_x); - } -} - std::vector getCoupledLocalSolutions( std::vector const& global_solutions, std::vector> const& indices) diff --git a/ProcessLib/CoupledSolutionsForStaggeredScheme.h b/ProcessLib/CoupledSolutionsForStaggeredScheme.h index 0393bd55860..b77bae1ec17 100644 --- a/ProcessLib/CoupledSolutionsForStaggeredScheme.h +++ b/ProcessLib/CoupledSolutionsForStaggeredScheme.h @@ -19,45 +19,6 @@ namespace ProcessLib { -/** - * A struct to keep the references of the current solutions of the equations of - * the coupled processes. - * - * During staggered coupling iteration, an instance of this struct is created - * and passed through interfaces to global and local assemblers for each - * process. - */ -struct CoupledSolutionsForStaggeredScheme -{ - explicit CoupledSolutionsForStaggeredScheme( - std::vector const& coupled_xs_); - - /// References to the current solutions of the coupled processes. - std::vector const& coupled_xs; - - /// Pointers to the vector of the solutions of the previous time step. - std::vector coupled_xs_t0; -}; - -/** - * A struct to keep the references to the local element solutions of the - * current and previous time step solutions of the equations of the coupled - * processes. - * - * During the global assembly loop, an instance of this struct is created for - * each element and it is then passed to local assemblers. - */ -struct LocalCoupledSolutions -{ - explicit LocalCoupledSolutions(std::vector&& local_coupled_xs0_) - : local_coupled_xs0(std::move(local_coupled_xs0_)) - { - } - - /// Local solutions of the previous time step. - std::vector const local_coupled_xs0; -}; - /** * Fetch the nodal solutions of all coupled processes from the given vector of * global solutions for each process into a flat vector. diff --git a/ProcessLib/HT/HTLocalAssemblerInterface.h b/ProcessLib/HT/HTLocalAssemblerInterface.h index 93255472ab7..8468aac8b50 100644 --- a/ProcessLib/HT/HTLocalAssemblerInterface.h +++ b/ProcessLib/HT/HTLocalAssemblerInterface.h @@ -18,7 +18,6 @@ namespace ProcessLib { -struct CoupledSolutionsForStaggeredScheme; namespace HT { @@ -46,12 +45,6 @@ class HTLocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface, { public: HTLocalAssemblerInterface() = default; - void setStaggeredCoupledSolutions( - std::size_t const /*mesh_item_id*/, - CoupledSolutionsForStaggeredScheme* const coupling_term) - { - _coupled_solutions = coupling_term; - } virtual std::vector const& getIntPtDarcyVelocity( const double /*t*/, @@ -63,18 +56,6 @@ class HTLocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface, double const t, std::vector const& local_x) const override = 0; - -protected: - // TODO: remove _coupled_solutions or move integration point data from - // local assembler class to a new class to make local assembler unique - // for each process. - /** Pointer to CoupledSolutionsForStaggeredScheme that is set in a - * member of Process class, - * setCoupledTermForTheStaggeredSchemeToLocalAssemblers. It is used for - * calculate the secondary variables like velocity for coupled - * processes. - */ - CoupledSolutionsForStaggeredScheme* _coupled_solutions{nullptr}; }; } // namespace HT diff --git a/ProcessLib/HT/HTProcess.cpp b/ProcessLib/HT/HTProcess.cpp index bf723e15912..9ba3c39fa6f 100644 --- a/ProcessLib/HT/HTProcess.cpp +++ b/ProcessLib/HT/HTProcess.cpp @@ -15,6 +15,7 @@ #include "MonolithicHTFEM.h" #include "NumLib/DOF/DOFTableUtil.h" #include "NumLib/DOF/LocalToGlobalIndexMap.h" +#include "ProcessLib/CoupledSolutionsForStaggeredScheme.h" #include "ProcessLib/SurfaceFlux/SurfaceFluxData.h" #include "ProcessLib/Utils/CreateLocalAssemblers.h" #include "StaggeredHTFEM.h" @@ -137,17 +138,6 @@ void HTProcess::assembleWithJacobianConcreteProcess( x_prev, process_id, M, K, b, Jac); } -void HTProcess::setCoupledTermForTheStaggeredSchemeToLocalAssemblers( - int const process_id) -{ - DBUG("Set the coupled term for the staggered scheme to local assemblers."); - - ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; - GlobalExecutor::executeSelectedMemberOnDereferenced( - &HTLocalAssemblerInterface::setStaggeredCoupledSolutions, - _local_assemblers, pv.getActiveElementIDs(), _coupled_solutions); -} - std::tuple HTProcess::getDOFTableForExtrapolatorData() const { diff --git a/ProcessLib/HT/HTProcess.h b/ProcessLib/HT/HTProcess.h index 5e090e13365..71dc33138ab 100644 --- a/ProcessLib/HT/HTProcess.h +++ b/ProcessLib/HT/HTProcess.h @@ -77,9 +77,6 @@ class HTProcess final : public Process double const t, std::vector const& x) const override; - void setCoupledTermForTheStaggeredSchemeToLocalAssemblers( - int const process_id) override; - void postTimestepConcreteProcess(std::vector const& x, std::vector const& x_prev, const double t, diff --git a/ProcessLib/HT/StaggeredHTFEM.h b/ProcessLib/HT/StaggeredHTFEM.h index 1aff984bca3..993b76d3ae1 100644 --- a/ProcessLib/HT/StaggeredHTFEM.h +++ b/ProcessLib/HT/StaggeredHTFEM.h @@ -24,7 +24,6 @@ namespace ProcessLib { -struct LocalCoupledSolutions; namespace HT { diff --git a/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h b/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h index ddde9d3d8ab..84a6505f543 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h @@ -22,7 +22,6 @@ #include "MaterialLib/SolidModels/SelectSolidConstitutiveRelation.h" #include "MathLib/KelvinVector.h" #include "NumLib/Function/Interpolation.h" -#include "ProcessLib/CoupledSolutionsForStaggeredScheme.h" #include "ProcessLib/Utils/SetOrGetIntegrationPointData.h" namespace ProcessLib diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp index 96b6c733696..11fdc1a13ac 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp @@ -421,8 +421,9 @@ void HydroMechanicsProcess::postTimestepConcreteProcess( template void HydroMechanicsProcess::postNonLinearSolverConcreteProcess( - GlobalVector const& x, GlobalVector const& x_prev, const double t, - double const dt, const int process_id) + std::vector const& x, + std::vector const& x_prev, const double t, double const dt, + const int process_id) { DBUG("PostNonLinearSolver HydroMechanicsProcess."); diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.h b/ProcessLib/HydroMechanics/HydroMechanicsProcess.h index a493d60de08..6a1cf557087 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.h @@ -97,10 +97,10 @@ class HydroMechanicsProcess final : public Process const double t, const double dt, int const process_id) override; - void postNonLinearSolverConcreteProcess(GlobalVector const& x, - GlobalVector const& x_prev, - const double t, double const dt, - int const process_id) override; + void postNonLinearSolverConcreteProcess( + std::vector const& x, + std::vector const& x_prev, const double t, + double const dt, int const process_id) override; void setInitialConditionsConcreteProcess(std::vector& x, double const t, diff --git a/ProcessLib/LocalAssemblerInterface.cpp b/ProcessLib/LocalAssemblerInterface.cpp index def554c2e3a..49a41ef7d70 100644 --- a/ProcessLib/LocalAssemblerInterface.cpp +++ b/ProcessLib/LocalAssemblerInterface.cpp @@ -12,7 +12,6 @@ #include -#include "CoupledSolutionsForStaggeredScheme.h" #include "MathLib/LinAlg/Eigen/EigenMapTools.h" #include "NumLib/DOF/DOFTableUtil.h" @@ -162,13 +161,14 @@ void LocalAssemblerInterface::postTimestep( void LocalAssemblerInterface::postNonLinearSolver( std::size_t const mesh_item_id, - NumLib::LocalToGlobalIndexMap const& dof_table, GlobalVector const& x, - GlobalVector const& x_prev, double const t, double const dt, + NumLib::LocalToGlobalIndexMap const& dof_table, + std::vector const& x, + std::vector 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_x_prev = x_prev.get(indices); + auto const local_x = x[process_id]->get(indices); + auto const local_x_prev = x_prev[process_id]->get(indices); postNonLinearSolverConcrete(local_x, local_x_prev, t, dt, use_monolithic_scheme, process_id); diff --git a/ProcessLib/LocalAssemblerInterface.h b/ProcessLib/LocalAssemblerInterface.h index 0034cecce20..4edd0135b49 100644 --- a/ProcessLib/LocalAssemblerInterface.h +++ b/ProcessLib/LocalAssemblerInterface.h @@ -22,8 +22,6 @@ class LocalToGlobalIndexMap; namespace ProcessLib { -struct CoupledSolutionsForStaggeredScheme; -struct LocalCoupledSolutions; /*! Common interface for local assemblers * NumLib::ODESystemTag::FirstOrderImplicitQuasilinear ODE systems. @@ -97,7 +95,8 @@ class LocalAssemblerInterface void postNonLinearSolver(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const& dof_table, - GlobalVector const& x, GlobalVector const& x_prev, + std::vector const& x, + std::vector const& x_prev, double const t, double const dt, bool const use_monolithic_scheme, int const process_id); diff --git a/ProcessLib/PhaseField/LocalAssemblerInterface.h b/ProcessLib/PhaseField/LocalAssemblerInterface.h index 70fbb391f90..57c64043782 100644 --- a/ProcessLib/PhaseField/LocalAssemblerInterface.h +++ b/ProcessLib/PhaseField/LocalAssemblerInterface.h @@ -58,17 +58,17 @@ struct PhaseFieldLocalAssemblerInterface std::vector< std::reference_wrapper> const& dof_tables, - GlobalVector const& x, double const t, double& crack_volume, - CoupledSolutionsForStaggeredScheme const* const cpl_xs) = 0; + std::vector const& x, double const t, + double& crack_volume) = 0; virtual void computeEnergy( std::size_t mesh_item_id, std::vector< std::reference_wrapper> const& dof_tables, - GlobalVector const& x, double const t, double& elastic_energy, - double& surface_energy, double& pressure_work, - CoupledSolutionsForStaggeredScheme const* const cpl_xs) = 0; + std::vector const& x, double const t, + double& elastic_energy, double& surface_energy, + double& pressure_work) = 0; }; } // namespace PhaseField diff --git a/ProcessLib/PhaseField/PhaseFieldFEM-impl.h b/ProcessLib/PhaseField/PhaseFieldFEM-impl.h index f0193f8318d..12343c1dbd7 100644 --- a/ProcessLib/PhaseField/PhaseFieldFEM-impl.h +++ b/ProcessLib/PhaseField/PhaseFieldFEM-impl.h @@ -259,12 +259,9 @@ void PhaseFieldLocalAssembler:: computeCrackIntegral(std::size_t mesh_item_id, std::vector> const& dof_tables, - GlobalVector const& /*x*/, double const /*t*/, - double& crack_volume, - CoupledSolutionsForStaggeredScheme const* const cpl_xs) + std::vector const& x, + double const /*t*/, double& crack_volume) { - assert(cpl_xs != nullptr); - std::vector> indices_of_processes; indices_of_processes.reserve(dof_tables.size()); std::transform(dof_tables.begin(), dof_tables.end(), @@ -272,8 +269,7 @@ void PhaseFieldLocalAssembler:: [&](NumLib::LocalToGlobalIndexMap const& dof_table) { return NumLib::getIndices(mesh_item_id, dof_table); }); - auto local_coupled_xs = - getCoupledLocalSolutions(cpl_xs->coupled_xs, indices_of_processes); + auto local_coupled_xs = getCoupledLocalSolutions(x, indices_of_processes); assert(local_coupled_xs.size() == displacement_size + phasefield_size); auto const d = Eigen::Map( @@ -314,12 +310,9 @@ void PhaseFieldLocalAssembler::computeEnergy( std::size_t mesh_item_id, std::vector> const& dof_tables, - GlobalVector const& /*x*/, double const t, double& elastic_energy, - double& surface_energy, double& pressure_work, - CoupledSolutionsForStaggeredScheme const* const cpl_xs) + std::vector const& x, double const t, double& elastic_energy, + double& surface_energy, double& pressure_work) { - assert(cpl_xs != nullptr); - std::vector> indices_of_processes; indices_of_processes.reserve(dof_tables.size()); std::transform(dof_tables.begin(), dof_tables.end(), @@ -328,7 +321,7 @@ void PhaseFieldLocalAssembler::computeEnergy( { return NumLib::getIndices(mesh_item_id, dof_table); }); auto const local_coupled_xs = - getCoupledLocalSolutions(cpl_xs->coupled_xs, indices_of_processes); + getCoupledLocalSolutions(x, indices_of_processes); assert(local_coupled_xs.size() == displacement_size + phasefield_size); auto const d = Eigen::Map( diff --git a/ProcessLib/PhaseField/PhaseFieldFEM.h b/ProcessLib/PhaseField/PhaseFieldFEM.h index 7f94728b848..fd570e745c6 100644 --- a/ProcessLib/PhaseField/PhaseFieldFEM.h +++ b/ProcessLib/PhaseField/PhaseFieldFEM.h @@ -312,17 +312,15 @@ class PhaseFieldLocalAssembler : public PhaseFieldLocalAssemblerInterface std::vector< std::reference_wrapper> const& dof_tables, - GlobalVector const& x, double const t, double& crack_volume, - CoupledSolutionsForStaggeredScheme const* const cpl_xs) override; - - void computeEnergy( - std::size_t mesh_item_id, - std::vector< - std::reference_wrapper> const& - dof_tables, - GlobalVector const& x, double const t, double& elastic_energy, - double& surface_energy, double& pressure_work, - CoupledSolutionsForStaggeredScheme const* const cpl_xs) override; + std::vector const& x, double const t, + double& crack_volume) override; + + void computeEnergy(std::size_t mesh_item_id, + std::vector> const& dof_tables, + std::vector const& x, double const t, + double& elastic_energy, double& surface_energy, + double& pressure_work) override; Eigen::Map getShapeMatrix( const unsigned integration_point) const override diff --git a/ProcessLib/PhaseField/PhaseFieldProcess.cpp b/ProcessLib/PhaseField/PhaseFieldProcess.cpp index 3ae00e74c96..5a725b1f352 100644 --- a/ProcessLib/PhaseField/PhaseFieldProcess.cpp +++ b/ProcessLib/PhaseField/PhaseFieldProcess.cpp @@ -303,9 +303,9 @@ void PhaseFieldProcess::postTimestepConcreteProcess( GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::computeEnergy, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, *x[process_id], t, + pv.getActiveElementIDs(), dof_tables, x, t, _process_data.elastic_energy, _process_data.surface_energy, - _process_data.pressure_work, _coupled_solutions); + _process_data.pressure_work); #ifdef USE_PETSC double const elastic_energy = _process_data.elastic_energy; @@ -333,7 +333,8 @@ void PhaseFieldProcess::postTimestepConcreteProcess( template void PhaseFieldProcess::postNonLinearSolverConcreteProcess( - GlobalVector const& x, GlobalVector const& /*x_prev*/, const double t, + std::vector const& x, + std::vector const& /*x_prev*/, const double t, double const /*dt*/, const int process_id) { _process_data.crack_volume = 0.0; @@ -342,7 +343,7 @@ void PhaseFieldProcess::postNonLinearSolverConcreteProcess( { if (_process_data.propagating_pressurized_crack) { - auto& u = *_coupled_solutions->coupled_xs[0]; + auto& u = *x[0]; MathLib::LinAlg::scale(const_cast(u), 1 / _process_data.pressure); } @@ -360,8 +361,7 @@ void PhaseFieldProcess::postNonLinearSolverConcreteProcess( ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; GlobalExecutor::executeSelectedMemberOnDereferenced( &LocalAssemblerInterface::computeCrackIntegral, _local_assemblers, - pv.getActiveElementIDs(), dof_tables, x, t, _process_data.crack_volume, - _coupled_solutions); + pv.getActiveElementIDs(), dof_tables, x, t, _process_data.crack_volume); #ifdef USE_PETSC double const crack_volume = _process_data.crack_volume; @@ -381,7 +381,8 @@ void PhaseFieldProcess::postNonLinearSolverConcreteProcess( _process_data.pressure; INFO("Internal pressure: {:g} and Pressure error: {:.4e}", _process_data.pressure, _process_data.pressure_error); - auto& u = *_coupled_solutions->coupled_xs[0]; + + auto& u = *x[0]; MathLib::LinAlg::scale(const_cast(u), _process_data.pressure); } diff --git a/ProcessLib/PhaseField/PhaseFieldProcess.h b/ProcessLib/PhaseField/PhaseFieldProcess.h index ba2680f6eac..e7b1a995931 100644 --- a/ProcessLib/PhaseField/PhaseFieldProcess.h +++ b/ProcessLib/PhaseField/PhaseFieldProcess.h @@ -82,10 +82,10 @@ class PhaseFieldProcess final : public Process const double t, const double delta_t, int const process_id) override; - void postNonLinearSolverConcreteProcess(GlobalVector const& x, - GlobalVector const& x_prev, - const double t, double const dt, - int const process_id) override; + void postNonLinearSolverConcreteProcess( + std::vector const& x, + std::vector const& x_prev, const double t, + double const dt, int const process_id) override; void updateConstraints(GlobalVector& lower, GlobalVector& upper, int const process_id) override; diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp index 3afa9e8f79d..3aa82bf248c 100644 --- a/ProcessLib/Process.cpp +++ b/ProcessLib/Process.cpp @@ -10,7 +10,6 @@ #include "Process.h" -#include "CoupledSolutionsForStaggeredScheme.h" #include "NumLib/DOF/ComputeSparsityPattern.h" #include "NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.h" #include "NumLib/ODESolver/ConvergenceCriterionPerComponent.h" @@ -37,7 +36,6 @@ Process::Process( _jacobian_assembler(std::move(jacobian_assembler)), _global_assembler(*_jacobian_assembler), _use_monolithic_scheme(use_monolithic_scheme), - _coupled_solutions(nullptr), _integration_order(integration_order), _process_variables(std::move(process_variables)), _boundary_conditions( @@ -416,12 +414,20 @@ void Process::postTimestep(std::vector const& x, _boundary_conditions[process_id].postTimestep(t, x, process_id); } -void Process::postNonLinearSolver(GlobalVector const& x, - GlobalVector const& x_prev, const double t, - double const dt, int const process_id) +void Process::postNonLinearSolver(std::vector const& x, + std::vector const& x_prev, + const double t, double const dt, + int const process_id) { - MathLib::LinAlg::setLocalAccessibleVector(x); - MathLib::LinAlg::setLocalAccessibleVector(x_prev); + for (auto* const solution : x) + { + MathLib::LinAlg::setLocalAccessibleVector(*solution); + } + for (auto* const solution : x_prev) + { + MathLib::LinAlg::setLocalAccessibleVector(*solution); + } + postNonLinearSolverConcreteProcess(x, x_prev, t, dt, process_id); } diff --git a/ProcessLib/Process.h b/ProcessLib/Process.h index 78ad10a6afc..b23f8ff616f 100644 --- a/ProcessLib/Process.h +++ b/ProcessLib/Process.h @@ -35,7 +35,6 @@ class Mesh; namespace ProcessLib { -struct CoupledSolutionsForStaggeredScheme; class Process : public NumLib::ODESystem< // TODO: later on use a simpler ODE system @@ -68,7 +67,8 @@ class Process /// 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& x_prev, + void postNonLinearSolver(std::vector const& x, + std::vector const& x_prev, const double t, double const dt, int const process_id); @@ -96,22 +96,12 @@ class Process MathLib::MatrixSpecifications getMatrixSpecifications( const int process_id) const override; - void setCoupledSolutionsForStaggeredScheme( - CoupledSolutionsForStaggeredScheme* const coupled_solutions) - { - _coupled_solutions = coupled_solutions; - } - void updateDeactivatedSubdomains(double const time, const int process_id); virtual bool isMonolithicSchemeUsed() const { return _use_monolithic_scheme; } - virtual void setCoupledTermForTheStaggeredSchemeToLocalAssemblers( - int const /*process_id*/) - { - } virtual void extrapolateIntegrationPointValuesToNodes( const double /*t*/, @@ -273,8 +263,9 @@ class Process } virtual void postNonLinearSolverConcreteProcess( - GlobalVector const& /*x*/, GlobalVector const& /*x_prev*/, - const double /*t*/, double const /*dt*/, int const /*process_id*/) + std::vector const& /*x*/, + std::vector const& /*x_prev*/, const double /*t*/, + double const /*dt*/, int const /*process_id*/) { } @@ -369,10 +360,6 @@ class Process const bool _use_monolithic_scheme; - /// Pointer to CoupledSolutionsForStaggeredScheme, which contains the - /// references to the solutions of the coupled processes. - CoupledSolutionsForStaggeredScheme* _coupled_solutions; - /// Order of the integration method for element-wise integration. /// The Gauss-Legendre integration method and available orders is /// implemented in MathLib::GaussLegendre. diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h index 73ffda62eb7..30a9d207ac0 100644 --- a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h +++ b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h @@ -22,7 +22,6 @@ #include "MathLib/EigenBlockMatrixView.h" #include "MathLib/KelvinVector.h" #include "NumLib/Function/Interpolation.h" -#include "ProcessLib/CoupledSolutionsForStaggeredScheme.h" #include "ProcessLib/Utils/SetOrGetIntegrationPointData.h" #include "ProcessLib/Utils/TransposeInPlace.h" diff --git a/ProcessLib/TH2M/TH2MFEM-impl.h b/ProcessLib/TH2M/TH2MFEM-impl.h index 930b4a23b6f..fa59f746c1c 100644 --- a/ProcessLib/TH2M/TH2MFEM-impl.h +++ b/ProcessLib/TH2M/TH2MFEM-impl.h @@ -20,7 +20,6 @@ #include "MathLib/EigenBlockMatrixView.h" #include "MathLib/KelvinVector.h" #include "NumLib/Function/Interpolation.h" -#include "ProcessLib/CoupledSolutionsForStaggeredScheme.h" #include "ProcessLib/Utils/SetOrGetIntegrationPointData.h" namespace ProcessLib diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h index 02274a65177..8477226eb32 100644 --- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h +++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM-impl.h @@ -23,7 +23,6 @@ #include "NumLib/Function/Interpolation.h" #include "NumLib/NumericalStability/AdvectionMatrixAssembler.h" #include "NumLib/NumericalStability/HydrodynamicDispersion.h" -#include "ProcessLib/CoupledSolutionsForStaggeredScheme.h" #include "ProcessLib/Utils/SetOrGetIntegrationPointData.h" #include "ThermoHydroMechanicsFEM.h" diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h index f39c809835e..c15321f5f84 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h +++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM-impl.h @@ -11,7 +11,6 @@ #pragma once #include "NumLib/DOF/DOFTableUtil.h" -#include "ProcessLib/CoupledSolutionsForStaggeredScheme.h" #include "ThermoMechanicalPhaseFieldFEM.h" namespace ProcessLib diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp index 49251ed7e7f..bb990ace0aa 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp +++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp @@ -306,8 +306,8 @@ void ThermoMechanicalPhaseFieldProcess:: template void ThermoMechanicalPhaseFieldProcess:: - postNonLinearSolverConcreteProcess(GlobalVector const& x, - GlobalVector const& x_prev, + postNonLinearSolverConcreteProcess(std::vector const& x, + std::vector const& x_prev, const double t, double const dt, const int process_id) { diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h index 2fa5633e108..cc6cec90450 100644 --- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h +++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h @@ -114,10 +114,10 @@ class ThermoMechanicalPhaseFieldProcess final : public Process double const t, double const dt, int const process_id) override; - void postNonLinearSolverConcreteProcess(GlobalVector const& x, - GlobalVector const& x_prev, - const double t, double const dt, - int const process_id) override; + void postNonLinearSolverConcreteProcess( + std::vector const& x, + std::vector const& x_prev, const double t, + double const dt, int const process_id) override; // To be replaced. NumLib::LocalToGlobalIndexMap& getDOFTableByProcessID( diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp index 792bf06d7be..435efd21741 100644 --- a/ProcessLib/TimeLoop.cpp +++ b/ProcessLib/TimeLoop.cpp @@ -14,7 +14,6 @@ #include "BaseLib/Error.h" #include "BaseLib/RunTime.h" -#include "CoupledSolutionsForStaggeredScheme.h" #include "MathLib/LinAlg/LinAlg.h" #include "NumLib/ODESolver/ConvergenceCriterionPerComponent.h" #include "NumLib/ODESolver/PETScNonlinearSolver.h" @@ -92,21 +91,11 @@ void postTimestepForAllProcesses( std::vector const& process_solutions, std::vector const& process_solutions_prev) { - // All _per_process_data share the first process. - bool const is_staggered_coupling = - !isMonolithicProcess(*per_process_data[0]); - for (auto& process_data : per_process_data) { auto const process_id = process_data->process_id; auto& pcs = process_data->process; - if (is_staggered_coupling) - { - CoupledSolutionsForStaggeredScheme coupled_solutions( - process_solutions); - pcs.setCoupledSolutionsForStaggeredScheme(&coupled_solutions); - } pcs.computeSecondaryVariable(t, dt, process_solutions, *process_solutions_prev[process_id], process_id); @@ -266,8 +255,7 @@ NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess( return nonlinear_solver_status; } - process.postNonLinearSolver(*x[process_id], *x_prev[process_id], t, delta_t, - process_id); + process.postNonLinearSolver(x, x_prev, t, delta_t, process_id); return nonlinear_solver_status; } @@ -737,16 +725,6 @@ TimeLoop::solveCoupledEquationSystemsByStaggeredScheme( BaseLib::RunTime time_timestep_process; time_timestep_process.start(); - // The following setting of coupled_solutions can be removed only if - // the CoupledSolutionsForStaggeredScheme and related functions are - // removed totally from the computation of the secondary variable - // and from post-time functions. - CoupledSolutionsForStaggeredScheme coupled_solutions( - _process_solutions); - - process_data->process.setCoupledSolutionsForStaggeredScheme( - &coupled_solutions); - nonlinear_solver_status = solveOneTimeStepOneProcess( _process_solutions, _process_solutions_prev, timestep_id, t, dt, *process_data, _outputs); @@ -893,10 +871,6 @@ double TimeLoop::computeRelativeSolutionChangeFromPreviousTimestep( void TimeLoop::preOutputInitialConditions(const double t) const { - // All _per_process_data share the first process. - bool const is_staggered_coupling = - !isMonolithicProcess(*_per_process_data[0]); - for (auto const& process_data : _per_process_data) { // If nonlinear solver diverged, the solution has already been @@ -909,35 +883,6 @@ void TimeLoop::preOutputInitialConditions(const double t) const auto const process_id = process_data->process_id; auto& pcs = process_data->process; - if (!is_staggered_coupling) - { - // 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); - - pcs.preTimestep(_process_solutions, _start_time, dt, process_id); - - pcs.preOutput(_start_time, dt, _process_solutions, - _process_solutions_prev, process_id); - - // Update secondary variables, which might be uninitialized, before - // output. - pcs.computeSecondaryVariable(_start_time, dt, _process_solutions, - *_process_solutions_prev[process_id], - process_id); - } - else - { - CoupledSolutionsForStaggeredScheme coupled_solutions( - _process_solutions); - - process_data->process.setCoupledSolutionsForStaggeredScheme( - &coupled_solutions); - process_data->process - .setCoupledTermForTheStaggeredSchemeToLocalAssemblers( - process_id); - // dummy value to handle the time derivative terms more or less // correctly, i.e. to ignore them. double const dt = 1; @@ -953,7 +898,6 @@ void TimeLoop::preOutputInitialConditions(const double t) const pcs.computeSecondaryVariable(_start_time, dt, _process_solutions, *_process_solutions_prev[process_id], process_id); - } } } } // namespace ProcessLib diff --git a/ProcessLib/VectorMatrixAssembler.h b/ProcessLib/VectorMatrixAssembler.h index 23cc368a6d0..41c2103a071 100644 --- a/ProcessLib/VectorMatrixAssembler.h +++ b/ProcessLib/VectorMatrixAssembler.h @@ -22,7 +22,6 @@ class LocalToGlobalIndexMap; namespace ProcessLib { -struct CoupledSolutionsForStaggeredScheme; class LocalAssemblerInterface;