Documentation ¶
Overview ¶
package inp implements the input data read from a (.sim) JSON file
Index ¶
- Constants
- type Cell
- type CellFaceId
- type CellSeamId
- type Data
- type EleCond
- type ElemData
- type FaceBc
- type FaceCond
- type FaceConds
- type FuncData
- type FuncsData
- type IniFcnData
- type IniImportRes
- type IniPorousData
- type IniStressData
- 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 ( TOL_ZMIN_FOR_3D = 1e-7 TOL_COINCIDENT_VERTS = 1e-5 )
constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 // derived Shp *shp.Shape // shape structure FaceBcs FaceConds // face boundary condition GoroutineId int // go routine id Disabled bool // cell is disabled (regardless inactive flag) // specific problems data IsBeam bool // simple beam element (no need for shape structure) IsJoint bool // cell represents joint element IsSolid bool // is 2D or 3D solid element; i.e. not "lin#", not "beam", not "joint" SeepVerts map[int]bool // local vertices ids of vertices on seepage faces Extrap bool // needs to extrapolate internal values; e.g. because is connected to joint JntConVerts []int // vertices of solids connected to it JntConCells []int // cells connected to it // NURBS Nrb int // index of NURBS patch to which this cell belongs to Span []int // knot indices indicating which span this cell is located }
Cell holds cell data
func (*Cell) GetNverts ¶
GetNverts returns the number of vertices, whether LBB condition is on or not
func (*Cell) GetSimilar ¶
GetSimilar allocates a copy of this cell
Note: the resulting cell with share the same slices as the original one => not a full copy
func (*Cell) GetVtkInfo ¶
GetVtkInfo returns information about this cell for generating VTK files
func (*Cell) SetFaceConds ¶
SetFaceConds sets face boundary conditions map in cell
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 Axisym bool `json:"axisym"` // axisymmetric Pstress bool `json:"pstress"` // plane-stress NoLBB bool `json:"nolbb"` // do not satisfy Ladyženskaja-Babuška-Brezzi condition; i.e. do not use [qua8,qua4] for u-p formulation 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 LiqMat string `json:"liq"` // name of liquid material GasMat string `json:"gas"` // name of gas material ListBcs bool `json:"listbcs"` // list boundary conditions WriteSmat bool `json:"writesmat"` // writes /tmp/gofem_Kb.smat file for debugging global Jacobian matrix. The simulation will be stopped. }
Data holds global data for simulations
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 { // input data 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 // auxiliary/internal Lbb bool // LBB element }
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 FaceCond ¶
type FaceCond struct { FaceId int // msh: cell's face local id LocalVerts []int // msh: cell's face local vertices ids (sorted) GlobalVerts []int // msh: global vertices ids (sorted) Cond string // sim: condition; e.g. "qn" or "seepH" Func fun.TimeSpace // sim: function to compute boundary condition Extra string // sim: extra information }
FaceCond holds information of one single face boundary condition. Example:
-12 => "qn", "seepH" 36 -12 35 -11 => "ux", "seepH" (3)--------(2) | 2 | face id => conditions | | 0 => <nil> |3 1| -11 1 => {"ux", "seepH"} => localVerts={1,2} => globalVerts={34,35} | | 2 => {"qn", "seepH"} => localVerts={2,3} => globalVerts={35,36} | 0 | 3 => <nil> (0)--------(1) 33 34 "seepH" => localVerts={1,2,3} "seepH" => globalVerts={34,35,36} face id => condition 1 => "ux" => localVerts={1,2} => globalVerts={34,35} 1 => "seepH" => localVerts={1,2} => globalVerts={34,35} 2 => "qn" => localVerts={2,3} => globalVerts={35,36} 2 => "seepH" => localVerts={2,3} => globalVerts={35,36}
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 dbf.Params `json:"prms"` // parameters PltExtra string `json:"pltextra"` // extra arguments for plotting // extra data for plotting LabelT, LabelF, LabelG, LabelH, ArgsF, ArgsG, ArgsH string }
FuncData holds function definition
type FuncsData ¶
type FuncsData []*FuncData
Funcs holds functions
type IniFcnData ¶
type IniFcnData struct { File string `json:"file"` // file with values at each node is given; filename with path is provided Fcns []string `json:"fcns"` // functions F(t, x) are given; from functions database Dofs []string `json:"dofs"` // degrees of freedom corresponding to "fcns" }
IniFcnData holds data for setting initial solution values such as Y, dYdt and d2Ydt2
type IniImportRes ¶
type IniImportRes 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) }
IniImportRes holds definitions for importing results from a previous simulation
type IniPorousData ¶
type IniPorousData struct { Nu []float64 `json:"nu"` // [nlayers] Poisson's coefficient to compute effective horizontal state for each layer K0 []float64 `json:"K0"` // [nlayers] or Earth pressure coefficient at rest to compute effective horizontal stresses Layers [][]int `json:"layers"` // [nlayers][ntagsInLayer]; e.g. [[-1,-2], [-3,-4]] => 2 layers }
IniPorousData holds data for setting initial porous media state (e.g. geostatic, hydrostatic)
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 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
type MatDb ¶
type MatDb struct { // input Functions FuncsData `json:"functions"` // all functions Materials MatsData `json:"materials"` // all materials // derived GEN map[string]*Material // subset with materials/models: generic materials SLD map[string]*Material // subset with materials/models: solids LIQ map[string]*Material // subset with materials/models: liquids GAS map[string]*Material // subset with materials/models: gases CND map[string]*Material // subset with materials/models: coductivities LRM map[string]*Material // subset with materials/models: retention models DIF map[string]*Material // subset with materials/models: diffusion TRM map[string]*Material // subset with materials/models: thermomech POR map[string]*Material // subset with materials/models: porous materials }
MatDb implements a database of materials
type Material ¶
type Material struct { // input Name string `json:"name"` // name of material Type string `json:"type"` // type of material; e.g. "gen", "sld", "fld", "cnd", "lrm", "dif", "trm", "por" Model string `json:"model"` // name of model; e.g. "dp", "vm", "elast", etc. Deps []string `json:"deps"` // dependencies; other material names. e.g. ["water", "dryair", "solid1", "conduct1", "lreten1"] Prms dbf.Params `json:"prms"` // prms holds all model parameters for this material // derived Gen generic.Model // pointer to generic model Sld solid.Model // pointer to solid model Liq *fluid.Model // pointer to liquid model Gas *fluid.Model // pointer to gas model Cnd conduct.Model // pointer to conductivity model Lrm retention.Model // pointer to retention model Dif diffusion.Model // pointer to diffusion model Trm thermomech.Model // pointer to thermo-mechanical model Por *porous.Model // pointer to porous model }
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 MaxElev float64 // max elevation; considering solids only // 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 // NURBS Nurbss []gm.NurbsExchangeData // all NURBS' data (read from file) PtNurbs []*gm.Nurbs // all NURBS' structures (allocated here) NrbFaces [][]*gm.Nurbs // all NURBS' faces }
Mesh holds a mesh for FE analyses
func (*Mesh) CalcDerived ¶
CalcDerived computes derived quantities
func (*Mesh) Draw2d ¶
func (o *Mesh) Draw2d(onlyLin, setup, withNodes bool, argsCells map[int]*plt.A, argsLins map[int]*plt.A, argsNodes map[int]*plt.A)
Draw2d draws 2D mesh
onlyLin -- show only linear cells setup -- setup axis with equal scales and fix range withNodes -- draw nodes argsCells -- arguments for drawing cells. maps cid => *plt.A if the cid is -1, use the same *plt.A to all cells. may be nil argsLins -- arguments for drawing linear cells. maps cid => *plt.A if the cid is -1, use the same *plt.A to all lins. may be nil argsNodes -- arguments for drawing nodes. maps nid => *plt.A if the nid is -1, use the same *plt.A to all nodes. may be nil
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 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 AbsPath bool `json:"abspath"` // mesh filename is given in absolute path // derived Msh *Mesh // the mesh }
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 GoroutineId int // id of goroutine to avoid race problems DirOut string // directory to save results Key string // simulation key; e.g. mysim01.sim => mysim01 or mysim01-alias EncType string // encoder type Ndim int // space dimension MaxElev float64 // maximum elevation Grav0 float64 // gravity constant from stage #0 MatModels *MatDb // materials and models LiqMdl *fluid.Model // liquid model to use when computing density and pressure along column; from stage #0 GasMdl *fluid.Model // gas model to use when computing density and pressure along column; from stage #0 // adjustable parameters Adjustable dbf.Params // adjustable parameters (not dependent) AdjRandom rnd.Variables // adjustable parameters that are random variables (not dependent) AdjDependent dbf.Params // adjustable parameters that depend on other adjustable parameters // contains filtered or unexported fields }
Simulation holds all simulation data
func ReadSim ¶
func ReadSim(simfilepath, alias string, erasePrev, createDirOut bool, goroutineId int) *Simulation
ReadSim reads all simulation data from a .sim JSON file
func (*Simulation) GetInfo ¶
func (o *Simulation) GetInfo(w goio.Writer) (err error)
GetInfo returns formatted information
func (*Simulation) PrmAdjust ¶
func (o *Simulation) PrmAdjust(adj int, val float64)
PrmAdjust adjusts parameter (random variable or not)
func (*Simulation) PrmGetAdj ¶
func (o *Simulation) PrmGetAdj(adj int) (val float64)
PrmGetAdj gets adjustable parameter (random variable or not)
type SolverData ¶
type SolverData struct { // nonlinear solver Type string `json:"type"` // nonlinear solver type: {imp, exp, rex} => implicit, explicit, Richardson extrapolation 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 CteTg bool `json:"ctetg"` // use constant tangent (modified Newton) during iterations ShowR bool `json:"showr"` // show residual // Richardson's extrapolation REnogus bool `json:"renogus"` // Richardson extrapolation: no Gustafsson's step control REnssmax int `json:"renssmax"` // Richardson extrapolation: max number of substeps REatol float64 `json:"reatol"` // Richardson extrapolation: absolute tolerance RErtol float64 `json:"rertol"` // Richardson extrapolation: relative tolerance REmfac float64 `json:"remfac"` // Richardson extrapolation: multiplier factor REmmin float64 `json:"remmin"` // Richardson extrapolation: min multiplier REmmax float64 `json:"remmax"` // 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 // constants Eps float64 `json:"eps"` // smallest number satisfying 1.0 + ϵ > 1.0 // 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 SeepFaces []int `json:"seepfaces"` // face tags corresponding to seepage faces IniPorous *IniPorousData `json:"iniporous"` // initial porous media state (geostatic and hydrostatic included) IniStress *IniStressData `json:"inistress"` // initial stress data IniFcn *IniFcnData `json:"inifcn"` // set initial solution values such as Y, dYdt and d2Ydt2 IniImport *IniImportRes `json:"import"` // import results from another previous simulation // 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
func (Stage) GetEleCond ¶
GetEleCond returns element condition structure by giving an elem tag
Note: returns nil if not found
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.TimeSpace // time step function DtoFunc fun.TimeSpace // output time step function }
TimeControl holds data for defining the simulation time stepping