Line
- class grheat.line_source.Line(yp, zp, tp=0, diffusivity=1.4557999999999998e-07, capacity=4184000.0, boundary='infinite')[source]
Bases:
objectProvides Green’s function heat transfer solutions for a line source.
The Line class encapsulates the behavior of a line source situated in a semi-infinite medium with a surface defined at z=0. The line source extends horizontally along all x-values passing through coordinates (yp, zp). At time tp, the line source delivers a heat impulse of 1 Joule per meter along its length.
- Boundary conditions at z=0 can be:
‘infinite’: No boundary (infinite medium).
‘adiabatic’: No heat flow across the boundary.
‘zero’: Boundary is fixed at T=0.
- yp
y-coordinate of the line source. [meters]
- Type:
scalar
- zp
z-coordinate of the line source. [meters]
- Type:
scalar
- diffusivity
Thermal diffusivity of the medium. [m^2/s]
- Type:
scalar
- capacity
Volumetric heat capacity of the medium. [J/degree/m^3]
- Type:
scalar
- boundary
Boundary condition at z=0. [‘infinite’, ‘adiabatic’, ‘zero’]
- Type:
str
Methods Summary
continuous(y, z, t)Calculate temperature rise due to a 1W/m continuous x-line source.
instantaneous(y, z, t)Calculate the temperature rise due to a 1 J/m instant x-line source.
pulsed(y, z, t, t_pulse)Calculate temperature rise due to a 1 J/m pulsed x-line source.
Methods Documentation
- continuous(y, z, t)[source]
Calculate temperature rise due to a 1W/m continuous x-line source.
The x-line source turns on at t=0 and passes through the coordinates (yp, zp).
Reference: Carslaw and Jaeger (1959), page 261, Equation 10.4(5).
- Parameters:
y (scalar) – The y-coordinate for the desired temperature location. [meters]
z (scalar) – The z-coordinate for the desired temperature location. [meters]
t (scalar or array) – Time(s) of desired temperature. [seconds]
- Returns:
scalar or array – Temperature increase in degrees Celsius [°C].
Example
The following example demonstrates how to use this method to calculate and plot the temperature rise over time due to a continuous line source 1mm deep that turned on at t=0:
import grheat import numpy as np import matplotlib.pyplot as plt t = np.linspace(0, 500, 100) / 1000 # seconds y, z = 0, 0 # meters yp, zp = 0, 0.001 # meters line = grheat.Line(yp, zp) T = line.continuous(y, z, t) plt.plot(t * 1000, T, color='blue') plt.xlabel("Time (ms)") plt.ylabel("Surface Temperature Increase (°C)") plt.title("Continuous Line Source at 1mm depth") plt.show()
- instantaneous(y, z, t)[source]
Calculate the temperature rise due to a 1 J/m instant x-line source.
This method computes the temperature rise at a specified location and time due to an instant x-line source. The line source is parallel to the x-axis and passes through the coordinates (yp, zp).
- Parameters:
y (scalar or array) – The y-coordinate(s) for the temperature location. [meters]
z (scalar or array) – The z-coordinate(s) for the temperature location. [meters]
t (scalar or array) – The time(s) of the temperature. [seconds]
- Returns:
scalar – Temperature increase in degrees Celsius [°C].
Example
The following example demonstrates how to use this method to calculate and plot the temperature rise over time due to an instant line source:
import grheat import numpy as np import matplotlib.pyplot as plt t = np.linspace(0, 500, 100) / 1000 # seconds y, z = 0, 0 # meters yp, zp = 0, 0.001 # meters line = grheat.Line(yp, zp) T = line.instantaneous(y, z, t) plt.plot(t * 1000, T, color='blue') plt.xlabel("Time (ms)") plt.ylabel("Surface Temperature Increase (°C)") plt.title("Instantaneous Line Source at 1mm depth") plt.show()
- pulsed(y, z, t, t_pulse)[source]
Calculate temperature rise due to a 1 J/m pulsed x-line source.
This method computes the temperature rise at a specified location and time due to a pulsed x-line source. 1 J/m of heat is deposited along the x-line passing through the coordinates (yp, zp) from t=0 to t=t_pulse.
- Parameters:
y (scalar or array) – The y-coordinate for the desired temperature location. [meters]
z (scalar or array) – The z-coordinate for the desired temperature location. [meters]
t (scalar or array) – Time(s) of desired temperature. [seconds]
t_pulse (scalar) – Duration of the pulse. [seconds]
- Returns:
scalar or array – Temperature increase in degrees Celsius [°C].
Example
The following example demonstrates how to use this method to calculate and plot the temperature rise over time due to a pulsed line source 1mm deep:
import grheat import numpy as np import matplotlib.pyplot as plt t = np.linspace(0, 500, 100) / 1000 # seconds y, z = 0, 0 # meters yp, zp = 0, 0.001 # meters t_pulse = 0.3 line = grheat.Line(yp, zp) T = line.pulsed(y, z, t, t_pulse) plt.plot(t * 1000, T, color='blue') plt.xlabel("Time (ms)") plt.ylabel("Surface Temperature Increase (°C)") plt.title("Pulsed Line Source at 1mm depth") plt.show()