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

fvOptions: how does it work or how to use the "fvOptions" ?

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

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Display Modes
Old   October 27, 2015, 06:39
Question fvOptions: how does it work or how to use the "fvOptions" ?
  #1
New Member
 
Xia Shaopeng
Join Date: Sep 2015
Posts: 2
Rep Power: 0
dsqx is on a distinguished road
i saw the "fvOptions(U)" in simpleFoam/UEqn.H. i know the "fvOptions" is about the source term but how does it work or how to use the "fvOptions" ?

regards
dsqx is offline   Reply With Quote

Old   October 27, 2015, 09:54
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,409
Rep Power: 24
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

1. This is how it works (since your question is about fvOptions(U), I show only this functionality):

fvOptions is an object of Foam::fv::optionList class. It has operator ():

Code:
            //- Return source for equation
            template<class Type>
            tmp<fvMatrix<Type> > operator()
            (
                GeometricField<Type, fvPatchField, volMesh>& fld
            );
which in turn is implemented like this:

Code:
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator()
(
    GeometricField<Type, fvPatchField, volMesh>& fld
)
{
    return this->operator()(fld, fld.name());
}

template<class Type>
Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator()
(
    GeometricField<Type, fvPatchField, volMesh>& fld,
    const word& fieldName
)
{
    checkApplied();

    const dimensionSet ds = fld.dimensions()/dimTime*dimVolume;

    tmp<fvMatrix<Type> > tmtx(new fvMatrix<Type>(fld, ds));

    fvMatrix<Type>& mtx = tmtx();


    forAll(*this, i)
    {
        option& source = this->operator[](i);
    
        label fieldI = source.applyToField(fieldName);

        if (fieldI != -1)
        {
            source.setApplied(fieldI);

            if (source.isActive())
            {
                if (debug)
                {
                    Info<< "Applying source " << source.name() << " to field "
                        << fieldName << endl;
                }

                source.addSup(mtx, fieldI);
            }
        }
    }

    return tmtx;
}
addSup implementation depends on fvOption.

2. How to use.

Code:
$ cd $FOAM_TUTORIALS
$ find . -name 'fvOptions'
...
./incompressible/simpleFoam/mixerVessel2D/system/fvOptions
./incompressible/simpleFoam/turbineSiting/system/fvOptions
you can find available sources in $FOAM_SRC/fvOptions/sources.
hanglian likes this.
alexeym is offline   Reply With Quote

Reply

Tags
fvoptions, opfoam

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding fvOptions to turbulence model slottedLemon OpenFOAM Programming & Development 8 October 15, 2014 21:34
Companies that lease software & hardware for cloud-based work? Catthan ANSYS 0 June 18, 2014 10:53
Do all CFD analysts have to do some hands-on work except PhDs? e13drd Main CFD Forum 2 March 17, 2014 15:56
Why do the Plant library cases don't work? Alumna Phoenics 6 June 22, 2004 12:08
why my In-Form doesn't work? green Phoenics 2 May 27, 2004 21:03


All times are GMT -4. The time now is 10:04.