Sei sulla pagina 1di 9

//

FLUENT6.3UDFManual8.2.1BoundaryConditions

8.2.1BoundaryConditions
ThissectioncontainstwoapplicationsofboundaryconditionUDFs.

ParabolicVelocityInletProfileinaTurbineVane
ConsidertheturbinevaneillustratedinFigure8.2.1.Anunstructuredgridisusedtomodeltheflow
fieldsurroundingthevane.Thedomainextendsfromaperiodicboundaryonthebottomtoan
identicaloneonthetop,avelocityinletontheleft,andapressureoutletontheright.

Figure8.2.1:TheGridfortheTurbineVaneExample
Aflowfieldinwhichaconstant velocityisappliedattheinletwillbecomparedwithonewherea
parabolic velocityprofileisapplied.Whiletheapplicationofaprofileusingapiecewiselinear
profileisavailablewiththeboundaryprofilesoption,thespecificationofapolynomialcanonlybe
accomplishedbyauserdefinedfunction.
Theresultsofaconstantvelocityappliedfield(of20m/sec)attheinletareshowninFigures8.2.2
and8.2.3.Theinitialconstantvelocityfieldisdistortedastheflowmovesaroundtheturbinevane.

https://www.sharcnet.ca/Software/Fluent6/html/udf/node231.htm

1/9

//

FLUENT6.3UDFManual8.2.1BoundaryConditions

Figure8.2.2:VelocityMagnitudeContoursforaConstantInlet
Velocity

Figure8.2.3:VelocityVectorsforaConstantInlet Velocity
Theinlet velocitywillnowbedescribedbythefollowingprofile:

wherethevariable is0.0atthecenteroftheinlet,andextendstovaluesof

0.0745matthetop

andbottom.Thusthe velocitywillbe20m/secatthecenteroftheinlet,and0attheedges.
AUDFisusedtointroducethisparabolicprofileattheinlet.TheCsourcecode(vprofile.c)is
https://www.sharcnet.ca/Software/Fluent6/html/udf/node231.htm

2/9

//

FLUENT6.3UDFManual8.2.1BoundaryConditions

shownbelow.ThefunctionmakesuseofFluentsuppliedsolverfunctionsthataredescribedin
Section3.2.4.
TheUDF,namedinlet_x_velocity,isdefinedusingDEFINE_PROFILEandhastwoarguments:thread
andposition.Threadisapointertotheface'sthread,andpositionisanintegerthatisanumerical
labelforthevariablebeingsetwithineachloop.
Thefunctionbeginsbydeclaringvariablefasaface_tdatatype.Aonedimensionalarrayxand
variableyaredeclaredasrealdatatypes.Aloopingmacroisthenusedtoloopovereachfaceinthe
zonetocreateaprofile,oranarrayofdata.Withineachloop,F_CENTROIDoutputsthevalueoftheface
centroid(arrayx)forthefacewithindexfthatisonthethreadpointedtobythread.The
coordinatestoredinx[1]isassignedtovariabley,andisthenusedtocalculatethe velocity.This
valueisthenassignedtoF_PROFILE,whichusestheintegerposition(passedtoitbythesolverbased
onyourselectionoftheUDFastheboundaryconditionfor velocityintheVelocityInletpanel)to
setthe velocityfacevalueinmemory.
/***********************************************************************
vprofile.c
UDFforspecifyingsteadystatevelocityprofileboundarycondition
************************************************************************/
#include"udf.h"
DEFINE_PROFILE(inlet_x_velocity,thread,position)
{
realx[ND_ND];

/*thiswillholdthepositionvector*/
realy;
face_tf;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
y=x[1];
F_PROFILE(f,thread,position)=20.y*y/(.0745*.0745)*20.;
}
end_f_loop(f,thread)
}

TomakeuseofthisUDFinFLUENT,youwillfirstneedtointerpret(orcompile)thefunction,and
thenhookittoFLUENTusingthegraphicaluserinterface.Followtheprocedureforinterpreting
sourcefilesusingtheInterpretedUDFspanel(Section4.2),orcompilingsourcefilesusingthe
CompiledUDFspanel(Section5.2).
TohooktheUDFtoFLUENTasthevelocityboundaryconditionforthezoneofchoice,openthe
VelocityInletpanelandclickontheMomentumtab(Figure8.2.4).
Define

BoundaryConditions...

https://www.sharcnet.ca/Software/Fluent6/html/udf/node231.htm

3/9

//

FLUENT6.3UDFManual8.2.1BoundaryConditions

Figure8.2.4:TheVelocityInletPanel
IntheXVelocitydropdownlist,selectudfinlet_x_velocity,thenamethatwasgiventothefunction
above(withudfpreceedingit).Onceselected,thedefaultvaluewillbecomegrayedoutintheX
Velocityfield.ClickOKtoacceptthenewboundaryconditionandclosethepanel.Theuserprofile
willbeusedinthesubsequentsolutioncalculation.
Afterthesolutionisruntoconvergence,arevisedvelocityfieldisobtainedasshowninFigures8.2.5
and8.2.6.Thevelocityfieldshowsamaximumatthecenteroftheinlet,whichdropstozeroatthe
edges.

Figure8.2.5:VelocityMagnitudeContoursforaParabolicInlet
Velocity

https://www.sharcnet.ca/Software/Fluent6/html/udf/node231.htm

4/9

//

FLUENT6.3UDFManual8.2.1BoundaryConditions

Figure8.2.6:VelocityVectorsforaParabolicInlet Velocity

TransientVelocityInletProfileforFlowinaTube
Inthisexample,atemporallyperiodicvelocityboundaryconditionwillbeappliedtotheinletofa
tubeusingaUDF.Thevelocityhastheform

Thetubeis1mlongwitharadiusof0.2m.Itisassumedtobefilledwithairwithadensityof1kg/m
andaviscosityof2
kg/ms.Thevelocityoftheairfluctuatesaboutanequilibriumvalue,
,of20m/s,withanamplitudeof5m/sandatafrequencyof10rad/s.
ThesourcefilelistingfortheUDFthatdescribesthetransientinletprofileisshownbelow.The
function,namedunsteady_velocity,isdefinedusingtheDEFINE_PROFILEmacro.Theutility
CURRENT_TIMEisusedtolookuptherealflowtime,whichisassignedtothevariablet.(SeeSection
3.5fordetailsonCURRENT_TIME).
/**********************************************************************
unsteady.c
UDFforspecifyingatransientvelocityprofileboundarycondition
***********************************************************************/
#include"udf.h"
DEFINE_PROFILE(unsteady_velocity,thread,position)
{
face_tf;
realt=CURRENT_TIME;
https://www.sharcnet.ca/Software/Fluent6/html/udf/node231.htm

5/9

//

FLUENT6.3UDFManual8.2.1BoundaryConditions

begin_f_loop(f,thread)
{
F_PROFILE(f,thread,position)=20.+5.0*sin(10.*t);
}
end_f_loop(f,thread)
}

BeforeyoucaninterpretorcompiletheUDF,youmustspecifyanunsteadyflowcalculationinthe
Solverpanel.Then,followtheprocedureforinterpretingsourcefilesusingtheInterpretedUDFs
panel(Section4.2),orcompilingsourcefilesusingtheCompiledUDFspanel(Section5.2).
ThesinusoidalvelocityboundaryconditiondefinedbytheUDFcannowbehookedtotheinletzone
fortheXVelocity.IntheVelocityInletpanel,simplyselectthenameoftheUDFgiveninthis
examplewiththewordudfpreceedingit(udfunsteady_velocity)fromthedropdownlisttothe
rightoftheXVelocityfield.Onceselected,thedefaultvaluewillbecomegrayedoutintheX
Velocityfield.ClickOKtoacceptthenewboundaryconditionandclosethepanel.Theuserprofile
willbeusedinthesubsequentsolutioncalculation.

ThetimesteppingparametersaresetintheIteratepanel.
Solve

Iterate...

https://www.sharcnet.ca/Software/Fluent6/html/udf/node231.htm

6/9

//

FLUENT6.3UDFManual8.2.1BoundaryConditions

Inthisexample,aTimeStepSizeof0.0314sisusedsothat20timestepswillcompleteafullperiod
ofoscillationintheinletvelocity.TheUDFProfileUpdateIntervalissetto1sothatthevelocity
willbeupdatedeveryiteration.After60timesteps(or3periods)arecomplete,youcanexaminethe
velocitymagnitudeacrossthepressureoutletforitsresponsetotheoscillatinginletcondition.
Tocollectthisinformationduringthecalculation,opentheSurfaceMonitorspanelbeforebeginning
toiterate.
Solve

Monitors

Surface...

IncreasetheSurfaceMonitorsindexto1.Thiswillenableyoutodefinetheparametersofmonitor1
(whichyoucouldrename,ifdesired,inthetextentryboxunderName).SelectPlotsothatthe
https://www.sharcnet.ca/Software/Fluent6/html/udf/node231.htm

7/9

//

FLUENT6.3UDFManual8.2.1BoundaryConditions

selectedquantitywillbeplottedasthecalculationproceeds.SelectPrinttoseethechangingvaluesof
theselectedquantityintheconsolewindow.SelectWritesothattheinformationwillbewrittentoa
file,whichwillbegiventhenamemonitor1.out.(Ifyouchangethenameofthemonitor,thatname
willbeusedastheprefixfortheoutputfile.)
UnderEvery,youcanchooseIteration,TimeStep,orFlowTime.Tomonitortheresultofeach
timestep,youshouldchoosetheTimeStepoption.ByclickingonDefine...youcanspecifythe
quantitytobemonitoredintheDefineSurfaceMonitorpanel.

Inthisexample,Velocity...andVelocityMagnitudearechoseninthedropdownlistsunderReport
of.Thelocationofthereportispressureoutlet5,whichisselectedintheSurfaceslist.Asimple
AreaWeightedAverageischosenintheReportTypedropdownlist,withtheFlowTimechosen
intheXAxisdropdownlist.
Oncethefirsttimestephasbeencompleted,themonitorshouldappearinthechosenplotwindow.
Alternatively,youcanreadthefilebyopeningtheFileXYPlotpanel.
Plot

File...

https://www.sharcnet.ca/Software/Fluent6/html/udf/node231.htm

8/9

//

FLUENT6.3UDFManual8.2.1BoundaryConditions

YoucanreadtheoutputfilebytypingitsnameinthetextentryboxunderFilesandclickingon
Add....ByselectingthisfileandclickingonPlot,youcanobtaintheplotshowninFigure8.2.7.

Figure8.2.7:AverageVelocityMagnitudeatthePressureOutlet
Thefigurenicelyillustratesthatthevelocityoscillatesaroundtheequilibriumvalue,20m/s,withan
amplitudeof5m/s,asexpected.
Previous:8.2DetailedUDFExamples
Up:8.2DetailedUDFExamples
Next:8.2.2SourceTerms
FluentInc.20060913

https://www.sharcnet.ca/Software/Fluent6/html/udf/node231.htm

9/9

Potrebbero piacerti anche