structure

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

README

Structure package

The structure package defines the structural model.

A structure is defined as a Structure struct, which contains a map of nodes by id and a slice of elements.

Nodes

Nodes are represented by the Node struct. A node is identified by a unique id, has a position in the plane and an optional external constraint.

A Node can be created using one of the following functions:

  • MakeNode: requires an id, a position and external constraint
  • MakeNodeAtPosition: requires an id, x and y coordinates and an external constraint
  • MakeFreeNodeAtPosition: creates a non-constrained node with the given id and position.

Elements

Documentation

Overview

Package structure defines the structure model used for the Finite Element Method analysis.

Index

Constants

This section is empty.

Variables

View Source
var (
	// NilConstraint is a constraint where all DOF are free.
	NilConstraint = Constraint{false, false, false}

	// DispConstraint is a constraint where the displacement DOFs are constrained.
	DispConstraint = Constraint{true, true, false}

	// FullConstraint is a constraint where all the DOFs are constrained.
	FullConstraint = Constraint{true, true, true}
)

Functions

This section is empty.

Types

type ConcLoadsById

type ConcLoadsById = map[contracts.StrID][]*load.ConcentratedLoad

type Constraint

type Constraint struct {
	// contains filtered or unexported fields
}

A Constraint represents a condition on displacements and rotations.

Constraints are immutable, and therefore can be shared amont the elements that use them. Use the `MakeConstraint` factory function to get an existing instance of a constraint.

func MakeConstraint

func MakeConstraint(isDxConstr, isDyConstr, isRzConst bool) *Constraint

MakeConstraint creates a new constraint with the given degrees of freedom constrained of free.

func (Constraint) AllowsDispX

func (c Constraint) AllowsDispX() bool

AllowsDispX returns true if displacement in x degree of freedom is not constrainted.

func (Constraint) AllowsDispY

func (c Constraint) AllowsDispY() bool

AllowsDispY returns true if displacement in y degree of freedom is not constrainted.

func (Constraint) AllowsRotation

func (c Constraint) AllowsRotation() bool

AllowsRotation returns true is rotation degree of freedom is not constrained.

func (*Constraint) Equals

func (c *Constraint) Equals(other *Constraint) bool

Equals tests whether this constraint equals other.

func (Constraint) String

func (c Constraint) String() string

String representation of the constraint. Used in the serialization format.

type DistLoadsById

type DistLoadsById = map[contracts.StrID][]*load.DistributedLoad

type Element

type Element struct {
	ConcentratedLoads []*load.ConcentratedLoad
	DistributedLoads  []*load.DistributedLoad
	// contains filtered or unexported fields
}

An Element represents a resistant element defined between two structural nodes, a section and a material.

An Element can have distributed and concentrated loads applied to it.

To create an element, use the `ElementBuilder`.

TODO: choose the bending axis TODO: buckling analysis

func (Element) DirectionVersor

func (e Element) DirectionVersor() *g2d.Vector
func (e Element) EndLink() *Constraint

func (Element) EndNodeID

func (e Element) EndNodeID() contracts.StrID

func (Element) EndPoint

func (e Element) EndPoint() *g2d.Point

EndPoint returns the position of the end node of this element's geometry.

func (*Element) Equals

func (e *Element) Equals(other *Element) bool

Equals tests whether this element is equal to other. Loads aren't compared, two bars with different set of loads might therefore be equal.

func (Element) GetID

func (e Element) GetID() contracts.StrID

func (Element) HasLoadsApplied

func (e Element) HasLoadsApplied() bool

HasLoadsApplied returns true if any load, either concentrated of distributed, is applied to the element.

func (Element) IsAxialMember

func (e Element) IsAxialMember() bool

IsAxialMember returns true if this element is pinned in both ends and, in case of having loads applied, they are always in the end positions of the directrix and does not include moments about Z, but just forces in X and Y directions.

FIXME: is axial member a good name? a distributed Fx load would make this bar not an axial member, which seems weird...

func (Element) Length

func (e Element) Length() float64

func (Element) LengthBetween

func (e Element) LengthBetween(tStart, tEnd nums.TParam) float64

func (Element) LoadsCount

func (e Element) LoadsCount() int

LoadsCount is the total number of concentrated and distributed loads applied to the element.

func (Element) Material

func (e Element) Material() *Material

Material returns the elements's material.

func (Element) NormalVersor

func (e Element) NormalVersor() *g2d.Vector

func (Element) PointAt

func (e Element) PointAt(t nums.TParam) *g2d.Point

PointAt returns the position of a middle point in this element's geometry.

func (Element) RefFrame

func (e Element) RefFrame() *g2d.RefFrame

func (Element) Section

func (e Element) Section() *Section

Section returns the element's section.

func (e Element) StartLink() *Constraint

func (Element) StartNodeID

func (e Element) StartNodeID() contracts.StrID

func (Element) StartPoint

func (e Element) StartPoint() *g2d.Point

StartPoint returns the position of the start node of this element's geometry.

func (Element) StiffnessGlobalMat

func (e Element) StiffnessGlobalMat(startT, endT nums.TParam) mat.ReadOnlyMatrix

StiffnessGlobalMat generates the local stiffness matrix for the element and applies the rotation defined by the elements' geometry reference frame.

It returns the element's stiffness matrix in the global reference frame.

func (Element) String

func (e Element) String() string

String representation of the bar.

type ElementBuilder

type ElementBuilder struct {
	// contains filtered or unexported fields
}

func MakeElementBuilder

func MakeElementBuilder(id contracts.StrID) *ElementBuilder

func (*ElementBuilder) AddConcentratedLoad

func (builder *ElementBuilder) AddConcentratedLoad(load *load.ConcentratedLoad) *ElementBuilder

func (*ElementBuilder) AddConcentratedLoads

func (builder *ElementBuilder) AddConcentratedLoads(loads []*load.ConcentratedLoad) *ElementBuilder

func (*ElementBuilder) AddDistributedLoad

func (builder *ElementBuilder) AddDistributedLoad(load *load.DistributedLoad) *ElementBuilder

func (*ElementBuilder) AddDistributedLoads

func (builder *ElementBuilder) AddDistributedLoads(loads []*load.DistributedLoad) *ElementBuilder

func (ElementBuilder) Build

func (builder ElementBuilder) Build() *Element

func (*ElementBuilder) IncludeOwnWeightLoad

func (builder *ElementBuilder) IncludeOwnWeightLoad() *ElementBuilder

func (*ElementBuilder) WithEndNode

func (builder *ElementBuilder) WithEndNode(
	endNode *Node,
	endLink *Constraint,
) *ElementBuilder

func (*ElementBuilder) WithMaterial

func (builder *ElementBuilder) WithMaterial(material *Material) *ElementBuilder

func (*ElementBuilder) WithSection

func (builder *ElementBuilder) WithSection(section *Section) *ElementBuilder

func (*ElementBuilder) WithStartNode

func (builder *ElementBuilder) WithStartNode(
	startNode *Node,
	startLink *Constraint,
) *ElementBuilder

type ElementsSeq

type ElementsSeq struct {
	// contains filtered or unexported fields
}

func (*ElementsSeq) Elements

func (el *ElementsSeq) Elements() []*Element

Elements returns a slice containing all elements.

func (*ElementsSeq) ElementsCount

func (el *ElementsSeq) ElementsCount() int

ElementsCount is the number of elements in the structure.

func (*ElementsSeq) GetElementById

func (el *ElementsSeq) GetElementById(id contracts.StrID) *Element

GetElementById returns the element with the given id or panics. This operation has an O(n) time complexity as it needs to iterate over all elements.

func (*ElementsSeq) GetMaterialsByName

func (el *ElementsSeq) GetMaterialsByName() map[string]*Material

GetMaterialsByName returns a map of all used materials by name.

func (*ElementsSeq) GetSectionsByName

func (el *ElementsSeq) GetSectionsByName() map[string]*Section

GetSectionsByName returns a map of all used sections by name.

func (*ElementsSeq) LoadsCount

func (el *ElementsSeq) LoadsCount() int

LoadsCount is the total number of concentrated and distributed loads applied to all elements.

func (*ElementsSeq) MaterialsCount

func (el *ElementsSeq) MaterialsCount() int

MaterialsCount is the number of different materials used in the elements. Two materials are considered different if their names are.

func (*ElementsSeq) SectionsCount

func (el *ElementsSeq) SectionsCount() int

SectionsCount is the number of different sections used in the elements. Two sections are considered different if their names are.

type Material

type Material struct {
	Name                             string
	Density                          float64
	YoungMod, ShearMod, PoissonRatio float64
	YieldStrength, UltimateStrength  float64
}

Material represents a the substance from which resistant elements are made of. Materials have the properties of: - Density - Young Modulus - Shear Modulus - Poisson Ratio - Yield Strength - Ultimate Strength

func MakeMaterial

func MakeMaterial(name string, density, young, shear, poisson, yield, ultimate float64) *Material

MakeMaterial creates a material with the given properties.

func MakeUnitMaterial

func MakeUnitMaterial() *Material

MakeUnitMaterial creates a material with all properties set to 1.0.

func (*Material) Equals

func (m *Material) Equals(other *Material) bool

Equals tests whether this and other materials are equal.

Materials are equal if all its numerical properties are equal. the name isn't considered for the equality check.

func (*Material) String

func (m *Material) String() string

String representation of the material.

type MaterialsByName

type MaterialsByName = map[string]*Material

type Node

type Node struct {
	Position           *g2d.Point
	ExternalConstraint *Constraint
	// contains filtered or unexported fields
}

Node is a point in the structure where one or more resistant elements meet.

func MakeFreeNodeAtPosition

func MakeFreeNodeAtPosition(id contracts.StrID, x, y float64) *Node

MakeFreeNodeAtPosition creates a new node without external constraint, with the given id and position by coordinates.

func MakeNode

func MakeNode(
	id contracts.StrID,
	position *g2d.Point,
	externalConstraint *Constraint,
) *Node

MakeNode creates a new node with the given id, position and external constraint.

func MakeNodeAtPosition

func MakeNodeAtPosition(
	id contracts.StrID,
	x, y float64,
	externalConstraint *Constraint,
) *Node

MakeNodeAtPosition creates a new node with the given id, position coordinates and external constraint.

func (Node) DegreesOfFreedomNum

func (n Node) DegreesOfFreedomNum() [3]int

DegreesOfFreedomNum returns the degrees of freedom numbers assigned to the node.

func (*Node) Equals

func (n *Node) Equals(other *Node) bool

Equals tests whether this node and other are equal.

func (Node) GetID

func (n Node) GetID() contracts.StrID

GetID returns the node's id.

func (Node) HasDegreesOfFreedomNum

func (n Node) HasDegreesOfFreedomNum() bool

HasDegreesOfFreedomNum returns true if the node has already been assigned degress of freedom.

func (Node) IsExternallyConstrained

func (n Node) IsExternallyConstrained() bool

IsExternallyConstrained returns true if this node is externally constrained.

func (*Node) SetDegreesOfFreedomNum

func (n *Node) SetDegreesOfFreedomNum(dx, dy, rz int) *Node

SetDegreesOfFreedomNum assigns numbers to the degress of freedom of the node.

func (Node) String

func (n Node) String() string

String representation of the node. This method is used for serialization, thus if the format is changed, the definition, preprocessed and solution file formats are affected.

type NodesById

type NodesById struct {
	// contains filtered or unexported fields
}

NodesById is a composable map of nodes with some useful methods.

func MakeNodesById

func MakeNodesById(nodes NodesByIdMap) NodesById

func (*NodesById) ConstrainedNodesCount

func (n *NodesById) ConstrainedNodesCount() int

ConstrainedNodesCount is the number of nodes with an external constraint.

func (*NodesById) GetAllNodes

func (n *NodesById) GetAllNodes() []*Node

GetAllNodes returns a slice containing all of the structure nodes.

func (*NodesById) GetNodeById

func (n *NodesById) GetNodeById(id contracts.StrID) *Node

GetNodeById returns the node with the given id. Panics if the node is doesn't exist in the structure.

func (*NodesById) NodesById

func (n *NodesById) NodesById() NodesByIdMap

NodesById is a map where the nodes of the structure can be accessed by their id.

func (*NodesById) NodesCount

func (n *NodesById) NodesCount() int

NodesCount is the number of nodes in the structure.

type NodesByIdMap

type NodesByIdMap = map[contracts.StrID]*Node

type Section

type Section struct {
	Name           string
	Area           float64
	IStrong, IWeak float64 // Moments of Inertia
	SStrong, SWeak float64 // Section Moduli
}

A Section of a resistant element.

func MakeSection

func MakeSection(name string, area, iStrong, iWeak, sStrong, sWeak float64) *Section

MakeSection creates a section with the given properties.

func MakeUnitSection

func MakeUnitSection() *Section

MakeUnitSection creates a section with all properties set to 1.0.

func (*Section) Equals

func (s *Section) Equals(other *Section) bool

Equals tests whether this and other sections are equal.

Sections are equal if all its numerical properties are equal. the name isn't considered for the equality check.

func (*Section) String

func (s *Section) String() string

String representation of the section.

type SectionsByName

type SectionsByName = map[string]*Section

type StrMetadata

type StrMetadata struct {
	MajorVersion, MinorVersion int
}

StrMetadata includes information about what version of the software created or resolved the structure.

type Structure

type Structure struct {
	Metadata StrMetadata
	NodesById
	ElementsSeq
}

A Structure is a group of linear resistant elements joined together designed to withstand the application of external loads, concentrated and distributed.

func Make

func Make(metadata StrMetadata, nodes map[contracts.StrID]*Node, elements []*Element) *Structure

Make creates a new structure model.

type StructureData

type StructureData struct {
	Nodes             NodesByIdMap
	Materials         MaterialsByName
	Sections          SectionsByName
	ConcentratedLoads ConcLoadsById
	DistributedLoads  DistLoadsById
}

Directories

Path Synopsis
Package load contains definition of loads applied to structural members.
Package load contains definition of loads applied to structural members.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL