Skip to content

Algebra Basics

giovannacandrade edited this page Mar 25, 2025 · 7 revisions

This page contains a basic information about mathematical operators and algebric operations that can be perfomed in Swan.

Differential Operators

Differential operators are currently defined for Lagrangian Functions.

Operation Expression Notes
Partial Derivative Partial(u, i)
Gradient Grad(u)
Symmetric Gradient SymGrad(u)
Divergence Divergence(u)
Laplacian u.computeLaplacianFun(xV) xV are the Gauss points
Curl u.computeCurl() Only for 2D
Deviatoric Deviatoric(A)
Volumetric Strain VolumetricStrain(u)
Deviatoric Strain DeviatoricStrain(u)
Deviatoric Elastic Energy Density DeviatoricElasticEnergyDensity(u,mu)
Volumetric Elastic Energy Density VolumetricElasticEnergyDensity(u,mu)

Algebric Operations

In this section we describe operations can be defined for DomainFunctions or LagrangianFunction.

Operation Expresion Notes
Pointwise Multiplication times(a,A) Scalar-Scalar, Scalar-Vector or Scalar-Tensor multiplications
Dot Product DP(A,B) Single Index Contraction for Tensors
Double Dot Product DDP(A,B) Double Index Contraction for Tensors

Integral Operations

Function Expression Notes
Mean Mean(f,quad) Mean value of f over the mesh with quadrature order quad
Integral Integrate(f) Integral of f over the mesh

Nonlinear Functions

Function Expression
Logarithm log(u)
Exponential exp(u)
Square Root sqrt(u)
Heaviside Heaviside(x)

Norms and Inner Products

Operation Definition Expression
L2 Inner Product ⟨f, g⟩ = ∫ f ⋅ g ScalarProduct(f,g,'L2')
L2 Norm ‖f‖ = sqrt(⟨a, a⟩) Norm(f,'L2')
H1 Inner Product ⟨f, g⟩ = ∫f ⋅ g + ε∇f ⋅ ∇g ScalarProduct(f,g,'H1',epsilon)
H1 Norm ‖f‖ = sqrt(⟨f, f⟩) Norm(f,'H1', epsilon)

Custom sidebar example

Clone this wiki locally