{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Klimakoffer.jl" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, load the Julia package Klimakoffer.jl:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "using Klimakoffer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then, set the number of time steps per year for the solver" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "NT = 48 # this is a good default" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and create a mesh" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mesh = Mesh()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and a corresponding model" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model = Model(mesh, NT)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then, combine everything into the discretization" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "discretization = Discretization(mesh, model, NT)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "During the initialization of the discretization, some temporary data structures are created, pusing the memory usage to close to 2 GiB. On a reasonably modern machine, this poses no problem, but when running this notebook on [mybinder.org](https://mybinder.org/), it can lead to out-of-memory errors. Therefore, we ask Julia to clean up all temporary data structures:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "GC.gc()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally, you can solve for the equilibrium temperature with" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "GlobTemp = compute_equilibrium!(discretization, verbose=false)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "which will yield the equilibrium temperature for the given discretization (`14.484963368768746`)." ] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.6.1", "language": "julia", "name": "julia-1.6" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.6.1" } }, "nbformat": 4, "nbformat_minor": 4 }