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

View file

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