### Moving Heat source not dissipating (staying constant) pics included

388

views

3

Hey everyone I am trying to simulate a heat source (laser) moving over the surface of a plate. All six sides of the 3-D plate have robin's boundary conditions (newton's law of cooling). I am utilizing the PointSource (Dirac Delta) function as my heat source on the top surface but notice that as the laser has moves the temperature at the previous location stays constants as shown below. I am looking for a way to dissipate the heat as it moves.

Here is my code for the boundary conditions:

s = room temperature

k, s = thermal conductivity of material

```
mesh = BoxMesh(Point(x_min, y_min, z_min), Point(x_max, y_max, z_max), nx, ny, nz)
V = FunctionSpace(mesh, 'P', 1)
u_0 = Constant(0)
u_n = interpolate(u_0, V)
u = TrialFunction(V)
v = TestFunction(V)
# Define boundary condition
boundary_markers = FacetFunction('size_t', mesh)
class BoundaryX0(SubDomain):
tol = 1e-2
def inside(self, x, on_boundary):
return on_boundary and near(x[0], x_min, tol) or near(x[0], x_max, tol) \
or near(x[1], y_min, tol) or near(x[1], y_max, tol) \
or near(x[2], z_min, tol) or near(x[2], z_max, tol)
bx0 = BoundaryX0()
bx0.mark(boundary_markers, 0)
boundary_conditions = {0: {'Robin': (r, s)}}
ds = Measure('ds', domain=mesh, subdomain_data=boundary_markers)
integrals_R = []
for i in boundary_conditions:
if 'Robin' in boundary_conditions[i]:
r, s = boundary_conditions[i]['Robin']
integrals_R.append(r*(u - s)*v*ds(i))
```

defining variational problem and assembly:

```
# Define variational problem
F = u*v*dx + dt*kappa*dot(grad(u), grad(v))*dx + \
sum(integrals_R) - (u_n)*v*dx
a, L = lhs(F), rhs(F)
A, l = assemble_system(a, L)
# Create VTK file for saving solution
vtkfile = File('plate/robin_plate.pvd')
# Time-stepping
u = Function(V)
```

loops (2 sides of the heat source square seen above)

```
y = y_min + (y_max)/2
x = x_min + (x_max)/2
t = 0
for n in range(num_steps):
if x >= (x_min + (x_max)/2) and x <= (x_max - 1):
t += dt
x+= (abs(x_min) + x_max)/num_steps
laser = PointSource(V, Point(x, y, 0.25), melting_point)
laser.apply(l)
solve(A, u.vector(), l)
vtkfile << (u, t)
u_n.assign(u)
n = 0
for n in range(num_steps):
if y >= (y_min + (y_max)/2) and y <= (y_max - 1):
t += dt
y+= (abs(y_min) + y_max)/num_steps
laser = PointSource(V, Point(x, y, 0.25), melting_point)
laser.apply(l)
solve(A, u.vector(), l)
vtkfile << (u, t)
u_n.assign(u)
n = 0
```

Any help would be greatly appreciated!!

Best,

Terrence

Community: FEniCS Project

### 1 Answer

2

When you apply the boundary condition, the vector 'l' is changed. Have you tried re-assembling 'l' before applying the new point source?

Hey Evan thanks for the response. That did help to move the point source but now the heat source is jumping from one step to the next erasing the heat at the previous step (essentially the opposite of the previous problem)

written
9 months ago by
Terrence

Perhaps the heat conduction is too high? That is, the coefficient of exchange 'r'.

written
9 months ago by
pf4d

I just messed around with all the material properties and parameters and its still acting the same way.

written
9 months ago by
Terrence

I need it to move the heat source one step over and dissipate the previous step. Do you think I have an issue in my loop

written
9 months ago by
Terrence

1

I dunno. You might try creating a simple one- or two-dimensional example that you can apply the point source too and simply remove. This might be easier to diagnose.

written
9 months ago by
pf4d

Hey it dissipates perfectly in 2-D so i wonder what the problem is in 3-D. I think It's probably my boundary conditions on the face the heat source is applied to.

written
9 months ago by
Terrence

Please login to add an answer/comment or follow this question.