CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

access inletValue

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 1 Post By demichie
  • 1 Post By alexeym
  • 1 Post By demichie

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 22, 2015, 10:33
Default access inletValue
  #1
Member
 
Mattia de\' Michieli Vitturi
Join Date: Mar 2009
Posts: 50
Rep Power: 17
demichie is on a distinguished road
I continue here an old thread without a solution.


Quote:
Originally Posted by stevek View Post
Hi,

I am manipulating boundary values where I access the "value" of inletOutlet bc with:

fvPatchScalarField& kInlet = k.boundaryField()[inletPatchID]

How can I similarly access "inletValue" of this bc for modification.

Thanks,
Steve
I have the same problem and I would like to access the "inletValue" of an inletOutlet boundary condition but I don't know how to do it.

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
Pagoda likes this.
demichie is offline   Reply With Quote

Old   January 22, 2015, 11:29
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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;
}
There you'll be able to find that inletValue is stored as refValue. You have to cast patch into mixedFvPatchField before accessing refValue method.
demichie likes this.
alexeym is offline   Reply With Quote

Old   January 22, 2015, 12:19
Default
  #3
Member
 
Mattia de\' Michieli Vitturi
Join Date: Mar 2009
Posts: 50
Rep Power: 17
demichie is on a distinguished road
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
Pagoda likes this.
demichie is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
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


All times are GMT -4. The time now is 03:34.