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

How to output user-defined volScalarField that paraFoam can read?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 29, 2013, 18:11
Default How to output user-defined volScalarField that paraFoam can read?
  #1
Senior Member
 
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 13
keepfit is on a distinguished road
Hi Foamers,

I have a question about how to write out a volScalarField derived from existing field:

The existing volScalarFields are :

Code:
...
    volScalarField alpha1
    (
        IOobject
        (
            "alpha1",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
....

    volScalarField voidfraction  // volume fraction of fluid, the rest is solid phase within one cell
    (
        IOobject
        (
            "voidfraction",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
Now I want to visualize a new volScalarField defined by alpha1*voidfraction:

Code:
    volScalarField alpha1Voidfraction
    (
        IOobject
        (
            "alpha1",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        alpha1*voidfraction
        //mesh
    );
Is the definition right? An "alpha1Voidfraction" BC is also defined in folder 0 similar to "alpha1". The simulation goes well, however, no such Field can be selected in paraview.

Basically I just want to write out "alpha1*voidfraction" and "(1-apha1)*voidfraction" everywhere in the fluid domain, does someone have such experiences on this issue? Any advice or recommendation will be highly appreciated.

Cheers,

David

Last edited by keepfit; September 29, 2013 at 19:31.
keepfit is offline   Reply With Quote

Old   September 30, 2013, 07:51
Default
  #2
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
well, you can use paraView calculator filter to calculate such expression
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   September 30, 2013, 07:56
Default
  #3
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
You name the field "alpha1" (in IOobject), this is also what paraview/parafoam shows. Put the correct name here, e.g. "alpha1Voidfraction"
Bernhard is offline   Reply With Quote

Old   October 14, 2013, 02:33
Default
  #4
Senior Member
 
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 13
keepfit is on a distinguished road
Quote:
Originally Posted by Bernhard View Post
You name the field "alpha1" (in IOobject), this is also what paraview/parafoam shows. Put the correct name here, e.g. "alpha1Voidfraction"
thanks for the tip.

It shows perfect in paraview.

However, I couldn't figure out why the volScalarField "alpha1Voidfraction" remains the initial status, even the alpha1 field changes.

Thnaks.
keepfit is offline   Reply With Quote

Old   October 14, 2013, 03:15
Default
  #5
Senior Member
 
fumiya's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18
fumiya is on a distinguished road
You need to update the volScalarField "alpha1Voidfraction" in the time loop:

Code:
while (simple.loop())
{
    alpha1Voidfraction=alpha1*voidfraction;
}
fumiya is offline   Reply With Quote

Old   February 7, 2014, 07:50
Default
  #6
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
Very late answer:
For the field alpha1Voidfraction you probably do not want to read it, because it is always calculated as suggested in comment #5. So you should probably change IOobject::MUST_READ to IOobject::NO_READ in the definition of that field.
jherb is offline   Reply With Quote

Reply

Tags
alpha1, paraview

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
USER DEFINED SCALARS yann Phoenics 6 November 14, 2013 08:46
UDF - Derivatives for User Defined Memory Variable Sandilya Garimella FLUENT 0 January 14, 2008 10:39
User fortran routines, DEBUG AND OUTPUT Bloshchitsyn Vladimir CFX 5 October 29, 2007 01:31
User Defined Scalars - Returning Values Carlos V. FLUENT 0 April 19, 2006 18:18
Usage of user defined functions Gowrish FLUENT 1 October 26, 2005 07:44


All times are GMT -4. The time now is 19:09.