CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

using SetFields with the fieldToCell selection

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

Like Tree1Likes
  • 1 Post By magga

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 11, 2015, 18:41
Default using SetFields with the fieldToCell selection
  #1
New Member
 
Marguerite
Join Date: Mar 2015
Posts: 4
Rep Power: 12
magga is on a distinguished road
Hi everyone,

I am trying to set a scalar field T, depending on the value of another scalar field alpha.
I would like T to be zero when alpha<=0.5, and T=1 when alpha>=0.5.
I wanted to use setFields, and select the region to be modified with fieldToCell, however I can't manage to do that .... I don't really know what to write it the setFieldsDict, as most of the examples I found on the wed use boxToCell.
Here is what I tried :

defaultFieldValues
(
volScalarFieldValue T 0
);

regions
(
fieldToCell
{
field alpha;
min 0;
max 0.5;
(
volScalarFieldValue T 1
);
}
);

And I receive an error message saying
"attempt to read beyond EOF".

Does anyone knows what it means and how I could fix it ?
Thank you very much for any help !
magga is offline   Reply With Quote

Old   March 12, 2015, 02:53
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 40
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Not sure this is the reason but the dictionary of fieldToCell is (taken from topoSetDict example)

Code:
source fieldToCell;
sourceInfo
{
    fieldName   U;      // Note: uses mag(U) since volVectorField
    min         0.1;
    max         0.5;
}
while you use just "field" label for alpha. Have you tried

Code:
fieldToCell
{
    fieldName alpha;
    min 0;
    max 0.5;

    (
        volScalarFieldValue T 1
    );
}
alexeym is offline   Reply With Quote

Old   March 12, 2015, 12:33
Default
  #3
New Member
 
Marguerite
Join Date: Mar 2015
Posts: 4
Rep Power: 12
magga is on a distinguished road
Hi,
Indeed this was half on the error, I had also forgotten the 'fieldValue', before the definition of T=1.
Thank very much you for your help alexeym! (and the link towards toposetdict example)
magga is offline   Reply With Quote

Old   March 12, 2015, 13:46
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 40
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Can you, please, share the example of correct syntax of setFieldsDict entry for reference?
alexeym is offline   Reply With Quote

Old   March 12, 2015, 14:50
Default
  #5
New Member
 
Marguerite
Join Date: Mar 2015
Posts: 4
Rep Power: 12
magga is on a distinguished road
sure, here is the code that works

Code:
defaultFieldValues
(
    volScalarFieldValue T 0
);

regions
(
    fieldToCell
    {
        fieldName alpha;
		min 0;
		max 0.5;
		fieldValues
        (
            volScalarFieldValue T 0 1
        );
    }
);
alexeym likes this.
magga is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can run setFields in parallel while decomposed? totalart OpenFOAM Running, Solving & CFD 2 August 21, 2018 00:07
Run time Selection Mechanism - Some help required to understand jaswi OpenFOAM Programming & Development 3 October 29, 2015 14:42
rhoSimplecFoam with setFields sino75 OpenFOAM Pre-Processing 0 March 11, 2015 05:08
Problem in3D model processing mebinitap OpenFOAM 2 December 12, 2014 05:40
Problems with the execution of the setFields utility. foamer OpenFOAM Pre-Processing 5 June 3, 2013 13:24


All times are GMT -4. The time now is 20:53.