1 Introduction

Throughout engineering and physical sciences, field problems, arising from e.g. device design, are confronted. Apart from some exceptionally simple cases, such field problems cannot be solved analytically. Hence, in real modeling situations, they are solved numerically with a computer.Footnote 1 One cannot, however, represent the solution in a function space that is not finite-dimensional: Computers can only deal with a finite number of equations. Modelers, such as engineers and physicists, say that the problem has to be discretized. One of the most popular approximative numerical methods for discretizing and solving a field problem is the Galerkin finite element method (FEM) [3, 16, 18, 19].Footnote 2

In natural language, the word discrete refers to something separate and non-continuous.Footnote 3 Hence, discretization is intuitively related to transferring from continuum to a state of separation, while maintaining enough information to utilize it in the sub-sequent decision making. In FEM, this is done by taking the function space in which the solution of the field problem is known to reside and then finding a suitable finite-dimensional subspace for it, from which an approximative solution to the original problem can be found. This process is what is referred to as discretization of the field problem when utilizing FEM.

However, the term discrete object has also a very specific meaning in category theory, revealing something interesting about the structural properties of the object by relating the web of morphisms originating from it with a counterpart in another category (see section 8 in [1]). Discrete objects arise in conrete categories, which formalize the concept of mathematical structure (see section 5 in [1]). Concrete categories relate structured objects and morphisms to their underlying objects and morphisms with less structure, such as groups and group homomorphisms to their underlying sets and functions. A discrete object in a concrete category is then characterized by surjectivity between morphisms originating from an object and the morphisms originating from its less structured counterpart. Hence, a question arises: Can we relate discretization, as understood in FEM, to the concept of discreteness in category theory? That is, in which sense, if any, can we interpret discretization in FEM through category theoretical concepts, unifying it with the concept of discreteness in other fields of mathematics? By answering this question, we want to reveal what kind of structure is encoded in the term discretization on an abstract level.Footnote 4 Or more concretely, of what kind of abstract structure discretization is an instance.

Hence, in this paper, we propose a category theoretical interpretation of discretization in FEM. Moreover, building on our earlier work on decomposability of abstract processes in a monoidal category [14], we discuss the concept of decomposability of discretization within a concrete framework. In particular, we consider how the decomposability of the function spaces from which the solution is sought relates to the decomposability of discretization. This is linked to different potential formulations of field problems and to choosing a suitable combination of basis functions for the discretized problem. To keep things simple, we will only consider elliptic (time-independent) field problems, leaving hyperbolic and parabolic problems (time-dependent) outside our treatment.Footnote 5

With this paper, we offer insight to mathematically oriented engineers about the structural properties of discretization and approximative solution of field problems. On the other hand, we also hope to shed light on the mathematical side of engineering with application-oriented mathematicians in mind, building a bridge between engineering and different fields of mathematics through the interaction between category theory and numerical methods. We expect the reader to be familiar with basic differential geometry [10] and elementary category theory [1, 7]. In particular, a certain level of familiarity with exterior calculus of differential forms and the concepts of categories, objects, morphisms, functors and natural transformations is expected. For introductory category theory, we refer the reader to [1, 7]. A survey of necessary category theoretical prerequisites for this work can also be found in our recent article [14].

In Sect. 2, we discuss the foundations of FEM, and take the reader through the discretization process without explicitly referring to category theory. Then, in Sect. 3 we introduce the relevant category theory for our interpretation of discretization. In Sect. 4 we present discretization in FEM in the light of category theory and discuss its decomposability within this framework, giving also examples. Finally, conclusions are drawn in Sect. 5.

2 Functional analytic background for FEM

In this section, we go through the foundations of FEM. In particular, we introduce relevant Sobolev spaces of differential forms for FEM analysis. Moreover, we go through the basic steps of the discretization process. For a more detailed discussion of the correct spaces of differential forms for FEM, see e.g. [13].

2.1 The weighted residual formulation and the weak formulation

In the following, \(\varOmega \) is an n-dimensional bounded open subset of a Riemannian manifold with a boundary \(\partial \varOmega \) that is sufficiently regular.

Let us first recall the definition of a Hilbert space.

Definition 1

A Hilbert space \(\mathcal {H}\) is a vector space \(\mathcal {V}\), equipped with an inner product \(\langle \cdot , \cdot \rangle \), complete with respect to the norm \(\Vert \cdot \Vert \) induced by \(\langle \cdot , \cdot \rangle \).

The fundamental building block of FEM is the following theorem in Hilbert spaces [20]:

Theorem 1

\(\gamma \in \mathcal {H}, \quad \gamma = 0 \quad \Leftrightarrow \quad \langle \gamma , \gamma ' \rangle = 0, \quad \forall \gamma ' \in \mathcal {H}\),

which gives us the permission to utilize the inner product of \(\mathcal {H}\) to test whether an element of \(\mathcal {H}\) is zero. To utilize this theorem in the realm of differential forms, we need an inner product of differential p-forms. Hence, we define a global inner product of p-forms on \(\varOmega \) as

$$\begin{aligned} \langle \gamma , \gamma ' \rangle = \int _{\varOmega } \gamma \wedge \star \gamma ', \end{aligned}$$
(1)

where \(\star \) is the Hodge operator, taking p-forms on n-dimensional \(\varOmega \) to \(n-p\)-forms on \(\varOmega \) (see section 14 in [10]). The (completed)Footnote 6 space of piecewise smooth p-forms on \(\varOmega \) with the inner product (1) satisfying \(\langle \gamma , \gamma \rangle < \infty \) for all \(\gamma \) is denoted as \(L^2F_p(\varOmega )\).

What kind of Hilbert spaces are suitable for carrying out FEM analysis? \(L^2F_p(\varOmega )\) is a good candidate but not quite perfect. We need the following Sobolev spaces of differential forms:

$$\begin{aligned} L^2F_p(\tilde{\mathrm{d}}, \varOmega )= & {} \left\{ \gamma \in L^2F_p(\varOmega ) \quad | \quad \tilde{\mathrm{d}} \gamma \in L^2F_{p+1}(\varOmega )\right\} , \end{aligned}$$
(2)
$$\begin{aligned} L^2F_p(\tilde{\delta }, \varOmega )= & {} \left\{ \gamma \in L^2F_p(\varOmega ) \quad | \quad \tilde{\delta } \gamma \in L^2F_{p-1}(\varOmega )\right\} . \end{aligned}$$
(3)

In the above equations, \(\tilde{\mathrm{d}}\) is the weak exterior derivative defined as

$$\begin{aligned} \langle \tilde{\mathrm{d}} \gamma , \eta \rangle = \langle \gamma , (-1)^p \star ^{-1} \mathrm{d}\star \eta \rangle , \quad \forall \eta \in \mathcal {D}F_{p+1}(\varOmega ), \end{aligned}$$
(4)

where \(\mathrm{d}\) is the exterior derivative operator (see section 2 in [10]), and \(\tilde{\delta }\) is the weak co-derivative defined to satisfy

$$\begin{aligned} \langle \tilde{\delta } \gamma , \varpi \rangle = \langle \gamma , \mathrm{d}\varpi \rangle , \quad \forall \varpi \in \mathcal {D}F_{p-1}(\varOmega ). \end{aligned}$$
(5)

Note that in (4) the linear operator \(\delta := (-1)^p \star ^{-1} \mathrm{d}\star \) is the (strong) co-derivative operator, highlighting the duality between (4) and (5) and thus also that between (2) and (3). The symbols \(\mathcal {D}F_{p-1}(\varOmega )\) and \(\mathcal {D}F_{p+1}(\varOmega )\) denote the spaces of smooth \(p-1\)-forms and \(p+1\)-forms with supports in \(\varOmega \), respectively. Smooth p-forms see \(\mathrm{d}\) and \(\tilde{\mathrm{d}}\) as the same operator, as well as \(\delta \) and \(\tilde{\delta }\), but these operators differ for piecewise smooth forms. However, as is customary, we shall not make a notational difference between \(\mathrm{d}\) and \(\tilde{\mathrm{d}}\) nor between \(\delta \) and \(\tilde{\delta }\) in our following examples. Moreover, note that \(\star \) acts as an isomorphism between \(L^2F_p(\tilde{\mathrm{d}}, \varOmega )\) and \(L^2F_{n-p}(\tilde{\delta }, \varOmega )\).

So, in \(L^2F_p(\tilde{\mathrm{d}}, \varOmega )\) and \(L^2F_p(\tilde{\delta }, \varOmega )\) the p-forms and their weak exterior derivatives and weak co-derivatives, respectively, are piecewise smooth and square-integrable. The weakness of these operators is important for modeling physical phenomena: it enables us, for example, to have discontinuities at material boundaries. For instance in electromagnetics, it is necessary to allow normal or tangential jumps in the quantities across material boundaries.

Now it is time to put these pieces of puzzle together. How exactly do we utilize the spaces (2) and (3) and Theorem 1 in FEM? Consider an equation of the form

$$\begin{aligned} \mathrm {L}\alpha = \nu , \end{aligned}$$
(6)

where \(\mathrm {L}\) is a linear operator, \(\alpha \) is the unknown form and \(\nu \) is known. Now, supposing \(\mathrm {L}\alpha \) and \(\nu \) reside in \(L^2F_p(\tilde{\mathrm{d}}, \varOmega )\) we can equivalently state the problem as

$$\begin{aligned} \int _\varOmega (\mathrm {L}\alpha - \nu ) \wedge \star \gamma '= 0, \quad \forall \gamma ' \in L^2F_p(\tilde{\mathrm{d}}, \varOmega ), \end{aligned}$$
(7)

which translates to

$$\begin{aligned} \langle \mathrm {L}\alpha , \gamma ' \rangle = \langle \nu , \gamma ' \rangle , \quad \forall \gamma ' \in L^2F_p(\tilde{\mathrm{d}}, \varOmega ). \end{aligned}$$
(8)

Now, \(\star \gamma '\) is obviously in \(L^2F_{n-p}(\tilde{\delta }, \varOmega )\). Equation (8) is the weighted residual formulation of the problem, guaranteed to be equivalent to the strong form (6) by theorem 1. Then, the weak formulation of the problem is obtained by weakening the differentiability requirements through partial integration of the left-hand side, which gives us a coercive and bounded bilinear form \(a(\cdot ,\cdot )\) on \(L^2F_p(\tilde{\mathrm{d}}, \varOmega )\) and leads us to [3]

$$\begin{aligned} a(\alpha , \gamma ') = \langle \nu , \gamma ' \rangle , \quad \forall \gamma ' \in L^2F_p(\tilde{\mathrm{d}}, \varOmega ). \end{aligned}$$
(9)

Usually, in engineering jargon, we say that (6) is weighted with weighting functions \(\gamma '\). This workflow of forming the weak formulation will become more apparent in later examples.

2.2 Discretization of the problem: finding a finite-dimensional subspace

Solving for \(\alpha \) from (9) numerically with a computer is still a lost cause as \(L^2F_p(\tilde{\mathrm{d}}, \varOmega )\) is not finite-dimensional. Hence, the key idea in FEM is to find a finite-dimensional subspace of \(L^2F_p(\tilde{\mathrm{d}}, \varOmega )\) from which a suitable approximative solution can be found by solving a matrix equation of finite size. Let us now consider, how this is achieved.

First, a mesh is attached to \(\varOmega \) by dividing it to a finite number of disjoint polyhedra that cover together all of \(\varOmega \). Then, a set, or a few sets of basis functions are attached to the mesh, for example to the vertices, edges, faces or volumes of its polyhedra, and the unknown is approximated as a sum of the basis functions with unknown coefficients. The key is to define the basis functions so, that they form a basis (hence the name) for a subspace \(L^2W_p(\varOmega )\) of \(L^2F_p(\tilde{\mathrm{d}}, \varOmega )\). A typical choice of basis functions, especially e.g. in electromagnetic modeling, are Whitney p-forms [5].Footnote 7 Then the weighting functions in (9) are also replaced with the finite set of basis functions, yielding a finite set of linear equations, which can be solved.

FEM is particularly appealing, as the difference between the approximative solution sought from \(L^2W_p(\varOmega )\) and the exact solution is minimized. The error is orthogonal to \(L^2W_p(\varOmega )\): Given the approximative solution \(\alpha ^{*}\) of (8) and the exact \(\alpha \), it holds for all weighting functions \({w^{j}_p} \in L^2W_p(\varOmega )\) that (see p. 58 in [3])

$$\begin{aligned} a(\alpha - \alpha ^{*}, {w^{j}_p}) = a(\alpha , {w^{j}_p}) - a(\alpha ^{*}, {w^{j}_p}) = \langle \nu , {w^{j}_p} \rangle - \langle \nu , {w^{j}_p} \rangle = 0. \end{aligned}$$
(10)

This is called Galerkin orthogonality.Footnote 8

3 Category theoretical preliminaries

In this section, we introduce the category theoretical concepts necessary for our interpretation of discretizaton: concrete categories, subobjects and discrete objects. In particular, we will define the category of Hilbert spaces \(\mathbf{Hilb}\), made concrete over the category of vector spaces \(\mathbf{Vec}\). Moreover, we present the definition of monoidal structure on a category.

We shall use the following notational conventions. We denote the class of morphisms of a category \(\mathbf{A}\) as \(\mathrm {Mor}(\mathbf{A})\) and its class of objects as \(\mathrm {Obj}(\mathbf{A})\). Moreover, the hom-set of morphisms between objects A and B in \(\mathrm {Obj}(\mathbf{A})\) is denoted as \(\mathrm {hom}_\mathbf{A}(A,B)\). Existence of an isomorphism between objects A and B is denoted as \(A \sim B\).

3.1 Subobjects: generalizing subsets and subspaces

The intuitive picture of a subobject is that it can in some way be included within another one. That is, there has to exist an inclusion morphism of some kind, in addition to the object itself. In category theory, the role of an inclusion morphism is played by the concept of monomorphism. Monomorphisms can be seen as generalizations of injective functions: Indeed, in the category of sets, Set, with functions between sets as its morphisms, monomorphisms are precisely the injections.

Definition 2

A morphism \(f: A \rightarrow B\) is a monomorphism, if it is cancellable from the left with respect to composition. That is, for all morphisms \(g, h: A' \rightarrow A\), \(f \circ g = f \circ h \Rightarrow g = h\).

Having defined monomorphisms, we are ready to define subobjects, which generalize the notions of, e.g., subsets and subspaces.

Definition 3

A subobject of an object A is an equivalence class M of monomorphisms into A, where two monomorphisms \(m_1: A_1 \rightarrow A\) and \(m_2: A_2 \rightarrow A\) are equivalent iff there exists an isomorphism \(f: A_1 \rightarrow A_2\) such that \(m_1 = m_2 \circ f\).

Hence, for example in the case of Set, subobjects of a set S are in one-to-one correspondense with subsets of S: a subset \(A \subset S\) to S comes readily equipped with a canonical monomorphism, i.e. the inclusion map \(i: A \rightarrow S\). Moreover, any monomorphism \(m: B \rightarrow S\) factors uniquely through an inclusion. Thus, i provides a canonical representative for the class of monomorphisms in which m resides.

3.2 Concrete categories

The concept of concrete category is essential for our construction of discretization. Concrete categories reveal the structural aspects of their objects by letting us access, e.g., the sets or other less structured objects underlying the more structured ones. Specifically, as we will do here, we can connect Hilbert spaces with their underlying vector spaces in a formal manner.

First, recall that a functor \(U: \mathbf{A} \rightarrow \mathbf{X}\) is faithful provided that all its restrictions to hom-sets \(U: \mathrm {hom}_\mathbf{A}(A,B) \rightarrow \mathrm {hom}_\mathbf{X}(U(A),U(B))\) are injective.Footnote 9 Essentially, concrete categories can be viewed as faithful functors from a category to another.

Definition 4

A concrete category \(\mathbf{A}\) over \(\mathbf{X}\) is the pair \((\mathbf{A}, U)\), where \(U: \mathbf{A} \rightarrow \mathbf{X}\) is a faithful functor between categories \(\mathbf{A}\) and \(\mathbf{X}\).

As an example, the faithful functor of the concrete category of vector spaces over the category of sets \((\mathbf{Vec}, U: \mathbf{Vec} \rightarrow \mathbf{Set})\) sends each vector space to its underlying set and each linear transformation between vector spaces to its underlying function, thus forgetting the vector space structure. From here on, when it is clear from the context, we shall denote a concrete category simply as the functor \(U: \mathbf{A} \rightarrow \mathbf{X}\). Furthermore, given a concrete category \(U: \mathbf{A} \rightarrow \mathbf{X}\), the notational conventions

$$\begin{aligned} \mathrm {Obj}_U(\mathbf{X}) := \{ O \in \mathrm {Obj}(\mathbf{X}) \quad | \quad \exists o \in \mathrm {Obj}(\mathbf{A}): \quad U(o) = O \} \end{aligned}$$
(11)

and

$$\begin{aligned} \mathrm {Mor}_U(\mathbf{X}) := \{ H \in \mathrm {Mor}(\mathbf{X}) \quad | \quad \exists h \in \mathrm {Mor}(\mathbf{A}): \quad U(h) = H \} \end{aligned}$$
(12)

give us a handy way of referring to the objects or morphisms of \(\mathbf{X}\) that have a counterpart in \(\mathbf{A}\) via U.

The category theoretical concept that generalizes such notions as discrete topological spaces and discrete partial orders to arbitrary concrete categories, is that of a discrete object in a concrete category. In essence, discreteness of an object is related to surjectivity of morphisms under the faithful functor U of the concrete category.

Definition 5

Let \(U: \mathbf {A} \rightarrow X\) a concrete category. \(A \in \mathrm {Obj}(\mathbf{A})\) is discrete provided that \(\forall B \in \mathrm {Obj}(\mathbf{A}), \quad \forall f \in \mathrm {hom}_\mathbf{X}(U(A),U(B)): \quad f \in \mathrm {Mor}_U(\mathbf{X})\).

So, if we consider as an example the category of topological spaces with continuous mappings as its morphisms, made concrete over the category of sets, \(U: \mathbf{Top} \rightarrow \mathbf{Set}\), the discrete objects are precisely the discrete topological spaces. This can be easily seen. First, recall that any mapping between sets is a morphism in \(\mathbf{Set}\). Then, note that if \(T \in \mathrm {Obj(\mathbf{Top})}\) has discrete topology, every mapping from T is continuous, and if every map from T is continuous, its topology must be discrete.

A concrete category of special interest for us is \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\): the category of Hilbert spaces made concrete over the category of vector spaces. In Vec, the objects are vector spaces and morphisms are linear transformations between them. Furthermore, we take the objects of Hilb to be Hilbert spaces and bounded linear operators as its morphisms. Then, we clearly have the faithful forgetful functorFootnote 10U from Hilb to Vec, and thus the concrete category \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\). As we shall see, this concrete category provides the natural category theoretical framework for discretization in FEM.

3.3 Monoidal categories

To conveniently discuss parallel systems and processes, and for example, decompositions of function spaces, we need more structure than just a category. This structure is that of a monoidal product, which is in a sense a binary operator on a category \(\mathbf{C}\), mapping objects and morphisms from the Cartesian product category \(\mathbf{C} \times \mathbf{C}\) to \(\mathbf{C}\) itself.Footnote 11

Definition 6

A monoidal category consists of

  • a category \(\mathbf{C}\),

  • the monoidal product functor \(\otimes : \mathbf{C} \times \mathbf{C} \rightarrow \mathbf{C}\),

  • the unit object \(I \in \mathrm {Obj} (\mathbf{C})\),

  • the associator \(\alpha \), a natural isomorphism assigning an isomorphism \(\alpha _{A,B,C}:(A \otimes B) \otimes C \sim A \otimes (B \otimes C)\) to each \(A,B,C \in \mathrm {Obj} (\mathbf{C})\),

  • the left unitor \(\lambda \), a natural isomorphism assigning an isomorphism \(\lambda _A: I \otimes A \sim A\) to each \(A \in \mathrm {Obj} (\mathbf{C})\), and

  • the right unitor \(\rho \), a natural isomorphism assigning an isomorphism \(\rho _A: A \otimes I \sim A\) to each \(A \in \mathrm {Obj} (\mathbf{C})\),

such that the so-called triangle and pentagon equations hold. That is, the triangle

commutes for all \(A,B \in \mathrm {Obj} (\mathbf{C})\) and the pentagon

commutes for all \(A,B,C,D \in \mathrm {Obj} (\mathbf{C})\).

The definition looks a bit daunting but in fact it is not very complicated. The coherence conditions above merely ensure that different isomorphisms constructed using the unitor and the associators are all the same. The monoidal structure on a category allows us to link objects and morphisms together in parallel in an associative manner, resembling the multiplication operations occuring in a monoid. For example, taking the monoidal product of \(A \otimes B\) and C gives us an object isomorphic to the monoidal product of A and \(B \otimes C\), and taking the monoidal product of an object and the unit object gives an object isomorphic to the original. Note that these are isomorphisms, not necesarily equalities. A classic example is the category of sets and functions with the monoidal product given by the cartesian product of sets. There, \((A \times B) \times C \ne A \times (B \times C)\) but there clearly is an isomorphism between the two sets. This is where the associator is needed. For a comprehensive, physics-oriented introduction to monoidal categories, see [7].

4 Discretization in FEM: finding discrete subobjects

Now we have all the machinery to discuss FEM discretization and its decomposability in a category theoretical framework. In this section, we will give a category theoretical interpretation of discretization and discuss some examples from magnetostatics, elliptic equations arising from modeling magnetic fields caused by known source current (densities).

4.1 Interpreting discretization in \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\) equipped with monoidal structure

Consider the category Hilb with monoidal structure \(\oplus \) given by the direct sum of Hilbert spaces with the zero-dimensional space as its unit object. This turns Hilb into a monoidal category [7]. Moreover, let us make \(\mathbf{Hilb}\) concrete over \(\mathbf{Vec}\). That is, we have a monoidal category of Hilbert spaces, with the direct sum \(\oplus \) as the monoidal product, made concrete over \(\mathbf{Vec}\). For simplicity, we shall denote this concrete monoidal category merely as \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\). This category provides us with tools to formalize concepts related to FEM. In the following, note that by a discrete subobject we mean a subobject with discrete domains. Furthermore, note that monomorphisms in \(\mathbf{Hilb}\) are precisely the injective bounded linear operators.

As discussed in Sect. 2, discretization of a field problem means, in the context of FEM, finding a finite-dimensional subspace of a Hilbert space. Hence, when defining discretization, we would like to capture the intuition of it being an inclusion of a finite-dimensional subspace into a larger Hilbert space. However, let us first note the following theorem:

Theorem 2

An object \(\mathcal {H} \in \mathrm {Obj}(\mathbf{Hilb})\) is discrete with respect to \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\) if and only if it is finite-dimensional.

This can be seen as follows. Let \(\mathcal {H}\) be finite-dimensional. To see that \(\mathcal {H}\) is discrete with respect to \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\), note that every linear transformation with a finite-dimensional Hilbert space as its domain is bounded. Then, utilizing contraposition, let \(\mathcal {H}\) be infinite-dimensional. Then, there exists a linear mapping on \(\mathcal {H}\) that is not bounded, due to existence of orthonormal bases, assuming the axiom of choice. For details of the non-trivial arguments above, see e.g. [11, 20].

Subobjects of objects of \(\mathbf{Hilb}\) correspond precisely to their Hilbert subspaces [12]. A discretization, is thus a representative of a subobject of \(\mathcal {H}\) in \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\). Even though not every monomorphism in Hilb preserves the inner product, every subobject has a unique representative that does,Footnote 12 and in FEM, we want that (1) is preserved in such a mapping. An inner product preserving monomorphism in Hilb is called a dagger mono.Footnote 13 Hence, we define discretization as follows.

Definition 7

A discretization (of infinite-dimensional \(\mathcal {H}\)) is the unique dagger mono representative of a subobject of \(\mathcal {H}\), discrete with respect to \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\).

Hence, a discretization is a dagger mono from discrete \(\mathcal {H}_{\mathrm{s}}\) to \(\mathcal {H}\). One might have the urge to say that a discretization should be a morphism going the other way: Should it not take a Hilbert space to its discrete subspace? However, by closer inspection, we are interested in the relationships between the two objects and the two categories. These are best captured by a morphism from discrete \(\mathcal {H}_{\mathrm{s}}\) to \(\mathcal {H}\) and the functor U. This way, the existence of a discretization guarantees us that there exists an object which is, in a formal sense, a discrete version of another object, which is exactly the idea we want to capture. After the discretization, injective mapping of the discrete object \(\mathcal {H}_{\mathrm{s}}\) to \(\mathcal {H}\), everything in FEM will be done within \(\mathcal {H}_{\mathrm{s}}\). So, in order for a morphism in \(\mathrm {Mor}(\mathbf{Hilb})\) to represent a discretization, its domain \(\mathcal {H}_{\mathrm{s}}\) needs to be such an object that every morphism from its vector space counterpart in \(\mathbf{Vec}\) (via U) is also a morphism in \(\mathbf{Hilb}\) (discreteness), it must be injective (monomorphism), and it must preserve the inner product of its domain object (the dagger-property). So actually, when we say that the function space from which we seek the solution in FEM has been discretized, we mean that we have found a discrete subspace for it with respect to the underlying vector space structure, while keeping its metric properties intact. And abstractly, we are talking about a dagger mono from a discrete object in a dagger category.

So, the term discretization in FEM is justified in the concrete categorical point of view: the concept of finiteness corresponds with the concept of discreteness. Hence, discretization is finite-dimensionalization. Note, however, that meshing a non-compact manifold does not lead to a discrete Hilbert space in this sense, as one would then end up dealing with an infinite number of basis functions. So even though in some intuitive respect, forming such a mesh could be considered as a discretization of the space, it is not a discretization in the sense of finite element method. Thus, this concrete categorical point of view captures exactly the concept of discreteness in FEM.Footnote 14

On the other hand, through this framework we can also interpret discretization differently (yet equivalently) than simply as finite-dimensionalization: It is a process of forming such a vector subspace of the original function space, that equipping it with the necessary Hilbert structure does not affect how it relates to other spaces: There must not be linear mappings from the subspace that are not bounded. An intuitive picture in the concrete modeling setting thus is that meshing will guarantee the boundedness of all linear operators on the space. On the chosen abstraction level this becomes obvious, as it is emphasized in the definition of discretization.

We can also connect all this with our previous work on decomposability of processes. This is where monoidality comes into play. In certain cases, we might be able to find two parallel discretizations, which combined together yield a single discretization. The following definition is an instance of parallel decomposability of processes in the framework of an arbitrary monoidal category, discussed in [14].

Definition 8

A discretization \(m_{\mathrm{d}}: \mathcal {H}_{\mathrm{s}} \rightarrow \mathcal {H}\) is parallel decomposable if there exist objects \(\mathcal {H}_{\mathrm{s1}}\), \(\mathcal {H}_{\mathrm{s2}}\), \(\mathcal {H}_1\), \(\mathcal {H}_2\), such that \(\mathcal {H}_{\mathrm{s1}} \oplus \mathcal {H}_{\mathrm{s2}} \sim \mathcal {H}_{\mathrm{s}}\) and \(\mathcal {H}_1 \oplus \mathcal {H}_2 \sim \mathcal {H}\), and non-trivial discretizations \(m_1: \mathcal {H}_{\mathrm{s1}} \rightarrow \mathcal {H}_1\), \(m_2: \mathcal {H}_{\mathrm{s2}} \rightarrow \mathcal {H}_2\) such that the diagram

commutes.

As we shall see in the examples to follow, this decomposability is directly related to representing the quantities to be solved in terms of different types of basis functions, and thus, to different FEM formulations.

4.2 A case study in magnetostatics

In magnetostatics on three-dimensional \(\varOmega \), the magnetic field \(\{B,H\}\) is defined to satisfy

$$\begin{aligned} \mathrm{d}B = 0, \quad \mathrm{d}H = J, \quad B = (\mu \circ \star ) H := \mu _\star H, \end{aligned}$$
(13)

where the magnetic flux density B is a 2-form, the magnetic field intensity H is a 1-form, the current density J is a 2-form and \(\mu _\star \) is the permeability operator taking 1-forms to 2-forms, composed of the material specific part \(\mu \) and the metric-dependent Hodge operator \(\star \). Next, we will take a look at two different well-known formulations of (13) and their FEM discretizations through the eyes of our category theoretical framework. We will be brief, and not consider, e.g., gauging.

4.2.1 The A-formulation

A common way to formulate (13) is to use the magnetic vector potential A. Since \(\mathrm{d}B = 0\), there exists a 1-form A such that

$$\begin{aligned} \mathrm{d}A = B. \end{aligned}$$
(14)

This means, we can combine the equations in (13) and take the Hodge of the resulting equation to yield

$$\begin{aligned} \star \mathrm{d}{\mu _\star }^{-1} \mathrm{d}A = \star J. \end{aligned}$$
(15)

This is the strong form of the A-formulation of magnetostatics. Here, the linear operator in (6) is \(\star \mathrm{d}{\mu _\star }^{-1} \mathrm{d}\), the unkown \(\alpha \) is A and \(\star J\) corresponds to the source term \(\nu \), Then, the weighted residual formulation of (15) yields

$$\begin{aligned} \int _\varOmega \star \mathrm{d}{\mu _\star }^{-1} \mathrm{d}A \wedge \star A' = \int _\varOmega \star J \wedge \star A', \quad \forall A' \in L^2F_1(\tilde{\mathrm{d}}, \varOmega ), \end{aligned}$$
(16)

which is equivalentFootnote 15 to

$$\begin{aligned} \int _\varOmega \mathrm{d}{\mu _\star }^{-1} \mathrm{d}A \wedge A' = \int _\varOmega \star J \wedge \star A', \quad \forall A' \in L^2F_1(\tilde{\mathrm{d}}, \varOmega ). \end{aligned}$$
(17)

Now, through partial integration, the weak formulation reads

$$\begin{aligned} \int _\varOmega {\mu _\star }^{-1} \mathrm{d}A \wedge \mathrm{d}A' + \int _{\partial \varOmega } {\mu _\star }^{-1} \mathrm{d}A \wedge A' = \int _\varOmega \star J \wedge \star A', \quad \forall A' \in L^2F_1(\tilde{\mathrm{d}}, \varOmega ). \end{aligned}$$
(18)

Given a homogeneous Neumann boundary condition on \(\partial \varOmega \) (i.e. \({\mu _\star }^{-1} \mathrm{d}A = 0\)), the boundary integral has no contribution to (18), rendering the weak formulation to

$$\begin{aligned} a(A,A') := \int _\varOmega {\mu _\star }^{-1} \mathrm{d}A \wedge \mathrm{d}A' = \int _\varOmega \star J \wedge \star A' = \langle \star J, A' \rangle , \quad \forall A' \in L^2F_1(\tilde{\mathrm{d}}, \varOmega ). \end{aligned}$$
(19)

Now, to discretize the problem, we consider a simplicial mesh on \(\varOmega \); a finite number of tetrahedra covering all of our modeling domain. Then a suitable subspace \(L^2W_1(\varOmega )\) of \(L^2F_1(\tilde{\mathrm{d}}, \varOmega )\) is spanned by Whitney 1-forms attached to the edges of the mesh. The unknown A is approximated as a sum of these Whitney 1-forms and the weighting functions are replaced with them as well, to yield the finite-dimensional problem

$$\begin{aligned} a\left( \sum ^n_{i=1}{A_i{w^{i}_1}}, {w^{j}_1}\right) = \langle \star J , {w^{j}_1} \rangle , \quad \forall {w^{j}_1} \in L^2W_1(\varOmega ), \end{aligned}$$
(20)

where \(A_i\) are unknown real number coefficients to be solved for. The key here is the existence of a dagger mono \(m_{\mathrm{d}}: L^2W_1(\varOmega ) \rightarrow L^2F_1(\tilde{\mathrm{d}}, \varOmega )\) in \(\mathbf{Hilb}\), where \( L^2W_1(\varOmega )\) is discrete in \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\) due to its finite-dimensionality. That is, there exists a discretization \(m_{\mathrm{d}}: L^2W_1(\varOmega ) \rightarrow L^2F_1(\tilde{\mathrm{d}}, \varOmega )\), allowing us to approximate A as an element of \(L^2W_1(\varOmega )\) in an optimal manner due to Galerkin orthogonality.

4.2.2 Decomposability of discretization: the (T)–\(\phi \)\(\varPsi \)-formulation

In this example, we consider utilization of cohomology in FEM-based modeling of magnetostatics. We will see how the category theoretical framework reveals the conceptual simplicity behind it.

Consider \(\varOmega \) consisting of conducting \(\varOmega _{\mathrm{c}}\) and non-conducting \(\varOmega _{\mathrm{nc}}\), that do not overlap. \(\varOmega _{\mathrm{c}}\) consists of tunnels through \(\varOmega _{\mathrm{nc}}\). Formulating (13) in terms of H gives us the equation

$$\begin{aligned} \mathrm{d}\mu _\star H = 0 \end{aligned}$$
(21)

in \(\varOmega \) with

$$\begin{aligned} \mathrm{d}H = J, \end{aligned}$$
(22)

with prescribed J in \(\varOmega _{\mathrm{c}}\). Now, to solve H approximatively, we could try a monomorphism of the form \(m_{\mathrm{d}}: L^2W_1(\varOmega ) \rightarrow L^2F_1(\tilde{\mathrm{d}}, \varOmega )\) as a discretization, but it would not be directly of much use in forming the weak formulation for FEM as (21) is a 3-form equation. However, the Hodge decomposition (see p. 372 in [10]) guarantees us that

$$\begin{aligned} H = T + \mathrm{d}\phi + \varPsi \end{aligned}$$
(23)

where \(\phi \) is a 0-form, T is the co-derivative of a 2-form, and \(\varPsi \) is a 1-form representative from the 1-cohomology space of \(\varOmega \), \(H^1(\varOmega )\).Footnote 16 That is, in our monoidal category \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\), we can express \(L^2F_1(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}})\) as the monoidal product

$$\begin{aligned} L^2F_1(\tilde{\mathrm{d}}, \varOmega ) \sim L^2 \delta F_2(\tilde{\delta }, \varOmega ) \oplus L^2 \mathrm{d}F_0(\tilde{\mathrm{d}}, \varOmega ) \oplus H^1(\varOmega ), \end{aligned}$$
(24)

where \(L^2 \delta F_2(\tilde{\delta }, \varOmega _{\mathrm{nc}})\) and \(L^2 \mathrm{d}F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}})\) are the space of co-derivatives of 2-forms in \(L^2F_2(\tilde{\delta }, \varOmega _{\mathrm{nc}})\) and the space of exterior derivatives of 0-forms in \(L^2F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}})\), respectively. Similarly, the subspace

$$\begin{aligned} L^2W_1(\varOmega ) \sim L^2 \delta W_2(\varOmega ) \oplus L^2 \mathrm{d}W_0(\varOmega ) \oplus H^1(\varOmega ), \end{aligned}$$
(25)

where the factors of the monoidal product have similar roles as above, is Hodge decomposable [8]. Now, there exist discretizations \(m_1: L^2 \delta W_2(\varOmega ) \rightarrow L^2 \delta F_2(\tilde{\delta }, \varOmega )\) and \(m_2: L^2 \mathrm{d}W_0(\varOmega ) \oplus H^1(\varOmega ) \rightarrow L^2 \mathrm{d}F_0(\tilde{\mathrm{d}}, \varOmega ) \oplus H^1(\varOmega )\) and isomorphisms such that

commutes, thus giving us the possibility to utilize a discretization of the form \(m_1 \oplus m_2\).

Let us focus our interest only in the solution in \(\varOmega _{\mathrm{nc}}\). Our modeling domain is thus \(\varOmega _{\mathrm{nc}}\), which has k tunnels through it. A prescribed current flows in each of the tunnels. We can safely fix \(T=0\) in \(\varOmega _{\mathrm{nc}}\) as no currents flow there, so in that case the solution to (13) will lie in \(L^2 \mathrm{d}F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}}) \oplus H^1(\varOmega _{\mathrm{nc}})\). That is, in \(\varOmega _{\mathrm{nc}}\) we can focus our interest only on the discretization of the form \(m_2: L^2 \mathrm{d}W_0(\varOmega _{\mathrm{nc}}) \oplus H^1(\varOmega _{\mathrm{nc}}) \rightarrow L^2 \mathrm{d}F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}}) \oplus H^1(\varOmega _{\mathrm{nc}})\). Hence, there we can write \(H = \mathrm{d}\phi + \varPsi \), where \(\varPsi \) takes into account the currents flowing in \(\varOmega _{\mathrm{c}}\). This implies that we can approximate H in \(\varOmega _{\mathrm{nc}}\) in a FEM formulation as a sum of exterior derivatives of Whitney 0-forms attached to the nodes of the mesh and a representative of the 1-cohomology basis of \(\varOmega _{\mathrm{nc}}\). See Fig. 1 for clarification.

Fig. 1
figure 1

A demonstrative depiction of the 1-chains to which cohomology basis functions are related. In this figure, the modeling domain \(\varOmega = \varOmega _{\mathrm{c}} \cup \varOmega _{\mathrm{nc}}\) with \(\varOmega _{\mathrm{c}} = T_1 \cup T_2\) and \(\varOmega _{\mathrm{nc}} = \varOmega {\setminus } \varOmega _{\mathrm{c}}\). We represent H as \(\mathrm{d}\phi + \varPsi \) in \(\varOmega _{\mathrm{nc}}\). Thus, per each \(T_i\) we assign a cohomology basis function \(\varPsi _i\) to one such chain reaching from \(\partial \varOmega \) to \(\partial T_i\), and fix its degree of freedom so that \(\oint \varPsi \) over any cycle homologous to the dashed circle, that the chain crosses, is equal to the desired net current flowing in corresponding \(T_i\). This way the integrals of H over the dashed circles, or any cycles homologous to them, yield the desired net currents, as \(\oint _\varGamma \mathrm{d}\phi = 0\) for all cycles \(\varGamma \). See e.g. [17] for more information on how to compute and utilize these basis functions in a FEM setting

Let us derive this FEM formulation. So, in \(\varOmega _{\mathrm{nc}}\), we can take the Hodge of (21) and write

$$\begin{aligned} \star \mathrm{d}\mu _\star (\mathrm{d}\phi + \varPsi ) = 0 \end{aligned}$$
(26)

with prescribed \(\varPsi \). Its weighted residual formulation is then

$$\begin{aligned} \int _{\varOmega _{\mathrm{nc}}} \star {\mathrm{d}\mu _\star (\mathrm{d}\phi + \varPsi )} \wedge \star \phi ' = 0, \quad \forall \phi ' \in L^2 F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}}). \end{aligned}$$
(27)

Separating \(\phi \) and \(\varPsi \) into integrals of their own, we obtain

$$\begin{aligned} -\int _{\varOmega _{\mathrm{nc}}} \star {\mathrm{d}\mu _\star \mathrm{d}\phi } \wedge \star \phi ' = \int _{\varOmega _{\mathrm{nc}}} \star {\mathrm{d}\mu _\star \varPsi } \wedge \star \phi ', \quad \forall \phi ' \in L^2 F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}}), \end{aligned}$$
(28)

which is equivalent to

$$\begin{aligned} -\int _{\varOmega _{\mathrm{nc}}} {\mathrm{d}\mu _\star \mathrm{d}\phi } \wedge \phi ' = \int _{\varOmega _{\mathrm{nc}}} \star {\mathrm{d}B_\varPsi } \wedge \star \phi ', \quad \forall \phi ' \in L^2 F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}}), \end{aligned}$$
(29)

where we have denoted \(B_\varPsi := \mu _\star \varPsi \). Partial integration of the left-hand side yields the weak formulation

$$\begin{aligned} -\int _{\varOmega _{\mathrm{nc}}} \mu _\star \mathrm{d}\phi \wedge \mathrm{d}\phi ' - \int _{\partial \varOmega _{\mathrm{nc}}} \mu _\star \mathrm{d}\phi \wedge \phi ' = \left\langle \star \mathrm{d}B_\varPsi , \phi ' \right\rangle , \quad \forall \phi ' \in L^2 F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}}). \end{aligned}$$
(30)

With suitable boundary conditions, we thus obtain

$$\begin{aligned} a(\phi , \phi ') := -\int _{\varOmega _{\mathrm{nc}}} \mu _\star \mathrm{d}\phi \wedge \mathrm{d}\phi ' = \left\langle \star \mathrm{d}B_\varPsi , \phi ' \right\rangle , \quad \forall \phi ' \in L^2 F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}}), \end{aligned}$$
(31)

where again, the left-hand side is a bounded and coercive bilinear form. Now, exploiting the discretization \(m_2: L^2 \mathrm{d}W_0(\varOmega _{\mathrm{nc}}) \oplus H^1(\varOmega _{\mathrm{nc}}) \rightarrow L^2 \mathrm{d}F_0(\tilde{\mathrm{d}}, \varOmega _{\mathrm{nc}}) \oplus H^1(\varOmega _{\mathrm{nc}})\), where \(W_0(\varOmega _{\mathrm{nc}})\) is spanned by Whitney 0-forms attached to the nodes of a simplicial mesh on \(\varOmega \), we can write an equation for the unknowns \(\phi _i \in \mathbb {R}\):

$$\begin{aligned} a\left( \sum ^n_{i=1}{\phi _i{w^{i}_0}}, {w^{j}_0}\right) = \left\langle \star \mathrm{d}B_\varPsi , {w^{j}_0} \right\rangle , \quad \forall {w^{j}_0} \in L^2W_0(\varOmega _{\mathrm{nc}}), \end{aligned}$$
(32)

with \(\varPsi = \sum ^{k}_{i=1} I_i \varPsi _i\), \(I_i \in \mathbb {R}\), prescribing currents through the k holes in \(\varOmega _{\mathrm{nc}}\) and \(\varPsi _i\) being a basis for \(H^1(\varOmega _{\mathrm{nc}})\).

This example connects the choice of basis functions in FEM to parallel decomposability of discretization: If a discretization of, e.g., space of p-forms is parallel decomposable in the concrete monoidal category \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\), we do not necessarily need to approximate the unknown we are searching from that space using merely p-form basis functions, but we might be able to recognize a different basis. This obtains a formal, structural context through the monoidal categorical point of view we have taken here. It is an instance of the abstract notion of parallel decomposability of morphisms in a monoidal category.

5 Conclusions and outlook

We have shown that discretization in FEM is a dagger mono with a discrete domain in a monoidal concrete category \(U: \mathbf{Hilb} \rightarrow \mathbf{Vec}\), with its monoidal product given by the direct sum \(\oplus \). Not only does this reveal the structural properties of discretization within the category, as how certain objects need to be related, but also between the relevant categories \(\mathbf{Hilb}\) and \(\mathbf{Vec}\). Even though our discussion was carried out in this specific concrete category, this interpretation highlights the abstract structure encoded in FEM discretization. Analyzing discretization in this context offers insight to the background of different potential formulations of field problems and allowable choices of basis functions for FEM. The existence of dagger monos in \(\mathbf{Hilb}\) is crucial for the existence of FEM, and the abstract notion of parallel decomposability of processes in a monoidal category translates into the possibility of formulating FEM problems using several basis functions. These results were discussed in the context of elliptic problems arising from magnetostatics. Moreover, discretization in FEM obtains a formal, unified meaning through this monoidal categorical point of view: Discreteness in FEM is the same concept as discreteness in, e.g., topology, on an abstract level. In the concrete modeling setting, this translates to finite-dimensionalization through meshing and ensures the boundedness of linear operators.

The recognition of the category theoretical interpretation of FEM discretization can yield us theoretical advancements in terms of generalization as well as direct practical benefits in, for example, search and recognition of different ways of finding approximative solutions to field problems. The structural properties of FEM discretization revealed here may transfer readily to other approximative solution methods too, such as spectral methods [4], finite volume methods [9] and finite difference methods [15], all of which utilize discretizations in some form. Moreover, this interpretation suggests that (monoidal) dagger categories are of interest in the foundational analysis of such methods.