festim-dev / FESTIM

Coupled hydrogen/tritium transport and heat transfer modelling using FEniCS
https://festim.readthedocs.io/en/stable/
Apache License 2.0
90 stars 23 forks source link

Wrong units for `SurfaceFluxCylindrical` #828

Closed RemDelaporteMathurin closed 2 months ago

RemDelaporteMathurin commented 2 months ago
import festim as F
import numpy as np

my_model = F.Simulation()
inner_radius = 0.1e-3
thickness = 0.2e-3
my_model.mesh = F.MeshFromVertices(
    np.linspace(inner_radius, inner_radius + thickness, num=100),
    type="cylindrical",
)
my_model.materials =  F.Material(id=1, D_0=1, E_D=0)

my_model.T = 500

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

my_flux = F.SurfaceFluxCylindrical(field="solute", surface=1)
derived_quantities = F.DerivedQuantities(
    [my_flux],
    show_units=True,
)

my_model.exports = [derived_quantities]

my_model.initialise()
my_model.run()

print(my_flux.export_units)

Produces

H m-2 s-1

When it should be

H s-1

In 2D axisymmetric

and

H m-1 s-1

In 1D axisymmetric

RemDelaporteMathurin commented 2 months ago

In the same vein, the units in the derived quantity file is wrong since it always shows (H s-1) but that's only true in 2D cylindrical.

Otherwise shold be H m-1 s-1.

We should fix this and release it in a patch for 1.3