Commit 4f93077c authored by Timo Koch's avatar Timo Koch
Browse files

Merge branch 'fix/periodic-box' into 'master'

Fix/periodic box

Closes #934

See merge request !2256

(cherry picked from commit 94b468f4)

4228c1f4 [fvassembler] Correct enforcement of periodic constraints
17aa9e7c [test][1p] Update periodic box test solution
parent 1d9e5815
......@@ -140,7 +140,7 @@ public:
localAssembler.assembleJacobianAndResidual(*jacobian_, *residual_, *gridVariables_, partialReassembler);
});
enforcePeriodicConstraints_(*jacobian_, *residual_, *gridGeometry_);
enforcePeriodicConstraints_(*jacobian_, *residual_, curSol, *gridGeometry_);
}
/*!
......@@ -416,7 +416,7 @@ private:
}
template<class GG> std::enable_if_t<GG::discMethod == DiscretizationMethod::box, void>
enforcePeriodicConstraints_(JacobianMatrix& jac, SolutionVector& res, const GG& gridGeometry)
enforcePeriodicConstraints_(JacobianMatrix& jac, SolutionVector& res, const SolutionVector& curSol, const GG& gridGeometry)
{
for (const auto& m : gridGeometry.periodicVertexMap())
{
......@@ -429,6 +429,7 @@ private:
jac[m.first][it.index()] += (*it);
// enforce constraint in second row
res[m.second] = curSol[m.second] - curSol[m.first];
for (auto it = jac[m.second].begin(); it != end; ++it)
(*it) = it.index() == m.second ? 1.0 : it.index() == m.first ? -1.0 : 0.0;
}
......@@ -436,7 +437,7 @@ private:
}
template<class GG> std::enable_if_t<GG::discMethod != DiscretizationMethod::box, void>
enforcePeriodicConstraints_(JacobianMatrix& jac, SolutionVector& res, const GG& gridGeometry) {}
enforcePeriodicConstraints_(JacobianMatrix& jac, SolutionVector& res, const SolutionVector& curSol, const GG& gridGeometry) {}
//! pointer to the problem to be solved
std::shared_ptr<const Problem> problem_;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment