Need some help with my masters thesis!
Hello everyone, I'm new to CFD and OpenFoam in particular. My dissertation theme is to model a block for coast protection that someone already had tested in laboratory.
I intend to recreate the experiments but using OpenFoam and numerical modelling to validate the results and maybe improve the structure. I had already written some files and did some tutorials but now I'm stuck in a point I can't leave and that's not good for my project. I'm having trouble with defining some settings for the problem to run in openfoam, for example, to define a geometry for the block to be removed from the mesh and proceed with the analysis. My main problems are with the setFieldsDict, because I need to define a depth of the channel filled with water but the other part is air. Also, I don't know how to define the geometry for the block (simple one to start) and to include it in the entire process. If anyone could help me I'd be really grateful. Thanks, Tiago |
It is best to start with the tutorials. Choose the one which fits most to your problem, let it run, fumble around, change something.
After that you should be able at least to modify an existing case. |
Quote:
Also I don´t know exactly how to make the setFieldsDict know that a part of the mesh is filled with water and the other one with air, so when I execute the process, the wave information will alternate the free surface. |
1 Attachment(s)
Hello Luis,
I've been simulating both dam break and piston driven wave s in long flumes for my PhD using the interFoam and olaDyMFoam solvers. olaDyMFoam is a modified version of interFoam developed and maintained by Pablo Higuera (see https://github.com/phicau/olaFlow), which implements a builtin method for performing mesh motion (it compresses/expands a region of the mesh) to allow for such boundary conditions as a moving piston wall based on a time history of wall displacement and also free surface elevation with the latter being an optional input. If you want an explanation of how to compile the olaDyMFoam solver so that it's properly added into an existing OpenFOAM installation, then let me know and I'd be happy to try to walk you through it. I've attached a modified example case of my piston wave maker setup since I don't have an OpenFOAM-5.0 version of the dambreak flume. Note that I changed the solver name in the controlDict file to be interFoam instead of olaDyMFoam, deleted the "0.org/pointDisplacement" file, and deleted the wave generation files in the "constant" directory, etc..., but I have not actually tested that it runs (not that anything would happen anyway since I took out the piston motion and left it as a tank full of water with no imposed velocity). However, the "buildUnbroken.sh" file should show you the general work flow required to setup a case like you're talking about, providing I understood your post correctly. To setup the initial conditions, you need to make sure you make a 0 directory (I make a directory called 0.org and copy it to be called 0 so I can start over from scratch when I need to) with files for each parameter used in the model, which depends on the solver used and the turbulence model you choose. For example, when using a 2-equation, k-epsilon type turbulence model with the interFoam solver, the parameter files are epsilon, k, p_rgh, U, and alpha.water (there may be nut and nuTilda in a tutorial, but they're not necessary for k-epsilon simulations since nut gets calculated from k and epsilon and nuTilda is for the 1-equation, SpallartAllmaras turbulence model). Take a look at the 0.org directory in the attached example case for how to setup these files. The actual values will of course vary depending on the type of flow you're simulating so don't take mine as being universal. Concerning building a model, I try to go through the following steps...
This basically takes care of building all of the geometry and you can get further details from the example case I've attached to this post. Lastly, you should use the setFields utility to fill in non-zero alpha.water values. For my cases, using a single rectangular volume region was sufficient. Note that the bounds of this region do not necessarily have to line up with the boundary edges; the utility will just ignore regions that are outside the domain (check the setFieldsDict in the attached example case). Note that in the setFieldsDict, you should set the "defaultFieldValues" so that alpha.water is 0, which will make the domain air everywhere to begin with. Then whatever part of the domain you select in the "regions" should have alpha.water set to 1. I hope this makes it clearer for you as to how you should use the setFields utility. Typically, I've found it's best to do this step last before you run a case in serial or decompose it to run in parallel. This way you can make whatever crazy geometry you want and then make a big box that goes through your domain at the correct depth and outside the boundaries everywhere else to fill in the water without missing any cells. Let me know if you have any questions or if I was unclear. Best regards, Andrew PS - I just realized I forgot to modify the "inlet" boundary condition for "0.org/U". It should be something other than "movingWallVelocity" since interFoam would be used instead of olaDyMFoam. |
Hello and thanks for the reply and the great information that you provided.
Could I email you the files I already did by myself to you so you could take a look into them and see what I'm doing wrong? I think that I'm doing wrong on some values for the boundary conditions and probably doing some other minor mistakes that I cant see but result in major differences. Also, I have a .stl file with my geometry for the block I want to test but maybe the fact that the block wasnt designed starting from the (0 0 0) results in the block not showing up in the mesh. if you could help me I'd really appreciate it. best regards, Tiago |
Luis,
Sure, I don't mind taking a look. If they're not too large, please attach the files to a post and I'll try them out. Concerning the placement of the .stl file, each point within the file will be used with the exact coordinates written in the file so if you expected it to be at the origin, but drew it in a CAD program away from the origin, then the CAD program would export it there and your .stl file may not fit inside your domain. Best, Andrew |
I think that's what happened probably. I'll need to draw the geometry again.
The files are too large to attach to a post here. It has also pictures of a sketch of the experiments I want to test in OpenFOAM best regards, Luís Tiago |
Luís,
Could you upload the files to something like Dropbox or Google Drive and send me a link? Or would they fit in a private message? Let me know what works best for you. Andrew |
I dont know why but cant attach files in a private message
|
Quote:
|
All times are GMT -4. The time now is 23:26. |