GFlex
Multiple methods to solve elastic plate flexure, designed for applications to Earth's lithosphere.
Install / Use
/learn @awickert/GFlexREADME
[![CSDMS Component][csdms_badge]][csdms_gflex]<br/> [![DOI][doi_badge]][doi_link]<br/> [![Test][test_badge]][test_workflow]
gFlex
Multiple methods to solve elastic plate flexure, designed for applications to Earth's lithosphere.
These instructions are meant to take an user familiar with computers but new to (or a beginner with) Python through the basics of how to get gFlex to work. The Python scripting part towards the end should be pretty straightforward as well, insofar as information is provided on how to get and set the chosen values inside gFlex. Please leave a message if you have trouble working with gFlex; your comments could assist both you and the more general improvement of this documentation.
When you use gFlex, please cite:
Wickert, A. D. (2016), [Open-source modular solutions for flexural isostasy: gFlex v1.0][paper_doi], Geosci. Model Dev., 9(3), 997–1017, doi:10.5194/gmd-9-997-2016.
If you additionally want an up-to-date citation for the latest source-code release, please see that given in CITATION.cff.
Download and Installation
Python
gFlex has been tested on Python 3.10+.
In order to run properly, gFlex requires the following Python dependencies:
- numpy
- scipy
- matplotlib
For users who are new to Python, follow these directions to install the Python interpreters onto your computer.
Linux
Use your package manager to download and install the required Python packages. For Debian/Ubuntu, it will be something like:
# Basic packages
sudo apt-get install \
python python-numpy python-scipy \
python-setuptools python-matplotlib
# pip (recommended for automatic installs via setuptools)
sudo apt-get install python-pip
# iPython console -- very useful (optional)
sudo apt-get install ipython
# Sypder IDE (I don't personally use it but many others like it: optional)
sudo apt-get install spyder
Windows
Download python(x,y) or another full-featured distribution such as Anaconda; both of these distributions have been tested successfully with gFlex. Python(x,y) and several others also contain the required packages (including the numerical libraries), the iPython console, and the Spyder IDE; Spyder is a nice IDE that will provide a familiar-looking interface for users accustomed to Matlab.
Mac
The current recommendation is to use a package manager like homebrew. With this you can install Python, and then move on to using pip (or homebrew) to install the Python modules. A good introduction to this can be found here: http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion. See the Linux instructions for the list of packages that you will need; after installing pip, these commands can be substituted as follows, e.g.,
# Homebrew
sudo brew install python-numpy
# Pip
pip install -r requirements.txt
Recent efforts to download Python distributions (both Anaconda and Enthought) have not met with success with both gFlex and GRASS, though Anaconda has been tested successfully with Windows. As a result, it should be more successful to keep the Python packages managed better by something like homebrew with pip.
gFlex
Downloading and Installing in One Step from PyPI using pip
gFlex is downloadable from the Python Package Index (PyPI); see https://pypi.python.org/pypi/gFlex.
If you have pip, you may simply type:
pip install
pip install gflex
# Or if the destination install folder requires sudo access
# (for UNIX-like systems)
sudo pip install gflex
# pip install gFlex works too -- install is caps-insensitive
and you will have a full, running copy of the latest release version of gFlex.
Downloading
gFlex may be downloaded here at GitHub, by either:
- Copying the link at right and pasting it into the command prompt as follows:
git clone <LINK>
- Downloading and extracting the compressed ZIP file (link at right)
- Clicking on the link to add gFlex to your local GitHub desktop app (for Windows or Mac)
Installing
Install gFlex at the command prompt using setuptools. If you have administrator privileges, which is often also the case when doing this install under Windows, you may drop the "sudo". For standard Linux or Mac users, the "sudo" will remain necessary, and you will have to enter your administrator password for the program to be added to your local set of applications (e.g., as "/usr/local/bin/gflex").
# For standard Linux/Mac users:
sudo python setup.py install
# OR
sudo python setup.py develop # If you want the install to see instantly
# any changes made in the source repository
# For Windows users or Unix-type users with SuperUser privileges:
python setup.py install
# OR
python setup.py develop # If you want the install to see instantly
# any changes made in the source repository
Running
Once gFlex is installed, it is possible to run it in four ways:
- With a configuration file
- Within a Python script
- Within GRASS GIS
- As part of the Landlab Earth-surface modeling framework, including an interface to the the Community Surface Dynamics Modeling System Component Model Interface (CMI)
For options 1 and 2, there are pre-built methods that can be selected along the way to visualize results. These use Python's Matplotlib plotting library. For option 3, GRASS GIS is used for visualization. In Option 4, output from Landlab can be visualized with Matplotlib, and output from CSDMS sets of models can be visualized using tools such as VisIt (CSDMS page about VisIt) and ParaView. ParaView also now has Python bindings, which can further be used to visualize outputs produced with any of these methods.
With configuration file
A configuration file can be generated to run gFlex; see examples in the input/ directory. To run gFlex using this file, one simply opens a terminal window and types:
# run like this:
gflex <path-to-configuration-file>
This can be run from any directory, as the installation of gFlex adds the program "gflex" to the system path.
For help constructing configuration files, see the blank template files input/template1D and input/template2D, as well as the other examples found in the input/ directory. The input/ directory also contains input/README.md, which provides a further local description of the files available. input/input_help provides a longer explanation of what the parameters are, and is therefore reproduced immediately below for reference:
; input_help
; All units are SI. Not all entries are needed.
; Standard parameter values for Earth are included.
[mode]
; 1 (line) or 2 (surface) dimensions
dimension=2
; Solution method: FD (Finite Difference), FFT (Fast Fourier
; Transform, not yet implemented), SAS (Spatial domain analytical
; solutions), or SAS_NG (SPA, but do not require a uniform grid
; - NG = "no grid")
; For SAS_NG, 1D data must be provided and will be returned in
; two columns: (x,q0) --> (x,w). 2D data are similar, except
; will be of the form (x,y,[q0/in or w/out])
; I am working on gridded output for these, so this might change
; in the future.
; Both the FFT and SPA techniques rely on superposition
; of solutions, because they can be combined linearly, whether in
; the spectral or the spatial domain)
method=SPA
; Plate solutions can be:
; * vWC1994 (best), or
; * G2009 (from Govers et al., 2009; not bad, but not
; as robust as vWC1994)
PlateSolutionType=vWC1994
[parameter]
YoungsModulus=65E9
PoissonsRatio=0.25
GravAccel=9.8
MantleDensity=3300
; This is the density of material (e.g., air, water)
; that is filling (or leaving) the hole that was
; created by flexure. If you do not have a constant
; density of infilling material, for example, at a
; subsiding shoreline, you must instead iterate (see
; [numerical], below).
InfillMaterialDensity=0
[input]
; space-delimited array of loads
; stresses (rho*g*h) if gridded (dx (and if applicable, dy)) will be applied
; to convert them into masses
; forces (rho*g*h*Area) if not gridded (SAS_NG)
; If the solution method (above) is selected as "SAS_NG", then this file
; will actually be of the format (x,[y],q0) and the code will sort it out.
; (Once again, working on a gridded output option for ungridded inputs)
Loads=q0_sample/2D/central_square_load.txt
;
; scalar value or space-delimited array of elastic thickness(es)
; array used for finite difference solutions
ElasticThickness=Te_sample/2D/10km_const.txt
;
; xw and yw are vectors of desired output points for the SAS_NG method.
; If they are not specified and a SAS_NG solution is run, the solution will be
; calculated at the points with the loads.
; they are ignored if a different solution method is chosen.
xw=
yw=
[output]
; DeflectionOut is for writing an output file.
; If this is blank, no output is printed.
; Otherwise, a space-delimited ASCII file of
; outputs is with this file name (and path).
DeflectionOut=tmpout.txt
;
; Acceptable inputs to "Plot" are q0 (loads), w (deflection), or both; any
; other entry here will result in no plotting.
; Automatically plots a 1D line or 2D surface based on the choice
; of "dimension" variable in [mode]
Plot=both
[numerical]
; dx [m]
GridSpacing_x=
;
; Boundary conditions can be:
; (FD): 0Slope0Shear, 0Moment0Shear, 0Displacement0Slope, Mirror, or Periodic
; For SAS or SAS_NG, NoOutsideLoads is valid, and no entry defaults to this
BoundaryCo
