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

Add a apply_callbacks method to the Transient solver #2207

Open
jgostick opened this issue Dec 1, 2021 · 1 comment · May be fixed by #2254
Open

Add a apply_callbacks method to the Transient solver #2207

jgostick opened this issue Dec 1, 2021 · 1 comment · May be fixed by #2254

Comments

@jgostick
Copy link
Member

jgostick commented Dec 1, 2021

This is to address #1766, for the application of fancy BCs like ramps and oscillations in time.

    def _build_rhs(self):

        def ode_func(t, y):
            # TODO: add a cache mechanism
            self[self.settings["quantity"]] = y
            # TransientReactiveTransport._update_A_and_b(self)
            self.apply_callbacks()
            A = self.A.tocsc()
            b = self.b
            V = self.network[self.settings["pore_volume"]]
            return (-A.dot(y) + b) / V  # much faster than A*y

        return ode_func

And this will require a set_callback function somewhere: like rxn.set_callback(<???>)

@jgostick jgostick added this to the v3+ - Future Enhancements milestone Dec 1, 2021
@ma-sadeghi ma-sadeghi changed the title Add an "apply_callbacks" method to the Transient solver Add a "apply_callbacks" method to the Transient solver Dec 14, 2021
@ma-sadeghi ma-sadeghi self-assigned this Dec 16, 2021
@jgostick
Copy link
Member Author

We should make a private _add_callbacks method, in its current form, and use it for a while to get a better feel for how it should work. At present is works for transient BCs, but could be more powerful if done right.

@ma-sadeghi ma-sadeghi changed the title Add a "apply_callbacks" method to the Transient solver Add a apply_callbacks method to the Transient solver Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants