After I obtained geometry, for example in the explanation in this post, the next step is to prepare a case dictionary for OpenFOAM. It tells what kind of physics you want to play with. And there are a lot of things you can play with.

In this post, a general step will be posted. Further improvements will be made along the way as I do more simulations.

Step 0 Check mesh

  1. Orintate the mesh towards x-positive direction
  2. Export from blender warning: the first line needs to be changed: solid final_rotate

Step 1 BlockMesh

  1. Look for 8 points to build a block

  2. Obtain coordinates: (a b c)

  3. Extend block An example would be:

    • -x: time 5
    • x: time 10
    • y: time 5
    • -y: time 5
    • z: time 5
    • -y: time 5

    A good example looks like this:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    
    (-60  50 45)
    ( 90  50 45)
    ( 90 -50 45)
    (-60 -50 45)
    (-60  50 -45)
    ( 90  50 -45)
    ( 90 -50 -45)
    (-60 -50 -45)
    
    (-300  250 225)
    ( 900  250 225)
    ( 900 -250 225)
    (-300 -250 225)
    (-300  250 -225)
    ( 900  250 -225)
    ( 900 -250 -225)
    (-300 -250 -225)
    
  4. Replace vertices in blockMeshDict file

  5. Move stl file to /constant/triSurface

Step 2 Run commands

  1. blockmesh
  2. snappyHexMesh -overwrite Without overwrite, you can visualize the refinement process.

Step 3 Fine tune snappyHexMesh

Refine some regions. This part will be further expanded in the future posts.

Step 4 Run simulation

For example, simpleFoam.

FAQ

Error: Cannot find triSurfaceMesh at xxx

Make sure the mesh file is in format of ASC-II, instead of binary. Double check the first line of that stl file.