Followup: update mesh after autoadaptive refinement

11 months ago by
Hi, this is followup question,

Hi I have to solve coupled equation, In that i am solving equations individually. First equation i want to solve auto adaptive, How can I update mesh to solve second equation.
from dolfin import *
import mshr
domain = mshr.Rectangle(Point(0,0), Point(1,1))-mshr.Circle(Point(0.5,0.5), 0.1)
mesh = mshr.generate_mesh(domain, 10)
V = VectorFunctionSpace(mesh, 'CG',1)
u = TrialFunction(V)
v = TestFunction(V)
def epsilon(u):
    return 0.5*(grad(u)  + grad(u).T)

def sigma(u):
    return 2.0*mu*epsilon(u) + lmbda*tr(epsilon(u))*Identity(2)

class top(SubDomain):
    def inside(self,x,on_boundary):
        tol = 1e-5
        return abs(x[1]-1.0) < tol and on_boundary

class bottom(SubDomain):
def inside(self,x,on_boundary):
        tol = 1e-5
        return abs(x[1]) < tol and on_boundary
Bottom = bottom()
Top = top()
bc = [bc1, bc2]

Eu = inner(nabla_grad(v), sigma(u))*dx
u = Function(V)

M = inner(u*u)dx
tol = 1.e-3

solver_parameters = {"error_control":{"dual_variational_solver":{"linear_solver": "cg"}}}
solve(lhs(Eu) == rhs(Eu), u, bc , tol=tol , M=M,solver_parameters=solver_parameters)

# I want mesh update for the second equation
I have used : mesh = mesh.leaf_node()

but second equation is solving on the initial mesh only.

I have given minimal working code, Thanks in advance

Please login to add an answer/comment or follow this question.

Similar posts:
Search »