Skip to content

Commit

Permalink
Merge branch 'fix-free-global-matrices' into 'master'
Browse files Browse the repository at this point in the history
Fix: Free global matrices after use.

See merge request ogs/ogs!4797
  • Loading branch information
chleh committed Nov 15, 2023
2 parents f1bb141 + d627e19 commit a2a0f88
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions ProcessLib/ComponentTransport/ComponentTransportProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,19 +462,18 @@ void ComponentTransportProcess::preOutputConcreteProcess(
{
auto const matrix_specification = getMatrixSpecifications(process_id);

std::size_t matrix_id = 0u;
auto& M = NumLib::GlobalMatrixProvider::provider.getMatrix(
matrix_specification, matrix_id);
auto& K = NumLib::GlobalMatrixProvider::provider.getMatrix(
matrix_specification, matrix_id);
auto& b =
NumLib::GlobalVectorProvider::provider.getVector(matrix_specification);
auto M = MathLib::MatrixVectorTraits<GlobalMatrix>::newInstance(
matrix_specification);
auto K = MathLib::MatrixVectorTraits<GlobalMatrix>::newInstance(
matrix_specification);
auto b = MathLib::MatrixVectorTraits<GlobalVector>::newInstance(
matrix_specification);

M.setZero();
K.setZero();
b.setZero();
M->setZero();
K->setZero();
b->setZero();

assembleConcreteProcess(t, dt, x, x_prev, process_id, M, K, b);
assembleConcreteProcess(t, dt, x, x_prev, process_id, *M, *K, *b);

std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
dof_tables;
Expand All @@ -494,7 +493,8 @@ void ComponentTransportProcess::preOutputConcreteProcess(

if (_use_monolithic_scheme)
{
auto const residuum = computeResiduum(dt, *x[0], *x_prev[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)
{
Expand All @@ -505,8 +505,8 @@ void ComponentTransportProcess::preOutputConcreteProcess(
}
else
{
auto const residuum =
computeResiduum(dt, *x[process_id], *x_prev[process_id], M, K, b);
auto const residuum = computeResiduum(dt, *x[process_id],
*x_prev[process_id], *M, *K, *b);
transformVariableFromGlobalVector(residuum, 0, dof_tables[process_id],
*_residua[process_id],
std::negate<double>());
Expand Down

0 comments on commit a2a0f88

Please sign in to comment.