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

Difference between internalField and setFields

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 10, 2013, 03:19
Default Difference between internalField and setFields
  #1
Member
 
Join Date: Jul 2011
Posts: 92
Rep Power: 6
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, 02:59
Default
  #2
ata
Senior Member
 
ata's Avatar
 
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 322
Rep Power: 9
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, 03:24
Default
  #3
Member
 
Join Date: Jul 2011
Posts: 92
Rep Power: 6
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, 08:24
Default
  #4
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 166
Rep Power: 14
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 08:26. Reason: added more explanation
GerhardHolzinger is offline   Reply With Quote

Old   January 15, 2013, 08:39
Default
  #5
Member
 
Join Date: Jul 2011
Posts: 92
Rep Power: 6
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 11: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: 4
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: AU
Posts: 123
Rep Power: 5
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, 22:02
Default
  #8
New Member
 
Join Date: Jan 2013
Location: U.S.A
Posts: 12
Rep Power: 4
banji is on a distinguished road
Hi Ata,

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

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
non-uniform internalField shash OpenFOAM Pre-Processing 6 May 12, 2013 16:54
setFields not working dsanza OpenFOAM 2 September 14, 2011 09:00


All times are GMT -4. The time now is 06:29.