I want to define a logistic function N on an interior boundary of a mesh using a DG elements and am hoping to make this function piecewise constant on each facet of a 2D mesh labelled with the marker 3. I’m defining the function N as

\dfrac{dN}{dt} = N(1-N)

and using the initial condition N(t=0) = 0.1.

To define the initial state of N, I have the code below:

```
DG0_elem = FiniteElement("DG", mesh.ufl_cell(), 0)
V0 = FunctionSpace(mesh, DG0_elem)
v0 = TestFunction(V0)
val = assemble(Constant(0.1)*v0('+')*dS(3))
N = Function(V0,val)
```

I’d like to update N in a time loop *without* re-assembling the expression for N in each loop, as I am currently doing:

```
dt = 0.01
T = 10.0*dt
while dt < T:
N_new = Function(V0, assemble((N('+')*(1-N('+')*dt + N('+'))*v0('+')*dS(3))
N.assign(N_new)
```

The above expression seems like it would be slow because it is redefining a new function and assembling a new form with every iteration. Is there a better way to do this?