I'm currently working through the following FEniCS tutorial program Heat Equation Tutorial. In the program, the following block of code appears initializing the variables L, linear_form and b.
L = (u_n + dt * f) * v * ufl.dx
linear_form = fem.form(L)
b = create_vector(linear_form)
later in the program, we have the following block of code -
for i in range(num_steps):
t += dt
# Update the right hand side reusing the initial vector
with b.localForm() as loc_b:
loc_b.set(0)
assemble_vector(b, linear_form)
.
.
.
# Update solution at previous time step (u_n)
u_n.x.array[:] = uh.x.array
I'm not sure how, but in every iteration of the for loop, the variable L is updated (presumably due to u_n being updated. My question is the following - how does this occur? Given a variable x defined in terms of another, y, under what circumstances can changing y cause x to change as well?
I know this is probably a very basic question, I'm a mathematician and new to Python.
As a side question, if anyone can refer me to a section in a text where this is treated more thoroughly, please send it my way