From dd8777480ace1de3f7617bbf70688233f2b0fc62 Mon Sep 17 00:00:00 2001 From: ignis Date: Thu, 6 Sep 2018 15:31:51 +0900 Subject: [PATCH] compiling --- ...ateTiltedInletVelocityFvPatchVectorField.C | 37 +++++++++++++++---- ...ateTiltedInletVelocityFvPatchVectorField.H | 6 +++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/flowRateTiltedInletVelocityFvPatchVectorField.C b/flowRateTiltedInletVelocityFvPatchVectorField.C index bb3fcbf..3ecb5e8 100644 --- a/flowRateTiltedInletVelocityFvPatchVectorField.C +++ b/flowRateTiltedInletVelocityFvPatchVectorField.C @@ -29,6 +29,8 @@ License #include "fvPatchFieldMapper.H" #include "surfaceFields.H" +#include "unitConversion.H" + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::flowRateTiltedInletVelocityFvPatchVectorField:: @@ -42,7 +44,9 @@ flowRateTiltedInletVelocityFvPatchVectorField flowRate_(), volumetric_(false), rhoName_("rho"), - rhoInlet_(0.0) + rhoInlet_(0.0), + angle_(0.0), + axis_(vector(0,0,0)) {} @@ -59,7 +63,9 @@ flowRateTiltedInletVelocityFvPatchVectorField flowRate_(ptf.flowRate_().clone().ptr()), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), - rhoInlet_(ptf.rhoInlet_) + rhoInlet_(ptf.rhoInlet_), + angle_(ptf.angle_), + axis_(ptf.axis_) {} @@ -111,6 +117,12 @@ flowRateTiltedInletVelocityFvPatchVectorField { evaluate(Pstream::blocking); } + + angle_ = degToRad(readScalar(dict.lookup("angle"))); + + vector axis(dict.lookup("axis")); + + axis_ = axis / mag(axis); } @@ -124,7 +136,9 @@ flowRateTiltedInletVelocityFvPatchVectorField flowRate_(ptf.flowRate_().clone().ptr()), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), - rhoInlet_(ptf.rhoInlet_) + rhoInlet_(ptf.rhoInlet_), + angle_(ptf.angle_), + axis_(ptf.axis_) {} @@ -139,7 +153,9 @@ flowRateTiltedInletVelocityFvPatchVectorField flowRate_(ptf.flowRate_().clone().ptr()), volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), - rhoInlet_(ptf.rhoInlet_) + rhoInlet_(ptf.rhoInlet_), + angle_(ptf.angle_), + axis_(ptf.axis_) {} @@ -159,10 +175,17 @@ void Foam::flowRateTiltedInletVelocityFvPatchVectorField::updateCoeffs() tmp n = patch().nf(); + scalarField B(Foam::asin(n & axis_)); + + scalarField tau(Foam::cos(B)*(Foam::tan(B+angle_) - Foam::tan(B))); + + vectorField nt((n + tau * axis_)/(1.0 + tau * (axis_ & n))); + + if (volumetric_ || rhoName_ == "none") { // volumetric flow-rate or density not given - operator==(n*avgU); + operator==(nt*avgU); } else { @@ -172,7 +195,7 @@ void Foam::flowRateTiltedInletVelocityFvPatchVectorField::updateCoeffs() const fvPatchField& rhop = patch().lookupPatchField(rhoName_); - operator==(n*avgU/rhop); + operator==(nt*avgU/rhop); } else { @@ -186,7 +209,7 @@ void Foam::flowRateTiltedInletVelocityFvPatchVectorField::updateCoeffs() << " and no constant density 'rhoInlet' specified" << exit(FatalError); } - operator==(n*avgU/rhoInlet_); + operator==(nt*avgU/rhoInlet_); } } diff --git a/flowRateTiltedInletVelocityFvPatchVectorField.H b/flowRateTiltedInletVelocityFvPatchVectorField.H index 684f0a8..ae10d19 100644 --- a/flowRateTiltedInletVelocityFvPatchVectorField.H +++ b/flowRateTiltedInletVelocityFvPatchVectorField.H @@ -123,6 +123,12 @@ class flowRateTiltedInletVelocityFvPatchVectorField //- Rho initialisation value (for start; if value not supplied) scalar rhoInlet_; + //- Rho initialisation value (for start; if value not supplied) + scalar angle_; + + //- Rho initialisation value (for start; if value not supplied) + vector axis_; + public: