preprocess

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: 11 Imported by: 0

README

Preprocess Package

This package defines the preprocessed or sliced structure model which is used for the Finite Element Analysis. It also provides the means for slicing or preprocessing the structure as it is defined in the structure package.

Slicing the structure model

A structure model (structure.Structure) can be sliced using the preprocess.StructureModel function. This function is the only public function this package exports. The result is a preprocess.Structure.

Documentation

Overview

Package preprocess defines the 'preprocessed' or 'sliced' structure model which is used for the Finite Element Analysis.

This package also provides the means for slicing or preprocessing the structure as it is defined in the 'structure' package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByGeometryPos

type ByGeometryPos []*Element

ByGeometryPos implements sort.Interface for []Element based on the position of the original geometry.

func (ByGeometryPos) Len

func (a ByGeometryPos) Len() int

func (ByGeometryPos) Less

func (a ByGeometryPos) Less(i, j int) bool

func (ByGeometryPos) Swap

func (a ByGeometryPos) Swap(i, j int)

type Element

type Element struct {
	*structure.Element
	// contains filtered or unexported fields
}

Element after slicing the original structural element. Consists of a sequence of intermediate nodes with the element's loads applied to them.

func MakeElement

func MakeElement(originalElement *structure.Element, nodes []*Node) *Element

MakeElement creates a new element given the original element and the nodes of the sliced result.

func (*Element) Equals

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

Equals compares this bar with another one and returns true if both have the same nodes.

func (Element) NodeAt

func (element Element) NodeAt(i int) *Node

NodeAt returns the node at a given index.

func (Element) Nodes

func (element Element) Nodes() []*Node

Nodes is the slice of all nodes in the element.

func (Element) NodesCount

func (element Element) NodesCount() int

NodesCount returns the number of nodes in the sliced element.

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 returns the number of elements in the original 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]*structure.Material

GetMaterialsByName returns a map of all used materials by name.

func (*ElementsSeq) GetSectionsByName

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

GetSectionsByName returns a map of all used sections by name.

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 Node

type Node struct {
	T        nums.TParam
	Position *g2d.Point
	// contains filtered or unexported fields
}

A Node represents an intermediate point in a sliced element.

This point has a T Parameter associated, external loads applied and degrees of freedom numbering for the global system.

The "leftLocalLoad" is the equivalent load, in local coordinates, from the finite element located to the left of the node.

The "rightLocalLoad" is the equivalent load, in local coordinates, from the finite element located to the right of the node.

func MakeNode

func MakeNode(
	t nums.TParam,
	position *g2d.Point,
	fx, fy, mz float64,
) *Node

MakeNode creates a new node with given T parameter value, position and local external loads {fx, fy, mz}.

func MakeUnloadedNode

func MakeUnloadedNode(t nums.TParam, position *g2d.Point) *Node

MakeUnloadedNode creates a new node with given T parameter value, position, and no loads applied.

func (*Node) AddLocalExternalLoad

func (n *Node) AddLocalExternalLoad(loadTorsor *math.Torsor)

AddLocalExternalLoad adds the given load values to the externally applied load.

func (*Node) AddLocalLeftLoad

func (n *Node) AddLocalLeftLoad(fx, fy, mz float64)

AddLocalLeftLoad adds the given load values to the load applied from the finite element where this node is to the left of it (where this node is the element's trailing node).

func (*Node) AddLocalRightLoad

func (n *Node) AddLocalRightLoad(fx, fy, mz float64)

AddLocalRightLoad adds the given load values to the load applied from the finite element where this node is to the right of it (where this node is the element's leading node).

func (Node) DegreesOfFreedomNum

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

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

func (*Node) DistanceTo

func (n *Node) DistanceTo(other *Node) float64

DistanceTo computes the distance between this an other node.

func (*Node) Equals

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

Equals returns true if this and the other node equal.

func (Node) HasDegreesOfFreedomNum

func (n Node) HasDegreesOfFreedomNum() bool

HasDegreesOfFreedomNum returns true if the node has already been assigned degress of freedom. If any of the DOFs is -1, it's assumed that this node hasn't been assigned DOFs.

func (Node) LocalLeftFx

func (n Node) LocalLeftFx() float64

func (Node) LocalLeftFy

func (n Node) LocalLeftFy() float64

func (Node) LocalLeftMz

func (n Node) LocalLeftMz() float64

func (Node) LocalRightFx

func (n Node) LocalRightFx() float64

func (Node) LocalRightFy

func (n Node) LocalRightFy() float64

func (Node) LocalRightMz

func (n Node) LocalRightMz() float64

func (Node) NetLocalFx

func (n Node) NetLocalFx() float64

NetLocalFx returns the magnitude of the net force in X, projected in local coordinates.

func (Node) NetLocalFy

func (n Node) NetLocalFy() float64

NetLocalFy returns the magnitude of the net force in Y, projected in local coordinates.

func (Node) NetLocalLoadTorsor

func (n Node) NetLocalLoadTorsor() *math.Torsor

NetLocalLoadTorsor returns the torsor of net load values {Fx, Fy, Mz} projected in local coordinates.

func (Node) NetLocalMz

func (n Node) NetLocalMz() float64

NetLocalMz returns the magnitude of the net moment about Z, projected in local coordinates.

func (Node) NetLocalTorsor

func (n Node) NetLocalTorsor() *math.Torsor

NetLocalTorsor returns the resulting torsor of adding the external loads and the loads added by the left and right finite elements, all projected in local coordinates.

func (*Node) SetDegreesOfFreedomNum

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

SetDegreesOfFreedomNum adds degrees of freedom numbers to the node. These degrees of freedom numbers are also the position in the system of equations for the corresponding stiffness terms.

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 preprocessed file format might be affected.

type Structure

type Structure struct {
	Metadata structure.StrMetadata
	structure.NodesById
	ElementsSeq
	// contains filtered or unexported fields
}

Structure result of preprocessing original structure, ready to be solved. The elements of a preprocessed structure are already sliced.

A preprocessed structure can be created using the MakeStructure function. The created structure doesn't have the degrees of freedom assigned. For that, the following function must be called:

structure.AssignDof()

func MakeStructure

func MakeStructure(
	metadata structure.StrMetadata,
	nodesById structure.NodesById,
	elements []*Element,
) *Structure

MakeStructure creates a preprocessed structure.

func StructureModel

func StructureModel(str *structure.Structure) *Structure

StructureModel preprocesses the structure by concurrently slicing each of the structural members. The resulting sliced structure includes the degrees of freedom numbering.

func (*Structure) AssignDof

func (str *Structure) AssignDof() *Structure

AssignDof assigns degrees of freedom numbers to all nodes on sliced elements.

Structural nodes are given degrees of freedom to help in the correct assignment of DOF numbers to the elements that meet in the node. Structural elements are first sorted by their geometry positions, so the degrees of freedom numbers follow a logical sequence.

func (*Structure) DofsCount

func (s *Structure) DofsCount() int

DofsCount is the number of degrees of freedom in the preprocessed structure.

func (*Structure) GetElementNodes

func (s *Structure) GetElementNodes(element *Element) (*structure.Node, *structure.Node)

GetElementNodes returns the element's start and end nodes.

func (*Structure) MakeSystemOfEquations

func (str *Structure) MakeSystemOfEquations() (mat.ReadOnlyMatrix, vec.ReadOnlyVector)

MakeSystemOfEquations generates the system of equations matrix and vector from the preprocessed structure.

It computes each of the sliced element's stiffness matrices and assembles them into one global matrix. It also assembles the global loads vector from the sliced element nodes.

func (*Structure) SetDofsCount

func (s *Structure) SetDofsCount(dofsCount int) *Structure

SetDofsCount sets the number of degrees of freedom the preprocessed structure has. This method is to be used when the structure is read from a file where the DOFs are already assigned.

Jump to

Keyboard shortcuts

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