71
1 Visualizing the Physical Phenomena for Computational Science with MATFOR MATFOR ® ® 4 4 Liger Chen AnCAD Inc.

Visualizing the Physical Phenomena for Computational · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

Embed Size (px)

Citation preview

Page 1: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

1

Visualizing the Physical Phenomena for Computational Science

with MATFORMATFOR®® 44

Liger Chen AnCAD Inc.

Page 2: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

2

Outline

Introduction to MATFOR®

MATFOR® Functions

Cases Using MATFOR®

Visualization of Physical Problem

by MATFOR®

Page 3: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

3

Introduction to MATFOR®

Page 4: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

4

What’s MATFOR® ?

� MATFOR® is a new generation graphics library fully exploiting the

modules and the array features of Fortran 90/95 and C++ languages.

� MATFOR® is a collection of high-level graphical procedures

developed with the mission of reducing time spent on the program

development.

� MATFOR® is a set of numerical and visualization

libraries especially designed for programmers in

scientific computing field.

Page 5: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

5

MATFOR® Structure

MATFOR®, a set of numerical and visualization libraries, is

developed to enhance programming in C++ and Fortran

environments. Especially designed for scientists and engineers,

MATFOR® fulfills the needs of speed and advanced visualization

capabilities simultaneously.

MATFOR

Graphics LibraryGraphics Library Numerical LibraryNumerical Library

VTK OpenGL Intel MKL

Page 6: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

6

Numerical Library

Based on Intel® MKL, the numerical library contains over 200 easy-to-use numerical functions subject to assist users with computational problem-solving.

– Data Manipulation Functions: mfSort, mfMin, mfMax, …

– Elementary Math Functions: mfSin, mfCos, mfASin, mfExp, mfAbs, …

– Elementary Matrix-Manipulating Functions: mfEye, mfDiag, mfRand, mfZeros, …

– Matrix Analysis: mfEig, mfInv, mfSvd, mfQz, mfLu, mfDet, mfNorm, …

– Sparse Array:

msSpAdd, msSpSet, mfSpNNZ,mfSpLDiv,…

– File IO: mfSave, mfSaveAscii, mfLoad, mfLoadAscii, …

Page 7: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

7

Graphics LibraryVisualization Modules I

surf mesh

plot

plot3

contour contour3

quiverquiver3

trimesh trisurf

pcolor molecules

surf mesh

solidcontour

Page 8: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

8

Graphics LibraryVisualization Modules II

ribbon

contour3 solidconour3 molecule image

tetmesh tetcontour tetisosurface cube, sphere, …

slicesisosurface tube

tricontour

tetsurf

streamline

Page 9: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

9

What Does MATFOR® Do?

By adding few lines of By adding few lines of

MATFORMATFOR®® codes to codes to

your Fortran/C/C++ your Fortran/C/C++

program, you can easily program, you can easily

visualize your visualize your

computing results, computing results,

performperform runrun--timetime

animations, or even animations, or even

produce an interactive produce an interactive

movie presentation as movie presentation as

you execute your you execute your

program.program.

call msSurf(x)call msDrawNow

Page 10: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

10

MATFOR® Functions

Page 11: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

11

MATFOR® Dynamic Array ImfArray Overview

mfArray is an advanced dynamic array defined by MATFOR® using

modern features of C++ and Fortran 90/95. The mfArray data type

consists of descriptors and values.

Values

2(3,3)

9(3,2)

4(3,1)

7(2,3)

5(2,2)

3(2,1)

6(1,3)

1(1,2)

8(1,1)

Descriptors

•Data Type

•Shape

•Status Flags

mfArray

Page 12: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

12

MATFOR® Dynamic Array IImfArray Feature

A key to integrate MATFOR® toolkit into high-level

programming environments

� Automatic data typing and dimensioning

� Dynamic memory allocation

� Simple calling routines with Matlab-like syntax

type(mfArray)::x,y

x = mfMagic(5)

y = mfInv(x)

mfArray x,y;

x = mfMagic(5);

y = mfInv(x);

FortranC/C++

Construct and initialize the mfArray

Page 13: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

13

Simple Using Mathmatical functions

� Calling msSVD in MATFOR® to perform singular value decomposition gives the same result as calling DGESVX in LAPACK. However, MATFOR® function only takes 3 pre-initialized parameters while LAPACK function takes 22 pre-initialized parameters.

Call DGESVX( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, EQUED, R, C,

B, LDB, X, LDX, RCOND, FERR, BERR, WORK, IWORK, INFO ) LAPACK

Call msSVD( mfOut(A, B), C )

MATFOR

� Besides its simple and powerful visual functions, MATFOR® enables scientists and engineers to code in Matlab fashion using the simple calling concept in Fortran and C++ environments.

MATFOR a = mfInv(x) e = mfEig(x)

MATLAB a = inv(x) e = eig(x)

Page 14: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

14

• Solving the symmetric tridiagonal matrix problem :

subroutine tridib(n,eps1,d,e,e2,lb,ub,m11,m,w,ind,ierr,rv4,rv5)

lamda= w LAPACK

eps1,lb,ub ,m11 , lb ,eps1,lb,ub ,m11 , lb ,eps1,lb,ub ,m11 , lb ,eps1,lb,ub ,m11 , lb ,indindindind , , , , ierrierrierrierr ,rv4 ,and rv5 = ????,rv4 ,and rv5 = ????,rv4 ,and rv5 = ????,rv4 ,and rv5 = ????

lamda = mfEig(x)MATFOR

(this eigsystem problem maybe be the reduction of a 2nd order differential equation

0))(()()(2

2

=−++ yxcdx

dyxb

dx

ydxa mλ

1,,1

2

1

2

1

,1,

,1

2,3

3,22,21,2

2,11,1

00

0

00

0

00

++

=

=

pppp

nnnnnn

nn

CC

y

y

y

y

y

y

CC

C

C

CCC

CC

M

M

M

M

L

OOM

OO

M

L

λ

Page 15: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

15

Real-Time Animation

MATFOR® features real-

time program-monitoring mechanism to reduce time and effort spent on

post-processing and

debugging.

• MATFOR presenting simulation while calculating the data.

The simulation can be

presented as an animation

while the calculation is

proceeded and shown in

the console window.

Page 16: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

16

MATFOR® Sample Code3D Presentation

program main

use fmluse fgl! Declare mfArray variablestype(mfArray) :: x, y, z

! Construct grid matrices for 3D plotcall msMeshgrid(mfOut(x, y), mfLinspace(-3,3,30), mfLinspace(-3,3,30))! Calculate Z valuez = mfSin(x) * mfCos(y) ! Plot surfcall msSurf(x,y,z)! Display the graphcall msViewPauseend program demo codes • MATFOR presents standalone

executables.

• MATFOR Standalone Executables

EXE

Page 17: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

17

MATFOR® Sample CodeMovie Presentation

program main

use fmluse fgl

type(mfArray) :: x, y, z, h ! Declare mfArray variablesinteger(4) :: I ! Declare an integer variable

! Construct grid matrices for 3D plotcall msMeshgrid(mfOut(x, y), mfLinspace(-3,3,30), mfLinspace(-3,3,30))call msRecordStart('demo.avi') ! Begin AVI recording

do i=1,50 ! Do loopwrite (*,*) 'step=', iz = mfSin(x+i/8.0d0) * mfCos(y) ! Calculate Z valueif (i==1) then ! Initialize handle

h = mfSurf(x, y, z)call msDrawNow

elsecall msGSet(h, 'zdata', z) ! Update Z valuecall msDrawNow

end ifend do

call msRecordEnd ! End recordingcall msViewPause ! Pause to display the graph

end program

demo codes

• Viewing the recorded AVI file with media player.

• Movie FilesAVI

Page 18: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

18

Runtime Data Manipulation

MATFOR® allows manipulation of the data displayed during execution; data can be examined with higher precision and customization at

runtime.

• Data Viewer• Graphics Viewer

Page 19: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

19

Data Viewer

Snapshot Panelcaptures the snapshot of

the distribution and size of

the two dimensional data.Analysis Panel

shows the distribution of

the data including its

average, standard

deviation and min/max

values.Filter Panel

defines a range using

conditions of inequalities.

MATFOR® Data Viewer is a powerful tool that displays simulating data in a

spreadsheet format.

• Snapshot Panel

• Analysis Panel

• Filter Panel

Page 20: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

20

Supported Data File Formats

MATFOR 4 supports common software data formats and 3-D object formats to enhance the reusability and interchangeability of data.

– Matlab

– Tecplot

– 3DS, OBJ, and STL

Page 21: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

21

Graphics Viewer

MATFOR® Graphics Viewer provides a full range of graphical editing

procedures which can be manipulated directly using the menu and the toolbar.

• Axis Setting Editor • Colormap Setting Editor

• Material Setting Editor

Page 22: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

22

Enhanced Graphics Viewer(Full-Screen Function)

The full-screen function allows users to view and/or present data at full screen. This function also serves to eliminate the context for on-screen data capturing and printing.

• Use the button indicated to show the graphs in full screen mode

Full Screen Mode

Page 23: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

23

MATFOR® mfPlayerAn exclusive Visual Tool

mfPlayer is an exclusive visual tool by which the previously saved numerical data is read and displayed as an interactive movie presentation. As MATFOR® saves the simulated data into a MATFOR®-defined MFA file, mfPlayer is one approach to present the recorded animation. The complete video clip can then be viewed from different angles.

� resize

� rotate

� zoom

� pause

� forward

� reward

� view data

� change colormaps

• mfPlayer

• Data Viewer

Page 24: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

24

mfPlayer Standalone

� Currently, the proprietary format dominates in most

visualization tools generates files that can only be executed on one specific application.

� MATFOR® possesses the ability to convert visualization files into standalone executables.

� Through the conversion, data sharing and publishing become much easier.

Compiling and linking the programs with MATFOR library.

Running compiled executables without installing MATFOR.

Page 25: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

25

MATFOR® GUI Builder

MATFOR® GUI Builder allows users to customize an interface of their own; the interface can be saved into a MFUI file (based on XML format).

• MATFOR GUI Builder

MFUI

Page 26: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

26

MATFOR® GUI System (An Use Case)

btnSurf1

!////////////////////////////////////////////////////////////!// MxUI Callback BEGINsubroutine btnSurf_Click(sender)use fmluse fgluse mxui

CHARACTER(*) :: senderinteger :: kindtype(mfArray) :: x, y, zexternal btnClose_Click

call msFigure()kind = mfUIGetPropertyInteger( sender, 'tag' )call msCreateSurfData( mfOut(x,y,z), mf(kind), mf(30), mf(30) )call msSurf(x,y,z)call msDrawNow

end subroutine btnSurf_Click

!// MxUI Callback END!////////////////////////////////////////////////////////////

Actor

Application

Click

• How does the communication work between the user and the application?

UI Engine

Page 27: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

27

Cases Using MATFOR®

AnCAD Incorporated

Page 28: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

28

Applied Fields

Solid Mechanics

Fluid Dynamics

Astrodynamics

Electromagnetic Analysis

Heat Transfer and Geology Analysis

Optical propagation

Molecular Dynamics

Page 29: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

29

Thin-plate Vibration Analysis

(Data courtesy of Yuan-Sen Yang, National Center for Research on Earthquake Engineering)

Force Impulse

Fixed Boundary

Plate

Displacement

Speed

Acceleration

Stress

Page 30: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

30

(Data courtesy of Professor Edward C. Ting/Chih-Cheng Lin, National Central University)

Simulation of the nonlinear, nonconsecutive destructive phenomenon of the dam structure based on the finite element method.

Destructive External Force

Elastic Material

3D Co-rotational Explicit Finite Element Analysis

Page 31: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

31

Structural Earthquake Response

Beam Structure

Observation PointDisplacement

Moment

(Data courtesy of Professor Yuan-Sen Yang, National Center for Research on Earthquake Engineering)

Page 32: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

32

(Data courtesy of Professor Edward C. Ting/Yeh-Chan Lin/Chih-Cheng Lin, National Central University)

Acting Force

Crack SupportSupport

Concrete Fracture 2D Analysis

Page 33: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

33

Fluid Field Direction

Contaminant Obstacle

Reynolds number=100

Obstacle

Contaminant

(Data courtesy of Ming-Hsin Su, AnCAD, Inc.)

Fluid Field Turbulence I

Page 34: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

34(Data courtesy of Dr. Lin and Dr. Huang, Institute of Science and Technology)

High-pressure wave

Sharp Obstacle

High Pressure Reflection

Page 35: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

35

Channel Narrowing

Floodway

(Data courtesy of Ming-Hsin Su, AnCAD, Inc.)

Fluid Field Turbulence II

Page 36: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

36

3D Inkjet System Simulation I

Blue Print

(Data courtesy of Weng-Sing Huang/Hsuan-Chung Wu, National Cheng Kung University) O

pen E

nd

Clo

se E

nd

Cavity

Flu

id

Sup

ply

Orific

e

Nozzle

L

PZ

T

Squeeze Tube Mode Inkjet Printhead

80 40 80

160

800

Unit: μm

Page 37: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

37

(Data courtesy of Weng-Sing Huang/Hsuan-Chung Wu, National Cheng Kung University)

Computer Simulation

3D Inkjet System Simulation II

Time: 0 20 26 32 38 44 50 56

62 68 74 80 [μs ]

break

Page 38: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

38

3D Solar System Model

(Data courtesy of Li-Ger Chen, AnCAD, Inc.)

Page 39: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

39 (Data courtesy of Chun-Hao Teng, AnCAD, Inc.)

EM-impulse

Perfectly Matched Layer

Amplitude

EM-wave Scattering on Perfectly Matched Layer

Page 40: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

40

(Data courtesy of Ruey-Beei Wu/Kuang-Hua Hsueh, National Taiwan University)

Single microstrip line crossing slot

CurrentSlot

Current Layer

Ground Layer Amplitude

Multi-layer Ground Noise in a Current Field I

Page 41: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

41

Differential microstrip line crossing

slot (coupling factor = 0.305)

ground plane

power planeSlotline

CurrentSlot

Current Layer

Ground Layer Amplitude

(Data courtesy of Ruey-Beei Wu/Kuang-Hua Hsueh, National Taiwan University)

Multi-layer Ground Noise in a Current Field II

Page 42: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

42

Micro-magnetic Simulations

(Data courtesy of Professor Lee, Ching-Ming, Chungchou Institute of Technology. )

Page 43: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

43(Data courtesy of Department of Physics & Astronomy, University of St Andrews, UK)

The blueprint of future integrated optical circuits.

Photonic Band Gap Waveguide Transmission I

Page 44: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

44

(Data courtesy of Dr. Pei-Kun Wei, Academia Sinica, Taiwan)

AmplitudeLight Source

Line Defect

Photonic Band Gap

Photonic Band Gap Waveguide Transmission II

Page 45: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

45(Data courtesy of Yu-Jen Lin, Precision Instrument Development Center)

Wave Source

Obstacle

Wave Source

Obstacle

Finite-difference Time-domain Analysis

Page 46: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

46

(Data courtesy of Tung-Lung Fu, Precision Instrument Development Center)

Light Source

Micro-lens

Analysis of Optical Thin-film Coated Micro-lens

Page 47: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

47 (Data courtesy of Chin-Hsiang Cheng, Tatung University)

30 nm

Water Molecules

Water Molecule Phase Transition

Page 48: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

48

Ion Perturbation Analysis

(Data courtesy of Yu-Chang Sheng, National Taiwan University)

Ion A

Ion BDistance between ions A and B

Page 49: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

49

Visualization of Physical Problem

by MATFOR®

Page 50: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

50

Electromagnetic Radiation

• Dipole

• Quadrupole

axial separation

laterial separation

2

2

3

42

0 1)(sin

42

1

rc

pnS θ

ω

π=⋅

vv

[ ]2

22

5

6

2

2 1)cos(sin)(sin

322

1

rkd

c

QnS θθ

ω

π=⋅

vv

2

22

3

42

0 1)cos()sin(

2sin)(sin

2

1

r

kd

c

pnS

=⋅ ϕθθ

ω

π

vv

Page 51: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

逸奇科技. www.AnCAD.com

Visualizing the Radiation Pattern

Page 52: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

52

Diffraction Integral

• Fresnel-Kirchhoff :

• Frauhofer :

∫ +=σ

θλ

ψψ da

r

e

iP

ikr

))cos(1(2

1)( 0

∫+−=

σ

βηαξ ηξλ

ψβαψ dde

Z

e

i

ik

ikR

)(01),( )

))(( βηαξλ +≈∴>>>> RrDR

Page 53: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

53

Slit Diffraction

• In one dimensional ,The Fraunhofer Diffraction Integral becomes :

• If the slit is of width 2a, then the integral is :

∫−=

σ

αξ ξαψ deCik)(

∫−

− ====a

a

ik akauu

uCadeC )sin(

2,)

)sin((2)( θ

λ

παξθψ αξ

Page 54: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

逸奇科技. www.AnCAD.com

Visualization of the Slit Diffraction

Page 55: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

55

Circular Aperture

)sin(),cos()( )( ϕρηϕρξηξψσ

βηαξ === ∫+−

ddeCPik

)'cos( ϕϕρθβηαξ −=+

2

0

22

2

02

0

0

0

2

0

cos

)(,2

))(

(2)(2)(

ψλ

ππθ

λ

π

πρρθπρθρθψπ

ϕρθ

Z

aCaau

u

uJCadkaJCddeC

aa

ik

==

==⋅=∴ ∫∫ ∫−

Page 56: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

逸奇科技. www.AnCAD.com

Visualizing the Circular-Aperture

Diffraction

Page 57: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

57

Optical Soliton : Kerr Effect

This refractive index variation is responsible for the nonlinear optical effects of self-focusing and self-phase modulation, and is the basis for Kerr-lens modelocking.

Type Kerr effect:

Innn 20 +=

.

Page 58: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

58

Slow Vary Approximation

βα

λλ

≡≡

⋅+∂

∂=

∂⇒

≈+−=−

∂>>

∂→>>∆

=+

∂+−+

∂⋅+

∂+

∂=∇=+∇

2,

2

1

)2

(2

1.

)2())((

,1

~

0)())(1()2(

,0

2

00

00

22

00

2

2

00

000

2

0

2

2

2

0

2

02

22

00002

2

2

2

2

222

0

22

nkn

knset

aankn

ix

a

kni

z

aeq

Innnnnnnnand

z

a

z

akzkfor

ankx

akn

z

akni

z

a

zxEknE

Page 59: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

59

Split Step Fourier Method

( )

][

ˆˆ

)(

22 )(

1

0

ˆˆ

0

)ˆˆ(

2

2

2

n

aizki

n

zNzLzNL

aeFea

aeeaeaaNLz

a

aaix

ai

z

a

βα

βα

∆⋅−+

⋅⋅+

=⇒

≈=⇒+=∂

∂⇒

⋅+∂

∂=

Page 60: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

逸奇科技. www.AnCAD.com

SSF simulation result for Kerr soliton.

Page 61: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

61

Sin-Gordon Equation

• Considing a 1-D chan of identiacl pendu;la connenctedby a torsion bar.

• The euqation of motion for pendulum j follows from Newton’s law for rotational motion in terms of torques:

2

2

11

)()sin()()(

dt

tdImg

I

j

jjjj

ij

jji

θθθθκθθκ

ατ

=−−−−−

=

+−

Page 62: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

62

2D Sin-Gordon Equation

• If the wavelength in a pulse are much longer than the repeat disance a, the chain could be approximated as a continuous medium.

• Then generalizing the spatial derivatives:

( )

)sin(lim

)()(

2

2

2

2

0

2

2

2

11

1

θθκθ

θθθθθ

θθθ

I

mg

xI

a

t

ax

ax

a

jjjj

jj

=∂

∂−

∂⇒

⋅∂

∂≈−−−−

⋅∂

∂+≈

+−

+

)sin(2

22 θβ

θαθ ⋅=

∂⋅−∇

x

Page 63: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

63

Sin-Gordon Equation: 1D solution

1-D analytic solution :

So the 2D initial gauss be :

where c be some constant.

( )

( )

+

−−

=−

±

−=

±=

=∂

∂−

π

θ

θξ

θ

ξ

θθθθ

2

12

1

2

12

1

2

2

2

2

2

2

2

2

1

exptan4

1

exptan4

)(

1~

)sin(1

),(,)sin(

v

vtx

v

vtx

vtx

vfor

v

v

d

d

v

xt

txxt

( )

+−== −

2

1221 exptan4)0,,( yxctyxθ

Page 64: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

64

2D Dynamical Sin-Gordon Equation

Initial condition, left: above equation; right: Gaussian form.

Page 65: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

65

Quantum bound

• In multiple-particle nature, the interaction leads the nonlocal potential :. It changes the interaction term in Schrodinger equation :

• Then the equation becomes :

∫ ′′′→ rdrrrVrrV )(),()()( ψψ

ψψ EH =

)()(),(2

)(2

0

22

kEdppkkpVkp

nnnn ψψπ

ψµ

++ ∫∞

Page 66: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

66

• One way to deal with the equation is by going to k-

space(Bessel transformation):

the k-space potential is obtain by a double Bessel transform

Numerically, The Schrodinger equation be :

)()(),(2

)(2

0

22

kEdppkkpVkp

nnnn ψψπ

ψµ

++ ∫∞

∫∫ ∫∞∞ ∞

′=

′′′

0

23

0 0

3 )()()()2()(),()()2( drrrpjrVkrjrdrprjdrrrrVrkj llll ππ

)()(),(2

)(2 1

22

kEkkkkVkkk

nn

N

i

jnjjjn ψψπ

ψµ

=⋅∆+ ∑=

Page 67: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

67

• In matrix form :

• To solve the eigensystem problem, we could receive several eigenvalues, but only one satisfys

(boundary condition). Once we find the , by inverse Bessel transformation we could get the wave function in r-space without any difficault : .

[ ] [ ] [ ]nnn EH ψψ =⋅jjjiij

i

ij kkkkVk

H ∆+= 2

2

),(2

2 πδ

µ

[ ]

=

)(

)(

)(

2

1

Nn

n

n

n

k

k

k

ψ

ψ

ψ

ψM

IEH n−

∫∞

=0

2)()()( dkkkrjkr lnψψ

)(kψ

Page 68: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

68

The simplest case :

.

)(2

)( brrV −= δµ

λ

)()(2

)()()(),(2

0

2prjkrj

bdrrprjrVkrjpkV llll

µ

λ== ∫

.

),(2

)( brrV −= δµ

λ

Page 69: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

69

Summary :MATFOR Components

• mfArray

– integrates the entire MATFOR toolkit into high-level programming environments such as C++ and Fortran, simplifying the syntax and facilitating object-oriented programming.

– Basic data structure.

• Numerical Library

– contains useful linear algebraic functions subject to assist users with computational problem solving.

– Use mfArray to do numerical computation

• Visualization Library

– collects well-designed graphical procedures and controls to support a variety of 2D and 3D visual functions.

Page 70: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

70

MATFOR Components (Cont)

• Data Viewer

– organized in spreadsheet format, is one convenient platform for data management, filter, and analysis.

• Graphics Viewer

– besides its highly customized user interface, overthrows the convention of post-processing as it instantly visualizes scientific and engineering data.

• mfPlayer

– captures picture frames, animates simulation results, and allowsadditional graphical manipulations.

Page 71: Visualizing the Physical Phenomena for Computational  · PDF fileDeclare mfArray variables type(mfArray) :: x, y, z! ... the two dimensional data. ... • Axis Setting Editor

71 AnCAD Incorporated

- MATFOR®-A Simple Yet Powerful Solution to Meet Your Needs!