MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

F Mathematica crashes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112962] F Mathematica crashes
  • From: ABHIJIT BHATTACHARYYA <b_abhijit2k at yahoo.co.in>
  • Date: Thu, 7 Oct 2010 03:39:40 -0400 (EDT)
  • References: <i8h7oe$cia$1@smc.vnet.net>

Hi!

thanks a lot for the kind reply. Here I am pasting code part. I like to 
dynamical plot in 3D ex..ez and hx..hz. 

Regs
Abhijit

 
Clear["Global`*"]

(**************************************************************************

 Fundamental constants
**************************************************************************)

c0              = 2.99792458*10^8;                                              
(*  m/s speed of light in vacuum                *)
mu0             = 4.0*Pi*1.0*10^(-7)//N;                        (*  H/m 
permeability of free space              *)
epsa0           = 1.0/(c0*c0*mu0);                                      (*  F/m 
permittivity of free space              *)

freq            = 1.0*10^9;                                                     
(*  Hz frequency of the source excitation       *)
lambda          = c0/freq;                                                      
(*  m wavelength of the source excitation       *)
omega           = 
2.0*Pi*freq//N;                                                               
(*  w = 2 * pi * f                              *)
(************************************************************************************************)


(************************************************************************************************

 Grid 
parameters                                                                               
 
************************************************************************************************)

nx              = 50;                           (*  number of grid cells in 
x-direction         *)
ny              = 24;                           (*                          
y                   *)
nz              = 10;                           (*                          
z                   *)

nx1             = (nx+1);
ny1             = (ny+1);
nz1             = (nz+1);

sx              = 26;                           (* X of z-directed current 
source               *)
sy              = 13;                           (* Y of z-directed current 
source               *)

kobs            = 5;

dx              = 0.002;                        (*  space resolution ~ 2 
mm                     *) 

dt              = dx/(2.0*c0)//N;               (*  time 
step                                   *)
omegadt         = omega*dt//N;

tstepmax        = 50;                           (*  total number of time 
steps                  *)
(************************************************************************************************)


(************************************************************************************************

 Differentiated Gaussian Pulse Excitation
************************************************************************************************)

rtau            = 50.0*10^(-12);
tau             = rtau/dt//N;
timedelay       = 3.0*tau;
srcconst        = dt*3.0*10^11;
(***********************************************************************************************)



(************************************************************************************************                                                                                  
 
 Material  
parameters                                                                         
 
************************************************************************************************)

epsar           = 1.0;
sigma           = 0.0;
(************************************************************************************************)


(************************************************************************************************

 updating coefficients for space region with non-permeable  
media                              

************************************************************************************************)

scourant        = c0 * dt / dx;
ca              =  
(1.0-(dt*sigma)/(2.0*epsa0*epsar))/(1.0+(dt*sigma)/(2.0*epsa0*epsar));
cb              =  
(scourant*dt/(epsa0*epsar*dx))/(1.0+(dt*sigma)/(2.0*epsa0*epsar));                   
  (* cbx, cby, cbz are same as dx=dy=dz == dx *)
da              =  
1.0;                                                                                 
  (* rho (i,j,k) == 0 *)
db              =  
dt/(mu0*dx)//N;                                                                      
  (* rho (i,j,k) == 0 *)
(************************************************************************************************)



(************************************************************************************************

 Field array and  
initialization                                                      

************************************************************************************************)

ex              = Array[0.0 # &, {nx, ny1, nz1}];
ey              = Array[0.0 # &, {nx1, ny, nz1}];
ez              = Array[0.0 # &, {nx1, ny1, nz}];
hx              = Array[0.0 # &, {nx1, ny, nz}];
hy              = Array[0.0 # &, {nx, ny1, nz}];
hz              = Array[0.0 # &, {nx, ny, nz1}];
(************************************************************************************************)

(************************************************************************************************

 start the time-stepping  
loop                                                              

************************************************************************************************)

(*
For[time=1, time <= tstepmax, time++,{
*)
Manipulate[

                        (************** UPDATE ELECTRIC FIELD  
***********************************)

        Do[ex[[i,j,k]]          = ca*ex[[i,j,k]] +  
cb*(hz[[i,j,k]]-hz[[i,j-1,k]]+hy[[i,j,k-1]]-hy[[i,j,k]]),  
{i,1,nx},{j,2,ny},{k,2,nz}];
        Do[ey[[i,j,k]]          = ca*ey[[i,j,k]] +  
cb*(hx[[i,j,k]]-hx[[i,j,k-1]]+hz[[i-1,j,k]]-hz[[i,j,k]]),  
{i,2,nx},{j,1,ny},{k,2,nz}];
        Do[ez[[i,j,k]]          = ca*ez[[i,j,k]] +  
cb*(hx[[i,j-1,k]]-hx[[i,j,k]]+hy[[i,j,k]]-hy[[i-1,j,k]]),  
{i,2,nx},{j,2,ny},{k,1,{k,1,nz}];

        Do[ez[[sx,sy,k]]        = ez[[sx,sy,k]] + srcconst*(time -  
timedelay)*Exp[-(time-timedelay)^2/tau^2], {k,1,nz}];


                        (************** UPDATE MAGNETIC FIELD  
***********************************)

        Do[hx[[i,j,k]]          = hx[[i,j,k]] +  
db*(ey[[i,j,k+1]]-ey[[i,j,k]]+ez[[i,j,k]]-ez[[i,j+1,k]]),  
{i,2,nx},{j,1,ny},{k,1,nz}];
        Do[hy[[i,j,k]]          = hy[[i,j,k]] +  
db*(ex[[i,j,k]]-ex[[i,j,k+1]]+ez[[i+1,j,k]]-ez[[i,j,k]]),  
{i,1,nx},{j,2,ny},{k,1,nz}];
        Do[hz[[i,j,k]]          = hz[[i,j,k]] +  
db*(ex[[i,j+1,k]]-ex[[i,j,k]]+ey[[i,j,k]]-ey[[i+1,j,k]]),  
{i,1,nx},{j,1,ny},{k,2,nz}];


                        (************** VISUALIZE THE FIELDS  
************************************)
        Show[ListPlot3D[ex, Mesh->None]], {time,1,tstepmax}
(*
Show[ListPlot3D[ex, Mesh->None], ListPlot3D[hx, Mesh->None]],  {time,1,tstepmax}
*)
]





----- Forwarded Message ----
From: "Rolf.Mertig at gmail.com" <rolf.mertig at gmail.com>
To: ABHIJIT BHATTACHARYYA <b_abhijit2k at yahoo.co.in>
Sent: Wed, 6 October, 2010 1:59:49 PM
Subject: [mg112962] Re: Mathematica crashes

Dear Dr. Bhattacharyya,
send me your calculation, then I can analyze what is going on.

Rolf Mertig

On Oct 6, 9:16 am, ABHIJIT BHATTACHARYYA <b_abhiji... at yahoo.co.in>
wrote:
> Hi!
>
>  I am computing six 3D matrices in a time loop. Now each matrices are of
>  dimension [50,50,50]. I find that during computation, my X-session
>  crashes and I am taken to the login screen.
>
>  I am using OpenSUSE 11.3 OS in Dell Studio XPS laptop with i7 CPU and 4
>  GB RAM. I find that cache memory used is 0MB.For other computation, this
>  does not occur which may indicate that memory shortage might be the root
>  cause.
>
>  Does not Mathematica use the cache memory as workaround? How can I avoid
>  such problem?
>
>  Thanks for your kind help.
>
>  Best
>
>  Abhijit Bhattacharyya





  • Prev by Date: Re: How to interpolate vectors?
  • Next by Date: Re: Find minimum number of operations
  • Previous by thread: No extrapolation warning on Plot
  • Next by thread: C-pointers from Mathematica