Automatize Tutorials html, py files creation (#496)

* workflow to export tutorials

---------
This commit is contained in:
Dario Coscia
2025-03-15 11:01:19 +01:00
committed by FilippoOlivo
parent 8dfc9d19db
commit 3ff9f0c9a2
51 changed files with 140529 additions and 440 deletions

View File

@@ -87,25 +87,27 @@
"source": [
"## routine needed to run the notebook on Google Colab\n",
"try:\n",
" import google.colab\n",
" IN_COLAB = True\n",
" import google.colab\n",
"\n",
" IN_COLAB = True\n",
"except:\n",
" IN_COLAB = False\n",
" IN_COLAB = False\n",
"if IN_COLAB:\n",
" !pip install \"pina-mathlab\"\n",
" !pip install \"pina-mathlab\"\n",
"\n",
"import warnings\n",
"\n",
"from pina.problem import SpatialProblem, TimeDependentProblem\n",
"from pina.domain import CartesianDomain\n",
"\n",
"warnings.filterwarnings('ignore')\n",
"warnings.filterwarnings(\"ignore\")\n",
"\n",
"\n",
"class TimeSpaceODE(SpatialProblem, TimeDependentProblem):\n",
" \n",
" output_variables = ['u']\n",
" spatial_domain = CartesianDomain({'x': [0, 1]})\n",
" temporal_domain = CartesianDomain({'t': [0, 1]})\n",
"\n",
" output_variables = [\"u\"]\n",
" spatial_domain = CartesianDomain({\"x\": [0, 1]})\n",
" temporal_domain = CartesianDomain({\"t\": [0, 1]})\n",
"\n",
" # other stuff ..."
]
@@ -152,6 +154,7 @@
"from pina.domain import CartesianDomain\n",
"from pina.equation import Equation, FixedValue\n",
"\n",
"\n",
"# defining the ode equation\n",
"def ode_equation(input_, output_):\n",
"\n",
@@ -164,6 +167,7 @@
" # calculate the residual and return it\n",
" return u_x - u\n",
"\n",
"\n",
"class SimpleODE(SpatialProblem):\n",
"\n",
" output_variables = [\"u\"]\n",