From 43674c372f2a7176410977c5e48ec8bf9a23d711 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Sun, 29 Jan 2012 11:46:02 +0000 Subject: [PATCH] Evaluate when auxiliary fields are not present --- .../buoyantPressureFvPatchScalarField.C | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/buoyantPressure/buoyantPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/buoyantPressure/buoyantPressureFvPatchScalarField.C index 286accef8..1bfe937c0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/buoyantPressure/buoyantPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/buoyantPressure/buoyantPressureFvPatchScalarField.C @@ -111,6 +111,26 @@ void buoyantPressureFvPatchScalarField::updateCoeffs() return; } + // If variables are not found, evaluate as zero gradient + // HJ, 17/Jan/2012 + if + ( + !db().foundObject("g") + || !db().foundObject(rhoName_) + ) + { + InfoIn + ( + "void buoyantPressureFvPatchScalarField::updateCoeffs()" + ) << "Fields required for evaluation not found for patch " + << patch().name() << endl; + + gradient() = 0; + fixedGradientFvPatchScalarField::updateCoeffs(); + + return; + } + const uniformDimensionedVectorField& g = db().lookupObject("g");