CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] FoamToVTK problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2006, 10:19
Default FoamToVTK problem
  #1
New Member
 
Michael Oevermann
Join Date: Mar 2009
Posts: 15
Rep Power: 17
oevermann is on a distinguished road
Hi everybody,

I have written a new boundary condition (a new FvPatchField) for a time dependent inlet velocity. Everything with running the solver works fine. However, when I do a foamToVTK I get the following error

--> FOAM FATAL IO ERROR : keyword U is undefined in dictionary "/home/oevermann/OpenFOAM/oevermann-1.1/run/tutorials/myTurbFoam/blende/3.6e-05/ U_0::inlet"

Actually, I have no idea were to look first and what's going wrong here.
I don't see fundamental difference in terms of the output files if I run the solver just with a fixedValue inlet or my own routine.

Any ideas from the experts here? Thanks!

Michael
oevermann is offline   Reply With Quote

Old   July 11, 2006, 10:24
Default Your input and output function
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Your input and output functions are not compatible: the stuff that you wrote into the dictionary is not consistent with read in in the constructor from the dictionary.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   July 11, 2006, 10:54
Default Hrvoje, that's what I assum
  #3
New Member
 
Michael Oevermann
Join Date: Mar 2009
Posts: 15
Rep Power: 17
oevermann is on a distinguished road
Hrvoje,

that's what I assumed. However, I don't see the inconsistency. The constructor from the dictionary looks

harmonicInletOutletFvPatchVectorField::harmonicInl etOutletFvPatchVectorField
(
const fvPatch& p,
const vectorField& iF,
const dictionary& dict
)
:
mixedFvPatchVectorField(p, iF),
UInf_(dict.lookup("U")),
pInf_(readScalar(dict.lookup("p"))),
omega_(readScalar(dict.lookup("omega"))),
phase_(readScalar(dict.lookup("phase")))
{
if (dict.found("value"))
...


and the write function

// Write
void harmonicInletOutletFvPatchVectorField::write(Ostre am& os) const
{
fvPatchVectorField::write(os);
writeEntry("value", os);
}

Do I need to write all private data read in by the constructor? If yes, how can I do that (just writeEntry("UInf_",os) ?)

Greetings

Michael
oevermann is offline   Reply With Quote

Old   July 11, 2006, 11:00
Default Well, (excuse the tone) you ar
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Well, (excuse the tone) you are dealing with a compiler, not a crystal ball: how would the write() function know that it needs to write out U, p, omega and phase? There is nothing anywhere in the software to tell the compiler this needs to be done, so it is not. If you look at the offending boundary dictionary, you will see that the data is not there.

You need some lines like:

amplitude_.writeEntry("amplitude", os);

Please adjust as necessary - I've picked this one from a similar piece of code.

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   July 11, 2006, 12:53
Default Hi Hrvoje, thanks for the hin
  #5
New Member
 
Michael Oevermann
Join Date: Mar 2009
Posts: 15
Rep Power: 17
oevermann is on a distinguished road
Hi Hrvoje,
thanks for the hint! Some lines like
os.writeKeyword("U") << UInf_ << token::END_STATEMENT << nl
have fixed the problem.

I don't think that my initial problem/question had anything to do with the compiler (and/or my knowledge about compilers which might or might not not be as good as yours) - it is just a matter of how the classes in Foam are designed. It is not obvious at all that the write routine of a patch should write exactly the data read and indeed, the solver has no problems with it. It is the postprocessing requiring that and it is not documented anywhere (well, it might be documented but I didn't find it).

Greetings from Berlin

Michael
oevermann is offline   Reply With Quote

Old   July 11, 2006, 14:56
Default Hi Michael, Hmm, on C++ kno
  #6
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Hi Michael,

Hmm, on C++ knowledge I rate myself somewhere up there with Yoda, so I will take up the challenge:

If I design a class in a hierarchy and add an unknown number and type of private data into a final derived class, which may be in a form of a value member, a static or a reference, can you create a form of the base class (which clearly does not see the derived private argument types) to handle derived class I/O automatically?

The only form I can suggest is to template on the base with member types as arguments, which brings in the story of elipsis in the template argument list, and that's definitely not standard C++.

The post-processing requirement is a "value" entry in the patch field dictionary, which is indeed handled automatically, by calling the write function from the virtual base.

Can you enlighten me?

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   July 11, 2006, 16:10
Default Hrvoje, sorry, but I cannot e
  #7
New Member
 
Michael Oevermann
Join Date: Mar 2009
Posts: 15
Rep Power: 17
oevermann is on a distinguished road
Hrvoje,
sorry, but I cannot enlighten you :-(
Your last sentence was just the answear I hoped for in my initial question. Your class design makes perfect sense and I agree there is no solution for
automated class I/O here.
oevermann 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
area does not match neighbour by ... % -- possible face ordering problem St.Pacholak OpenFOAM 11 September 4, 2024 05:28
Is COMSOL Multi Physics is suitable to solve complex flow problem? steve lee COMSOL 8 January 5, 2023 03:31
Problem diverges when exhaust valve opens swerner0711 AVL FIRE 0 September 21, 2018 08:14
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13


All times are GMT -4. The time now is 17:07.