## [Libmesh-users] Unsteady Incompressible Navier Stokes

 [Libmesh-users] Unsteady Incompressible Navier Stokes From: Sahai, Amal - 2014-07-08 08:09:44 ```I was a little unsure of the following bit of code in Example 2 for the System of Equations (the Incompressible Unsteady Navier Stokes Solver). const bool pin_pressure = true; if (pin_pressure) { const unsigned int pressure_node = 0; const Real p_value = 0.0; for (unsigned int c=0; cn_nodes(); c++) if (elem->node(c) == pressure_node) { Kpp(c,c) += penalty; Fp(c) += penalty*p_value; } } } // end boundary condition section Why exactly is "elem->node(c) == pressure_node" condition being used? I would imagine that pressure at all points on the surface where Dirichlet Boundary condition is being imposed would be made zero. In that case why are nodes with the global id number 0 being considered? Also, since Pressure is a First order approximation, how does LibMesh decide on which nodes (in a given element) would be used be for storing Pressure values. Regards Amal Regards Amal ```

 [Libmesh-users] Unsteady Incompressible Navier Stokes From: Sahai, Amal - 2014-07-08 08:09:44 ```I was a little unsure of the following bit of code in Example 2 for the System of Equations (the Incompressible Unsteady Navier Stokes Solver). const bool pin_pressure = true; if (pin_pressure) { const unsigned int pressure_node = 0; const Real p_value = 0.0; for (unsigned int c=0; cn_nodes(); c++) if (elem->node(c) == pressure_node) { Kpp(c,c) += penalty; Fp(c) += penalty*p_value; } } } // end boundary condition section Why exactly is "elem->node(c) == pressure_node" condition being used? I would imagine that pressure at all points on the surface where Dirichlet Boundary condition is being imposed would be made zero. In that case why are nodes with the global id number 0 being considered? Also, since Pressure is a First order approximation, how does LibMesh decide on which nodes (in a given element) would be used be for storing Pressure values. Regards Amal Regards Amal ```
 Re: [Libmesh-users] Unsteady Incompressible Navier Stokes From: Roy Stogner - 2014-07-08 14:21:57 ```On Tue, 8 Jul 2014, Sahai, Amal wrote: > Why exactly is "elem->node(c) == pressure_node" condition being > used? As the "laziest" way of constraining away the kernel of the Incompressible Navier-Stokes problem. In the lid-driven cavity problem there are no boundary conditions for the pressure, and the PDE on the interior only defines *relative* pressure: you could add a constant pressure to any solution of the PDE and get another solution. If you simply discretize an operator like this with a 1-D kernel, you get a matrix with a 1-D kernel. Not all solvers are happy with a singular matrix, so we make the problem well-posed by adding a constraint for the pressure - in this case by pinning the pressure at a single point; in another example by using a Lagrange multiplier to constrain the average pressure in the domain. > In that case why are nodes with the global id number 0 being > considered? Also, since Pressure is a First order approximation, how > does LibMesh decide on which nodes (in a given element) would be > used be for storing Pressure values. libMesh uses vertex nodes to store pressure values, numbers vertex nodes before non-vertex nodes, and numbers Lagrange degrees of freedom in the same order as node numbering. All of those assumptions are necessary to make the code you were looking at correct. For a less "brittle" pressure pinning code you could see fem_system_ex1; the only assumption in that one is that the problem domain includes the origin. The least fragile technique is probably the Lagrange multiplier in systems_of_equations_ex5; the only implicit assumption there is that your domain is connected. --- Roy ```