Hello,
I tried to solve a slightly modified version of step-22 and obtained strange results. The only difference in my case with respect to step-22 is the definition of the boundary conditions. In my case, no Dirichlet boundary conditions are applied on the velocity. Instead of that, a pressure boundary condition is applied such that If x =- 2 then p(x) = -2, and if x = 2 then x = 2.
I expected to get a solution showing a pressure gradient along the x-axis, and a velocity field with a non-positive x-component. However, for some reason, the solution is different. Attached are the resulting VTK files from running my code.
In terms of the implementation, here is the list of modifications in the attached step-22.cc file:
1) The boundary_id was set to 1 on the faces where |x| = 2. The boundary_id of the rest of the faces is 0.
2) The boundary conditions were applied on the pressure field and not ton he velocity field by using the appropriate component_mask.
3) The function BoundaryValues::value was modified to the requested form.
I commented the places where I changed the code and added the comment “Oded Yaakobi - October 4, 2017” to allow locating those places easily.
It would be great to know if someone has an idea what is wrong in my implementation.
Thanks,
Oded