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

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

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 7 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread 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,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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.
hwangpo, hanglian, kk415 and 4 others like this.
alexeym is offline   Reply With Quote

Reply

Tags
fvoptions, opfoam


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
Adding fvOptions to turbulence model slottedLemon OpenFOAM Programming & Development 13 May 28, 2020 13:27
Companies that lease software & hardware for cloud-based work? Catthan ANSYS 0 June 18, 2014 11: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 13:08
why my In-Form doesn't work? green Phoenics 2 May 27, 2004 22:03


All times are GMT -4. The time now is 19:11.