Skip to content

Commit

Permalink
ENH: 3D code
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchengtkc committed Nov 6, 2023
1 parent ec97578 commit acd94bf
Show file tree
Hide file tree
Showing 19 changed files with 987 additions and 454 deletions.
246 changes: 95 additions & 151 deletions docs/notebooks/3D_simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,66 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import warmth\n",
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1e-6*30e3"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"30e-3"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"maps_dir = Path(\"./data/\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -30,7 +70,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -39,106 +79,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Age</th>\n",
" <th>File_name</th>\n",
" <th>Facies_maps</th>\n",
" <th>Stratigraphy</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>0.gri</td>\n",
" <td>None</td>\n",
" <td>Onlap</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>66</td>\n",
" <td>66.gri</td>\n",
" <td>None</td>\n",
" <td>Onlap</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>100</td>\n",
" <td>100.gri</td>\n",
" <td>None</td>\n",
" <td>Onlap</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>163</td>\n",
" <td>163.gri</td>\n",
" <td>None</td>\n",
" <td>Erosive</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>168</td>\n",
" <td>168.gri</td>\n",
" <td>None</td>\n",
" <td>Erosive</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>170</td>\n",
" <td>170.gri</td>\n",
" <td>None</td>\n",
" <td>Onlap</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>182</td>\n",
" <td>182.gri</td>\n",
" <td>None</td>\n",
" <td>Erosive</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Age File_name Facies_maps Stratigraphy\n",
"0 0 0.gri None Onlap\n",
"1 66 66.gri None Onlap\n",
"2 100 100.gri None Onlap\n",
"3 163 163.gri None Erosive\n",
"4 168 168.gri None Erosive\n",
"5 170 170.gri None Onlap\n",
"6 182 182.gri None Erosive"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"#Add surface grids to the table. You can use other method as well\n",
"inputs.loc[0]=[0,\"0.gri\",None,\"Onlap\"]\n",
Expand All @@ -154,7 +97,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -164,7 +107,16 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model.builder.grid.__dict__"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -173,27 +125,16 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"182"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"model.parameters.time_start"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -203,7 +144,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -213,7 +154,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -222,63 +163,66 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"102"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"model.builder.n_valid_node"
]
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model.simulator.simulate_every=1"
"model.builder.node"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model.builder.iter_node()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processing... |################################| 102/102\n",
"\u001b[?25h"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 471 ms, sys: 224 ms, total: 696 ms\n",
"Wall time: 31.6 s\n"
"ename": "NameError",
"evalue": "name 'model' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/workspaces/warmth/docs/notebooks/3D_simulation.ipynb Cell 14\u001b[0m line \u001b[0;36m1\n\u001b[0;32m----> <a href='vscode-notebook-cell://codespaces%2Bobscure-meme-qpw4jj4pgvp34j7v/workspaces/warmth/docs/notebooks/3D_simulation.ipynb#X45sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a>\u001b[0m \u001b[39mfor\u001b[39;00m i \u001b[39min\u001b[39;00m model\u001b[39m.\u001b[39mbuilder\u001b[39m.\u001b[39mnode:\n\u001b[1;32m <a href='vscode-notebook-cell://codespaces%2Bobscure-meme-qpw4jj4pgvp34j7v/workspaces/warmth/docs/notebooks/3D_simulation.ipynb#X45sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'>2</a>\u001b[0m \u001b[39mprint\u001b[39m(i)\n",
"\u001b[0;31mNameError\u001b[0m: name 'model' is not defined"
]
}
],
"source": [
"for i in model.builder.node:\n",
" print(i)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"model.simulator.run(save=True,purge=True)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand All @@ -288,7 +232,7 @@
"Rebuild/reload mesh at tti= 182\n",
"Using 1D Node parameters NodeParameters1D(shf=0.03, hc=30000.0, hw=3600.0, hLith=130000.0, kLith=3.109, kCrust=2.5, kAsth=100, rhp=2, crustliquid=2500.0, crustsolid=2800.0, lithliquid=2700.0, lithsolid=3300.0, asthliquid=2700.0, asthsolid=3200.0, T0=5, Tm=1330.0, qbase=0.03)\n",
"builing\n",
"saving\n"
"buildVertices\n"
]
},
{
Expand Down
Loading

0 comments on commit acd94bf

Please sign in to comment.