diff --git a/Fenics_FloryHugg_Binary.ipynb b/Fenics_FloryHugg_Binary.ipynb index a5ec16f0d6093f9969a6541e276bc117471f6927..63f4f8309b71fa5512c3c872baad7a355e234206 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": {