Update of flux bc

This commit is contained in:
Hrvoje Jasak 2013-06-13 09:59:59 +01:00
parent 4fa88b1419
commit 75ff3d51f3
2 changed files with 29 additions and 25 deletions

View file

@ -41,28 +41,14 @@ fluxFvPatchField<Type>::fluxFvPatchField
) )
: :
fixedGradientFvPatchField<Type>(p, iF), fixedGradientFvPatchField<Type>(p, iF),
reactivity_(0), flux_(p.size(), pTraits<Type>::zero),
reactivity_(p.size(), 0),
gammaName_("gamma") gammaName_("gamma")
{ {
this->gradient() = pTraits<Type>::zero; this->gradient() = pTraits<Type>::zero;
} }
template<class Type>
fluxFvPatchField<Type>::fluxFvPatchField
(
const fluxFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchField<Type>(ptf, p, iF, mapper),
reactivity_(ptf.reactivity_),
gammaName_(ptf.gammaName_)
{}
template<class Type> template<class Type>
fluxFvPatchField<Type>::fluxFvPatchField fluxFvPatchField<Type>::fluxFvPatchField
( (
@ -72,7 +58,8 @@ fluxFvPatchField<Type>::fluxFvPatchField
) )
: :
fixedGradientFvPatchField<Type>(p, iF), fixedGradientFvPatchField<Type>(p, iF),
reactivity_(readScalar(dict.lookup("reactivity"))), flux_("flux", dict, p.size()),
reactivity_("reactivity", dict, p.size()),
gammaName_(dict.lookup("gamma")) gammaName_(dict.lookup("gamma"))
{ {
// Set dummy gradient // Set dummy gradient
@ -104,6 +91,22 @@ fluxFvPatchField<Type>::fluxFvPatchField
} }
template<class Type>
fluxFvPatchField<Type>::fluxFvPatchField
(
const fluxFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchField<Type>(ptf, p, iF, mapper),
flux_(ptf.flux_),
reactivity_(ptf.reactivity_),
gammaName_(ptf.gammaName_)
{}
template<class Type> template<class Type>
fluxFvPatchField<Type>::fluxFvPatchField fluxFvPatchField<Type>::fluxFvPatchField
( (
@ -111,6 +114,7 @@ fluxFvPatchField<Type>::fluxFvPatchField
) )
: :
fixedGradientFvPatchField<Type>(ptf), fixedGradientFvPatchField<Type>(ptf),
flux_(ptf.flux_),
reactivity_(ptf.reactivity_), reactivity_(ptf.reactivity_),
gammaName_(ptf.gammaName_) gammaName_(ptf.gammaName_)
{} {}
@ -124,6 +128,7 @@ fluxFvPatchField<Type>::fluxFvPatchField
) )
: :
fixedGradientFvPatchField<Type>(ptf, iF), fixedGradientFvPatchField<Type>(ptf, iF),
flux_(ptf.flux_),
reactivity_(ptf.reactivity_), reactivity_(ptf.reactivity_),
gammaName_(ptf.gammaName_) gammaName_(ptf.gammaName_)
{} {}
@ -139,8 +144,6 @@ void fluxFvPatchField<Type>::updateCoeffs()
return; return;
} }
const Field<Type>& C = *this;
const fvPatchField<scalar>& gammap = const fvPatchField<scalar>& gammap =
this->lookupPatchField this->lookupPatchField
( (
@ -149,7 +152,7 @@ void fluxFvPatchField<Type>::updateCoeffs()
reinterpret_cast<const scalar*>(NULL) reinterpret_cast<const scalar*>(NULL)
); );
this->gradient() = reactivity_*C/gammap; this->gradient() = reactivity_*flux_/gammap;
fixedGradientFvPatchField<Type>::updateCoeffs(); fixedGradientFvPatchField<Type>::updateCoeffs();
} }
@ -159,10 +162,8 @@ template<class Type>
void fluxFvPatchField<Type>::write(Ostream& os) const void fluxFvPatchField<Type>::write(Ostream& os) const
{ {
fixedGradientFvPatchField<Type>::write(os); fixedGradientFvPatchField<Type>::write(os);
os.writeKeyword("reactivity") flux_.writeEntry("flux", os);
<< reactivity_ << token::END_STATEMENT << nl; reactivity_.writeEntry("reactivity", os);
os.writeKeyword("gamma")
<< gammaName_ << token::END_STATEMENT << nl;
this->writeEntry("value", os); this->writeEntry("value", os);
} }

View file

@ -54,8 +54,11 @@ class fluxFvPatchField
{ {
// Private data // Private data
//- Flux
Field<Type> flux_;
//- Reactivity //- Reactivity
scalar reactivity_; scalarField reactivity_;
//- Name of diffusion field //- Name of diffusion field
word gammaName_; word gammaName_;