CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   is it possible to learn open foam and run simulations on an iron man suit in 2 weeks? (https://www.cfd-online.com/Forums/openfoam/252902-possible-learn-open-foam-run-simulations-iron-man-suit-2-weeks.html)

bored_bot November 11, 2023 06:08

is it possible to learn open foam and run simulations on an iron man suit in 2 weeks?
 
i have been given a 2-week deadline to come up with some results on analyzing flow behaviours on iron man and conduct a small study on its aerodynamic properties by experimenting with variable geometry designs and other such things

now im really lost as to what software to use since they all cost a pretty penny and im restricted to using my university in-house computers which are pretty good but i dont have access to them all the time.

OpenFoam seemed to be a good option since it's open source, but then i realized the steep learning curve. Im sufficiently decent when it comes to programming though i dont know C++ but only C. Will i be able to come up with enough quantifiable results by 2 weeks or is it hopeless? And If so are there software out there willing to give me a chance?

AtoHM November 13, 2023 08:27

With no experience in OF? Its gonna be tough.
You might be able to build a stable setup from the tutorials (and some youtube-video maybe?), but studying several variants will require building quite some meshes manually, which is time-consuming work without further automation if you use the openfoam tools like snappyHexMesh. Its not impossible, though. If you are enrolled with a university, they usually have access to more user-friendly software (with GUI) like CFX or Fluent. That might be the better choice given the timeframe. Even then, expecting meaningful results from someone with few experience in that short span of time is ...

bored_bot November 13, 2023 10:07

Hey thank you for replying, im not so well versed with the meshing. I do have an iron man suit stl file from grabcad that i plan on using and the geometry is quite complex.

my plan of action was using an example from openfoam (the motorcycle example) and then just putting in my model and praying that it would give me some result.

yes I've just recently gotten the green light to use my university's computer lab containing ansys and solidworks. I will try finding which ones the easiest. But a part of me wants to go all out and learn open foam and try to get something out of my simulation. Im a big fan of open source and i do enjoy working on the terminal. But i dont know a lick of C++ but only C. I am deeply interested in academia, so i think i will have to come in terms with open foam one day or another.

given the timescale, i think i will have to do the former for now.

Please do let me know if there are any tutorials that a newbie like me can follow. I know a thing or two in linux.

AtoHM November 14, 2023 02:23

Good news regarding C++: you do not need to program stuff if you keep at the entry level with the default solvers. Even some advanced things are possible without programming.


Bad news: meshing is quite complex for OpenFOAM. Stl is a limited file format and its more than probable, that the stl you get from 3rd parties are not ready to use for meshing. You probably have to clean it put, remove some details that are not relevant, make regions to have advanced control for the meshing (you will need finer mesh for details, coarse mesh for flat faces). This can cause the stl to have holes (check the threads here about "watertight stl") which can cause the meshing to abort. That leads to the requirement of learning yet another tool like (Salome, Blender, ...) just to get a good stl in the first place. That's alot to do in two weeks. Not counting the hours the cases need to run.

bored_bot December 3, 2023 23:12

okay so i have got the mesh with the help of a friend but unfortunately im unable to contact him at the moment,

the meshing comes with a domain and im unable to just isolate the iron man suit. I want to get pressure and velocity contour plots if anything.

this is the error i get whilst running potentialFoam on the mesh



--> FOAM FATAL IO ERROR: (openfoam-2306)
Size 160158 is not equal to the expected length 1280

file: 0/U.internalField at line 21.

From void Foam::Field<Type>::assign(const Foam::entry&, Foam::label) [with Type = Foam::Vector<double>; Foam::label = int]
in file /usr/src/packages/BUILD/src/OpenFOAM/lnInclude/Field.C at line 253.

FOAM exiting



how do i resize it? since i am running it of from the motorbike tutorial

here's the pictures to my mesh and my boundary file contents:

https://imgur.com/a/edJjsN5

Yann December 4, 2023 03:34

Hello,

This usually happens when there is a size mismatch between the 0 directory and the mesh.
It's not really possible to help you further without knowing your exact workflow. Do you have a run script showing all the commands you run? Is it the motorbike Allrun script?

Where is the boundary file you showed in your screenshot? In constant/polyMesh or in processor*/constant/polyMesh?

Yann

bored_bot December 4, 2023 06:11

okay nevermind that, i have a new issue now lol

Check header is of the form:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
arch "LSB;label=32;scalar=64";
class IOobject;
location "constant/polyMesh/sets";
object nonOrthoFaces;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Mesh non-orthogonality Max: 80.5616594275 average: 8.5256679656
*Number of severely non-orthogonal (> 70 degrees) faces: 91.
Non-orthogonality check OK.
<<Writing 91 non-orthogonal faces to set nonOrthoFaces
Face pyramids OK.
***Max skewness = 9.72019388748, 1 highly skew faces detected which may impair the quality of the results
<<Writing 1 skew faces to set skewFaces
Coupled point location match (average 0) OK.

Failed 1 mesh checks.

End



i got this after running checkMesha and im not so sure how i can fix this issue, any help would be appreciated

bored_bot December 4, 2023 06:20

okay nevermind, still the same issue

Size 160158 is not equal to the expected length 431380


and yes, im using the motorbike allrun script, and yes my boundary file is located within the constant/polyMesh directory

Yann December 4, 2023 06:23

you can run checkMesh with the -writeSets vtk option. it will write vtk files in a postProcessing directory. Loading these vtk files in ParaView will allow you to visualize which cells are in error.

The only way to fix it is to modify your mesh in the zones related to the error cells.

bored_bot December 4, 2023 07:01

thanks for that, yeah i can see the cells that seem to be causing the issue. but ive kinda given up on remeshing it manually.

is there any way where i can circumvent this problem?

and btw i have a .msh file from fluent but unfortunately, i dont have any otherfiles pertaining to this.

So would i still be able to create a polyMesh from this using snappyHexMesh?
because the time i tried it, it spit out errors saying that i lacked the controlDict. What do i do from here?

Yann December 4, 2023 08:11

Quote:

Originally Posted by bored_bot (Post 861011)
okay nevermind, still the same issue

Size 160158 is not equal to the expected length 431380


and yes, im using the motorbike allrun script, and yes my boundary file is located within the constant/polyMesh directory

Alright, what did you change in the Allrun script?
Because you cannot run the script as it is if you are converting a fluent mesh to OpenFOAM.

Quote:

Originally Posted by bored_bot (Post 861013)
So would i still be able to create a polyMesh from this using snappyHexMesh?
because the time i tried it, it spit out errors saying that i lacked the controlDict. What do i do from here?

For snappyHexMesh, you will need your geometry in STL or OBJ format.

bored_bot December 4, 2023 08:41

Quote:

Alright, what did you change in the Allrun script?
Because you cannot run the script as it is if you are converting a fluent mesh to OpenFOAM.
yeah i gave up on that as well, for some reason even when i use my own mesh and use it in the motorbike tutorial, it still spits out the original mesh (the motorbike mesh) and idk how to fix this. and plus everytime i use fluentMeshToFoam or fluent3DMeshToFoam i get this error : missing file " .../system/controlDict" im not sure how to combat this since im literally just using the motorbike tutorial. sorry im a beginner.

And sorry for the earlier confusion, im not using Allrun.


Quote:

For snappyHexMesh, you will need your geometry in STL or OBJ format.
so i have the stl file and i did all the things that needed to be done. no errors but when i open it on parafoam, what i end up getting is nothing. Nothing shows up in my cuboid? what could this issue be. let me link my gdrive so you can get the stl file.

https://drive.google.com/file/d/1EH9...ew?usp=sharing

here you go

Yann December 4, 2023 09:00

You can open the Allrun script to see what commands are used in order to run the tutorial.
Before trying to run your own case, you should understand the motorbike case setup (mesh, boundary conditions, etc...) in order to be able to adapt it to your case.

Quote:

Originally Posted by bored_bot (Post 861026)
so i have the stl file and i did all the things that needed to be done. no errors but when i open it on parafoam, what i end up getting is nothing. Nothing shows up in my cuboid? what could this issue be. let me link my gdrive so you can get the stl file.

Obviously you did something wrong at some point since it doesn't work, but it's not possible to say what since we don't know what you have done. Can you describe everything you've done?

This might give you some ideas about what information to give in order to get help: https://www.cfd-online.com/Forums/op...-get-help.html

bored_bot December 4, 2023 11:11

Quote:

Before trying to run your own case, you should understand the motorbike case setup (mesh, boundary conditions, etc...) in order to be able to adapt it to your case.
where can i exactly know what to change to fit my mesh? any online resources you know of? thank you.

Heres all the things i did:

1) copy everything from the motorBike tutorial
2) create a new folder under /constant called triSurface
3) add my .obj file to triSurface
4) performed blockMesh, no issues
5) performed surfaceFeatureExtract, no issues again
6) performed snappyHexMesh, no issues again
7) performed > touch open.foam ( since i dont have parafoam directly installed on my ubuntu on wsl)
8) opened paraform to view the file
9) here's what i got (ALL the log files included as well)

https://drive.google.com/drive/folde...H-?usp=sharing


i definitely think it has something to do with the domain size, but im not sure how to fix it through block mesh. but at the same time, my mesh doesn't seem to show up anywhere, so idk how to fix that as well.

Yann December 4, 2023 11:41

Alright, this is a dimension issue. Your STL file is written in millimeters, but OpenFOAM works with meters so the coordinates in your STL file are interpreted as meters by OpenFOAM.
You can use surfaceTransformPoints to scale your geometry in order to get the proper size.

You can see it in your snappy log file:
Code:

Create time

Create mesh for time = 0

Read mesh in = 0 s

Overall mesh bounding box  : (-5 -4 0) (15 4 8)
Relative tolerance        : 1e-06
Absolute matching distance : 2.29783e-05

Reading refinement surfaces.
Read refinement surfaces in = 0.07 s

Reading refinement shells.
Refinement level 4 for all cells inside refinementBox
Read refinement shells in = 0 s

Setting refinement level of surface to be consistent with shells.
For geometry motorBike.obj detected 0 uncached triangles out of 21644
Checked shell refinement in = 0.06 s

Reading features.
Read edgeMesh motorBike.eMesh
    points      : 64932
    edges      : 64932
    boundingBox : (-3371.16 134.852 -260.806) (-2335.53 2361.61 205.806)

Regarding your workflow:

1 to 3 seems OK.
4: you need to make sure the mesh created by blockMesh has the proper size and position. It should encloses your STL file. If it doesn't, you will have to adjust the blockMeshDict file. To check this, your can open your mesh in ParaView using your open.foam file, then load your STL file and check if size and positions are correct.
5 and 6: you need to adjust surfaceFeatureExtractDict and snappyHexMeshDict to match your STL name, and possibly the refinement levels in snappyHexMeshDict

bored_bot December 4, 2023 11:52

im really sorry, but you got spoon feed me here

so i basically have to go to the dict files for blockmesh, surfaceFeatureExctract, and snappyHexMesh and then change the boundaries to match my stl size? and to what refinement levels do i change it to?

is there any way i can automate this? i belive surfaceTransformPoints should do the trick no? and if so do you mind spelling out the parameters pls :(

Yann December 4, 2023 12:04

No, for the size issue you just need to use surfaceTransformPoints in order to scale down your STL file. (surfaceTransformPoints -help to get help on the syntax)

Once it's done, open it in ParaView alongside the mesh created with blockMesh to see if the STL is enclosed in your mesh.

From there, you will see if you need to adjust things in the dict files.
You might find information in the documentation https://doc.openfoam.com/2306/ and/or user guide: https://www.openfoam.com/documentation/user-guide

bored_bot December 4, 2023 12:39

ah man i think my brain got surgically removed while i was asleep or something

because i cant get to figure this scale thing out

do you mind helping me out with the syntax pls

Yann December 5, 2023 03:26

You can look at the documentation, you will find information, examples, and link to tutorials using the command: https://doc.openfoam.com/2306/tools/...ansformPoints/
You will also get information on the command by typing surfaceTransformPoints -help in your terminal.

So in your case, coordinates in your STL are in millimeters but you want it in meters. So it would be something like that:
Code:

surfaceTransformPoint -scale 0.001 constant/triSurface/yourFile.stl constant/triSurface/yourFile_scaled.stl

bored_bot December 5, 2023 09:47

oh okay thanks, i did type in help and all that but i couldn't really find an example that displays the argument. But after seeing your code it makes intuitive sense. sorry for the trouble.

but now i have a different issue, even though the mesh is scaled down, it's not properly positioned. what steps can i take to resolve this?

https://imgur.com/a/rC3fQr2

yeah im not so sure how to setup my mesh within the boundary box


All times are GMT -4. The time now is 09:11.