# Heat transfer problem: how to set up transient calcumations

**URL:** <https://festim.discourse.group/t/heat-transfer-problem-how-to-set-up-transient-calcumations/39>\
**Category:** User Support\
**Created:** [April 19, 2024, 4:52pm UTC](https://festim.discourse.group/t/heat-transfer-problem-how-to-set-up-transient-calcumations/39 "2024-04-19T16:52:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ialoveganicolas](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/ialoveganicolas/32/17_2.png) [@ialoveganicolas](https://festim.discourse.group/u/ialoveganicolas)\
**Post date:** [April 19, 2024, 4:52pm UTC](https://festim.discourse.group/t/heat-transfer-problem-how-to-set-up-transient-calcumations/39/1 "2024-04-19T16:52:47Z")

</div>

Hey everyone, I’m trying to set up heat transfer problem in FESTIM for the transient case. There is a good example on the stationary case in the workshop ([FESTIM-workshop/tasks/task07.ipynb at main · festim-dev/FESTIM-workshop · GitHub](https://github.com/festim-dev/FESTIM-workshop/blob/main/tasks/task07.ipynb)) which I was following.

I would like to simulate heat flux on the surface of 2 MW/m2 acting for a couple of seconds. For that, I introduced the material properties (rho and cp), but how to specify the initial condition?  
Ex., model.T = F.HeatTransferProblem(transient=True, initial\_condition=320) gives an error. Can someone help me with this?

---

<div class="post-metadata">

**Author:** ![remidm](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/remidm/32/4_2.png) [@remidm](https://festim.discourse.group/u/remidm)\
**Post date:** [April 19, 2024, 4:55pm UTC](https://festim.discourse.group/t/heat-transfer-problem-how-to-set-up-transient-calcumations/39/2 "2024-04-19T16:55:10Z")

</div>

Hi @ialoveganicolas

The docstrings of the class `HeatTransferProblem` specify the type of the initial\_condition argument:

```auto
Args:
    transient (bool, optional): If True, a transient simulation will
        be run. Defaults to True.
    initial_condition (festim.InitialCondition, optional): The initial condition.
        Only needed if transient is True.

```

It should be of type `festim.InitialCondition`.

Consider the following:

```python
import festim as F
import numpy as np

model = F.Simulation()

model.mesh = F.MeshFromVertices(vertices=np.linspace(0, 1, num=1000))

model.settings = F.Settings(
    absolute_tolerance=1e-10, relative_tolerance=1e-10, transient=True, final_time=100
)

mat = F.Material(id=1, D_0=1, E_D=0.2, thermal_cond=1, rho=1, heat_capacity=1)
model.materials = mat

model.T = F.HeatTransferProblem(
    transient=True, initial_condition=F.InitialCondition(field="T", value=300)
)

model.boundary_conditions = [F.DirichletBC(surfaces=[1, 2], value=400, field="T")]

model.sources = [F.Source(value=100, field="T", volume=1)]

model.dt = F.Stepsize(1)

model.initialise()
model.run()

import matplotlib.pyplot as plt
import fenics as f

f.plot(model.T.T)
plt.show()

```

![image](https://global.discourse-cdn.com/free1/uploads/festim/original/1X/90774ef94bf19f7f773f666ceba1636f0f8221ee.png)
