Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jigyasa Watwani
/
growth-pattern-control
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
734bcaf6
authored
Dec 03, 2025
by
Jigyasa Watwani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some comments added about difference with and without remshing
parent
ead15c37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
u_v_rho/1D/tissue.py
u_v_rho/1D/tissue.py
View file @
734bcaf6
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment