alexeym |
October 27, 2015 08:54 |
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.
|