|
248 | 248 | "ρ_I = Constant(ice_density)\n", |
249 | 249 | "g = Constant(gravity)\n", |
250 | 250 | "\n", |
251 | | - "\n", |
252 | | - "#n = Constant(glen_flow_law)\n", |
253 | | - "n = Constant(1.0)\n", |
254 | | - "\n", |
| 251 | + "n = Constant(glen_flow_law)\n", |
255 | 252 | "\n", |
256 | 253 | "P = ρ_I * g * h\n", |
257 | 254 | "S_n = inner(grad(s), grad(s))**((n - 1) / 2)\n", |
|
412 | 409 | "\n", |
413 | 410 | "sparams = {\n", |
414 | 411 | " \"solver_parameters\": {\n", |
415 | | - " \"snes_monitor\": \":rainier-output-monolothic.txt\",\n", |
| 412 | + " \"snes_monitor\": \":rainier-output-initial.log\",\n", |
416 | 413 | " \"snes_type\": \"newtonls\",\n", |
417 | 414 | " \"snes_max_it\": 200,\n", |
418 | 415 | " \"snes_linesearch_type\": \"nleqerr\",\n", |
|
462 | 459 | "metadata": {}, |
463 | 460 | "outputs": [], |
464 | 461 | "source": [ |
465 | | - "\"\"\"\n", |
466 | 462 | "num_continuation_steps = 5\n", |
467 | 463 | "for exponent in np.linspace(1.0, 3.0, num_continuation_steps):\n", |
468 | 464 | " n.assign(exponent)\n", |
469 | | - " momentum_solver.solve()\n", |
470 | | - "\"\"\"\n", |
471 | | - "momentum_solver.solve()" |
| 465 | + " momentum_solver.solve()" |
472 | 466 | ] |
473 | 467 | }, |
474 | 468 | { |
|
586 | 580 | "source": [ |
587 | 581 | "tableau = irksome.BackwardEuler()\n", |
588 | 582 | "t = Constant(0.0)\n", |
589 | | - "dt = Constant(1.0 / 12)\n", |
| 583 | + "dt = Constant(1.0 / 6)\n", |
590 | 584 | "\n", |
591 | 585 | "lower = firedrake.Function(W)\n", |
592 | 586 | "upper = firedrake.Function(W)\n", |
|
597 | 591 | "\n", |
598 | 592 | "bparams = {\n", |
599 | 593 | " \"solver_parameters\": {\n", |
600 | | - " \"snes_vi_monitor\": None,\n", |
| 594 | + " \"snes_monitor\": \":rainier-output-vi.log\",\n", |
601 | 595 | " \"snes_type\": \"vinewtonrsls\",\n", |
602 | 596 | " \"snes_max_it\": 200,\n", |
603 | 597 | " #\"snes_linesearch_type\": \"nleqerr\",\n", |
|
621 | 615 | "The good part: run the model for 500 years of simulation time." |
622 | 616 | ] |
623 | 617 | }, |
| 618 | + { |
| 619 | + "cell_type": "code", |
| 620 | + "execution_count": null, |
| 621 | + "id": "ffbd91d3-b0e4-416d-822d-2dd8f5f78a89", |
| 622 | + "metadata": {}, |
| 623 | + "outputs": [], |
| 624 | + "source": [ |
| 625 | + "n.assign(1.0)\n", |
| 626 | + "solver.advance(bounds=bounds)" |
| 627 | + ] |
| 628 | + }, |
| 629 | + { |
| 630 | + "cell_type": "code", |
| 631 | + "execution_count": null, |
| 632 | + "id": "f360f81b-5c4f-4615-8937-b8f316099a0d", |
| 633 | + "metadata": {}, |
| 634 | + "outputs": [], |
| 635 | + "source": [ |
| 636 | + "n.assign(2.0)\n", |
| 637 | + "solver.advance(bounds=bounds)" |
| 638 | + ] |
| 639 | + }, |
| 640 | + { |
| 641 | + "cell_type": "code", |
| 642 | + "execution_count": null, |
| 643 | + "id": "3b9f978b-d4ca-4c74-82c8-cf159e527c50", |
| 644 | + "metadata": {}, |
| 645 | + "outputs": [], |
| 646 | + "source": [ |
| 647 | + "n.assign(glen_flow_law)\n", |
| 648 | + "solver.advance(bounds=bounds)" |
| 649 | + ] |
| 650 | + }, |
624 | 651 | { |
625 | 652 | "cell_type": "code", |
626 | 653 | "execution_count": null, |
|
633 | 660 | "\n", |
634 | 661 | "final_time = 500.0\n", |
635 | 662 | "num_steps = int(final_time / float(dt))\n", |
636 | | - "progress_bar = trange(num_steps)\n", |
637 | | - "for step in progress_bar:\n", |
| 663 | + "for step in trange(num_steps):\n", |
638 | 664 | " solver.advance(bounds=bounds)\n", |
639 | 665 | " h = w.subfunctions[3]\n", |
640 | | - " progress_bar.set_description(str(h.dat.data_ro.min()))\n", |
641 | 666 | " s.interpolate(b + h)\n", |
642 | 667 | " a.interpolate(smb(s))\n", |
643 | 668 | "\n", |
|
678 | 703 | "metadata": {}, |
679 | 704 | "outputs": [], |
680 | 705 | "source": [ |
681 | | - "u, M, τ = z.subfunctions\n", |
| 706 | + "u, M, τ, h = w.subfunctions\n", |
682 | 707 | "\n", |
683 | 708 | "fig, axes = plt.subplots()\n", |
684 | 709 | "axes.set_aspect(\"equal\")\n", |
|
725 | 750 | "from IPython.display import HTML\n", |
726 | 751 | "HTML(animation.to_html5_video())" |
727 | 752 | ] |
| 753 | + }, |
| 754 | + { |
| 755 | + "cell_type": "code", |
| 756 | + "execution_count": null, |
| 757 | + "id": "53927034-2a55-4391-b0af-ac84f555f26a", |
| 758 | + "metadata": {}, |
| 759 | + "outputs": [], |
| 760 | + "source": [ |
| 761 | + "volumes = [firedrake.assemble(h * dx) for h in hs]\n", |
| 762 | + "fig, ax = plt.subplots()\n", |
| 763 | + "ax.plot(volumes);" |
| 764 | + ] |
728 | 765 | } |
729 | 766 | ], |
730 | 767 | "metadata": { |
|
0 commit comments