Operators and Algebra
Base.:* — Method*(b::Number, A::ScalarField)Performs multiplication of a ScalarField objects and a Number.
Return: ScalarField
Examples
C = 2.0 * ABase.:* — Method*(A::ScalarField, b::Number)Performs multiplication of a ScalarField objects and a Number.
Return: ScalarField
Examples
C = A * 2.0Base.:* — Method*(A::ScalarField, B::ScalarField)Performs element-wise multiplication of two ScalarField objects on the same set of elements.
Returns: ScalarField
Examples
C = A * BBase.:* — Method*(A::ScalarField, B::VectorField)Scales a VectorField by a ScalarField element-wise on matching elements.
Returns: VectorField
Examples
v2 = s .* v # equivalent to s * vBase.:* — Method*(A::TensorField, B::TensorField)Tensor contraction (matrix multiplication) for each element/node: reshapes 9×1 blocks into 3×3, multiplies, then flattens back.
Returns: TensorField
Base.:* — Method*(B::VectorField, A::ScalarField)Scales a VectorField by a ScalarField element-wise on matching elements.
Returns: VectorField
Base.:+ — Method+(A::ScalarField, B::ScalarField)Performs element-wise addition of two ScalarField objects on the same set of elements.
Returns: ScalarField
Examples
C = A + BBase.:- — Method-(A::ScalarField, B::ScalarField)Performs element-wise subtraction of two ScalarField objects on the same set of elements.
Returns: ScalarField
Examples
C = A - BBase.:/ — Method/(A::ScalarField, B::ScalarField)Performs element-wise division of two ScalarField objects on the same set of elements.
Returns: ScalarField
Examples
C = A / BBase.:/ — Method/(B::VectorField, A::ScalarField)Divides a VectorField by a ScalarField element-wise on matching elements.
Returns: VectorField
Base.:∘ — Method∘(D::Function, A::Union{ScalarField,VectorField})Left application of differential operator D to field A.
- If
D == ∇andAisScalarField: returnsgrad(A). - If
D == ∇andAisVectorField: returnsgrad(A)'(transpose).
Returns: VectorField or TensorField
Examples
# 3D (assumes `problem` and a "body" physical group are defined)
V = vectorField(problem, [field("body", fx=x->x, fy=y->y, fz=z->z)])
T = ∇ ∘ V # equals grad(V)'Base.:∘ — Method∘(A::Union{ScalarField,VectorField}, D::Function)Right application of differential operator D to field A.
- If
D == ∇andAisScalarField: returnsgrad(A). - If
D == ∇andAisVectorField: returnsgrad(A).
Returns: VectorField or TensorField
Examples
# 3D (assumes `problem` and a "body" physical group are defined)
S = scalarField(problem, [field("body", f=(x,y,z)->x*y)])
G = S ∘ ∇ # grad of scalar field
V = vectorField(problem, [field("body", fx=x->x, fy=y->y, fz=z->z)])
H = V ∘ ∇ # grad of vector field (tensor)Base.adjoint — Methodadjoint(A::TensorField)Adjoint (conjugate transpose) of each 3×3 tensor block.
Returns: TensorField
Base.inv — Methodinv(A::TensorField)Matrix inverse of each 3×3 tensor block.
Returns: TensorField
Base.transpose — Methodtranspose(A::TensorField)Transposes each 3×3 tensor block.
Returns: TensorField
LinearAlgebra.:× — Method×(D::Function, A::VectorField)Left curl. With D == ∇, returns curl(A).
Returns: VectorField
Examples
# 3D (assumes `problem` and a "body" physical group are defined)
V = vectorField(problem, [field("body", fx=x->0, fy=x->x, fz=z->0)])
C = ∇ × VLinearAlgebra.:× — Method×(A::VectorField, D::Function)Right curl with sign convention. With D == ∇, returns -curl(A).
Returns: VectorField
Examples
# 3D (assumes `problem` and a "body" physical group are defined)
V = vectorField(problem, [field("body", fx=x->0, fy=x->x, fz=z->0)])
Cneg = V × ∇ # -curl(V)LinearAlgebra.:× — Method×(a::VectorField, b::VectorField)Element-wise 3D vector cross product on matching elements.
Returns: VectorField
Examples
w = u × vLinearAlgebra.:⋅ — Method⋅(D::Function, A::Union{VectorField,TensorField})Left contraction with the differential operator. With D == ∇:
- If
AisVectorField: returnsdiv(A). - If
AisTensorField: returnsdiv(A').
Returns: ScalarField or VectorField
Examples
# 3D (assumes `problem` and a "body" physical group are defined)
T = tensorField(problem, [field("body", fz=z->z)])
DV = ∇ ⋅ T # VectorField (divergence of tensor)LinearAlgebra.:⋅ — Method⋅(A::TensorField, B::TensorField)Element-wise (Hadamard) product followed by summation of all components, yielding a scalar per tensor (i.e., Frobenius inner product).
Returns: ScalarField
LinearAlgebra.:⋅ — Method⋅(A::Union{VectorField,TensorField}, D::Function)Right contraction with the differential operator. With D == ∇:
- If
AisVectorField: returnsdiv(A)(scalar field). - If
AisTensorField: returnsdiv(A)(vector field).
Returns: ScalarField or VectorField
Examples
# 3D (assumes `problem` and a "body" physical group are defined)
V = vectorField(problem, [field("body", fx=x->x, fy=y->y, fz=z->z)])
divV = V ⋅ ∇ # ScalarFieldLinearAlgebra.det — Methoddet(A::TensorField)Computes the determinant of each 3×3 tensor block.
Returns: ScalarField
LinearAlgebra.diagm — Methoddiagm(A::VectorField)Creates a diagonal TensorField from a VectorField (dim=3), i.e., places vector components on the tensor diagonal for each node/element.
Returns: TensorField
LinearAlgebra.norm — Methodnorm(A::VectorField)Element-wise Euclidean norm of a VectorField.
Returns: ScalarField
LowLevelFEM.trace — Methodtrace(A::TensorField)Computes the trace of each 3×3 tensor block.
Returns: ScalarField
LowLevelFEM.unitTensor — MethodunitTensor(A::TensorField)Creates an identity tensor field (I) with the same element structure and time steps as A.
Returns: TensorField