Documentation ¶
Overview ¶
package inp implements the input data read from a (.sim) JSON file
Index ¶
- Constants
- Variables
- func FlushLog()
- func InitLogFile(dirout, fnamekey string) (err error)
- func LogErr(err error, msg string) (stop bool)
- func LogErrCond(condition bool, msg string, prm ...interface{}) (stop bool)
- func MatfileNew2Old(dirout string, fnold, fnnew string, convertsymbols bool)
- func MatfileOld2New(dirout string, fnnew, fnold string, convertsymbols bool)
- type Cell
- type CellFaceId
- type CellSeamId
- type Data
- type EleCond
- type ElemData
- type FaceBc
- type FuncData
- type FuncsData
- type GeoStData
- type ImportRes
- type IniStressData
- type InitialData
- type LinSolData
- type MatDb
- type Material
- type MatsData
- type Mesh
- type NodeBc
- type PlotFdata
- type Region
- type SeamBc
- type Simulation
- type SolverData
- type Stage
- type TimeControl
- type Vert
Constants ¶
const Ztol = 1e-7
constants
Variables ¶
var LogFile *os.File
LogFile holds a handle to errors logger file
Functions ¶
func InitLogFile ¶
InitLogFile initialises logger
func LogErrCond ¶
LogErr logs error using condition (==true) to stop and returs stop flag
func MatfileNew2Old ¶
MatfileNew2Old converts a new mat file to the old mat file format
convertsymbols -- convert back symbols with Greek characters to UTF-8
func MatfileOld2New ¶
MatfileOld2New converts an old mat file to new mat file format
convertsymbols -- convert symbols with Greek characters to ANSI
Types ¶
type Cell ¶
type Cell struct { // input data Id int // id Tag int // tag Geo int // geometry type (gemlab code) Type string // geometry type (string) Part int // partition id Verts []int // vertices FTags []int // edge (2D) or face (3D) tags STags []int // seam tags (for 3D only; it is actually a 3D edge tag) JlinId int // joint line id JsldId int // joint solid id // neighbours Neighs []int // neighbours; e.g. [3, 7, -1, 11] => side:cid => 0:3, 1:7, 2:-1(no cell), 3:11 // derived Shp *shp.Shape // shape structure // specific problems data IsJoint bool // cell represents joint element SeepVerts map[int]bool // local vertices ids of vertices on seepage faces }
Cell holds cell data
type CellFaceId ¶
CellFaceId structure
type CellSeamId ¶
CellSeamId structure
type Data ¶
type Data struct { // global information Desc string `json:"desc"` // description of simulation Matfile string `json:"matfile"` // materials file path DirOut string `json:"dirout"` // directory for output; e.g. /tmp/gofem Encoder string `json:"encoder"` // encoder name; e.g. "gob" "json" "xml" // problem definition and options Steady bool `json:"steady"` // steady simulation Pstress bool `json:"pstress"` // plane-stress Axisym bool `json:"axisym"` // axisymmetric NoLBB bool `json:"nolbb"` // do not satisfy Ladyženskaja-Babuška-Brezzi condition; i.e. do not use [qua8,qua4] for u-p formulation LogBcs bool `json:"logbcs"` // log boundary conditions setting up Debug bool `json:"debug"` // activate debugging Stat bool `json:"stat"` // activate statistics Wlevel float64 `json:"wlevel"` // water level; 0 means use max elevation Surch float64 `json:"surch"` // surcharge load at surface == qn0 // options React bool `json:"react"` // indicates whether or not reaction forces must be computed ShowR bool `json:"showr"` // show residual NoDiv bool `json:"nodiv"` // disregard divergence control in both fb or Lδu CteTg bool `json:"ctetg"` // use constant tangent (modified Newton) during iterations // derived FnameDir string // directory where .sim filename is locatd FnameKey string // simulation filename key; e.g. mysim01.sim => mysim01 }
Data holds global data for simulations
func (*Data) PostProcess ¶
PostProcess performs a post-processing of the just read json file
type EleCond ¶
type EleCond struct { Tag int `json:"tag"` // tag of cell/element Keys []string `json:"keys"` // key indicating type of condition. ex: "g" (gravity), "qn" for beams, etc. Funcs []string `json:"funcs"` // name of function. ex: grav, none Extra string `json:"extra"` // extra information. ex: '!λl:10' }
EleCond holds element condition
type ElemData ¶
type ElemData struct { Tag int `json:"tag"` // tag of element Mat string `json:"mat"` // material name Type string `json:"type"` // type of element. ex: u, p, up, rod, beam, rjoint Nip int `json:"nip"` // number of integration points; 0 => use default Nipf int `json:"nipf"` // number of integration points on face; 0 => use default Extra string `json:"extra"` // extra flags (in keycode format). ex: "!thick:0.2 !nip:4" Inact bool `json:"inact"` // whether element starts inactive or not }
ElemData holds element data
type FaceBc ¶
type FaceBc struct { Tag int `json:"tag"` // tag of face Keys []string `json:"keys"` // key indicating type of bcs. ex: qn, pw, ux, uy, uz, wwx, wwy, wwz Funcs []string `json:"funcs"` // name of function. ex: zero, load, myfunction1, etc. Extra string `json:"extra"` // extra information. ex: '!λl:10' }
FaceBc holds face boundary condition
type FuncData ¶
type FuncData struct { Name string `json:"name"` // name of function. ex: zero, load, myfunction1, etc. Type string `json:"type"` // type of function. ex: cte, rmp Prms fun.Prms `json:"prms"` // parameters }
FuncData holds function definition
type FuncsData ¶
type FuncsData []*FuncData
Funcs holds functions
type GeoStData ¶
type GeoStData struct { Nu []float64 `json:"nu"` // [nlayers] Poisson's coefficient to compute effective horizontal state for each layer K0 []float64 `json:"K0"` // [nlayers] Earth pressure coefficient at rest to compute effective horizontal stresses UseK0 []bool `json:"useK0"` // [nlayers] use K0 to compute effective horizontal stresses instead of "nu" Layers [][]int `json:"layers"` // [nlayers][ntagsInLayer]; e.g. [[-1,-2], [-3,-4]] => 2 layers }
GeoStData holds data for setting initial geostatic state (hydrostatic as well)
type ImportRes ¶
type ImportRes struct { Dir string `json:"dir"` // output directory with previous simulation files Fnk string `json:"fnk"` // previous simulation file name key (without .sim) ResetU bool `json:"resetu"` // reset/zero u (displacements) }
ImportRes holds definitions for importing results from a previous simulation
type IniStressData ¶
type IniStressData struct { Hom bool `json:"hom"` // homogeneous stress distribution Iso bool `json:"iso"` // isotropic state Psa bool `json:"psa"` // plane-strain state S0 float64 `json:"s0"` // Iso => stress value to use in homogeneous and isotropic distribution Sh float64 `json:"sh"` // Psa => horizontal stress Sv float64 `json""sv"` // Psa => vertical stress Nu float64 `json:"nu"` // Psa => Poisson's coefficient for plane-strain state }
IniStressData holds data for setting initial stresses
type InitialData ¶
type InitialData struct { Fcn string `json:"fcn"` // function F(t, x) is given; from functions database File string `json:"file"` // file with values at each node is given; filename with path is provided }
InitialData holds data for setting initial solution values such as Y, dYdt and d2Ydt2
type LinSolData ¶
type LinSolData struct { Name string `json:"name"` // "mumps" or "umfpack" Symmetric bool `json:"symmetric"` // use symmetric solver Verbose bool `json:"verbose"` // verbose? Timing bool `json:"timing"` // show timing statistics Ordering string `json:"ordering"` // ordering scheme Scaling string `json:"scaling"` // scaling scheme }
LinSolData holds data for linear solvers
func (*LinSolData) PostProcess ¶
func (o *LinSolData) PostProcess()
PostProcess performs a post-processing of the just read json file
type MatDb ¶
type MatDb struct { Functions FuncsData `json:"functions"` // all functions Materials MatsData `json:"materials"` // all materials }
MatDb implements a database of materials
type Material ¶
type Material struct { Name string `json:"name"` // name of material Desc string `json:"desc"` // description of material Model string `json:"model"` // name of model ex: 'dp', 'vm', 'elast', etc. Extra string `json:"extra"` // extra information about this material Prms fun.Prms `json:"prms"` // prms holds all model parameters for this material }
Material holds material data
type Mesh ¶
type Mesh struct { // from JSON Verts []*Vert // vertices Cells []*Cell // cells // derived FnamePath string // complete filename path Ndim int // space dimension Xmin, Xmax float64 // min and max x-coordinate Ymin, Ymax float64 // min and max x-coordinate Zmin, Zmax float64 // min and max x-coordinate // derived: maps VertTag2verts map[int][]*Vert // vertex tag => set of vertices CellTag2cells map[int][]*Cell // cell tag => set of cells FaceTag2cells map[int][]CellFaceId // face tag => set of cells FaceTag2verts map[int][]int // face tag => vertices on tagged face SeamTag2cells map[int][]CellSeamId // seam tag => set of cells Ctype2cells map[string][]*Cell // cell type => set of cells Part2cells map[int][]*Cell // partition number => set of cells }
Mesh holds a mesh for FE analyses
type NodeBc ¶
type NodeBc struct { Tag int `json:"tag"` // tag of node Keys []string `json:"keys"` // key indicating type of bcs. ex: pw, ux, uy, uz, wwx, wwy, wwz Funcs []string `json:"funcs"` // name of function. ex: zero, load, myfunction1, etc. Extra string `json:"extra"` // extra information. ex: '!λl:10' }
NodeBc holds node boundary condition
type PlotFdata ¶
type PlotFdata struct { Ti float64 `json:"ti"` // initial time Tf float64 `json:"tf"` // final time Np int `json:"np"` // number of points Skip []string `json:"skip"` // skip functions WithG bool `json:"withg"` // with dF/dt WithH bool `json:"withh"` // with d²F/dt² Eps bool `json:"eps"` // save eps instead of png WithTxt bool `json:"withtxt"` // show text corresponding to initial and final points }
PlotFdata holds information to plot functions
type Region ¶
type Region struct { // input data Desc string `json:"desc"` // description of region. ex: ground, indenter, etc. Mshfile string `json:"mshfile"` // file path of file with mesh data ElemsData []*ElemData `json:"elemsdata"` // list of elements data // derived Msh *Mesh // the mesh // contains filtered or unexported fields }
Region holds region data
type SeamBc ¶
type SeamBc struct { Tag int `json:"tag"` // tag of seam Keys []string `json:"keys"` // key indicating type of bcs. ex: qn, pw, ux, uy, uz, wwx, wwy, wwz Funcs []string `json:"funcs"` // name of function. ex: zero, load, myfunction1, etc. Extra string `json:"extra"` // extra information. ex: '!λl:10' }
SeamBc holds seam (3D edge) boundary condition
type Simulation ¶
type Simulation struct { // input Data Data `json:"data"` // stores global simulation data Functions FuncsData `json:"functions"` // stores all boundary condition functions PlotF *PlotFdata `json:"plotf"` // plot functions Regions []*Region `json:"regions"` // stores all regions LinSol LinSolData `json:"linsol"` // linear solver data Solver SolverData `json:"solver"` // FEM solver data Stages []*Stage `json:"stages"` // stores all stages // derived Mdb *MatDb // materials database Ndim int // space dimension MaxElev float64 // maximum elevation Gfcn fun.Func // first stage: gravity constant function WaterRho0 float64 // first stage: intrinsic density of water corresponding to pressure pl=0 WaterBulk float64 // first stage: bulk modulus of water WaterLevel float64 // first stage: water level == max(Wlevel, MaxElev) }
Simulation holds all simulation data
func ReadSim ¶
func ReadSim(dir, fn, logPrefix string, erasefiles bool) *Simulation
ReadSim reads all simulation data from a .sim JSON file
Notes: 1) this function initialises log file 2) returns nil on errors
type SolverData ¶
type SolverData struct { // constants Eps float64 // smallest number satisfying 1.0 + ϵ > 1.0 // nonlinear solver NmaxIt int `json:"nmaxit"` // number of max iterations Atol float64 `json:"atol"` // absolute tolerance Rtol float64 `json:"rtol"` // relative tolerance FbTol float64 `json:"fbtol"` // tolerance for convergence on fb FbMin float64 `json:"fbmin"` // minimum value of fb DvgCtrl bool `json:"dvgctrl"` // use divergence control NdvgMax int `json:"ndvgmax"` // max number of continued divergence // Richardson's extrapolation RE bool // Richardson extrapolation is active REnogus bool // Richardson extrapolation: no Gustafsson's step control REnssmax int // Richardson extrapolation: max number of substeps REatol float64 // Richardson extrapolation: absolute tolerance RErtol float64 // Richardson extrapolation: relative tolerance REmfac float64 // Richardson extrapolation: multiplier factor REmmin float64 // Richardson extrapolation: min multiplier REmmax float64 // Richardson extrapolation: max multiplier // transient analyses DtMin float64 `json:"dtmin"` // minium value of Dt for transient (θ and Newmark / Dyn coefficients) Theta float64 `json:"theta"` // θ-method ThGalerkin bool `json:"thgalerkin"` // use θ = 2/3 ThLiniger bool `json:"thliniger"` // use θ = 0.878 // dynamics Theta1 float64 `json:"theta1"` // Newmark's method parameter Theta2 float64 `json:"theta2"` // Newmark's method parameter HHT bool `json:"hht"` // use Hilber-Hughes-Taylor method HHTalp float64 `json:"hhtalp"` // HHT α parameter // combination of coefficients ThCombo1 bool `json:"thcombo1"` // use θ=2/3, θ1=5/6 and θ2=8/9 to avoid oscillations // derived Itol float64 // iterations tolerance }
SolverData holds FEM solver data
func (*SolverData) PostProcess ¶
func (o *SolverData) PostProcess()
PostProcess performs a post-processing of the just read json file
type Stage ¶
type Stage struct { // main Desc string `json:"desc"` // description of simulation stage. ex: activation of top layer Activate []int `json:"activate"` // array of tags of elements to be activated Deactivate []int `json:"deactivate"` // array of tags of elements to be deactivated Save bool `json:"save"` // save stage data to binary file Load string `json:"load"` // load stage data (filename) from binary file Skip bool `json:"skip"` // do not run stage // specific problems data HydroSt bool `json:"hydrost"` // hydrostatic initial condition SeepFaces []int `json:"seepfaces"` // face tags corresponding to seepage faces IniStress *IniStressData `json:"inistress"` // initial stress data GeoSt *GeoStData `json:"geost"` // initial geostatic state data (hydrostatic as well) Import *ImportRes `json:"import"` // import results from another previous simulation Initial *InitialData `json:"initial"` // set initial solution values such as Y, dYdt and d2Ydt2 // conditions EleConds []*EleCond `json:"eleconds"` // element conditions. ex: gravity or beam distributed loads FaceBcs []*FaceBc `json:"facebcs"` // face boundary conditions SeamBcs []*SeamBc `json:"seambcs"` // seam (3D) boundary conditions NodeBcs []*NodeBc `json:"nodebcs"` // node boundary conditions // timecontrol Control TimeControl `json:"control"` // time control }
Stage holds stage data
type TimeControl ¶
type TimeControl struct { Tf float64 `json:"tf"` // final time Dt float64 `json:"dt"` // time step size (if constant) DtOut float64 `json:"dtout"` // time step size for output DtFcn string `json:"dtfcn"` // time step size (function name) DtoFcn string `json:"dtofcn"` // time step size for output (function name) // derived DtFunc fun.Func // time step function DtoFunc fun.Func // output time step function }
TimeControl holds data for defining the simulation time stepping