Uploaded by gokul lp

Gauss, Poisson, Laplace Equations & Numerical Methods

advertisement
EE 735 MSL Assignment-1
Discussion
Gauss Law and Poisson’s Equation
• Gauss's Law is one of Maxwell's equations and relates the electric
flux through a closed surface to the charge enclosed within that
surface.
• Poisson's Equation arises from Gauss's Law when the electric
field is expressed in terms of the electric potential
Laplace’s Equation
• Laplace's Equation is a special case of Poisson's Equation
that applies in regions of space where there is no charge.
• Since it is time-independent, so describes the steady-state
behavior of a scalar function in space.
πœ•2 πœ•2 πœ•2
+
+
𝑉=0
πœ•π‘₯ πœ•π‘¦ πœ•π‘§
Discretizing derivatives
• Computers can only operate on discrete data. So, we need to convert
our continuous differential equations into a discrete form.
• Space can be discretized in x, y, and z directions by choosing an
appropriate number of points.
• We use the Taylor Series Expansion to discretize differentiation.
2 ′′
β„Ž
𝑓 π‘₯
′
𝑓 π‘₯ + β„Ž = 𝑓 π‘₯ + β„Žπ‘“ π‘₯ +
+β‹―
2!
2 ′′
β„Ž
𝑓 π‘₯
′
𝑓 π‘₯ − β„Ž = 𝑓 π‘₯ − β„Žπ‘“ π‘₯ +
+β‹―
2!
Discretizing derivatives
Forward Difference
𝑓 π‘₯+β„Ž −𝑓 π‘₯
′
⇒𝑓 π‘₯ =
− 𝑂 β„Ž2 …
β„Ž
Backward Difference
𝑉𝑖+1,𝑗 − 𝑉𝑖,𝑗
𝐸𝑖,𝑗 π‘₯ = −
βˆ†π‘₯𝑖,𝑗
𝑓 π‘₯ −𝑓 π‘₯−β„Ž
π‘₯ =
− 𝑂 β„Ž2 …
β„Ž
𝑉𝑖,𝑗 − 𝑉𝑖−1,𝑗
𝐸𝑖,𝑗 π‘₯ = −
βˆ†π‘₯𝑖,𝑗
⇒ 𝑓′
Central Difference
𝑓 π‘₯+β„Ž −𝑓 π‘₯−β„Ž
′
⇒𝑓 π‘₯ =
− 𝑂 β„Ž3 …
2β„Ž
𝑉𝑖+1,𝑗 − 𝑉𝑖−1,𝑗
𝐸𝑖,𝑗 π‘₯ = −
2βˆ†π‘₯𝑖,𝑗
Discretizing the Laplace Equation
∇2 𝑉 = 0,
𝑉𝑖+1,𝑗 − 𝑉𝑖,𝑗
𝑉𝑖,𝑗 − 𝑉𝑖−1,𝑗
−
βˆ†π‘₯𝑖,𝑗
βˆ†π‘₯𝑖,𝑗
βˆ†π‘₯𝑖,𝑗
πœ•2
πœ•2
πœ•2
+ +
πœ•π‘₯
πœ•π‘¦
πœ•π‘§
+
𝑉=0
𝑉𝑖,𝑗+1 − 𝑉𝑖,𝑗
𝑉𝑖,𝑗 − 𝑉𝑖,𝑗−1
−
βˆ†π‘¦π‘–,𝑗
βˆ†π‘¦π‘–,𝑗
βˆ†π‘¦π‘–,𝑗
𝑉𝑖+1,𝑗 − 2𝑉𝑖,𝑗 + 𝑉𝑖−1,𝑗 𝑉𝑖,𝑗+1 − 2𝑉𝑖,𝑗 + 𝑉𝑖,𝑗−1
+
=0
2
2
(βˆ†π‘₯𝑖,𝑗 )
(βˆ†π‘¦π‘–,𝑗 )
=0
Discretizing Laplace Equation
• Assuming the grid spacing to be common in the x and
y direction i.e. Δxi,j = Δyi,j
• We obtain the equation:
𝑉𝑖,𝑗 = (𝑉𝑖+1,𝑗 + 𝑉𝑖−1,𝑗 + 𝑉𝑖,𝑗+1 + 𝑉𝑖,𝑗−1 )/4
• So for our questions, we can consider the system as a
mesh of points where the potential at each point is
the average of the potential of its four nearest
neighbours.
𝑉𝑖,𝑗+1
𝑉𝑖−1,𝑗+1
𝑉𝑖+1,𝑗+1
βˆ†π‘¦π‘–,𝑗
𝑉𝑖−1,𝑗
𝑉𝑖,𝑗
𝑉𝑖−1,𝑗−1
𝑉𝑖+1,𝑗
𝑉𝑖,𝑗−1 𝑉
𝑖+1,𝑗−1
βˆ†π‘₯𝑖,𝑗
Implementing Boundary Conditions
• Boundary conditions are essential for solving partial differential equations (PDEs)
numerically, as they define the behavior of the solution at the edges of the domain.
Dirichlet Boundary Conditions
Neumann Boundary Conditions
Specifies the value of the function on
the boundary.
Used in defining potential at boundary
of the box and metal plates.
Specifies the value of the derivative
(flux) of the function normal to the
boundary.
Used at interface of two dielectric
mediums.
𝑉𝑖 = a (a is a constant)
𝐷𝑖−1 − 𝐷𝑖 = πœŒπ‘–
𝑉𝑖 − 𝑉𝑖−1
𝑉𝑖+1 − 𝑉𝑖
⇒ πœ–π‘–−1
= πœ–π‘–
βˆ†π‘₯𝑖−1
βˆ†π‘₯𝑖
Iterative Solution and Error Function
• To find out the exact potential field, we will have to use the potential
update equation: 𝑉𝑖,𝑗 = (𝑉𝑖+1,𝑗 + 𝑉𝑖−1,𝑗 + 𝑉𝑖,𝑗+1 + 𝑉𝑖,𝑗−1 )/4 multiple
times in a loop.
• But how do we know when to stop?
• Find out the error (difference) between the values of the potential
before and after the current iteration of the update equation. If the
error between the two is less than some tolerance value, then we can
stop.
• Use Root Mean Square Error (RMSE) or Mean Absolute Error (MAE) as
the error functions.
Estimating Electric field and Charge Density
After estimating the Potential in the complete region. Next we need to
estimate electric field and the charge distribution. This can be done using:
𝐸 = −𝛻V
πœ•π‘‰ πœ•π‘‰
𝐸=−
−
πœ•π‘₯ πœ•π‘¦
ρ= ε × π›». 𝐸
ρ= ε ×
πœ•πΈπ‘₯
πœ•πΈπ‘¦
+
πœ•π‘₯
πœ•π‘¦
Implement the gradient and divergence calculations in Python using numpy
function: np.gradient()
Thank You
Download