|
[Sponsors] |
access boundary fields in a boundary condition |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 4, 2014, 12:11 |
access boundary fields in a boundary condition
|
#1 |
New Member
Join Date: Dec 2014
Location: Germany
Posts: 3
Rep Power: 12 |
Hello everyone,
I am just starting out with OpenFoam for my master thesis. This far I studied fluid mechanics and didn´t have the chance to learn a lot about programming. I´m trying to implement my own boundary condition, which does not differ a lot from flowRateInletVelocity. I need to access to some values (velocity-component Ux, pressure, temperature) from the 0-folder for other boundary-surfaces to adjust to the needs of my experimental data. Actually, I want to give a blowing ratio instead of a flowrate on this one inlet (as I have 2 inlets I need to get values for this other one). I looked for an answer on the forum, but nothing I tried worked. For instance the function lookupPatchID(my_boundary) called an error : error: ‘const class Foam::fvBoundaryMesh’ has no member named ‘lookupPatchID’ and the name my_boundary was said "not declared in this scope". I guess it must not be that complicated to call my boundary values, since it is quite an useful and common request ; but I´d be pleased if someone could give me a hint for the right syntax. Thanks a lot, Regards |
|
December 5, 2014, 04:12 |
|
#2 | ||
Senior Member
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21 |
I'm not an expert, but I do have some quick guesses based on http://www.cfd-online.com/Forums/ope...nditions.html:
Quote:
Quote:
If that does not help, please post more details of your code for people to be truly able to help rather than guess. Instead of coding, you might want to have a look at the groovyBC library first. Judging by what you say, I think it is able to do what you want. |
|||
December 5, 2014, 05:56 |
|
#3 | |||
New Member
Join Date: Dec 2014
Location: Germany
Posts: 3
Rep Power: 12 |
Hi,
Thank you for your answer. Of course I did replace "my_boundary" with the name of my boundary. I tried with findPatchID and it caused less errors but the code still does not recognise my U (velocity field) as a boundary field. As I said, I´m just using the code of the boundary condition flowRateInletVelocity.C and here is the only thing I changed in the code of the member function "updateCoeffs()" : My boundary is called MF_INLET. Quote:
Quote:
Quote:
I´ll be looking at this groovyBC library now ; but I would really like to manage coding my boundary condition, I´m sure it is not as hard a I first thought ! |
||||
December 5, 2014, 07:37 |
|
#4 |
Senior Member
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21 |
You need to access "U" via the ObjectRegistry.
This thread (specifically the first post) will help with that: http://www.cfd-online.com/Forums/ope...ct-scalar.html Code:
const volVectorField& U = this->db().objectRegistry::lookupObject<volVectorField> ("U"); The first post of the above thread does as well tell you how to access a dictionary. This thread tells you how to read a vector from a dictionary: http://www.cfd-online.com/Forums/ope...d-vectors.html This should help as well with accessing the x-component of U: http://www.cfd-online.com/Forums/ope...ell-label.html I am, however, unsure if you can access the 0/U file as a dictionary - I can't find anyone doing so. In the createFields.H file of every solver it is read using an IOObject. Otherwise... I hope someone else know how to acess the 0/U file. (But do you need the IC anyway? Or do you just need the velocity at the current time?) (Note that I'm trying to formulate an answer by simply searching, as I have little experience with this - but I learn as I go, and attempting to answering questions is an effective way to learn.) |
|
December 11, 2014, 05:22 |
|
#5 | |
New Member
Join Date: Dec 2014
Location: Germany
Posts: 3
Rep Power: 12 |
Thank you for your help, Kevin.
I finally did it ! I combined several of your links and I finally found a way to write it that worked. Here is my code, in case someone would need it in the future : Quote:
Good luck for your further work with OpenFoam ! |
||
Tags |
boundary condition, boundary field, openfoam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Low Mixing time Problem | Mavier | CFX | 5 | April 29, 2013 01:00 |
Velocity profile boundary condition | Tuca | FLOW-3D | 1 | April 23, 2013 13:02 |
Opening Boundary Condition | andreachan | Main CFD Forum | 11 | March 19, 2013 17:46 |
asking for Boundary condition in FLUENT | Destry | FLUENT | 0 | July 27, 2010 01:55 |
External Radiation Boundary Condition for Grid Interface | CFD XUE | FLUENT | 0 | July 9, 2010 03:53 |