CFD post-processing in Unity3D

115 downloads 216 Views 1MB Size Report
our spatial da the plane. .... while exploring we plan exten change and fu uable t user enta- lding. Same ferent ee the using .... Interactive visualisation of heat loss and gain for early-stage energy appraisal of the built environment, Procs 30th.
CFD post-processing in Unity3D Matthias Berger1,2 and Verina Cristie2 1

2

ETH Zürich, Zurich, Switzerland. Future Cities Lab, SEC, Singapore. {mberger, verina}@arch.ethz.ch

Abstract In architecture and urban design the urban climate on a meso/micro scale is a strong design criterion for outdoor thermal comfort and building’s energy performance. Evaluating the effect of buildings on the local climate and vice versa can be done by computational fluid dynamics (CFD) methods. The results from CFD are typically visualized through post-processing software closely related to the product family of pre-processing and simulation. The built-in functions are made for engineers and lack user-friendliness for real-time exploration of results. To bridge the gap between architect and engineer we propose visualizations based on game engine technology. This paper demonstrates the implementation of CFD to Unity3D conversion and weather data visualization. Keywords: CFD post-processing, Unity3D, urban climate, urban designs, visualization

1 Introduction Urban planning is nowadays an interdisciplinary endeavor, as shown by ETH Zürich’s Future Cities Laboratory*, the Centre for Liveable Cities in Singapore†, or the British Future Cities Catapult‡. Visualizations and models have been the channel of choice for communication in architecture. With the interdisciplinary input from citizens, engineers, politicians and other experts, relying on a visually oriented language as the common denominator is becoming crucial for the effectiveness of the interdisciplinary approach (Grêt-Regamey et al., 2013; Pettit et al., 2012). One field of input to urban planning is coming from joint efforts in computational science, engineering and urban climate studies: The advancement of computational power in combination with reduced operating costs in the last two decades enabled computational fluid dynamics (CFD) methods to enter urban climate studies on meso and micro scale (Ashie and Kono, 2011; Mochida et al., 1997). There is still an upper limit of available resources for meso scale simulations, which often prefers isothermal Lattice Boltzmann methods focusing on wind flow over more complex turbulence models due to significant less computational time (Miao and Shen, 2014). *

www.futurecities.ethz.ch www.clc.gov.sg ‡ futurecities.catapult.org.uk †

Several researchers already pointed out the difference in requirements of engineering visualizations, depending on if they are addressing engineers only or interdisciplinary (even non-expert) stakeholders (Stone et al., 2014). Suggested was a user-centric focus by implementing game-like environments (Greenwood et al., 2009), or directly employing game engines like Unity3D (Indraprastha and Shinozaki, 2008, 2009; Stojanovic et al., 2014). The object of visualization includes multi-dimensional data, and as Donalek et al. highlight, it is not about raw (or big) data, “it is about discovery and understanding of meaningful patterns hidden in the data” (2014). A different approach on interactive visualizations can be described as computer aided drafting (Pauwels, 2014), when interoperability is the challenge. Tools for stakeholders can furthermore help researchers to study user behavior (Prendinger et al., 2013), or help understand complex scientific aspects (Berger, 2012; Grêt-Regamey et al., 2013). Our goal was to provide a visualization tool called CFDtoUnity3D based on CFD simulation results from professional engineering software, instead of providing visualization tools for architects based on visual correlation of epiphenomena, like in the ‘Specialist Modelling Group’ of Foster + Partners and the space syntax framework by Hillier (Hillier and Hanson, 1984). The CFDtoUnity3D tool shall enable a rapid analysis cycle as in (Birch et al., 2013), since a true design cycle including CFD would be out of sync to a real-time visualization (due to extensive computational needs of CFD). The post-processing commonly done in CFD can be as complex as the actually numerical simulation, especially for visualizing the streamlines of wind flow (McLoughlin et al., 2010). In their excellent review paper McLoughlin et al. emphasize the problems resulting from computational time and irregular grids on the data side as well as visual clutter and occlusion when visualizing in 3D.

2 Methodology 2.1 Visualization workflow Given are 3D building models and its corresponding CFD simulation results. Our aim is now to post-process the results into visuals that any user can interact with. As Unity3D has the capability of importing 3D models, our building geometry is done with 3dsMax or Rhino and imported to Unity3D directly using the .obj or .fbx format. On the other hand, ANSYS Fluent is commonly used engineering software for CFD simulations. Its results then were exported to text format (.txt or .csv) that can be read by Unity3D. For temperature, humidity, and pressure data, however, we preprocessed it into 3D spatial data structures before handling it to the engine such that it will be easier to process during interactive exploration. Unity3D finally will do the rendering to be shown on display(s) and the user will be able to interact and navigate through the environment by using a controller. Figure 1 provides a flowchart showing the implementation of our tool.

2.2 Pre-processing and rendering Pre-processing ANSYS Fluent produces mesh and nodes in the simulation space, of which we need to extract information of temperature etc. at any point in the 3D space. The distance between the nodes, however, is irregular. There will be more nodes nearer the building geometry compared to the number of nodes in the empty places where there is no building geometry (sky area, corners of the simulation space). In our study case we use existing CFD simulations (Papadopoulou et al., 2015; Vernay et al., 2015) and 3D-models generated by Lidar and aerial photogrammetry (Gruen, 2013) of the CREATE Tower and University Town campus in Singapore (1°18'14.5"N 103°46'25.1"E). The simulation space from CFD extends to 2.0×1.2×0.3 km with approximately 14 million nodes. We explicitly decided to not use surface textures of buildings and terrain unlike others (Piga et al., 2013; Wang et al., 2010), to preserve a clear view on the simulation results.

Figure 1: Floowchart of the CFD C data visuallization. On thee input side in red there is the sscenery and in green thee numerical resuults of the CFD simulation. Bluue represents thhe processing arround the Unity3D game enginne and oraange is the comm munication betw ween visualizatiion and user.

Pre-processinng is needed to t divide the nnodes into spaatial data strucctures such that accessing innformaation of tempeerature, pressuure, and humiddity at any paarticular positiion in the spacce becomes eaasier. Thhe most straighhtforward metthod is to dividde the space innto a regular ggrid (in k×l×m m). The grid resolutioon is decided such that the size of each cell is (spacee length/k × sppace width/l × space heighht/m). Given a specificc position in w which we wantt to know whaat the temperatture, pressure,, or humidity vvalue is, we could just divide it by the grid resollution to find its index in eeach X, Y, and Z-axis. Thee grid ressolution thereffore corresponnds to the leveel of detail. If the grid resoluution is too cooarse, there wiill be lacck of details – each cell encompasses a tooo large space. Conversely, if the grid ressolution is too fine, wee will have a loot of details yeet it will consuume much com mputer memory – the progrram becomes sslow. Coonverting meshh into grid, hoowever, will leeave some of tthe cells emptyy as there is ann unequal disttributioon of nodes in space. For sim mplification, our o current appproach will reeturn values bby linear averaaging in 3D the next data points if a grid point is eempty (containns no values fr from the input)). One way to solve data annd speed relatted problems is using cliennt-server strucctures (Jung et e al., 2012) and SQL databases (Zhhao et al., 20113). Our grid iis saved in thee three-dimennsional array sstructurre of C#. We decided to inntroduce a seccond data struucture – octreee§. Octree datta structures aallow subbdivision of sspace to into eeight regular cchildren spacees. This meanss that we are able to use biigger octtrees for area where there are a not many nodes, and use smaller octtrees (subdivided octree) onn the areea near the buuildings. This will allow moore level of deetails near thee building; if there t is any em mpty node, the valuess could be inteerpolated baseed on the otheer children occtrees on the ssame space. Inn our im mplementation,, the .xml form mat is used too store the occtree after pree-processing ddue to naturall tree §

en.wikipedia.oorg/wiki/Octree

strructure the .xm ml format has, making the fille easily readaable. The user has to define the smallest ooctree sizze, which is thhe opposite of the normal prrocedure. Eachh level we go up will increaase the cell sizze by facctor two (or ceell volume byy factor eight). We have to find the maxiimum node size such that it can enccompass the w whole simulatiion space. If needed, em mpty space is aadded to the outer o dimensioons of the simuulated space fr from CFD, in order o to return integerr spatial valuess. Next, we caan start to consstruct the octreee using the ppre-processed iinput datta. Each of thhe converted ooctree cells coontains inform mation of centter, (octree-) llevel, temperaature, preessure, and huumidity. Reendering & Ligghtmapping Like other gaame engines, Unity3D is alsso able to suppport lighting and a rendering systems. Uniity3D proovides graphiccs classes and renderer classses with its ow wn line and meesh classes forr visualizationn. We usee the GL-classs that providdes a low-leveel graphics libbrary capablee to issue com mmands similar to OppenGL. Given the raw text ddata then we cconstruct trianngles and plannes for visualization. For annimatioon, Unity3D pprovides the U Update() functtion where eaach point will be updated aafter certain frame fr ratte. Since the bbuilding is stattic, lighting is precomputedd and saved intto Unity’s Ligghtmap such itt will not consume com mputer resourcce during runttime and a fram me rate supporting interactivvity is achievaable.

2.3 GUI annd interacttion Naavigation To enable innteractive explloration, we aallow the user to have two nnavigation moodes: Walkthrough (seee Fig. 5 right)) and Helicopter (see Fig. 5 left) mode. In Walkthrouggh mode, we hhave four degree of freeedom for expploration: righht-left movemeent, forward-bbackward movvement, turninng left-right (yyaw), andd tilting upwaard-downwardd (pitch). The Helicopter m mode allows onne more degreee of freedom m, upwaard-downwardd movement. R Running and juumping is alsoo allowed in W Walkthrough mode, m as in gam mes. Maap Functionallity We also provvide map funcctionality in w which the userr can have an overview of tthe whole buillding lanndscape (as inn Fig. 2). Userr’s position is marked by a rred arrow on the map. A sm mall map is shhown onn the top right of the screen tto give user aw wareness of thhe immediate surroundings. The zoomingg level of surroundinng map can bee adjusted froom the Settinggs panel. To hhave an overaall view, userss can mize the map. Top down viiew of the whole area can bbe shown on tthe full screenn (see chooose to maxim Figg. 2 right). Onn this screen, the user is abble to perform m two operations: teleport (11) – such that user cann immediatelyy access place that he/she w wants to focus out of the enttire landscape,, and measurement (2)) – such that thhe user can coorrelate what tthey see with actual a measureement (in metters). In additional, wee also provide cursor positioons at the centter of screen ssuch that user is able to meaasure actual height of building in m meters. This is done by usingg the ray castiing from centeer of camera tto center of screen, to know where tthe ray hits thee building, andd so the heightt could be calcculated.

Figure 2: CFD DtoUnity3D GU UI with Settingss (left). Map funnctionality in maaximized zoom m mode (right).

Setttings a allowed too select certainn options or vvisualization modes m that he/sshe wants to see s in The user is also thee Settings (seee Fig 2 left in tthe center): -

-

Scale Panell to give the acctual data valuue correspondiing to the coloor shown in vissualization. Positional D Data Label too give inform mation of windd speed, tempperature, humiidity, and presssure value of thee current positiion of user. Visualizatioon Option to cchoose what data visuals tto be shown (wind ( streamllines/ temperaature/ humidity/ ppressure). Onlyy one data typpe can be seenn at one time. Wind animattion can be pllayed concurrentlyy with other vvisualization ooptions. The deensity level off static stream mlines visualization is also adjusstable. Navigation and Control Panel to provvide user withh navigational keys and conntrols informaation. with the keys, tthey can disabble this panel. Once users are familiar w Data Cullinng Mask to shoow data visuallization on the top-down vieew map panel. Global Movvement activates same moveement for all aavailable screeens while usingg multiple screeens. Global Settiings activates same settings for all availabble screens.

3 Results Wiind Streamlinees Tunnel Both wind sttreamlines tunnnel and windd animation arre based on wind w streamlinnes data from CFD (sttreamline ID, P Position, Timee, and Speed aas in Fig. 1). F For the static sttreamline (seee Fig. 3 left) geeneration, we do nott use the time information. A procedural m mesh generation method is being used to genc a circle with giiven position as the center. The eraate 3D tubes ((a tunnel-like mesh). We constructed raddius used shouuld not be tooo small avoidinng streamliness to look like fine hair liness, neither it shhould be too big that liines will start overlapping aand occlude eaach other. Oncce the circles were w generatedd, we theen constructedd triangles on tthe outer pointt of circles to create the tubee. Wiind Streamlinee Animation For wind strreamline anim mation (see Figg. 3 right), thee wind’s param meter needs too be calculatedd dynam mically on evvery time step yet it needs too stay truthfull based on thee given discrette data. Takingg accouunt of the currve nature of w wind, we interrpolated pointss in between data d points to get more inteermediaate wind posittions, so that animation cann run smoothlly. Catmull-R Rom Splines arre used to proovide cubbic spline withh smooth tanggent (Catmull and a Rom, 19774).

Figure 3: Winnd streamlines ttunnel (left). Wiind streamline aanimation (rightt).

Users are alsso allowed to set the numbber of waves to be visualizzed. Setting a higher number of waaves allows beetter understannding of the wiind movementt in the overalll simulation aarea. The windd trail

is generated usinng the LineReenderer class of o Unity3D. T Textures with a transparent shader are useed to givve the effect of moving windd. Wiind Wavefrontt Animation Wind wavefr front animationn (see Fig. 4) used the samee points as geenerated by wiind streamlinee animaation. Howeveer, instead of drawing d trails we are drawiing a meshed plane. Initial points of the w wind strreamlines are ccoming from a wind outlet aat the left side of the simulaation area and will travel thrrough thee area to the riight. While thhe streamlines come from thhe same initiall plane, the giiven wind ID from AN NSYS does nott come in reguular sequencess. Thus, we neeed to trianguulate the initiall points. Delaaunay triaangulation** iss applied to fi find the initiall arrangement of the IDs thhat makes up the triangles. The subbsequence aniimation steps will then folloow the same trriangle sequennce. The colorr of the pointss will chaange accordinng to the speedd information extracted e from m ANSYS data..

Figure 4: Winnd wavefront annimation with movement m at diffferent time stepps (left to right)), indicating position of tthe front and wind speed (coloored).

Prressure & Hum midity Plane To overcomee depth percepption and visibbility & occluusion issues, w we allow optioonal a dynamicc explooration of the simulation ressults such thatt temperature,, pressure, or humidity h dataa are presentedd in a plaane that is alw ways facing thhe user (see F Fig. 5). Given the user’s poosition in 3D space, s the forw ward vecctor is calculaated. Users aree allowed to sscroll in and out o to adjust thhe distance too the plane. W We set thee plane width tto span acrosss the building. Once we have calculated thhe orthogonal line on the ground (baase of the planne), we then ssample points along the linee and find the temperature etc. e informatioon of thiis point from our spatial daata structure. E Expanded it too the Y-directtion, we can tthen get the ppoints neeeded to draw the t plane.

Figure 5: Pressure plane vieewed from Heliccopter mode (leeft). Temperatuure plane viewed from Walkthrrough moode (right).

**

en.wikipedia.oorg/wiki/Delaunaay_triangulation

4 Discusssion Muultiple Screenss with Controlller We presented our early prrototype to a ggroup of archiitects and reseearchers and oone of the valuuable feeedbacks we reeceived was too have differennt images/ sim mulations/ perspectives to coompare so thatt user will be able to iinfer meaningful insight froom the data. This T resulted iin multiple scrreens implementaUnity3D. Possibble combinatioons that can bee done on mulltiple screens: (1) Same buillding tioon of CFDtoUn with same data oon all screenss, with differennt positioning/ different setttings on each screens; (2) S Same buuilding with different data (example: sam me building with w different wind directioons); (3) Diffferent buuilding with different data (eexample: builddings that are different in thheir geometriees – we can seee the diffference it willl cause e.g. to the wind direection). Additioonal functionaality could be exploited by uusing muulti-touch surfface screens (C Chen and Schnnabel, 2011). In our initiall testing with oour 35 megappixel video waall (8k in 4x4 2k screens) drriven by an Inntel® Xeeon® CPU E5-2687w @3.10GHz dual prrocessor, 32GB B RAM, four Nvidia Quadrro K5000, an iinteracttive frame ratte at >10fps iss achievable w when we creaated less than ten visualizattion windows.. The muultiple screen mechanism iss implementedd using Client--Server architeecture on the same computeer. A deffault dialoguee is initialized on program sstart on the seerver screen. When W our proogram is launcched, thee default dialoogue (see Fig. 6 left) will prrompt the userr to enter the nnumber of screeens which wiill be thee clients. The user has to set data sourcees for every sccreen. Once aall the screenss are launchedd, the useer can select aany of the scrreens to be conntrolled. Globbal movement and global seettings can theen be acttivated.

Figure 6: Deffault dialogue (left). User explooration of multipple screens usinng the Wii U Proo Controller (right).

w want to enaable the explooration in the most user-frieendly way, wee implementedd the Lastly, as we Ninntendo Wii U Pro Controlller (see Fig. 6 right) as the navigational ccontrol in the environment.. The Setttings panel allso can be actiivated from thhe controller. W We used JoyT ToKey††, a sharreware, to oveerride buutton controls oof the controlller, which is coonnected to PC C using a USB B adapter. while exploringg our Since architeect’s and urbaan planner’s uunderstanding,, behavior andd feedback w CF FDtoUnity3D visualization tool should strongly s influence the implementation, w we plan extennsive useer studies throoughout 2015. Visual effectts, appearance and features are object to change c and fuurther devvelopment.

††

http://joytokeyy.net/en/

5 Conclusion In agreement with Chen and Schnabel (2011) we see the future of urban planning to be most likely successful by opening up towards democratic and participatory design (Kunze et al., 2012). This can be achieved through breaking the monopoly on information and knowledge, in our case held by architects and engineers, by an alternative approach on simulation and visualization. As we demonstrated with the CFDtoUnity3D visualization tool exploration, navigation, and understanding can be enhanced by game-like environments. This setup is empowering the user (or stakeholder of a design/ planning process) to make informed decisions based on accurate simulations, here from CFD. Special attention has been put on the interface or communication channel, to use Shannon’s words. Game controllers and multi-touch screens have been implemented as well as displays beyond 4k resolution in single and multiple screen view mode. Optimization of the computational performance by minimizing needs (e.g. memory) is ongoing, but on the other hand depending on the visualization platform. By using Untiy3D we permit a wide range of devices to visualize the simulation results, and no commercial software license is required to run the application.

References Ashie, Y., Kono, T., 2011. Urban‐scale CFD analysis in support of a climate‐sensitive design for the Tokyo Bay area. International Journal of Climatology 31, 174-188. Berger, M., 2012. Urban heat-balling - A review of measures on reducing heat in tropical and subtropical cities, in: Sheng, T.K., Hing, P. (Eds.), Sustainable Future Energy 2012 & 10th Sustainable Energy and Environment, Brunei Darussalam pp. 445-451. Birch, D., Kelly, P.H., Field, A.J., Simondetti, A., 2013. Computationally unifying urban masterplanning, Proceedings of the ACM International Conference on Computing Frontiers. ACM, p. 32. Catmull, E., Rom, R., 1974. A class of local interpolating splines. Computer aided geometric design 74, 317-326. Chen, I.R., Schnabel, M.A., 2011. Multi-Touch: The Future of Design Interaction, CAADFutures 2011 : Designing Together, Liège, pp. 557-571. Donalek, C., Djorgovski, S., Davidoff, S., Cioc, A., Wang, A., Longo, G., Norris, J.S., Zhang, J., Lawler, E., Yeh, S., 2014. Immersive and Collaborative Data Visualization Using Virtual Reality Platforms. arXiv preprint arXiv:1410.7670. Greenwood, P., Sago, J., Richmond, S., Chau, V., 2009. Using game engine technology to create real-time interactive environments to assist in planning and visual assessment for infrastructure, 18th World IMACS/MODSIM Congress, Cairns, pp. 2229-2235. Grêt-Regamey, A., Celio, E., Klein, T.M., Wissen Hayek, U., 2013. Understanding ecosystem services trade-offs with interactive procedural modeling for sustainable urban planning. Landscape and Urban Planning 109, 107-116. Gruen, A., 2013. Generating a 3D Campus Model. GEOInformatics 16, 30-36. Hillier, B., Hanson, J., 1984. The social logic of space. Cambridge university press Cambridge. Indraprastha, A., Shinozaki, M., 2008. Constructing virtual urban environment using game technology, 26th eCAADe Conference: Architecture in Computro Antwerpen pp. 359-366. Indraprastha, A., Shinozaki, M., 2009. The investigation on using Unity3D game engine in urban design study. Journal of ICT Research and Applications 3, 1-18. Jung, Y., Behr, J., Drevensek, T., Wagner, S., 2012. Declarative 3D Approaches for Distributed Web-based Scientific Visualization Services, Dec3D. Kunze, A., Burkhard, R., Gebhardt, S., Tuncer, B., 2012. Visualization and Decision Support Tools in Urban Planning, Digital Urban Modeling and Simulation. Springer, pp. 279-298.

McLoughlin, T., Laramee, R.S., Peikert, R., Post, F.H., Chen, M., 2010. Over Two Decades of Integration‐Based, Geometric Flow Visualization, Computer Graphics Forum. Wiley Online Library, pp. 1807-1829. Miao, H., Shen, J., 2014. Developing Three-Dimensional CFD City Model Based on Public Accessible Information for Street-Level Wind Risk Assessment, 19th Australasian Fluid Mechanics Conference, Melbourne. Mochida, A., Murakami, S., Ojima, T., Kim, S., Ooka, R., Sugiyama, H., 1997. CFD analysis of mesoscale climate in the Greater Tokyo area. Journal of Wind Engineering and Industrial Aerodynamics 67, 459-477. Papadopoulou, M., Raphael, B., Smith, I.F.C., Sekhar, C., 2015. Optimal sensor placement for time-dependent systems: application to wind studies around buildings. Journal of Computing in Civil Engineering [under review]. Pauwels, P., 2014. Supporting Decision-Making in the Building Life-Cycle Using Linked Building Data. Buildings 4, 549-579. Pettit, C., Widjaja, I., Russo, P., Sinnott, R., Stimson, R., Tomko, M., 2012. Visualisation support for exploring urban space and place, XXII ISPRS Congress, Melbourne. Piga, B.E., Cibien, L., Legnani, A., Mungo, S., Zappa, D., Signorelli, V., Morello, E., 2013. A sense-archive of urban space, EAEA-11 conference 2013, Milano, pp. 251-258. Prendinger, H., Gajananan, K., Zaky, A., Fares, A., Molenaar, R., Urbano, D., van Lint, H., Gomaa, W., 2013. Tokyo Virtual Living Lab: Designing Smart Cities Based on the 3D Internet. IEEE Internet Computing 17, 30-38. Stojanovic, V., Falconer, R., Blackwood, D., Paterson, G., Fleming, M., Bell, S., 2014. Interactive visualisation of heat loss and gain for early-stage energy appraisal of the built environment, Procs 30th Annual ARCOM Conference, Portsmouth, pp. 743-752. Stone, R., Guest, R., Pahl, S., Boomsma, C., 2014. Exploiting gaming technologies to visualise dynamic thermal qualities of a domestic dwelling, BEHAVE2014 – Behavior and Energy Efficiency Conference. Vernay, D.G., Raphael, B., Smith, I.F.C., 2015. A Model-based Data-interpretation Framework for Improving Wind Predictions Around Buildings. Journal of Wind Engineering & Industrial Aerodynamics [under review]. Wang, S., Mao, Z., Zeng, C., Gong, H., Li, S., Chen, B., 2010. A new method of virtual reality based on Unity3D, Geoinformatics, 2010 18th International Conference on. IEEE, pp. 1-5. Zhao, Y., Yan, C., Zhou, X., Zhu, Q., Wang, S., Guo, W., 2013. The research and development of 3D urban geographic information system with Unity3D, 21st International Conference on Geoinformatics IEEE, pp. 1-4.