|
[Sponsors] |
[Other] How to add water in a non-rectangular bounding box? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 3, 2023, 12:51 |
How to add water in a non-rectangular bounding box?
|
#1 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Hi! I am new to CFD. I want to use the multiphase solver and generate a beach-type geometry (box with slanted side for beach) to observe the waves on the beach. I don't know how to create this fluid. I was able to create the whole domain via BlockMeshDict but the water, I don't know how to put.
I have checked setFieldsDict but I feel like it can only create boxes of fluid. (Correct me if I am wrong). Thank you to anyone who can answer. |
|
October 4, 2023, 02:27 |
|
#2 |
Senior Member
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13 |
Welcome to the forum bunnybunny,
you are on the right track, you should use setFields for this. You can define any region in terms of an stl file that you can create in your CAD tool of choice. Grab a template of setFieldsDict anywhere and use the surfaceToCell definition; adjust x/y/z_coords and waterFieldName to your case. I recommend to run this locally and check the outcome before you continue to run the simulation. Code:
regions ( surfaceToCell { file "waterInitialization.stl"; // placed inside case folder outsidePoints ( (<x_coord> <y_coord> <z_coord>) ); includeCut true; // whether or not to include cells that are cut by the stl includeInside true; includeOutside false; nearDistance 0.001; // cells within that distance are also included curvature 1; fieldValues ( volScalarFieldValue <waterFieldName> 1 ); } ) Last edited by AtoHM; October 4, 2023 at 03:49. |
|
October 4, 2023, 06:49 |
|
#3 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Hi AtoHM, thanks for the reply. Very informative.
But how about for cases wherein I will not import an STL file? I created the beach in the blockMeshDict file. I am not sure if this strategy is correct. Thank you. |
|
October 4, 2023, 07:20 |
|
#4 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29 |
Hello Rhea,
I am not sure I tried it before but if I'm not mistaken you can use the same sources in setFields than in topoSet. So you can use boxToCell or surfaceToCell but also cylinderToCell, sphereToCell, rotatedBoxToCell, etc... But maybe you could post a drawing of your domain and the water body you want to initialize? At this point I am not sure to understand what kind of water shape you need. Yann |
|
October 4, 2023, 22:06 |
|
#5 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Hello Yann, I am planning to create something like this.
Edit: Sorry I can't seem to upload the photo. It's basically a beach type of setup like this. |
|
October 4, 2023, 22:15 |
|
#6 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Hello Yann, I cannot seem to upload my own photo. But it looks something like this:
https://pub.mdpi-res.com/jmse/jmse-1...png?1676882133 or maybe this https://www.mdpi.com/jmse/jmse-11-00...00519-g001.png Thank you. |
|
October 5, 2023, 02:52 |
|
#7 |
Senior Member
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13 |
Why do you think you need something more than a box to set the water phase?
Your fluid domain should end at the beach sand ("wall"). You can use a generic box to set the water because where the sand is, you should have no cells for either air or water to exist. You might want to attach an image of your blockMesh or the blockMeshDict here so we can see what that looks like. You can attach normal picture files to any forum post here, no need for external links. |
|
October 5, 2023, 04:26 |
|
#8 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29 |
Hello,
I agree with AtoHM and I just wanted to add a detail to make things clearer: the box (or cylinder or whatever geometry) defined in setFieldsDict is just a way to select cells inside the domain. The box can be larger than the domain itself, it will only select the cells within the mesh which are inside the box. |
|
October 5, 2023, 06:50 |
|
#9 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Hello, thanks for the replies, I didn't know I can extend the setFieldsDict to outside of the blockMeshDict geometry, I have tried it with regular rectangular prism and it works.
However, my question now is when I try to make the blockMeshDict into the beach geometry, the fluid(water) is no longer appearing. What could have been the problem? I am showing here my blockmeshdict file in case. Code:
vertices ( ( 0 0 0 ) ( 0.3 0 0 ) ( 0.3 0.09 0 ) ( 0 0.09 0 ) ( 0 0 0.2 ) ( 0.4 0 0.2 ) ( 0.4 0.09 0.2 ) ( 0 0.09 0.2 ) ); blocks ( hex (0 1 2 3 4 5 6 7) (100 75 1) simpleGrading (1 1 1) ); edges ( ); boundary ( leftWall { type wall; faces ( (0 4 7 3) ); } rightWall { type wall; faces ( (2 6 5 1) ); } lowerWall { type wall; faces ( (0 1 5 4) (3 2 6 7) (0 1 2 3) ); } atmosphere { type patch; faces ( (4 5 6 7) ); } ); Last edited by bunnybunny; October 5, 2023 at 06:51. Reason: Clarification, more context |
|
October 5, 2023, 07:14 |
|
#10 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29 |
Some screenshots of your mesh/domain would help to visualize what you are doing.
You can show what work and don't work. |
|
October 5, 2023, 07:19 |
|
#11 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
This is what I am trying to simulate. And then maybe add water until the middle height.But then there is no water appearing.
https://imgur.com/CIXuGdJ I tried to run a case wherein it is rectangular, and the water appears. Last edited by bunnybunny; October 5, 2023 at 07:19. Reason: typo |
|
October 5, 2023, 07:24 |
|
#12 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29 |
Could you also post the same screenshot on your working case (rectangular domain) at time 0?
Also can you post your setFieldsDict definition? |
|
October 5, 2023, 10:40 |
|
#13 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Hello, I was able to solve the problem with making the fluid appear. Turns out that I wasn't able to fix the mesh in the BlockMeshDict.
However, now I get a new problem. When the geometry is rectangular, the simulation runs well. Now, using the beach type geometry, i get this error just after one time step (t=0.005) PIMPLE: iteration 1 smoothSolver: Solving for alpha.water, Initial residual = 5.77942e-09, Final residual = 5.77942e-09, No Iterations 0 Phase-1 volume fraction = 0.4375 Min(alpha.water) = -1.63506e-13 Max(alpha.water) = 1 MULES: Correcting alpha.water MULES: Correcting alpha.water Phase-1 volume fraction = 0.4375 Min(alpha.water) = -1.63506e-13 Max(alpha.water) = 1 #0 Foam::error:rintStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 ? in /lib/x86_64-linux-gnu/libc.so.6 #3 Foam::scalarProduct<double, double>::type Foam::sumProd<double>(Foam::UList<double> const&, Foam::UList<double> const&) at ??:? #4 Foam::PCG::scalarSolve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:? #5 Foam::PCG::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:? #6 Foam::fvMatrix<double>::solveSegregated(Foam::dict ionary const&) at ??:? #7 Foam::fvMatrix<double>::solveSegregatedOrCoupled(F oam::dictionary const&) at ??:? #8 Foam::fvMesh::solve(Foam::fvMatrix<double>&, Foam::dictionary const&) const at ??:? Last edited by bunnybunny; October 5, 2023 at 10:41. Reason: typo |
|
October 5, 2023, 10:48 |
|
#14 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Another thing is, I have noticed that the water are actually on the sides (walls) only. I am not sure if the box is actually filled.
|
|
October 5, 2023, 11:02 |
|
#15 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29 |
Please provide your setFieldsDict definition. Are you sure the water is only initialized on the walls or could it be a visualization matter?
Open your case in paraView and create a slice to visualize alpha.water in the domain (preferably cell values, surface with edges) Regarding to your case, first thing coming to my mind would be a boundary condition issue. What BCs did you define? |
|
October 5, 2023, 11:17 |
|
#16 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Hello, I have followed your advice and checked on paraview and the whole thing is filled, thankfully. It's just a visualization issue.
Anyway, regarding my model, if the blockmeshdict is a rectangular prism, i have tried a dambreak case in it and the simulation runs smoothly. However, i tried exactly the same case (except for changing two vertices so i can make one wall slanted), and then suddenly, the simulation stops after one iteration. Is there a problem with the fact that the wall is slanted? I have checked boundary conditions. I am now using Around, and Atmosphere. But still same thing. Rectangular domain works, but a beach-type does not |
|
October 6, 2023, 05:35 |
|
#17 | |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29 |
Quote:
You get your error when the solver is supposed to solve pressure, this is why I thinking boundary conditions should be checked first, but this could come from something else too. Since I don't know what boundary conditions your used, I cannot really help. Yann |
||
October 6, 2023, 08:16 |
|
#18 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Here are my boundary conditions, just in case it can help:
For alpha.water: Code:
boundaryField { atmosphere { type inletOutlet; inletValue uniform 0; value uniform 0; } around { type zeroGradient; } } Code:
boundaryField { atmosphere { type totalPressure; p0 uniform 0; U U; phi phi; rho rho; psi none; gamma 1; value uniform 0; } around { type fixedFluxPressure; value uniform 0; } } Code:
boundaryField { atmosphere { type pressureInletOutletVelocity; value uniform (0 0 0); } around { type fixedValue; value uniform (0 0 0); } } I am really stuck. Thank you in advance for all the help. |
|
October 6, 2023, 12:30 |
|
#19 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29 |
Nothing wrong so far.
What OpenFOAM version are you using? Would it be possible to post your case here to have a deeper look? Yann |
|
October 9, 2023, 10:24 |
|
#20 |
New Member
Rhea
Join Date: Oct 2023
Posts: 13
Rep Power: 3 |
Hi, Sorry for late reply. I am using v2112. Here is the case folder.
https://file.io/71eJb5bAk6Ed Feel free to let me know if I have done anything wrong as I am a beginner to cfd. |
|
Tags |
beach, multiphase, slope, water, waves |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mass imbalance problem in multiphase water and steam CFX case | Antech | CFX | 1 | October 26, 2020 05:03 |
phantom region created outside blockmesh bounding box | derekm | OpenFOAM Pre-Processing | 0 | May 15, 2014 11:31 |
2D Box dropping into water | kailingkk | Fluent Multiphase | 1 | April 9, 2014 20:06 |
snapyHexMesh Bounding box | vmsandip2011 | OpenFOAM Pre-Processing | 5 | May 26, 2012 03:13 |
Terrible Mistake In Fluid Dynamics History | Abhi | Main CFD Forum | 12 | July 8, 2002 10:11 |