Skip to content

Commit

Permalink
Replace non-linear model with a linear dummy model (working).
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminRodenberg committed Jun 17, 2021
1 parent 9f55c40 commit 6d9200e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions gierer-meinhardt/fenics/gierer-meinhardt.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ def inside(self, x, on_boundary):

# from https://github.com/sebapersson/Master_thesis/blob/1643193a8f786674ce0573518162c0497306935d/Code/Python/RD_models/Run_RD_simulations.py#L21
a = Constant(0.5)
b = Constant(2.0)
gamma = Constant(20)
d = Constant(50)
b = Constant(1.0)
gamma = Constant(0.4)
d = Constant(0.001)
e = Constant(0.001)

mesh = UnitSquareMesh(10, 10)

Expand All @@ -50,7 +51,11 @@ def inside(self, x, on_boundary):

v = TestFunction(V)
u_n = Function(V)
u_ini = Expression("x[0]*x[1]", degree=1)
if args.activator:
u_ini = Expression("x[0] * x[1]", degree=1)
g = Expression("x[0] * x[0] * x[0]", degree=1)
elif args.inhibitor:
u_ini = Expression("10*(1-x[0])*(1-x[0]) * (1-x[1])*(1-x[1])", degree=1)
u_n = interpolate(u_ini, V)

dt = precice.initialize(AllDomain(), read_function_space=V, write_object=u_n)
Expand All @@ -63,10 +68,9 @@ def inside(self, x, on_boundary):

# from https://github.com/sebapersson/Master_thesis/blob/1643193a8f786674ce0573518162c0497306935d/Code/Python/RD_models/Simulate_RD_models.py#L342-L355
if args.activator:
F = dt_inv*(u - u_n)*v*dx - gamma*(a - b * u + u / f) * v *dx + inner(grad(u), grad(v))*dx
#F = dt_inv*(u - u_n)*v*dx - gamma*(a - b * u + u**2 / f) * v *dx + inner(grad(u), grad(v))*dx
F = - dt_inv * (u - u_n)*v*dx - f*v*dx - 10e-7 * inner(grad(u), grad(v))*dx + g * v * dx
elif args.inhibitor:
F = dt_inv*(u - u_n)*v*dx - gamma*(f**2 - u)*v*dx + d*inner(grad(u), grad(v))*dx
F = - dt_inv * (u - u_n)*v*dx + 10 * f*v*dx - 10e-5 * inner(grad(u), grad(v))*dx

# Time-stepping
u_np1 = Function(V)
Expand Down
2 changes: 1 addition & 1 deletion gierer-meinhardt/precice-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<coupling-scheme:serial-implicit>
<participants first="Activator" second="Inhibitor"/>
<max-time value="1.0"/>
<max-time value="10.0"/>
<time-window-size value="0.1"/>
<max-iterations value="100"/>
<exchange data="Substance" mesh="Activator-Mesh" from="Activator" to="Inhibitor" />
Expand Down

0 comments on commit 6d9200e

Please sign in to comment.