Skip to content

Commit

Permalink
save diffusivity variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rtimms committed Mar 6, 2023
1 parent 9d5f5a1 commit a09fc8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
20 changes: 7 additions & 13 deletions pybamm/models/submodels/particle/fickian_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,28 +216,22 @@ def get_coupled_variables(self, variables):
)

if self.size_distribution is True:
R = variables[f"{Domain} {phase_name}particle sizes [m]"]
# Size-dependent flux variables
variables.update(self._get_standard_flux_distribution_variables(N_s))
f_a_dist = self.phase_param.f_a_dist(R)
# Size-averaged flux variables (perform area-weighted avg manually as flux
# evals on edges)
N_s = pybamm.Integral(f_a_dist * N_s, R)

# Volume-weighted average for effective diffusivity
variables.update(
self._get_standard_diffusivity_distribution_variables(D_eff)
)
variables.update(self._get_standard_flux_distribution_variables(N_s))
# Size-averaged flux variables
R = variables[f"{Domain} {phase_name}particle sizes [m]"]
f_a_dist = self.phase_param.f_a_dist(R)
D_eff = pybamm.Integral(f_a_dist * D_eff, R)
N_s = pybamm.Integral(f_a_dist * N_s, R)

if self.x_average is True:
D_eff = pybamm.SecondaryBroadcast(D_eff, [f"{domain} electrode"])
N_s = pybamm.SecondaryBroadcast(N_s, [f"{domain} electrode"])

if self.size_distribution is False:
# Save diffusivity variables for the no-size-distrbution case
# (they were saved earlier for the size-distribution case)
variables.update(self._get_standard_diffusivity_variables(D_eff))

variables.update(self._get_standard_diffusivity_variables(D_eff))
variables.update(self._get_standard_flux_variables(N_s))

return variables
Expand Down
4 changes: 3 additions & 1 deletion pybamm/models/submodels/particle_mechanics/base_mechanics.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@ def _get_mechanical_results(self, variables):
# Averages
stress_r_surf_av = pybamm.x_average(stress_r_surf)
stress_t_surf_av = pybamm.x_average(stress_t_surf)
disp_surf_av = pybamm.x_average(disp_surf)

variables.update(
{
f"{Domain} particle surface tangential stress [Pa]": stress_t_surf,
f"{Domain} particle surface radial stress [Pa]": stress_r_surf,
f"{Domain} particle surface tangential stress [Pa]": stress_t_surf,
f"{Domain} particle surface displacement [m]": disp_surf,
f"X-averaged {domain} particle surface "
"radial stress [Pa]": stress_r_surf_av,
f"X-averaged {domain} particle surface "
"tangential stress [Pa]": stress_t_surf_av,
f"X-averaged {domain} particle surface displacement [m]": disp_surf_av,
f"{Domain} electrode thickness change [m]": electrode_thickness_change,
}
)
Expand Down

0 comments on commit a09fc8d

Please sign in to comment.