42
Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute Potsdam (AIP).

Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

Embed Size (px)

Citation preview

Page 1: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

Arman Khalatyan

GasPMViewer 1.x.x

The Secrets of Particle Visualization methods.

The summer school 2006 on "Computational Cosmology" Astrophysical Institute Potsdam (AIP).

Page 2: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

2

OUTLINE

Modern Cosmological Simulations Basics of DM Simulations Density calculation

PMViewer basics. Developed Branches. Visualization algorithms:

DM GAS

Introduction to Stereo 3D Basic concepts 3D stereo facilities at AIP

<= NEW Visualization Technique

Page 3: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

3

Modern Cosmological Simulations

The evolution of cosmic structures is a nonlinear process.

In the simulation Box up to 5123(134M) particles or more. Output of one time step is: ~3.2GB raw

data. ~200K gravitationally bound objects:

Haloes and subhaloes. For constructing merger history we

need >100 time steps.

Page 4: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

4

Simulations DiagramCosmological model

INITIAL CONDITIONS

GetX,Y,Z, Vx,Vy,Vz

Zeldovich approximation

EVOLVE N-Body relaxation problem

PM,ART,GADGET

ANALYSE DATA

•Particles (points)•MESH(AMR grid)•Properties (Rho, T,P etc)

Halo catalogs:•Positions•Radius•Triaxial ellipsoids

Page 5: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

5

What to visualize?

2 vector fields Positions r (X,Y,Z) Velocities v (VX, VY, VZ)

Several scalar fields Density Temperature Pressure Absolute Velocity measured by observer

Page 6: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

6

Density calculation for Point data

NGP CIC TSC AMR SPH

BH-Tree (oct-tree) KD-Tree (binary-tree)

Page 7: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

7

Mapping particles to GRID

slice with Z depth

Page 8: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

8

Result=SLICE

After 15 min on supercomputer we will get CIC on a GRID resolution 512^3

Page 9: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

9

But we want to do more…

Page 10: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

10

Density estimation by BH-Tree

Build the BH-Tree (J.Barnes,P.Hut, 1986) Calculate density = MCOM/Vnode Disadvantages: over/under-estimate!!! Advantages: It is fast and useful for

visualizations!!!

Page 11: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

11

True SPH Density

Assign "radius" defined by N-neighbors (Nngb=30-60). Get density by: i=N

jmjW(rij,hi), where W(r , h) is a smoothing kernel.

Disadvantages: Needs computational power!!! Advantages: It is more accurate.

Page 12: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

12

Examples: SPH on a GRID

NGB=40 NGB=250

Page 13: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

13

Idea of PMViewer

Interactive fast tool to visualize particles.

Visualize Haloes to check halo finder algorithms.

Easy to handle and expand. Multiplatform

possibility to run on supercomputers non interactive rendering

Make fancy movies

Page 14: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

14

QT based PMViewer 2.x.x

This is not supported anymore.

Page 15: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

15

Modern GasPMViewer’s properties

OS: Linux, MacOS, CygWin Programming Language: C/C++ Environment: X11 Require: >= g++2.99, OpenGL, GLUT Hardware: >=P3 400Mhz, >32M VRAM.

Notes: Direct Draw should be enabled. Particles data formats: ART, GADGET-1/2,

MLAPM/AMIGA?(ask Alexander), BIN/ASCII(N,X,Y,Z,M)

HALO Catalogs: BDM, BDM_MPI, for new format edit read_halos.cpp file.

Page 16: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

16

User Interface.

Page 17: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

17

How to start?

Look at “glxinfo” ’s output:name of display: 127.0.0.1:0.0display: 127.0.0.1:0 screen: 0direct rendering: Noserver glx vendor string: SGIserver glx version string: 1.2server glx extensions: GLX_ARB_multisample, GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_EXT_import_context, GLX_OML_swap_method, client glx vendor string: SGIclient glx version string: 1.4client glx extensions:......

Force your administrator to install OpenGL correctly!!!

This should be YES

Page 18: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

18

Getting code.

http://pmviewer.sourceforge.net

http://www.aip.de/People/AKhalatyan/Download/GasPMViewer.tar.gz

Page 19: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

19

Makefile

For DM: MYOPT= -DSWE -DNOAGE -DVERBOSE -DPBUFFER

For Gas and track center MYOPT= -DVERBOSE -DREADCENTFROMFILE -DNOBH -DSWE -DNOTVISBOUNDPART -DPBUFFER -DDEBUGME

For DM,Boundary,Gas,Stars, BH

MYOPT= -DSIMPLE -DVERBOSE -DDEBUGME -DPBUFFER There are more then 20 options…

Page 20: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

20

Setup my.ini file;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Inifile for GasPMViewer v1.3.3b ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[DATA_TYPE];; 0 or 1 show particles?PARTICLE_FLAG = 1;; ASCII 0 || ART data 1 || GADGET 2 || MLAPM 3DATA_TYPE = 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[BOX PARAMETERS];; Box Size of simulation only for ARTBOX = 30 ;; Per cent of particlesproc = 100;; 0 or 1 periodic shifting of some point to the center ofbox PERIODIC_FLAG = 0;;translation coordinates for shifting to the center in Mpc/h ;;Box50x128tx= 48.99 ty= 18.64 tz= 48.12;; 0 or 1 Dencity scaleDENCE_SC = 0D_MAX = 6.18475e+08D_MIN = 4.0;;;;;;;;;;;;; Write dencity centrsCENT_OUT = 0

Note: The format is case sensitive!!!

Page 21: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

21

my.ini file;;;;;;;;;;;;;;;;;;;;;;; Draw all particles iside of defined box SUBBOX = 0;;in kpc XBOX = 25000.0YBOX = 25000.0ZBOX = 25000.0DBOX = 1210.0;;;;;;;;;in K ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Tempmax = 5.0e+6 Tempmin = 1e+1 ;;;;;;;;;;;;;;;;;;;;;trace centerCENTER_FILE = FOF/4Kpc/host_track.log ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[GADGET];; 1 or 0BIG_GADGET = 0 GADGET_TYPE = 1GAS_FLAG = 0 GADGET_PATH = /work4/arm2arm/GAD/ GADGET_BASENAME = snapshot;; which moment?SNAP_NUMBER = 32 ;; num of filesGADGET_FILES = 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Page 22: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

22

my.ini file[ASCII]ASCII_FILE = /windows/D/Projects/MMC/xyzINI_TIME = 492EVOL = 0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[ART]MPI_ART = 0MPI_DIR = /home/arm2arm/DATA/Box30_chris/NAME1 = /homeold/arm2arm/DATA/Box30/PMcrd.DAT NAME2 = /home/arm2arm/DATA/Box30_chris/PMcrs0_00490.DAT;draw Hires particles onlyMULTI = 0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[HALO];0 or 1HALO_FLAG = 0;; 0 Old || 1 Stefan|| 2 Christian || 3 Arman_S || 4 Arman || 6 AndreyHALO_FILE_TYPE = 31;; header lines of halo fileN_SKIP = 18 ;; number of lines in file eg.: wc -l CATH_FILE HALO_FILE_LINES = 395N_MAX_SHOW_HALO = 175 CATH_FILE = Catshort__00486.DAT.ord;;optional ;CATH_FILE2 ;CATH_FILE_OUT ;MASS_FUNCTION_FILE

Page 23: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

23

my.ini file

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[SNAPSHOT]STEP_FOR_SNAP=1ANI = 0;; snapshot file name format Ex: snapshot0000.ppmSNAPSHOT_FILE = /home/arm2arm/AVI/Box50_128/tmp/snapshott%0.4d.ppm;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[CONFIG]INTENSITY = 1.1 COLOR_TABLE = /home/arm2arm/bin/bgry64k.rgbaSCRIPT_FILE = script.camPIC_FILE = /home/arm2arm/bin/p1.tga;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[VIEW]WIN_WIDTH = 320WIN_HEIGHT = 240 ;in internal units minx=-10 maxx=10x = 0 y = 0z = 5.0 ; in gradangle = 0

Page 24: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

24

How to run?

from command line:

#>GasPMViwer.x ./my.ini

Page 25: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

25

PMViewer rendering algorithms.

DM Rendering algorithms

Page 26: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

26

Gas rendering NEW algorithm.

Get SPH density Hsml Rho, Temp…

Sort by given property Rho Temp Pot |V|

Page 27: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

27

Billboarding

Billboarding - Excerpt From Real-Time Rendering 2Eby Tomas Akenine-Möller and Eric Haines (16 September 2002)

Page 28: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

28

Example:

Page 29: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

29

Page 30: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

30

Go ahead and visualize your simulations.

&Thank YOU for Your attention.

Page 31: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

31

References

http://pmviewer.sourceforge.net/ www.google.com http://www.aip.de/People/AKhalatyan nehe.gamedev.net http://www.lighthouse3d.com/opengl/billboarding/ http://www.flipcode.com/articles/article_rtr2billboards.shtml MSDN

Page 32: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

Arman Khalatyan

3D Stereo Visualization facilities in AIP.

Page 33: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

33

Stereographics using stereo pairs

To render a stereo pair one needs to create two images, one for each eye in such a way that when independently viewed they will present an acceptable image to the visual cortex and it will fuse the images and extract the depth information as it does in normal viewing.

Page 34: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

34

Parallax

The distance between the left and right eye projections is called the horizontal parallax

The object is behind the projection plane.

Object is located in front of the projection plane.

Object lies at the projection plane.

Page 35: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

35

Rendering

Toe-in (Incorrect ) Off-axis (Correct)

Page 36: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

36

Rendering

Off-axis method requires a non symmetric camera frustum.This is supported by some rendering packages, in particular, OpenGL and DirectX.

Page 37: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

37

Frustum

Page 38: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

38

3D Stereo in OpenGL

Setting drawing mode glutInitDisplayMode( GLUT_STEREO);

For Drawing:glDrawBuffer(GL_BACK_LEFT)MyDrawLeft();glDrawBuffer(GL_BACK_RIGHT);MyDrawRight();glutSwapBuffers();

Page 39: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

39

Anaglyph

If your graphics card doesn’t support stereographics or even left and right buffers, then try Anaglyph(old method).

Page 40: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

40

Media and Communication Center (MCC)

Page 41: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

41

More3D Stereo visualization system.

Page 42: Arman Khalatyan GasPMViewer 1.x.x The Secrets of Particle Visualization methods. The summer school 2006 on "Computational Cosmology" Astrophysical Institute

42

Movies at MCC

Box=50 Mpc/h 512^3 (~134 000 000) particles Evolution of Box=50 Mpc/h 128^3(~2 000 000)

particles

Stereo PMViewer. Pulsar model from Swinburne.

Interactive Software