diff --git a/ProcessLib/LocalAssemblerInterface.cpp b/ProcessLib/LocalAssemblerInterface.cpp index c626e7cb71cd2b915e6f5fad759817bc2318929a..7283a36809ce342102a4c774bf57abcfa4eaee5a 100644 --- a/ProcessLib/LocalAssemblerInterface.cpp +++ b/ProcessLib/LocalAssemblerInterface.cpp @@ -13,7 +13,6 @@ namespace ProcessLib { - void LocalAssemblerInterface::assembleWithCoupledTerm( double const /*t*/, std::vector<double> const& /*local_x*/, std::vector<double>& /*local_M_data*/, @@ -22,8 +21,8 @@ void LocalAssemblerInterface::assembleWithCoupledTerm( LocalCouplingTerm const& /*coupling_term*/) { OGS_FATAL( - "The assembleWithCoupledTerm() function is not implemented in the local " - "assembler."); + "The assembleWithCoupledTerm() function is not implemented in the " + "local assembler."); } void LocalAssemblerInterface::assembleWithJacobian( @@ -54,10 +53,9 @@ void LocalAssemblerInterface::assembleWithJacobianAndCouping( } void LocalAssemblerInterface::computeSecondaryVariable( - std::size_t const mesh_item_id, - NumLib::LocalToGlobalIndexMap const& dof_table, - double const t, GlobalVector const& x, - StaggeredCouplingTerm const& coupled_term) + std::size_t const mesh_item_id, + NumLib::LocalToGlobalIndexMap const& dof_table, double const t, + GlobalVector const& x, StaggeredCouplingTerm const& coupled_term) { auto const indices = NumLib::getIndices(mesh_item_id, dof_table); auto const local_x = x.get(indices); @@ -68,11 +66,14 @@ void LocalAssemblerInterface::computeSecondaryVariable( } else { - auto const local_coupled_xs - = getCurrentLocalSolutionsOfCoupledProcesses( - coupled_term.coupled_xs, indices); - computeSecondaryVariableWithCoupledProcessConcrete(t, local_x, - local_coupled_xs); + auto const local_coupled_xs = + getCurrentLocalSolutionsOfCoupledProcesses(coupled_term.coupled_xs, + indices); + if (local_coupled_xs.size() != 0) + computeSecondaryVariableWithCoupledProcessConcrete( + t, local_x, local_coupled_xs); + else + computeSecondaryVariableConcrete(t, local_x); } } diff --git a/ProcessLib/UncoupledProcessesTimeLoop.cpp b/ProcessLib/UncoupledProcessesTimeLoop.cpp index f31970e6894ce354fe4bdacf8ee519e8e72746aa..c830ccfeed9792e871877ab9428b102ddc2dd020 100644 --- a/ProcessLib/UncoupledProcessesTimeLoop.cpp +++ b/ProcessLib/UncoupledProcessesTimeLoop.cpp @@ -491,7 +491,7 @@ UncoupledProcessesTimeLoop::UncoupledProcessesTimeLoop( bool UncoupledProcessesTimeLoop::setCoupledSolutions() { // Do nothing if process are not coupled - if (!_global_coupling_conv_crit && _global_coupling_max_iterations == 1) + if ((!_global_coupling_conv_crit) || _global_coupling_max_iterations == 1) return false; unsigned pcs_idx = 0; diff --git a/ProcessLib/VectorMatrixAssembler.cpp b/ProcessLib/VectorMatrixAssembler.cpp index 0420af82b719d319bcb3ab2e163b44d9836d59df..c60c09967d6a17401495684b315c62c66b563ed7 100644 --- a/ProcessLib/VectorMatrixAssembler.cpp +++ b/ProcessLib/VectorMatrixAssembler.cpp @@ -79,13 +79,22 @@ void VectorMatrixAssembler::assemble( getPreviousLocalSolutionsOfCoupledProcesses(coupling_term, indices); auto local_coupled_xs = getCurrentLocalSolutionsOfCoupledProcesses( coupling_term.coupled_xs, indices); - ProcessLib::LocalCouplingTerm local_coupling_term( - coupling_term.dt, coupling_term.coupled_processes, - std::move(local_coupled_xs0), std::move(local_coupled_xs)); - local_assembler.assembleWithCoupledTerm(t, local_x, _local_M_data, - _local_K_data, _local_b_data, - local_coupling_term); + if (local_coupled_xs0.size() == 0 || local_coupled_xs.size() == 0) + { + local_assembler.assemble(t, local_x, _local_M_data, _local_K_data, + _local_b_data); + } + else + { + ProcessLib::LocalCouplingTerm local_coupling_term( + coupling_term.dt, coupling_term.coupled_processes, + std::move(local_coupled_xs0), std::move(local_coupled_xs)); + + local_assembler.assembleWithCoupledTerm( + t, local_x, _local_M_data, _local_K_data, _local_b_data, + local_coupling_term); + } } auto const num_r_c = indices.size(); @@ -137,14 +146,23 @@ void VectorMatrixAssembler::assembleWithJacobian( getPreviousLocalSolutionsOfCoupledProcesses(coupling_term, indices); auto local_coupled_xs = getCurrentLocalSolutionsOfCoupledProcesses( coupling_term.coupled_xs, indices); - ProcessLib::LocalCouplingTerm local_coupling_term( - coupling_term.dt, coupling_term.coupled_processes, - std::move(local_coupled_xs0), std::move(local_coupled_xs)); - - _jacobian_assembler->assembleWithJacobianAndCouping( - local_assembler, t, local_x, local_xdot, dxdot_dx, dx_dx, - _local_M_data, _local_K_data, _local_b_data, _local_Jac_data, - local_coupling_term); + if (local_coupled_xs0.size() == 0 || local_coupled_xs.size() == 0) + { + ProcessLib::LocalCouplingTerm local_coupling_term( + coupling_term.dt, coupling_term.coupled_processes, + std::move(local_coupled_xs0), std::move(local_coupled_xs)); + + _jacobian_assembler->assembleWithJacobianAndCouping( + local_assembler, t, local_x, local_xdot, dxdot_dx, dx_dx, + _local_M_data, _local_K_data, _local_b_data, _local_Jac_data, + local_coupling_term); + } + else + { + _jacobian_assembler->assembleWithJacobian( + local_assembler, t, local_x, local_xdot, dxdot_dx, dx_dx, + _local_M_data, _local_K_data, _local_b_data, _local_Jac_data); + } } auto const num_r_c = indices.size();