Mesh refinement with SnappyHexMesh

Mesh refinement is probably one of the hardest components of OpenFOAM, for me this mainly revolves around snappyhexmesh and blockmesh, with one or more STL files exported from SolidWorks as the input.

The first thing to get right is the position in the the blockmesh, you can do this using a transform, or by changing the coordinates in the blockmeshdict.  Then check the refinement box is suitably sized, this one was too small so I made it larger using the refinementbox settings:

          type searchableBox;
          min (-1.0 -1.4 0.0);
          max ( 8.0  1.4 2.5);

Next up is to look at the basic refinement and improve that, currently, the basic mesh looks like this:

Using feature edge detection should align the cells better with the edges of the features.  First we run surfaceFeatureExtract on the STL file, then update snappyhexmesh to use edge detection.

           file "seven.eMesh";
           level 10;

I also turn on feature snapping

nFeatureSnapIter 5;

This makes the edges much cleaner, but the mesh is still too course.

Adding more layers of refinement around the car should improve the mesh some more, to do this we use the addLayersControls settings below:

nSurfaceLayers 3;
expansionRatio 1.3;
finalLayerThickness 0.7;
minThickness 0.25;

Next I make the bounding box slightly finer using blockmesh

     hex (0 1 2 3 4 5 6 7) (80 32 32) simpleGrading (1 1 1)

At this point I also need to turn up the max cells a little, and add another refinement level

maxGlobalCells 12000000;
     // Surface-wise min and max refinement level
     level (5 6);

 As you would expect, mesh size increases dramatically, as does the time to create the mesh.  The result is improved, however the quality of the mesh is still poor in places, this will need further effort.

Loguino support for DS18B20 temperature sensors

The Maxim DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements over a 1-Wire interface providing accurate and inexpensive temperature readings.

Kyle Gordon contributed some code that builds on Jim Studt‘s 1-Wire library and Jordan Hochenbaum’s DallasTemperature implementation to integrate into Loguino.

Now you can enable the DS18B20Poller and loguino will capture temperatures from any attached DS180 series sensors.