Variable boundary conditions

Hey everyone !

I’m trying to solve a classic elasticity problem just like this one 2D linear elasticity of a simple square model. I wanna apply a Dirichlet Boundary conditions on the top and the bottom. and i wanna apply a loop on the boundary conditions so each time i will have a different value of shear displacement and then save data at each loop.

what are the things that gonna change in this output code ?

Time-dependent boundary conditions can be updated as in this example:
https://fenicsproject.org/pub/tutorial/html/._ftut1006.html

u_D = Expression('1 + x[0]*x[0] + alpha*x[1]*x[1] + beta*t',
                 degree=2, alpha=alpha, beta=beta, t=0)
#updating for different t
u_D.t = t

Saving the solution e.g. as pdv file can be done as in this example:
https://fenicsproject.org/pub/tutorial/html/._ftut1004.html

# Save solution to file in VTK format
vtkfile = File('poisson/solution.pvd')
vtkfile << u

Saving the solution to a problem with Dirichlet Boundary Conditions will of course also implicitly save the Boundary Condition itself.