Skip to content

Commit 33dbfeb

Browse files
no need to override initialise()
1 parent d061987 commit 33dbfeb

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

src/festim/problem_change_of_var.py

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,13 @@
77
import festim.boundary_conditions
88
import festim.species as _species
99
from festim import boundary_conditions
10-
from festim.helpers import as_fenics_constant, get_interpolation_points
10+
from festim.helpers import get_interpolation_points
1111
from festim.hydrogen_transport_problem import HydrogenTransportProblem
1212

1313

1414
class HydrogenTransportProblemDiscontinuousChangeVar(HydrogenTransportProblem):
1515
species: List[_species.Species]
1616

17-
def initialise(self):
18-
self.create_species_from_traps()
19-
self.define_function_spaces()
20-
self.define_meshtags_and_measures()
21-
self.assign_functions_to_species()
22-
23-
self.t = fem.Constant(self.mesh.mesh, 0.0)
24-
if self.settings.transient:
25-
# TODO should raise error if no stepsize is provided
26-
# TODO Should this be an attribute of festim.Stepsize?
27-
self._dt = as_fenics_constant(
28-
self.settings.stepsize.initial_value, self.mesh.mesh
29-
)
30-
31-
self.create_implicit_species_value_fenics()
32-
33-
self.define_temperature()
34-
self.define_boundary_conditions()
35-
self.convert_source_input_values_to_fenics_objects()
36-
self.create_flux_values_fenics()
37-
self.create_initial_conditions()
38-
self.create_formulation()
39-
self.create_solver()
40-
self.override_post_processing_solution() # NOTE this is the only difference with parent class
41-
self.initialise_exports()
42-
4317
def create_formulation(self):
4418
"""Creates the formulation of the model"""
4519

@@ -86,6 +60,7 @@ def create_formulation(self):
8660
K_S = reaction.volume.material.get_solubility_coefficient(
8761
self.mesh.mesh, self.temperature_fenics, spe
8862
)
63+
assert isinstance(spe, _species.SpeciesChangeVar)
8964
spe.concentration = spe.solution * K_S
9065

9166
# reactant
@@ -143,6 +118,10 @@ def create_formulation(self):
143118
spe.solution * spe.test_function * self.dx(vol.id)
144119
)
145120

121+
def initialise_exports(self):
122+
self.override_post_processing_solution()
123+
super().initialise_exports()
124+
146125
def override_post_processing_solution(self):
147126
# override the post-processing solution c = theta * K_S
148127
Q0 = fem.functionspace(self.mesh.mesh, ("DG", 0))

0 commit comments

Comments
 (0)