Commit 734bcaf6 by Jigyasa Watwani

some comments added about difference with and without remshing

parent ead15c37
Showing with 13 additions and 9 deletions
......@@ -43,7 +43,7 @@ class OneDimTissue(object):
self.function = df.Function(self.function_space)
def advection(self, conc, vel, tconc):
return df.inner(df.div(vel * conc), tconc)
return df.inner(df.div(vel) * conc, tconc)
def active_stress(self, rho):
if self.active_death:
......@@ -59,7 +59,7 @@ class OneDimTissue(object):
cell_markers = df.MeshFunction("bool", mesh, mesh.topology().dim())
cell_markers.set_all(False)
for cell in df.cells(mesh):
if cell.h() > 0.05: # if the width of the cell > threshold, refine
if cell.h() > 0.05:
cell_markers[cell] = True
mesh = df.refine(mesh, cell_markers)
return mesh
......@@ -115,8 +115,9 @@ class OneDimTissue(object):
u, v, rho = df.split(self.function)
tu, tv, trho = df.TestFunctions(self.function_space)
uform = (df.inner((u - u0)/self.timestep, tu)
- df.inner(v0, tu))
uform = ( df.inner((u - u0)/self.timestep, tu)
- df.inner(v0, tu)
)
vform = (self.friction * df.inner(v, tv)
+ df.inner(self.stress(u, v, rho),
......@@ -128,7 +129,7 @@ class OneDimTissue(object):
self.form = (uform + vform + rhoform) * df.dx
def solve(self, initu=None, initv=None, initrho=None, initTime=0, extend=False):
def solve(self, initu = None, initv = None, initrho = None, initTime = 0, extend = False):
# create function space, functions, bc
self.setup()
......@@ -177,31 +178,34 @@ class OneDimTissue(object):
df.solve(self.form == 0, self.function, self.bc)
# save the fields
u, v, rho = self.function.split(deepcopy=True)
u, v, rho = self.function.split(deepcopy = True)
if steps % savesteps == 0:
self.uFile.write_checkpoint(u, 'displacement', self.time, append=True)
self.vFile.write_checkpoint(v, 'velocity', self.time, append=True)
self.rhoFile.write_checkpoint(rho, 'density', self.time, append=True)
# assign the calculated function to a newly-defined function, to be used later
#NOTE: If no remeshing, only do self.function0.assign(self.function), following not needed
old_function = df.Function(self.function_space)
old_function.assign(self.function)
# move the mesh
dr = df.project(v * self.timestep, self.function_space.sub(0).collapse())
df.ALE.move(self.mesh, dr)
# refine the mesh
# refine the mesh
#NOTE: If no remeshing, following not needed
self.mesh = self.refine_mesh(self.mesh)
# new function space, bc, functions
# # new function space, bc, functions
self.setup()
# new function0 should be the old function in the old function space projected on the new function space
self.function0 = df.project(old_function, self.function_space)
# new weak form
#NOTE: If no remeshing, following still needed
self.setup_weak_forms()
self.uFile.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment