Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Bruggeman non-hardcoded / parameter in elyte #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/models/battmo_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions src/models/elyte.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ function select_parameters!(S ,
)

S[:Temperature] = Temperature()
S[:BruggemanCoefficient] = BruggemanCoefficient()
S[:VolumeFraction] = VolumeFraction()

end

function select_equations!(eqs ,
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/setup/model_setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading