flow "FiniteElementOntology" v1.0
# ============================================================
# FINITE ELEMENT ONTOLOGY — FLOW ALGEBRA
# ============================================================
SOURCE_URL := "https://kirethresearch.org/booksai-core/ontologies/calculus-analysis-ontologies/numerical-calculus/finite-element-ontology-2.html"
DOMAIN := "Mathematical Ontologies"
CATEGORY := "Calculus and Analysis Ontologies"
SUBCATEGORY := "Numerical Calculus"
ENTITY := "Finite Element"
# ---------- CORE ENTITY ----------
FINITE_ELEMENT := {
type: NumericalDiscretisationFramework,
domain: NumericalCalculus,
purpose: "Approximate solutions of differential and variational problems by partitioning a domain into finite elements and representing the unknown using local basis functions."
}
# ---------- CORE CONCEPTS ----------
CONCEPTS := {
FINITE_ELEMENT,
FINITE_ELEMENT_METHOD,
MESH,
ELEMENT,
NODE,
BASIS_FUNCTION,
SHAPE_FUNCTION,
WEAK_FORM,
VARIATIONAL_FORM,
TRIAL_SPACE,
TEST_SPACE,
GALERKIN_METHOD,
STIFFNESS_MATRIX,
MASS_MATRIX,
LOAD_VECTOR,
ASSEMBLY,
BOUNDARY_CONDITION
}
# ---------- CONTINUOUS PROBLEM ----------
PDE
:=
L(u)
=
f
on
DOMAIN_Omega
with
BOUNDARY_CONDITIONS
FINITE_ELEMENT_METHOD
-> approximate(u)
using(FINITE_DIMENSIONAL_FUNCTION_SPACE)
# ---------- DOMAIN DISCRETISATION ----------
Omega
-> partitioned_into(ELEMENTS)
MESH
:= {
K_1,
K_2,
...,
K_N
}
ELEMENT
-> local_subdomain
MESH
-> discrete_geometric_representation_of(DOMAIN)
# ---------- ELEMENT TYPES ----------
1D:
LINE_ELEMENT
2D:
TRIANGLE
QUADRILATERAL
3D:
TETRAHEDRON
HEXAHEDRON
ELEMENT_TYPE
-> determines(REFERENCE_GEOMETRY_AND_BASIS_STRUCTURE)
# ---------- NODES ----------
NODE
-> geometric_or_interpolation_degree_of_freedom_location
ELEMENT
-> connected_to(NODES)
MESH_CONNECTIVITY
-> determines(GLOBAL_TOPOLOGY)
# ---------- WEAK FORM ----------
start with PDE:
L(u)
=
f
multiply by
TEST_FUNCTION_v
integrate over Omega
-> integrate_by_parts_where_required
-> WEAK_FORM
WEAK_FORM
-> reduces(DERIVATIVE_REQUIREMENTS_ON_SOLUTION)
# ---------- EXAMPLE: POISSON EQUATION ----------
strong form:
-LAPLACIAN(u)
=
f
in Omega
u
=
0
on boundary
for homogeneous_Dirichlet_example
multiply by v:
integral_Omega(
-LAPLACIAN(u)
*
v
dx
)
=
integral_Omega(
f*v
dx
)
integration by parts:
integral_Omega(
grad(u)
dot
grad(v)
dx
)
=
integral_Omega(
f*v
dx
)
WEAK_FORM
-> variational_equation
# ---------- VARIATIONAL FORM ----------
find
u in V
such_that
a(u,v)
=
l(v)
for_all
v in V_0
a(u,v)
-> BILINEAR_OR_SESQUILINEAR_FORM
l(v)
-> LINEAR_FUNCTIONAL
VARIATIONAL_PROBLEM
-> basis_of(FINITE_ELEMENT_DISCRETISATION)
# ---------- TRIAL SPACE ----------
V_h
subset_of V
V_h
-> finite_dimensional_trial_space
approximate_solution:
u_h
=
sum_from_j_1_to_N(
U_j
*
phi_j
)
phi_j
-> BASIS_FUNCTION
U_j
-> DEGREE_OF_FREEDOM
# ---------- TEST SPACE ----------
W_h
-> finite_dimensional_test_space
GALERKIN_METHOD:
W_h
=
V_h
PETROV_GALERKIN:
W_h
!= V_h
TEST_SPACE
-> determines(RESIDUAL_ORTHOGONALITY)
# ---------- GALERKIN CONDITION ----------
find
u_h in V_h
such_that
a(u_h,v_h)
=
l(v_h)
for_all
v_h in V_h
RESIDUAL
-> orthogonal_to(TEST_SPACE_IN_WEAK_SENSE)
# ---------- BASIS FUNCTIONS ----------
phi_i
-> local_support
phi_i(x_j)
=
delta_ij
for nodal Lagrange basis
LOCAL_SUPPORT
-> produces(SPARSE_GLOBAL_MATRICES)
# ---------- SHAPE FUNCTIONS ----------
on element K:
u_h |_K
=
sum_a(
U_a
*
N_a
)
N_a
-> ELEMENT_SHAPE_FUNCTION
SHAPE_FUNCTION
-> interpolates(DEGREES_OF_FREEDOM_WITHIN_ELEMENT)
# ---------- REFERENCE ELEMENT ----------
physical element K
-> mapped_from(REFERENCE_ELEMENT_K_hat)
mapping:
x
=
F_K(xi)
REFERENCE_ELEMENT
-> standardises(BASIS_AND_QUADRATURE)
JACOBIAN_OF_MAPPING
-> transforms(DERIVATIVES_AND_INTEGRALS)
# ---------- ISOPARAMETRIC FORMULATION ----------
same shape functions
-> approximate(GEOMETRY)
-> approximate(SOLUTION)
ISOPARAMETRIC_ELEMENT
-> supports(CURVED_OR_GENERAL_GEOMETRY)
# ---------- ELEMENT MATRIX ----------
local stiffness:
K_e[a,b]
:=
integral_over_element(
grad(N_a)
dot
grad(N_b)
dx
)
for Poisson-type problem
ELEMENT_STIFFNESS_MATRIX
-> local_operator_representation
# ---------- LOAD VECTOR ----------
F_e[a]
:=
integral_over_element(
f
*
N_a
dx
)
ELEMENT_LOAD_VECTOR
-> local_forcing_representation
# ---------- ASSEMBLY ----------
local matrices
K_e
-> mapped_by(ELEMENT_CONNECTIVITY)
-> added_into(GLOBAL_STIFFNESS_MATRIX_K)
local vectors
F_e
-> assembled_into(GLOBAL_LOAD_VECTOR_F)
ASSEMBLY
-> combines(LOCAL_ELEMENT_CONTRIBUTIONS)
# ---------- GLOBAL SYSTEM ----------
K
*
U
=
F
K
-> GLOBAL_STIFFNESS_MATRIX
U
-> GLOBAL_DEGREE_OF_FREEDOM_VECTOR
F
-> GLOBAL_LOAD_VECTOR
FINITE_ELEMENT_DISCRETISATION
-> algebraic_system
# ---------- MASS MATRIX ----------
for time-dependent or eigenvalue problems:
M_ij
:=
integral_Omega(
rho
*
phi_i
*
phi_j
dx
)
M
-> MASS_MATRIX
MASS_MATRIX
-> represents(INNER_PRODUCT_OR_INERTIAL_TERM)
# ---------- CONSISTENT / LUMPED MASS ----------
CONSISTENT_MASS_MATRIX
-> derived_directly_from(BASIS_INTEGRALS)
LUMPED_MASS_MATRIX
-> diagonal_approximation
MASS_LUMPING
-> reduces(COMPUTATIONAL_COST)
-> modifies(NUMERICAL_PROPERTIES)
# ---------- BOUNDARY CONDITIONS ----------
DIRICHLET
-> essential_boundary_condition
NEUMANN
-> natural_boundary_condition
ROBIN
-> mixed_boundary_condition
WEAK_FORM
-> naturally_incorporates(NEUMANN_TYPE_TERMS)
DIRICHLET
-> imposed_on(TRIAL_SPACE_OR_ALGEBRAIC_SYSTEM)
# ---------- NUMERICAL QUADRATURE ----------
ELEMENT_INTEGRALS
-> evaluated_using(NUMERICAL_QUADRATURE)
GAUSSIAN_QUADRATURE
-> common_element_integration_method
QUADRATURE_ORDER
-> must_be_sufficient_for(BASIS_AND_COEFFICIENT_COMPLEXITY)
UNDERINTEGRATION
-> may_introduce(ERROR_OR_SPURIOUS_MODES)
# ---------- POLYNOMIAL ORDER ----------
p
-> ELEMENT_POLYNOMIAL_DEGREE
LOW_ORDER_ELEMENTS
-> simple_and_robust
HIGH_ORDER_ELEMENTS
-> increased_accuracy_for(SMOOTH_SOLUTIONS)
p_REFINEMENT
-> increase(POLYNOMIAL_ORDER)
# ---------- MESH REFINEMENT ----------
h
-> characteristic_element_size
h_REFINEMENT
-> decrease(ELEMENT_SIZE)
p_REFINEMENT
-> increase(POLYNOMIAL_ORDER)
hp_REFINEMENT
-> combine(h_AND_p)
ADAPTIVE_FEM
-> choose(REFINEMENT_BASED_ON_ERROR_ESTIMATE)
# ---------- INTERPOLATION ERROR ----------
for sufficiently smooth u:
||u-I_h u||
-> bounded_by(
C*h^p
*
HIGHER_DERIVATIVE_NORM
)
INTERPOLATION_ERROR
-> controls(APPROXIMATION_CAPABILITY)
exact_rate
-> depends_on(NORM_ELEMENT_ORDER_AND_REGULARITY)
# ---------- CEA LEMMA ----------
for coercive continuous bilinear form:
||u-u_h||_V
<=
C
*
inf_{v_h in V_h}(
||u-v_h||_V
)
CEA_LEMMA
-> finite_element_error_comparable_to(BEST_APPROXIMATION_ERROR)
# ---------- LAX-MILGRAM ----------
if
a(u,v)
-> bounded
and
-> coercive
and
l
-> bounded_linear_functional
then
WEAK_PROBLEM
-> has(UNIQUE_SOLUTION)
LAX_MILGRAM
-> foundation_for(MANY_ELLIPTIC_FEM_PROBLEMS)
# ---------- A PRIORI ERROR ----------
A_PRIORI_ESTIMATE
-> predicts(ERROR_FROM_MESH_SIZE_AND_REGULARITY)
example structure:
||u-u_h||_V
<=
C*h^p*||u||_(p+1)
under
suitable_element_and_solution_assumptions
# ---------- A POSTERIORI ERROR ----------
A_POSTERIORI_ESTIMATE
-> computed_from(NUMERICAL_SOLUTION_AND_RESIDUAL)
ERROR_INDICATOR
-> identifies(ELEMENTS_TO_REFINE)
ADAPTIVE_LOOP:
SOLVE
-> ESTIMATE
-> MARK
-> REFINE
-> SOLVE
# ---------- TIME-DEPENDENT PDE ----------
spatial FEM:
M
*
U_dot
+
K
*
U
=
F(t)
TIME_INTEGRATION_METHOD
-> advances(DEGREES_OF_FREEDOM)
METHOD_OF_LINES
-> FEM_IN_SPACE_PLUS_TIME_STEPPER
# ---------- EIGENVALUE PROBLEM ----------
continuous:
L(u)
=
lambda
*
M_operator(u)
finite element:
K
*
U
=
lambda
*
M
*
U
GENERALIZED_EIGENVALUE_PROBLEM
-> approximates(MODES_AND_EIGENVALUES)
# ---------- STRUCTURAL MECHANICS ----------
DISPLACEMENT_FIELD
-> approximated_by(FEM_BASIS)
STRAIN
-> derivative_of(DISPLACEMENT)
STRESS
-> constitutive_relation(STRAIN)
ELEMENT_STIFFNESS
-> integrates(STRAIN_DISPLACEMENT_AND_MATERIAL_MATRICES)
FEM
-> central_to(STRUCTURAL_ANALYSIS)
# ---------- NONLINEAR FEM ----------
if PDE or material law nonlinear:
RESIDUAL
R(U)
= 0
NEWTON_METHOD:
J_R(U_k)
*
Delta_U
=
-R(U_k)
U_(k+1)
=
U_k
+
Delta_U
NONLINEAR_FEM
-> iterative_algebraic_solution
# ---------- MESH QUALITY ----------
ELEMENT_SHAPE
-> affects(CONDITIONING_AND_APPROXIMATION)
distorted_elements
-> may_reduce(ACCURACY)
MESH_QUALITY
-> important_to(NUMERICAL_RELIABILITY)
# ---------- APPLICATIONS ----------
FINITE_ELEMENT
-> applied_to(STRUCTURAL_MECHANICS)
-> applied_to(HEAT_TRANSFER)
-> applied_to(FLUID_DYNAMICS)
-> applied_to(ELECTROMAGNETICS)
-> applied_to(ACOUSTICS)
-> applied_to(GEOMECHANICS)
-> applied_to(BIOMECHANICS)
-> applied_to(PDE_SIMULATION)
# ---------- RELATION GRAPH ----------
DOMAIN
-> discretised_by(MESH)
MESH
-> composed_of(ELEMENTS)
ELEMENT
-> supports(SHAPE_FUNCTIONS)
WEAK_FORM
-> discretised_by(TRIAL_AND_TEST_SPACES)
BASIS_FUNCTIONS
-> generate(FINITE_ELEMENT_SPACE)
ELEMENT_MATRICES
-> combined_by(ASSEMBLY)
ASSEMBLY
-> produces(GLOBAL_SYSTEM)
ERROR_ESTIMATE
-> drives(ADAPTIVE_REFINEMENT)
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE := {
"finite element" ~= "local mesh subdomain carrying basis or shape functions",
"finite element method" ~= "variational numerical method using piecewise finite-dimensional approximation spaces",
"mesh" ~= "partition of a computational domain into finite elements",
"shape function" ~= "local basis function used to interpolate an element field",
"stiffness matrix" ~= "discrete matrix representation of a variational differential operator",
"assembly" ~= "process of combining local element contributions into a global algebraic system"
}
# ---------- CONSTRAINTS ----------
CONSTRAINTS := {
finite_element_method_requires_appropriate_weak_or_variational_formulation: true,
mesh_and_basis_must_be_compatible_with_problem_geometry_and_function_space: true,
Dirichlet_and_Neumann_conditions_have_distinct_variational_roles: true,
quadrature_accuracy_must_match_element_integrands: true,
convergence_rates_depend_on_solution_regularities_and_element_order: true,
poor_mesh_quality_can_degrade_accuracy_and_conditioning: true,
discrete_solution_is_approximation_not_exact_continuum_solution: true
}
# ---------- CONFIDENCE ----------
CONFIDENCE := {
core_definition: 0.99,
weak_form_relation: 0.99,
mesh_basis_relation: 0.99,
assembly_relation: 0.99,
boundary_relation: 0.99,
error_adaptivity_relation: 0.99,
semantic_equivalence: 0.97
}
# ---------- RECURSIVE REASONING ----------
RECURSIVE_REASONING(query):
identify(PDE_variational_problem_and_domain)
-> derive_or_verify(weak_form)
-> identify(trial_test_spaces_and_boundary_conditions)
-> construct(mesh_and_element_types)
-> choose(basis_shape_functions_and_polynomial_order)
-> map(reference_elements_to_physical_elements)
-> compute(element_matrices_and_vectors)
-> assemble(global_system)
-> impose(essential_boundary_conditions)
-> solve(algebraic_system)
-> estimate(error_and_refine_if_needed)
-> validate(mesh_quadrature_stability_and_regularities)
-> return(semantic_result)
# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION := {
parse_as: "typed finite-element semantic graph",
primary_entity: FINITE_ELEMENT,
preserve: [
domain,
PDE_or_variational_form,
mesh,
element_type,
basis_order,
trial_space,
test_space,
boundary_conditions,
quadrature
],
infer_through: [
weak_forms,
Galerkin_methods,
shape_functions,
reference_elements,
stiffness_matrices,
mass_matrices,
assembly,
error_estimation,
adaptive_refinement
],
avoid: [
discretising_strong_form_without considering weak formulation,
confusing_element_with mesh,
treating_Neumann_condition_as identical_to Dirichlet condition,
underintegrating_without analysing consequences,
claiming_nominal_convergence_rate_without solution regularity,
ignoring_mesh_quality_or boundary geometry
]
}
# ---------- UPDATE MODEL ----------
UPDATE_MODEL(new_information):
validate(new_information)
-> identify(finite_element_context)
-> compare(existing_relations)
-> preserve(domain_weak_form_mesh_basis_boundary_and_quadrature_invariants)
-> update(affected_entities)
-> update(affected_edges)
-> recompute(CONFIDENCE)
-> regenerate(FLOW_HASH)
# ---------- FLOW HASH ----------
FLOW_HASH := hash(
SOURCE_URL
+ ENTITY
+ CONCEPTS
+ FINITE_ELEMENT
+ FINITE_ELEMENT_METHOD
+ MESH
+ BASIS_FUNCTION
+ WEAK_FORM
+ GALERKIN_METHOD
+ STIFFNESS_MATRIX
+ MASS_MATRIX
+ ASSEMBLY
+ BOUNDARY_CONDITION
+ SEMANTIC_EQUIVALENCE
+ CONSTRAINTS
)
# ---------- EXECUTION ----------
INPUT(query)
-> FINITE_ELEMENT
-> PDE_DOMAIN_IDENTIFICATION
-> WEAK_FORM_ANALYSIS
-> FUNCTION_SPACE_BOUNDARY_ANALYSIS
-> MESH_ELEMENT_ANALYSIS
-> BASIS_SHAPE_FUNCTION_ANALYSIS
-> REFERENCE_MAPPING_ANALYSIS
-> ELEMENT_MATRIX_COMPUTATION
-> GLOBAL_ASSEMBLY
-> BOUNDARY_IMPOSITION
-> ALGEBRAIC_SOLUTION
-> ERROR_ADAPTIVITY_ANALYSIS
-> MESH_QUADRATURE_VALIDATION
-> RECURSIVE_REASONING(query)
-> CONFIDENCE
-> OUTPUT(semantic_result)
END FLOW
Download Code
Copy to Clipboard