|
7 | 7 | import festim.boundary_conditions |
8 | 8 | import festim.species as _species |
9 | 9 | from festim import boundary_conditions |
10 | | -from festim.helpers import as_fenics_constant, get_interpolation_points |
| 10 | +from festim.helpers import get_interpolation_points |
11 | 11 | from festim.hydrogen_transport_problem import HydrogenTransportProblem |
12 | 12 |
|
13 | 13 |
|
14 | 14 | class HydrogenTransportProblemDiscontinuousChangeVar(HydrogenTransportProblem): |
15 | 15 | species: List[_species.Species] |
16 | 16 |
|
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 | | - |
43 | 17 | def create_formulation(self): |
44 | 18 | """Creates the formulation of the model""" |
45 | 19 |
|
@@ -86,6 +60,7 @@ def create_formulation(self): |
86 | 60 | K_S = reaction.volume.material.get_solubility_coefficient( |
87 | 61 | self.mesh.mesh, self.temperature_fenics, spe |
88 | 62 | ) |
| 63 | + assert isinstance(spe, _species.SpeciesChangeVar) |
89 | 64 | spe.concentration = spe.solution * K_S |
90 | 65 |
|
91 | 66 | # reactant |
@@ -143,6 +118,10 @@ def create_formulation(self): |
143 | 118 | spe.solution * spe.test_function * self.dx(vol.id) |
144 | 119 | ) |
145 | 120 |
|
| 121 | + def initialise_exports(self): |
| 122 | + self.override_post_processing_solution() |
| 123 | + super().initialise_exports() |
| 124 | + |
146 | 125 | def override_post_processing_solution(self): |
147 | 126 | # override the post-processing solution c = theta * K_S |
148 | 127 | Q0 = fem.functionspace(self.mesh.mesh, ("DG", 0)) |
|
0 commit comments