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

dimensionedScalar + volScalarField is evaluated elementwisely ?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 29, 2012, 14:53
Default dimensionedScalar + volScalarField is evaluated elementwisely ?
  #1
New Member
 
Tianyi LI
Join Date: Mar 2012
Posts: 4
Rep Power: 14
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 14:55. Reason: typo
tianyikillua is offline   Reply With Quote

Old   March 30, 2012, 04:12
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30
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.
akidess is offline   Reply With Quote

Reply


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
if-loop, volScalarField comparison volker OpenFOAM 7 March 6, 2020 21:03
Problems with creating a volScalarField georlade OpenFOAM Programming & Development 4 December 4, 2016 13:31
changing a volScalarField to a dimensionedScalar wschosta OpenFOAM Running, Solving & CFD 5 May 6, 2015 11: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 11:07


All times are GMT -4. The time now is 00:52.