|
[Sponsors] |
read scalar field phi, get flux through faces |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 28, 2010, 14:23 |
read scalar field phi, get flux through faces
|
#1 |
New Member
Peter Wiemeyer
Join Date: Sep 2009
Location: Germany, Munich
Posts: 22
Rep Power: 17 |
Hello,
I've a question. I write a program with the target to read the flux phi through some faces. (I need this for a special report. The code is already able to find the necessary faces. So the import of the mesh itself works.) But now I've no idea, how to read the flux phi through the faces, and especially everything I tried to source the field phi was not really successfully. Probably it's easy but I've no idea, how to do? Thanks a lot already for your help & best Regards, Peter <code> #include "argList.H" #include "cellSet.H" #include "topoSetSource.H" #include "Time.H" #include "globalMeshData.H" #include <fstream> //to write out the stl file #include <malloc.h> #include <string.h> using namespace Foam; using namespace std; // for input/output file // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: int main(int argc, char *argv[]) { argList::noParallel(); #include "setRootCase.H" fileName sourceRootDir = "."; fileName sourceCaseDir = "."; Time runTime ( Time::controlDictName, sourceRootDir, sourceCaseDir ); #include "createPolyMesh.H" </code> |
|
July 28, 2010, 15:33 |
|
#2 |
Senior Member
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22 |
Hi Peter,
can't you simply use: Code:
surfaceScalarField phi ( IOobject ( "phi", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), linearInterpolate(U) & mesh.Sf() ); Code:
# include "createPhi.H" |
|
July 29, 2010, 03:30 |
|
#3 |
New Member
Peter Wiemeyer
Join Date: Sep 2009
Location: Germany, Munich
Posts: 22
Rep Power: 17 |
phi is already present in the time step (from data side), but
in the program there're no fields sourced at the moment. The point is that the class(?) surfaceScalarField is not known. Probably the right #include file is missing but here I've the problem if I take other programs like simpleFoam (or someome with phi present, that swallow... thing) I get a couple of more errors. Than the topo functions working no longer because at the end of the code I build a cellset. I need a method so that I can simple read the fields, especially the phi one, at that moment when I read the time step. Hope it's clear what I want. I'm not a real c++ expert, but my knowledge becomes better by day ;-) Thx & Best Regards, Peter |
|
August 3, 2010, 04:44 |
|
#4 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
Hi Peter,
is this a postprocessing routine or do you need to have the output in your solver? If it is a postprocessing routine you could try to have a look in the applications/utilities/postprocessing routines. Mayby you could use a foam::calc function or you could try to just add #include fvCFD.H Maybe this could work. Best Kathrin |
|
August 4, 2010, 17:36 |
|
#5 |
New Member
Peter Wiemeyer
Join Date: Sep 2009
Location: Germany, Munich
Posts: 22
Rep Power: 17 |
Hello,
thanks for your help. I began again with the simpleFoam.C and beginning from this code I tried to solve my problem. At the end it was in fact the simple point to add fvCFD but additionaly the order of the include files was important as well. Now it works. Thanks a lot and bye Peter |
|
April 28, 2017, 20:40 |
|
#6 |
Member
Pavan
Join Date: Jan 2016
Posts: 53
Rep Power: 10 |
Peter
Can you share your code. Here is my problem: in each pressure loop I need to find the fluxes through the faces lying in a particular cellZone and then multiply them with zero. And then pass this upadted velocity field to the next pressure loop. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
dieselFoam problem!! trying to introduce a new heat transfer model | vivek070176 | OpenFOAM Programming & Development | 10 | December 24, 2014 00:48 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
[snappyHexMesh] external flow with snappyHexMesh | chelvistero | OpenFOAM Meshing & Mesh Conversion | 11 | January 15, 2010 20:43 |
Can I specify a passive scalar flux source in ccm+ | eric | Siemens | 0 | June 11, 2008 15:48 |
from a vecor field to get a gradient of scalar | dusky.he | Main CFD Forum | 4 | March 30, 2007 10:08 |