Вы находитесь на странице: 1из 6

MeasuringthePhysicalAccuracyofaRealtimeFluidSimulationbyCalculatingtheKinetic Energy

ChristopherBell

12thgrade,GlenelgCountrySchool,EllicottCity,MD

Introduction

SmoothedParticleHydrodynamics(SPH)referstoacomputermodelusedtosimulate fluids.SPHwasfirstconceivedanddevelopedbyGingoldandMonaghan(1977)aswell asLucy(1977)tosimulatetheformationofstarsandhassinceplayedanotableroleinthe fieldoffluidsimulation.

Problem

AnSPHsimulationconsistsoffourprimarystages:asearchforandstorageofthe neighboringparticleswithinacertainradiusforeveryparticle,theinterpolationand summationofforcesanddensityamongtheneighboringparticles,anupdateofthe velocitiesandpositionsofeachparticle,andthereconstructionandupdateofthespatial indexingcontainerusedtolocatealloftheneighboringparticles.SPHsimulationswhich utilizealargenumberofparticlesthereforeproducemoreaccuraterepresentationsof fluids,aseachparticlemayrepresentasmallerportion dV ofthesimulatedfluidvolume. However,simulationswithlargeamountsofparticlesaredifficulttoproduceinrealtime andareCPUintensivetorun.ThisoftenlimitsSPHsimulationswithlargeamountsof particlestooffscreenrenderingapplicationssuchasmovieeffects.

Purpose

ThepurposeofthisexperimentistodetermineifalimitintheaccuracyofanSPHfluid simulationexistsasthenumberofparticlesusedinasimulationincreases.Ifsuchalimit exists,futureSPHapplicationsmayavoidusinganunnecessarilylargenumberofparticles toaccuratelymodelfluidbehaviorandthusincreaseprogramefficiency.Thisisespecially relevantinthegraphicsindustry,ascompaniesstrivetoproducerealtimefluidsthatare

physicallyrealisticforusageininteractivemediasuchasvideogames. Asthenumberofparticlesusedtosimulateavolumeoffluidincreases,thegraphofthe kineticenergyofthefluidversustimewillapproachanintrinsic,unchangingshape.

ConstantsUsedinSimulation

Property Timestep SimulationTime Temperature RestDensity DynamicViscosity SurfaceTension GasStiffness #KernelParticles GravitationalAcceleration SEEThreshold

Symbol t t T o k x g SEEthresh

Value .002s 2s 30C


kg 1000 m 3

7.98 104 P a s 7.12 102 2.0J 20


m [0, 0, 9.8] s 2 N m

.05

SimulationProcedure

Preliminaryresearchshowedthatinsufficientempiricaldataregardingthekineticenergyof

waterexisted.Therefore,Inordertoproduceanexpectedgraphofthekineticenergyof anyfluidoveraperiodoftime,theassumptionthat 613 particlesmodeledreallife accuratelyenoughforthemajorityofapplicationswasmade.Thevolumeofthesimulated fluidwaschosentobe .01m3 tominimizepotentialerrorcausedbysimulatinglarge volumesofwater.Eachsimulationwasruninsidea 1m3 containerwitharestitutionof0.55 simulationswith i3 particleswererun,where i = 5 forthefirstsimulationupuntil i = 61 . Themassofeachparticlevariedwiththetotalnumberofparticles N ,andwasthus
V calculatedusing mi = o N aseachparticlerepresentedasmallportionofthefluidvolume.

Thelastvariable h whichrepresentedthesmoothingradiususedintheneighborsearch wasproportionaltothevolume dV eachparticleoccupiedin3Dspace,andwascalculated using hradius =

3V x .ThesimulationsweredevelopedinC++usingacombinationofthe 4n

structuresproposedbyAuerandKelager.Thekineticenergyofthesimulatedfluidduring || ||2 anytime t wascalculatedusing k = 1 2 m||vi|| ,overaperiodof2seconds.Thecollected i=1 datawassavedtoatextfileaftereachsimulation.


N

GraphingProcedure

Asthecalculationofthekineticenergywasaresultofthesummationofthemagnitudesof eachfluidparticlesvelocityvector,simulationswithlargernumbersofparticlestendedto producealargervariationinkineticenergy.Inordertocomparelargersimulationsto smallerones,eachsimulationwasscaledsothatthepeakkineticenergyofeach simulationmatchedthepeakexpected K E ofthereferencesimulationof 613 particles.


.Max Thiswasaccomplishedbydeterminingtheratio KEExp foreachsimulationandby Obs.Max

KE

multiplyingeachobserved K E valuebyit.Thevariabilityineachsimulationsscaled K E valuesfromtheexpected K E valueswasdeterminedbycalculatingthestandarderrorof estimate(SEE)where est

(observedexpected)2 .Thegraphofeachsimulations K E overtime N

wasgeneratedandplottedonthesamepapertoimprovevisualization.Anexponential regressionlinewascalculatedinExcelforthescatterplotofthe est todetermineanexact xvaluewherethenumberofparticlesusedcausedan est of5%ofthedifferencebetween themaximumandminimum est valuesplusthe est ofthesimulationwith 603 particles (explainedlater).

Analysis

Asillustratedbythegraphofscaled K E valuesovertime,eachsimulationappearedto approachanintrinsicamountofsimulationaccuracyas N increased.Whenan thresh value of5%ofthevalue max.est. min.est.+1 addedto min.est.+1 waschosenandsubstitutedfory intheregressionequation,thecorrespondingnumberofparticlesxwasfoundtobe 219323particles.The min.est.+1 valuecorrespondingtothesecondtolastcalculated min.est. valuewasusedinthecalculationofthethresholdsincetheregressionlinecannot modeldatawithayvalueof0,ortheactual min.est.+1 .Thismeantthatiftheassumptionthat 613 particlesaccuratelymodeledwaterinreallifewastrue,thesimulationwith 219323 numberofparticleswouldhaveminimizedits est to5%ofthe SEE rangeofalltested simulationsplus min.est.+1 onlyifassumedthatthe 53 simulationrepresentedthesimulation withthelargestamountoferrorinallsimulationswith N rangingfrom 1 61 usingthe sameparameters.

ThoughtsOnFutureWork

Toproduceamoreaccurateinterpretationofthexvaluewherethenumberofparticles minimizesthedifferencein SEEs ,alargerrangeof N particlesshouldbeused.Inafuture experiment, N mayevenbelimitedtoanintendedgoalinaccuracyforanSPHsimulation. Forinstance,ifavideogamecompanywishestomodelavolumeoffluidwiththeaccuracy

of1millionparticleswhileminimizingthe SEE to5%ofthe SEErange plus min.est.+1 ,itshould chooseamaximum N valueof1millionandaminimum N valuecorrespondingtothe lowestamountofparticlesitcansimulate.Careshouldbetakenwhenlowering N ,asSPH simulationsrelyonlargenumbersofparticlestosimulateafluidasintendedandalow N valuemaycauseunexpectedsimulationresults.

Credits

1]SPHACOMPARISONOFNEIGHBORSEARCHMETHODSBASEDONCONSTANTNUMBEROF NEIGHBORSANDCONSTANTCUTOFFRADIUS(PAWEWRBLEWSKI,MARIUSZKOPEAND KRZYSZTOFBORYCZKO) [2]BasicsofSmoothedParticleHydrodynamics(StefanAuer) [3]DansMorrissNotesonStableFluids(JosStam,SIGGRAPH1999) [4]LagrangianFluidDynamicsUsingSmoothedParticleHydrodynamics(MickyKelager2006) [5]Fluidsv.2(http://www.rchoetzlein.com/eng/graphics/fluids.htm)

Вам также может понравиться