Skip to content

Commit

Permalink
field always list, refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdark committed Oct 23, 2023
1 parent 6e32e79 commit 9a4475c
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions festim/hydrogen_transport_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,9 @@ def defing_export_writers(self):
for export in self.exports:
# TODO implement when export.field is an int or str
# then find solution from index of species
if isinstance(export.field, str):
export.field = F.find_species_from_name(field, self.species)
elif isinstance(export.field, list):
for idx, field in enumerate(export.field):
if isinstance(field, str):
export.field[idx] = F.find_species_from_name(
field, self.species
)
for idx, field in enumerate(export.field):
if isinstance(field, str):
export.field[idx] = F.find_species_from_name(field, self.species)

if isinstance(export, (F.VTXExport, F.XDMFExport)):
export.define_writer(MPI.COMM_WORLD)
Expand Down Expand Up @@ -241,8 +236,7 @@ def define_boundary_conditions(self):
for bc in self.boundary_conditions:
if isinstance(bc.species, str):
# if name of species is given then replace with species object
name = bc.species
bc.species = F.find_species_from_name(name, self.species)
bc.species = F.find_species_from_name(bc.species, self.species)
if isinstance(bc, F.DirichletBC):
bc_dofs = bc.define_surface_subdomain_dofs(
self.facet_meshtags, self.mesh, bc.species.sub_function_space
Expand Down

0 comments on commit 9a4475c

Please sign in to comment.