Skip to content

Conversation

@ddundo
Copy link
Member

@ddundo ddundo commented Feb 20, 2025

Closes #157.

Based on Animate's bubble shear demo.

@ddundo ddundo added documentation Improvements or additions to documentation PRIORITY We should address this ASAP labels Feb 20, 2025
@ddundo ddundo requested a review from joewallwork February 20, 2025 16:41
@ddundo
Copy link
Member Author

ddundo commented Feb 21, 2025

Just to clarify what I meant during the meeting when I suggested passing args/kwargs to the monitor function:

def monitor(mesh, solution):
   ...

def run_simulation(...):
    ...
    mover = MongeAmpereMover(...)
    while float(t) < t_end + 0.5 * float(dt):
        lvs.solve()  # solve for c
        mover.move(c)  # pass c to monitor

Or we could do it more explicitly, for example:

monitor_kwargs = {"solution": c}
mover.move(**monitor_kwargs)

@joewallwork
Copy link
Member

Just to clarify what I meant during the meeting when I suggested passing args/kwargs to the monitor function:

def monitor(mesh, solution):
   ...

def run_simulation(...):
    ...
    mover = MongeAmpereMover(...)
    while float(t) < t_end + 0.5 * float(dt):
        lvs.solve()  # solve for c
        mover.move(c)  # pass c to monitor

Or we could do it more explicitly, for example:

monitor_kwargs = {"solution": c}
mover.move(**monitor_kwargs)

Thanks. I guess one question I have is why do we need to define get_initial_condition, velocity_expression, and run_simulation if they're only called once? For the purposes of a demo, couldn't we just inline them into the main program? Then we wouldn't need to change the signature of the monitor function.

@ddundo
Copy link
Member Author

ddundo commented Feb 21, 2025

Thanks. I guess one question I have is why do we need to define get_initial_condition, velocity_expression, and run_simulation if they're only called once? For the purposes of a demo, couldn't we just inline them into the main program? Then we wouldn't need to change the signature of the monitor function.

You're right, no need to complicate it for now. I inlined them in ac24b50. Still fiddly with the NameError though

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

Labels

documentation Improvements or additions to documentation PRIORITY We should address this ASAP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

time dependent example?

3 participants