Converting the heat equation into a time independent heat equation

Hello everyone,

I am working on with fenics heat solver in order to model heat dissipation in a cylinder into a time independent function. In essence I am trying to remove the time variable of ‘dt’ in the function F. Any ideas how I would go about this ? I have my code below.

Thanks,

#!/usr/bin/env python
# coding: utf-8

# In[63]:


"""
FEniCS tutorial demo program: Diffusion of a Gaussian hill.

u'= Laplace(u) + f  in a square domain
u = u_D             on the boundary
u = u_0             at t = 0

u_D = f = 0

The initial condition u_0 is chosen as a Gaussian hill.
"""

from dolfin import *
from mshr import *
from fenics import *
import time

t = 2.0            # final time
num_steps = 50     # number of time steps
dt = t / num_steps # time step size

#Making a cylindrical geometry 10 cm radius and 15 cm height in S.I

cylinder = Cylinder(Point(0, 0, -7.5), Point(0, 0, 7.5), 5, 5)
domain = cylinder


# Making Mesh ( THe value corresponds to the mesh density)
mesh = generate_mesh(domain, 20) # generates 3D model of the cylindrical geometry in x, y, and z                 
axes. 
V = FunctionSpace(mesh, 'P', 1)

# Define boundary condition
def boundary(x, on_boundary):
return on_boundary

 # ( not sure what this really represents )
bc = DirichletBC(V, Constant(0), boundary)

# Define initial value ( not sure what this really represents )
u_0 = Expression('exp(-a*pow(x[0], 2) - a*pow(x[1], 2))',
             degree=2, a=5)
u_n = interpolate(u_0, V)

# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(0)

# ( not sure what this really represents )
F = u*v*dx + dt*dot(grad(u), grad(v))*dx - (u_n + dt*f)*v*dx
a, L = lhs(F), rhs(F)

# Create VTK file for saving solution
vtkfile = File('heat_gaussian/solution.pvd')



# Time-stepping
u = Function(V)
t = 0
for n in range(num_steps):

# Update current time
t += dt

# Compute solution
solve(a == L, u, bc)

# Save to file and plot solution
vtkfile << (u, t)
plot(u)

# Update previous solution
u_n.assign(u)



import matplotlib.pyplot as plt
plt.show()

The heat equation in itself is a time dependent equation.
For time independent problems, du/dt is simply equal to zero, and you are left with a Poisson problem -\nabla\cdot(\kappa \nabla u))=f in \Omega with corresponding boundary conditions.

2 Likes