Skip to content
Snippets Groups Projects
Verified Commit 6daffc24 authored by Paul Dechamps's avatar Paul Dechamps :speech_balloon:
Browse files

(fix) Pinned DOF for Neumann boundary condition

Ensures that the same DOF is pinned between two consecutive runs when using Neumann boundary condition
parent 01f99c4c
No related branches found
No related tags found
No related merge requests found
Pipeline #49837 passed
...@@ -77,9 +77,16 @@ void Initial::write(std::ostream &out) const ...@@ -77,9 +77,16 @@ void Initial::write(std::ostream &out) const
Dirichlet::Dirichlet(std::shared_ptr<tbox::MshData> _msh, int no, int dim, double alpha, double beta, bool pin) : Assign(_msh, no) Dirichlet::Dirichlet(std::shared_ptr<tbox::MshData> _msh, int no, int dim, double alpha, double beta, bool pin) : Assign(_msh, no)
{ {
f = new F0PsPhiInf(dim, alpha, beta); f = new F0PsPhiInf(dim, alpha, beta);
// Only retain the first node, so that the DOF associated to this node will be pinned // Only retain one node, so that the DOF associated to this node will be pinned
if (pin) if (pin)
this->nodes.resize(1); {
// Pin node with min x min y min z
auto it = std::min_element(nodes.begin(), nodes.end(), [](Node *n1, Node *n2) {
return n1->pos[0] < n2->pos[0] || (n1->pos[0] == n2->pos[0] && n1->pos[1] < n2->pos[1]) || (n1->pos[0] == n2->pos[0] && n1->pos[1] == n2->pos[1] && n1->pos[2] < n2->pos[2]);
});
nodes.resize(1);
nodes[0] = *it;
}
} }
Dirichlet::Dirichlet(std::shared_ptr<tbox::MshData> _msh, std::string const &name, int dim, double alpha, double beta) : Assign(_msh, name) Dirichlet::Dirichlet(std::shared_ptr<tbox::MshData> _msh, std::string const &name, int dim, double alpha, double beta) : Assign(_msh, name)
{ {
......
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