Solution for Cartesian Coordinates as 2D of Laplace Heat Equation
Solution of Laplace Heat Equation that expressing as a important point on various application field to analysis of heat distribution of system on a value for midpoint on established boundary conditions.
Solution of Laplace Heat Equation among popular using fields of Finite Different Method maybe can express.Shortly,we will determine
Next,as input a midpoint heat value.Finally,completing to mapping of heat distribution
A presentation for clear explanation about Principles of Method;
Where,chapter based on nxn type is explaining.Next,presented program shortly expressing to area distribution for nxn type;
# Simple Numerical Laplace Equation Solution using Finite Difference Method
import numpy as np
import matplotlib.pyplot as plt
# Set maximum iteration
maxIter = 500
# Set Dimension and delta
lenX = lenY = 20 #we set it rectangular
delta = 1
# Boundary condition
Ttop = 150
Tbottom = 40
Tleft = 30
Tright = 100
# Initial guess of interior grid
Tguess = 30
# Set colour interpolation and colour map
colorinterpolation = 50
colourMap = plt.cm.gnuplot2 #you can try: colourMap = plt.cm.coolwarm
# Set meshgrid
X, Y = np.meshgrid(np.arange(0, lenX), np.arange(0, lenY))
# Set array size and set the interior value with Tguess
T = np.empty((lenX, lenY))
T.fill(Tguess)
# Set Boundary condition
T[(lenY-1):, :] = Ttop
T[:1, :] = Tbottom
T[:, (lenX-1):] = Tright
T[:, :1] = Tleft
# Iteration (We assume that the iteration is convergence in maxIter = 500)
print("Please wait for a moment")
for iteration in range(0, maxIter):
for i in range(1, lenX-1, delta):
for j in range(1, lenY-1, delta):
T[i, j] = 0.25 * (T[i+1][j] + T[i-1][j] + T[i][j+1] + T[i][j-1])
print("Iteration finished")
# Configure the contour
plt.title("Contour of Temperature")
plt.contourf(X, Y, T, colorinterpolation, cmap=colourMap)
# Set Colorbar
plt.colorbar()
# Show the result in the plot window
plt.show()
print("")
for two conditions via 'considering to Heat Values' on Presentation;
Ttop
Tbottom
Tleft
Tright
input conclusions of parameters;
Note:Where,I have not realised any changing for lenX,lenY,delta parameter.Also;
MaxIter:considered maximum value for for loop at program.By the way,color interpolation:Expressing as contour frequency/thickness parameter
Add for Color Map function is presenting...
Have a nice day...
Solution of Laplace Heat Equation among popular using fields of Finite Different Method maybe can express.Shortly,we will determine
- heat boundary values as up-low and left-right
Next,as input a midpoint heat value.Finally,completing to mapping of heat distribution
A presentation for clear explanation about Principles of Method;
Where,chapter based on nxn type is explaining.Next,presented program shortly expressing to area distribution for nxn type;
# Simple Numerical Laplace Equation Solution using Finite Difference Method
import numpy as np
import matplotlib.pyplot as plt
# Set maximum iteration
maxIter = 500
# Set Dimension and delta
lenX = lenY = 20 #we set it rectangular
delta = 1
# Boundary condition
Ttop = 150
Tbottom = 40
Tleft = 30
Tright = 100
# Initial guess of interior grid
Tguess = 30
# Set colour interpolation and colour map
colorinterpolation = 50
colourMap = plt.cm.gnuplot2 #you can try: colourMap = plt.cm.coolwarm
# Set meshgrid
X, Y = np.meshgrid(np.arange(0, lenX), np.arange(0, lenY))
# Set array size and set the interior value with Tguess
T = np.empty((lenX, lenY))
T.fill(Tguess)
# Set Boundary condition
T[(lenY-1):, :] = Ttop
T[:1, :] = Tbottom
T[:, (lenX-1):] = Tright
T[:, :1] = Tleft
# Iteration (We assume that the iteration is convergence in maxIter = 500)
print("Please wait for a moment")
for iteration in range(0, maxIter):
for i in range(1, lenX-1, delta):
for j in range(1, lenY-1, delta):
T[i, j] = 0.25 * (T[i+1][j] + T[i-1][j] + T[i][j+1] + T[i][j-1])
print("Iteration finished")
# Configure the contour
plt.title("Contour of Temperature")
plt.contourf(X, Y, T, colorinterpolation, cmap=colourMap)
# Set Colorbar
plt.colorbar()
# Show the result in the plot window
plt.show()
print("")
for two conditions via 'considering to Heat Values' on Presentation;
Ttop
Tbottom
Tleft
Tright
input conclusions of parameters;
Note:Where,I have not realised any changing for lenX,lenY,delta parameter.Also;
MaxIter:considered maximum value for for loop at program.By the way,color interpolation:Expressing as contour frequency/thickness parameter
Add for Color Map function is presenting...
Have a nice day...
Yorumlar
Yorum Gönder