|
[Sponsors] | |||||
using SetFields with the fieldToCell selection |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#1 |
|
New Member
Marguerite
Join Date: Mar 2015
Posts: 4
Rep Power: 12 ![]() |
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 ! |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
|
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;
}
Code:
fieldToCell
{
fieldName alpha;
min 0;
max 0.5;
(
volScalarFieldValue T 1
);
}
|
|
|
|
|
|
|
|
|
#3 |
|
New Member
Marguerite
Join Date: Mar 2015
Posts: 4
Rep Power: 12 ![]() |
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) |
|
|
|
|
|
|
|
|
#4 |
|
Senior Member
|
Hi,
Can you, please, share the example of correct syntax of setFieldsDict entry for reference? |
|
|
|
|
|
|
|
|
#5 |
|
New Member
Marguerite
Join Date: Mar 2015
Posts: 4
Rep Power: 12 ![]() |
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
);
}
);
|
|
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 |