// get_porous_parameters extracts parameters based on region data func get_porous_parameters(mdb *inp.MatDb, reg *inp.Region, ctag int) (RhoS0, nf0 float64, err error) { edat := reg.Etag2data(ctag) mat := mdb.Get(edat.Mat) if mat.Model != "group" { err = chk.Err("geost: material type describing layer must be 'group' with porous data") return } if matname, found := io.Keycode(mat.Extra, "p"); found { m := mdb.Get(matname) for _, p := range m.Prms { switch p.N { case "RhoS0": RhoS0 = p.V case "nf0": nf0 = p.V } } } if RhoS0 < 1e-7 { err = chk.Err("geost: initial density of solids RhoS0=%g is incorrect", RhoS0) return } if nf0 < 1e-7 { err = chk.Err("geost: initial porosity nf0=%g is incorrect", nf0) } return }
// GetElemInfo returns information about elements/formulations // cellType -- e.g. "qua8" // elemType -- e.g. "u" func GetElemInfo(cell *inp.Cell, reg *inp.Region, sim *inp.Simulation) (info *Info, inactive bool, err error) { edat := reg.Etag2data(cell.Tag) if edat == nil { err = chk.Err("cannot get data for element {tag=%d, id=%d}", cell.Tag, cell.Id) return } inactive = edat.Inact infogetter, ok := infogetters[edat.Type] if !ok { err = chk.Err("cannot get info for element {type=%q, tag=%d, id=%d}", edat.Type, cell.Tag, cell.Id) return } info = infogetter(sim, cell, edat) if info == nil { err = chk.Err("info for element {type=%q, tag=%d, id=%d} is not available", edat.Type, cell.Tag, cell.Id) } return }
// NewElem returns a new element from its type; e.g. "p", "u" or "up" func NewElem(cell *inp.Cell, reg *inp.Region, sim *inp.Simulation) (ele Elem, err error) { edat := reg.Etag2data(cell.Tag) if edat == nil { err = chk.Err("cannot get data for element {tag=%d, id=%d}", cell.Tag, cell.Id) return } allocator, ok := eallocators[edat.Type] if !ok { err = chk.Err("cannot get allocator for element {type=%q, tag=%d, id=%d}", edat.Type, cell.Tag, cell.Id) return } x := BuildCoordsMatrix(cell, reg.Msh) ele = allocator(sim, cell, edat, x) if ele == nil { err = chk.Err("element {type=%q, tag=%d, id=%d} is not available", edat.Type, cell.Tag, cell.Id) } return }