Presentation is loading. Please wait.

Presentation is loading. Please wait.


Similar presentations

Presentation on theme: "PyCGNS Poinot Marc ONERA - DSNA/ELSA /ELSA/PRS-02036"— Presentation transcript:


2 /ELSA/PRS Overview CGNS Goals History Actors/ Components Examples Future/ ISO process pyCGNS Goals/ Status Interoperability architecture Examples Proprietary data format and semantics ISO data format and semantics

3 /ELSA/PRS CFD ( Computational Fluid Dynamics ) General Notation System CFD standard We want to use a common data representation for interoperability Data semantics Physical representation  Grid creation/ Solvers/ Visualizers  Pre/Post processing of very large amount of data We want to ensure our data a long life format Consistency Timelessness Provide a general, portable and extensible standard for storage and retrieval of CFD analysis data.

4 /ELSA/PRS Steering Committee Airbus Boeing commercial Boeing Phantom Works Boeing Space & Communications CD ADAPCO Group Fluent, Inc. ICEM CFD Engineering Intelligent Light NASA Ames NASA Langley NASA Glenn NUMECA International ONERA Pointwise, Inc. Pratt & Whitney Aircraft Rolls-Royce Allison US Air Force Mission Ensure the continuation of CGNS Responsabilities Software devt., maintenance, test… Documentation Insure a soft. and doc. free distribution Provide expertise and extensions proposals Promote acceptance of the standard Organization Main meeting once per year One chairperson per organization Governs by consensus Welcomes participation of all parties, members or not

5 /ELSA/PRS Overall architecture Data semantics and Syntax CGNSLib File format Node API Specific Sub-trees API

6 /ELSA/PRS Data exchange example - An informal view Communication layer Mesh generator WB234 wing body coordX bodyConnectivity wingZones Fluid solver solution#1 pressuredensity Post processor drag

7 /ELSA/PRS Example - A CGNS tree WB234 wing coordX Solution#1 density drag WB234 CGNSBase_t Description Wing and body test case 234 Descriptor_t Date 13/03/2002 Descriptor_t Zone_t wing ZoneType_t Structured GridCoordinates_t CoordinateX solution#1 FlowSolution_t DataArray_t Density UserDefined_t Drag DimensionalUnits_t DimensionalUnits DataArray_t dragCoef

8 /ELSA/PRS Example - An ADF node WB234 wing coordX Solution#1 density drag Name: Density Label: DataArray_t DataType: DataType Dimensions: IndexDimension Parameters: DataType, IndexDimension, DataSize Cardinality: 0,N DimensionValues: DataSize[] Data: [values] Children: [nodes]

9 /ELSA/PRS-02036

10 ONERA - Office National D'Etudes et de Recherches Aérospatiales The French aeronautics and space research center From basic research to flight testing All disciplines involved in aircraft, spacecraft and missile design DSNA Numerical Simulation and Aeroacoustics dept. ELSA: Software unit in charge of elsA software elsA New generation CFD solver Industrial tool Framework for research Gather 20 years of CFD methods and software expertise Technologies leading edge OO design and implementation (C++, Python) Efficiency (scalar/vector, space/time) High level QA

11 /ELSA/PRS CGNS related developments at ONERA elsA Main I/O data representation SIDS compliant Interoperability / Multi-processing –In-memory and disk tree low level Validation resources pyCGNS A Python binding to CGNS Used as gluing language for application framework e.g. translators to CGNS trees –From/To Tecplot and Aerospace actors data format Open source

12 /ELSA/PRS elsA Software Interoperability Multi-platform/ Multi-applications Fluid/ Structures/ Optimization/ Thermics/ pre/post processing know how Technologies OO design/ implementation C++ kernel Fortran for computation leaves Python user interface A single representation for I/O XDT trees + parsers for subset translation from/to  CGNS/ XML/ Python

13 /ELSA/PRS Using Python for extensions Perfect mapping Easy to map Easy to deliver Easy to maintain Easy to use Re-use Numerical packages DBMS Parsers OS, string, re... But... no tree Hard to cross compile (and static libs…) Thanks to a good design, to a process and a set of tools Create your own tree class, DAG, graph, b-tree, etc...

14 /ELSA/PRS Ease of use example a= b=[1.2, 0.3E-10, 1.4] import Numeric c=Numeric.ones([3])*a+b print "Values :", c import math for d in c: print math.cos(d) Values : array([2.8, 1.6, 3.])

15 /ELSA/PRS In-memory trees Goal Have a in-memory representation of trees Communicate semantics using trees Have a contiguous memory zone –share –transfert Use memory buffer based systems –MPI/ SHM/ RPC/ Fast dump to disk/ recovery Implementation ADF API unchanged New implementation Thanks the two layers design of CGNS libraries Disk dump Native ADF Plan to extend to HDF5

16 /ELSA/PRS Architecture with Python modules Tree on disk: File system/DBMS Tree in-memory: Python interpreter RPC SHM MPI TCP/IP

17 /ELSA/PRS Interoperability example Two solvers and glue Structure solver Glue FFT+CGNS tree Fluid solver Visualization Main loop Structure computation Translator HOST/ CGNS SPARC parser Numerical Python (arrays+FFT) pyCGNS tree Fluid computation Full CGNS Tecplot viewer Read CGNS

18 /ELSA/PRS Scenario Helicopter blade deformation

19 /ELSA/PRS Xdt classes and parsers XdtParse XdtTree *mytree; XdtParse w; w.dump(mytree); XdtCGNS db("/tmp/mytree.cgns",OPENWRITE); db.dump(mytree); XdtMemory mbuff; mbuff.dump(mytree); MPI_Send(, mbuff.size, MPI_UNSIGNED_CHAR,n,id, MPI_COMM_WORLD); XdtPython import xdt import CRAB p=CRAB.readTecplot("") grid_tree=xdt.py2xdt(p) XdtPython *xpy; XdtTree *gridtree; xpy=XdtPython::lookUp("__main__","grid_tree"); gridtree=xpy->load();

20 /ELSA/PRS Python tree import xdt # --- Part 1 - etat file from HOST import hfile nh =['nh',['Nh'],[]] t0 =['t0',['T0'],[]] dcos=['dCos',['dCos'],[]] dsin=['dSin',['dSin'],[]] gval=['General','',[nh,t0,dcos,dsin]] val=[] for nbm in range(['nbmodes']):['Mode%.2d'%nbm] nh =['Nh',ms['Nh'], []] q0 =['Q0',ms['Q0'], []] qhc=['Qhc',Numeric.array(ms['Qhc']), []] qhs=['Qhs',Numeric.array(ms['Qhs']), []] val.append(['mode%.2d'%nbm, 'Data for mode %d'%nbm, [nh, q0, qhc, qhs]]) mval=['Values','',val] tree=['HOST',['TITLE'], [gval, mval]] xdt_host_tree=xdt.py2xdt(tree) xdt_host_tree.dump()

21 /ELSA/PRS Code example XdtTree *pbData; p1.load(pbData); … p2.dump(pbData); XdtTree *host_tree; host_tree=XdtTree::getSubTree("HOST"); host_tree->getByPath(ShaftAngle_s,&alp0); host_tree->getByPath(FlapAngle_s,&_penBat); host_tree->getByPath(LagAngle_s,&_penTra); host_tree->getByPath(PreConAngle_s,&_preCone); host_tree->getByPath(PreLagAngle_s,&_preTra); host_tree=host_tree->getSubTree("Harmonics"); host_tree->getByPath("StateModeNumber",&_nbModEtat); host_tree->getByPath("HarmonicNumber",&nbHarmonax); host_tree->getByPath("Harmonics",&_nbHarmo.begin()); host_tree->getByPath(GeneralizedCoordConstant_s,&_qi0.begin()); host_tree->getByPath(GeneralizedCoordSin,&_qis.begin()); host_tree->getByPath(GeneralizedCoordCos,&_qic.begin()); XdtPython p1("__main__","host_data"); XdtPython p2("__main__","elsa_result");... XdtMemory p1(ptr); XdtCGNS p2("Rotor466.adf",MODE_WRITE);...

22 /ELSA/PRS Archival example Validation database RDBMS+ proprietary tool Store CGNS file as binary large object (blob) Add attributes Extracted from tree Hidden to MLL RDBMS extra features Access control Query Centralized archival

23 /ELSA/PRS Code example - pyCGNS #!/usr/bin/env python # CFD General Notation System - CGNS lib wrapper # ONERA/DSNA/ELSA - # User's Guide to CGNS - C.L.Rumsey et al. examples translation # from CGNS import midlevel from CGNS.wrap import * from Numeric import * # # open CGNS file for read-only file=pyCGNS('grid.cgns',midlevel.MODE_READ) index_base=1 index_zone=1 index_flow=1 isize=file.zoneread(index_base,index_zone)[3] irmin=[1,1,1] irmax=[isize[0],isize[1],isize[2]] (loc,name)=file.solinfo(index_base,index_zone,index_flow) if (loc != midlevel.Vertex): print "Error, GridLocation must be Vertex! Currently:", print midlevel.GridLocation[loc] # read flow solution r=file.fieldread(index_base,index_zone,index_flow, 'Density',midlevel.RealSingle,irmin,irmax) p=file.fieldread(index_base,index_zone,index_flow, 'Pressure',midlevel.RealSingle,irmin,irmax) # close CGNS file del file print "Successfully read flow solution from file 'grid.cgns'" print "For example, r,p(21,17,9)=",r[20,16,8],p[20,16,8] print "Program successful... ending now"

24 /ELSA/PRS pyCGNS Status v0.4 Binding Full ADF wrapper + 75% MLL wrapper Experimental OOL layer Python + Numerical Python Standard package Documentation+ test suite In-memory representation Python/C/C++/Fortran in-memory tree sharing Tools SIFT - SIDS instance description check ParseTree - Tree dump/display as XML tree StampNode - Add sub-nodes with specific stamps (date, ownership…)

25 /ELSA/PRS pyCGNS v1.0 commitments v1.0 (4Q2002) Binding Full ADF+MLL wrapper Full OOL layer Documentation Features 100% documented + tutorial + design C/Fortran examples Test suite Complete test suite for OOL/MLL/ADF Tools/extensions ADFM embedded DBMS interface for blobs Translators

26 /ELSA/PRS Actual use Companies Most of our customers All universities/ research centers working with/for elsA Python Lot of translators Legacy shell scripts translation Monolithic tools Promote use of Distutils Numerical Python Small arrays transformations In-memory on the fly operations Handle copies with care pyCGNS Translators Tree manipulation for built and re-use

27 /ELSA/PRS CGNS and pyCGNS references summary CGNS AIAA CFD General Notation System (CGNS): Status and future directions - S.Legensky, D.Edwards, R.Bush, D.Poirier, C.Rumsey, R.Cosner, C.Towne ONERA DSNA/ELSA AIAA An efficient Object-Oriented solution to CFD complexity - L.Cambier, M.Gazaix pyCGNS Python

Download ppt "PyCGNS Poinot Marc ONERA - DSNA/ELSA /ELSA/PRS-02036"

Similar presentations

Ads by Google