# Several volumetric sources of heat

**URL:** <https://festim.discourse.group/t/several-volumetric-sources-of-heat/80>\
**Category:** User Support\
**Created:** [November 1, 2024, 12:42pm UTC](https://festim.discourse.group/t/several-volumetric-sources-of-heat/80 "2024-11-01T12:42:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![miklavrent](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/miklavrent/32/94_2.png) [@miklavrent](https://festim.discourse.group/u/miklavrent)\
**Post date:** [November 1, 2024, 12:42pm UTC](https://festim.discourse.group/t/several-volumetric-sources-of-heat/80/1 "2024-11-01T12:42:51Z")

</div>

Hi,

Is it possible to have different volumetric sources of heat in different parts of a system? Imagine a two layered first wall with neutrons generating different amount of heat in tungsten and steel. I was only able to find something like this:

my\_model.sources = [  
F.Source(value=5e8, volume=1, field=“T”),  
]

Where volume=1 means all of the system (correct?). Can I create say volume=2 for tungsten part and make a separate source of heat for it?

Best wishes,

Mikhail

---

<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:** [November 1, 2024, 12:54pm UTC](https://festim.discourse.group/t/several-volumetric-sources-of-heat/80/2 "2024-11-01T12:54:58Z")

</div>

Hi Mikhail,

Yes it is totally possible. Consider [this section](https://festim.readthedocs.io/en/latest/userguide/sources.html#volumetric-sources) of the documentation:

You can set different volumetric heat sources with

```python
import festim as F

my_model = F.Simulation()

my_model.sources = [
    F.Source(value=10, volume=1, field="T"),
    F.Source(value=20, volume=2, field="T"),
    ]

```

---

<div class="post-metadata">

**Author:** ![miklavrent](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/miklavrent/32/94_2.png) [@miklavrent](https://festim.discourse.group/u/miklavrent)\
**Post date:** [November 1, 2024, 1:04pm UTC](https://festim.discourse.group/t/several-volumetric-sources-of-heat/80/3 "2024-11-01T13:04:17Z")

</div>

Hi Remi,

Thanks a lot! This brings another question: how to assign different numbers to different parts of a system? I just couldn’t find an example with e.g. volume=1 for tungsten, volume=2 for steel etc.

---

<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:** [November 1, 2024, 1:10pm UTC](https://festim.discourse.group/t/several-volumetric-sources-of-heat/80/4 "2024-11-01T13:10:58Z")

</div>

Does this help?  
In this script, we define a steady state heat transfer problem. The H transport problem is empty (ie. no boundary conditions or sources, so c=0) just to focus on the heat transfer pb.

If I understand correctly, you want to define different materials and assign different material properties, correct? You can do this by giving several `F.Material` objects to the `Simulation` each will have an `id` corresponding to the volume id and its own set of parameters (diffusivity, solubility, thermal properties, etc.)

Consider this [section](https://festim.readthedocs.io/en/latest/userguide/materials.html#materials) of the documentation and [this tutorial](https://github.com/festim-dev/FESTIM-workshop/blob/main/tasks/task08.ipynb)

```python
import festim as F

my_model = F.Simulation()

my_model.T = F.HeatTransferProblem(transient=False)

# ------ Mesh ------

vertices = np.concatenate([np.linspace(0, 0.5), np.linspace(0.5, 1)])
my_model.mesh = F.MeshFromVertices(vertices)

# ------ Materials ------

material_1 = F.Material(id=1, D_0=1, E_D=0, thermal_cond=2, borders=[0, 0.5])
material_2 = F.Material(id=2, D_0=1, E_D=0, thermal_cond=30, borders=[0.5, 1])

my_model.materials = [material_1, material_2]

# ------ Volumetric heat sources ------

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

# ------ Boundary conditions ------

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

# ------ Exports, settings ------

my_model.exports = [
    F.XDMFExport(field="T", checkpoint=False)
]

my_model.settings = F.Settings(
    absolute_tolerance=1e-10,
    relative_tolerance=1e-10,
    transient=False,
)

my_model.initialise()
my_model.run()

```

Opening the XDMF file in paraview you obtain:

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

---

<div class="post-metadata">

**Author:** ![miklavrent](https://yyz2.discourse-cdn.com/free1/user_avatar/festim.discourse.group/miklavrent/32/94_2.png) [@miklavrent](https://festim.discourse.group/u/miklavrent)\
**Post date:** [November 1, 2024, 1:38pm UTC](https://festim.discourse.group/t/several-volumetric-sources-of-heat/80/5 "2024-11-01T13:38:25Z")

</div>

Thank you Remi, so volume id is the same as material id, this solves my problem!

Best wishes,

Mikhail

---

<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:** [November 1, 2024, 1:46pm UTC](https://festim.discourse.group/t/several-volumetric-sources-of-heat/80/6 "2024-11-01T13:46:24Z")

</div>

Yes exactly, when in doubt, have a look at the documentation for the class.

[Here](https://festim.readthedocs.io/en/latest/api/sources.html#festim.Source) for `F.Source`:

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