festim-dev / festim-dev/FESTIM

Issue with assigning ICs in separate volumes for Heat Transfer Problem

Open
#1,217 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
135
Forks
45
Avg merge
3d 23h
Merged PRs (30d)
14

Description

**Describe the bug**
FESTIM version 2.1
In FESTIM docs tutorials section "Initial conditions -> Temperature", initial temperatures are set using:
```python
model.initial_conditions = [
F.InitialTemperature(value=300, volume=vol)
]
```
however when attempting to assign initial conditions to a heat transfer model, only the attribute "initial_condition" is available, not the plural, which only allows a single initial condition to be set within a single volume, whereas documentation suggests initial conditions can be set in a list for discontinuous problems with multiple volume subdomains. Setting model.initial_conditions does not throw an error despite not actually setting any conditions.

**To Reproduce**
Steps to reproduce the behaviour:

Set e.g.
```python
model.initial_conditions = [
F.InitialTemperature(value=temp, volume=vol1),
F.InitialTemperature(value=temp, volume=vol2),
F.InitialTemperature(value=temp, volume=vol3),
]
```
and print
```
model.u_n.x.array.min(),
model.u_n.x.array.max()
```
after model.initialise() and before model.run() which will return "0.0 0.0", whereas when using initial_condition returns "temp temp" (i.e. the value of temp, e.g. 300.0 if temp=300.0)

Also attempt to set multiple volumes to a single initial condition
```
model.initial_condition = F.InitialTemperature(value=temp, volume=model.volume_subdomains)
```

which will raise an error
```
TypeError("volume must be of type festim.VolumeSubdomain")
```
**Expected behavior**
Expected to be able to set initial conditions in a list for multiple volume subdomains using model.initial_conditions = [], as described within "https://festim-workshop.readthedocs.io/en/latest/content/initial_conditions/temperature.html"

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the initial-conditions temperature tutorial linked in the issue and reproduce the model.u_n.x.array check using multiple volume subdomains. Compare the documented initial_conditions list with the model's available initial_condition handling and volume validation. Done means multiple volume-specific temperatures are applied after initialise() and the documentation matches the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.