Skip to content

Commit

Permalink
docs: updating examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlangrose committed Oct 23, 2024
1 parent 7b4a61c commit 5c44747
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/3_advanced/plot_7_local_weights.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
============================
1f. Local data weighting
Local data weighting
============================
LoopStructural primarily uses discrete interpolation methods (e.g. finite differences on a regular grid,
or linear/quadratic on tetrahedral meshes). The interpolation is determined by combining a regularisation
Expand Down
5 changes: 1 addition & 4 deletions examples/4_performance/README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
Performance and Optimisation
----------------------------
The Performance and Optimization section focuses on improving the efficiency and scalability of your geological models.
These examples illustrate how to optimize large datasets, fine-tune solver parameters, and efficiently manage complex modeling scenarios.
You'll also learn techniques for balancing computational performance with model accuracy, enabling you to build robust geological models without sacrificing speed.
Whether you're working on a large-scale model or need to improve performance for time-sensitive projects, this section provides practical guidance on achieving the best results with LoopStructural.
This section will show some tips for how to speed up your models for specific applications.
40 changes: 40 additions & 0 deletions examples/4_performance/plot_1_solver_iterations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""
Solver Iteration Limits
-----------------------
LoopStructural uses iterative solvers to solve the least squares problem.
The number of iterations can be controlled by the user.
"""

"""
Solver Iteration Limits
-----------------------
LoopStructural uses iterative solvers to solve the least squares problem.
The number of iterations can be controlled by the user.
The number of iterations required by LoopStructural depends on the complexity of the geometry
being modelled.
In some cases a satisfactory solution can be found with a small number of iterations.
In the example below we show the time taken to solve the problem for different numbers of iterations
and show the resulting model.
"""

from LoopStructural import GeologicalModel
from LoopStructural.datasets import load_claudius
from LoopStructural.visualisation import Loop3DView
import time

data, bb = load_claudius()
model = GeologicalModel(bb[0, :], bb[1, :])
model.data = data
isovalue = 220
for maxiter in [10, 100, 500, 1000, 10000]:
start = time.time()
model.create_and_add_foliation(
"strati", interpolatortype="FDI", solver_kwargs={"maxiter": maxiter}
)
model.update()
end = time.time()
print(f"maxiter: {maxiter} time: {end-start} seconds")
view = Loop3DView(model)
view.plot_surface(model["strati"], [220])
view.show()
view.clear()
3 changes: 3 additions & 0 deletions examples/4_performance/plot_2_nelements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Resolution of interpolator
"""

0 comments on commit 5c44747

Please sign in to comment.