CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   setfields for alpha (https://www.cfd-online.com/Forums/openfoam-programming-development/123481-setfields-alpha.html)

belkadi September 13, 2013 09:14

setfields for alpha
 
1 Attachment(s)
Dear Foamers,

I've created a geometry to simulate air injection into a tank filled with water as shown in the attached file.
I've also used the setFields to define the alpha in the system.
alpha =1 for the water inside the tank.
alpha =0 for the air in the injector (by suing the celltobox).

I have some problems with this. I could not define these alpha in my mesh. I think that I've missed something, after processing all the geometry is with alpha = 1 although using the celltobox with alpha = 0 !
Please could anyone help me ?

Thanks in advance !

Kind regards


// blockMesh : Block mesh description file
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
// ************************************
}






convertToMeters 1;

//5 mm column diameter
//10 cm length



//Width of middle square section




//how many cells in the square section
//how many cells from square section to perimeter
// how many cells from top to bottom

vertices
(

// partie cylindre sup
( 1.25 0.0 1.25) // Vertex fiveoclocksqb = 0
(-1.25 0.0 1.25) // Vertex sevenoclocksqb = 1
(-1.25 0.0 -1.25) // Vertex elevenoclocksqb = 2
( 1.25 0.0 -1.25) // Vertex oneoclocksqb = 3

( 1.76776695455285 0.0 1.76776695137989) // Vertex fiveoclockcb = 4
(-1.76776695455285 0.0 1.76776695137989) // Vertex sevenoclockcb = 5
(-1.76776695455285 0.0 -1.76776695137989) // Vertex elevenoclockcb = 6
( 1.76776695455285 0.0 -1.76776695137989) // Vertex oneoclockcb = 7

( 1.25 4 1.25) // Vertex fiveoclocksqt = 8
(-1.25 4 1.25) // Vertex sevenoclocksqt = 9
(-1.25 4 -1.25) // Vertex elevenoclocksqt = 10
( 1.25 4 -1.25) // Vertex oneoclocksqt = 11

( 1.76776695455285 4 1.76776695137989) // Vertex fiveoclockct = 12
(-1.76776695455285 4 1.76776695137989) // Vertex sevenoclockct = 13
(-1.76776695455285 4 -1.76776695137989) // Vertex elevenoclockct = 14
( 1.76776695455285 4 -1.76776695137989) // Vertex oneoclockct = 15

// partie injecteur

(-1.25 -2 0.11) // Vertex sevenoclockct = 16
(-1.75 -2 0.11) // Vertex elevenoclockct = 17
(-1.75 -2 -0.11) // Vertex sevenoclockct = 18
(-1.25 -2 -0.11) // Vertex elevenoclockct = 19

(-1.25 -2.22 0.11) // Vertex sevenoclockct = 20
(-1.75 -2.22 0.11) // Vertex elevenoclockct = 21
(-1.75 -2.22 -0.11) // Vertex sevenoclockct = 22
(-1.25 -2.22 -0.11) // Vertex elevenoclockct = 23

// partie cone
( 0.625 -2 0.625) // Vertex fiveoclocksqb = 24
(-0.625 -2 0.625) // Vertex sevenoclocksqb = 25
(-0.625 -2 -0.625) // Vertex elevenoclocksqb = 26
( 0.625 -2 -0.625) // Vertex oneoclocksqb = 27

( 0.88 -2 0.88) // Vertex fiveoclockcb = 28
(-0.88 -2 0.88) // Vertex sevenoclockcb = 29
(-0.88 -2 -0.88) // Vertex elevenoclockcb = 30
( 0.88 -2 -0.88) // Vertex oneoclockcb = 31

// partie cone bas (après injecteur) 1
( 0.625 -2.4 0.625) // Vertex fiveoclocksqb = 32
(-0.625 -2.4 0.625) // Vertex sevenoclocksqb = 33
(-0.625 -2.4 -0.625) // Vertex elevenoclocksqb = 34
( 0.625 -2.4 -0.625) // Vertex oneoclocksqb = 35

( 0.88 -2.4 0.88) // Vertex fiveoclockcb = 36
(-0.88 -2.4 0.88) // Vertex sevenoclockcb = 37
(-0.88 -2.4 -0.88) // Vertex elevenoclockcb = 38
( 0.88 -2.4 -0.88) // Vertex oneoclockcb = 39

// partie cone bas (après injecteur) 2
( 0.625 -2.22 0.625) // Vertex fiveoclocksqb = 40
(-0.625 -2.22 0.625) // Vertex sevenoclocksqb = 41
(-0.625 -2.22 -0.625) // Vertex elevenoclocksqb = 42
( 0.625 -2.22 -0.625) // Vertex oneoclocksqb = 43

( 0.88 -2.22 0.88) // Vertex fiveoclockcb = 44
(-0.88 -2.22 0.88) // Vertex sevenoclockcb = 45
(-0.88 -2.22 -0.88) // Vertex elevenoclockcb = 46
( 0.88 -2.22 -0.88) // Vertex oneoclockcb = 47
);

blocks
(

//square block
hex (
1 0 3 2
9 8 11 10
)
(10 10 5)
simpleGrading (1 1 1)

//slice1
hex (
5 4 0 1
13 12 8 9
)
(10 10 5)
simpleGrading (1 1 1)

//slice2
hex (
1 2 6 5
9 10 14 13
)
(10 10 5)
simpleGrading (1 1 1)

//slice3
hex (
2 3 7 6
10 11 15 14
)
(10 10 5)
simpleGrading (1 1 1)

//slice4
hex (
3 0 4 7
11 8 12 15
)
(10 10 5)
simpleGrading (1 1 1)



// cone
//square block
hex (
25 24 27 26
1 0 3 2
)
(10 10 5)
simpleGrading (1 1 1)
//slice1 bis
hex (
29 28 24 25
5 4 0 1
)
(10 10 5)
simpleGrading (1 1 1)
//slice2 bis
hex (
25 26 30 29
1 2 6 5
)
(10 10 5)
simpleGrading (1 1 1)
//slice3bis
hex (
26 27 31 30
2 3 7 6
)
(10 10 5)
simpleGrading (1 1 1)
//slice4bis
hex (
27 24 28 31
3 0 4 7
)
(10 10 5)
simpleGrading (1 1 1)


// cone bas (après injecteur)
//square block
hex (
33 32 35 34
41 40 43 42
)
(10 10 5)
simpleGrading (1 1 1)

//slice1
hex (
37 36 32 33
45 44 40 41
)
(10 10 5)
simpleGrading (1 1 1)
//slice2
hex (
33 34 38 37
41 42 46 45
)
(10 10 5)
simpleGrading (1 1 1)
//slice3
hex (
34 35 39 38
42 43 47 46
)
(10 10 5)
simpleGrading (1 1 1)
//slice4
hex (
35 32 36 39
43 40 44 47
)
(10 10 5)
simpleGrading (1 1 1)


// cone bas 2 (après injecteur)
//square block
hex (
41 40 43 42
25 24 27 26
)
(10 10 5)
simpleGrading (1 1 1)
//slice1
hex (
45 44 40 41
29 28 24 25
)
(10 10 5)
simpleGrading (1 1 1)
//slice2
hex (
41 42 46 45
25 26 30 29
)
(10 10 5)
simpleGrading (1 1 1)
//slice3
hex (
42 43 47 46
26 27 31 30
)
(10 10 5)
simpleGrading (1 1 1)
//slice4
hex (
43 40 44 47
27 24 28 31
)
(10 10 5)
simpleGrading (1 1 1)

//injecteur
hex (
21 20 16 17
22 23 19 18
)
(10 10 10)
simpleGrading (1 1 1)
);




//create the quarter circles
edges
(

// pour cylindre
arc 4 5 (0.0 0.0 2.5)
arc 5 6 (-2.5 0.0 0.0)
arc 6 7 (0.0 0.0 -2.5)
arc 7 4 (2.5 0.0 0.0)

arc 12 13 (0.0 4 2.5)
arc 13 14 (-2.5 4 0.0)
arc 14 15 (0.0 4 -2.5)
arc 15 12 (2.5 4 0.0)



// pour cone
arc 28 29 (0 -2 1.25)
arc 29 30 (-1.25 -2 0)
arc 30 31 (0 -2 -1.25)
arc 31 28 (1.25 -2 0)

// pour cone bas 1 après injecteur
arc 36 37 (0 -2.4 1.25)
arc 37 38 (-1.25 -2.4 0)

arc 38 39 (0 -2.4 -1.25)
arc 39 36 (1.25 -2.4 0)

// pour cone bas 2 après injecteur
arc 44 45 (0 -2.22 1.25)
arc 45 46 (-1.25 -2.22 0)

arc 46 47 (0 -2.22 -1.25)
arc 47 44 (1.25 -2.22 0)



/*
// pour injecteur
arc 16 19 (-2.5 0.40 0)
arc 16 20 (-2.5 0.56 0.16)
arc 20 23 (-2.5 0.72 0)
arc 23 19 (-2.5 0.56 -0.16)

arc 17 18 (-3 0.40 0)
arc 17 21 (-3 0.56 0.16)
arc 21 22 (-3 0.72 0)
arc 22 18 (-3 0.56 -0.16) */

);

boundary
(
inlet
{
type wall;
faces
(
(21 17 18 22)
);
}

leftWall
{
type wall;
faces
(
(37 45 46 38)
(45 29 30 46)
(5 13 14 6 )
);
}

rightWall
{
type wall;
faces
(
(36 28 31 39)
(28 4 7 31)
(4 12 15 7)
);
}

upperWall
{
type wall;
faces
(
(13 14 15 12)
);
}

lowerWall
{
type wall;
faces
(
(37 38 39 36)
);
}

frontAndBack
{
type empty;
faces
(
(17 21 20 16)
(18 22 23 19)

(37 45 44 36)
(38 46 47 39)

(45 29 28 44)
(46 30 31 47)

(29 5 4 28)
(30 6 7 31)

(5 13 12 4)
(6 14 15 7)
);
}
);

patches
(
);




for the setFields file :

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

defaultFieldValues
(
volScalarFieldValue alpha1 1
//volScalarFieldValue U (0 0 0)
);

regions
(
boxToCell
{
box (-1.75 -2.22 0.11) (-1.25 -2 -0.11);

fieldValues
(
volScalarFieldValue alpha1 0
);
}
);


// ************************************************** *********************** //


Thanks !

Krimo

alexeym September 13, 2013 09:27

If you attach archive of you case it'll be easier to figure out what is wrong. Also if you'd like to insert blockMeshDict and setFieldsDict in the post, please, use [CODE] tags.

Bernhard September 13, 2013 09:56

You set the default value to 1 and, after that, alpha to 0 inside the box in setFieldsDict. If you want to invert it, invert these values in the dictionary.

belkadi September 16, 2013 05:39

1 Attachment(s)
Thanks for your reply Bernhardt, I tried your solutuion but it doesn't work.
In attached file the code source. Please if you have time you can check this problem.

Thanks in advance !

Kind regards

Krimo

alexeym September 16, 2013 05:47

In setFieldsDict you need to change this

Code:

box  (-1.75  -2.22  0.11) (-1.25 -2  -0.11);
to this

Code:

box  (-1.75  -2.22  -0.11) (-1.25 -2  0.11);
I think setFields doesn't like that Z of the first box point is higher than of the second.

belkadi September 16, 2013 05:58

DearAlexeym,

Excellent, now it works !
it's magic
Thank you very much for your help. I spent 3hours looking for this problem !
Again thank you very much

Kind regards

Krimo

sharonyue September 22, 2013 20:59

May I know why dont you use ICEM or the others but blockMesh? blockMesh is not convenient dealing with this.

bgane67 November 25, 2014 11:53

setFields
 
1 Attachment(s)
i want to design a nuzzle with cylinder ,what should i replace in setfieldsDict
(region)?sphereToCell or boxToCell?


All times are GMT -4. The time now is 22:02.