Documentation
¶
Index ¶
- Constants
- Variables
- func BuildCoordsMatrix(c *inp.Cell, msh *inp.Mesh) (x [][]float64)
- func DerivSig(DσDun [][]float64, n, ndim int, G, D [][]float64)
- func End()
- func FlowKeys() []string
- func GetAndInitPorousModel(matname string) *mporous.Model
- func GetAndInitSolidModel(matname string, ndim int) (msolid.Model, fun.Prms)
- func GetIntegrationPoints(nip, nipf int, cellType string) (ipsElem, ipsFace []*shp.Ipoint)
- func GetIsEssenKeyMap() map[string]bool
- func GetSeepFaceFlags(extra string) (Macaulay bool, BetRamp, Kappa float64)
- func GetSolidFlags(extra string) (useB, debug bool, thickness float64)
- func GetVertsWithCond(fconds []*FaceCond, conds ...string) (verts []int)
- func IpAddToKt(Kt [][]float64, nne, ndim int, coef float64, G, D [][]float64)
- func IpBmatrix(B [][]float64, ndim, nne int, G [][]float64, radius float64, S []float64)
- func IpBmatrix_sparse(B *la.Triplet, ndim, nne int, G [][]float64, radius float64, S []float64)
- func IpStrains(εs []float64, nne, ndim int, u []float64, Umap []int, G [][]float64)
- func IpStrainsAndInc(εs, Δεs []float64, nne, ndim int, u, Δu []float64, Umap []int, ...)
- func IpStrainsAndIncB(εs, Δεs []float64, nσ, nu int, B [][]float64, u, Δu []float64, Umap []int)
- func Ivs2sigmas(σ []float64, i int, ivs map[string][]float64)
- func LogErr(err error, msg string) (stop bool)
- func LogErrCond(condition bool, msg string, prm ...interface{}) (stop bool)
- func Run() (runisok bool)
- func Start(simfilepath string, erasefiles, verbose bool) (startisok bool)
- func Stop() bool
- func StressKeys() []string
- func TestingCompareResultsU(tst *testing.T, simfname, cmpfname string, tolK, tolu, tols float64, ...)
- type Beam
- func (o Beam) AddToKb(Kb *la.Triplet, sol *Solution, firstIt bool) (ok bool)
- func (o Beam) AddToRhs(fb []float64, sol *Solution) (ok bool)
- func (o Beam) Decode(dec Decoder) (ok bool)
- func (o Beam) Encode(enc Encoder) (ok bool)
- func (o Beam) Id() int
- func (o *Beam) InterpStarVars(sol *Solution) (ok bool)
- func (o Beam) OutIpsData() (data []*OutIpData)
- func (o *Beam) SetEleConds(key string, f fun.Func, extra string) (ok bool)
- func (o *Beam) SetEqs(eqs [][]int, mixedform_eqs []int) (ok bool)
- func (o *Beam) Update(sol *Solution) (ok bool)
- type Decoder
- type Dof
- type Domain
- func (o *Domain) In(sum *Summary, tidx int, allInOne bool) (ok bool)
- func (o *Domain) Out(tidx int) (ok bool)
- func (o *Domain) ReadIvs(dir, fnkey string, tidx, proc int) (ok bool)
- func (o *Domain) ReadSol(dir, fnkey string, tidx int) (ok bool)
- func (o Domain) SaveIvs(tidx int) (ok bool)
- func (o Domain) SaveSol(tidx int) (ok bool)
- func (o *Domain) SetGeoSt(stg *inp.Stage) (ok bool)
- func (o *Domain) SetHydroSt(stg *inp.Stage) (ok bool)
- func (o *Domain) SetIniStress(stg *inp.Stage) (ok bool)
- func (o *Domain) SetStage(idxstg int, stg *inp.Stage, distr bool) (setstageisok bool)
- type DynCoefs
- type Elem
- type ElemConnector
- type ElemIntvars
- type ElemP
- func (o ElemP) AddToKb(Kb *la.Triplet, sol *Solution, firstIt bool) (ok bool)
- func (o ElemP) AddToRhs(fb []float64, sol *Solution) (ok bool)
- func (o *ElemP) BackupIvs(aux bool) (ok bool)
- func (o ElemP) Decode(dec Decoder) (ok bool)
- func (o ElemP) Encode(enc Encoder) (ok bool)
- func (o ElemP) Id() int
- func (o *ElemP) InterpStarVars(sol *Solution) (ok bool)
- func (o ElemP) Ipoints() (coords [][]float64)
- func (o ElemP) OutIpsData() (data []*OutIpData)
- func (o *ElemP) RestoreIvs(aux bool) (ok bool)
- func (o *ElemP) SetEleConds(key string, f fun.Func, extra string) (ok bool)
- func (o *ElemP) SetEqs(eqs [][]int, mixedform_eqs []int) (ok bool)
- func (o *ElemP) SetIniIvs(sol *Solution, ignored map[string][]float64) (ok bool)
- func (o *ElemP) Update(sol *Solution) (ok bool)
- func (o *ElemP) Ureset(sol *Solution) (ok bool)
- type ElemPhi
- func (o *ElemPhi) AddToKb(Kb *la.Triplet, sol *Solution, firstIt bool) (ok bool)
- func (o *ElemPhi) AddToRhs(fb []float64, sol *Solution) (ok bool)
- func (o *ElemPhi) Decode(dec Decoder) (ok bool)
- func (o *ElemPhi) Encode(enc Encoder) (ok bool)
- func (o *ElemPhi) Id() int
- func (o *ElemPhi) InterpStarVars(sol *Solution) (ok bool)
- func (o *ElemPhi) OutIpsData() (data []*OutIpData)
- func (o *ElemPhi) SetEleConds(key string, f fun.Func, extra string) (ok bool)
- func (o *ElemPhi) SetEqs(eqs [][]int, mixedform_eqs []int) (ok bool)
- func (o *ElemPhi) Update(sol *Solution) (ok bool)
- type ElemU
- func (o *ElemU) AddToKb(Kb *la.Triplet, sol *Solution, firstIt bool) (ok bool)
- func (o *ElemU) AddToRhs(fb []float64, sol *Solution) (ok bool)
- func (o *ElemU) BackupIvs(aux bool) (ok bool)
- func (o ElemU) Decode(dec Decoder) (ok bool)
- func (o ElemU) Encode(enc Encoder) (ok bool)
- func (o ElemU) Id() int
- func (o *ElemU) InterpStarVars(sol *Solution) (ok bool)
- func (o ElemU) Ipoints() (coords [][]float64)
- func (o ElemU) OutIpsData() (data []*OutIpData)
- func (o *ElemU) RestoreIvs(aux bool) (ok bool)
- func (o *ElemU) SetEleConds(key string, f fun.Func, extra string) (ok bool)
- func (o *ElemU) SetEqs(eqs [][]int, mixedform_eqs []int) (ok bool)
- func (o *ElemU) SetIniIvs(sol *Solution, ivs map[string][]float64) (ok bool)
- func (o *ElemU) Update(sol *Solution) (ok bool)
- func (o *ElemU) Ureset(sol *Solution) (ok bool)
- type ElemUP
- func (o ElemUP) AddToKb(Kb *la.Triplet, sol *Solution, firstIt bool) (ok bool)
- func (o ElemUP) AddToRhs(fb []float64, sol *Solution) (ok bool)
- func (o *ElemUP) BackupIvs(aux bool) (ok bool)
- func (o ElemUP) Decode(dec Decoder) (ok bool)
- func (o ElemUP) Encode(enc Encoder) (ok bool)
- func (o ElemUP) Id() int
- func (o *ElemUP) InterpStarVars(sol *Solution) (ok bool)
- func (o ElemUP) Ipoints() (coords [][]float64)
- func (o ElemUP) OutIpsData() (data []*OutIpData)
- func (o *ElemUP) RestoreIvs(aux bool) (ok bool)
- func (o *ElemUP) SetEleConds(key string, f fun.Func, extra string) (ok bool)
- func (o *ElemUP) SetEqs(eqs [][]int, mixedform_eqs []int) (ok bool)
- func (o *ElemUP) SetIniIvs(sol *Solution, ivs map[string][]float64) (ok bool)
- func (o *ElemUP) Update(sol *Solution) (ok bool)
- func (o *ElemUP) Ureset(sol *Solution) (ok bool)
- type Encoder
- type EssentialBc
- type EssentialBcs
- type FaceCond
- type GeoLayer
- type GeoLayers
- type HydroStatic
- type Info
- type NaturalBc
- type Node
- type OutIpData
- type PtNaturalBc
- type PtNaturalBcs
- type RichardsonExtrap
- type Rjoint
- func (o *Rjoint) AddToKb(Kb *la.Triplet, sol *Solution, firstIt bool) (ok bool)
- func (o *Rjoint) AddToRhs(fb []float64, sol *Solution) (ok bool)
- func (o *Rjoint) BackupIvs(aux bool) (ok bool)
- func (o *Rjoint) Connect(cid2elem []Elem, c *inp.Cell) (nnzK int, ok bool)
- func (o Rjoint) Decode(dec Decoder) (ok bool)
- func (o Rjoint) Encode(enc Encoder) (ok bool)
- func (o Rjoint) Id() int
- func (o *Rjoint) InterpStarVars(sol *Solution) (ok bool)
- func (o Rjoint) Ipoints() (coords [][]float64)
- func (o Rjoint) OutIpsData() (data []*OutIpData)
- func (o *Rjoint) RestoreIvs(aux bool) (ok bool)
- func (o *Rjoint) SetEleConds(key string, f fun.Func, extra string) (ok bool)
- func (o *Rjoint) SetEqs(eqs [][]int, mixedform_eqs []int) (ok bool)
- func (o *Rjoint) SetIniIvs(sol *Solution, ivs map[string][]float64) (ok bool)
- func (o *Rjoint) Update(sol *Solution) (ok bool)
- func (o *Rjoint) Ureset(sol *Solution) (ok bool)
- type Rod
- func (o Rod) AddToKb(Kb *la.Triplet, sol *Solution, firstIt bool) (ok bool)
- func (o Rod) AddToRhs(fb []float64, sol *Solution) (ok bool)
- func (o *Rod) BackupIvs(aux bool) (ok bool)
- func (o Rod) Decode(dec Decoder) (ok bool)
- func (o Rod) Encode(enc Encoder) (ok bool)
- func (o Rod) Id() int
- func (o *Rod) InterpStarVars(sol *Solution) (ok bool)
- func (o Rod) Ipoints() (coords [][]float64)
- func (o Rod) OutIpsData() (data []*OutIpData)
- func (o *Rod) RestoreIvs(aux bool) (ok bool)
- func (o *Rod) SetEleConds(key string, f fun.Func, extra string) (ok bool)
- func (o *Rod) SetEqs(eqs [][]int, mixedform_eqs []int) (ok bool)
- func (o *Rod) SetIniIvs(sol *Solution, ivs map[string][]float64) (ok bool)
- func (o *Rod) SetIvs(zvars map[string][]float64) (ok bool)
- func (o *Rod) Update(sol *Solution) (ok bool)
- func (o *Rod) Ureset(sol *Solution) (ok bool)
- type Solution
- type Summary
- type T_iteration
- type T_results
- type T_results_set
Constants ¶
const SQ2 = math.Sqrt2
Variables ¶
var Global struct { // constants LogPrefix string // extra string to prefix log file // multiprocessing data Rank int // my rank in distributed cluster Nproc int // number of processors Root bool // am I root? (i.e. myrank == 0) Distr bool // distributed simulation with more than one mpi processor Verbose bool // verbose == root WspcStop []int // stop flags [nprocs] WspcInum []int // workspace of integer numbers [nprocs] // simulation, materials, meshes and convenience variables Sim *inp.Simulation // simulation data Ndim int // space dimension Dirout string // directory for output of results Fnkey string // filename key; e.g. mysim.sim => mysim Enc string // encoder; e.g. "gob" or "json" Stat bool // save residuals in summary LogBcs bool // log essential and ptnatural boundary conditions Debug bool // debug flag // auxiliar structures DynCoefs *DynCoefs // dynamic coefficients HydroSt *HydroStatic // computes hydrostatic states // for debugging DebugKb func(d *Domain, it int) // debug Kb callback function }
Global holds global data
Functions ¶
func BuildCoordsMatrix ¶
BuildCoordsMatrix returns the coordinate matrix of a particular Cell
func DerivSig ¶
DerivSig returns the derivative of σ (Mandel) with respect to displacement at nodes
Note: DσDun = ∂σ/∂un [nσ][ndim]
func GetAndInitPorousModel ¶
GetAndInitPorousModel get porous model from material name It returns nil on errors, after logging
func GetAndInitSolidModel ¶
func GetIntegrationPoints ¶
func GetIsEssenKeyMap ¶
GetFirstYandCmap returns the initial "yandc" map with additional keys that EssentialBcs can handle
rigid -- define rigid element constraints incsup -- inclined support constraints hst -- set hydrostatic pressures
func GetSeepFaceFlags ¶
func GetSolidFlags ¶
func GetVertsWithCond ¶
GetVertsWithCond gets all vertices with any of the given conditions
"seepH" => localVerts={1,2,3}
func IpBmatrix_sparse ¶
func IpStrainsAndInc ¶
func IpStrainsAndIncB ¶
func Ivs2sigmas ¶
Ivs2sigmas converts ivs map to σ values [nsig]
σ -- [ndim] stresses i -- index of integration point
func LogErrCond ¶
func StressKeys ¶
func StressKeys() []string
Types ¶
type Beam ¶
type Beam struct {
// basic data
Cid int // cell/element id
X [][]float64 // matrix of nodal coordinates [ndim][nnode]
Nu int // total number of unknowns == 2 * nsn
// parameters
E float64 // Young's modulus
A float64 // cross-sectional area
Izz float64 // Inertia zz
// variables for dynamics
Rho float64 // density of solids
Gfcn fun.Func // gravity function
// vectors and matrices
T [][]float64 // global-to-local transformation matrix [nnode*ndim][nnode*ndim]
Kl [][]float64 // local K matrix
K [][]float64 // global K matrix
Ml [][]float64 // local M matrices
M [][]float64 // global M matrices
Rus []float64 // residual: Rus = fi - fx
// problem variables
Umap []int // assembly map (location array/element equations)
Hasq bool // has distributed loads
QnL fun.Func // distributed normal load functions: left
QnR fun.Func // distributed normal load functions: right
Qt fun.Func // distributed tangential load
// contains filtered or unexported fields
}
Beam represents a structural beam element (Euler-Bernoulli, linear elastic)
func (*Beam) InterpStarVars ¶
InterpStarVars interpolates star variables to integration points
func (Beam) OutIpsData ¶
OutIpsData returns data from all integration points for output
func (*Beam) SetEleConds ¶
SetEleConds set element conditions
type Decoder ¶
type Decoder interface {
Decode(e interface{}) error
}
Decoder defines decoders; e.g. gob or json
type Domain ¶
type Domain struct {
// init: region, mesh, linear solver
Reg *inp.Region // region data
Msh *inp.Mesh // mesh data
LinSol la.LinSol // linear solver
// stage: auxiliary maps for setting boundary conditions
FaceConds map[int][]*FaceCond // maps cell id to its face boundary conditions
// stage: nodes (active) and elements (active AND in this processor)
Nodes []*Node // active nodes (for each stage)
Elems []Elem // [procNcells] only active elements in this processor (for each stage)
MyCids []int // [procNcells] the ids of cells in this processor
// stage: auxiliary maps for dofs and equation types
F2Y map[string]string // converts f-keys to y-keys; e.g.: "ux" => "fx"
YandC map[string]bool // y and constraints keys; e.g. "ux", "pl", "H", "incsup", "rigid"
Dof2Tnum map[string]int // {t1,t2}-types: dof => t_number; e.g. "ux" => 2, "pl" => 1
// stage: auxiliary maps for nodes and elements
Vid2node []*Node // [nverts] VertexId => index in Nodes. Inactive vertices are 'nil'
Cid2elem []Elem // [ncells] CellId => index in Elems. Cells in other processors or inactive are 'nil'
Cid2active []bool // [ncells] CellId => whether cell is active or not in ANY processor
// stage: subsets of elements
ElemIntvars []ElemIntvars // elements with internal vars in this processor
ElemConnect []ElemConnector // connector elements in this processor
// stage: coefficients and prescribed forces
EssenBcs EssentialBcs // constraints (Lagrange multipliers)
PtNatBcs PtNaturalBcs // point loads such as prescribed forces at nodes
// stage: t1 and t2 variables
T1eqs []int // first t-derivative variables; e.g.: dp/dt vars (subset of ykeys)
T2eqs []int // second t-derivative variables; e.g.: d²u/dt² vars (subset of ykeys)
// stage: dimensions
NnzKb int // number of nonzeros in Kb matrix
Ny int // total number of dofs, except λ
Nlam int // total number of Lagrange multipliers
NnzA int // number of nonzeros in A (constraints) matrix
Nyb int // total number of equations: ny + nλ
// stage: solution and linear solver
Sol *Solution // solution state
Kb *la.Triplet // Jacobian == dRdy
Fb []float64 // residual == -fb
Wb []float64 // workspace
InitLSol bool // flag telling that linear solver needs to be initialised prior to any further call
// contains filtered or unexported fields
}
Domain holds all Nodes and Elements active during a stage in addition to the Solution at nodes. Only elements in this processor are recorded here; however information from all cells might be recorded as well.
func (*Domain) In ¶
In performes the inverse operation from Out
allInOne -- indicates that all results must be read into the root processor only
For example when plotting or generating VTU files (or testing)
If allInOne is false, each processor will read its part as described by Summary.
Thus, recoreving the state as in the previous simulation.
func (*Domain) ReadIvs ¶
ReadIvs reads elements's internal values from a file which name is set with tidx (time output index)
func (*Domain) ReadSol ¶
ReadSol reads Solution from a file which name is set with tidx (time output index)
func (Domain) SaveIvs ¶
SaveIvs saves elements's internal values to a file which name is set with tidx (time output index)
func (Domain) SaveSol ¶
SaveSol saves Solution to a file which name is set with tidx (time output index)
func (*Domain) SetHydroSt ¶
SetHydroSt sets the initial state to a hydrostatic condition
func (*Domain) SetIniStress ¶
SetIniStress sets the initial state with initial stresses
type DynCoefs ¶
type DynCoefs struct {
HHT bool
// contains filtered or unexported fields
}
DynCoefs calculates θ-method, Newmark's or HHT coefficients.
Notes: θ1 -- Newmark parameter (gamma) [0 <= θ1 <= 1] θ2 -- Newmark parameter (2*beta) [0 <= θ2 <= 1] HHT -- use Hilber-Hughes-Taylor method ? α -- Hilber-Hughes-Taylor parameter [-1/3 <= α <= 0] if HHT==True, θ1 and θ2 are automatically calculated for unconditional stability
func (*DynCoefs) CalcAlphas ¶
CalcAlphas computes only alphas
type Elem ¶
type Elem interface {
// information and initialisation
Id() int // returns the cell Id
SetEqs(eqs [][]int, mixedform_eqs []int) (ok bool) // set equations
// conditions (natural BCs and element's)
SetEleConds(key string, f fun.Func, extra string) (ok bool) // set element conditions
// called for each time step
InterpStarVars(sol *Solution) (ok bool) // interpolate star variables to integration points
// called for each iteration
AddToRhs(fb []float64, sol *Solution) (ok bool) // adds -R to global residual vector fb
AddToKb(Kb *la.Triplet, sol *Solution, firstIt bool) (ok bool) // adds element K to global Jacobian matrix Kb
Update(sol *Solution) (ok bool) // perform (tangent) update
// reading and writing of element data
Encode(enc Encoder) (ok bool) // encodes internal variables
Decode(dec Decoder) (ok bool) // decodes internal variables
// output
OutIpsData() (data []*OutIpData) // returns data from all integration points for output
}
Elem defines what elements must calculate
type ElemConnector ¶
type ElemConnector interface {
Id() int // returns the cell Id
Connect(cid2elem []Elem, c *inp.Cell) (nnzK int, ok bool) // connect multiple elements; e.g.: connect rod/solid elements in Rjoints
}
ElemConnector defines connector elements; elements that depend upon others
type ElemIntvars ¶
type ElemIntvars interface {
Ipoints() (coords [][]float64) // returns the real coordinates of integration points [nip][ndim]
SetIniIvs(sol *Solution, ivs map[string][]float64) (ok bool) // sets initial ivs for given values in sol and ivs map
BackupIvs(aux bool) (ok bool) // create copy of internal variables
RestoreIvs(aux bool) (ok bool) // restore internal variables from copies
Ureset(sol *Solution) (ok bool) // fixes internal variables after u (displacements) have been zeroed
}
ElemIntvars defines elements with {z,q} internal variables
type ElemP ¶
type ElemP struct {
// basic data
Cid int // cell/element id
X [][]float64 // matrix of nodal coordinates [ndim][nnode]
Shp *shp.Shape // shape structure
Np int // total number of unknowns == number of vertices
// integration points
IpsElem []*shp.Ipoint // integration points of element
IpsFace []*shp.Ipoint // integration points corresponding to faces
// material model
Mdl *mporous.Model // model
// problem variables
Pmap []int // assembly map (location array/element equations)
// internal variables
States []*mporous.State
StatesBkp []*mporous.State
StatesAux []*mporous.State
// gravity
Gfcn fun.Func // gravity function
// natural boundary conditions
NatBcs []*NaturalBc // natural boundary conditions
Emat [][]float64 // [nverts][nips] extrapolator matrix
DoExtrap bool // do extrapolation of ρl and Cpl => for use with flux and seepage conditions
// seepage face
Nf int // number of fl variables
HasSeep bool // indicates if this element has seepage faces
Vid2seepId []int // [nverts] maps local vertex id to index in Fmap
SeepId2vid []int // [nf] maps seepage face variable id to local vertex id
Fmap []int // [nf] map of "fl" variables (seepage face)
Macaulay bool // use discrete ramp function instead of smooth ramp
Hst []bool // [nf] set hydrostatic plmax
Plmax [][]float64 // [nf][nipsFace] specified plmax (not corrected by multiplier)
Kpp [][]float64 // [np][np] Kpp := dRpl/dpl consistent tangent matrix
Kpf [][]float64 // [np][nf] Kpf := dRpl/dfl consistent tangent matrix
Kfp [][]float64 // [nf][np] Kfp := dRfl/dpl consistent tangent matrix
Kff [][]float64 // [nf][nf] Kff := dRfl/dfl consistent tangent matrix
// contains filtered or unexported fields
}
ElemP implements an element for transient seepage analyses [1]
References:
[1] Pedroso DM (2015) A solution to transient seepage in unsaturated porous media.
Computer Methods in Applied Mechanics and Engineering, 285 791-816,
http://dx.doi.org/10.1016/j.cma.2014.12.009
func (*ElemP) InterpStarVars ¶
InterpStarVars interpolates star variables to integration points
func (ElemP) OutIpsData ¶
OutIpsData returns data from all integration points for output
func (*ElemP) RestoreIvs ¶
RestoreIvs restores internal variables from copies
func (*ElemP) SetEleConds ¶
SetEleConds sets element conditions
type ElemPhi ¶
type ElemPhi struct {
// basic data
Cid int // cell/element id
X [][]float64 // [ndim][nnode] matrix of nodal coordinates
Shp *shp.Shape // shape structure
Nu int // total number of unknowns == number of vertices
// integration points
IpsElem []*shp.Ipoint // [nip] integration points of element
// scratchpad. computed @ each ip
K [][]float64 // [nu][nu] consistent tangent matrix
// problem variables
Umap []int // assembly map (location array/element equations)
// contains filtered or unexported fields
}
ElemPhi implementes a general element to solve the following equation
dφ ∂φ -- + v . -- = s(x) dt ∂x
Notes: v is a constant vector
func (*ElemPhi) InterpStarVars ¶
InterpStarVars interpolate star variables to integration points
func (*ElemPhi) OutIpsData ¶
OutIpsData returns data from all integration points for output
func (*ElemPhi) SetEleConds ¶
SetEleConds set element conditions
type ElemU ¶
type ElemU struct {
// basic data
Cid int // cell/element id
X [][]float64 // matrix of nodal coordinates [ndim][nnode]
Shp *shp.Shape // shape structure
Nu int // total number of unknowns
// variables for dynamics
Rho float64 // density of solids
Cdam float64 // coefficient for damping
Gfcn fun.Func // gravity function
// optional data
UseB bool // use B matrix
Thickness float64 // thickness (for plane-stress)
Debug bool // debugging flag
// integration points
IpsElem []*shp.Ipoint // integration points of element
IpsFace []*shp.Ipoint // integration points corresponding to faces
// material model and internal variables
Model msolid.Model // material model
MdlSmall msolid.Small // model specialisation for small strains
MdlLarge msolid.Large // model specialisation for large deformations
// internal variables
States []*msolid.State // [nip] states
StatesBkp []*msolid.State // [nip] backup states
StatesAux []*msolid.State // [nip] auxiliary backup states
// problem variables
Umap []int // assembly map (location array/element equations)
// natural boundary conditions
NatBcs []*NaturalBc
K [][]float64 // [nu][nu] consistent tangent (stiffness) matrix
B [][]float64 // [nsig][nu] B matrix for axisymetric case
D [][]float64 // [nsig][nsig] constitutive consistent tangent matrix
Δε []float64 // incremental strains leading to updated strains
// contains filtered or unexported fields
}
ElemU represents a solid element with displacements u as primary variables
func (*ElemU) InterpStarVars ¶
InterpStarVars interpolates star variables to integration points
func (ElemU) OutIpsData ¶
OutIpsData returns data from all integration points for output
func (*ElemU) RestoreIvs ¶
RestoreIvs restore internal variables from copies
func (*ElemU) SetEleConds ¶
SetEleConds set element conditions
type ElemUP ¶
type ElemUP struct {
// auxiliary
Fconds []*FaceCond // face conditions; e.g. seepage faces
CtypeU string // u: cell type
CtypeP string // p: cell type
// underlying elements
U *ElemU // u-element
P *ElemP // p-element
Kup [][]float64 // [nu][np] Kup := dRus/dpl consistent tangent matrix
Kpu [][]float64 // [np][nu] Kpu := dRpl/dus consistent tangent matrix
// contains filtered or unexported fields
}
ElemUP represents an element for porous media based on the u-p formulation [1]
References:
[1] Pedroso DM (2015) A consistent u-p formulation for porous media with hysteresis.
Int Journal for Numerical Methods in Engineering, 101(8) 606-634
http://dx.doi.org/10.1002/nme.4808
[2] Pedroso DM (2015) A solution to transient seepage in unsaturated porous media.
Computer Methods in Applied Mechanics and Engineering, 285 791-816,
http://dx.doi.org/10.1016/j.cma.2014.12.009
func (*ElemUP) InterpStarVars ¶
InterpStarVars interpolates star variables to integration points
func (ElemUP) OutIpsData ¶
OutIpsData returns data from all integration points for output
func (*ElemUP) RestoreIvs ¶
RestoreIvs restore internal variables from copies
func (*ElemUP) SetEleConds ¶
SetEleConds set element conditions
type Encoder ¶
type Encoder interface {
Encode(e interface{}) error
}
Encoder defines encoders; e.g. gob or json
type EssentialBc ¶
type EssentialBc struct {
Key string // ux, uy, rigid, incsup
Eqs []int // equations
ValsA []float64 // values for matrix A
Fcn fun.Func // function that implements the "c" in A * y = c
Inact bool // inactive
}
EssentialBc holds information about essential bounday conditions such as constrained nodes. Lagrange multipliers are used to implement both single- and multi-point constraints.
In general, essential bcs / constraints are defined by means of:
A * y = c
The resulting Kb matrix will then have the following form:
_ _
| K At | / δy \ / -R - At*λ \
| | | | = | |
|_ A 0 _| \ δλ / \ c - A*y /
Kb δyb fb
type EssentialBcs ¶
type EssentialBcs struct {
Eq2idx map[int][]int // maps eq number to indices in BcsTmp
Bcs []*EssentialBc // active essential bcs / constraints
A la.Triplet // matrix of coefficients 'A'
Am *la.CCMatrix // compressed form of A matrix
// temporary
BcsTmp eqbcpairs // temporary essential bcs / constraints, including inactive ones. maps the first equation number to bcs
}
EssentialBcs implements a structure to record the definition of essential bcs / constraints. Each constraint will have a unique Lagrange multiplier index.
func (EssentialBcs) AddToRhs ¶
func (o EssentialBcs) AddToRhs(fb []float64, sol *Solution)
AddtoRhs adds the essential bcs / constraints terms to the augmented fb vector
func (*EssentialBcs) Build ¶
func (o *EssentialBcs) Build(ny int) (nλ, nnzA int)
Build builds this structure and its iternal data
nλ -- is the number of essential bcs / constraints == number of Lagrange multipliers nnzA -- is the number of non-zeros in matrix 'A'
func (*EssentialBcs) List ¶
func (o *EssentialBcs) List(t float64) (l string)
List returns a simple list logging bcs at time t
func (*EssentialBcs) Reset ¶
func (o *EssentialBcs) Reset()
Reset initialises this structure. It also performs a reset of internal structures.
func (*EssentialBcs) Set ¶
Set sets a constraint if it does NOT exist yet.
key -- can be Dof key such as "ux", "uy" or constraint type such as "mpc" or "rigid"
extra -- is a keycode-style data. e.g. "!type:incsup2d !alp:30"
Notes: 1) the default for key is single point constraint; e.g. "ux", "uy", ...
2) hydraulic head can be set with key == "H"
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.Func // sim: function to compute boundary condition
Extra string // sim: extra information
}
type GeoLayer ¶
type GeoLayer struct {
Tags []int // tags of cells within this layer
Zmin float64 // coordinate (elevation) at bottom of layer
Zmax float64 // coordinate (elevation) at top of layer
Nodes []*Node // nodes in layer
Elems []Elem // elements in layer
Cl float64 // liquid compressibility
RhoS0 float64 // initial density of solids
K0 float64 // earth-pressure at rest
Dpl float64 // liquid pressure added by this layer
DsigV float64 // absolute value of vertical stress increment added by this layer
Jac ode.Cb_jac // Jacobian for ode solver
// contains filtered or unexported fields
}
GeoLayer holds information of one soil layer. It computes pressures (σVabs, pl) and densities (ρL, ρ) based on the following model (fully liquid saturated)
ρL = ρL0 + Cl・pl thus dρL/dpl = Cl
sl = 1
ρ = nf・sl・ρL + (1 - nf)・ρS
ns = 1 - nf
Z(z) = zmax + T・(z - zmax) with 0 ≤ T ≤ 1
dZ = (z - zmax)・dT
dpl = ρL(pl)・g・(-dZ)
dpl = ρL(pl)・g・(zmax - z)・dT
dσV = ρ(pl)・g・(zmax - z)・dT
Δz = zmax - z
/ dpl/dT \ / ρL(pl)・g・Δz \
dY/dT = | dρL/dT | = | Cl・dpl/dT |
| dρ/dT | | nf・sl・dρL/dT |
\ dσV/dT / \ ρ(pl)・g・Δz /
type GeoLayers ¶
type GeoLayers []*GeoLayer
GeoLayers is a set of Layer
type HydroStatic ¶
HydroStatic computes water pressure (pl) and intrinsic liquid density (ρL) based on the following model
ρL = ρL0 + Cl・pl thus dρL/dpl = Cl
Z(z) = zmax + T・(z - zmax) with 0 ≤ T ≤ 1
dZ = (z - zmax)・dT
dpl = ρL(pl)・g・(-dZ)
dpl = ρL(pl)・g・(zmax - z)・dT
Δz = zmax - z
/ dpl/dT \ / ρL(pl)・g・Δz \
dY/dT = | | = | |
\ dρL/dT / \ Cl・dpl/dT /
type Info ¶
type Info struct {
// essential
Dofs [][]string // solution variables PER NODE. ex for 2 nodes: [["ux", "uy", "rz"], ["ux", "uy", "rz"]]
Y2F map[string]string // maps "y" keys to "f" keys. ex: "ux" => "fx", "pl" => "ql"
// internal Dofs; e.g. for mixed formulations
NintDofs int // number of internal dofs
// t1 and t2 variables (time-derivatives of first and second order)
T1vars []string // "pl"
T2vars []string // "ux", "uy"
}
Info holds all information required to set a simulation stage
func GetElemInfo ¶
GetElemInfo returns information about elements/formulations
cellType -- e.g. "qua8" elemType -- e.g. "u"
type NaturalBc ¶
type NaturalBc struct {
Key string // key such as qn, qn0, ql, seepH, seepP, etc...
IdxFace int // local index of face
Fcn fun.Func // function callback
Extra string // extra information
}
NaturalBc holds information on natural boundary conditioins such as distributed loads or fluxes acting on surfaces
type Node ¶
type Node struct {
Dofs []*Dof // degrees-of-freedom == solution variables
Vert *inp.Vert // pointer to Vertex
}
Node holds node dofs information
func (*Node) AddDofAndEq ¶
AddDof adds a new dof to thisnode; ignores it if it exists already
nexteq -- is the next equation number == eqnum + 1;
returns eqnum if dof exists already
func (*Node) GetDof ¶
GetDof returns the Dof structure for given Dof name (ukey)
Note: returns nil if not found
func (*Node) GetEq ¶
GetEq returns the equation number for given Dof name (ukey)
Note: returns -1 if not found
type OutIpData ¶
type OutIpData struct {
Eid int // id of element that owns this ip
X []float64 // coordinates
Calc func(sol *Solution) map[string]float64 // [nkeys] function to calculate secondary values
}
OutIpData is an auxiliary structure to transfer data from integration points (IP) to output routines.
type PtNaturalBc ¶
type PtNaturalBc struct {
Key string // key such as fux, fpl, etc...
Eq int // equation
X []float64 // location
Fcn fun.Func // function
Extra string // extra information
}
PtNaturalBc holds information on point natural boundary conditions such as prescribed forces or fluxes) at nodes
type PtNaturalBcs ¶
type PtNaturalBcs struct {
Eq2idx map[int]int // maps eq number to indices in Bcs
Bcs []*PtNaturalBc //active boundary conditions such as prescribed forces
}
PointLoads is a set of prescribed forces
func (PtNaturalBcs) AddToRhs ¶
func (o PtNaturalBcs) AddToRhs(fb []float64, t float64)
AddToRhs adds the boundary conditions terms to the augmented fb vector
func (*PtNaturalBcs) List ¶
func (o *PtNaturalBcs) List(t float64) (l string)
List returns a simple list logging bcs at time t
type RichardsonExtrap ¶
type Rjoint ¶
type Rjoint struct {
// basic data
Edat *inp.ElemData // element data; stored in allocator to be used in Connect
Cid int // cell/element id
Ny int // total number of dofs == rod.Nu + sld.Nu
// essential
Rod *Rod // rod element
Sld *ElemU // solid element
Mdl msolid.RjointM1 // material model
// shape functions evaluations and extrapolator matrices
Nmat [][]float64 // [sldNn][rodNn] shape functions of solids @ [N]odes of rod element
Pmat [][]float64 // [sldNn][rodNp] shape functions of solids @ integration [P]oints of rod element (for Coulomb model)
Emat [][]float64 // [sldNn][sldNp] solid's extrapolation matrix (for Coulomb model)
// variables for Coulomb model
Coulomb bool // use Coulomb model
// auxiliary variables
ΔuC [][]float64 // [rodNn][ndim] relative displ. increment of solid @ nodes of rod; Eq (30)
Δw []float64 // [ndim] relative velocity; Eq (32)
// temporary Jacobian matrices. see Eq. (57)
Krr [][]float64 // [rodNu][rodNu] Eq. (58)
Krs [][]float64 // [rodNu][sldNu] Eq. (59)
Ksr [][]float64 // [sldNu][rodNu] Eq. (60)
Kss [][]float64 // [sldNu][sldNu] Eq. (61)
// internal values
States []*msolid.OnedState // [nip] internal states
StatesBkp []*msolid.OnedState // [nip] backup internal states
StatesAux []*msolid.OnedState // [nip] backup internal states
// contains filtered or unexported fields
}
Rjoint implements the rod-joint (interface/link) element for reinforced solids.
The following convention is considered:
n or N -- means [N]odes
p or P -- means integratioin [P]oints
nn or Nn -- number of nodes
np or Np -- number of integration [P]points
ndim -- space dimension
nsig -- number of stress/strain components == 2 * ndim
rod -- means rod element
rodH -- rod shape structure
rodNn -- rod number of nodes
rodNp -- rod number of integration points
rodS -- rod shape functions
sld -- means solid element
sldH -- rod shape structure
sldNn -- solid number of nodes
sldNp -- solid number of integration points
sldS -- solid shape functions
rodYn -- rod's (real) coordinates of node
rodYp -- rod's (real) coordinates of integration point
r or R -- means natural coordinates in the solids' system
z or Z -- means natural coordinates in the rod's system
s or S -- parametric coordinate along rod
rodRn -- natural coordinates or rod's nodes w.r.t solid's system
rodRp -- natural coordinates of rod's integration point w.r.t to solid's system
Nmat -- solid shape functions evaluated at rod nodes
Pmat -- solid shape functions evaluated at rod integration points
References:
[1] R Durand, MM Farias, DM Pedroso. Modelling the strengthening of solids with
incompatible line finite elements, Computers and Structures (2014). Submitted.
[2] R Durand, MM Farias, DM Pedroso, Computing intersections between non-compatible
curves and finite elements, Computational Mechanics (2014). Submitted.
[3] R Durand, MM Farias. A local extrapolation method for finite elements,
Advances in Engineering Software 67 (2014) 1-9.
http://dx.doi.org/10.1016/j.advengsoft.2013.07.002
func (*Rjoint) InterpStarVars ¶
InterpStarVars interpolates star variables to integration points
func (Rjoint) OutIpsData ¶
OutIpsData returns data from all integration points for output
func (*Rjoint) RestoreIvs ¶
RestoreIvs restore internal variables from copies
func (*Rjoint) SetEleConds ¶
SetEleConds set element conditions
type Rod ¶
type Rod struct {
// basic data
Cid int // cell/element id
X [][]float64 // matrix of nodal coordinates [ndim][nnode]
Shp *shp.Shape // shape structure
Nu int // total number of unknowns == 2 * nsn
// parameters
A float64 // cross-sectional area
// variables for dynamics
Rho float64 // density of solids
Gfcn fun.Func // gravity function
// integration points
IpsElem []*shp.Ipoint // integration points of element
// vectors and matrices
K [][]float64 // global K matrix
M [][]float64 // global M matrices
Rus []float64 // residual: Rus = fi - fx
// problem variables
Umap []int // assembly map (location array/element equations)
// material model and internal variables
Model msolid.OnedSolid
States []*msolid.OnedState
StatesBkp []*msolid.OnedState
StatesAux []*msolid.OnedState
// contains filtered or unexported fields
}
Rod represents a structural rod element (for only axial loads)
func (*Rod) InterpStarVars ¶
InterpStarVars interpolates star variables to integration points
func (Rod) OutIpsData ¶
OutIpsData returns data from all integration points for output
func (*Rod) RestoreIvs ¶
RestoreIvs restore internal variables from copies
func (*Rod) SetEleConds ¶
SetEleConds set element conditions
type Solution ¶
type Solution struct {
// state
T float64 // current time
Y []float64 // DOFs (solution variables); e.g. y = {u, p}
Dydt []float64 // dy/dt
D2ydt2 []float64 // d²y/dt²
// auxiliary
ΔY []float64 // total increment (for nonlinear solver)
Psi []float64 // t1 star vars; e.g. ψ* = β1.p + β2.dpdt
Zet []float64 // t2 star vars; e.g. ζ* = α1.u + α2.v + α3.a
Chi []float64 // t2 star vars; e.g. χ* = α4.u + α5.v + α6.a
L []float64 // Lagrange multipliers
}
Solution holds the solution data @ nodes.
/ u \ / u \
| | => y = | |
yb = | p | \ p / (ny x 1)
| |
\ λ / (nyb x 1)
type Summary ¶
type Summary struct {
Nproc int // number of processors used in last last run; equal to 1 if not distributed
OutTimes []float64 // [nOutTimes] output times
Resids utl.DblSlist // residuals (if Stat is on; includes all stages)
Dirout string // directory where results are stored
Fnkey string // filename key of simulation
}
Summary records summary of outputs
type T_iteration ¶
type T_iteration struct {
It int // iteration number
ResRel float64 // relative residual
Resid float64 // absolute residual
}
T_iteration testing: iteration results
type T_results ¶
type T_results struct {
Status string // status message
LoadFactor float64 // load factor
Iterations []T_iteration // iterations data
Kmats [][][]float64 // [nele][nu][nu] all stiffness matrices
Disp [][]float64 // [nnod][ndim] displacements at nodes
DispMult float64 // displacements multiplier
Note string // note about number of integration points
Sigmas [][][]float64 // [nele][nip][nsig] all stresses @ all ips 2D:{sx, sy, sxy, sz}
}
T_results testing: results