Describe the bug
Using any of the extrema quantities on HydrogenTransportProblemDiscontinuous -- MaximumVolume,, MaximumSurface, MinimumVolume or MinimumSurface--leads to the AttributeErrors '[Minimum/Maximum]Volume' object has no attribute 'volume_meshtags' and [Minimum/Maximum]Surface object has no attribute 'facet_meshtags', respectively.
I'll link a PR shortly to provide a fix for this
EDIT: PR is #1226 . Note that this is rather temporary as https://github.com/ee-nn/FESTIM/tree/derived-quantities-revamp will refactor these capabilities after #1216 is released
Full traceback for volume
Traceback (most recent call last):
File "~/min_max_export_bug.py", line 71, in <module>
my_model.run()
~~~~~~~~~~~~^^
File "~/src/festim/hydrogen_transport_problem.py", line 2376, in run
self.post_processing()
~~~~~~~~~~~~~~~~~~~~^^
File "~/src/festim/hydrogen_transport_problem.py", line 2264, in post_processing
export.compute()
~~~~~~~~~~~~~~^^
File "~/src/festim/exports/minimum_volume.py", line 32, in compute
entities = self.volume_meshtags.find(self.volume.id)
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MinimumVolume' object has no attribute 'volume_meshtags'
Full traceback for surface
File "~/min_max_export_bug.py", line 73, in <module>
my_model.run()
~~~~~~~~~~~~^^
File "~/src/festim/hydrogen_transport_problem.py", line 2376, in run
self.post_processing()
~~~~~~~~~~~~~~~~~~~~^^
File "~/src/festim/hydrogen_transport_problem.py", line 2250, in post_processing
export.compute()
~~~~~~~~~~~~~~^^
File "~/src/festim/exports/minimum_surface.py", line 32, in compute
entities = self.facet_meshtags.find(self.surface.id)
^^^^^^^^^^^^^^^^^^^
AttributeError: 'MinimumSurface' object has no attribute 'facet_meshtags'
To Reproduce
Add one of the above extrema objects to the following MWE (a MinimumSurface is currently enabled):
from mpi4py import MPI
import numpy as np
from dolfinx.mesh import create_unit_square
import festim as F
fenics_mesh = create_unit_square(MPI.COMM_WORLD, 10, 10)
festim_mesh = F.Mesh(fenics_mesh)
my_model = F.HydrogenTransportProblemDiscontinuous()
# Top material (Material A)
material_top = F.Material(name="Material_A", D_0=1, E_D=0, K_S_0=2, E_K_S=0)
# Bottom material (Material B)
material_bottom = F.Material(name="Material_B", D_0=2, E_D=0, K_S_0=3, E_K_S=0)
top_volume = F.VolumeSubdomain(
id=3, material=material_top, locator=lambda x: x[1] >= 0.5
)
bottom_volume = F.VolumeSubdomain(
id=4, material=material_bottom, locator=lambda x: x[1] <= 0.5
)
top_surface = F.SurfaceSubdomain(id=1, locator=lambda x: np.isclose(x[1], 1.0))
bottom_surface = F.SurfaceSubdomain(id=2, locator=lambda x: np.isclose(x[1], 0.0))
my_model.mesh = festim_mesh
my_model.subdomains = [top_surface, bottom_surface, top_volume, bottom_volume]
my_model.interfaces = [F.Interface(5, (bottom_volume, top_volume), penalty_term=1000)]
H = F.Species("H")
my_model.species = [H]
for species in my_model.species:
species.subdomains = [bottom_volume, top_volume]
my_model.temperature = 400
my_model.boundary_conditions = [
F.FixedConcentrationBC(subdomain=top_surface, value=1.0, species=H),
F.FixedConcentrationBC(subdomain=bottom_surface, value=0.0, species=H),
]
my_model.settings = F.Settings(atol=1e-10, rtol=1e-10, transient=False)
# bottom_min = F.MinimumVolume(field=H, volume=bottom_volume, filename="bottom_min.csv")
# bottom_max = F.MaximumVolume(field=H, volume=bottom_volume, filename="bottom_max.csv")
bottom_surf_min = F.MinimumSurface(
field=H, surface=bottom_surface, filename="bottom_surf_min.csv"
)
# bottom_surf_max = F.MaximumSurface(
# field=H, surface=bottom_surface, filename="bottom_surf_max.csv"
# )
my_model.exports = [bottom_surf_min]
my_model.initialise()
my_model.run()
Expected behavior
The min/max concentrations on the given surface or volume subdomains should be exported to a .csv file.
Describe the bug
Using any of the extrema quantities on
HydrogenTransportProblemDiscontinuous--MaximumVolume,,MaximumSurface,MinimumVolumeorMinimumSurface--leads to the AttributeErrors'[Minimum/Maximum]Volume' object has no attribute 'volume_meshtags'and[Minimum/Maximum]Surface object has no attribute 'facet_meshtags', respectively.I'll link a PR shortly to provide a fix for this
EDIT: PR is #1226 . Note that this is rather temporary as https://github.com/ee-nn/FESTIM/tree/derived-quantities-revamp will refactor these capabilities after #1216 is released
Full traceback for volume
Full traceback for surface
To Reproduce
Add one of the above extrema objects to the following MWE (a
MinimumSurfaceis currently enabled):Expected behavior
The min/max concentrations on the given surface or volume subdomains should be exported to a .csv file.