CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Trouble with programming parabolic velocity BC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 18, 2017, 20:50
Question Trouble with programming parabolic velocity BC
  #1
New Member
 
Outside US and Canada
Join Date: May 2016
Posts: 1
Rep Power: 0
DenisPushin is on a distinguished road
Hi, everyone.

I need to program a new BC allowing to prescribe a 3D parabolic velocity profile for circular inlet of a pipe with an arbitrary orientation in space (in foam-extend 3.1). In addition, I'd like to use average flow rate rather than velocity.

I started from parabolicVelocityFvPatchVectorField BC designed for prescribing parabolic profile only along one axis. Moreover, It is necessary to provide velocity and normal vector for this type of BC.

I changed the code for my purpose but faced the problems (described after the code). Below is a snippet of code (part of the function updateCoeffs) that works correctly for setting the velocity in the pipe oriented along coordinate axis (parabolicProfile.png).
Code:
boundBox bb(patch().patch().localPoints(), true);

vector ctr = 0.5*(bb.max() + bb.min());

const vectorField& c = patch().Cf();
vectorField n = patch().nf();

//scalar maxU = 2*(avgQ_ / gSum(patch().magSf()));

scalar patchRadius = mag(bb.max()-bb.min()) / (2 * sqrt(2.0));
scalarField coord = mag(c-ctr) / (patchRadius);

// maxU_ is read from the "0/U" dictionary.
vectorField::operator=((-1)*n*maxU_*(1.0 - sqr(coord)));
Problems
1) If I try to replace maxU_ with avgQ_ (uncomment the line and make the necessary changes in other places), I can compile the code and run calculations (using simpleFoam). But during the reconstruction of case I always get the error when reconstructing the velocity field. The error is float point exception. The question is how such code changing can lead to this error?

I would be grateful for any hint.

2) When the pipe is located with an arbitrary orientation, I always get the error immediately after run the case (listing below).
Code:
[13] —> FOAM FATAL ERROR: 
[13] 
gradientInternalCoeffs cannot be called for a genericFvPatchField (actual type parabolicInletFlowVelocity)
on patch rightInlet of field U in file "/home/denis/foam/denis-3.1/run/testParabolicBC/processor13/0/U"
You are probably trying to solve for a field with a generic boundary condition.
[13] 
[13] From function genericFvPatchField<Type>::gradientInternalCoeffs() const
[13] in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 811.
[13] 
FOAM parallel run exiting
Is there any idea what this error means?

Thank you in advance.
Attached Images
File Type: jpg parabolicProfile.jpg (43.7 KB, 19 views)
DenisPushin is offline   Reply With Quote

Reply

Tags
parabolic velocity


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Parabolic Velocity Profile Allan_Carey93 OpenFOAM Running, Solving & CFD 4 November 26, 2015 07:11
VELOCITY vs VELOCITY IN STN FRAME vs RELATIVE VELOCITY everest20 FLUENT 1 July 13, 2015 09:35
3-D parabolic velocity Inlet - Steady state - UDF Turbulent Flow mohibanwar Fluent UDF and Scheme Programming 10 May 18, 2015 11:34
parabolic inlet velocity condition a_cucen Fluent UDF and Scheme Programming 4 March 4, 2015 10:15
[swak4Foam] problem with a parabolic velocity profile Claudio87 OpenFOAM Community Contributions 5 May 29, 2014 10:30


All times are GMT -4. The time now is 19:04.