|
|
|
|
|
|
|
|
|
|
AnCAD Newsletter - Technical News |
|
Run-time
Animation of Wave Simulation |
Many
subjects in the scientific computing field are related
to wave simulations, such as wave, electromagnetic wave
and light wave. MATFOR provides you with full, high-level
graphical procedures to perform dynamic visualizations
smoothly.
The procedure msSurf creates three-dimensional
graphs composed of colored quadrilateral surfaces. You
can choose several shading options including mesh, flat,
faceted, and interpolated by using the procedure msShading.
The surface
object's intersections of coordinates
x-, y-, and z- are
contained in arguments x, y and z respectively.
The following are plotting results and example codes
of case studies from MATFOR users in Taiwan. Example
I illustrates an electromagnetic
wave movement simulation. Example II
illustrates a photonic crystals movement simulation. |
|
Example
I
:
EM Wave Simulation.
A three-dimensional dynamic simulation of the
transmission of electromagnetic wave.
|
|
Example
II
: Photonic Crystals Simulation.
Data
courtesy of Dr. Wei, Center of Applied Science
& Engineering Research of Academia Sinica/Taiwan.
|
|
|
-› Partial codes
of Example I.
|
-› Partial codes
of Example II.
|
|
|
|
|
|
|
|
Step
1: Use MATFOR numerical and graphics modules.
! Use modules
use
fml
use fgl
implicit none
Step
2: Declare data type.
! Declare mfArray data type
type(mfArray)
:: atmp,&
fig,axis
real :: Ey(0:N_max,0:N_max)
real :: act
integer :: N_iter
! Algorithms calculation
...
Step
3: Assign Fortran data to mfArray data
type.
!Assign
Ey value to atmp
call
msAssign(atmp,&
Ey(0:N,0:N))
Step
4: Design graphic attributions.
! Draw atmp surface
call
msSurf(atmp)
call msShading('interp')
call msViewPause()
! Save graphic attribution
fig=mfGetCurrentDraw()
Step
5: Do loop algorithms.
do
k=1,N_iter
!
Do loop algorithms
...
!
Assign Ey value to atmp
call msAssign(atmp,&
Ey(0:N,0:N))
!
Update atmp
call msGSet(fig,&
'zdata',atmp)
Step
6: Create an animation.
! Create an animation
call
msDrawNow()
end do
|
|
|
|
|
|
|
|
|
|
|
|
|
Step
1: Use MATFOR numerical and graphics modules.
! Use modules
use
fml
use fgl
implicit
none
Step
2: Declare data type.
! Declare mfArray data type
type(mfArray)
:: MFX,MFY, &
MF1,MF2,h1,h2
complex(8)
:: Ey(251,410)
logical(4) :: first
integer(4) :: Loop
!
Algorithms calculation
...
Step
3: Do loop algorithms.
do lp=1,Loop
!
Do loop algorithms
...
Step
4: Assign Fortran data to mfArray data
type.
!
Assign Ey value to atmp
call
msAssign(MF2,&
real(Ey(:,mz)))
if(first)
then
h1=mfSolidContour(MFX,&
MFY,MF1)
call
msGset(h1,'iso',&
mf((/0.0,2.0/)))
call
msHold('on')
h2=mfPcolor(MFX,&
MFY,MF2)
first=.false.
else
! Update MF2
call
msGSet(h2,&
'cdata',MF2)
Step
5: Create an animation.
!
Create an animation
call
msDrawNow()
end if
end do |
|
|
|
|
|
|
With
MATFOR, you can easily visualize and pause a program,
perform run-time animation, and real-time data monitoring
while the program is executing.
Don't you want to visualize your simulation in this
way too?
Try MATFOR Now
|
|
|
|
|
|
|
|
|
|
|