fluent_2009april21_final.pdf

Upload: anonymous-guitcvo

Post on 07-Aug-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/20/2019 FLUENT_2009April21_final.pdf

    1/47

     

    Special Topics In FLUENTSpecial Topics In FLUENT

    David H. PorterMinnesota Supercomputing Institute

    University of Minnesota

    April 21, 2!

  • 8/20/2019 FLUENT_2009April21_final.pdf

    2/47

     

    OUTLINEOUTLINE

    Parallel FLUENT "aster time to solution Do larger pro#lems

    User Defined Functions $ustomi%e & almost anyt'ing

    Hands-On ()periment * learn +ry in your on application

    Round Table Q&A Access e)perience of group Identify needs * pro#lems Suggest future special topics

  • 8/20/2019 FLUENT_2009April21_final.pdf

    3/47

     

    Running FLUENT in ParallelRunnin

    g FLUENT in Parallel

    •Motiation

    •Ne! "latfor# for FLUENT

    •Ho! to run in "arallel Domain decomposition Interactively In #ac-ground In PS /ueue

  • 8/20/2019 FLUENT_2009April21_final.pdf

    4/47

     

    Why Run in Parallel?Wh y Run in Parallel?

    $est !a% to do reall% lare 'obs atc' /ueues are designed for large parallel 0o#s nly supported ay to access significant resources

    Faster ti#e to solution Parallel speedup is good ueue availa#ility ill dramatically improve soon

    Enable larer "roble#s More memory availa#le

    Memory distri#uted across nodes +ypically 2 3 per core 4arger * faster dis-s availa#le on core systems

  • 8/20/2019 FLUENT_2009April21_final.pdf

    5/47

     

    New Platform for FLUENT:New Platform for FLUENT: BladeBlade

    $est !a% to co#"ute on $lade is in "arallel batc( )ueue 4i-e la# P$s, login nodes are s'ared 4ogin nodes are  NOT  intended for computation 5ou can su#mit large 0o#s to /ueue * disconnect Individual 0o#s can run for as long as 2 days 6e procurement ill or- t'e same ay

    Dedicated co#"ute nodes 7 3 per node 8 cores per node

    Dis* s"ace  9 + of fast scratc' space Use pro0ect space for longer term storage

  • 8/20/2019 FLUENT_2009April21_final.pdf

    6/47

     

    Ho To Run In ParallelHo To Run In ParallelParallel FLUENT based on +Do#ain Deco#"osition,

    Partition mes': for distri#uted memory systems ne MPI ran- per partition

    nteractiel% 3UI driven parallel "4U(6+ Interactive PS /ueue

    n t(e bac*round $ommand line driven "4U(6+ ;un * input scripts

    $atc( 'obs in P$. )ueue Ho to su#mit 0o#s PS #atc' scripts 4i-e running in t'e #ac-ground

  • 8/20/2019 FLUENT_2009April21_final.pdf

    7/47

     

    Par!i!ion "eshPar!i!ion "esh

    Setup pro#lem as usual.

    Module load fluent

    "luent

  • 8/20/2019 FLUENT_2009April21_final.pdf

    8/47

     

    #isplay Par!i!ions#isplay Par!i!ions

    Display = $ontours &"illed$ontours of : $ell Info &

    $ell PartionSurfaces: Symmetry

  • 8/20/2019 FLUENT_2009April21_final.pdf

    9/47

     

    In!erac!i$e Parallel FLUENTIn!erac!i$e Parallel FLUENT

    Loin !it( / for!ardinss' @ BuseridC49.msi.umn.edu

    .tart "arallel fluent

    ne MPI ran- per partition "lag is @t6 6 > 6um#er of MPI ran-s All ran-s on same node Elimit to 8 on ladeF $an start from a pre@partitioned case

    Fluent 0d -t1"ile = ;ead = $ase * DataSolve = Iterate ...

  • 8/20/2019 FLUENT_2009April21_final.pdf

    10/47

     

    FLUENT 2U re)uires / for!ardin "lag for forarding G "lag for interactive /ueue GI

    Loin !it( / for!ardin3 t(en sub#it interactie 'ob !it( / ss' @ BuseridC#lade.msi.umn.edu /su# G GI r8i.p#s

    T(en !ait for interactie "ro#"t4

    In!erac!i$e in PBS %UEUEIn!erac!i$e in PBS %UEUE

    #!/bin/bash -l

    #PBS -l walltime=01:00:00,pmem=1750mb,nodes=1:ppn=4

  • 8/20/2019 FLUENT_2009April21_final.pdf

    11/47

     

    &o''and Line Parallel FLUENT&o''and Line Parallel FLUENT

    .etu" 5ase as usual

    Partition #es( & sae 5ase6Data Includes mes' partition

     Edit a te7t in"ut file "ile: run8.in A leading J means comment

    Run !it(out 2U "lag @g means no 3UI "lag @t6 mean run 6 partitions Eran-sF

     fluent 0d -t1 - 8 run14in 9& run14out &

    ; ead ase " data iles$d elbow1%as%&'; (al)late 150 ite$ationsit 150; *$ite ase " data ileswd elbow+150%as%&'; it .2

    eit

  • 8/20/2019 FLUENT_2009April21_final.pdf

    12/47

     

    Run in PBS %ueueRun in PBS %ueue

    .etu" for co##and line "arallel run

    3enerate $aseKData Partition mes' (dit input script

    .etu" P$. run

    $ase * data in directory: BdirC (dit PS script: run.p#s /su# run.p#s

    #!/bin/bash -l#PBS -l walltime=03:00:00,pmem=1750mb,nodes=1:ppn=4#d wdi$l)ent 6d -t4 -& $)n4%in " $)n4%o)t

    6*

  • 8/20/2019 FLUENT_2009April21_final.pdf

    13/47

     

    Parallel Speedup Tes! Parallel Speedup Tes! 

    +est case:

  • 8/20/2019 FLUENT_2009April21_final.pdf

    14/47

     

    Parallel Speedup Resul!sParallel Speedup Resul!s;an rela)ation iterations for steady state from initial state.+imes for 2 * 12 iterations include startup, read, rite, * s'utdon

    Internal 1 iterations representative of long calculation limit.All +imes are in sec.

    6 2 iter 12 iter Internal 1 Speedup1 8.81 288.892 1!.821 1.

    2

  • 8/20/2019 FLUENT_2009April21_final.pdf

    15/47

     

    User #e(ined Func!ionsUser #e(ined Func!ions

    :(at is a UDF; ?'at UD"s can do Ninds of UD"s Map of $all utsJ

    Macros Define Macros Loo" Macros

  • 8/20/2019 FLUENT_2009April21_final.pdf

    16/47

     

    Wha! is a User #e(ined Func!ion?Wha! is a User #e(ined Func!ion?

    A UDF is a routine t(at is called fro# FLUENT 5ou rite t'e routine ;outine is in $ Macros provide easy * uniform access "4U(6+ varia#les UD"s are compiled or interpreted t'en lin-ed into "4U(6+ UD"s are 'oo-edJ into appropriate parts of "4U(6+

    Use UDFs to custo#i=e #an% different as"ects of FLUENT oundary conditions * source terms

    ?'at, 'en, and 'o data is read and ritten Models: fluid, martial, tur#ulence, species, & $ontrol time step Post@processing

    )i d ( U # (i d F !i)i d ( U # (i d F !i

  • 8/20/2019 FLUENT_2009April21_final.pdf

    17/47

     

    )inds o( User #e(ined Func!ions)inds o( User #e(ined Func!ions>ind of UDF deter#ines !(en it is called & !(at it can do

    Nind of UD" specified #y Define MacroJ

    Define Macro specifies 'en and 'o UD" is called

    2eneral Pur"ose UDFs ?called outside of fluid u"date@ n startup * on initiali%ation n ;ead * ?rite efore or after eac' fluid iteration n e)it n demand

    Model s"ecific UDFs ?usuall% called durin fluid iteration@ Material properties +ransport e/uations +ur#ulence models Dynamic mes' Mes' motion

    & lli P d *P B d+& lli

    P d *P B d+

  • 8/20/2019 FLUENT_2009April21_final.pdf

    18/47

     

    &alling Procedure *Pressure Based+&alling Procedure *Pressure Based+

    , l P # (i ", l P

    # (i "

  • 8/20/2019 FLUENT_2009April21_final.pdf

    19/47

     

    ,eneral Purpose #e(ine "acros,eneral Purpose #e(ine "acrosD("I6(OADUS+ Manipulate varia#les #efore iteration

    D("I6(OD(4+A+ $ontrol time step

    D("I6(O(($U+(OA+O(6D At end of fluid update

    D("I6(O(($U+(OA+O(I+ At end of "4U(6+ session

    D("I6(O(($U+(O";MO3UI User defined sc'eme routine

    D("I6(O(($U+(O6O4ADI63 ?'en a UD" li#rary is loaded

    D("I6(OI6I+ Initiali%e varia#les

    D("I6(O6OD(MA6D Async'ronously: on user input

    D("I6(O;?O"I4( ?'en $ase * Data are read or ritten

    "or details, see UD" Manual, Sec 2.1

    "odel Speci(ic #e(ine "acros"odel S

    peci(ic #e(ine "acros

  • 8/20/2019 FLUENT_2009April21_final.pdf

    20/47

     

    "odel Speci(ic #e(ine "acros"odel Speci(ic #e(ine "acros

    D("I6(O$H(MOS+(PD("I6(O$PHID("I6(ODMODI""US(O;("4($+IQI+5D("I6(ODMOSU;$(D("I6(ODMOSP($U4A;O;("4($+IQI+5D("I6(O3;A5OA6DOASO$(""D("I6(O6(+O;(A$+I6O;A+(D("I6(O6O;A+(D("I6(OP;O;A+(D("I6(OS$A+OPHAS(O"U6$

    D("I6(OS4A;OI6+(6SI+5D("I6(OSO;A+(

    D("I6(O?A44O"U6$+I6SD("I6(OP;"I4(D("I6(OSU;$(

    D("I6(ODI""USIQI+5D("I6(O+U;U4(6+OQIS$SI+5D("I6(O+U;OP;(MIOSU;$(D("I6(OH(A+O"4UD("I6(OP;A6D+4 UD"sD("I6(OP;P(;+5 UD"sD("I6(OS;O;A+(

    D("I6(OQ;O;A+(

    Many different -inds of model specific define macros

    Here are some categories

    "or details * full lists of define macros See UD" Manual, Sec. 2

  • 8/20/2019 FLUENT_2009April21_final.pdf

    21/47

     

    E-a'ple. #e(ine "acroE-a'ple. #e(ine "acro

    #inl)de )d%h

    8.9+P.9name+o$+this+$o)tine, th$ead, position<  /> oal ?a$iable dela$ations >/  /> " ontent o $o)tine >/

    @

    Rinclude udf.'J alays neededDefineO... specifies 'ere UD" can #e 'oo-ed and arguments5ou provide UD" name for reference in "4U(6+Arguments Et'read * positionF passed into UD" #y "4U(6++'read is a set of cell faces passed #y "4U(6+Position is 'ic' is set #y fluent

  • 8/20/2019 FLUENT_2009April21_final.pdf

    22/47

     

    "acros For Looping O$er "esh"acros For Looping O$er "esh

    Mes' Hierarc'y DomainEsF made up of t'reads +'reads made up of cells or faces $ells contain volume E

  • 8/20/2019 FLUENT_2009April21_final.pdf

    23/47

     

    E-a'ple. Loop O$er &ellsE-a'ple. Loop O$er &ells

    8.9+A8S2mC+$o)tine, domain<  2h$ead >t;  ell+t ;

      th$ead+loop+ t,domain<   be&in++loop ,t<

      /> Aess o$ modiC ell DE ?a$iables >/  @  @@

    In a D("I6(OADUS+J UD", t'e domain is passed inAll t'reads tJ in t'e domain domainJ are looped over in outer loopAll cells cJ in t'e t'read tJ are looped over in t'e inner loop+'is routine ill do 'at you specify to every cell in t'e domain

  • 8/20/2019 FLUENT_2009April21_final.pdf

    24/47

     

    "acros For #a!a /ccess"acros For #a!a /ccess

    Access data at 6odes: locations, num#ers $ells: volume, flo varia#les, gradients "aces: vector area, flo varia#les, flu)s $onnectivity: vectors #eteen cell centroids Special utilities: get ID, set #oundary profile Model specific: User Defined Scaler: set transport coefficients User Defined Memory:

    ?ill only revie some of t'e data access macros 'ere.

    "or full lists * details see: UD" Manual, Sec

  • 8/20/2019 FLUENT_2009April21_final.pdf

    25/47

     

    "acros For #a!a /ccess. Nodes"acros For #a!a /ccess. Nodes

    6ode Macros 6D(OEnodeF > @coordinate of node 6D(O5EnodeF > 5@coordinate of node 6D(OEnodeF > @coordinate of node "O66D(SEf,tF > num#er of nodes in a face

    "or details see: UD" Manual, Sec

  • 8/20/2019 FLUENT_2009April21_final.pdf

    26/47

     

    "acros For #a!a /ccess. &ells"acros For #a!a /ccess. &ells

    $ell attri#utes Eof cellOt c in t'read TtF $O$(6+;IDE),c,tF: returns centroid in real )6DO6DV $OQ4UM(Ec,tF > volume of cell $O66D(SEc,tF > num#er of nodes $O6"A$(SEc,tF > num#er of faces $O"A$(Ec,t,iF > glo#al face inde) ,from local face inde) i

    $ell flo varia#les: $OvarEc,tF > flo varia#le varJ?'ere: var>W;,P,U,Q,?,+,HX"or: density,pressure,velocityE5F,temperature,ent'alpy

    3radients: $OBvarCO3Ec,tF;econstruction 3radients EmonotonicF: $OBvarCO;3Ec,tF

    "or complete lists and details see: UD" Manual, Sec

  • 8/20/2019 FLUENT_2009April21_final.pdf

    27/47

     

    "acros For #a!a /ccess. Faces"acros For #a!a /ccess. Faces

    "ace attri#utes Eof faceOt f in t'read TtF "O$(6+;IDE),f,tF: returns centroid in real )6DO6DV "OA;(AEa,c,tF: returns face area vector in real a6DO6DV

    oundary face flo varia#les: "OvarEf,tF > flo varia#le varJ?'ere: var>WU,Q,?,+,HX

    "or: 5@velocity,temperature,ent'alpy

    Interior and #oundary faces "OPEf,tF > pressure "O"4UEf,tF > mass flo rate t'roug' face

    "or details see: UD" Manual, Sec

  • 8/20/2019 FLUENT_2009April21_final.pdf

    28/47

     

    User #e(ined ScalarsUser #e(ined Scalars

    6e mes' varia#les $ell varia#le: one for eac' cell "ace varia#le: one for eac' face

    Inputs for "4U(6+ procedures or use for your on purposes Set * used in UD"s $an #e 'oo-ed into "4U(6+ procedures $ustom diagnostics

  • 8/20/2019 FLUENT_2009April21_final.pdf

    29/47

     

    S!eps To &rea!e 0 Use / U#FS!eps To &rea!e 0 Use / U#F

    +e)t edit a $ source code file 'ic' defines t'e UD" Use a D("I6( macro for routine declaration Use loop macros to run over cells * faces Use data access macros to retrieve and modify "4U(6+ data

    $ompile or interpret source code * load into "4U(6+ pro0ect uild #uild li#rary t'roug' "4U(6+ 3UI 4oad li#rary into pro0ect

    Hoo- UD" to "4U(6+ model 5our UD" name ill appear in appropriate dialogs Increase num#er of UDS as needed.

  • 8/20/2019 FLUENT_2009April21_final.pdf

    30/47

     

    U#F E-a'plesU#F E-a'ples

    •T!o e7a#"les $ustomi%e Inflo oundary $onditions $reate a User Defined Scalar EUDSF for Post Processing

    Start from: 2D c'annel flo past a #lade

  • 8/20/2019 FLUENT_2009April21_final.pdf

    31/47

     

    1# &hannel Flo Pas! / Blade1# &hannel Flo Pas! / BladeSolver: 2D, unsteady, pressure #ased+ur#ulence Model -@epsilonYreali%a#leInlet #oundary: constant Q)>1mYsMes': +ri, 17,28 cells 27,2 faces !L9 nodes

  • 8/20/2019 FLUENT_2009April21_final.pdf

    32/47

     

    E-a'ple 2. "odi(y Inle! BoudnaryE-a'ple 2. "odi(y Inle! Boudnary

    Impose #ot' temporally and spatially dependent inflo velocity Q) > 1. K .TsinEtY2FTsinEpiTyY1F Units: MNS

    Qariation in inflo velocity Su#stantial: Z 1 period across vertical range: y>@1, 1V Period of 8Tpi sec

    Source &ode For Boundary U#FSource &ode For Boundar

    y U#F

  • 8/20/2019 FLUENT_2009April21_final.pdf

    33/47

     

    Source &ode For Boundary U#FSource &ode For Boundar  y U#F#inl)de )d%h8.9+P.9sin+o+Ct, th$ead, position<  $eal F8+8G; /> Position ?eto$ >/  $eal C;  ae+t ;  $eal t = (2+29H; /> ()$$ent time o sim)lation >/

      be&in++loop, th$ead< /> oops o?e$ aes in th$ead >/

        .+(298,,th$ead Iets ent$oid o ae >/  C = F1G;  .+P.9, th$ead, position< = 1%0 J  0%7>sin0%5>tsin0%61415KLM54>C

  • 8/20/2019 FLUENT_2009April21_final.pdf

    34/47

     

    &o'pile and Load U#F&o'pile and Load U#F

    Define =User Defined = "unctions = $ompiled

    Source "ile Add... sinOofOyt.cJNeep 4i#rary 6ame: li#udfJuild4oad

    Hoo3 U#F In!o Inle! BoundaryHoo3 U#F In!o Inle! Boundar

    y

  • 8/20/2019 FLUENT_2009April21_final.pdf

    35/47

     

    Hoo3 U#F In!o Inle! BoundaryHoo3 U#F In!o Inle! Boundar  y

    Define = oundary $onditionsSelect Inflo EQelocity InletFSet & Qelocity Inlet EInfloF

    Momentum +a#Qelocity Magnitude EmYsF

    Select: udf sinOofOytN 

  • 8/20/2019 FLUENT_2009April21_final.pdf

    36/47

     

    Run For 4 SecRun For 4 Sec

    A#out

  • 8/20/2019 FLUENT_2009April21_final.pdf

    37/47

     

    Run For /no!her 255 Sec6Run For /no!her 255 Sec6

  • 8/20/2019 FLUENT_2009April21_final.pdf

    38/47

     

    E-a'ple 1. &rea!e Ne #iagnos!icE-a'ple 1. &rea!e Ne #iagnos!ic

    3oal: visuali%e @component of vorticityS'os eddies and slip surfaces

    Signed /uantity: direction of rotation

    "ormula: dQYd) @ dUYdy

    & Source &ode. ON #E"/N#& Source &ode. ON

    #E"/N#

  • 8/20/2019 FLUENT_2009April21_final.pdf

    39/47

     

    & Source &ode. ON7#E"/N#& Source &ode. ON 7#E"/N#

    #inl)de )d%hen)m

      N2+O, /> 9nde o 8S: N2+O=0 >/  +98+8S /> # o 8S ?a$iables: +98+8S=1 >/@;

    8.9++8HA8?o$t'+on+demand<

      8omaind; /

    > domain is not passed in >/  2h$ead t;  ell+t ;  ae+t ; /> HaQe s)$e the$e a$e eno)&h )se$-deined sala$s% >/

      i n+)ds +98+8S<

      9nte$nal+$$o$not eno)&h 8Ss alloated/

    An 6OD(MA6D UD" can #e called at any time from 3UI

    & Source &ode. & #8#9& Source &ode. &

    #8#9

  • 8/20/2019 FLUENT_2009April21_final.pdf

    40/47

     

    & Source &ode. &7#8#9& Source &ode. & 7#8#9

      /> .ill ells with 8S: O-omponent o ?o$tiitC% >/  th$ead+loop+ t,d<

        i != 2RA8+S2AIt,SN+8S+9N2+O

  • 8/20/2019 FLUENT_2009April21_final.pdf

    41/47

     

    & Source &ode.& Sou ce &ode.

    /> .ill aes with 8S: O-omponent o ?o$tiitC% >/  th$ead+loop+ t,d<    i != 2RA8+S2AIt,SN+8S+9N2+O

  • 8/20/2019 FLUENT_2009April21_final.pdf

    42/47

     

    pp

    Define = User@Defined ="unctions = $ompiled ...Source "iles: add #ot' sinOofOyt.c * vort%.c

    uild4oad

    I N : ( U#SI N : ( U#S

  • 8/20/2019 FLUENT_2009April21_final.pdf

    43/47

     

    Increase Nu':er o( U#SIncrease Nu':er o( U#S

    Define = User@Defined = Scalars &Set: 6um#er of User@Define Scalers > 1N 

    8ie Be(ore Running U#F8ie Be(ore Runnin

    g U#F

  • 8/20/2019 FLUENT_2009April21_final.pdf

    44/47

     

    gg

    $an Select UDS in $ontours

    Hoever, UDS 'as not #een filled.

    6eed to run 6OD(MA6D UD".

    8ie /(!er Running U#F8ie /(!er Runnin

    g U#F

  • 8/20/2019 FLUENT_2009April21_final.pdf

    45/47

     

    gg

    Iterate once to fill arrays.

    Define = User@Defined= ()ecute on Demand &

    QortO% s'os direction of rotation

    Set range to @.L, .LV?'ite s'os clipped valuesStrong vorticity #e'ind #lade edges

    Hands OnHands On

  • 8/20/2019 FLUENT_2009April21_final.pdf

    46/47

     

    Hands OnHands On

    Tutorial loins on .D

  • 8/20/2019 FLUENT_2009April21_final.pdf

    47/47

     

    On line Docu#entation  'ttp:YYr.msi.umn.eduYfluentYinde).'tm  Parallel "luent: User[s 3uide Sec