Skip to content

Commit

Permalink
Use diagonal_balance and UpdateIRLS
Browse files Browse the repository at this point in the history
Use `diagonal_balance=True` when creating TreMeshes, and replace one
missed `Update_IRLS` for `UpdateIRLS`.
  • Loading branch information
santisoler committed Nov 20, 2024
1 parent 9ed0b0d commit 427a7f5
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion notebooks/03-gravity/fwd_gravity_gradiometry_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
"hx = [(dx, nbcx)]\n",
"hy = [(dy, nbcy)]\n",
"hz = [(dz, nbcz)]\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\")\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\", diagonal_balance=True)\n",
"\n",
"# Shift vertically to top same as maximum topography\n",
"mesh.origin += np.r_[0.0, 0.0, z_topo.max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/03-gravity/inv_gravity_anomaly_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@
"hx = [(dx, nbcx)]\n",
"hy = [(dy, nbcy)]\n",
"hz = [(dz, nbcz)]\n",
"tree_mesh = TreeMesh([hx, hy, hz], x0=\"CCN\")\n",
"tree_mesh = TreeMesh([hx, hy, hz], x0=\"CCN\", diagonal_balance=True)\n",
"\n",
"# Shift vertically to top same as maximum topography\n",
"tree_mesh.origin += np.r_[0.0, 0.0, topo_xyz[:, -1].max()]\n",
Expand Down
6 changes: 3 additions & 3 deletions notebooks/03-gravity/weighting_strategies.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1537,11 +1537,11 @@
"\n",
"# Defines the directives for the IRLS regularization. This includes setting\n",
"# the cooling schedule for the trade-off parameter.\n",
"update_IRLS = directives.Update_IRLS(\n",
"update_IRLS = directives.UpdateIRLS(\n",
" f_min_change=1e-4,\n",
" max_irls_iterations=30,\n",
" coolEpsFact=1.5,\n",
" beta_tol=1e-2,\n",
" irls_cooling_factor=1.5,\n",
" misfit_tolerance=1e-2,\n",
")\n",
"\n",
"# Options for outputting recovered models and predicted data for each beta.\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/04-magnetics/fwd_magnetics_mvi_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
"hx = [(dx, nbcx)]\n",
"hy = [(dy, nbcy)]\n",
"hz = [(dz, nbcz)]\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\")\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\", diagonal_balance=True)\n",
"\n",
"# Shift vertically to top same as maximum topography\n",
"mesh.origin += np.r_[0.0, 0.0, z_topo.max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/04-magnetics/inv_magnetics_induced_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@
"hx = [(dx, nbcx)]\n",
"hy = [(dy, nbcy)]\n",
"hz = [(dz, nbcz)]\n",
"tree_mesh = TreeMesh([hx, hy, hz], x0=\"CCN\")\n",
"tree_mesh = TreeMesh([hx, hy, hz], x0=\"CCN\", diagonal_balance=True)\n",
"\n",
"# Shift vertically to top same as maximum topography\n",
"tree_mesh.origin += np.r_[0.0, 0.0, topo_xyz[:, -1].max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/05-dcr/fwd_dcr_2d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@
"# Define the base mesh with top at z = 0 m.\n",
"hx = [(dh, nbcx)]\n",
"hz = [(dh, nbcz)]\n",
"mesh = TreeMesh([hx, hz], x0=\"CN\")\n",
"mesh = TreeMesh([hx, hz], x0=\"CN\", diagonal_balance=True)\n",
"\n",
"# Shift top to maximum topography\n",
"mesh.origin = mesh.origin + np.r_[0.0, z_topo.max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/05-dcr/fwd_dcr_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
"hx = [(dh, nbcx)]\n",
"hy = [(dh, nbcy)]\n",
"hz = [(dh, nbcz)]\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\")\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\", diagonal_balance=True)\n",
"\n",
"# Shift top to maximum topography\n",
"mesh.origin = mesh.origin + np.r_[0.0, 0.0, z_topo.max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/05-dcr/inv_dcr_2d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@
"# Define the base mesh with top at z = 0 m\n",
"hx = [(dh, nbcx)]\n",
"hz = [(dh, nbcz)]\n",
"mesh = TreeMesh([hx, hz], x0=\"CN\")\n",
"mesh = TreeMesh([hx, hz], x0=\"CN\", diagonal_balance=True)\n",
"\n",
"# Shift top to maximum topography\n",
"mesh.origin = mesh.origin + np.r_[0.0, topo_2d[:, -1].max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/05-dcr/inv_dcr_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@
"hx = [(dh, nbcx)]\n",
"hy = [(dh, nbcy)]\n",
"hz = [(dh, nbcz)]\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\")\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\", diagonal_balance=True)\n",
"\n",
"# Shift top to maximum topography\n",
"mesh.origin = mesh.origin + np.r_[0.0, 0.0, topo_xyz[:, -1].max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/06-ip/fwd_ip_2d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
"# Define the base mesh with top at z = 0 m.\n",
"hx = [(dh, nbcx)]\n",
"hz = [(dh, nbcz)]\n",
"mesh = TreeMesh([hx, hz], x0=\"CN\")\n",
"mesh = TreeMesh([hx, hz], x0=\"CN\", diagonal_balance=True)\n",
"\n",
"# Shift top to maximum topography\n",
"mesh.origin = mesh.origin + np.r_[0.0, z_topo.max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/06-ip/fwd_ip_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
"hx = [(dh, nbcx)]\n",
"hy = [(dh, nbcy)]\n",
"hz = [(dh, nbcz)]\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\")\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\", diagonal_balance=True)\n",
"\n",
"# Shift top to maximum topography\n",
"mesh.origin = mesh.origin + np.r_[0.0, 0.0, z_topo.max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/06-ip/inv_ip_2d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@
"# Define the base mesh with top at z = 0 m\n",
"hx = [(dh, nbcx)]\n",
"hz = [(dh, nbcz)]\n",
"mesh = TreeMesh([hx, hz], x0=\"CN\")\n",
"mesh = TreeMesh([hx, hz], x0=\"CN\", diagonal_balance=True)\n",
"\n",
"# Shift top to maximum topography\n",
"mesh.origin = mesh.origin + np.r_[0.0, topo_2d[:, -1].max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/06-ip/inv_ip_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@
"hx = [(dh, nbcx)]\n",
"hy = [(dh, nbcy)]\n",
"hz = [(dh, nbcz)]\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\")\n",
"mesh = TreeMesh([hx, hy, hz], x0=\"CCN\", diagonal_balance=True)\n",
"\n",
"# Shift top to maximum topography\n",
"mesh.origin = mesh.origin + np.r_[0.0, 0.0, topo_xyz[:, -1].max()]\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/07-fdem/fwd_fdem_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@
"nbc = 2 ** int(np.round(np.log(dom_width / dh) / np.log(2.0))) # num. base cells\n",
"\n",
"h = [(dh, nbc)]\n",
"mesh = TreeMesh([h, h, h], x0=\"CCC\")\n",
"mesh = TreeMesh([h, h, h], x0=\"CCC\", diagonal_balance=True)\n",
"\n",
"# Mesh refinement based on surface topography (starting with 20 cells)\n",
"k = np.sqrt(np.sum(topo_xyz[:, 0:2] ** 2, axis=1)) < 400\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/08-tdem/fwd_tdem_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
"nbc = 2 ** int(np.round(np.log(dom_width / dh) / np.log(2.0))) # num. base cells\n",
"\n",
"h = [(dh, nbc)]\n",
"mesh = TreeMesh([h, h, h], x0=\"CCC\")\n",
"mesh = TreeMesh([h, h, h], x0=\"CCC\", diagonal_balance=True)\n",
"\n",
"# Mesh refinement based on surface topography (starting with 20 cells)\n",
"k = np.sqrt(np.sum(topo_xyz[:, 0:2] ** 2, axis=1)) < 400\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/08-tdem/fwd_utem_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@
"L = 80000.0\n",
"nbc = 2 ** int(np.round(np.log(L / dh) / np.log(2.0)))\n",
"h = [(dh, nbc)]\n",
"mesh = TreeMesh([h, h, h], origin=\"CCC\")\n",
"mesh = TreeMesh([h, h, h], origin=\"CCC\", diagonal_balance=True)\n",
"\n",
"# Shift vertically to top same as maximum topography\n",
"mesh.origin += np.r_[0.0, 0.0, z_topo.min()]"
Expand Down

0 comments on commit 427a7f5

Please sign in to comment.