Skip to content

Commit

Permalink
move omega and min max coordinates to config
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelmagnu committed Sep 14, 2024
1 parent a6a9c6f commit 9943188
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
" \"uy\": 0.25,\n",
" \"dt\": 0.025,\n",
" \"tmax\": 2.0,\n",
" \"polydeg\": 2\n",
" \"polydeg\": 2,\n",
" \"omega\": 3.141592,\n",
" \"min_x\": -1.0,\n",
" \"min_y\": -1.0,\n",
" \"max_x\": 1.0,\n",
" \"max_y\": 1.0\n",
"}\n",
"\n",
"assert SETUP[\"nx\"] == SETUP[\"ny\"]\n",
Expand Down Expand Up @@ -72,8 +77,8 @@
"end\n",
"\n",
"cells_per_dimension = (setup[\"nx\"], setup[\"ny\"])\n",
"coordinates_min = (-1.0, -1.0)\n",
"coordinates_max = ( 1.0, 1.0)\n",
"coordinates_min = (setup[\"min_x\"], setup[\"min_y\"])\n",
"coordinates_max = (setup[\"max_x\"], setup[\"max_y\"])\n",
"\n",
"mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)\n",
"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)\n",
Expand Down Expand Up @@ -136,7 +141,6 @@
"metadata": {},
"cell_type": "code",
"source": [
"mu = 0.0\n",
"dt = SETUP[\"dt\"]\n",
"tmax = SETUP[\"tmax\"]\n",
"nt = int(tmax / dt)\n",
Expand All @@ -145,11 +149,10 @@
"ny = SETUP[\"ny\"] * SETUP[\"polydeg\"] + 1\n",
"ux = SETUP[\"ux\"]\n",
"uy = SETUP[\"uy\"]\n",
"omega = SETUP[\"omega\"]\n",
"\n",
"omega = np.pi\n",
"\n",
"min_x, min_y = -1, -1\n",
"max_x, max_y = 1, 1\n",
"min_x, min_y = SETUP[\"min_x\"], SETUP[\"min_y\"]\n",
"max_x, max_y = SETUP[\"max_x\"], SETUP[\"max_y\"]\n",
"dx_temp = (max_x - min_x) / (nx - 1)\n",
"dy_temp = (max_y - min_y) / (ny - 1)\n",
"min_x, max_x = min_x - dx_temp/2, max_x + dx_temp/2\n",
Expand All @@ -167,7 +170,7 @@
"metadata": {},
"cell_type": "code",
"source": [
"opt = Options(n_iters=3, non_zero_mu_coeff=True)\n",
"opt = Options(n_iters=3)\n",
"boundary_conditions = (Periodic(), Periodic())"
],
"id": "64e3274fa4ac14a6",
Expand All @@ -178,8 +181,9 @@
"metadata": {},
"cell_type": "code",
"source": [
"def analytic_solution(x, y, t):\n",
" return np.sin(omega*(x-ux*t+y-uy*t))*np.exp(-2*mu*t*omega**2) + 1"
"#similiar to advection_diffusion_2d.ipynb but without diffusion\n",
"def analytic_solution(x, y, t): \n",
" return np.sin(omega*(x-ux*t+y-uy*t)) + 1"
],
"id": "1f2e59f8bb5f083a",
"outputs": [],
Expand Down Expand Up @@ -246,7 +250,7 @@
{
"metadata": {},
"cell_type": "code",
"source": "_ = solver.advance(n_steps=nt, mu_coeff=(mu, mu))",
"source": "_ = solver.advance(n_steps=nt)",
"id": "b29adee15e8ff545",
"outputs": [],
"execution_count": null
Expand Down

0 comments on commit 9943188

Please sign in to comment.