Please help me, I am new to CFD and snappyHexMesh
Hello :)
I have made a thread on the OpenFOAM sub-forum in the past about installation problems and turned it into my question thread but after a while I got told I would be better off making a new thread for my questions so here it is ;) EDIT: I have figured this question out after searching the forum for ages and finding a solution, but I will be asking many more questions soon. |
I have a question now, I am using the motorbike tutorial as a guide and found this:
http://www.vespalabs.org/Projects/Ve...rbike_Tutorial I have messed around on paraview for ages but cant get it anything like the view on the website, I want it so that I slice through the block (wind tunnel) so that I can actually see the flow over the motorbike while the motorbike itself stays as a solid surface, whenever I try use the slice tool it end up cutting through the bike also, is there anyway I only cut through the block? |
Hi Ben,
You can try to open 2 objects in paraView: the internal flow field and the motorbike surface. If you use VTK format, then load both files. Otherwise, select both in the Object Inspector. Then, render the motorbike as a surface, and make a cut through the internal field. You can also find many info in here: http://www.paraview.org/paraview/hel...de%20v3.10.pdf I hope this help. regards, Eloïse |
Thank you for the reply Eloise.
Could you please tell me how to render the motorbike as a surface? Also, I have been wondering, why is the motorbike tutorial under incompressible flows because the simulation is of a wind tunnel and that is a compressible flow. If I changed the name of the file in the snappyHexMeshDict file for another stl file would the model in the wind tunnel change or would more things need to be modified, and also, where would I save the stl file? I am sorry for asking such newbie questions but I have just started out with OpenFOAM and really don't know much about it. |
Quote:
Quote:
Quote:
Good luck ! |
Thank you for the reply.
|
Could anyone please tell me how to run the motorbike tutorial with a different stl model?
I have already converted my model to ASCII and placed it into the trisurface folder I have also edited the snappyHexMeshDict on the top line and changed it from motorbike.obj to myfilename.obj I meshed the geometry and used the ./Allrun command to run it and viewed it on paraview, the tunnel was there butmy stl geometry was not in the tunnel. What have I done wrong? |
Hi ben,
have a look at the openfoamwiki http://openfoamwiki.net/index.php/SnappyHexMesh There you can find some tutorials with sHM! After that it should be clear how to use it. Otherwise you can make a thread in the sHM section. Regard Tobi |
Quote:
I think HelxyOS is a great GUI and keeps one away from wrong file names. You could sometimes get much better results when you use an myfilename.eMesh-file that you get by using surfaceFeatureExtract command and include that myfilename.eMesh in snappyHexMeshDict as well |
Thank you for the replies, links have come in very handy. My main concern at the moment is not to get perfect results but it is just to get any results at all.
I have found a guide that told me a bit about creating code in the snappyHexMeshDict file so I copied the code and modified it and got the following: FoamFile { version 2.0; format ascii; root ""; case ""; instance ""; local ""; class dictionary; object autoHexMeshDict; } castellatedMesh true; snap true; addLayers true; geometry { cara.stl { type triSurfaceMesh; name cara; } }; castellatedMeshControls { maxLocalCells 10000000; maxGlobalCells 2000000; minRefinementCells 0; nCellsBetweenLevels 1; refinementSurfaces { cara { level (4 5); } } resolveFeatureAngle 30; refinementRegions { cara { mode distance; levels ((0.1 5) (0.4 4) (1 2)); } } locationInMesh (3.11 1.51 -1.1); } snapControls { nSmoothPatch 3; tolerance 4.0; nSolveIter 30; nRelaxIter 5; } addLayersControls { layers { cara_vcg { nSurfaceLayers 1; } } } meshQualityControls { } I try this and only my tunnel loads which is what is in the blockMeshDict, my STL file does not show, what have I done wrong? Also, I did not modify anything in the refinement regions, the location mesh and dont really know what to put in the meshQualityControls, although I will modify the location in mesh once I have actually got the STL model to appear. |
Greetings to all,
FYI: I've mode this thread to the snappyHexMesh sub-forum. @ben1793: which tutorial are you following now? Nonetheless, it would be best that you use OpenFOAM's own motorBike tutorial "mesh/snappyHexMesh/motorBike" and work from there. And as already mentioned before, Helyx-OS would make your life a lot easier since you're new with snappyHexMesh ;) Best regards, Bruno |
Quote:
|
Try this one below...
I deactivated the layer insertion (You don't need that yet), and added some "default" values for mesh quality. Use the command snappyHexMesh > log.snappyHexMesh and post the log file here so maybe we can help you to see where is the error Regards, Eloïse Quote:
|
Thank you for all the replies and I am sorry that I had posted this question on the wrong sub-forum.
Also, Thank you so much Eloise for taking the time to edit my code :) I have used the command in the terminal and got the following error: --> FOAM FATAL ERROR: Cannot find file "points" in directory "polyMesh" in times 0 down to constant From function Time::findInstance(const fileName&, const word&, const IOobject::readOption, const word&) in file db/Time/findInstance.C at line 188. FOAM exiting I also did not mention, I had changed the size of the external mesh (wind tunnel) in the blockMeshDict file because when I had loaded the tunnel and STL files separately on para view I had noticed that the STL file was much larger in size than the tunnel, so I added two more 0's after every number in the initial part of the blockMeshDict to scale the tunnel by 100. |
The file "points" in the polymesh directory is created by blockMesh. Have you run the blockMesh utility before snappyHexMesh?
Try the following steps: 1) copy the "AllClean" from motorbike tutorial to your case directory 2) run AllClean in your case directory 3) execute the following commands, one by one: cp -r 0.org 0 > /dev/null 2>&1 blockMesh > log.blockMesh => Check in paraView if your windtunnel is as you expect and if your STL is where you want it to be. Play around with the bolckMeshDict until you reach that point. snappyHexMesh > log.snappyHexMesh => Check the different meshs (times 0, 1 and 2) in paraView to see what was the effect of the castellate and snap steps Regards, Eloïse |
I managed to do everything up till the last step and then a Error:
--> FOAM FATAL IO ERROR: keyword mergeTolerance is undefined in dictionary "/home/ben/OpenFOAM/ben-2.1.1/run/motorBike/system/snappyHexMeshDict" file: /home/ben/OpenFOAM/ben-2.1.1/run/motorBike/system/snappyHexMeshDict from line 20 to line 56. From function dictionary::lookupEntry(const word&, bool, bool) const in file db/dictionary/dictionary.C at line 400. FOAM exiting I think I have fixed the mergeTolerance problem by coppying it from another example but now have the following error: --> FOAM FATAL IO ERROR: keyword features is undefined in dictionary "/home/ben/OpenFOAM/ben-2.1.1/run/motorBike/system/snappyHexMeshDict::castellatedMeshControls" file: /home/ben/OpenFOAM/ben-2.1.1/run/motorBike/system/snappyHexMeshDict::castellatedMeshControls from line 28 to line 36. From function dictionary::lookupEntry(const word&, bool, bool) const in file db/dictionary/dictionary.C at line 400. FOAM exiting Here is what is inside my snappyHexMeshDict under castellatedMeshControl: castellatedMeshControls { maxLocalCells 10000000; maxGlobalCells 2000000; minRefinementCells 0; nCellsBetweenLevels 1; When I used the command you told me to use, it created a new folder called 0, what is the difference between 0 and 0.org? Is the main reason for creating a log just to see if there is any errors? Thank you :) |
Its the latest entry in your sHMDict:
Code:
// Advanced Code:
mergeTolerance 1e-6; Differences between 0 and 0.org are that in 0.org your variables (U,T,p...) are and in the folder 0 is your castellatedMesh. If you have the folder 0.org copyed to 0 with Code:
cp -r 0.org 0 in timestep 2 is your snapped mesh in timestep 3 is your addedLayer mesh (if you use it). If you set Code:
writeTimestep 100; you ll get the folders 100 200 300 and so no. Build an empty folder 0 befor running sHM. Then open paraview and you can switch from 0 (backgroundmesh) to 1 (castellatedMesh) to 2 (snapped mesh) and so on. Tobi Tobi |
Thank you for replying Toby and also thank you for answering my questions and clearing things up for me :)
I have added the code to my snappyHexMeshDict and got the same error when I tried to compile it in the terminal: --> FOAM FATAL IO ERROR: keyword features is undefined in dictionary "/home/ben/OpenFOAM/ben-2.1.1/run/motorBike/system/snappyHexMeshDict::castellatedMeshControls" file: /home/ben/OpenFOAM/ben-2.1.1/run/motorBike/system/snappyHexMeshDict::castellatedMeshControls from line 28 to line 36. From function dictionary::lookupEntry(const word&, bool, bool) const in file db/dictionary/dictionary.C at line 400. FOAM exiting |
If you read the message, it tells you that it misses "features" in castellatedMeshControls. Look at the sHMD in the motorbike totuorial and you will see that there is a line with "feature" which does not exist in your sHMD
Add this: Quote:
Regards, Eloïse |
Thank you Eloise.
I had done as you said and continued changing the snappyHexMeshDict whenever an error came up and finally got it so that no errors come up, but now I have a new problem. I used the commands you said which created the 0 folder and then used the blockMesh > log.blockMesh and then snappyHexMesh > log.snappyHexMesh and after that used paraFoam, when I went into paraFoam I can see my part under the mesh parts in the pipeline browser, it is right at the bottom under all my other patch's and its called cara_vcg - Patch, when I click apply to view my geometry the cara_vcg vanishes and I am left with just the patch's for my tunnel. EDIT: I have fixed it, I just ticked the skip zero time box, what does this do? Also, I have executed the command potentialFoam and simpleFoam as I did on the motorBike tutorial in the past and I did not get a log for simpleFoam so I did it again but this time did simpleFoam > log.simpleFoam, I now have the log but can not view the information I need which is the drag coefficient, I could do this on the motorbike tutorial but for some reason it does not work on here. |
Quote:
Quote:
Quote:
geometry { cara.stl { type triSurfaceMesh; name cara; }}; The system/controlDict file in the motorbike tutorial has the line which should also appear in your controlDict functions {#include "forceCoeffs"} It refers to the file forceCoeffs (that you must copy in your system directory) and you must change the patches name from patches ( "motorBike.*" ); to patches ( "cara.*" ); |
Thank you for the help.
I have changed the name in the forceCoefs file and when I tried to run the simulation in paraFoam I did not get any results, not just that but I cant even get the options for u or p, so I went into the 0 folder and realised it was still under the name motorbike so I changed all the contents (in files such as p, u, k, omega) files from "motorBike_.*" to "cara.*" I had also tried "cara_.*" but still get the same problem, I cant change to velocity or pressure in para view and cant get any results, does anyone know what else I need to change? |
Quote:
|
Thank you for the help plucas.
I did as you said and changed the name to motorBike and also edited the snappyHexMesh but the same problem occurs, I will take you through what I did: In the terminal I typed: cp -r 0.org 0 > /dev/null 2>&1 blockMesh snappyHexMesh potentialFoam simpleFoam paraFoam I then hit apply and changed to the number 2 on the top right corner so that I could view my STL geometry, but still no u or p options, I also checked numbers 1 and 0 and still couldn't find anything. |
try this:
Code:
cp -r 0.org 0 > /dev/null 2>&1 |
Suggestion - replace these three lines:
Code:
snappyHexMesh Code:
snappyHexMesh -overwrite |
Thank you :)
I have now got the p and u values but can not view my drag coefficient, on the motorbike tutorial it made a log.simpleFoam file automatically and listed all my drag coefficients but on this example there is no log so I made one separately and still no results, does anyone know how to view these results? |
Hi Ben,
If you are still using the same settings that are present in "system/controlDict" that the "motorBike" case is using, along with the included files it refers to, then you should have the following file present in your case: Code:
forces/0/forceCoeffs.dat
Bruno |
Thank you for the reply wyldckat I did as you said and found the file called forceCoefs.dat, I opened it and there was a HUGE list of coefficients for the drag but, they were all VERY high, ranging from 2800-1300 for the drag coefficient when I know it should only be around 0.2, why is this happening? |
Could anybody please tell me why I am getting such high drag coefficients even though I have not modified anything apart from the snappyHexMeshDict and the STL file in the motorbike tutorial?
Also, if possible could somebody please upload a STL file that the drag coefficient has already been tested on so that I could use it as a guide? Thank you. |
Hi Ben,
Think about the definition of a drag coefficient and go to read the file forceCoeffs. There might be some stuff you need to modify in there... Regards, Eloïse |
I have tried playing around with the forceCoefs and have also been reading up on the drag coefficient but can not fix the problem, still getting very high drag, I will make a separate thread for this question so that I can post all my code.
Thank you. |
If you did not get any answer on that question :
you have to specify in controlDict a surface and a velocity to define the drag value. I think it is Aref and Umag. there are other variables such as the direction of the velocity. What you found in the motor bike tutorial may not actually be applicable for your case. Hope that helps. |
All times are GMT -4. The time now is 06:03. |