ptrack

package module
v0.0.0-...-e133cae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2023 License: GPL-3.0 Imports: 23 Imported by: 0

README

ptrack.go

A generalized particle tracking and flux-field analysis suite, designed for unstructured model structures and computational scalability.

current version includes:
  • the Pollock (1989) method (only works for rectilinear model grids)
  • the Waterloo method: a semi-analytic groundwater particle tracking algorithm (Muhammad Ramadhan, 2015)
  • Euler and Runge-Kutta pathline integration schemes with adaptive time-stepping
  • reads MODFLOW6 output files
  • output results to *.vtk for 3D visualizations and animations
work in progress:
  • FlowSource volumetric flow tracking (Foley and Black, 2017)
  • additional processing:
    • Monte Carlo uncertainty analysis
    • particle endpoint cluster analysis

more details to come..

References

Foley and Black, 2017. Efficiently delineating volumetric capture areas and flow pathways using directed acyclic graphs and MODFLOW-description of the algorithms within FlowSource.

Pollock, D.W., 1989, Documentation of a computer program to compute and display pathlines using results from the U.S. Geological Survey modular three-dimensional finite-difference ground-water flow model: U.S. Geological Survey Open-File Report 89–381.

Muhammad Ramadhan, 2015. A Semi-Analytic Particle Tracking Algorithm for Arbitrary Unstructured Grids. MASc thesis. University of Waterloo.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportPathlinesGob

func ExportPathlinesGob(fp string, pl [][]Particle) error

func ExportVTKpathlines

func ExportVTKpathlines(filepath string, pl [][][]float64, vertExag float64)

ExportVTKpathlines saves particle tracking results as a *.vtk file for visualization.

func LoadPathlinesGOB

func LoadPathlinesGOB(fp string) ([][]Particle, int64, error)

func SaveGeojson

func SaveGeojson(fp string, apl [][]Particle, epl int)

Types

type Domain

type Domain struct {
	VF map[int]VelocityFielder // prism velocity field

	Nly      int     // (optional) number of layers
	Minthick float64 // "pinchout" thickness
	// contains filtered or unexported fields
}

Domain is a set of cells that constitute a model

func ReadFLX

func ReadFLX(hstratFP, flxFP string) (Domain, *grid.Definition)

currently needs an accompanying .gdef; also not reading wells

func ReadHGS

func ReadHGS(q_pmFP string) Domain

currently reads only 1 state.

func ReadHSTRAT

func ReadHSTRAT(hstratFP string) (Domain, *mesh.Slice)

currently reads only 1 state.

func ReadMODFLOW

func ReadMODFLOW(fprfx string) Domain

ReadMODFLOW reads a MODFLOW6 output file

func (*Domain) ExportGridNetworkGob

func (d *Domain) ExportGridNetworkGob(fp string, gd *grid.Definition, pl [][]Particle) error

func (*Domain) ExportMeshNetworkGob

func (d *Domain) ExportMeshNetworkGob(fp string, pl [][]Particle, nv int) error

func (*Domain) ExportVTK

func (d *Domain) ExportVTK(filepath string, vertExag float64)

ExportVTK saves model domain as a *.vtk file for visualization.

func (*Domain) MakePollock

func (d *Domain) MakePollock(dt float64)

MakePollock creates velocity field using the Pollock (MODPATH) Method

func (*Domain) MakeVector

func (d *Domain) MakeVector()

MakeVector creates velocity field based on a uniform prism velocity vector

func (*Domain) MakeWaterloo

func (d *Domain) MakeWaterloo(pt ParticleTracker)

MakeWaterloo creates velocity field using the Waterloo Method

func (*Domain) New

func (d *Domain) New(prsms map[int]*Prism, conn map[int][]int, pflxs map[int][]float64, qwell map[int]float64)

New Domain constructor

func (*Domain) Nprism

func (d *Domain) Nprism() int

Nprism returns the prisms (cells) in the domain

func (*Domain) ParticleToPrismIDs

func (d *Domain) ParticleToPrismIDs(p *Particle, pidFrom int) []int

ParticleToPrismIDs returns a set of prisms for which a particle is located position index: left-up-right-down-bottom-top

func (*Domain) Print

func (d *Domain) Print()

Print properties of the domain

func (*Domain) PrintToCSV

func (d *Domain) PrintToCSV(fp string)

func (*Domain) Prism

func (d *Domain) Prism(pid int) *Prism

func (*Domain) PrismTopsToSaturated

func (d *Domain) PrismTopsToSaturated()

func (*Domain) Prisms

func (d *Domain) Prisms() map[int]*Prism

func (*Domain) ResetTops

func (d *Domain) ResetTops(v float64)

func (*Domain) ReverseVectorField

func (d *Domain) ReverseVectorField()

func (*Domain) TrackCentroidalParticles

func (d *Domain) TrackCentroidalParticles(excl map[int]bool) ([][]Particle, int, []int)

Track a collection of particles through the centroid of at least 1 model cell

func (*Domain) TrackCentroidalParticlesReverse

func (d *Domain) TrackCentroidalParticlesReverse() ([][]Particle, int, []int)

Track a collection of particles through the centroid of at least 1 model cell

func (*Domain) TrackParticles

func (d *Domain) TrackParticles(p Particles) ([][]Particle, int)

Track a collection of particles through the domain

type EulerSpace

type EulerSpace struct{ Ds float64 }

EulerSpace constant space step Euler particle pathline integration scheme

func (*EulerSpace) TestTracktoExit

func (es *EulerSpace) TestTracktoExit(p *Particle, q *Prism, w VelocityFielder) []Particle

testTrack track particle to the next space step

type EulerTime

type EulerTime struct{ Dt float64 }

EulerTime constant time step Euler particle pathline integration scheme

func (*EulerTime) TestTracktoExit

func (et *EulerTime) TestTracktoExit(p *Particle, q *Prism, w VelocityFielder) []Particle

testTrack track particle to the next time step

type Particle

type Particle struct {
	I, C       int
	X, Y, Z, T float64
}

Particle struct

func (*Particle) Dist

func (p *Particle) Dist(p1 *Particle) float64

Dist returns the Euclidian distance between to points

func (*Particle) PrintState

func (p *Particle) PrintState() string

PrintState returns the particles current state in CSV format

func (*Particle) ResetState

func (p *Particle) ResetState(s []float64)

type ParticleTracker

type ParticleTracker interface {
	// contains filtered or unexported methods
}

ParticleTracker interface to particle tracking methods

type Particles

type Particles []Particle

Particles is a collection of Particle

type PollockMethod

type PollockMethod struct {
	// contains filtered or unexported fields
}

PollockMethod is the solution to the pollock method Pollock, D.W., 1989, Documentation of a computer program to compute and display pathlines using results from the U.S. Geological Survey modular three-dimensional finite-difference ground-water flow model: U.S. Geological Survey Open-File Report 89–381. Pollock, D.W., 2016, User guide for MODPATH Version 7—A particle-tracking model for MODFLOW: U.S. Geological Survey Open-File Report 2016–1086, 35 p., http://dx.doi.org/10.3133/ofr20161086.

func (*PollockMethod) Local

func (pm *PollockMethod) Local(p *Particle) (float64, bool)

Local returns whether the point is solvable within the solution space

func (*PollockMethod) New

func (pm *PollockMethod) New(q *Prism, zwl complex128, Qx0, Qx1, Qy0, Qy1, Qz0, Qz1, dt float64)

New PollockMethod constructor

func (*PollockMethod) PointVelocity

func (pm *PollockMethod) PointVelocity(p *Particle, d1 *Prism, d2 float64) (float64, float64, float64)

PointVelocity returns the velocity vector for a given (x,y,z) coordinate. (must only be used with rectilinear cells)

func (*PollockMethod) ReverseVectorField

func (pm *PollockMethod) ReverseVectorField()

func (*PollockMethod) TestTracktoExit

func (pm *PollockMethod) TestTracktoExit(p *Particle, q *Prism, vf VelocityFielder) []Particle

type Prism

type Prism struct {
	Z                           []complex128
	Top, Bot, Area, Bn, Por, Tn float64
}

Prism struct represents a singular model prism

func (*Prism) Centroid

func (q *Prism) Centroid() (x, y, z float64)

Centroid returns the coordinates of the prism centroid

func (*Prism) CentroidParticle

func (q *Prism) CentroidParticle(i int) *Particle

CentroidParticle returns the coordinates of the prism centroid

func (*Prism) CentroidXY

func (q *Prism) CentroidXY() (x, y float64)

CentroidXY returns the coordinates of the prism centroid

func (*Prism) Contains

func (q *Prism) Contains(p *Particle) bool

Contains returns true if the given particle is contained by the prism bounds

func (*Prism) ContainsXY

func (q *Prism) ContainsXY(x, y float64) bool

ContainsXY returns true if the given (x,y) coordinates are contained by the prism planform bounds

func (*Prism) ContainsXYZ

func (q *Prism) ContainsXYZ(x, y, z float64) bool

ContainsXYZ returns true if the given (x,y) coordinates are contained by the prism planform bounds

func (*Prism) New

func (q *Prism) New(z []complex128, top, bot, bn, tn, porosity float64)

New prism constructor

func (*Prism) Saturation

func (q *Prism) Saturation() float64

type RungeKutta

type RungeKutta struct{ Dt float64 }

RungeKutta particle pathline integration scheme

func (*RungeKutta) TestTracktoExit

func (rk *RungeKutta) TestTracktoExit(p *Particle, q *Prism, w VelocityFielder) []Particle

testTracktoExit track particle to the next point

type RungeKuttaAdaptive

type RungeKuttaAdaptive struct{ Ds, Dt float64 }

RungeKuttaAdaptive particle pathline integration scheme

func (*RungeKuttaAdaptive) TestTracktoExit

func (rk *RungeKuttaAdaptive) TestTracktoExit(p *Particle, q *Prism, w VelocityFielder) []Particle

testTracktoExit track particle to the next point

type VectorMethSoln

type VectorMethSoln struct {
	// contains filtered or unexported fields
}

VectorMethSoln uses a uniform vector within a prism

func (*VectorMethSoln) Local

func (vm *VectorMethSoln) Local(p *Particle) (float64, bool)

Local returns whether the point is solvable within the solution space

func (*VectorMethSoln) New

func (vm *VectorMethSoln) New(zc complex128, q []float64, por, r float64)

func (*VectorMethSoln) PointVelocity

func (vm *VectorMethSoln) PointVelocity(d1 *Particle, d2 *Prism, d3 float64) (float64, float64, float64)

PointVelocity returns the velocity vector for a given (x,y,z) coordinate

func (*VectorMethSoln) ReverseVectorField

func (vm *VectorMethSoln) ReverseVectorField()

type VelocityFielder

type VelocityFielder interface {
	PointVelocity(p *Particle, q *Prism, v float64) (float64, float64, float64)
	Local(p *Particle) (float64, bool)
	ReverseVectorField()
}

VelocityFielder interface for flux field scheme

type Vert

type Vert struct {
	X, Y, Z, T                                               float64
	VertID, PathID, PrsmID, CellID, Layer, Order, USid, DSid int
}

func LoadNetworkGob

func LoadNetworkGob(fp string) ([]*Vert, error)

type WatMethSoln

type WatMethSoln struct {
	// contains filtered or unexported fields
}

WatMethSoln (The Waterloo Method Solution): is a struct that contains a grid cell's internal flow field Ramadhan, M., 2015, A Semi-Analytical Particle Tracking Algorithm for Arbitrary Unstructured Grids. Unpublished MASc. Thesis. University of Waterloo, Waterloo Ontario.

func (*WatMethSoln) ExportComplexPotentialField

func (w *WatMethSoln) ExportComplexPotentialField(q *Prism, pointDensity int)

ExportComplexPotentialField creates a *.csv file containing the distribution of the resulting complex potential field for viewing

func (*WatMethSoln) Local

func (w *WatMethSoln) Local(p *Particle) (float64, bool)

Local returns whether the point is solvable within the solution space

func (*WatMethSoln) New

func (w *WatMethSoln) New(prismID int, p *Prism, Qj []float64, zw complex128, Qtop, Qbot, Qwell float64, m, n int, prnt bool)

New WatMethSoln constructor

func (*WatMethSoln) PointVelocity

func (w *WatMethSoln) PointVelocity(p *Particle, q *Prism, dbdt float64) (float64, float64, float64)

PointVelocity returns the velocity vector for a given (x,y,z) coordinate. ** Set dbdt = 0. for steady-state cases

func (*WatMethSoln) ReverseVectorField

func (w *WatMethSoln) ReverseVectorField()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL