Hi everyone :
I’m using ALE.move() to move the mesh boundary.
I want to know that has the “ds” been updated after use ALE.move() ?
I make two experiments, but their results seem to be contradictory.
My code is:
from dolfin import *
import matplotlib.pyplot as plt
import numpy as np
mesh = UnitSquareMesh(100, 100)
V = VectorFunctionSpace(mesh, "CG", 1)
x = SpatialCoordinate(mesh)
class Right(SubDomain):
def __init__(self):
SubDomain.__init__(self)
def inside(self, x, on_boundary):
return on_boundary and near(x[0], 1)
right = Right()
#mark the boundary
#bmesh = BoundaryMesh(mesh, "exterior", True)
bmf = MeshFunction("size_t", mesh, mesh.topology().dim() - 1, 0)
bmf.set_all(0)
right.mark(bmf, 1)
#boundary displacement
disp = project(as_vector((0.1, 0)), V)
disp_bc = DirichletBC(V, disp, bmf, 1)
b_disp = Function(V)
disp_bc.apply(b_disp.vector())
#define 'ds'
ds = Measure('ds', domain = mesh, subdomain_data = bmf)
n = FacetNormal(mesh)
v = project(as_vector((x[0] , x[0])), V)
#save files
#outfile = File("mesh.pvd")
#outfile << mesh
plot(mesh)
plt.show()
for i in range(10):
#move boundary
ALE.move(mesh, b_disp)
#outfile << mesh
i += 1
#smooth mesh
for i in range(10):
mesh.smooth()
#outfile << mesh
plot(mesh)
plt.show()
print(assemble(inner(v, n)*ds(1)))
The results are always 1.0 , 1.0, 1.0 … ,but the correct results should be 1.1 , 1.2 , 1.3 … Does the ‘ds’ not update?
While, I change the boundary displacement and print
disp = project(as_vector((0.1*x[1]*(1 - x[1]), 0)), V)
print(assemble(1*ds(1)))
The results will be changed with noving boundary. The seem to be updated?