Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] TemperatureFromXDMF class not working in transient h transport #499

Closed
jhdark opened this issue Jul 15, 2022 · 1 comment · Fixed by #500 or #501
Closed

[BUG] TemperatureFromXDMF class not working in transient h transport #499

jhdark opened this issue Jul 15, 2022 · 1 comment · Fixed by #500 or #501
Labels
bug Something isn't working

Comments

@jhdark
Copy link
Collaborator

jhdark commented Jul 15, 2022

Describe the bug
When using the F.TemperatureFromXDMF in transient h transport cases the following error is produced:

Time stepping...
Traceback (most recent call last):
  File "test.py", line 51, in <module>
    my_model.run()
  File "/home/fenics/shared/FESTIM/FESTIM/generic_simulation.py", line 279, in run
    self.run_transient()
  File "/home/fenics/shared/FESTIM/FESTIM/generic_simulation.py", line 298, in run_transient
    self.iterate()
  File "/home/fenics/shared/FESTIM/FESTIM/generic_simulation.py", line 324, in iterate
    self.T.update(self.t)
  File "/home/fenics/shared/FESTIM/FESTIM/temperature/temperature.py", line 52, in update
    self.expression.t = t
AttributeError: 'NoneType' object has no attribute 't'

To Reproduce

import FESTIM as F
import fenics as f
import numpy as np

# create temperature field xdmf
my_model = F.Simulation(log_level=20)
my_model.mesh = F.MeshFromVertices(vertices=np.linspace(0, 1, num=100))
my_model.materials = F.Materials(
    [
        F.Material(
            id=1,
            D_0=1,
            E_D=1,
        ),
    ]
)
my_model.T = F.Temperature(value=300)
my_model.settings = F.Settings(
    transient=False,
    absolute_tolerance=1e12,
    relative_tolerance=1e-08,
)
my_model.initialise()
T = my_model.T.T
f.XDMFFile("temperature.xdmf").write_checkpoint(
    T, "T", 0, f.XDMFFile.Encoding.HDF5, append=False
)

# run transient simulation with TemperatureFromXDMF class

my_model.T = F.TemperatureFromXDMF(filename="temperature.xdmf", label="T")
my_model.dt = F.Stepsize(initial_value=1)
my_model.settings = F.Settings(
    transient=True,
    final_time=10,
    absolute_tolerance=1e12,
    relative_tolerance=1e-08,
)
my_model.initialise()
my_model.run()

this could potentially be fixed by adding an update function to the class:

def update(self, t):
        pass
@jhdark jhdark added the bug Something isn't working label Jul 15, 2022
@RemDelaporteMathurin RemDelaporteMathurin linked a pull request Jul 15, 2022 that will close this issue
10 tasks
@RemDelaporteMathurin
Copy link
Collaborator

This is fixed in 0.10.1

@RemDelaporteMathurin RemDelaporteMathurin linked a pull request Jul 28, 2022 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants