Skip to content
Snippets Groups Projects
Commit a08b0e51 authored by wenqing's avatar wenqing
Browse files

[HT] Enabled more flexible process order within the staggered coupling

parent 1acc4362
No related branches found
No related tags found
No related merge requests found
...@@ -153,8 +153,8 @@ void HTProcess::assembleWithJacobianConcreteProcess( ...@@ -153,8 +153,8 @@ void HTProcess::assembleWithJacobianConcreteProcess(
ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
GlobalExecutor::executeSelectedMemberDereferenced( GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, pv.getActiveElementIDs(), dof_tables, t, x, _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, x, xdot,
xdot, dxdot_dx, dx_dx, M, K, b, Jac, _coupled_solutions); dxdot_dx, dx_dx, M, K, b, Jac, _coupled_solutions);
} }
void HTProcess::preTimestepConcreteProcess(GlobalVector const& x, void HTProcess::preTimestepConcreteProcess(GlobalVector const& x,
...@@ -193,8 +193,7 @@ void HTProcess::setCoupledTermForTheStaggeredSchemeToLocalAssemblers() ...@@ -193,8 +193,7 @@ void HTProcess::setCoupledTermForTheStaggeredSchemeToLocalAssemblers()
ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0]; ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
GlobalExecutor::executeSelectedMemberOnDereferenced( GlobalExecutor::executeSelectedMemberOnDereferenced(
&HTLocalAssemblerInterface::setStaggeredCoupledSolutions, &HTLocalAssemblerInterface::setStaggeredCoupledSolutions,
_local_assemblers, pv.getActiveElementIDs(), _local_assemblers, pv.getActiveElementIDs(), _coupled_solutions);
_coupled_solutions);
} }
std::tuple<NumLib::LocalToGlobalIndexMap*, bool> std::tuple<NumLib::LocalToGlobalIndexMap*, bool>
...@@ -221,29 +220,27 @@ HTProcess::getDOFTableForExtrapolatorData() const ...@@ -221,29 +220,27 @@ HTProcess::getDOFTableForExtrapolatorData() const
manage_storage); manage_storage);
} }
void HTProcess::setCoupledSolutionsOfPreviousTimeStep() void HTProcess::setCoupledSolutionsOfPreviousTimeStepPerProcess(
const int process_id)
{ {
const auto number_of_coupled_solutions = const auto& x_t0 = _xs_previous_timestep[process_id];
_coupled_solutions->coupled_xs.size(); if (x_t0 == nullptr)
_coupled_solutions->coupled_xs_t0.clear();
_coupled_solutions->coupled_xs_t0.reserve(number_of_coupled_solutions);
const int process_id = _coupled_solutions->process_id;
for (std::size_t i = 0; i < number_of_coupled_solutions; i++)
{ {
const auto& x_t0 = _xs_previous_timestep[process_id]; OGS_FATAL(
if (x_t0 == nullptr) "Memory is not allocated for the global vector of the solution of "
{ "the previous time step for the staggered scheme.\n It can be done "
OGS_FATAL( "by overriding Process::preTimestepConcreteProcess (ref. "
"Memory is not allocated for the global vector " "HTProcess::preTimestepConcreteProcess) ");
"of the solution of the previous time step for the ."
"staggered scheme.\n It can be done by overriding "
"Process::preTimestepConcreteProcess"
"(ref. HTProcess::preTimestepConcreteProcess) ");
}
MathLib::LinAlg::setLocalAccessibleVector(*x_t0);
_coupled_solutions->coupled_xs_t0.emplace_back(x_t0.get());
} }
_coupled_solutions->coupled_xs_t0[process_id] = x_t0.get();
}
void HTProcess::setCoupledSolutionsOfPreviousTimeStep()
{
_coupled_solutions->coupled_xs_t0.resize(2);
setCoupledSolutionsOfPreviousTimeStepPerProcess(_heat_transport_process_id);
setCoupledSolutionsOfPreviousTimeStepPerProcess(_hydraulic_process_id);
} }
Eigen::Vector3d HTProcess::getFlux(std::size_t element_id, Eigen::Vector3d HTProcess::getFlux(std::size_t element_id,
......
...@@ -101,8 +101,11 @@ private: ...@@ -101,8 +101,11 @@ private:
double const dt, double const dt,
const int process_id) override; const int process_id) override;
void setCoupledSolutionsOfPreviousTimeStepPerProcess(const int process_id);
/// Set the solutions of the previous time step to the coupled term. /// Set the solutions of the previous time step to the coupled term.
/// It only performs for the staggered scheme. /// It is only for the staggered scheme, and it must be called within
/// the coupling loop because that the coupling term is only created there.
void setCoupledSolutionsOfPreviousTimeStep(); void setCoupledSolutionsOfPreviousTimeStep();
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment