CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Difference between internalField and setFields

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 10, 2013, 02:19
Default Difference between internalField and setFields
  #1
Senior Member
 
Join Date: Jul 2011
Posts: 120
Rep Power: 14
haze_1986 is on a distinguished road
Hi all, I am new here. Following the guide on shallowWaterFoam, I am not sure why at the start we have included the internalFields, which I assume is the initial conditions, and we still have to run setFields before running foam? Can anyone enlighten me?
haze_1986 is offline   Reply With Quote

Old   January 14, 2013, 01:59
Default
  #2
ata
Senior Member
 
ata's Avatar
 
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 17
ata is on a distinguished road
Hi
internalFields are your fields like pressure field velocity field and etc. setFields is a function that initialize your requested fields.
ata is offline   Reply With Quote

Old   January 14, 2013, 02:24
Default
  #3
Senior Member
 
Join Date: Jul 2011
Posts: 120
Rep Power: 14
haze_1986 is on a distinguished road
Hi, could you please elaborate further with examples? I.e. for the shallowwaterfoam, if we did not use setfields, wouldn't it be the same as it would take the field values initially?
haze_1986 is offline   Reply With Quote

Old   January 15, 2013, 07:24
Default
  #4
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 339
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
When you want to define an internal field with internalField you have two options:

Either define a uniform value for the whole domain, or use a list to assign each cell its own value.


setFields is a utility which you can use to define geometric regions with different field values.


Example: You want to initialize a half empty water glass.

The two-phase solvers use a scalar field - the volume fraction alpha1 - to quantify how much water/air a cell contains. In the case of the water glass alpha1=0 means only water and alpha1=1 means only air.

This is a setFieldsDict entry to initialize a partly filled vessel.

Code:
defaultFieldValues
(
    volScalarFieldValue alpha1 1
);

// alpha1 = 0  <=>  no air, only water
regions
(
    // Set cell values
    // (does zerogradient on boundaries)
    boxToCell
    {
        box (-0.3 -0.3 0) (0.3 0.3 0.39);

        fieldValues
        (
            volScalarFieldValue alpha1 0
        );
    }
);
In the case of a non-uniform internal field, you can also use the internalField keyword. However, this gets lengthy - see the bubble column tutorial of the twoPhaseEulerFoam solver


The following is a part of the 0/alpha1 file of the bubble column tutorial of twoPhaseEulerFoam. There the internal field is defined using the internalField keyword. In this case you have 1875 cells. Consequently, the list has to be 1875 entries long.

Code:
internalField   nonuniform List<scalar>
1875
(
0.0548304
0.0623421
// and so on ....

Last edited by GerhardHolzinger; January 15, 2013 at 07:26. Reason: added more explanation
GerhardHolzinger is offline   Reply With Quote

Old   January 15, 2013, 07:39
Default
  #5
Senior Member
 
Join Date: Jul 2011
Posts: 120
Rep Power: 14
haze_1986 is on a distinguished road
Quote:
Originally Posted by GerhardHolzinger View Post
When you want to define an internal field with internalField you have two options:

Either define a uniform value for the whole domain, or use a list to assign each cell its own value.


setFields is a utility which you can use to define geometric regions with different field values.


Example: You want to initialize a half empty water glass.

The two-phase solvers use a scalar field - the volume fraction alpha1 - to quantify how much water/air a cell contains. In the case of the water glass alpha1=0 means only water and alpha1=1 means only air.

This is a setFieldsDict entry to initialize a partly filled vessel.

Code:
defaultFieldValues
(
    volScalarFieldValue alpha1 1
);

// alpha1 = 0  <=>  no air, only water
regions
(
    // Set cell values
    // (does zerogradient on boundaries)
    boxToCell
    {
        box (-0.3 -0.3 0) (0.3 0.3 0.39);

        fieldValues
        (
            volScalarFieldValue alpha1 0
        );
    }
);
In the case of a non-uniform internal field, you can also use the internalField keyword. However, this gets lengthy - see the bubble column tutorial of the twoPhaseEulerFoam solver


The following is a part of the 0/alpha1 file of the bubble column tutorial of twoPhaseEulerFoam. There the internal field is defined using the internalField keyword. In this case you have 1875 cells. Consequently, the list has to be 1875 entries long.

Code:
internalField   nonuniform List<scalar>
1875
(
0.0548304
0.0623421
// and so on ....
Hi GerhardHolzinger,

Thanks for the explanation, thus am I right to say that in the shalloWaterFoam example the results will be the same even if setFields isn't used? Since it has been described in internalfield in each cell at the start? No alpha1 is used there.

Last edited by haze_1986; January 15, 2013 at 10:37.
haze_1986 is offline   Reply With Quote

Old   September 21, 2013, 09:12
Default setFields to set non uniform list for internal Field?
  #6
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
Hi,

can I use setFields to set a non uniform Temperature field like T = Ax+By in the internal Field in a simple geometry like a cavity? If yes, what should the setFieldsDict contain?

Thank you in advance!
__________________
Regards,

Srivaths
Sherlock_1812 is offline   Reply With Quote

Old   September 21, 2013, 11:02
Default
  #7
Senior Member
 
Mohammad Shakil Ahmmed
Join Date: Oct 2012
Location: AUS
Posts: 137
Rep Power: 14
ahmmedshakil is on a distinguished road
Quote:
Originally Posted by Sherlock_1812 View Post
Hi,

can I use setFields to set a non uniform Temperature field like T = Ax+By in the internal Field in a simple geometry like a cavity? If yes, what should the setFieldsDict contain?

Thank you in advance!
Hi,
You can use funkySetFields that comes with swak4Foam.
ahmmedshakil is offline   Reply With Quote

Old   January 13, 2014, 21:02
Default
  #8
Member
 
Olabanji
Join Date: Jan 2013
Location: U.S.A
Posts: 31
Rep Power: 13
banji is on a distinguished road
Hi Ata,

Did you see my message concerning interFoam with smoother. Thanks.
banji is offline   Reply With Quote

Old   July 10, 2017, 04:32
Default
  #9
New Member
 
Alice
Join Date: Jun 2017
Posts: 26
Rep Power: 8
yangzhuan is on a distinguished road
Hi,
Why my setFields is not work. My setFields is that.
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (0 0 0) (0.5 0.1 0.1);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);

This case is a channel od dimensions 1.00m*0.10m*0.15m(length, width, height). No matter how to change the boxToCell, there is nothing to change. Only the inlet is water. But i want a half water and the rest is air. I really nead help.
Thank you!
Attached Images
File Type: png )[(I79%BBYBK)J05GQHZ1%F.png (8.3 KB, 64 views)
yangzhuan is offline   Reply With Quote

Old   August 11, 2017, 11:28
Default
  #10
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 16
Elham is on a distinguished road
Quote:
Originally Posted by yangzhuan View Post
Hi,
Why my setFields is not work. My setFields is that.
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (0 0 0) (0.5 0.1 0.1);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);

This case is a channel od dimensions 1.00m*0.10m*0.15m(length, width, height). No matter how to change the boxToCell, there is nothing to change. Only the inlet is water. But i want a half water and the rest is air. I really nead help.
Thank you!
Your mesh maybe is too coarse.
Elham is offline   Reply With Quote

Old   April 18, 2018, 15:14
Default Set fields dict bubble column water height
  #11
Vam
New Member
 
Join Date: Apr 2018
Posts: 2
Rep Power: 0
Vam is on a distinguished road
Quote:
Originally Posted by Elham View Post
Your mesh maybe is too coarse.
I have the same problem. I am using a bubblecolumn in the twophaseeluerfoam solver. I am trying to change the water height of my geometry but it does not work.
I used salome for the geometry. Could it be because of that?
Vam is offline   Reply With Quote

Old   May 13, 2020, 15:10
Default
  #12
New Member
 
sante junior
Join Date: Oct 2016
Posts: 11
Rep Power: 9
sante is on a distinguished road
Hello
I'd like to fill a cylinder halfway with charcoal. Can you help me with the setFieldDict tool?
sante is offline   Reply With Quote

Old   January 19, 2021, 18:42
Default
  #13
Senior Member
 
starter
Join Date: Sep 2012
Posts: 125
Rep Power: 15
sihaqqi is on a distinguished road
Greetings

What does $internalField mean. Can someone please explain function of $.
Thanks
sihaqqi is offline   Reply With Quote

Old   January 19, 2021, 21:47
Default
  #14
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,674
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Quote:
Originally Posted by sihaqqi View Post
Greetings

What does $internalField mean. Can someone please explain function of $.
Thanks

$internalField is a pointer used on boundaries to point to the internal field and use this as the boundary field value. The boundary faces take on the value of the adjacent cells at runtime. You use this when you don't want to specify explicitly the boundary values but just want to use whatever is available from the internal field. A very common situation where it is used is at outlets since it makes sense to use whatever is variable that has arrived at the outlet rather than setting an arbitrary fixed value.
LuckyTran is offline   Reply With Quote

Old   September 17, 2021, 04:55
Default
  #15
Member
 
Honza Höll
Join Date: Mar 2016
Location: Brno, CZ
Posts: 34
Rep Power: 10
indy07cz is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
$internalField is a pointer used on boundaries to point to the internal field and use this as the boundary field value. The boundary faces take on the value of the adjacent cells at runtime. You use this when you don't want to specify explicitly the boundary values but just want to use whatever is available from the internal field. A very common situation where it is used is at outlets since it makes sense to use whatever is variable that has arrived at the outlet rather than setting an arbitrary fixed value.
Hello, I have a question to that. Let say I use inletOutlet BC for velocity at outlet and for inletValue I use $internalField, then its like zeroGradient BC isn't it?
indy07cz is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
setFields not working dsanza OpenFOAM 4 October 18, 2018 09:43
non-uniform internalField shash OpenFOAM Pre-Processing 8 January 4, 2017 12:30


All times are GMT -4. The time now is 07:03.