Git Product home page Git Product logo

quagmire's Introduction

Quagmire

build/test

Quagmire is a Python surface process framework for building erosion and deposition models on highly parallel, decomposed structured and unstructured meshes.

Quagmire Surface Process Framework

Documentation

The documentation is in the form of jupyter notebooks that are online in the form of a jupyter-book

"Stable" code (developer release, 2020)

Bleeding edge code

Demonstration

Launch Demo

Installation

The native installation of Quagmire requires a number of dependencies and a fortran compiler, preferably gfortran. Install Quagmire using setuptools:

python setup.py build
python setup.py install

Or using pip:

pip3 install quagmire
  • If you change the fortran compiler, you may have to add the flags config_fc --fcompiler=<compiler name> when setup.py is run (see docs for numpy.distutils).

If you are using Python 3.7+ and Linux or MacOS, then you may wish to install Quagmire using conda:

conda install -c underworldcode quagmire

To run the demonstration examples:

conda install -c conda-forge gdal cartopy
conda install -c underworldcode quagmire

However, we are aware that the dependency list is quite large and restrictive and this can make it tough for Anaconda to install other complicated packages. You may need to do this in a separate conda environment.

Some parts of the examples include references to the lavavu package which has its own installation requirements and it might be best to read their documentation

Alternatively

Dependencies

Installing these dependencies is not required if you follow the Conda or Docker installation method. If you choose to install Quagmire natively, then the following packages are required:

Optional dependencies

These dependencies are required to run the Jupyter Notebook examples:

PETSc installation

PETSc is used extensively via the Python frontend, petsc4py. It is required that PETSc be configured and installed on your local machine prior to using Quagmire. You can use pip to install petsc4py and its dependencies.

[sudo] pip install numpy mpi4py
[sudo] pip install petsc petsc4py

If that fails you must compile these manually.

HDF5 installation

If you are compiling HDF5 from source it should be configured with the --enable-parallel flag:

CC=/usr/local/mpi/bin/mpicc ./configure --enable-parallel --enable-shared --prefix=INSTALL-DIRECTORY
make	# build the library
make check	# verify the correctness
make install

You can then point to this installation directory when you install h5py.

Usage

Quagmire is highly scalable. All of the python scripts in the tests subdirectory can be run in parallel, e.g.

mpirun -np 4 python stream_power.py

where the number after the -np flag specifies the number of processors.

Tutorials and worked examples

Tutorials with worked examples can be found in the Quagmire Community repository. The topics covered in the Notebooks include:

Meshing

  • Square mesh
  • Elliptical mesh
  • Mesh refinement (e.g. Lloyd's mesh improvement)
  • Poisson disc sampling
  • Mesh Variables
  • quagmire function interface (requires a base mesh)

Flow algorithms

  • Single and multiple downhill pathways
  • Accumulating flow

Erosion and deposition

  • Long-range stream flow models
  • Short-range diffusive evolution

Landscape evolution

  • Explicit timestepping and numerical stability
  • Landscape equilibrium metrics
  • Basement uplift

Credits

The primary authors of the code are Ben Mather, Louis Moresi and Romain Beucher. We take collective responsibility for creating and maintaining the code. Here and there in the source code we mention who originated the code or modified it in order to help direct questions.

quagmire's People

Contributors

lmoresi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

meditate9

quagmire's Issues

Pixmesh Octopants issue

Pixmesh example (Pixmesh Octopants) - some missing functionality in Pixmesh ?

(https://github.com/underworld-community/quagmire-examples-and-workflows/blob/master/Notebooks/IdealisedExamples/PixMeshOctoPants.ipynb)

~/+Codes/Python/quagmire/quagmire/topomesh/topomesh.py in _build_down_neighbour_arrays(self, nearest)
    189         nheightn = nheight.copy()
    190         # nheightn[~self.near_neighbour_mask] += self.height.max()
--> 191         nheightn[~self.near_neighbour_mask] += self._heightVariable.data.max()
    192         nheightnidx = np.argsort(nheightn, axis=1)
    193 

AttributeError: 'SurfaceProcessMeshClass' object has no attribute 'near_neighbour_mask'

loading into a locked mesh variable.

mesh.topography.load("global_OC_8.4_topography.h5")

should fail because the topography variable is locked (because it should be used within a context manager). The following is not allowed without the context manager

mesh.topography.data = 0.0

Saving / load of states with `.quag` files

We want to be able to save the mesh to an HDF5 file along with mesh variables, and rebuild all the relevant data structures using that same file.

I think the .quag extension is pretty cute too.

Move Notebooks to a different repo

Still need to decide whether to include a stripped back user manual for Quagmire, but all workflow stuff should be moved out of the man repository.

I still like the idea of using Quagmire to install the documentation.

quagmire.documentation.install_documentation(path="./Quagmire-Notebooks")

Perhaps a good solution is for this function to clone the examples/community repo to the install location, and download all the data to run the examples from CloudStor.

Randomise x, y vectors

Points are randomised in create_DMPlex_from_points to improve triangulation performance, but this breaks some existing code in the notebooks. It can be easily fixed, but I'm not sure which is better...

  1. Put the permutation routine in the other mesh generation functions, and assume the x,y vectors are shuffled prior to making the DM.
  2. Have a convenience method get_xy in trimesh to return the shuffled (local) x,y vectors.

The second option might be wiser since refinement will add new points anyway.

Conda-based testing

The updated petsc etc (#10) has broken the old conda-based build and test workflow. Should be simple to update but does need to be done.

Extended neighbour cloud

I don't think I understood this at the time... here are you including the two closest neighbours outside the immediate node neighbours? Sort of a limited extended-neighbours search?

neighbours = np.bincount(self.tri.simplices.flat)
self.near_neighbours = neighbours + 2

Radians or degrees

Everything in sTriMesh is currently in radians to be compatible with stripy, but perhaps mesh creation, interpolation and derivatives should all be in degrees to match geospatial data.

Setting downhill neighbours

In SurfaceProcessMesh, the context manager to update the topography rebuilds the downhill matrix and integrates the upstream area, whereas the downhill_neighbours setter just rebuilds the downhill matrix. This is because the property is defined only on the TopoMesh class while the context manager is overridden on the SurfMesh class. I'm not sure if this is intended?

Also it would be good to have the option to set the downhill neighbours from the context manager, e.g.

class Surfmesh_Height_Update_Manager(object):
    """Manage when changes to the height information trigger a rebuild
    of the topomesh matrices and other internal data.
    """

    def __init__(inner_self, downhill_neighbours=downhill_neighbours):
        inner_self._surfmesh = surfmesh
        inner_self._topovar = topographyVariable
        inner_self._downhill_neighbours = int(downhill_neighbours)
        return

    def __enter__(inner_self):
        # unlock
        inner_self._topovar.unlock()
        inner_self._surfmesh._downhill_neighbours = inner_self._downhill_neighbours
        return

    def __exit__(inner_self, *args):
        inner_self._surfmesh._update_height()
        inner_self._surfmesh._update_height_for_surface_flows()
        inner_self._topovar.lock()
        return

Error importing stripy after underworld

Not sure if anyone else has encountered this, but if underworld is imported before stripy then the triangulation routines break on my machine. I only discovered this when I merged #20 and all my tests broke because underworld was being imported by the scaling module. I've fixed that now, but something to be aware of in the future. (Though it may just be my machine...)

My annoying function

@lmoresi flagged that a function like this works in underworld but not in quagmire (#13):

my_annoying_fn = fn.math.sin(mymeshvar.fn_gradient[1]**2)

But maybe it's better if fn_gradient gets a list of derivative functions for each direction. So where you may currently do something like this:

interpolate_derivatives_fn = mymeshvar.fn_gradient(1)
interpolate_derivatives_fn.evaluate(xi, yi)

which interpolates derivatives in the y direction at (xi,yi), you would instead write:

interpolate_derivatives_fn = mymeshvar.fn_gradient[1]
interpolate_derivatives_fn.evaluate(xi, yi)

What should we go with? If the second one is more compatible with the UW way of things then I'd to go with that, but it would require a bit of patience to dig out all instances of the former implementation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.