 Order Now

# 澳洲数学assignment代写

SCIENTIFIC COMPUTING -- Due: 3 May 2013
Exercise #3 3 11 March 2013
Find the electric potential  ( l/N, m/N, n/N) for the charge distribution:
 = -200 3/8 < x < 1/2 , 3/8 < y < 5/8, 7/16 < z < 9/16,
 = 0 x=0
 = 200 1/2 < x < 5/8 , 3/8 < y < 5/8, 7/16 < z < 9/16,
You may assume that  =0 everywhere else in the cube.
Find the solutions jkl for N = 16, 32, 48, 64, 80, 96,128, 160, 192, 256, 320 … until the problem
is too big for the PC.
Suggestions:
a. Allocate type double arrays of size N3 to hold the input, the output and the work arrays.
{I would recommend allocating these three arrays as single dimension arrays of size N3 .
Use the mapping p = j+ Nk + N2l to find the location of vertex j,k,l }
b. Set the jkl array to zero. For j from 3N/8 to N/2-1, for k from 3N/8 to 5N/8 and for
l from 7N/16 to 9N/16 set jkl = -200. Repeat for j from N/2+1 to 5N/8 with jkl = 200.
c. Find the Discrete Fourier transform of this distribution jkl by:
i. For k from 0 to N-1, For l from 0 to N-1, do the size N Discrete Fourier Transform
starting at 0kl with an initial skip of 1.
ii. For j from 0 to N-1, For l from 0 to N-1, do the size N Discrete Fourier Transform
starting at j0l with an initial skip of N.
iii. For j from 0 to N, For k from 0 to N, do the size N Discrete Fourier Transform
starting at jk0 with an initial skip of N2.
d. Calculate mnp from mnp using equation (8.2). 000 should be zero, so set 000 = 0.
e. Calculate the result vertex values of jkl by performing three sets of N^2 of size N Discrete
Fourier Series reversing step c.
You may wish to write 1-D and 2-Discrete Fourier Poisson solvers to get the details correct first.
Partial credit will be given for working 1-D and 2-D codes. Use the given 3-D charge distribution to
define the 2 D and 1-D charge distributions.
As the charge distribution is purely real and the resultant electric potential field is purely real, the
half of the calculation using imaginary values is wasted. It is possible to calculate the Discrete
Fourier Transform of Real Data efficiently when you are doing multiple transforms of the same size
by putting one set of real data into the real part of a size N complex vector and putting another set
of real data into the imaginary part. The Discrete Fourier Transform y of a purely real Data vector x
has the property: yN-k = yk* , the reversed second half of the transform array is the complex
conjugate of the first half. For a purely imaginary Data vector x, the y vector has the property:
yN-k = -yk* .
How long do steps c, d & e take for N = 16, 32, 48, 64, 80…. etc. ?
For what values of N does available computer memory become a problem?
In real modelling of atoms, molecules and semiconductors by this method , the distribution of
charges is averaged onto the nearest jkl grid vertex, the resultant electric potential at each grid
point jkl is calculated by the above algorithm and then each charge is moved by Maxwell’s laws in
the resultant Electric field. This process is repeated several thousand times for each model!
The results for the potential of our dipole brick may converge much faster if we set the faces to +
100, the edges to + 50 and the corners to + 25 (do you have any ideas why!). Test this for the 3-D
case and for any 2-D and 1-D cases if you have coded those up.
Plot j(N/2)(N/2), (N/2)k(N/2) & (N/2)(N/2)l for 0 < j,k,l < N on the same scale for your three largest
values of N. How long does this method of solving Poisson’s Equation take for N = (3,4,5)  24+k
0 < k < (as large as possible).? How would you expect the time taken to increase as N increases
(to leading order as a power of N!). For what values of N does available computer memory become
a problem?