Documentation ¶
Overview ¶
package out implements FE simulation output handling for analyses and plotting
Index ¶
- Constants
- Variables
- func ComputeExtrapolatedValues(extrapKeys []string)
- func Define(alias string, loc Locator)
- func Draw(dirout, fname string, show bool, extra ExtraPlt)
- func End()
- func GetCoords(alias string) []float64
- func GetDist(key, alias string) (dist []float64)
- func GetIds(alias string) (vids, ipids []int)
- func GetRes(key, alias string, idxI int) []float64
- func GetTexLabel(key, unit string) string
- func GetXYZ(key, alias string) (x, y, z []float64)
- func IntegOnPlane(key, alias string) (res []float64)
- func Integrate(key, alias, along string, idxI int) float64
- func LoadResults(times []float64)
- func ParseKey(key string) (string, int)
- func Plot(xHandle, yHandle interface{}, alias string, fm plt.Fmt, idxI int)
- func Splot(splotTitle string)
- func SplotConfig(xunit, yunit string, xscale, yscale float64)
- func Start(simfnpath string, stageIdx, regionIdx int)
- type Along
- type AlongX
- type AlongY
- type AlongZ
- type At
- type AtIp
- type ExtraPlt
- type Locator
- type N
- type OnZplane
- type P
- type PlaneData
- type PltEntity
- type Point
- type Points
- type ResultsMap
- type SplotDat
- type Styles
Constants ¶
const DIST_TOL = 1e-6 // tolerance to compare distances or proximity between points
Variables ¶
var ( TolC = 1e-8 // tolerance to compare x-y-z coordinates TolT = 1e-3 // tolerance to compare times Ndiv = 20 // bins n-division )
constants
var ( // data set by Start Sum *fem.Summary // summary Dom *fem.Domain // FE domain Ipoints []*fem.OutIpData // all integration points. ipid == index in Ipoints Cid2ips [][]int // [ncells][nip] maps cell id to index in Ipoints Ipkey2ips map[string][]int // maps ip keys to indices in Ipoints Ipkeys map[string]bool // all ip keys NodBins gm.Bins // bins for nodes IpsBins gm.Bins // bins for integration points IpsMin []float64 // [ndim] {x,y,z}_min among all ips IpsMax []float64 // [ndim] {x,y,z}_max among all ips // defined entities and results loaded by LoadResults Planes map[string]*PlaneData // for points defined on planes. maps aliases to data Results ResultsMap // maps labels => points TimeInds []int // selected output indices Times []float64 // selected output times // extrapolated values Extrap []string // keys to be extrapolated; e.g. []string{"nwlx", "nwly"} ExVals []map[string]float64 // [nverts][nkeys] extrapolated values // subplots Splots []*SplotDat // all subplots Csplot *SplotDat // current subplot )
Global variables
Functions ¶
func ComputeExtrapolatedValues ¶
func ComputeExtrapolatedValues(extrapKeys []string)
func Define ¶
Define defines aliases
alias -- an alias to a group of points, an individual point, or to a set of points. Example: "A", "left-column" or "a b c". If the number of points found is different than the number of aliases, a group is created. Note: To use spaces in aliases, prefix the alias with an exclamation mark; e.g "!right column"
func Draw ¶
Draw draws or save figure with plot
dirout -- directory to save figure fname -- file name; e.g. myplot.eps or myplot.png. Use "" to skip saving show -- shows figure extra -- is called just after Subplot command and before any plotting Note: subplots will be split if using 'eps' files
func GetDist ¶
GetDist returns the distance from a reference point on the given line with selected points if they contain a given key
key -- use any to get coordinates of points with any key such as "ux", "pl", etc.
func GetRes ¶
GetRes gets results as a time or space series corresponding to a given alias for a single point or set of points.
idxI -- index in TimeInds slice corresponding to selected output time; use -1 for the last item. If alias defines a single point, the whole time series is returned and idxI is ignored.
func GetTexLabel ¶
func GetXYZ ¶
GetXYZ returns the x-y-z coordinates of selected points that have a specified key
key -- use any to get coordinates of points with any key such as "ux", "pl", etc.
func IntegOnPlane ¶
IntegOnPlane integrates the results of nodes located on a plane perpedicular to either {x,y,z} The mesh on the plane must be structured and with rectangle elements in order to build an {u,v} coordinates system Input:
key -- node variable; e.g. "uz", "ex_sz" alias -- alias of plane; e.g. "surf"
Output:
res -- the result of the integration res = ∫_u ∫_v f(u,v) du dv for all output times
func Integrate ¶
Integrate integrates key along direction "x", "y", or "z"
idxI -- index in TimeInds slice corresponding to selected output time; use -1 for the last item. If alias defines a single point, the whole time series is returned and idxI is ignored.
func LoadResults ¶
func LoadResults(times []float64)
LoadResults loads all results after points are defined
times -- specified selected output times use nil to indicate that all times are required
func ParseKey ¶
ParseKey parses key like "duxdt" returning "ux" and time derivative number
Output: {key, number-of-time-derivatives} Examples: "ux" => "ux", 0 "duxdt" => "ux", 1 "d2uxdt2" => "ux", 2
func Plot ¶
Plot plots data
xHandle -- can be a string, e.g. "t" or a slice, e.g. pc = []float64{0, 1, 2} yHandle -- can be a string, e.g. "pl" or a slice, e.g. sl = []float64{0, 1, 2} alias -- alias such as "centre" fm -- formatting codes; e.g. plt.Fmt{C:"blue", L:"label"} idxI -- index of time; use -1 for all times
func SplotConfig ¶
SplotConfig configures units and scales of axes
Types ¶
type Along ¶
type Along [][]float64
Along implements locator along line => LineLocator
Example: with 2 points in 3D: {{0,0,0}, {1,1,1}}
type AlongX ¶
type AlongX []float64
AlongX implements LineLocator with []float64{y_cte} or []float64{y_cte, z_cte}
type AlongY ¶
type AlongY []float64
AlongY implements LineLocator with []float64{x_cte} or []float64{x_cte, z_cte}
type AtIp ¶
type AtIp []float64
AtIp implements locator at integration point => PointLocator
Note: this is useful when there are vertices overlapping ips
type ExtraPlt ¶
type ExtraPlt func(i, j, nplots int)
ExtraPlt defines a callback function for extra plt commands
Note: i and j are indices as in Subplot
type Locator ¶
type Locator interface {
Locate() Points
}
PointLocator defines interface for locating space positions
type OnZplane ¶
type OnZplane []float64
OnZplane implements locator for nodes/ips on plane perpendicular to z-axis
Note: slice must contain at least one value; e.g. []float64{z_cte} a second value is used as tolerance; e.g. []float64{z_cte, z_tolerance}
type P ¶
type P [][]int
P implements [element][integrationPoint] locator Pairs of ids or tags of cells and integration points indices can be stored in Cells
Note: 1) negative element ids means element tags 2) negative integration poitns ids means all integration points of element
type PlaneData ¶
type PlaneData struct { Plane int // Plane indicator: {0,1,2} == {x-pane, y-plane, z-plane}. plane perpendicular to {x,y,z} Ids map[int]bool // Ids in Dom.Msh.Verts or Ipoints of notes/ips on plane Dx []float64 // Increments between cells in global coordinates Iu []int // Index of global coordinates corresponding to {u,v} plane Du []float64 // Increments between cells in {u,v} coordinates Umin []float64 // min {u,v} coordinates Umax []float64 // max {u,v} coordinates Nu []int // number of divisions along {u,v} Ubins gm.Bins // bins to search points in {u,v} grid F [][]float64 // [nu][nv] values of a function evaluated at the uv coords; i.e. f(u,v) // contains filtered or unexported fields }
PlaneData holds data for handling planes described by {u,v}-coordinates
func NodesOnPlane ¶
NodesOnPlane finds vertices located on {x,y,z} plane and returns an iterator that can be used to extract results on the plane. An {u,v}-coordinates system is built on the plane.
Input: ftag -- cells' face tag; e.g. -31 Output: dat -- plane data holding vertices on plane and other information; see above Note: 1) this function works with 3D cells only 2) faces on cells must be either "qua4" or "qua8" types 3) middle nodes in "qua8" are disregarded in order to buidl an {u,v} grid 4) the resulting mesh on plane must be equally spaced; i.e. Δx and Δy are constant; but not necessarily equal to each other
func (*PlaneData) ConnectResults ¶
ConnectResults connects Ids to Points in Results structure
type PltEntity ¶
type PltEntity struct { Alias string // alias X []float64 // x-values Y []float64 // y-values Xlbl string // horizontal axis label (raw; e.g. "t") Ylbl string // vertical axis label (raw; e.g. "pl") Style plt.Fmt // style }
PltEntity stores all data for a plot entity (X vs Y)
type Point ¶
type Point struct { Vid int // vertex id; -1 => not node IpId int // ip id; -1 => not ip X []float64 // coordinates Dist float64 // distance from reference point (if along line) Vals map[string][]float64 // combines keys to results along time; e.g. "ux" : {0,0.0001,0,0002,...} }
Point holds information about one specific node xor one integration point
type ResultsMap ¶
ResultsMap maps aliases to points
func (ResultsMap) String ¶
func (o ResultsMap) String() string
type SplotDat ¶
type SplotDat struct { Title string // title of subplot Topts string // title options Xscale float64 // x-axis scale Yscale float64 // y-axis scale Xlbl string // x-axis label (formatted; e.g. "$t$") Ylbl string // y-axis label (formatted; e.g. "$p_{\ell}$") GllArgs string // extra arguments for Gll such as leg_out Data []*PltEntity // data and styles to be plotted }
SplotDat stores all data for one subplot