Hello all,

I’m trying to solve a simple elasticity problem in Fenics under several loading steps. However, I’m looking for a way where I can update the region for Dirichlet BC in each loading step. For example, let’s say I want to identify the region where the magnitude of solution u (from previous loading step) is higher than 0.03 (|**u**|>0.03). Then, in the next loading step, I want to change the region top_evolving to the region where u is higher than 0.03, and have the new Dirichlet boundary condition there. Can anyone help me with this?

Thanks!

My code is below:

```
from dolfin import *
mesh = RectangleMesh(Point(-0.5,-0.5),Point(0.5,0.5), 20, 20)
W = VectorFunctionSpace(mesh, 'CG', 1)
u, v, du = Function(W), TestFunction(W), TrialFunction(W)
def bot(x, on_boundary):
return x[1] < -0.45
def top_evolving(x, on_boundary):
return x[1] > 0.45
top_expr = Expression(("0.02*t", 0),t=0, degree=1)
bctop = DirichletBC(W, top_expr , top_evolving)
bcbot = DirichletBC(W, Constant((0.0, 0)), bot)
bc_u = [bcbot, bctop]
lmbda, mu= 1.5, 1
def W0(u):
F = Identity(len(u)) + grad(u)
C = F.T*F
Ic, J = tr(C), det(F)
E = (mu/2)*(Ic - 2) - mu*ln(J) + (lmbda/2)*(ln(J))**2
return E
E_du = derivative(W0(u) * dx , u, v)
J_u = derivative(E_du, u, du)
p_disp = NonlinearVariationalProblem(E_du, u, bc_u, J_u)
solver_disp = NonlinearVariationalSolver(p_disp)
Disp_file = File ("./disp.pvd")
t,deltaT =0, 1
while t<= 5:
t += deltaT
top_expr.t = t
solver_disp.solve()
Disp_file << u
```