Add abstractions for time-dependent problems

Issue #16 new
Martin Sandve Alnæs created an issue

(This is a jumble of time related ideas copied from launchpad.)

Keywords: Time derivatives, automatic ODE methods, space-time elements.

Do we want something like:

  • Time abstraction: t = Time()
  • Time derivatives: Dt(u), Dtt(u), diff(u, t)
  • Automated time discretizations: CR(a), FE(a), BE(a), TR(a, theta)

In particular, this can be interesting in combination with time elements?

        es = FiniteElement("CG", triangle, 1)
        et = TimeElement(1) # Any point in non-Galerkin elements?
        e = es*et
        v = TestFunction(e)
        u = TrialFunction(e)
        f = Function(es)
        g = Function(e)
        a = f*u*v*dx

Need to extend ufc::cell for this, perhaps adding time interval [t0,t1] as part of ufc::cell, new shapes time_triangle etc and bool is_time_dependent() to form.

Just writing down a related idea:

pde = Dt(u)*v - dot(grad(u), grad(v)) - f*v
time_discretized_pde = theta_rule(pde, theta, dt, u, { u: u_prev, f: f_prev })

Here u_prev and f_prev are Coefficients representing f and u at the previous timestep, and theta and dt are either Coefficients (Constants) or literal floats. If theta is set to literal 0 or 1, the form will reduce to BE or FE schemes with no penalty. The system can then be split into lhs, rhs as usual.

I believe this could be implemented if we can split a pde into parts based on time derivatives (dr/dt - w = 0), similar to how we split a pde into parts with lhs, rhs.

An alternative way to represent this idea is to introduce a TimeStepped expression type:

u = TimeStepped(u_next, u_curr)
f = TimeStepped(f_next, f_curr)

together with an abstract time derivative type Dt(expr):

F = (Dt(u)*v + kappa*dot(grad(u), grad(v)) - f*v)*dx

and then the theta rule becomes simply:

Fth = theta_rule(F, timestep, theta)

with fixed theta=1,0 versions:

Ffe = forward_euler(F, timestep)
Fbe = backward_euler(F, timestep)

In the time discretized forms Fth, Ffe, Fbe, the TimeStepped types can either be replaced with the underlying _next, _curr objects, or there could be yet another operator AtTime(u, step) where step is an integer, to retain the information about the time abstraction for analysis.

But a question then is, what will derivative w.r.t. u mean?

v = TestFunction(V)
u_curr = Coefficient(V)
u_next = Coefficient(V)
u = TimeStepped(u_next, u_curr)

Possibly just:

w1 = derivative(u**2*dx, u_next, v) # 2*u_next*v*dx
w2 = derivative(u**2*dx, u_curr, v) # 2*u_prev*v*dx
w3 = derivative(u**2*dx, u, v) # 2*u*v*dx

but the behaviour together with theta_rule should be investigated before this design is finalized.

Comments (0)

  1. Log in to comment