From 553979e44d68e03fbbe92c0a6422c837f3ac234c Mon Sep 17 00:00:00 2001 From: Debbie Zhuang Date: Mon, 18 Jul 2022 14:57:18 -0400 Subject: [PATCH] added checking to see if nonisothermal parameters are input --- configs/params_system.cfg | 4 ++-- mpet/config/configuration.py | 11 +++++++++++ mpet/config/schemas.py | 20 ++++++++++---------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/configs/params_system.cfg b/configs/params_system.cfg index b5498128..d0b49ea6 100644 --- a/configs/params_system.cfg +++ b/configs/params_system.cfg @@ -133,11 +133,11 @@ G_stddev_a = 0 [Thermal Parameters] # Heat capacity of anode, cathode, electrolyte material in J/(kg*K). cp_c = 700 -cp_l = 700 +cp_s = 700 cp_a = 700 # Mass density of anode, cathode, and electrolyte materialin kg/m^3. rhom_c = 2500 -rhom_l = 1100 +rhom_s = 1100 rhom_a = 2500 # Heat transfer coefficient with the cell separator (W/(m^2*K)) h_h = 2e4 diff --git a/mpet/config/configuration.py b/mpet/config/configuration.py index 794cc70a..da8b9dc6 100644 --- a/mpet/config/configuration.py +++ b/mpet/config/configuration.py @@ -510,6 +510,12 @@ def _scale_electrode_parameters(self): self['cp'][trode] = self['cp'][trode] / \ (self['k_h_ref'] * self['t_ref'] / (self['rho_ref']*self['L_ref']**2)) self['rhom'][trode] = self['rhom'][trode] / self['rho_ref'] + if self['nonisothermal']: + if self['rhom'][trode] == 0 or self['cp'][trode] == 0 or self['k_h'][trode] == 0: + raise Exception( + "Please provide all nonisothermal parameters for the " + + trode + + " electrode and ensure they are nonzero") if self[trode, 'lambda'] is not None: self[trode, 'lambda'] = self[trode, 'lambda'] / kT @@ -527,6 +533,11 @@ def _scale_electrode_parameters(self): self['cp']['s'] = self['cp']['s'] / \ (self['k_h_ref'] * self['t_ref'] / (self['rho_ref']*self['L_ref']**2)) self['rhom']['s'] = self['rhom']['s'] / self['rho_ref'] + if self['nonisothermal']: + if self['rhom']['s'] == 0 or self['cp']['s'] == 0 or self['k_h']['s'] == 0: + raise Exception( + "Please provide all nonisothermal parameters for the " + + " separator and ensure they are nonzero") def _scale_macroscopic_parameters(self, Vref): """ diff --git a/mpet/config/schemas.py b/mpet/config/schemas.py index fa7b6cd8..994875f0 100644 --- a/mpet/config/schemas.py +++ b/mpet/config/schemas.py @@ -114,16 +114,16 @@ def tobool(value): 'BruggExp_c': Use(float), 'BruggExp_a': Use(float), 'BruggExp_s': Use(float)}, - 'Thermal Parameters': {Optional('cp_c', default=1e8): Use(float), - Optional('cp_a', default=1e8): Use(float), - Optional('cp_s', default=1e8): Use(float), - Optional('rhom_c', default=0.2): Use(float), - Optional('rhom_a', default=0.2): Use(float), - Optional('rhom_s', default=0.2): Use(float), - Optional('k_h_c', default=0.2): Use(float), - Optional('k_h_a', default=0.2): Use(float), - Optional('k_h_s', default=0.2): Use(float), - Optional('h_h', default=500): Use(float), + 'Thermal Parameters': {Optional('cp_c', default=0): Use(float), + Optional('cp_a', default=0): Use(float), + Optional('cp_s', default=0): Use(float), + Optional('rhom_c', default=0): Use(float), + Optional('rhom_a', default=0): Use(float), + Optional('rhom_s', default=0): Use(float), + Optional('k_h_c', default=0): Use(float), + Optional('k_h_a', default=0): Use(float), + Optional('k_h_s', default=0): Use(float), + Optional('h_h', default=0): Use(float), Optional('entropy_heat_gen', default=False): Use(tobool)}, 'Electrolyte': {'c0': Use(float), 'zp': Use(int),