Dirichlet boundary conditions in NonlinearVariationalProblem

Hi
For time dependent BCs, you can simply create a time-dependent expression for u_left and update it inside the for loop. For instance,

u_left = Expression(("a*x[0]+i*0.005","a*x[1]"), a = eps_s , i=0, degree=1) #INITIAL STRAIN
...
...
for i, ti in enumerate(time):
    print("Timestep: "+ str(i)+"/"+str(Nsteps)+", time = "+str(ti))
    u_left.i = i

instead of creating the DirichletBC object again. Note that there could be other issues with the formulation/solver, since running the problem as is with a LU solver doesn’t yield convergence.

1 Like