Hello !
I am trying to solve the incompressible and invsicid flow in FreeFEM for a 3D geometry. I have written the code to work in parallel using PETSc. The mesh is imported from GMSH mesh file. I am not sure what is wrong with my code as the solution is not correct. I thought the dt might be a problem but changing dt doesn’t affect the result.

The weak form of the GE I used,

Boundary Conditions:

Dirchlet B.C. for velocity at inlet.

Neumaan B.C. for pressure at outlet

Periodic B.C. on the top, bottom, front and back walls of the domain.

I assume you are aware of the problems of singularities and finite-time blow-up in the incompressible Euler equations. Have you already checked your formulation with a simpler 2D/3D sequential problem to rule out such issues?

I was actually checking the code with the cylinder case. The problem was there in the sequential case too. No, I am not very well aware of the issues with them. Can you please share ?

Well the system is hyperbolic except for the divergence-free constraint induced by the pressure. Also, the BCs in the Euler equations are not equivalent to those of the NSE (eg your no-slip condition on the cylinder does not make sense).

What is it precisely that you need from your model?

Okay. But, if no viscosity is present then there won’t be any “no-slip” bc on the cylinder body. There will be stagnation point in front of the cylinder but doesn’t necessarily require the velocity to be zero everywhere on the surface. So, it is free slip only, right ? (I haven’t applied any bc for velocity/pressure on the surface of the cylinder).

Sorry, I only glanced at your code and misinterpreted your BC. You have not imposed no-slip BC, but you also have not imposed no-penetration BC’s… You just have a hole in your mesh.

Note that there is no natural Neumann condition in the Euler equations since there is no viscous term to integrate by parts…

Assuming you mean all boundaries except inlet AND outlet, yes. but that is not trivial with curved boundaries. What are you trying to do? I thought you wanted periodic boundaries?

Yeah with curved boundary, it is any issue. I have periodic bc on the other boundaries except the cylinder boundary, inlet and outlet, does that prevent the penetration. Any help on implementing the no penetration bc for general boundaries ?

Hello,
The no penetration boundary conditions is one possible issue.
I think that another one is the implicit treatment of convection without viscosity. I would recommend using convect().

I had been using convect() earlier but it is not recommended with periodic boundary conditions. I read one discussion about it in the community. So, I switched to this method.

I understand your reason, but I think that the implicit method is unstable here. You could try with convect and no penetration condition instead of periodic, to see if it works or not.

Hello,
Based on the recommendations, I modified my code to remove the periodic boundary condition and use convect function for the non-linear term along with no-penetration BC using the method suggested by @fb77. Thanks a lot, seems like the divergence problem is solved. But the velocity field is still patchy (See the image for reference). I don’t understand why there are patches of zero velocity. Is it due to the FEM element type. I am using P2 for velocity and P1 for pressure.