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
6e4d884c
authored
Nov 12, 2022
by
Vijay Kumar Krishnamurthy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Saving updates
parent
2c482e06
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
growing_domain/diffusion_on_growing_domain.py
growing_domain/parameters.json
growing_domain/diffusion_on_growing_domain.py
View file @
6e4d884c
...
@@ -47,34 +47,37 @@ class GrowthDiffusion(object):
...
@@ -47,34 +47,37 @@ class GrowthDiffusion(object):
+
self
.
Dc
*
df
.
inner
(
df
.
nabla_grad
(
self
.
c
),
df
.
nabla_grad
(
tc
))
+
self
.
Dc
*
df
.
inner
(
df
.
nabla_grad
(
self
.
c
),
df
.
nabla_grad
(
tc
))
-
df
.
inner
(
self
.
reaction_rate
*
self
.
c
,
tc
)
)
*
df
.
dx
-
df
.
inner
(
self
.
reaction_rate
*
self
.
c
,
tc
)
)
*
df
.
dx
def
solve
(
self
):
def
solve
(
self
):
times
=
np
.
arange
(
0
,
self
.
maxtime
+
self
.
timestep
,
self
.
timestep
)
savesteps
=
int
(
self
.
savetime
/
self
.
timestep
)
fname
=
params
[
'timestamp'
]
+
'_concentration'
maxsteps
=
int
(
self
.
maxtime
/
self
.
timestep
)
cFile
=
df
.
XDMFFile
(
fname
+
'.xdmf'
)
self
.
time
=
0.0
cFile
=
df
.
XDMFFile
(
'
%
s_concentration.xdmf'
%
params
[
'timestamp'
])
# initial condition
# initial condition
r2
=
"+"
.
join
([
'x['
+
str
(
i
)
+
']*x['
+
str
(
i
)
+
']'
for
i
in
range
(
self
.
dimension
)])
r2
=
"+"
.
join
([
'x['
+
str
(
i
)
+
']*x['
+
str
(
i
)
+
']'
for
i
in
range
(
self
.
dimension
)])
c0
=
'1 + 0.1*cos(pi*m*(
%
s)/L)'
%
r2
c0
=
'1 + 0.1*cos(pi*m*(
%
s)/L)'
%
r2
c0
=
df
.
Expression
(
c0
,
pi
=
np
.
pi
,
m
=
1
,
L
=
self
.
system_size
,
degree
=
1
)
c0
=
df
.
Expression
(
c0
,
pi
=
np
.
pi
,
m
=
1
,
L
=
self
.
system_size
,
degree
=
1
)
self
.
c0
.
assign
(
df
.
project
(
c0
,
self
.
SFS
))
self
.
c0
.
assign
(
df
.
project
(
c0
,
self
.
SFS
))
# save data
# save data
cFile
.
write_checkpoint
(
self
.
c0
,
fname
,
times
[
0
]
)
cFile
.
write_checkpoint
(
self
.
c0
,
'concentration'
,
self
.
time
)
# time stepping
# time stepping
for
i
in
progressbar
.
progressbar
(
range
(
1
,
len
(
times
)
)):
for
steps
in
progressbar
.
progressbar
(
range
(
1
,
maxsteps
+
1
)):
# get velocity
# get velocity
self
.
sigma
.
t
=
times
[
i
-
1
]
self
.
sigma
.
t
=
self
.
time
self
.
velocity
.
assign
(
df
.
project
(
self
.
sigma
*
self
.
growth_direction
,
self
.
VFS
))
self
.
velocity
.
assign
(
df
.
project
(
self
.
sigma
*
self
.
growth_direction
,
self
.
VFS
))
# solve
# solve
df
.
solve
(
self
.
form
==
0
,
self
.
c
)
df
.
solve
(
self
.
form
==
0
,
self
.
c
)
# update
# update
self
.
c0
.
assign
(
self
.
c
)
self
.
c0
.
assign
(
self
.
c
)
# save data
# save data
cFile
.
write_checkpoint
(
self
.
c0
,
fname
,
times
[
i
],
append
=
True
)
if
steps
%
savesteps
==
0
:
cFile
.
write_checkpoint
(
self
.
c0
,
'concentration'
,
self
.
time
,
append
=
True
)
# move mesh
# move mesh
displacement
=
df
.
project
(
self
.
velocity
*
self
.
timestep
,
self
.
VFS
)
displacement
=
df
.
project
(
self
.
velocity
*
self
.
timestep
,
self
.
VFS
)
df
.
ALE
.
move
(
self
.
mesh
,
displacement
)
df
.
ALE
.
move
(
self
.
mesh
,
displacement
)
self
.
time
+=
self
.
timestep
cFile
.
close
()
cFile
.
close
()
...
@@ -95,5 +98,5 @@ if __name__ == '__main__':
...
@@ -95,5 +98,5 @@ if __name__ == '__main__':
gd
=
GrowthDiffusion
(
params
)
gd
=
GrowthDiffusion
(
params
)
gd
.
solve
()
gd
.
solve
()
with
open
(
params
[
'timestamp'
]
+
'_parmeters.json'
,
"w"
)
as
fp
:
with
open
(
params
[
'timestamp'
]
+
'_par
a
meters.json'
,
"w"
)
as
fp
:
json
.
dump
(
params
,
fp
,
indent
=
4
)
json
.
dump
(
params
,
fp
,
indent
=
4
)
\ No newline at end of file
growing_domain/parameters.json
View file @
6e4d884c
{
{
"dimension"
:
2
,
"dimension"
:
2
,
"resolution"
:
5
,
"resolution"
:
1
5
,
"system_size"
:
1
,
"system_size"
:
1
,
"Dc"
:
0.1
,
"Dc"
:
0.1
,
"growth"
:
"
exponential
"
,
"growth"
:
"
linear
"
,
"growth_parameter"
:
0.1
,
"growth_parameter"
:
0.1
,
"reaction_rate"
:
0.0
,
"reaction_rate"
:
0.0
,
"timestep"
:
0.01
,
"timestep"
:
0.01
,
"maxtime"
:
1.0
"savetime"
:
0.1
,
"maxtime"
:
5.0
}
}
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