Numerical Solutions of PDE: Finite Difference Methods Report
VerifiedAdded on 2022/09/07
|12
|2653
|103
Report
AI Summary
This report provides a detailed analysis of numerical solutions for partial differential equations (PDEs) using finite difference methods. It begins by introducing the problem and discussing various finite difference schemes suitable for approximating solutions, justifying the choices made. The core of the report constructs numerical schemes for both explicit and implicit finite difference methods, including the Crank-Nicolson and Lax-Friedrichs schemes, and demonstrates their consistency with the given PDE. Python code is then developed to implement these schemes, with a brief explanation of the algorithms used. The report also includes figures visualizing the numerical solutions obtained from both schemes, and concludes with a discussion of the stability of the algorithms. This report provides a comprehensive understanding of the application of finite difference methods in solving PDEs, along with practical implementation through Python code.

NUMERICAL SOLUTIONS OF PDE
Problem 1.a)
There various finite difference methods of solving partial differential equations. The method
used depends on the structure and complexity of the equation of concern. The Partial
Differential Equation (PDEs) of interest does not have an analytical solution and therefore, a
numerical method have to be used to find an approximate solution. The approximation is done
at discrete values of independent variables using an approximation scheme implemented via a
program. An approximated solution is obtained after manipulation and creation of a finite
difference schemes:
Taylor’s Theorem.
This method operates by replacing the over regions of defined independence variables by
points of approximated dependent variables. The partial derivatives are thereafter estimated
from the neighboring values.
Given that ;
Ut(x,t) + 1
8 Ux(x,t) +2e-1/2tU(x,t)=0 -6 ≤x≤0 , 0≤x≤2
U(x,0) =-8e4x ,U(0,t)=texp(4e-1/2t
From the Taylor’s theorem you can interpret that if the value of U is known at its point of
differentiation, then it is possible to write down the value of X0+h as the neighboring points of
U(x,t).
The expression contains unknown quantity with an error term which can be discarded to
obtain the approximate value of U(X0+h).
A) Explicit Schemes.
This is a type of scheme in which data in the next time interval is obtained from an explicit
formula that involves data obtained from the previous time intervals. It is significant as it may
involve restrictions on the maximum time involved in each step.
An explicit finite-difference (FD) technique can be used to perform
simulated positive and bounded development process of a colony of micro-
organisms which are exposed to a substrate of nutrients of non-linear partial
differential equations The finite difference is specifically modeled in such a
Problem 1.a)
There various finite difference methods of solving partial differential equations. The method
used depends on the structure and complexity of the equation of concern. The Partial
Differential Equation (PDEs) of interest does not have an analytical solution and therefore, a
numerical method have to be used to find an approximate solution. The approximation is done
at discrete values of independent variables using an approximation scheme implemented via a
program. An approximated solution is obtained after manipulation and creation of a finite
difference schemes:
Taylor’s Theorem.
This method operates by replacing the over regions of defined independence variables by
points of approximated dependent variables. The partial derivatives are thereafter estimated
from the neighboring values.
Given that ;
Ut(x,t) + 1
8 Ux(x,t) +2e-1/2tU(x,t)=0 -6 ≤x≤0 , 0≤x≤2
U(x,0) =-8e4x ,U(0,t)=texp(4e-1/2t
From the Taylor’s theorem you can interpret that if the value of U is known at its point of
differentiation, then it is possible to write down the value of X0+h as the neighboring points of
U(x,t).
The expression contains unknown quantity with an error term which can be discarded to
obtain the approximate value of U(X0+h).
A) Explicit Schemes.
This is a type of scheme in which data in the next time interval is obtained from an explicit
formula that involves data obtained from the previous time intervals. It is significant as it may
involve restrictions on the maximum time involved in each step.
An explicit finite-difference (FD) technique can be used to perform
simulated positive and bounded development process of a colony of micro-
organisms which are exposed to a substrate of nutrients of non-linear partial
differential equations The finite difference is specifically modeled in such a
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

form that it eliminates the parabolic terms in the initial PDE into numerical
sets of linear algebraic equations that can easily be solved. Which ensuring
that the solution remains stable and unbounded. This can be realized from a
model of interconnected estimations fo a diffusion response and functions of
both time and spatial variations as well as the control time-step of
generating a criteria of theoretical stability. An elaborate analysis of
theoretical stability is performed to help realize that our technique is indeed
optimal. The numerical solutions are to be ensured to be non-negative and
bounded.
Consistency: You can conclude that a nominal finite difference scheme is
consistent when it converges to the PDEs we are trying to solve as the space
and time approaches zero. Consistency does not prove relevant when it is
spatial and time discretization are parted. However, a further check is
important at mixed discretization.
Stability: You can only say a finite difference is stable when the difference
between the numerical value solution and the exact value solution are
bounded as it approaches to infinite.
B)Implicit Schemes.
A type of scheme in which data obtained from the next time level happens on both sides of the
difference schemes that involve solving a system of linear equations .This is characterized by
non-stable restrictions. The maximum time allowed in each step may be much longer than that
of the explicit scheme for the same problem.
A type of Scheme are chosen depending on the accuracy level in need.
Convergence: You can say that a finite difference scheme converges when its numerical value
tends to zero as the space and time discretization also tend to zero.
Implicit solutions relate only to the simplest systems of equations. Implicit solutions are
not conditionally stable. This can be realized fro mathematical models of the dynamic
problems such as the fluid dynamics.
The stability of the finite difference scheme corresponds to the spread of waves of
information into a solution. Elastic and fluctuating waves may lead to a balance between
inertia and gravity. Kinematic waves is a consequence of the the balance between
resistance and gravity.
1.The problems will be continuously be unstable at the tiny level when the waves move
at higher speed as compared to the dynamic waves. This can however make both
conditions of implicit and explicit schemes to be unstable.
sets of linear algebraic equations that can easily be solved. Which ensuring
that the solution remains stable and unbounded. This can be realized from a
model of interconnected estimations fo a diffusion response and functions of
both time and spatial variations as well as the control time-step of
generating a criteria of theoretical stability. An elaborate analysis of
theoretical stability is performed to help realize that our technique is indeed
optimal. The numerical solutions are to be ensured to be non-negative and
bounded.
Consistency: You can conclude that a nominal finite difference scheme is
consistent when it converges to the PDEs we are trying to solve as the space
and time approaches zero. Consistency does not prove relevant when it is
spatial and time discretization are parted. However, a further check is
important at mixed discretization.
Stability: You can only say a finite difference is stable when the difference
between the numerical value solution and the exact value solution are
bounded as it approaches to infinite.
B)Implicit Schemes.
A type of scheme in which data obtained from the next time level happens on both sides of the
difference schemes that involve solving a system of linear equations .This is characterized by
non-stable restrictions. The maximum time allowed in each step may be much longer than that
of the explicit scheme for the same problem.
A type of Scheme are chosen depending on the accuracy level in need.
Convergence: You can say that a finite difference scheme converges when its numerical value
tends to zero as the space and time discretization also tend to zero.
Implicit solutions relate only to the simplest systems of equations. Implicit solutions are
not conditionally stable. This can be realized fro mathematical models of the dynamic
problems such as the fluid dynamics.
The stability of the finite difference scheme corresponds to the spread of waves of
information into a solution. Elastic and fluctuating waves may lead to a balance between
inertia and gravity. Kinematic waves is a consequence of the the balance between
resistance and gravity.
1.The problems will be continuously be unstable at the tiny level when the waves move
at higher speed as compared to the dynamic waves. This can however make both
conditions of implicit and explicit schemes to be unstable.

2.As you will often realize that numerical stability is not constant but varies with relative
measures of control of a chosen analysis. This may initiate a hyper volume of higher
dimensions in regard to the locality of the finite volume over lifespan which can emerge
into a courant Number.Courant is the distance travelled over an element’s lifespan .
3. In extension of the initial conditions and in comparison to the current situation,
boundary conditions can be seen as a relatively a time-wise expansion.Therefore,the
space wise direction in which equations are solved becomes significant.
4.Explicit solutions are discriminative, that is, the solutions for each explicit function
within a cell are only meant for that cell. This is not the case with implicit function as any
solution from any cell can be used in any other different cell. AS a result, it is only
applicable in stability for courant numbers<1
5.The solutions for implicit functions are generally stable for even Courant Numbers
greater than 1 when solved simultaneously over a range of cells. For cases of low
courant numbers ,the implicit equations appear top be unstable and are solved in the
wrong direction from the boundaries.
6.Stability of finite difference scheme of PDE cannot guarantee accuracy
level.However,the its accuracy may dependent variable on a balance of influence
between the initial conditions and the boundary mark. As a result,courant
number=1,where both implicit and explicit schemes are most accurate.
7. There always a search of the scheme with the best performance in both the explicit
and implicit schemes as there are several courant numbers with different wave types
and spatial dimensions.However,implicit solutions are much more preferred as
compared to the explicit solutions. Explicit solutions can be coded to run at a higher
pace in relation to the explicit solutions.
You will confirm that the explicit formulation requires values from other loci on the
previous instantaneous time to produce the values of the current loci. This is repetitive
and may but not cumbersome to get involved as the method is very simple and
clear.However,the time step must be maintained to a smaller value to ensure an
accurate stability is met and maintained. This may need many iterations to significantly
calculate time. The explicit formulation needs the values from other nodes at a previous
instant of time to determine the node value of the present one, the computational
calculation method is very simple. However, the time step has to be really small in order
to maintain the stability of this approach, so it will require a huge number of iterations
that could increase significantly the calculation time.
The implicit formulation is more advantageous in solving a defined problem. It may
require much less time as it does not need to verify the stability criterion of each time
step. The manipulation of node values and figures at the current time, relies on the
measures of control of a chosen analysis. This may initiate a hyper volume of higher
dimensions in regard to the locality of the finite volume over lifespan which can emerge
into a courant Number.Courant is the distance travelled over an element’s lifespan .
3. In extension of the initial conditions and in comparison to the current situation,
boundary conditions can be seen as a relatively a time-wise expansion.Therefore,the
space wise direction in which equations are solved becomes significant.
4.Explicit solutions are discriminative, that is, the solutions for each explicit function
within a cell are only meant for that cell. This is not the case with implicit function as any
solution from any cell can be used in any other different cell. AS a result, it is only
applicable in stability for courant numbers<1
5.The solutions for implicit functions are generally stable for even Courant Numbers
greater than 1 when solved simultaneously over a range of cells. For cases of low
courant numbers ,the implicit equations appear top be unstable and are solved in the
wrong direction from the boundaries.
6.Stability of finite difference scheme of PDE cannot guarantee accuracy
level.However,the its accuracy may dependent variable on a balance of influence
between the initial conditions and the boundary mark. As a result,courant
number=1,where both implicit and explicit schemes are most accurate.
7. There always a search of the scheme with the best performance in both the explicit
and implicit schemes as there are several courant numbers with different wave types
and spatial dimensions.However,implicit solutions are much more preferred as
compared to the explicit solutions. Explicit solutions can be coded to run at a higher
pace in relation to the explicit solutions.
You will confirm that the explicit formulation requires values from other loci on the
previous instantaneous time to produce the values of the current loci. This is repetitive
and may but not cumbersome to get involved as the method is very simple and
clear.However,the time step must be maintained to a smaller value to ensure an
accurate stability is met and maintained. This may need many iterations to significantly
calculate time. The explicit formulation needs the values from other nodes at a previous
instant of time to determine the node value of the present one, the computational
calculation method is very simple. However, the time step has to be really small in order
to maintain the stability of this approach, so it will require a huge number of iterations
that could increase significantly the calculation time.
The implicit formulation is more advantageous in solving a defined problem. It may
require much less time as it does not need to verify the stability criterion of each time
step. The manipulation of node values and figures at the current time, relies on the
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

neighboring figures of every locus at constant period. The equation formation is done
simultaneously.
Implicit schemes are very expensive as compared to explicit formulation. Implicit
schemes and techniques may be unconditionally stable considering each time step and
the problem under specification. Implicit method can use several time steps and get an
exact solution within a short time. Hence it is more reliable as compared to explicit
schemes. This is due to low computer costs and a significant accuracy level.
The disadvantage of the explicit schemes is their conditional stability. Each addition of
the explicit time integration is much less is expensive than the time integration for the
implicit manipulations.
The decision on the explicit and implicit schemes depends on the type and size of the
problem.
Problem 1.b)
Krank-Nicolson Scheme.
This is an implicit scheme in which a partial derivative are approximated at the time interval
n.There is realization of value change between time interval n and n+1 time interval level.From
the resultit is indeed true that a better approximation of the partial derivative function could be
seful on both ends i.e the left ends and the right ends.
From the function given,Un+1m;
We can note that;
i)The scheme is both a first order and second order in space.
ii)On both ends, ghost values are required.
iii)Solving the system of linear equations provides some approximate values at the time interval
of n+1 from the implicit scheme.
Assuming that c = V ∆ t
∆ x ;
Umn+1=Umn - c
2( Um+1n−¿U n m−1
2 ¿- Un+1 m+ 1−Un +1 m+1−U n+1 m−1
2 )
simultaneously.
Implicit schemes are very expensive as compared to explicit formulation. Implicit
schemes and techniques may be unconditionally stable considering each time step and
the problem under specification. Implicit method can use several time steps and get an
exact solution within a short time. Hence it is more reliable as compared to explicit
schemes. This is due to low computer costs and a significant accuracy level.
The disadvantage of the explicit schemes is their conditional stability. Each addition of
the explicit time integration is much less is expensive than the time integration for the
implicit manipulations.
The decision on the explicit and implicit schemes depends on the type and size of the
problem.
Problem 1.b)
Krank-Nicolson Scheme.
This is an implicit scheme in which a partial derivative are approximated at the time interval
n.There is realization of value change between time interval n and n+1 time interval level.From
the resultit is indeed true that a better approximation of the partial derivative function could be
seful on both ends i.e the left ends and the right ends.
From the function given,Un+1m;
We can note that;
i)The scheme is both a first order and second order in space.
ii)On both ends, ghost values are required.
iii)Solving the system of linear equations provides some approximate values at the time interval
of n+1 from the implicit scheme.
Assuming that c = V ∆ t
∆ x ;
Umn+1=Umn - c
2( Um+1n−¿U n m−1
2 ¿- Un+1 m+ 1−Un +1 m+1−U n+1 m−1
2 )
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

4Un+1m=4Unm –c(Unm+1-Unmm-1+Un+1m+1- Un+1m-1
Rearranging the data we obtain:
-Cn+1m-1+4Un+1m +CUn+1m+1 =Cnm-1 +4Unm –CUnm+1
Assuming that you know the data at the n time interval, you can replace the right hand side by
dnm to get;
-Cn+1m + 4Un+1m+CUn+1m+1= dnm
Consider every grid point m=1,2,3,,……………..,N;You get,
-Cn+10 +4Un+11 + CU2n+12………………………………..=dn1
-Cn+11 + 4Un+12 +Cn+13 ……………………………………=dn2
-CUn+12 +4Un+13 +CUn+14……………………………….=dn3
-CUn+1N-2 +4Un+1N-1 +CUn+1N+1……………………………….=dnN
From the equations N+2 are unknown values.Un+10 and Un+1N+1 on the left hand side are
ghost values and can be calculated in terms of the neighboring values.
Supposing that dn1=dn1 +Cn+10,dn’N-Cn+1N+1,you get;
4Un+11+ Cn+12……………………………………………….=dn’1
-Cn+11 + 4Un+12 +Cn+13 ……………………………………=dn2
-Cn+12 +4Un+13 +CUn+14……………………………….=dn3
-CUn+1N-1 +4Un+1N-1 +CUn+1N……………………………….=dnN
You can express the system in a matrix equation of
Aun+1=dn
Where Un+1 =A-1dn
Lax-Friedrichs Scheme:
This is an explicit scheme in which the first term on the right hand side of the linear equation is
substituted with its neighboring values.
For instance;
Unm is substituted with Unm+1+Unm-1
Rearranging the data we obtain:
-Cn+1m-1+4Un+1m +CUn+1m+1 =Cnm-1 +4Unm –CUnm+1
Assuming that you know the data at the n time interval, you can replace the right hand side by
dnm to get;
-Cn+1m + 4Un+1m+CUn+1m+1= dnm
Consider every grid point m=1,2,3,,……………..,N;You get,
-Cn+10 +4Un+11 + CU2n+12………………………………..=dn1
-Cn+11 + 4Un+12 +Cn+13 ……………………………………=dn2
-CUn+12 +4Un+13 +CUn+14……………………………….=dn3
-CUn+1N-2 +4Un+1N-1 +CUn+1N+1……………………………….=dnN
From the equations N+2 are unknown values.Un+10 and Un+1N+1 on the left hand side are
ghost values and can be calculated in terms of the neighboring values.
Supposing that dn1=dn1 +Cn+10,dn’N-Cn+1N+1,you get;
4Un+11+ Cn+12……………………………………………….=dn’1
-Cn+11 + 4Un+12 +Cn+13 ……………………………………=dn2
-Cn+12 +4Un+13 +CUn+14……………………………….=dn3
-CUn+1N-1 +4Un+1N-1 +CUn+1N……………………………….=dnN
You can express the system in a matrix equation of
Aun+1=dn
Where Un+1 =A-1dn
Lax-Friedrichs Scheme:
This is an explicit scheme in which the first term on the right hand side of the linear equation is
substituted with its neighboring values.
For instance;
Unm is substituted with Unm+1+Unm-1

You can therefore choose;
σ x Unm= Un m+1−Un m−1
2 ∆ x and σ xxUnm=0
This results to a new equation of;
Un+1m = Un m+1+U n m−1
2 - V ∆ t
2 ∆ X (Unm+1 –Unm-1)
You will realize that the scheme is first order in time and first order in space.
Ghost values are required on both sides to compute the domain.
The scheme has got a unique a unique performance.
Problem 1 .c
Considering the implicit scheme stated above,the problem is solved at every step and the
solution updated iteratively using python.
Use an efficient matrix conversion method to iterate 1000000 values.
Invert the boundary values only once.
Calculate the left hand boundary values in terms of the neighbouring values i.e the first and the
last rows of the boundary values would vary from time step to time step.
I)Implicit Scheme
# 1d time is dependent on the linear equation
# dC/dt = K div(slope(C)) + 4U/x grad(c) on x=[0,1]
# BC: dx=0 C=1, @x=1 dC/dC=-1
# Time discretization using Crank Nicolson scheme
import scipy
σ x Unm= Un m+1−Un m−1
2 ∆ x and σ xxUnm=0
This results to a new equation of;
Un+1m = Un m+1+U n m−1
2 - V ∆ t
2 ∆ X (Unm+1 –Unm-1)
You will realize that the scheme is first order in time and first order in space.
Ghost values are required on both sides to compute the domain.
The scheme has got a unique a unique performance.
Problem 1 .c
Considering the implicit scheme stated above,the problem is solved at every step and the
solution updated iteratively using python.
Use an efficient matrix conversion method to iterate 1000000 values.
Invert the boundary values only once.
Calculate the left hand boundary values in terms of the neighbouring values i.e the first and the
last rows of the boundary values would vary from time step to time step.
I)Implicit Scheme
# 1d time is dependent on the linear equation
# dC/dt = K div(slope(C)) + 4U/x grad(c) on x=[0,1]
# BC: dx=0 C=1, @x=1 dC/dC=-1
# Time discretization using Crank Nicolson scheme
import scipy
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

import scipy.sparse as sparse
import scipy.sparse.linalg
import numpy
N = 50
dx = 1/(N-1.0)
delta = -1.0
c= 1.0
#grid points
A = numpy.linspace(0,1,N)
#create time steps
c = 0.5/100
TFinal = 1
NumOfTimeSteps = int(TFinal/c)
#initial solution
u = numpy.transpose([numpy.ones(N)*1.0])
#source term
F = numpy.transpose([numpy.zeros(N)])
F[-1]=2.0*K*delta*(1.0/dx+1.0)
print F
import scipy.sparse.linalg
import numpy
N = 50
dx = 1/(N-1.0)
delta = -1.0
c= 1.0
#grid points
A = numpy.linspace(0,1,N)
#create time steps
c = 0.5/100
TFinal = 1
NumOfTimeSteps = int(TFinal/c)
#initial solution
u = numpy.transpose([numpy.ones(N)*1.0])
#source term
F = numpy.transpose([numpy.zeros(N)])
F[-1]=2.0*K*delta*(1.0/dx+1.0)
print F
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

#create matrices with boundary conditions
A1=numpy.zeros([N])
A2=numpy.zeros([N])
A1[0]=0.0 # constant value boundary
for i in range(1,N-1):
array = numpy.zeros([N])
array[i-1:i-1+3] = [1,-2,1]
X1=numpy.Ustack([x1,array])
array = numpy.zeros([N])
#array[m-1:m-1+3] = [-1.0/x[m],0.0,1.0/x[m]] #x is the
grid spacing
array[m-1:m-1+3] = [-1.0,0.0,1.0]
A2=numpy.Ustack([A2,array])
array = numpy.zeros([N])
array[-2:]=[2,-2] #gradient boundary condition
X1=numpy.vstack([x1,array])
print A1
A1=X1*C/dx/dx
A1=scipy.sparse.csr_matrix(A1)
array = numpy.zeros([N])
A2=numpy.vstack([A2,array])
print A2
A2=A2*2.0*K/2.0/dx #note: grid factor, 1/x, is built into A2
matrix already
A2=scipy.sparse.csr_matrix(A2)
A1=numpy.zeros([N])
A2=numpy.zeros([N])
A1[0]=0.0 # constant value boundary
for i in range(1,N-1):
array = numpy.zeros([N])
array[i-1:i-1+3] = [1,-2,1]
X1=numpy.Ustack([x1,array])
array = numpy.zeros([N])
#array[m-1:m-1+3] = [-1.0/x[m],0.0,1.0/x[m]] #x is the
grid spacing
array[m-1:m-1+3] = [-1.0,0.0,1.0]
A2=numpy.Ustack([A2,array])
array = numpy.zeros([N])
array[-2:]=[2,-2] #gradient boundary condition
X1=numpy.vstack([x1,array])
print A1
A1=X1*C/dx/dx
A1=scipy.sparse.csr_matrix(A1)
array = numpy.zeros([N])
A2=numpy.vstack([A2,array])
print A2
A2=A2*2.0*K/2.0/dx #note: grid factor, 1/x, is built into A2
matrix already
A2=scipy.sparse.csr_matrix(A2)

data = []
#identity matrix
I = sparse.identity(N)
print("Time step = %g \t Time = %g"%(0, 0))
print(u)
for i in range(NumOfTimeSteps):
A = (I - m/2.0*A1 - m/2.0*A2)
b = (I + m/2.0*A1 + m/2.0*A2)*c+k*F
u = numpy.transpose(numpy.mat(sparse.linalg.spsolve(A,
b)))
print("Time step = %g \t Time = %g"%(m+1, k*(m+1)))
data.append(u)
print u[:,-1]
#identity matrix
I = sparse.identity(N)
print("Time step = %g \t Time = %g"%(0, 0))
print(u)
for i in range(NumOfTimeSteps):
A = (I - m/2.0*A1 - m/2.0*A2)
b = (I + m/2.0*A1 + m/2.0*A2)*c+k*F
u = numpy.transpose(numpy.mat(sparse.linalg.spsolve(A,
b)))
print("Time step = %g \t Time = %g"%(m+1, k*(m+1)))
data.append(u)
print u[:,-1]
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

II)Explicit Scheme
Considering the explicit scheme stated above,the problem is solved at every step and the
solution updated iteratively using python.
Use an efficient matrix conversion method to iterate the values.
Invert the boundary values only once.
Calculate the left hand boundary values in terms of the neighbouring values i.e the first and the
last rows of the boundary values would vary from time step to time step.
pos = offset0+offset1; /* skip lower boundary layer (in x)*/
for (i=1; i<nx; i++) {
for (j=1; j<ny; j++) {
Considering the explicit scheme stated above,the problem is solved at every step and the
solution updated iteratively using python.
Use an efficient matrix conversion method to iterate the values.
Invert the boundary values only once.
Calculate the left hand boundary values in terms of the neighbouring values i.e the first and the
last rows of the boundary values would vary from time step to time step.
pos = offset0+offset1; /* skip lower boundary layer (in x)*/
for (i=1; i<nx; i++) {
for (j=1; j<ny; j++) {
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

for (k=1; k<nz; k++) {
++pos;
u[pos] = -um2[pos] + 2*um[pos] +
Cx2*(um[pos-offset0] - 2*um[pos] + um[pos+offset0]) +
Cy2*(um[pos-offset1] - 2*um[pos] + um[pos+offset1]) +
Cz2*(um[pos-1] - 2*um[pos] + um[pos+1]) +
dt2*source3D(x[i], y[j], z[k], t_old);
}
pos += 2; /* skip the two boundary layers (in z)*/
}
pos += 2*offset1; /* skip the two boundary layers (in y)*/
}
++pos;
u[pos] = -um2[pos] + 2*um[pos] +
Cx2*(um[pos-offset0] - 2*um[pos] + um[pos+offset0]) +
Cy2*(um[pos-offset1] - 2*um[pos] + um[pos+offset1]) +
Cz2*(um[pos-1] - 2*um[pos] + um[pos+1]) +
dt2*source3D(x[i], y[j], z[k], t_old);
}
pos += 2; /* skip the two boundary layers (in z)*/
}
pos += 2*offset1; /* skip the two boundary layers (in y)*/
}

REFERENCES:
1.D.Greenspan.2011.Introductory Numerical Analysis of Elliptic Boundary Value
Problems. New York: Wiley.
2.T.Henric.2009.Discrete Variable Methods in Ordinary Differential Equations. New York:
Wiley.
3.E.Isaacson& Keller,H.2007.Analysis of Numerical Methods. New York :Weley.
1.D.Greenspan.2011.Introductory Numerical Analysis of Elliptic Boundary Value
Problems. New York: Wiley.
2.T.Henric.2009.Discrete Variable Methods in Ordinary Differential Equations. New York:
Wiley.
3.E.Isaacson& Keller,H.2007.Analysis of Numerical Methods. New York :Weley.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 12
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.