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

Time varying boundary conditions needed in transient algorithms #1766

Closed
jgostick opened this issue Nov 19, 2020 · 5 comments
Closed

Time varying boundary conditions needed in transient algorithms #1766

jgostick opened this issue Nov 19, 2020 · 5 comments

Comments

@jgostick
Copy link
Member

No description provided.

@jgostick jgostick added this to the v3.0 milestone Feb 1, 2021
@jgostick jgostick changed the title Time varying boundary conditions needed in transient reactions Time varying boundary conditions needed in transient algorithms Jun 11, 2021
@jgostick
Copy link
Member Author

We need to discuss the best way to do this. The first option I think of is passing a pandas dataframe with each row being a pore and each column being the time step, with the entry in the array being the value to apply:

pore 0 10 20
0 1 0.5 0
3 1 0 0
11 1 1 1

This is a bit of a pain to program though, especially if there are a lot of pores and changes. For instance, how would you do sinusoidal BCs with this?

Another option might be to use pore-scale models, and assign them like source terms to certain pores (i.e. the boundary pores). The models could be things like sinusoids or heavyside functions.

Clearly we should look into other packages for how they do it.

Incidentally, this is actually possible with openpnm at present by just running the alg until t_final (i.e. 5 seconds), then setting t_initial to t_final, setting an new t_final (i.e 200 seconds), and putting the current solution (i.e. pore.concentration) as the initial conditions.

@jgostick
Copy link
Member Author

At present you can do this:

alg.set_IC(alg['pore.concentration'])
alg.settings['t_initial'] = alg.settings['t_final']
alg.settings['t_final'] = alg.settings['t_final'] + 20

One option is to add a continue method to alg:

alg.run()  # This ran from 0 to 10 seconds
alg.continue(20)  # This runs from 10 to 30

The continue method will need to look up the current time by looking t_final, then doing the specific steps mentioned above for the user (i.e. adjusting the settings and setting ICs).

@jgostick
Copy link
Member Author

jgostick commented Sep 8, 2021

This may also be possible using the planned callback functionality

@jgostick
Copy link
Member Author

@ma-sadeghi, is this issue still valid? I seem to remember you saying that the new transient solver approach made this feature unnecessary. Can you comment on this, or close?

@ma-sadeghi
Copy link
Member

I've created a prototype of the callback mechanism in PR #2254. Time-varying BCs can be applied using callbacks. In the same PR, you can find an example of setting time-dependent Dirichlet BC.

Probably we need some nice wrappers, like set_pulse_BC? Needs some thought...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants