From 5d0ec8c1fef1cd7fed26d5e22fcf56907c4cedee Mon Sep 17 00:00:00 2001
From: Lars Hubatsch <hubatsch@pks.mpg.de>
Date: Thu, 28 Nov 2019 22:13:48 +0100
Subject: [PATCH] Parameter changes to make cool movie. Now again 2D.

---
 Fenics_FloryHugg_Binary.ipynb | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/Fenics_FloryHugg_Binary.ipynb b/Fenics_FloryHugg_Binary.ipynb
index a5ec16f..63f4f83 100644
--- a/Fenics_FloryHugg_Binary.ipynb
+++ b/Fenics_FloryHugg_Binary.ipynb
@@ -23,7 +23,7 @@
     "        random.seed(2 + MPI.rank(MPI.comm_world))\n",
     "        super().__init__(**kwargs)\n",
     "    def eval(self, values, x):\n",
-    "        if x[0] > 0.5:\n",
+    "        if (x[0] > 0.48) & (x[0] < 0.52) & (x[1] > 0.48) & (x[1] < 0.52):\n",
     "#             values[0] = 0.63 + 0.02*(0.5 - random.random())\n",
     "            values[0] = 0.6\n",
     "        else:\n",
@@ -45,13 +45,13 @@
     "        assemble(self.a, tensor=A)\n",
     "# Model parameters\n",
     "lmbda  = 1.0e-02  # surface parameter\n",
-    "dt     = 5.0e-03  # time step\n",
+    "dt     = 5.0e-02  # time step\n",
     "theta  = 0.5      # time stepping family, e.g. theta=1 -> backward Euler, theta=0.5 -> Crank-Nicolson\n",
     "# Form compiler options\n",
     "parameters[\"form_compiler\"][\"optimize\"]     = True\n",
     "parameters[\"form_compiler\"][\"cpp_optimize\"] = True\n",
     "# Create mesh and build function space\n",
-    "mesh = UnitSquareMesh.create(96, 1, CellType.Type.quadrilateral)\n",
+    "mesh = UnitSquareMesh.create(96, 96, CellType.Type.quadrilateral)\n",
     "P1 = FiniteElement(\"Lagrange\", mesh.ufl_cell(), 1)\n",
     "ME = FunctionSpace(mesh, P1*P1)\n",
     "# Define trial and test functions\n",
@@ -94,12 +94,12 @@
     "\n",
     "# Step in time\n",
     "t = 0.0\n",
-    "T = 3000*dt\n",
+    "T = 100*dt\n",
     "while (t < T):\n",
+    "    file << (u.split()[0], t)\n",
     "    t += dt\n",
     "    u0.vector()[:] = u.vector()\n",
-    "    solver.solve(problem, u.vector())\n",
-    "    file << (u.split()[0], t)"
+    "    solver.solve(problem, u.vector())"
    ]
   },
   {
@@ -116,13 +116,6 @@
     "a, b, c, d = popt\n",
     "plt.plot(xdata, tanh_fit(xdata, a, b, c, d))# np.tanh((xdata-52)/12.4)*0.36+0.5"
    ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": []
   }
  ],
  "metadata": {
-- 
GitLab