Incomprensible output

I would appreciate some helps in order to clarify the nature of my simulation output. This simulation regards the flow around a cube contained inside a cylindrical channel in 3D. The mathematical model are the Navier-Stokes equations and the continuity equation (div U = 0). I’ve develop the code for a 2d numerical simulation and the output is correct, this lead me to think that the variational problem which is the same for 2d and 3d problem (correct me if i’m wrong), is well posed in FEniCS. When I try to run the simulation on the 3D geometry i’ve got the following (output) both in term of pressure and velocity fields (u,p).

I want to explain how I’ve managed the geometry in few steps:

  1. Build it in FreeCAD
  2. Imported it in GMSH
  3. Define the Boundaries through command add–>surfaces and labeled them with number from 1 to 4
    3.1) Wall which corresponds to tag ‘1’ represents the surface associated with the cylinder
    3.2) Obstalce which corresponds to tag ‘2’ represent the inner cube surfaces
    3.3) Inlet (Outlet) which correspond to tag ‘3’ (‘4’) represent the inlet and outlet surfaces associated to the cylinder
  4. Define volume with add–>volumes and labeled it with 5
  5. Convert .msh file into .xml file which generates two additional file: physical_region.xml and facet_region.xml. These two files must contains the informations about boundaries automatically. Then the following line are implemented in order to elaborate the geometry in python3 before computing the simulation:
    % Read mesh
    mesh = Mesh(‘file.xml’)
    cd=MeshFunction(‘size_t’, mesh, ‘prova_physical_region.xml’)
    fd=MeshFunction(‘size_t’, mesh, ‘prova_facet_region.xml’)
    bcu_inflow = DirichletBC(V, Constant((2, 2, 0)), ‘3’)
    bcu_wall = DirichletBC(V, Constant((0, 0, 0)), ‘1’)
    bcu_cube = DirichletBC(V, Constant((0, 0, 0)), ‘2’)
    bcp_outflow = DirichletBC(Q, Constant(0), ‘4’)

The simulation doesn’t give any error and computes the result showed in (output) which has no sense in our physical context (fluid dynamics), then I would like to know what the problem is. I would stress that the mesh is well charged in FEniCS.


As you have not supplied any code that can reproduce the behaviour, it is very hard for anyone to give you any guidance.

It looks like you are using matplotlib for visualization; I would recommend using Paraview for 3D visualization (saving the velocity or pressure to a PVD-file (File("output.pvd") or an xdmf-file (XDMFFile("output.xdmf"))

1 Like