# How to define setFields to have a triangle fluid domain in 2D case?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 March 16, 2015, 04:28 How to define setFields to have a triangle fluid domain in 2D case? #1 New Member   Join Date: Feb 2015 Posts: 4 Rep Power: 9 Hi, every one, I am just new to OpenFoam and now my case is a inclined rectangular tank with a horizontal water surface(water depth is very low) as the initial condition. But when I go through Dambreaking tutorial, I find that I can only define a box-shape fluid domain rather than a triangle one, which doesnot work in this case. Could anyone please tell me that how to define such a fluid domain as in the pic?shallow water in tank.pdf Any information is appreciated. Thanks! ahparvin likes this.

March 16, 2015, 05:22
#2
Senior Member

Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 36
Hi,

If your mesh is not inclined, you can use rotated box, so the intersection of the mesh and rotated box is triangle (case A on attached image, search the forum for syntax of rotatedBox in setFields), if your mesh is inclined, you can use just box (case B on attached image).
Attached Images
 box-outside-domain.png (6.8 KB, 121 views)

March 16, 2015, 09:27
#3
New Member

Join Date: Feb 2015
Posts: 4
Rep Power: 9
Quote:
 Originally Posted by alexeym Hi, If your mesh is not inclined, you can use rotated box, so the intersection of the mesh and rotated box is triangle (case A on attached image, search the forum for syntax of rotatedBox in setFields), if your mesh is inclined, you can use just box (case B on attached image).
Thank you! Alexey Matveichev,

I used the first method u mentioned and it works quite well. Thanks for help!

Best regards

April 13, 2018, 15:10
water domain above slopped surface
#4
New Member

Join Date: Apr 2018
Posts: 2
Rep Power: 0
Hello
Could someone please help me define a volume of water above a sloped surface? Basically, I need to define a triangular volume of water in setField. Please see the figure attached.

Thanks
Attached Images
 cross-section6.png (9.6 KB, 58 views)

 January 2, 2022, 07:37 #5 New Member   Join Date: Dec 2020 Posts: 8 Rep Power: 3 Hello behnazphp I don't know if after a long time can you reply back to me. but I have a similar issue. could you finally define directly the initial conditions by rotatedboxToCell in setFieldsDic? Thanks

January 4, 2022, 07:44
#6
New Member

Join Date: Dec 2020
Posts: 8
Rep Power: 3
Quote:
 Originally Posted by ahparvin Hello behnazphp I don't know if after a long time can you reply back to me. but I have a similar issue. could you finally define directly the initial conditions by rotatedboxToCell in setFieldsDic? Thanks
Hello;

I have a similar issue. I want to define a trapezoidal shape initial condition for a dam break problem. This shape is formed from overlapping the Mesh and a rotated box with different alpha values.
I tried to do that by defining a rotatedboxTocell in the setFields dictionary.
However there is no error in running setField but after that in initial conditions, I can not see any sign of water alpha = 1.

Any of you can help me with that?

autodraw 1_4_2022.jpg

Code:
```/*--------------------------------*- C++ -*----------------------------------*\
=========                 |
\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
\\    /   O peration     | Website:  https://openfoam.org
\\  /    A nd           | Version:  7
\\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
version     2.0;
format      ascii;
class       dictionary;
location    "system";
object      setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues
(
volScalarFieldValue alpha.water 0
);

regions
(
rotatedBoxToCell
{
name    rotatedBox1;
type    cellSet;
action  new;
source  rotatedBoxToCell;
origin  (0.3 0.2 10);
i       (-0.1 -0.1 0);
j       (0.1 -0.1 0);
k       (0 0 -20);

fieldValues
(
volScalarFieldValue alpha.water 1
);
}

);```

 Tags setfieldsdict