pybamm-team / PyBaMM

Fast and flexible physics-based battery models in Python
https://www.pybamm.org/
BSD 3-Clause "New" or "Revised" License
1.11k stars 546 forks source link

Adding customized function for tortuosity #2111

Closed amirsh213 closed 5 months ago

amirsh213 commented 2 years ago

Description

I was wondering if it is possible to enable adding customized non-Bruggeman functions to define tortuosity or MacMullin number as a function of porosity?

Thanks.

Motivation

No response

Possible Implementation

No response

Additional context

No response

rtimms commented 2 years ago

You could create a new submodel in this folder. The simplest thing would be to copy the Bruggeman submodel and edit it to whatever function you want.

You could either hard-code some functional form with some new scalar parameters, or allow a general function of porosity/active material by adding a new FunctionParameter

amirsh213 commented 2 years ago

If I copy the Bruggeman submodel and add my function, how should I have the model use this custom submodel and not the Bruggeman?

Also, can you please elaborate on how this FunctionParamter works? I want to add (and change) two parameters for my customized equation in the "negative_electrode" folder like where you defined "Negative electrode Bruggeman coefficient (electrolyte)" in the CSV file. Should I define those parameters here?

I'm also wondering how you defined your effective properties e.g. electrolyte diffusivity/conductivity? I get tortuosity smaller than 1 which is confusing. Where should I define my effective properties the way I want?

rtimms commented 2 years ago

I'm currently working on adding extra documentation around how to use submodels, but there is an example of swapping out submodels here. If you wanted to integrate your new submodel into the code you could make it so that you pass an option to the model to set the tortuosity. Take a look at the base battery model to see how options are handled.

For FunctionParameters you could look at how particle radius is defined, and see this example for how to provide a function. Yes, you can define your new parameters in GeometricParameters.

See this discussion around how the properties are defined (we actually define a "transport efficiency", not a tortuosity).

TomTranter commented 1 year ago

Hi @amirsh213 , how's it going? We are running a hackathon on 29th of March in Oxford and this issue is potentially one we could work on together. You'd be welcome to join us if you can make it. Tickets are free but limited availability https://www.eventbrite.co.uk/e/pybamm-hackathon-tickets-517334430207?keep_tld=1 If you have already made some progress on this issue then let us know and we will exclude it from the options to work on during the day. Thanks

TomTranter commented 1 year ago

Hackathon info