From 3d385cb2bace857269f8ed9ba59b8e12e549d281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olav=20M=C3=B8yner?= Date: Mon, 2 Dec 2024 12:00:53 +0100 Subject: [PATCH] Make Bruggeman non-hardcoded / parameter in elyte --- src/models/battmo_types.jl | 3 +++ src/models/elyte.jl | 19 ++++++++++--------- src/setup/model_setup.jl | 1 + 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/models/battmo_types.jl b/src/models/battmo_types.jl index a6ef207..33471cf 100644 --- a/src/models/battmo_types.jl +++ b/src/models/battmo_types.jl @@ -37,6 +37,9 @@ minimum_value(::C) = 0. # relative_increment_limit(::C) = 0.1 struct Temperature <: Potential end +struct BruggemanCoefficient <: ScalarVariable end + +Jutul.default_value(model, ::BruggemanCoefficient) = 1.5 struct Conductivity <: ScalarVariable end struct Diffusivity <: ScalarVariable end diff --git a/src/models/elyte.jl b/src/models/elyte.jl index 5b417cc..ddc5749 100644 --- a/src/models/elyte.jl +++ b/src/models/elyte.jl @@ -60,8 +60,9 @@ function select_parameters!(S , ) S[:Temperature] = Temperature() + S[:BruggemanCoefficient] = BruggemanCoefficient() S[:VolumeFraction] = VolumeFraction() - + end function select_equations!(eqs , @@ -201,37 +202,37 @@ end # ? Does this maybe look better ? @jutul_secondary( -function update_conductivity!(kappa, kappa_def::Conductivity, model::ElectrolyteModel, Temperature, C, VolumeFraction, ix) +function update_conductivity!(kappa, kappa_def::Conductivity, model::ElectrolyteModel, Temperature, C, VolumeFraction, BruggemanCoefficient, ix) """ Register conductivity function """ # We use Bruggeman coefficient for i in ix - + b = BruggemanCoefficient[i] if Jutul.haskey(model.system.params, :conductivity_data) - @inbounds kappa[i] = model.system[:conductivity_func](C[i]) * VolumeFraction[i]^1.5 + @inbounds kappa[i] = model.system[:conductivity_func](C[i]) * VolumeFraction[i]^b else - @inbounds kappa[i] = model.system[:conductivity_func](C[i], Temperature[i]) * VolumeFraction[i]^1.5 + @inbounds kappa[i] = model.system[:conductivity_func](C[i], Temperature[i]) * VolumeFraction[i]^b end end end ) -@jutul_secondary function update_diffusivity!(D, D_def::Diffusivity, model::ElectrolyteModel, C, Temperature, VolumeFraction, ix) +@jutul_secondary function update_diffusivity!(D, D_def::Diffusivity, model::ElectrolyteModel, C, Temperature, VolumeFraction, BruggemanCoefficient, ix) """ Register diffusivity function """ for i in ix - + b = BruggemanCoefficient[i] if Jutul.haskey(model.system.params, :diffusivity_data) - @inbounds D[i] = model.system[:diffusivity_func](C[i])*VolumeFraction[i]^1.5 + @inbounds D[i] = model.system[:diffusivity_func](C[i])*VolumeFraction[i]^b else - @inbounds D[i] = model.system[:diffusivity_func](C[i], Temperature[i])*VolumeFraction[i]^1.5 + @inbounds D[i] = model.system[:diffusivity_func](C[i], Temperature[i])*VolumeFraction[i]^b end end diff --git a/src/setup/model_setup.jl b/src/setup/model_setup.jl index 24b448c..b639d57 100644 --- a/src/setup/model_setup.jl +++ b/src/setup/model_setup.jl @@ -626,6 +626,7 @@ function setup_battery_parameters(inputparams::InputParams, prm_elyte = Dict{Symbol, Any}() prm_elyte[:Temperature] = T0 + prm_elyte[:BruggemanCoefficient] = inputparams["Electrolyte"]["bruggemanCoefficient"] parameters[:Elyte] = setup_parameters(model[:Elyte], prm_elyte)