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

Output of tmp<volScalarField> data

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 16, 2014, 07:11
Default Output of tmp<volScalarField> data
  #1
New Member
 
Christoph Wenzel
Join Date: May 2014
Location: Germany
Posts: 21
Rep Power: 11
ChrisWe is on a distinguished road
I'm doing DDES calculation in OpenFoam and want to show me the gridcells, that are calculated with RANS and those that are calculated with LES.

Therefore I created a new turbulenceModel called mySpalartAllmarasDDES that is a simple copy of the standard SpalartAllmarasDDES. There are the following lines in the mySpalartAllmarasDDES.C file:

Code:
volScalarField mySpalartAllmarasDDES::dTilda(const volScalarField& S) const
{
    return max
    (
        y_
      - fd(S)
       *max(y_ - CDES_*delta(), dimensionedScalar("zero", dimLength, 0)),
        dimensionedScalar("small", dimLength, SMALL)
    );
}
The first step I want to do is to write out dTilda in the time directories. My Problem is, that dTilda is only virtual as a tmpField.

So my Question is: is there any possibility, to write out tmp-datas?
For example anything like

Code:
volScalarField dTilda_output...
(
   NO_READ
   MUST_WRITE...
)

dTilda_output = dTilda;
Thank you all for the amazing help that this forum gives me all the time...
ChrisWe is offline   Reply With Quote

Old   November 30, 2018, 10:46
Default
  #2
New Member
 
Terrence Nguyen
Join Date: Jan 2012
Posts: 13
Rep Power: 14
hismother is on a distinguished road
Quote:
Originally Posted by ChrisWe View Post
I'm doing DDES calculation in OpenFoam and want to show me the gridcells, that are calculated with RANS and those that are calculated with LES.

Therefore I created a new turbulenceModel called mySpalartAllmarasDDES that is a simple copy of the standard SpalartAllmarasDDES. There are the following lines in the mySpalartAllmarasDDES.C file:

Code:
volScalarField mySpalartAllmarasDDES::dTilda(const volScalarField& S) const
{
    return max
    (
        y_
      - fd(S)
       *max(y_ - CDES_*delta(), dimensionedScalar("zero", dimLength, 0)),
        dimensionedScalar("small", dimLength, SMALL)
    );
}
The first step I want to do is to write out dTilda in the time directories. My Problem is, that dTilda is only virtual as a tmpField.

So my Question is: is there any possibility, to write out tmp-datas?
For example anything like

Code:
volScalarField dTilda_output...
(
   NO_READ
   MUST_WRITE...
)

dTilda_output = dTilda;
Thank you all for the amazing help that this forum gives me all the time...



Does anyone have the answer for this problem??
hismother is offline   Reply With Quote

Old   November 30, 2018, 11:56
Default
  #3
Senior Member
 
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21
Daniel_Khazaei will become famous soon enough
Hi, cant you just use the following method? I use it for temperature dependent density to be written during simulation...

Code:
tmp<volScalarField> incompressibleTwoPhaseThermoMixture::rho1() const
{
    return tmp<volScalarField>
    (
        new volScalarField
        (
            IOobject
            (
                "rho1",
                mesh_.time().timeName(),
                mesh_,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),
            rho1_ + linearCoeff1_ * (T().oldTime() - TRef1_)
          + polyCoeff1_ * sqr(T().oldTime() - TRef1_)
        )
    );
}
But it seems that your function returns a volScalarField instead of tmp<volScalarField>, which the above method that I have described may not work for you! (although I can see that it is define as tmp<volScalarField> in my OpenFOAM version, so perhaps we are running different versions)
second method would be to define dTilda as volScalarField globally (don't define it in local scope of your function as you are not allowed to return local variable) and do the calculation in your function and then return it:

in your header file define dTilda_ as private variable:

Code:
volScalarField dTilda_;
then initialize it in the constructor in your C file:

Code:
    dTilda_
    (
        IOobject
        (
            "dTilda",
            U.time().timeName(),
            U.mesh(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
         U.mesh(),
        dimensiondScalar("zero", dimension, scalar(0))

     )

Last edited by Daniel_Khazaei; December 1, 2018 at 08:44.
Daniel_Khazaei 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
[ICEM] Data structure of output file from ICEM for my own code openfoammaofnepo ANSYS Meshing & Geometry 0 July 1, 2013 17:24
help for data output aki_yafuji OpenFOAM Running, Solving & CFD 0 September 12, 2010 07:15
How to output data from stationary part only? Aerolex FLUENT 0 November 16, 2009 22:46
output data for unsteady flow case wieke Main CFD Forum 0 September 30, 2003 04:40
Data output collection simon Main CFD Forum 0 September 29, 2003 09:03


All times are GMT -4. The time now is 16:14.