From 75ff3d51f3085071e276729eb9b867e4c8e6ab73 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 13 Jun 2013 09:59:59 +0100 Subject: [PATCH] Update of flux bc --- .../derived/flux/fluxFvPatchField.C | 49 ++++++++++--------- .../derived/flux/fluxFvPatchField.H | 5 +- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flux/fluxFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/flux/fluxFvPatchField.C index da4e36fda..b9e6c0872 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flux/fluxFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flux/fluxFvPatchField.C @@ -41,28 +41,14 @@ fluxFvPatchField::fluxFvPatchField ) : fixedGradientFvPatchField(p, iF), - reactivity_(0), + flux_(p.size(), pTraits::zero), + reactivity_(p.size(), 0), gammaName_("gamma") { this->gradient() = pTraits::zero; } -template -fluxFvPatchField::fluxFvPatchField -( - const fluxFvPatchField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - fixedGradientFvPatchField(ptf, p, iF, mapper), - reactivity_(ptf.reactivity_), - gammaName_(ptf.gammaName_) -{} - - template fluxFvPatchField::fluxFvPatchField ( @@ -72,7 +58,8 @@ fluxFvPatchField::fluxFvPatchField ) : fixedGradientFvPatchField(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::fluxFvPatchField } +template +fluxFvPatchField::fluxFvPatchField +( + const fluxFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedGradientFvPatchField(ptf, p, iF, mapper), + flux_(ptf.flux_), + reactivity_(ptf.reactivity_), + gammaName_(ptf.gammaName_) +{} + + template fluxFvPatchField::fluxFvPatchField ( @@ -111,6 +114,7 @@ fluxFvPatchField::fluxFvPatchField ) : fixedGradientFvPatchField(ptf), + flux_(ptf.flux_), reactivity_(ptf.reactivity_), gammaName_(ptf.gammaName_) {} @@ -124,6 +128,7 @@ fluxFvPatchField::fluxFvPatchField ) : fixedGradientFvPatchField(ptf, iF), + flux_(ptf.flux_), reactivity_(ptf.reactivity_), gammaName_(ptf.gammaName_) {} @@ -139,8 +144,6 @@ void fluxFvPatchField::updateCoeffs() return; } - const Field& C = *this; - const fvPatchField& gammap = this->lookupPatchField ( @@ -149,7 +152,7 @@ void fluxFvPatchField::updateCoeffs() reinterpret_cast(NULL) ); - this->gradient() = reactivity_*C/gammap; + this->gradient() = reactivity_*flux_/gammap; fixedGradientFvPatchField::updateCoeffs(); } @@ -159,10 +162,8 @@ template void fluxFvPatchField::write(Ostream& os) const { fixedGradientFvPatchField::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); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flux/fluxFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/flux/fluxFvPatchField.H index 0b2fe6eac..ed6247bf7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flux/fluxFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/flux/fluxFvPatchField.H @@ -54,8 +54,11 @@ class fluxFvPatchField { // Private data + //- Flux + Field flux_; + //- Reactivity - scalar reactivity_; + scalarField reactivity_; //- Name of diffusion field word gammaName_;