CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

dimensionedScalar + volScalarField is evaluated elementwisely ?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 29, 2012, 13:53
Default dimensionedScalar + volScalarField is evaluated elementwisely ?
  #1
New Member
 
Tianyi LI
Join Date: Mar 2012
Posts: 4
Rep Power: 5
tianyikillua is on a distinguished road
Hello everyone,

I'd like to know if a dimensionedScalar (ex. T1) + volScalarField (ex. T) is still a volScalarField and the result is obtained elementwisely, that is : result(i)=T1+T(i).

I need also to use a scalar function (ex. pos) determing the positivity of a scalar. If I apply this function to a volScalarField (ex. T), can I still obtain a volScalarField and result(i)=pos(T(i)) ?

I wrote this because I'm now implementing a non-constant diffusivity in the laplacianFoam solver.

In mylaplacianFoam.C, I have
Code:
DT=(a1+b1*T)*pos(T1-T)+(a2+b2*T)*neg(T1-T)*pos(T2-T)+(a3+b3*T)*neg(T2-T);
before solving the laplacian equation.

In creatFields.H, I have
Code:
    volScalarField DT
    (
        IOobject
        (
            "DT",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        (a1+b1*T)*pos(T1-T)+(a2+b2*T)*neg(T1-T)*pos(T2-T)+(a3+b3*T)*neg(T2-T)
    );
where ai, bi, T1 and T2 are scalars and DT is piecewise affine in [0,T1], [T1,T2] and [T2,+Inf].

Thank you very much for your help !!

Last edited by tianyikillua; March 29, 2012 at 13:55. Reason: typo
tianyikillua is offline   Reply With Quote

Old   March 30, 2012, 03:12
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
Yes, pos(T - X), where T is a volScalarField and X is a dimensionedScalar will return a volScalarField.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess 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
changing a volScalarField to a dimensionedScalar wschosta OpenFOAM Running, Solving & CFD 5 May 6, 2015 10:20
volScalarField for cell volumes and face surfaces AlmostSurelyRob OpenFOAM 2 December 13, 2010 06:24
Confused about how OF handles operation between volScalarField and dimensionedScalar Edy OpenFOAM 3 September 30, 2010 10:07
Problems with creating a volScalarField georlade OpenFOAM Programming & Development 2 July 6, 2010 02:19
if-loop, volScalarField comparison volker OpenFOAM 5 April 23, 2010 14:18


All times are GMT -4. The time now is 02:42.