|
[Sponsors] |
January 22, 2015, 10:33 |
access inletValue
|
#1 | |
Member
Mattia de\' Michieli Vitturi
Join Date: Mar 2009
Posts: 50
Rep Power: 17 |
I continue here an old thread without a solution.
Quote:
If I write this piece of code: const volVectorField::GeometricBoundaryField& U2bf = U2.boundaryField(); forAll(U2bf, patchi) { if ( U2bf.types()[patchi] == "inletOutlet" ) { Info << U2bf[patchi].inletValue() << endl; } } compilation fails giving the following error: error: ‘const class Foam::fvPatchField<Foam::Vector<double> >’ has no member named ‘inletValue’ I have not found the member for inletValue! Can someone help me please? Thank you Mattia |
||
January 22, 2015, 11:29 |
|
#2 |
Senior Member
|
Hi,
If you take a look at the inletOutletFvPatchField documentation http://foam.sourceforge.net/docs/cpp/a01095.html, you can find, that it is a child of mixedFvPatchField and has refValue method. Alternatively you can look at the sources: Code:
template<class Type> Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField ( const fvPatch& p, const DimensionedField<Type, volMesh>& iF, const dictionary& dict ) : mixedFvPatchField<Type>(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")) { this->refValue() = Field<Type>("inletValue", dict, p.size()); if (dict.found("value")) { fvPatchField<Type>::operator= ( Field<Type>("value", dict, p.size()) ); } else { fvPatchField<Type>::operator=(this->refValue()); } this->refGrad() = pTraits<Type>::zero; this->valueFraction() = 0.0; } |
|
January 22, 2015, 12:19 |
|
#3 |
Member
Mattia de\' Michieli Vitturi
Join Date: Mar 2009
Posts: 50
Rep Power: 17 |
Dear alexeym,
following your suggestion I have solved the problem! Here there is the working code: Code:
const volVectorField::GeometricBoundaryField& U2bf = U2.boundaryField(); forAll(U2bf, patchi) { Info << U2bf[patchi] << endl; if ( U2bf.types()[patchi] == "inletOutlet" ) { mixedFvPatchField<vector>& U2inletOutlet = refCast<mixedFvPatchField<vector> >(U2.boundaryField()[patchi]); Info << U2inletOutlet.refValue() << endl; } } Thank you Mattia |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Getting access to mesh (fvMesh) via object registry | Chris Lucas | OpenFOAM Programming & Development | 18 | January 15, 2024 03:57 |
[DesignModeler] DesignModeler Scripting: How to get Full Command Access | ANT | ANSYS Meshing & Geometry | 53 | February 16, 2020 16:13 |
how to access inletValue | stevek | OpenFOAM | 1 | August 15, 2013 06:19 |
Online libraries - with access to Journals | momentum_waves | Main CFD Forum | 2 | December 12, 2007 11:08 |
Access Density | Allan Walsh | FLUENT | 3 | October 4, 2005 08:55 |