|
[Sponsors] | |||||
|
|
|
#1 |
|
Senior Member
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 121
Rep Power: 4 ![]() |
Hello everybody,
I would like to create a new boundary condition derived from the outletInlet. I want a "zeroGradient" as outlet and a "slip" / "symmetry" as inlet. But before coding this, I went to study the source code of inletOutlet and outletInlet. I know that depending of the sign of "phi" (flux on the patch field), the code switch from one or the other boundary. However, I cannot understand the piece of code in charge of this process. For the inletOutlet: (opt/openfoam220/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C) 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")) // get the flux name
{
this->refValue() = Field<Type>("inletValue", dict, p.size()); // get the desired fixed value at the inlet
if (dict.found("value")) // ??? if the flux go outside the domain ???
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size()) // the patch get the field value
);
}
else // ??? if the flux go inside the domain ???
{
fvPatchField<Type>::operator=(this->refValue()); // the patch get the desired fixed value
}
this->refGrad() = pTraits<Type>::zero; // set the zero gradient vector
this->valueFraction() = 0.0; // ??? for multiphase flow ? ???
}
(opt/openfoam220/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.C) Code:
template<class Type>
Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchField<Type>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")) // get the flux name
{
this->refValue() = Field<Type>("outletValue", dict, p.size()); // get the desired fixed value at the inlet
if (dict.found("value")) // ??? if the flux go inside the domain ???
{
fvPatchField<Type>::operator=
(
Field<Type>("value", dict, p.size()) // the patch get the field value
);
}
else // ??? if the flux go outside the domain ???
{
fvPatchField<Type>::operator=(this->refValue()); // the patch get the desired fixed value
}
this->refGrad() = pTraits<Type>::zero; // set the zero gradient vector
this->valueFraction() = 0.0; // ??? for multiphase flow ? ???
}
inletOutlet: Code:
if (dict.found("value")) // ??? if the flux go outside the domain ???
Code:
if (dict.found("value")) // ??? if the flux go inside the domain ???
inletOutlet: Code:
template<class Type>
void Foam::inletOutletFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const Field<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
phiName_
);
this->valueFraction() = 1.0 - pos(phip); // The difference is here
mixedFvPatchField<Type>::updateCoeffs();
}
Code:
template<class Type>
void Foam::outletInletFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const fvsPatchField<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
phiName_
);
this->valueFraction() = pos(phip); // The difference is here
mixedFvPatchField<Type>::updateCoeffs();
}
|
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 121
Rep Power: 4 ![]() |
a small up
|
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| The FOAM Documentation Project - SHUT-DOWN | holger_marschall | OpenFOAM | 242 | March 7, 2013 12:30 |
| understanding kEpsilon model source code | jet | OpenFOAM Programming & Development | 5 | November 15, 2009 08:52 |
| Understanding k-omega SST model source code | tmhonka | OpenFOAM Programming & Development | 1 | September 8, 2009 07:33 |
| Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 15:56 |
| What is the Better Way to Do CFD? | John C. Chien | Main CFD Forum | 54 | April 23, 2001 08:10 |