CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM

How to manipulat a volScalarField like this...

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

LinkBack Thread Tools Display Modes
Old   June 22, 2010, 17:38
Default How to manipulat a volScalarField like this...
New Member
Xingzhi You
Join Date: May 2010
Posts: 7
Rep Power: 9
masspec is on a distinguished road
Hey there,

I get a volScalarField A,and another volScalarField B. And B is dependent on A as follows:

if the value of a particular element in A is larger than a threshold,
then the corresponding value of that element in B is a function of A as f1.

else the value of B is a function of A as f2.

I do not know how can I manipulate the volScalarField to attain such objective, and looking for some help......

Thanks a lot.
masspec is offline   Reply With Quote

Old   June 22, 2010, 20:29
New Member
Join Date: Jun 2010
Posts: 2
Rep Power: 0
tiddlycorona is on a distinguished road
I think what you need is just how to have access to the field value at a cell, judge it and accordingly made modification to another field.

forAll (A, celli) {

if (A[celli]) > Threshold)
B[celli] = f1(A[celli]);
B[celli] = f2(A[celli]);


Not sure if it is right. Hope more experienced Foamers can tell us how to do it.
tiddlycorona is offline   Reply With Quote


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
Problems with creating a volScalarField georlade OpenFOAM Programming & Development 4 December 4, 2016 13:31
How to create initiate a volScalarField p without reading from disk NO_READ does not seem to work dbxmcf OpenFOAM Running, Solving & CFD 12 August 22, 2013 07:32
Definition of a linear function as volScalarField titio OpenFOAM Running, Solving & CFD 1 October 3, 2010 16:51
if-loop, volScalarField comparison volker OpenFOAM 5 April 23, 2010 14:18
dimensioned volScalarField lions85 OpenFOAM 1 November 12, 2009 03:41

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