Skip to content

Concise GPU and CPU iterative Stokes solver for viscous glacier flow

License

Notifications You must be signed in to change notification settings

PTsolvers/ViscousGlacier2D.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ViscousGlacier2D

Concise CPU and GPU iterative Stokes solvers for viscous flow - 2D glacier examples.

Description

This repository contains GPU and CPU implementations of a 2D Stokes solver to resolve glacier flow on an inclined plane with a stress-free surface. The routines exemplify the implementation of a fast and concise (60 lines of code) iterative solving strategy referred to as Pseudo-Transient. The core of the Pseudo-Transient approach relies in using physics-motivated transient terms within differential equations in order to iteratively converge to an accurate solution.

The routines relate to a seminar on "Simply solving PDEs". The seminar presentation is accessible here. Further material relating to the pseudo-transient method and pseudo-transient solvers can be found here.

Content

Script list

The /scripts folder contains the following PT routines:

The keywords in the code naming stand for:

  • gpu: Nvidia GPU ready routines using the CUDA.jl package
  • nondim: non-dimensional version of the code, using natural scaling

Usage

The routines are written in Julia and can be executed from the REPL. Output is produced using PyPlot.jl requiring a valid and on PATH python (+ matplotlib) install.

Example running the viscous_gl2D_nondim.jl routine.

  1. Launch Julia
% julia --project
  1. ENter package mode ] and instantiate the environment
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.0 (2020-08-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia>

(ViscousGlacier2D) pkg> activate .

(ViscousGlacier2D) pkg> instantiate

(ViscousGlacier2D) pkg> st
Status `~/Documents/git/github/ViscousGlacier2D/Project.toml`
  [d330b81b] PyPlot v2.9.0

(ViscousGlacier2D) pkg> 

julia> 
  1. Run the script
julia> include("scripts/viscous_gl2D_nondim.jl")
error = 0.007844763087162187
error = 0.0035814871757943543
error = 0.0005235773871451197
error = 6.932325914314143e-5
error = 2.3742721434622532e-5
error = 9.103473750402527e-7
error = 7.903400522027475e-7
error = 7.196251086591826e-8
error = 1.9440634300592754e-8
error = 4.161439365592243e-9
error = 2.54854535939787e-10
error = 1.6094254786093418e-10

julia> 

Output

The output of running the viscous_gl2D_nondim.jl script is following Viscous 2D full Stokes flow (2D glacier) with stress free surface

Questions and comments

Contact me or open an issue if you have any questions or comments about the presented material.

Seminar presentation

Simply solving PDEs

About

Concise GPU and CPU iterative Stokes solver for viscous glacier flow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 100.0%