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

how to write quantities from interfaceProperties.C ?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 8, 2014, 01:43
Question how to write quantities from interfaceProperties.C ?
  #1
New Member
 
Join Date: Jul 2014
Posts: 12
Rep Power: 12
red.yxg is on a distinguished road
Dear all:

Now I am using interFoam to simulate two-phase flow. And I want to write out private data in interfaceProperties.C like curvature. Because in createFields.H of interFoam there is an object ''interface'' of class ''interfaceProperties''. So I just add this in createFields.H :
Code:
volScalarField 	K
    (
        IOobject
        (
            "K",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        interface.K()
    );
After recompile interFoam and run a case, the value of K in different time step is the same. It seems that K is just calculated from alpha distribution of the first time step instead of the updated alpha. Is this because createFields.H is included before the time loop ?
So how to solve this problem ? Any hint is appreciated.
red.yxg is offline   Reply With Quote

Old   October 8, 2014, 02:38
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

you should update your K after interface.correct() call to copy newly calculated values to your variable. You can do it with simple K = interface.K().

Also you can try to get K from object registry and modify its wirteOpts and path, but it'll be more complicated.
alexeym is offline   Reply With Quote

Old   October 8, 2014, 04:40
Default
  #3
New Member
 
Join Date: Jul 2014
Posts: 12
Rep Power: 12
red.yxg is on a distinguished road
Hi, Alexey:

Thank you for your reply. It works! Yes, this is simple to implement than writing another .C like writeCellCenters.C.
red.yxg is offline   Reply With Quote

Old   August 24, 2015, 15:10
Default Ploting K
  #4
Member
 
Mahmoud Aboukhedr
Join Date: Feb 2014
Location: London
Posts: 40
Rep Power: 12
Mahmoud_aboukhedr is on a distinguished road
Dear All,

I tried to follow what you said to plot K, but it failed to compile.
What I did is ,,
1) Added this piece of code to the creatPatch.h file in interfoam
Info<< "Reading field K\n" << endl;
volScalarField K
(
IOobject
(
"K",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
K = interface.K()
);

2) Then compiled

I got this error each time ..

createFields.H: In function ‘int main(int, char**)’:
createFields.H:40:12: error: ‘interface’ was not declared in this scope
In file included from myinterFoam.C:61:0:
/home/ofoam/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable]
make: *** [Make/linux64GccDPOpt/myinterFoam.o] Error 1

I tried to change the code to
Info<< "Reading field K\n" << endl;
volScalarField K
(
IOobject
(
"K",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

it complie but nothing happens in the K file after the run


Any help will do ..

Thanks mahmoud
Mahmoud_aboukhedr is offline   Reply With Quote

Reply

Tags
curvature, interfoam, ioobject


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
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 7 December 15, 2020 13:06
[Helyx OS] Helyx-OS (GUI for SnappyHexMesh elvis OpenFOAM Community Contributions 210 January 30, 2017 18:57
Reading Additional Data Quantities from Fluent into Tecplot fremder Tecplot 9 December 16, 2016 15:35
[snappyHexMesh] Debug option in snappy / Write volScalarField with cellLevel for postprocessing Ruli OpenFOAM Meshing & Mesh Conversion 1 March 30, 2014 08:57
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 14:37


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