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

Derived quantity objects data and t attributes are not emptied at beginning of simulation #728

Open
RemDelaporteMathurin opened this issue Apr 1, 2024 · 1 comment · Fixed by #733 or #772
Labels
bug Something isn't working fenicsx Issue that is related to the fenicsx support good first issue Good for newcomers
Milestone

Comments

@RemDelaporteMathurin
Copy link
Collaborator

Describe the bug
When running the same simulation twice with derived quantities, their t and data attributes isn't reset to an empty list but instead values are just appended.

To Reproduce
Run the following on fenicsx

import festim as F

my_model = F.HydrogenTransportProblem()

my_model.mesh = F.Mesh1D([0, 1, 2, 3, 4])

tungsten = F.Material(D_0=1, E_D=0)

my_subdomain = F.VolumeSubdomain1D(id=1, borders=[0, 4], material=tungsten)
left_surface = F.SurfaceSubdomain1D(id=1, x=0)

my_model.subdomains = [my_subdomain, left_surface]

mobile_H = F.Species("H")
my_model.species = [mobile_H]

my_model.temperature = 400

left_flux = F.SurfaceFlux(field=mobile_H, surface=left_surface)

my_model.exports = [left_flux]

my_model.settings = F.Settings(
    atol=1e-15,
    rtol=1e-15,
    transient=False,
)

for i in range(3):
    my_model.initialise()
    my_model.run()

    print(left_flux.data)

Produces:

[0.0]
[0.0, 0.0]
[0.0, 0.0, 0.0]

Expected behavior
left_flux.data should be of length 1 everytime

@RemDelaporteMathurin RemDelaporteMathurin added bug Something isn't working good first issue Good for newcomers fenicsx Issue that is related to the fenicsx support labels Apr 1, 2024
@RemDelaporteMathurin
Copy link
Collaborator Author

I noticed this bug also occurs on the main branch!

@RemDelaporteMathurin RemDelaporteMathurin added this to the v1.3 milestone Apr 5, 2024
@RemDelaporteMathurin RemDelaporteMathurin linked a pull request Jun 20, 2024 that will close this issue
10 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 fenicsx Issue that is related to the fenicsx support good first issue Good for newcomers
Projects
None yet
1 participant