CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Dictionary operation (

Peter Müller January 10, 2012 11:31

Dictionary operation
Hello together

I created an fvPatchField for a mixing plane and now try to make it a bit more general. The idea is to have an fvPatchField for any scalar quantity (k,epsilon,omega,..) that are exchanged in the same way.
What I now need is to pick up the name of the patch that I'm actually on (the updateCoeffs() function). Something like:

word scalarQuantity = this.patch().name()

but like this I receive the name of the patch i have chosen in the boundary-file and not "p", "U","k",... or however the folders are called in the zero-directory.

Does anybody have any idea?

Thanks a lot

marupio January 10, 2012 13:18

Are you looking for this:

word scalarQuantity(dimensionedInternalField().name());

Peter Müller January 11, 2012 12:04

Thanks a lot for your reply. Sadly I was not able to use your suggestion, I always got the error:
scalarQuantity not declared.
I solved the problem in a different way. First I defined a const protected word in the header file of my fvPatchField. The constructor then assigns it a word that I defined in the dictionary.

Have a nice evening

Peter Müller January 12, 2012 04:02

Hello David

Perhaps you know this. I would like to use the lookupPatchField for and kind of Field (scalar, vector, tensor), like

const fvPatchField<Type>& typeValues =
mpPatch_.shadow().lookupPatchField<volField<Type>, Type>(typeName_);

The problem I have is that that it doesn't know a template form volField<Type>, it works fine if i use it for example for vector like

const fvPatchVectorField& vectorValues =
mpPatch_.shadow().lookupPatchField<volVectorField, vector>(vectorName_);

Do you have any idea how I should replace volVectorField?

Thanks Peter

marupio January 12, 2012 11:59

Hi Peter, a volVectorField is actually a GeometricField, but it's templated on more than just Type. One of them is even a template template parameter.

See finiteVolume/fields/surfaceFields/surfaceFieldsFwd.H and /finiteVolume/fields/volFields/volFieldsFwd.H.

All times are GMT -4. The time now is 00:13.