1 Introduction

Beams and trusses are components of many engineering structures. Thus, many analytical and numerical simulation schemes were developed over the last century that can predict the displacements, deflections and normal, shear forces and bending moments in these structural members. Classical truss and beam models are described in any textbook on engineering mechanics, see, e.g., [6] and [4]. These models are based on kinematical assumptions which relate for beams to the names of Euler and Bernoulli for beams neglecting shear deformation. Equilibrium, kinematical relations and linear elastic behavior lead in the case of trusses to second-order ordinary differential equations and for beams to fourth-order ordinary differential equations in case of statics.

For the trusses, it is possible to use \(C^0\)-continuous ansatz spaces that classically can be formulated in a finite element environment using the isoparametric concept. The Euler–Bernoulli theory requires for beams \(C^1\)-continuous ansatz functions which, for a finite element formulation, is easily available using Hermite polynomials, see, e.g., [8, 16] and [12]. Thus, a virtual element formulation for trusses and beams does not necessarily provide any advantages. However, based on the virtual element method beam and truss elements of any order can be formulated easily as shown in Sects. 2.3 and 3.2. These higher-order elements provide better approximations of the deflections and stress resultants within the elements. An extension of the Euler–Bernoulli beam elements is provided by the Kirchhoff–Love theory for plate. Different formulations have already been discussed in [3, 5, 11] and [15] in this context .

The developed virtual truss and beam elements only introduce displacements, deflections and rotations as nodal unknowns at the end of the elements, even for higher-order ansatz spaces where additional unknowns have to be introduced, but these are only internal variables that are not attached to any node. Thus, the virtual elements can be easily incorporated in finite element software. Based on simple examples, it can be concluded that these structural virtual element are accurate and provide analytical solutions, for the kinematical variables and the stress resultants depending on the order of the ansatz.

An extension of the formulation to nonlinear problems in structural mechanics can be constructed in a straightforward way using the approaches derived for the linear problems. The related formulation is shown at the end of this contribution for different orders of ansatz functions.

2 Virtual element formulation of trusses

The truss or bar depicted in Fig. 1 can be modeled for constant cross section A

Fig. 1
figure 1

Simple bar problem, geometry, data and discretization

by the ordinary differential equation

$$\begin{aligned} EA \,u''(x) = -f(x) \end{aligned}$$
(1)

where u(x) is the longitudinal displacement of the bar, EA the stiffness, f(x) the loading along the bar and x the coordinate. This differential equation can be recast in its weak form leading to

$$\begin{aligned} \int \limits _0^l EA \,u'(x) \,\eta '(x) \text{ d } x -\int \limits _0^l f(x) \,\eta (x) \text{ d } x =0 \,. \end{aligned}$$
(2)

Equivalently a potential can be formulated

$$\begin{aligned} \frac{1}{2} \int \limits _0^l EA [u'(x)]^2 \text{ d } x - \int \limits _0^l f(x)\,u(x) \text{ d } x \longrightarrow MIN\,. \end{aligned}$$
(3)

To solve the bar problem (1) with a discretization scheme, the bar of length l will be subdivided in \(n_e\) elements of length \(l_e\) such that \(\sum _{i=1}^{n_e} l_e =l\), see Fig. 1. Either the weak form (2) or the potential (3) can be starting point for a discretization scheme.

In this simple example, for a linear ansatz, the finite element and the virtual element method yield the same matrices and hence produce the same results.

However, the methodology for deriving virtual elements is different from the finite element method. Mathematical details can be found, e.g., in [2] for solids in elasticity. It is based on the following ingredients:

  • An ansatz space in which the displacements are known at the nodal points i and \(i+1\). see Fig. 1, and at the element edges (which actually do not exist in our case of one-dimensional problems).

  • The approximation \(u_h\) is not known within the domain of the element \(l_e\).

  • A projection \(\Pi [u_h]\) of the ansatz space \(u_h\) onto a polynomial space of order n will be used to formulate the virtual element. This leads to the approximation \(u_h= \Pi [u_h]+ (u_h-\Pi [u_h])\) where the last term is a remainder.

This ansatz space is totally different from the finite element method, see below, where the ansatz for the displacement field is defined in the entire domain \(l_e\) of the element.

The question is now: how can we derive an ansatz for the displacement field? The idea is to compute the projection \(\Pi (u_h)\) of the displacement \(u_h\) from the two conditions for the first derivative (gradient) and the average of the displacements related to \(u_h\) and \(\Pi [u_h]\)

$$\begin{aligned} \int _0^{l_e} p' (u'_\pi -u'_h) \,\text{ d }x = 0 \qquad \text{ and } \,\,\, \int _0^{l_e} (u_\pi -u_h) \,\text{ d }x = 0 \end{aligned}$$
(4)

Here, to shorten notation, the projected part is defined by \(u_\pi = \Pi [u_h]\). The weighting function p in the first equation has the same polynomial order as the projection \(u_\pi \).

2.1 Finite element method for trusses

Here the ansatz functions are classically defined on the basis of an isoparametric mapping such that for an element \(\Omega _e\) a linear ansatz is defined in a reference space \(-1 \le \xi \le 1\), see Fig. 2,

$$\begin{aligned} u_h(\xi ) = \sum _{k=1}^2 N_k(\xi ) u_k \quad \text{ with } \,\, N_1= \frac{1}{2} ( 1-\xi ) \,\, \text{ and } \,\, N_2 = \frac{1}{2} ( 1+\xi ) \,. \end{aligned}$$
(5)
Fig. 2
figure 2

Element in initial and reference configuration

This ansatz approximates the displacement field in the element \(\Omega _e\) and thus can be inserted, e.g., in (3) for all \(n_e\) elements leading to

$$\begin{aligned} \mathop {\mathop {{\mathbf{A}}}\limits _{{e=1}}^{n_{e}}} \left[ \frac{1}{2} \int \limits _{-1}^1 EA\, [u'_h(\xi )]^2 \,J_e\, \text{ d } \xi - \int \limits _{-1}^1 f(\xi )\,u_h(\xi ) \,J_e \,\text{ d } \xi \,\right] \longrightarrow MIN \end{aligned}$$
(6)

where \(J_e\) is the Jacobian of the isoparametric mapping \(J_e= \frac{\text{ d } x}{\text{ d } \xi } = \frac{l_e}{2}\). Both integrals can be evaluated using numerical integration. In the special case of the bar problem, the first integral is with

$$\begin{aligned} u_h'(\xi ) = \frac{\text{ d } u_h(\xi )}{\text{ d } x} = \frac{\text{ d } u_h(\xi )}{\text{ d } \xi } \frac{\text{ d } \xi }{\text{ d } x} = \frac{\text{ d } u_h(\xi )}{\text{ d } \xi } \frac{2}{l_e} = \frac{u_2-u_1}{l_e} \end{aligned}$$
(7)

simply given by the constant term for an element e

$$\begin{aligned} U_e(u_i)=\frac{1}{2} \int \limits _{-1}^1 EA\, [u'_h(\xi )]^2 \,J_e\, \text{ d } \xi = \frac{EA}{2} \,\left[ \frac{u_2-u_1}{l_e}\right] ^2 \,l_e\,. \end{aligned}$$
(8)

By introducing the unknown vector \({\mathbf {u}}_e= \langle u_1 \,, u_2 \rangle ^T\), the term in the square bracket can be written as \((u_2-u_1)/l_e = \frac{1}{l_e} \langle -1\,,1 \rangle {\mathbf {u}}_e = {\mathbf {B}}\, {\mathbf {u}}_e \) which yields the matrix form of (8)

$$\begin{aligned} U_e({\mathbf {u}}_e)=\frac{1}{2} \int \limits _{-1}^1 EA\, [u'_h(\xi )]^2 \,J_e\, \text{ d } \xi = \frac{EA}{2} \, {\mathbf {u}}_e^T {\mathbf {B}}^T {\mathbf {B}} \,{\mathbf {u}}_e \,l_e \end{aligned}$$
(9)

and the element stiffness matrix

$$\begin{aligned} {\mathbf {K}}^{FEM} = \frac{\partial ^2 U_e({\mathbf {u}}_e)}{\partial {\mathbf {u}}_e \partial {\mathbf {u}}_e} = \frac{EA}{l_e} \begin{bmatrix} 1 &{} -1 \\ -1 &{} 1 \end{bmatrix}\,. \end{aligned}$$
(10)

The second integral in (6) which relates to the potential of the distributed load f can be evaluated at element level using numerical integration, like the Gauss quadrature. The number of integration point depends then on the polynomial degree of \(f(\xi )\), taking into account that \(u(\xi )\) is a linear function.

2.2 Virtual element method with linear ansatz

In the standard isoparametric formulation used in the finite element method, an additional coordinate system is employed in the reference configuration, see (5). On the contrary, the virtual element method is formulated directly with respect to the coordinate system in the initial configuration.

With a linear ansatz \(u_\pi = a_1 + a_2 x\), one can compute the gradient of the projected part, here the derivative \(u'_\pi =a_2\), from the orthogonality condition (4)\(_1\) within an element

$$\begin{aligned} \int \limits _0^{l_e} p'\,(\,u'_h-u'_\pi ) \, \text{ d } x =0 \rightarrow \int \limits _0^{l_e} p'\,u'_\pi \, \text{ d } x= \int \limits _0^{l_e} p'\,u'_h \, \text{ d } x \end{aligned}$$
(11)

where p is a weighting function that has the same polynomial degree as the ansatz \(u_\pi \). Since \(u_h\) is not known within the element, the integral on the right side of (11) cannot be computed. However, based on the identity \((p'\,u_h)'= p'\,u'_h + p''\,u_h\) (11) can be reformulated

$$\begin{aligned} \int \limits _0^{l_e} p'\,u'_\pi \, \text{ d } x= \left. (p'\,u_h)\right| _0^{l_e} - \int \limits _0^{l_e} p''\,u_h \, \text{ d } x\,. \end{aligned}$$
(12)

For the chosen linear ansatz \(p'\) is constant as well as \(u'_\pi \), it follows that \(p''=0\). With \(u_h(0)= u_1\) and \(u_h(l_e)=u_2\), see Fig. 2, we obtain the projected gradient from (12)

$$\begin{aligned} a_2=u'_\pi = \frac{u_2-u_1}{l_e} \end{aligned}$$
(13)

which is now a function of the nodal displacements \(u_1\) and \(u_2\).

Thus, it is possible to compute the gradient \(u'_\pi \) without knowing the function \(u_h\) inside the element \(\Omega _e\). In this simple case, the result \(u'_\pi \) matches exactly \(u'_h\) provided by the finite element method and hence the remainder is zero: \(u'_h-u'_\pi =0\). But in general the results are different, see e.g. [2]. Finally, \(u'_\pi \) can be inserted in (3) which provides the same result as given in (8). Thus, also the stiffness matrix of the virtual element \({\mathbf {K}}^{VEM}\) is exactly the same as \({\mathbf {K}}^{FEM}\) in (10).

A problem is now to compute the loading term in (3) since \(u_h\) is not known inside the element. A possibility is to compute an approximation of \(u_h\) by the projected displacement \(u_\pi \) using the linear ansatz. Mathematically, it can be shown that this approximation of \(u_h\) by \(u_\pi \) in the loading term will result in optimal error estimates, see, e.g., [1].

The complete projection \(u_\pi \) follows from (4)\(_2\) where the average displacement \(u_\pi \) is equal to the average displacement \(u_h\). Instead of evaluating the integrals, a sum of the values at the vertices of the element is employed. This yields for the two nodes of the bar element with \(x_1=0\) and \(x_2=l_e\)

$$\begin{aligned} \sum _{n=1}^2 u_\pi (x_n) = \sum _{n=1}^2 u_h(x_n) \rightarrow a_1+ (a_1+a_2 l_e) = u_1+u_2 \end{aligned}$$
(14)

and together with (13) we obtain \(a_1 = u_1\). Thus, \(u_\pi = u_1 + \frac{u_2-u_1}{l_e} x\). This function can be used to evaluate the integral associated with the loading potential in (3). As an example, we compute the potential energy \(U_e^f\) of the loading term for \(f(x)=f_c=const.\)

$$\begin{aligned} U_e^f=\int \limits _{0}^{l_e} f_c\,u_\pi (x) \,\text{ d } x = f_c\int \limits _{0}^{l_e} (u_1 + \frac{u_2-u_1}{l_e} x) \,\text{ d } x = \frac{ f_c \,l_e}{2} (u_1+u_2) \end{aligned}$$
(15)

which yields with the definition \( {\mathbf {u}}_e= \langle u_1\,,u_2 \rangle ^T\) the matrix form

$$\begin{aligned} {\mathbf {f}} = \frac{\partial U_e^f }{\partial {\mathbf {u}}_e} = \frac{ f_c \,l_e}{2} \begin{Bmatrix} 1 \\ 1 \end{Bmatrix} \,. \end{aligned}$$
(16)

This loading term is exactly the same as the one for the finite element formulation in (6). Thus, so far the virtual element formulation produces equivalent results as the FEM. This will, however, change for higher-order ansatz functions.

2.3 Quadratic ansatz for a one-dimensional virtual truss element

The simplest possible higher-order ansatz function that can be used to derive a virtual truss element is provided by a quadratic ansatz for the problem \(EA u''(x) = -f(x)\), see Fig. 2.

Analogous to the case of the linear ansatz, we select a quadratic function (ansatz order \(n=2\)) for the projection

$$\begin{aligned} u_\pi = a_1 + a_2\,x + a_3 \,x^2\,. \end{aligned}$$
(17)

This projection function has three unknown parameters and the question is: how will it be possible to derive a virtual element since we have only two points at the edges of the element with nodal displacements \(u_2\) and \(u_1\)?

The solution follows from a closer look at the Galerkin projection (12)

$$\begin{aligned} \int \limits _0^{l_e} p'\,u'_\pi \, \text{ d } x= \left. (p'\,u_h)\right| _0^{l_e} - \int \limits _0^{l_e} p''\,u_h \, \text{ d } x \end{aligned}$$
(18)

where now p has the same polynomial degree as (17) and thus is a quadratic polynomial with \(p''=const.\) Hence the last integral \(\int \,u_h \, \text{ d } x \) on the right-hand side does not vanish. But it is also not computable since \(u_h\) is not known inside the element. The way out is to define a new (internal) variable. This variable is not associated with any node and is called moment in the virtual element literature since for higher-order ansatz functions \((n \ge 2)\) integrals \(\int x ^{n-2}\,u_h \, \text{ d } x\) up to the order \(n-2\) appear. These can be associated with moments in mechanics. Here we introduce

$$\begin{aligned} m_0 = \frac{1}{l_e}\int _0^{l_e} \,u_h \, \text{ d } x \end{aligned}$$
(19)

which is scaled by the element length such that \(m_0\) has the same dimensions as \(u_1\) and \(u_2\). With this new variable the projection in (18) is computable, as we will see next.

It is convenient to introduce a matrix formulation in order to shorten notation. This leads to the derivative of \(u_\pi \)

$$\begin{aligned} u'_\pi = a_2 + 2 a_3 \,x = \langle \begin{matrix} 1&2x \end{matrix} \rangle \left\{ \begin{matrix} a_2 \\ a_3 \end{matrix} \right\} \,. \end{aligned}$$
(20)

With the matrix form \(p' = \langle \begin{matrix} 1&2x \end{matrix} \rangle ^T \), the left-hand side of (18) yields

$$\begin{aligned} \int \limits _0^{l_e} p'\,u'_\pi \, \text{ d } x = \int \limits _0^{l_e} \left\{ \begin{matrix} 1 \\ 2x \end{matrix} \right\} \langle \begin{matrix} 1&2x \end{matrix} \rangle \, \text{ d } x \left\{ \begin{matrix} a_2 \\ a_3 \end{matrix} \right\} = \int \limits _0^{l_e} \begin{bmatrix} 1 &{} 2x \\ 2x &{} 4 x^2 \end{bmatrix} \, \text{ d } x \left\{ \begin{matrix} a_2 \\ a_3 \end{matrix} \right\} \,. \end{aligned}$$
(21)

The polynomials can be integrated exactly leading to

$$\begin{aligned} \int \limits _0^{l_e} p'\,u'_\pi \, \text{ d } x = \begin{bmatrix} l_e &{} l_e^2 \\ l_e^2 &{} \frac{4}{3} l_e^3 \end{bmatrix} \left\{ \begin{matrix} a_2 \\ a_3 \end{matrix} \right\} ={\mathbf {G}}\,{\mathbf {a}} \end{aligned}$$
(22)

The right-hand side in (18) can be evaluated with \(p''= \langle \begin{matrix} 0&2 \end{matrix} \rangle ^T \) resulting in

$$\begin{aligned} \left. (p'\,u_h)\right| _0^{l_e} - \int \limits _0^{l_e} p''\,u_h \, \text{ d } x= \left[ \left\{ \begin{matrix} 1 \\ 2x \end{matrix} \right\} u_h \right] _0^{l_e} - \left\{ \begin{matrix} 0 \\ 2 \end{matrix} \right\} \int \limits _0^{l_e} u_h \, \text{ d } x \end{aligned}$$
(23)

With the unknown defined in (19), the right-hand side of (18) follows as

$$\begin{aligned} \left. (p'\,u_h)\right| _0^{l_e} - \int \limits _0^{l_e} p''\,u_h \, \text{ d } x= \left\{ \begin{matrix} u_2-u_1 \\ 2 \,l_e u_2\end{matrix} \right\} - \left\{ \begin{matrix} 0 \\ 2 \,l_e m_0\end{matrix} \right\} = {\mathbf {r}}(u_i,m_0) \end{aligned}$$
(24)

The projection Eq. (18) can now be solved for the unknowns \({\mathbf {a}}\) by combining (22) and (23)

$$\begin{aligned} {\mathbf {G}}\,{\mathbf {a}}= {\mathbf {r}}(u_i,m_0) \rightarrow \left\{ \begin{matrix} a_2 \\ a_3 \end{matrix} \right\} = \left\{ \begin{matrix} -\frac{2}{l_e} (2 u_1+u_2- 3 m_0) \\ \frac{3}{l_e^2} (u_1+u_2-2 m_0)\end{matrix} \right\} \,. \end{aligned}$$
(25)

Furthermore, the constant \(a_1\) can be obtained by the condition that the average of the projection \(u_\pi \) is equal to the average of the ansatz \(u_h\) over the element

$$\begin{aligned} \int \limits _0^{l_e} u_\pi \text{ d } x = \int \limits _0^{l_e} u_h \text{ d } x \,. \end{aligned}$$
(26)

This leads with the definition of the unknown \(m_0\), the ansatz (17) and (25) after some algebra to

$$\begin{aligned} a_1 l_e + \frac{1}{2} a_2\,l_e^2 + \frac{1}{3} a_3\,l_e^3 = l_e\,m_0 \quad \rightarrow a_1=u_1 \end{aligned}$$
(27)

Equations (25) and (27) determine the projection and its first derivative in terms of the unknowns \(u_1\,,u_2\) and \(m_0\)

$$\begin{aligned} u_\pi = \langle \begin{matrix} 1&x&x^2 \end{matrix} \rangle \left\{ \begin{matrix} u_1 \\ -\frac{2}{l_e} (2 u_1+u_2- 3 m_0) \\ \frac{3}{l_e^2} (u_1+u_2-2 m_0)\ \end{matrix} \right\} \quad \text{ and } \,\, u'_\pi = \langle \begin{matrix} 1&2 x \end{matrix} \rangle \left\{ \begin{matrix} -\frac{2}{l_e} (2 u_1+u_2- 3 m_0) \\ \frac{3}{l_e^2} (u_1+u_2-2 m_0)\ \end{matrix} \right\} \end{aligned}$$
(28)

This result can be written in a more compact matrix form by introducing the matrices

$$\begin{aligned} {\mathbf {N}}^{(2)}_\pi (x) = \langle \begin{matrix} 1&x&x^2 \end{matrix} \rangle \quad \text{ and } \,\, \nabla {\mathbf {N}}^{(2)}_\pi (x) = \langle \begin{matrix} 1&2x \end{matrix} \rangle \end{aligned}$$
(29)

together with the unknown vector \(\widehat{{\mathbf {u}}}_e=\langle u_1\,,u_2\,,m_0 \rangle ^T\) and the projection operators

$$\begin{aligned} {\mathbb {P}}^{(2)} =\frac{1}{l_e^2} \begin{bmatrix} l_e^2 &{}0&{}0\\ -4 l_e&{} -2 l_e &{} 6 l_e \\ 3&{}3&{}-6 \end{bmatrix} \quad \text{ and } \,\, {\mathbb {B}}^{(2)} =\frac{1}{l_e^2} \begin{bmatrix} -4 l_e&{} -2 l_e &{} 6 l_e \\ 3&{}3&{}-6 \end{bmatrix}, \end{aligned}$$
(30)

leading to

$$\begin{aligned} u_\pi = {\mathbf {N}}^{(2)}_\pi (x)\, {\mathbb {P}}^{(2)} \,\widehat{{\mathbf {u}}}_e \quad \text{ and } \,\, u'_\pi = \nabla {\mathbf {N}}^{(2)}_\pi (x) \, {\mathbb {B}}^{(2)} \,\widehat{{\mathbf {u}}}_e\,. \end{aligned}$$
(31)

The derivative \(u'_\pi \) from (31) can now be inserted into the potential energy and integrated using the result from (22)

$$\begin{aligned} \begin{aligned} U_e= \frac{1}{2} \int \limits _0^{l_e}\! EA\,(u'_\pi )^2 \, \text{ d } x&=\frac{1}{2} \widehat{{\mathbf {u}}}_e^T [{\mathbb {B}}^{(2)}] ^T \!\!\int \limits _0^{l_e}\! [\nabla {\mathbf {N}}^{(2)}_\pi (x)]^T \nabla {\mathbf {N}}^{(2)}_\pi (x) \, \text{ d } x \,{\mathbb {B}}^{(2)} \,\widehat{{\mathbf {u}}}_e \\&= \frac{1}{2}\widehat{{\mathbf {u}}}_e^T [{\mathbb {B}}^{(2)}] ^T {\mathbf {G}}\, {\mathbb {B}}^{(2)} \,\widehat{{\mathbf {u}}}_e \,. \end{aligned} \end{aligned}$$
(32)

Now the stiffness matrix of the virtual truss (T) element follows by differentiation with respect to \(\widehat{{\mathbf {u}}}_e\) as

$$\begin{aligned} {\mathbf {K}}^{T,V}= \frac{\partial ^2 U_e}{\partial \widehat{{\mathbf {u}}}_e\partial \widehat{{\mathbf {u}}}_e}= [{\mathbb {B}}^{(2)}] ^T {\mathbf {G}}\, {\mathbb {B}}^{(2)} = \frac{2 \,EA}{l_e} \begin{bmatrix} 2 &{} 1 &{} -3 \\ 1 &{} 2 &{} -3 \\ -3&{} -3 &{} 6 \end{bmatrix} \end{aligned}$$
(33)

It is interesting to note that the VEM stiffness matrix is not equivalent to the FEM matrix for a quadratic element which can be computed from the potential (6) using the quadratic ansatz \(u_h^{F}= \sum _{I=1}^3 N_I(\xi ) u_i\) with \(N_1(\xi )=\frac{1}{2} \xi (1-\xi )\), \(N_2(x) = \frac{1}{2} \xi (1+\xi )\) and \(N_3=(1-\xi ^2)\) with the reference space \(-1\le \xi \le 1\) and the procedure in Sect. 2.1

$$\begin{aligned} {\mathbf {K}}^{T,F}= \frac{2 \,EA}{l_e} \begin{bmatrix} \frac{7}{6} &{} \frac{1}{6} &{} -\frac{4}{3} \\ \frac{1}{6} &{} \frac{7}{6} &{} -\frac{4}{3} \\ -\frac{4}{3}&{} -\frac{4}{3} &{} \frac{8}{3} \end{bmatrix}\,. \end{aligned}$$
(34)

When looking at the eigenvalues \(\omega \) of both stiffness matrices we obtain \(\omega ^{T,V} = \frac{2 \,EA}{l_e} \{ 0 \,,1\,,9 \}\) and \(\omega ^{T,F} = \frac{2 \,EA}{l_e} \{ 0 \,,1\,,4 \}\) which are different. These have the same subset \(\frac{2 \,EA}{l_e} \{ 0 \,,1 \}\) which are actually the two eigenvalues of the stiffness matrix for the virtual and the finite truss element with linear ansatz function. The zero eigenvalue is associated with the rigid body translation. Both stiffness matrices have the correct rank. Thus, a stabilization for the virtual element is not necessary.

The loading term follows from the potential, see (15),

$$\begin{aligned} U_f= \int \limits _0^{l_e} f(x)\,u_h \, \text{ d } x\,. \end{aligned}$$
(35)

Interestingly, for the case of \(f(x)=f_c=const.\) the integral \(\int u_h \, \text{ d } x\) can be approximated directly by the variable \(m_0\) introduced in (19) leading to

$$\begin{aligned} U_f= f_c \int \limits _0^{l_e} u_h \, \text{ d } x = f_c\,m_0\,l_e\,. \end{aligned}$$
(36)

Thus the matrix form of the loading term is

$$\begin{aligned} {\mathbf {f}}^{T,V} = \frac{\partial U_f}{\partial \widehat{{\mathbf {u}}}_e} =f_c l_e \begin{Bmatrix} 0 \\ 0 \\ 1 \end{Bmatrix} \end{aligned}$$
(37)

which is counterintuitive since no load term is assigned to the nodal degrees of freedom \(u_1\) and \(u_2\). The loading term for finite elements is given for a constant load by

$$\begin{aligned} {\mathbf {f}}^{T,F} = \frac{f_c l_e}{6} \begin{Bmatrix} 1 \\ 1 \\ 4 \end{Bmatrix} \end{aligned}$$
(38)

which is clearly different to (37).

In order to verify the correctness of the virtual element formulation leading to (33) and (37), a simple example of a bar under constant load \(f_c\) is considered that is fixed at the left end (\(u_1=0\)) , see Fig. 1. Using only one virtual element for the discretization yields with (33) and (37)

$$\begin{aligned} \frac{2 \,EA}{l_e} \begin{bmatrix} 2&{} -3 \\ -3 &{} 6 \end{bmatrix}\begin{Bmatrix} u_2\\m_0 \end{Bmatrix} = f_c l_e \begin{Bmatrix} 0 \\ 1 \end{Bmatrix} \quad \rightarrow \,\,\begin{Bmatrix} u_2\\m_0 \end{Bmatrix} =\frac{f_c L_e^2}{6\,EA} \begin{Bmatrix} 3\\2 \end{Bmatrix}. \end{aligned}$$
(39)

This result can be introduced in (31) to compute the displacement \(u_\pi \) and normal force \(N= EA u'_\pi \) which leads after some simple algebra to

$$\begin{aligned} u_\pi = \frac{f_c}{2\,EA} (2 l_e-x)x \quad \text{ and }\,\, N = f_c(l_e-x)\,. \end{aligned}$$
(40)

These results are equivalent to the exact analytical solution of the differential equation \(E A u''=-f_c\). Thus the projected displacement \(u_\pi \) of the quadratic virtual truss element delivers an exact solution in this special case. Actually, the exact analytical solution is also recovered when using the finite element formulation in (34) with the load vector in (38). We note that exact solutions are even recovered for the linear ansatz in Sect. 2.2, however, only for the nodal values, see, e.g., [13]. Finally, we observe that stiffness matrix and load vector of the virtual element are different from the finite element formulation and that the finite element formulation includes a third node at the center of the element.

2.4 Generalization for higher-order ansatz functions

The virtual element formulation for a truss element can be easily generalized to ansatz functions of any order. With the polynomial

$$\begin{aligned} u_\pi = \sum _{k=0}^n a_{k+1}\,x^k \end{aligned}$$
(41)

where n is the highest polynomial degree of the ansatz function, the projection can be computed. As before, a matrix \( {\mathbf {B}}_\pi (x)\) can be introduced

$$\begin{aligned} {\mathbf {B}}_\pi (x)= \langle \begin{matrix} 1&2x&\cdots&k\, x^{k-1} \end{matrix} \rangle \end{aligned}$$
(42)

with \(1 \le k \le n\). The derivative of the ansatz \(u_\pi \) is then given by

$$\begin{aligned} u'_\pi ={\mathbf {B}}_\pi (x) \,\hat{{\mathbf {a}}} \qquad \text{ with }\,\,\,\hat{{\mathbf {a}}}^T= \langle \begin{matrix} a_2&a_3&\ldots&a_{k+1} \end{matrix} \rangle ^T \end{aligned}$$
(43)

for \(1 \le k \le n\). Furthermore the internal variable, moment, is introduced

$$\begin{aligned} m_{k-2} = \frac{1}{l_e^{k-1}}\int _0^{le} x^{k-2} w_h \,\text{ d }x \qquad \text{ for }\,\,\, 2 \le k \le n\,. \end{aligned}$$
(44)

Here a scaling of the moment performed by \(l_e^{k-1}\) such that \(m_{k-2}\) has the same dimension as the displacement. From the right-hand side of the projection (23), it is clear that moments only appear when the ansatz order is at least 2.

By using the same polynomial ansatz for p as for \(u_\pi \), the derivative yields in matrix form \(p'= {\mathbf {B}}_\pi ^T = \langle \begin{matrix} 1&2x&\cdots&k x^{k-1} \end{matrix} \rangle ^T \) and the left-hand side of (21) follows as

$$\begin{aligned} \begin{aligned} \int \limits _0^{l_e} p'\,u'_\pi \, \text{ d } x&= \int \limits _0^{l_e} [{\mathbf {B}}_\pi (x)]^T {\mathbf {B}}_\pi (x)]\, \text{ d } x \, \hat{{\mathbf {a}}} \\&= \int \limits _0^{l_e} \begin{bmatrix} 1 &{} 2x &{} \cdots &{} k x^{k-1} \\ 2 x &{} 4 x^2 &{} \cdots &{} 2 k x^{k} \\ \vdots &{} \vdots &{} \vdots &{} \vdots &{} \\ k x^{k-1}&{}2 k x^{k} &{} \cdots &{} k^2 x^{2k-2} \end{bmatrix} \, \text{ d } x \left\{ \begin{matrix} a_2 \\ a_3 \\ \vdots \\ a_{k+1} \end{matrix} \right\} \,. \end{aligned} \end{aligned}$$
(45)

All polynomials can be integrated exactly which yields

$$\begin{aligned} \int \limits _0^{l_e} p'\,u'_\pi \, \text{ d } x = \begin{bmatrix} l_e &{} l_e^2 &{}\cdots &{} 2 l_e^{k} \\ l_e^2 &{} \frac{4}{3} l_e^3 &{}\cdots &{} \frac{2 k}{k+1} l_e^{k+1} \\ \vdots &{}\vdots &{}\vdots &{}\vdots \\ l_e^{k} &{} \frac{2 k}{k+1} l_e^{k+1} &{}\cdots &{} \frac{k^2}{2k-1} l_e^{2k-1} \end{bmatrix} \left\{ \begin{matrix} a_2 \\ a_3 \\ \vdots \\ a_{k+1} \end{matrix} \right\} ={\mathbf {G}}\, \hat{{\mathbf {a}}} \end{aligned}$$
(46)

The right-hand side in (23) can be evaluated with \(p'\) using (42) and \(p''= \langle \begin{matrix} 0&2&\ldots&k(k-1) x^{k-1} \end{matrix} \rangle ^T \) where \(p''\) only exist for \(k\ge 2\). This results in

$$\begin{aligned} {\mathbf {r}}(u_{h\,})= & {} \left. (p'\,u_h)\right| _0^{l_e} - \int \limits _0^{l_e} p''\,u_h \, \text{ d } x \nonumber \\= & {} \left[ \left\{ \begin{matrix} 1\\ 2x \\ \vdots \\ k\, x^{k-1} \end{matrix} \right\} u'_h \right] _0^{l_e}- \left\{ \begin{matrix}0 \\ 2 l_e \,m_0 \\ \vdots \\ k(k-1)\,l_e^{k-1} \,m_{k-2} \end{matrix} \right\} \end{aligned}$$
(47)

With the unknowns, \({\mathbf {u}}_e= (u_1\,,u_2)\), defined in the right part of Fig. 3, \(u_h(0)=u_1\), \(u_h(l_e) = u_2\) and the moments \({\mathbf {m}}=\langle \begin{matrix} m_0&\cdots&m_{k-2} \end{matrix} \rangle \) the right-hand side of (47) follows for an ansatz up to order n with \(2 \le k \le n\) as

$$\begin{aligned} {\mathbf {r}}({\mathbf {u}}_e,{\mathbf {m}})= \left\{ \begin{matrix} (u_2-u_1) \\ 2 l_e\,u_2\\ \vdots \\ k l_e^{k-1} \,u_2 \end{matrix} \right\} - \left\{ \begin{matrix}0\\ 2 l_e \,m_0 \\ \vdots \\ k(k-1) \,l_e^{k-1}\, m_{k-2} \end{matrix} \right\} \end{aligned}$$
(48)

The projection equation (69) can now be solved for the unknowns \({\mathbf {a}}\) by combining (46) and (48)

$$\begin{aligned} {\mathbf {G}}\, \hat{{\mathbf {a}}} = {\mathbf {r}}({\mathbf {u}}_e,{\mathbf {m}}) \end{aligned}$$
(49)

Once the parameters \(\hat{{\mathbf {a}}} \) are known as function of the nodal and internal variables, the parameter \(a_1\) can be obtained from (27). But due to the construction of the virtual element \(a_1=u_1\) since \(u_\pi (0)=u_1\).

3 Virtual element formulations for Euler–Bernoulli beams

We consider a beam of length l with a stiffness of EI where E is the Young’s modulus and I the moment of inertia of the cross section. The beam is loaded by a line load of magnitude q, see Fig. 3. The fourth-order ordinary differential equation for the deflection w of the Euler–Bernoulli beam with a constant cross section is given by

$$\begin{aligned} E\,I\,w''''(x) = q(x) \end{aligned}$$
(50)

By introducing a potential, the differential equation (50) can be written as a minimization problem

$$\begin{aligned} \frac{1}{2} \int \limits _0^l EI [w''(x)]^2 \text{ d } x - \int \limits _0^l q(x)\,w(x) \text{ d } x \longrightarrow MIN\,. \end{aligned}$$
(51)
Fig. 3
figure 3

Beam under constant line load and degrees of freedom of the associated element

3.1 Cubic ansatz for a one-dimensional virtual beam element

As for the truss element, the approximation of the deflection \(w_h\) is not known along the beam axis within a virtual element formulation. The unknown function \(w_h\) is only known at the nodal points of the element. For a fourth-order differential equation not only the deflection but also the rotations have to be approximated. The unknowns of a beam element are depicted in the right-hand side of Fig. 3.

The four unknowns \(w_1\), \(\theta _1\), \(w_2\) and \(\theta _2\) lead to a choice of a cubic ansatz which has four unknown coefficients \(a_i\)

$$\begin{aligned} w_\pi = a_1 + a_2 x +a_3 x^2 + a_4 x^3 = \langle 1, x, x^2, x^3 \rangle \, \left\{ \begin{matrix} a_1\\ a_2\\ a_3 \\ a_4 \end{matrix} \right\} = {\mathbf {N}}^{(3)}_\pi (x) \,{\mathbf {a}}\,. \end{aligned}$$
(52)

As in the truss formulation, the parameters can be determined from a \(L^2\)-projection. In case of the beam, we have to perform this for the curvature \(w''\)

$$\begin{aligned} \int \limits _0^{l_e} p''\,(\,w''_h-w''_\pi ) \, \text{ d } x =0 \rightarrow \int \limits _0^{l_e} p''\,w''_\pi \, \text{ d } x= \int \limits _0^{l_e} p''\,w''_h \, \text{ d } x\,. \end{aligned}$$
(53)

Again p is a polynomial of the same order as \(w_\pi \). Since second derivatives appear on the left-hand side of the projection, only the coefficients \(a_3\) and \(a_4\) can be determined from (53). Differentiation of (52) yields

$$\begin{aligned} w''_\pi = \langle \begin{matrix} 2&6x \end{matrix} \rangle \,\left\{ \begin{matrix} a_3 \\ a_4 \end{matrix} \right\} = {\mathbf {B}}^{(3)}_\pi \hat{{\mathbf {a}}} \quad \text{ and }\,\, p'' = \langle \begin{matrix} 2&6x \end{matrix} \rangle = {\mathbf {B}}^{(3)}_\pi \end{aligned}$$
(54)

which provides after integration a \(2 \times 2\) matrix for the left side of the projection (53)

$$\begin{aligned} \int \limits _0^{l_e} p''\,w''_\pi \, \text{ d } x = \int \limits _0^{l_e} [{\mathbf {B}}_\pi ^{(3)}]^T {\mathbf {B}}_\pi ^{(3)} \text{ d } x \,\hat{{\mathbf {a}}} = l_e \left[ \begin{matrix} 4 &{} 6 l_e \\ 6 l_e &{}12 l_e^2 \end{matrix} \right] \,\hat{{\mathbf {a}}}= {\mathbf {G}}_\pi \,\hat{{\mathbf {a}}}\,. \end{aligned}$$
(55)

with the vector containing the coefficients \(\hat{{\mathbf {a}}}= \langle a_3 \, a_4 \rangle ^T\).

The right-hand side of the projection (53) cannot be computed directly since \(w_h\) is not known along the beam axis. However, by using partial integration twice we are able to shift \(w_h\) to single values at the boundary of the element which are known,

$$\begin{aligned} \int \limits _0^{l_e} p''\,w''_h \, \text{ d } x = \left. (p'' w'_h) \right| _0^{l_e} - \left. (p''' w_h) \right| _0^{l_e} + \int \limits _0^{l_e} p''''\,w_h \, \text{ d } x \,. \end{aligned}$$
(56)

In (52), we use a cubic polynomial hence the fourth derivative \(p''''\) is zero. Noting that the derivative \(p'''\) can be written as \(\nabla {\mathbf {B}}^{(3)}_\pi = \langle 0, 6 \rangle \) the matrix form of (56) follows with the right side of (54) as

$$\begin{aligned} \int \limits _0^{l_e} p''\,w''_h \, \text{ d } x = \left. ([{\mathbf {B}}_\pi ^{(3)}]^T w'_h) \right| _0^{l_e} - \left. ([\nabla {\mathbf {B}}^{(3)}_\pi ]^T w_h) \right| _0^{l_e} \,. \end{aligned}$$
(57)

The rotation \(w'_h\) is known at the nodes of the beam element: \(w'_h(x=0)=\theta _1\) and at \(w'_h(x=l_e)=\theta _2\), see Fig. 3. The same is true for the deflection \(w_h\): \(w_h(x=0)= w_1\) and \(w_h(x=l_e)= w_2\). By introducing these relations into the above equation and combining the result with (55), the explicit matrix form of (53)

$$\begin{aligned} {\mathbf {G}}_\pi \,\hat{{\mathbf {a}}} = \left\{ \begin{matrix} 2 \\ 6 l_e \end{matrix} \right\} \theta _2 - \left\{ \begin{matrix} 2\\ 0 \end{matrix} \right\} \theta _1 - \left\{ \begin{matrix} 0 \\ 6 \end{matrix} \right\} (w_2-w_1) \end{aligned}$$
(58)

is obtained. The solution of this equation yields the coefficients \(a_3\) and \(a_4\) as a function of the nodal unknowns \({\mathbf {w}}_e\)

$$\begin{aligned} \hat{{\mathbf {a}}} = \frac{1}{l_e^2} \left[ \begin{matrix} -3 &{} -2 l_e &{} 3 &{} -l_e\\ \frac{2}{ l_e} &{}1 &{} - \frac{2}{ l_e} &{}1 \end{matrix} \right] \,{\mathbf {w}}_e = \hat{{\mathbb {P}}}^{(3)} \,{\mathbf {w}}_e \end{aligned}$$
(59)

with \({\mathbf {w}}^T_e= \langle w_1 \, \theta _1 \, w_2 \, \theta _2 \rangle \). Based on this result, the curvature \(w''_\pi \) can be expressed with (54) as \(w''_\pi = {\mathbf {B}}_\pi \hat{{\mathbf {a}}} = {\mathbf {B}}_\pi \,\hat{{\mathbb {P}}} \,{\mathbf {w}}_e\). Now the strain energy of the beam element (51) will be approximated using \(w''_\pi \)

$$\begin{aligned} U_B= \frac{1}{2} \int \limits _0^l EI [w''_\pi (x)]^2 \text{ d } x = \frac{1}{2} {\mathbf {w}}^T_e \, [\hat{{\mathbb {P}} }^{(3)}]^T\, EI \int \limits _0^{l _e} [{\mathbf {B}}_\pi ^{(3)}]^T\, {\mathbf {B}}^{(3)}_\pi \text{ d } x \,\hat{{\mathbb {P}}}^{(3)} \,{\mathbf {w}}_e\,. \end{aligned}$$
(60)

We note that the integral in this equation was already evaluated in (55). Thus, the stiffness matrix \( {\mathbf {K}}^{B,V}\) of the virtual Euler–Bernoulli beam element can be computed explicitly by a second derivative of the potential with respect to the nodal unknowns

$$\begin{aligned} {\mathbf {K}}^{B,V} = \frac{\partial ^2 U_B}{\partial {\mathbf {w}}\partial {\mathbf {w}}} = EI\,[\hat{{\mathbb {P}}}^{(3)}]^T \,{\mathbf {G}}_\pi \,\hat{{\mathbb {P}}}^{(3)} = \frac{EI}{l_e^3}\left[ \begin{matrix} 12 &{} 6 l_e &{} -12 &{} 6 l_e \\ 6 l_e &{} 4 l_e^2 &{} - 6 l_e &{} 2 l_e^2 \\ -12 &{} -6 l_e &{} 12 &{} - 6 l_e \\ 6 l_e &{} 2 l_e^2 &{} - 6 l_e &{} 4 l_e^2 \end{matrix} \right] \end{aligned}$$
(61)

which is exactly the stiffness matrix that is obtained when using the finite element method with a cubic Hermitian ansatz function, see, e.g., [12].

What remains is to compute the loading term in the potential (51). Since \(w_h\) is not known inside the element, it can be approximated by \(w_\pi \) in (52). So far only \(a_3\) and \(a_4\) are known. To compute coefficients \(a_1\) and \(a_2\), the relation (14) in Sect. 2 has to be extended to include also the derivative of the deflection (the rotations). The idea is to equalize not only the average of the nodal degrees of freedom of \(w_h\) and the value of the projection \(w_\pi \) at the element nodes but also the rotations \(w'_h\) and \(w'_\pi \). Hence, the following conditions can be employed to compute the remaining coefficients

$$\begin{aligned} \sum _{i=1}^2 w_h(x_i) = \sum _{i=1}^2 w_\pi (x_i) \quad \text{ and }\,\,\sum _{i=1}^2 w'_h(x_i) = \sum _{i=1}^2 w'_\pi (x_i) \,. \end{aligned}$$
(62)

By evaluating these equations at \(x=0\) and \(x=l_e\), we obtain for the deflections

$$\begin{aligned} w_1 + w_2= a_1 + (a_1+a_2 l_e + a_3 l_e^2 + a_4 l_e^3 ) \end{aligned}$$
(63)

and the rotations

$$\begin{aligned} \theta _1 + \theta _2 = a_2 + (a_2 + 2 a_3 l_e + 3 a_4 l_e^2 )\,. \end{aligned}$$
(64)

By inserting \(a_3\) and \(a_4\) from (59), the result \(a_2 = \theta _1\) and \(a_1=w_1\) follows. This result could also be obtained by just looking at the ansatz \(w_\pi \) in (52) since for \(x=0\) the ansatz function has the value \(w_\pi (0)=a_1=w_1\). The same is true for the first derivative \(w'_\pi \) which has to be for \(x=0\): \(w'_\pi (0) = a_2=\theta _1\).

Now all coefficients are known as functions of the nodal degrees of freedom \({\mathbf {w}}_e\) which can be expressed by the projection

$$\begin{aligned} {\mathbf {a}} = {\mathbb {P}}^{(3)}\,{\mathbf {w}}_e \Longrightarrow \left\{ \begin{matrix} a_1 \\ a_2 \\ a_3\\ a_4 \end{matrix} \right\} = \frac{1}{l_e^2} \left[ \begin{matrix} l_e^2 &{} 0 &{} 0 &{} 0\\ 0 &{} l_e^2 &{} 0 &{} 0\\ -3 &{} -2 l_e &{} 3 &{} -l_e\\ \frac{2}{ l_e} &{}1 &{} - \frac{2}{ l_e} &{}1 \end{matrix} \right] \, \left\{ \begin{matrix} w_1 \\ \theta _1 \\ w_2\\ \theta _2 \end{matrix} \right\} \end{aligned}$$
(65)

With (52) the ansatz \(w_\pi \) is complete

$$\begin{aligned} w_\pi (x) = {\mathbf {N}}^{(3)}_\pi (x) \, {\mathbb {P}}^{(3)}\,{\mathbf {w}}_e \,. \end{aligned}$$
(66)

By inserting this ansatz into the loading term in (51), here written for the element e, we derive for \(q(x)= q_0=const.\)

$$\begin{aligned} \int \limits _0^{l_e} q(x)\,w_\pi (x) \text{ d } x = q_0 \int \limits _0^{l_e} {\mathbf {N}}^{(3)}_\pi (x) \ \text{ d } x \, {\mathbb {P}}^{(3)}\,{\mathbf {w}}_e= \frac{q_0\,l_e}{2} \left\langle \begin{matrix} 1&\frac{l_e}{6}&1&-\frac{l_e}{6} \end{matrix} \right\rangle \, {\mathbf {w}}_e \end{aligned}$$
(67)

which is exactly the same result as provided by a cubic Hermitian finite element ansatz, see, e.g., [12].

Also in the case of the Euler–Bernoulli beam, the virtual element method leads to an identical result as the finite element method which has full rank. Thus, the remainder \( (w_h-w_\pi )\) in \(w_h= w_\pi + (w_h-w_\pi )\) is zero.

3.2 Fourth-order ansatz for a one-dimensional virtual beam element

This simple example will underline the methodology used to derive virtual elements for higher-order ansatz function. For this purpose, we will discuss a fourth-order (quadratic) ansatz for the problem \(EI w''''(x) = q(x)\), see Fig. 2.

Analogous to the case of the cubic projection, we select a fourth-order function

$$\begin{aligned} w_\pi = a_1 + a_2\,x + a_3 \,x^2 + a_4\,x^3 + a_5\,x^4 = {\mathbf {N}}_\pi ^{(4)} \,{\mathbf {a}} \end{aligned}$$
(68)

with \({\mathbf {N}}^{(4)}_\pi (x) = \langle \begin{matrix} 1&x&x^2&x^3&x^4 \end{matrix} \rangle \) and \({\mathbf {a}}^T = \langle a_1\,,a_2\,,a_3\,,a_4\,,a_5\rangle \). This projection function has five unknown parameters and the question is: how will it be possible to derive a virtual element since we have only two points at the edges of the element with nodal displacements \(w_1\) and \(w_2\) and the nodal rotations \(\theta _1\) and \(\theta _2\)?

The solution is the same as in Sect. 2.3. We look at the Galerkin projection (53) together with (56)

$$\begin{aligned} \int \limits _0^{l_e} \! p''\,(\,w''_h-w''_\pi ) \, \text{ d } x =0 \rightarrow \int \limits _0^{l_e} \! p''\,w''_\pi \, \text{ d } x= \left. (p'' w'_h) \right| _0^{l_e} - \left. (p''' w_h) \right| _0^{l_e} + \int \limits _0^{l_e} \! p''''\,w_h \, \text{ d } x \end{aligned}$$
(69)

where now p has the same polynomial degree as (68) and thus is a fourth-order polynomial with \(p''''=const.\) Hence the last integral \(\int \,w_h \, \text{ d } x \) does not vanish. But it is also not computable since \(w_h\) is not known inside the element. As in Sect. 2.3, we introduce an internal variable (so called moment)

$$\begin{aligned} m_0 = \frac{1}{l_e}\int _0^{l_e} \,w_h \, \text{ d } x \end{aligned}$$
(70)

which is scaled by the element length such that \(m_0\) has the same dimensions as \(w_1\) and \(w_2\). With this new variable, the projection in (69) can be determined.

It is convenient to introduce a matrix formulation in order to shorten notation. This leads to the second derivative of \(w_\pi \)

$$\begin{aligned} w''_\pi = 2 a_3 + 6 a_4\,x + 12 a_5\,x^2 = {\mathbf {B}}^{(4)}_\pi (x) \,\hat{{\mathbf {a}}} \end{aligned}$$
(71)

where \({\mathbf {B}}^{(4)}_\pi (x)= \langle \begin{matrix} 2&6x&12x^2 \end{matrix} \rangle \) and \(\hat{{\mathbf {a}}}^T = \langle \begin{matrix} a_3&a_4&a_5 \end{matrix} \rangle \). By writing the second derivative of the polynomial p in matrix form \(p''= [{\mathbf {B}}^{(4)}_\pi ]^T = \langle \begin{matrix} 2&6x&12 x^2 \end{matrix} \rangle ^T \) the left-hand side of (69) yields

$$\begin{aligned} \int \limits _0^{l_e} p''\,w''_\pi \, \text{ d } x = \int \limits _0^{l_e} [{\mathbf {B}}^{(4)}_\pi (x)]^T {\mathbf {B}}^{(4)}_\pi (x)\, \text{ d } x \, \hat{{\mathbf {a}}} = \int \limits _0^{l_e} \begin{bmatrix} 4 &{} 12x &{} 24 x^2 \\ 12 x &{} 36 x^2 &{} 72x^3 \\ 24 x^2 &{} 72 x^3 &{} 144 x^4\end{bmatrix} \, \text{ d } x \left\{ \begin{matrix} a_3 \\ a_4 \\ a_5 \end{matrix} \right\} \,. \end{aligned}$$
(72)

The polynomials can be integrated exactly, leading to

$$\begin{aligned} \int \limits _0^{l_e} p''\,w''_\pi \, \text{ d } x = \begin{bmatrix} 4 l_e &{} 6 l_e^2 &{} 8 l_e^3 \\ 6 l_e^2 &{} 12 l_e^3 &{} 18 l_e^4 \\ 8 l_e^3 &{} 18 l_e^4 &{} \frac{144}{5} l_e^5 \end{bmatrix} \left\{ \begin{matrix} a_3 \\ a_4 \\ a_5 \end{matrix} \right\} ={\mathbf {G}}\, \hat{{\mathbf {a}}} \,. \end{aligned}$$
(73)

The right-hand side in (69) can be evaluated with \(p'''= \langle \begin{matrix} 0&6&24 x \end{matrix} \rangle ^T \) and

\(p''''= \langle \begin{matrix} 0&0&24 \end{matrix} \rangle ^T \)

$$\begin{aligned} {\mathbf {r}}(w_{hi\,})= & {} \left. (p''\,w'_h)\right| _0^{l_e} - \left. (p'''\,w_h)\right| _0^{l_e} + \int \limits _0^{l_e} p''''\,w_h \, \text{ d } x \nonumber \\= & {} \left[ \left\{ \begin{matrix} 2 \\ 6x \\ 12 x^2 \end{matrix} \right\} w'_h - \left\{ \begin{matrix} 0 \\ 6 \\ 24 x \end{matrix} \right\} w_h \right] _0^{l_e} + \left\{ \begin{matrix} 0 \\ 0 \\ 24 \end{matrix} \right\} \int \limits _0^{l_e} w_h \, \text{ d } x \end{aligned}$$
(74)

With the unknowns, defined in the right part of Fig. 3, \(w_h(0)=w_1\), \(w_h(l_e) = w_2\), \(w'_h(0)=\theta _1\) and \(w'_h(l_e)=\theta _2\), the right-hand side of (74) follows as

$$\begin{aligned} {\mathbf {r}}(w_i,\theta _i,m_0)= \left\{ \begin{matrix} 2(\theta _2-\theta _1) \\ 6 \,l_e \theta _2 \\ 12 l_e^2 \theta _2\end{matrix} \right\} - \left\{ \begin{matrix} 0 \\ 6 \,(w_2-w_1) \\ 24 l_e w_2 \end{matrix} \right\} + \left\{ \begin{matrix} 0 \\ 0 \\ 24 l_e m_0 \end{matrix} \right\} \end{aligned}$$
(75)

The projection equation (69) can now be solved for the unknowns \({\mathbf {a}}\) by combining (73) and (75)

$$\begin{aligned} {\mathbf {G}}\, \hat{{\mathbf {a}}} = {\mathbf {r}}(w_i,\theta _i,m_0) \rightarrow \left\{ \begin{matrix} a_3 \\ a_4\\ a_5 \end{matrix} \right\} = \left\{ \begin{matrix} -\frac{3}{2 l_e^2} (12 w_1+3 l_e \theta _1+ 8 w_2 - l_e \theta _2 - 20 m_0) \\ \frac{2}{l_e^3} (16 w_1+3 l_e \theta _1+ 14 w_2 -2 l_e \theta _2 - 30 m_0) \\ frac{5}{2 l_e^4} (6 w_1+ l_e \theta _1 + 6 w_2 - l_e \theta _2 - 12 m_0) \end{matrix} \right\} \,. \end{aligned}$$
(76)

Furthermore, the constants \(a_1\) and \(a_2\) can be obtained by the conditions that the average of the projection \(w_\pi \) and its derivative \(w'_\pi \) evaluated at the nodal points is equal to the average of the ansatz \(w_h\) and its derivative \(w'_h\)at the nodal points for one element

$$\begin{aligned} \int _0^{l_e} w_\pi (x) \text{ d } x = \int _0^{l_e} w_h(x) \text{ d } x \,,\qquad \int _0^{l_e} w'_\pi (x) \text{ d } x = \int _0^{l_e} w'_h(x) \text{ d } x \,. \end{aligned}$$
(77)

The first equation leads with \(x_1=0\), \(x_2=l_e\) and the ansatz (68) to

$$\begin{aligned} a_1 \,l_e + \frac{1}{2}a_2\,l_e^2 + \frac{1}{2} a_3\,l_e^3 + \frac{1}{4} a_4\,l_e^4 + \frac{1}{5}\,l_e^5= l_e\,m_0 \end{aligned}$$
(78)

and the second condition results in

$$\begin{aligned} a_2 \,l_e a_3\,l_e^2 + a_4\,l_e^3 + a_5\,l_e^4 = \int _0^{l_e} w'_h(x) \text{ d } x = \left. w_h \right| _0^{l_e}=w_2-w_1\,. \end{aligned}$$
(79)

The two equations above yield a matrix system from which \(a_1\) and \(a_2\) can be determined

$$\begin{aligned} \begin{bmatrix} l_e &{}\frac{1}{2} l_e^2 \\ 0 &{} l_e \end{bmatrix} \begin{Bmatrix} a_1 \\ a_2 \end{Bmatrix}= \begin{Bmatrix} l_e\,m_0\\ w_2-w_1 \end{Bmatrix} - \begin{bmatrix} \frac{1}{2} \,l_e^3 &{} \frac{1}{4} \,l_e^4 &{}\frac{1}{5}\,l_e^5\\ l_e^2 &{} l_e^3&{} l_e^4 \end{bmatrix} \begin{Bmatrix} a_3 \\ a_4 \\ a_5 \end{Bmatrix}\,. \end{aligned}$$
(80)

By inserting \(a_3\) to \(a_5\) from (76) this equation system leads after some algebra to \(a_1=w_1\) and \(a_2= \theta _1\). The result is obvious since for \(x=0\) the ansatz function should give the nodal values \(w_1\) and \(\theta _1\) at this point.

As in the case of the virtual beam element with cubic ansatz in section 3 a projector, see (65), can be defined which maps expresses the constants \({\mathbf {a}}^T = \langle a_1\,,a_2\,,a_3\,,a_4\,,a_5\rangle \) in terms of the nodal values and the moment \(\widehat{{\mathbf {w}}}^T_e = \langle w_1\,,\theta _1\,,w_2\,,\theta _2\,,m_0 \rangle \) as

$$\begin{aligned} {\mathbf {a}} = {\mathbb {P}}^{(4)}\,\widehat{{\mathbf {w}}}_e \Longrightarrow \left\{ \begin{matrix} a_1 \\ a_2 \\ a_3\\ a_4 \\ a_5 \end{matrix} \right\} = \frac{1}{l_e^4} \left[ \begin{matrix} l_e^4 &{} 0 &{} 0 &{} 0 &{} 0\\ 0 &{} l_e^4 &{} 0 &{} 0&{} 0\\ -{18}{l_e^2} &{} - \frac{9}{2} l_e^3 &{} -{12}{l_e^2} &{} \frac{3}{2}{l_e^3} &{} {30}{l_e^2} \\ {32}{l_e} &{} {6}{l_e^2} &{} {28}{l_e} &{} -{4}{l_e^2} &{} -{60}{l_e} \\ -{15} &{} -\frac{5}{2} l_e &{} -{15} &{} \frac{5}{2} l_e &{} {30} \end{matrix} \right] \, \left\{ \begin{matrix} w_1 \\ \theta _1 \\ w_2\\ \theta _2 \\ m_0 \end{matrix} \right\} \end{aligned}$$
(81)

The definitions in (68) and (71) together with

$$\begin{aligned} {\mathbb {B}}^{(4)} = \frac{1}{l_e^4}\left[ \begin{matrix} -{18}{l_e^2} &{} - \frac{9}{2} l_e^3 &{} -{12}{l_e^2} &{} \frac{3}{2} {l_e^3} &{} {30}{l_e^2} \\ {32}{l_e} &{} {6}{l_e^2} &{} {28}{l_e} &{} -{4}{l_e^2} &{} -{60}{l_e} \\ -{15} &{} -\frac{5}{2} l_e &{} -{15} &{} \frac{5}{2} l_e &{} {30} \end{matrix} \right] \end{aligned}$$
(82)

yield the matrix form of the projection of the ansatz function and its second derivative

$$\begin{aligned} w_\pi = {\mathbf {N}}^{(4)}_\pi (x) \, {\mathbb {P}}^{(4)} \,\widehat{{\mathbf {w}}}_e \quad \text{ and }\,\,\, w''_\pi = {\mathbf {B}}^{(4)}_\pi (x) \,{\mathbb {B}}^{(4)} \, \widehat{{\mathbf {w}}}_e \end{aligned}$$
(83)

The derivative \(w''_\pi \) from (83) can now be inserted into the potential energy and integrated using the result from (73)

$$\begin{aligned} \begin{aligned} U_e= \frac{1}{2} \int \limits _0^{l_e}\! EI\,(w''_\pi )^2 \, \text{ d } x&=\frac{1}{2} \widehat{{\mathbf {w}}}_e^T [{\mathbb {B}}^{(4)}] ^T \!\!\int \limits _0^{l_e}\! [{\mathbf {B}}^{(4)}_\pi (x)]^T {\mathbf {B}}^{(4)}_\pi (x) \, \text{ d } x \,{\mathbb {B}}^{(4)} \widehat{{\mathbf {w}}}_e\\&= \frac{1}{2} \widehat{{\mathbf {w}}}_e^T [{\mathbb {B}}^{(4)}] ^T {\mathbf {G}}\, {\mathbb {B}}^{(4)} \widehat{{\mathbf {w}}}_e\,. \end{aligned} \end{aligned}$$
(84)

Now the stiffness matrix of the virtual element follows by differentiation with respect to \({\mathbf {u}}_e\) as

$$\begin{aligned} {\mathbf {K}}^{B,V}= \frac{\partial ^2 U_e}{\partial \widehat{{\mathbf {w}}}_e\partial \widehat{{\mathbf {w}}}_e}= [{\mathbb {B}}^{(4)} ]^T {\mathbf {G}}\, {\mathbb {B}}^{(4)} = \frac{EI}{l_e^3} \begin{bmatrix} 192 &{} 36 l_e&{} 168 &{} -24 l_e &{} -360 \\ 36 l_e&{}9 l_e^2 &{} 24 l_e&{} -3 l_e^2 &{} -60 l_e \\ 168 &{} 24 l_e &{}192 &{} -36 l_e&{} -360 \\ -24 l_e &{} -3 l_e^2 &{} -36 l_e &{} 9 l_e^2 &{} 60 l_e\\ -360 &{} -60 l_e &{} -360 &{} 60 l_e &{} 720 \end{bmatrix} \end{aligned}$$
(85)

It is interesting to note that there is no adequate FEM formulation that yields the a finite beam element with 5 degrees of freedom.

The loading term follows from the potential, see (51),

$$\begin{aligned} U_q= \int \limits _0^{l_e} q(x)\,w_h \, \text{ d } x \end{aligned}$$
(86)

Interestingly, for the case of \(q(x)=q_0=const.\) the integral \(\int w_h \, \text{ d } x\) can be evaluated directly using the definition (70) of the variable \(m_0\). This yields

$$\begin{aligned} U_q= q_0 \int \limits _0^{l_e} w_h \, \text{ d } x = q_0\,m_0\,l_e \end{aligned}$$
(87)

Thus, the matrix form of the loading term is simply given by

$$\begin{aligned} {\mathbf {f}}_0^{B,V} = q_0\,l_e \begin{Bmatrix} 0 \\ 0 \\ 0\\ 0\\ 1 \end{Bmatrix} \end{aligned}$$
(88)

which is similar to the constant loading term of the truss element with quadratic ansatz function, see (37). One can evaluate \(U_q\) in a different way by inserting the ansatz for \(w_\pi \), see (83) into the integral in (87). This will actually lead after some algebraic manipulations to exactly the same result.

For a load that varies linearly in the virtual element given as \(q(x) = (1-\frac{x}{l_e} )\,q_1 + \frac{x}{l_e}\, q_2\) with two constants \(q_1\) and \(q_2\) describing the load at the nodes, the potential of this loading term is obtained by inserting \(w_\pi \) from (83)

$$\begin{aligned} \begin{aligned} U_q=&\int \limits _0^{l_e} \left[ (1-\frac{x}{l_e} )q_1 + \frac{x}{l_e} q_2\right] \, {\mathbf {N}}^{(4)}_\pi (x) \,\text{ d } x\, {\mathbb {P}}^{(4)} \,\widehat{{\mathbf {w}}}_e \\ =&\, \frac{l_e}{120} \left[ (q_1 - q_2) [12 (w_1 - w_2) + l_e (\theta _1 + \theta _2)] + 60 \, (q_1 + q_2) m_0 \right] \end{aligned} \end{aligned}$$
(89)

This result yields the load vector for one element

$$\begin{aligned} {\mathbf {f}}_1^{B,V}= \frac{\partial U_q}{\partial {\mathbf {w}}_e}= \frac{l_e}{120} \begin{Bmatrix} 12 (q_1-q_2) \\ (q_1-q_2) l_e \\ -12 (q_1-q_2) \\ (q_1-q_2) l_e\\ 60 (q_1+q_2) l_e\end{Bmatrix}\,. \end{aligned}$$
(90)
Fig. 4
figure 4

On beam under linearly varying line load

For an assessment of the accuracy of the developed element, a beam that is clamped at the left side is investigated. Only one element is considered for the case of the constant load, \(q_1=q_2=q_0\) leading to \( {\mathbf {f}}_0\), and the linear varying load, \( {\mathbf {f}}_1\). The boundary conditions for the clamped beam are (\(w_1= \theta _1=0\)) , see Fig. 4. In that case, the element stiffness matrix (135) can be used where the first and second rows and columns are eliminated. Furthermore, the first two rows of the load vector are deleted leading for the constant load to the equation system with the solution

$$\begin{aligned} \begin{bmatrix} 192 &{} -36 l_e&{} -360 \\ -36 l_e &{} 9 l_e^2 &{} 60 l_e\\ -360 &{} 60 l_e &{} 720 \end{bmatrix} \begin{Bmatrix} w_2 \\ \theta _2 \\ m_0 \end{Bmatrix} = \begin{Bmatrix} 0 \\ 0\\ q_0\,l_e\end{Bmatrix} \Longrightarrow \begin{Bmatrix} w_2 \\ \theta _2 \\ m_0 \end{Bmatrix} = \frac{q_0\,l_e^3}{EI}\begin{Bmatrix} \frac{l_e}{8} \\ \frac{1}{6} \\ \frac{l_e}{20} \end{Bmatrix} \end{aligned}$$
(91)

The nodal values \(w_2\) and \(\theta _2\) match the analytical results. Furthermore, the solution can be used to compute the moment distribution along the beam \(M(x) = -EI \,w''_\pi \). For that, the results of (91) are introduced in (83) which leads to

$$\begin{aligned} M(x) = EI \, {\mathbf {B}}^{(4)}_\pi (x) \,{\mathbb {B}}^{(4)} \,\widehat{{\mathbf {w}}}_e = -\frac{q_0}{2}( l_e-x)^2\,. \end{aligned}$$
(92)

Also this result matches the analytical solution which is related to the fact that the analytical solution is a fourth-order polynomial, and hence, the fourth-order ansatz (68) can approximate this solution exactly.

For the linearly distributed load, we obtain

$$\begin{aligned} \begin{bmatrix} 192 &{} -36 l_e&{} -360 \\ -36 l_e &{} 9 l_e^2 &{} 60 l_e\\ -360 &{} 60 l_e &{} 720 \end{bmatrix} \begin{Bmatrix} w_2 \\ \theta _2 \\ m_0 \end{Bmatrix} = \begin{Bmatrix} - (q_1-q_2)\frac{l_e}{10} \\ (q_1-q_2) \frac{l_e^2}{120}\\ (q_1+q_2)\,\frac{l_e}{2}\end{Bmatrix} \Longrightarrow \begin{Bmatrix} w_2 \\ \theta _2 \\ m_0 \end{Bmatrix} = \frac{\,l_e^3}{24 EI}\begin{Bmatrix} \frac{l_e}{5}(4 q_1+11 q_2) \\ q1+3 q_2 \\ \frac{l_e}{15}(5 q_1+13 q_2 \end{Bmatrix} \end{aligned}$$
(93)

Here \(w_2\) and \(\theta _2\) coincide with the analytical solution at the beam end which actually can be shown for all complete polynomial ansatz functions that fulfil the homogeneous differential equation of the beam. The result (93) leads to bending moment distribution in the beam

$$\begin{aligned} M^{B,V}_1(x) = - EI \, {\mathbf {B}}^{(4)}_\pi (x) \,{\mathbb {B}}^{(4)} \, \widehat{{\mathbf {w}}}_e = -(19 q_1 + 41 q_2) \frac{l_e^2}{120} + (2 q_1 + 3 q_2) \frac{l_e x}{5} - (q_1+q_2) \frac{ x^2}{4} \end{aligned}$$
(94)

that does not match the distribution computed from the analytical solution

$$\begin{aligned} M^{B,A}_1(x) = -\frac{(l_e-x)^2 }{6 l_e} \left[ (q_1+2 q_2) l_e +(q_2-q_1) x \right] \end{aligned}$$
(95)

which is a cubic function. However, the difference is not large which can be seen by evaluating \(M^{B,V}_1\) and \(M^{B,A}_1\) at \(x=0\) and \(x=l_e\):

$$\begin{aligned} \begin{aligned} M^{B,V}_1(0)&= M^{B,A}_1(0) -(q_2 - q_1) \frac{l_e^2}{120} \qquad \,\, M^{B,A}_1(0) = - (20 q_1+40 q_2) \frac{l_e^2 }{120} \\ M^{B,V}_1(l_e)&= (q_2 - q_1) \frac{l_e^2}{120} \qquad \qquad \qquad \quad \,\, M^{B,A}_1(l_e) = 0 \end{aligned} \end{aligned}$$
(96)

3.3 Generalization for higher-order ansatz functions

The virtual element formulation for Euler–Bernoulli beams can be generalized for higher-order ansatz function. For that, an ansatz is introduced

$$\begin{aligned} w_\pi = \sum _{k=0}^n a_{k+1}\,x^k \end{aligned}$$
(97)

where n is the highest polynomial degree of the ansatz function. The matrix \( {\mathbf {B}}_\pi (x)\) in (71) can be written as

$$\begin{aligned} {\mathbf {B}}_\pi (x)= \langle \begin{matrix} 2&6x&\cdots&c_1(k)\, x^{k-2} \end{matrix} \rangle \end{aligned}$$
(98)

with \(2 \le k \le n\) and \(c_1(k) =k(k-1)\). The second derivative of the ansatz is then given by

$$\begin{aligned} w''_\pi ={\mathbf {B}}_\pi (x) \,\hat{{\mathbf {a}}} \qquad \text{ with }\,\,\,\hat{{\mathbf {a}}}^T= \langle \begin{matrix} a_3&a_4&\ldots&a_{k+1} \end{matrix} \rangle ^T \end{aligned}$$
(99)

for \(2 \le k \le n\). Furthermore, we can introduce the moment, which is an internal variable,

$$\begin{aligned} m_{k-4} = \frac{1}{l_e^{k-3}}\int _0^{le} x^{k-4} w_h \,\text{ d }x \qquad \text{ for }\,\,\, 4 \le k \le n \end{aligned}$$
(100)

where the scaling by \(l_e^{k-3}\) is made such that \(m_{k-4}\) has the same dimension as the deflection. From the right-hand side of the projection (69), it is clear that moments only appear when the ansatz order is at least 4.

By using the same polynomial ansatz for p as for \(w_\pi \), the second derivative yields in matrix form \(p''= {\mathbf {B}}_\pi ^T = \langle \begin{matrix} 2&6x&\cdots&k(k-1) x^{k-2} \end{matrix} \rangle ^T \) and the left-hand side of (69) follows as

$$\begin{aligned} \begin{aligned} \int \limits _0^{l_e} p''\,w''_\pi \, \text{ d } x&= \int \limits _0^{l_e} [{\mathbf {B}}_\pi (x)]^T {\mathbf {B}}_\pi (x)]\, \text{ d } x \, \hat{{\mathbf {a}}} \\&= \int \limits _0^{l_e} \begin{bmatrix} 4 &{} 12x &{} \cdots &{}2 k(k-1) x^{k-2} \\ 12 x &{} 36 x^2 &{} \cdots &{} 6 k(k-1) x^{k-1} \\ \vdots &{} \vdots &{} \vdots &{} \vdots &{} \\ 2 k(k-1) x^{k-2} &{}6 k(k-1) x^{k-1} &{} \cdots &{}[ k(k-1)]^2 x^{2k-4} \end{bmatrix} \, \text{ d } x \left\{ \begin{matrix} a_3 \\ a_4 \\ \vdots \\ a_{k+1} \end{matrix} \right\} \,. \end{aligned} \end{aligned}$$
(101)

The polynomials can be integrated exactly, leading to

$$\begin{aligned} \int \limits _0^{l_e} p''\,w''_\pi \, \text{ d } x = \begin{bmatrix} 4 l_e &{} 6 l_e^2 &{}\cdots &{} 2 k \,l_e^{k-1} \\ 6 l_e^2 &{} 12 l_e^3 &{}\cdots &{} 6 (k-1) l_e^{k} \\ \vdots &{}\vdots &{}\vdots &{}\vdots \\ 2 k\, l_e^{k-1} &{} 6 (k-1) l_e^{k} &{}\cdots &{} \frac{[k(k-1)]^2}{2k-3} l_e^{2k-3} \end{bmatrix} \left\{ \begin{matrix} a_3 \\ a_4 \\ \vdots \\ a_{k+1} \end{matrix} \right\} ={\mathbf {G}}\, \hat{{\mathbf {a}}} \end{aligned}$$
(102)

The right-hand side in (69) can be evaluated with \(p''\) using (98), \(p'''= \langle \begin{matrix} 0&6&\ldots&c_2(k) x^{k-3} \end{matrix} \rangle ^T \) and \(p''''= \langle \begin{matrix} 0&0&24&\ldots&c_3(k) x^{k-4} \end{matrix} \rangle ^T \) where \(p'''\) and \(p''''\) only exist for \(k\ge 3\) and \(k\ge 4\), respectively. Here the constants \(c_2(k) =k(k-1)(k-2)\) and \(c_3(k) =k(k-1)(k-2)(k-3)\), depending on the ansatz order, were introduced. This results in

$$\begin{aligned} {\mathbf {r}}(w_{h\,})= & {} \left. (p''\,w'_h)\right| _0^{l_e} - \left. (p'''\,w_h)\right| _0^{l_e} + \int \limits _0^{l_e} p''''\,w_h \, \text{ d } x \nonumber \\= & {} \left[ \left\{ \begin{matrix} 2\\ 6x \\ 12 x^2\\ \vdots \\ c_1(k)\, x^{k-2} \end{matrix} \right\} w'_h - \left\{ \begin{matrix} 0 \\ 6 \\ 24 x\\ \vdots \\ c_2(k) \,x^{k-3} \end{matrix} \right\} w_h \right] _0^{l_e} + \left\{ \begin{matrix}0 \\ 0\\ 24 l_e \,m_0 \\ \vdots \\ c_3(k)\,)l_e^{k-3} \,m_{k-4} \end{matrix} \right\} \end{aligned}$$
(103)

With the unknowns, \({\mathbf {w}}_e= (u_1\,,\theta _1\,,u_2\,,\theta _2)\), defined in the right part of Fig. 3, \(w_h(0)=w_1\), \(w_h(l_e) = w_2\), \(w'_h(0)=\theta _1\), \(w'_h(l_e)=\theta _2\) and the moments \({\mathbf {m}}=\langle \begin{matrix} m_0&\cdots&m_{k-4} \end{matrix} \rangle \) the right-hand side of (103) follow for an ansatz up to order n with \(3 \le k \le n\) as

$$\begin{aligned} {\mathbf {r}}({\mathbf {w}}_e,{\mathbf {m}})= \left\{ \begin{matrix} 2(\theta _2-\theta _1) \\ 6 \,l_e \theta _2 \\ 12 l_e^2 \theta _2\\ \vdots \\ c_1(k)) l_e^{k-2} \theta _2\end{matrix} \right\} - \left\{ \begin{matrix} 0 \\ 6 \,(w_2-w_1) \\ 24 l_e\,w_2\\ \vdots \\ c_2(k) l_e^{k-3} \,w_2 \end{matrix} \right\} + \left\{ \begin{matrix}0 \\ 0\\ 24 l_e \,m_0 \\ \vdots \\ c_3(k) )\,l_e^{k-3}\, m_{k-4} \end{matrix} \right\} \end{aligned}$$
(104)

The projection equation (69) can now be solved for the unknowns \({\mathbf {a}}\) by combining (102) and (104)

$$\begin{aligned} {\mathbf {G}}\, \hat{{\mathbf {a}}} = {\mathbf {r}}({\mathbf {w}}_e,{\mathbf {m}}) \end{aligned}$$
(105)

Once the parameters \(\hat{{\mathbf {a}}} \) are known as function of the nodal and internal variables, the two parameters \(a_1\) and \(a_2\) follow from (77). But as discussed in the previous section, due to the construction of the ansatz we arrive always at \(a_1 = w_1\) and \(a_2 =\theta _1\). With this the projection function, \(w_\pi \) is completely determined.

For an ansatz of order \(n\ge 4\), we will obtain an exact solution for a load of \(q(x) = \sum _{k=4}^{n} q_{k-4} x^{k-4}\). In that case, the potential related to the load can be written as

$$\begin{aligned} U_q= \int \limits _0^{l_e} q(x)\,w_h \, \text{ d } x = \sum _{k=4}^{n} q_{k-4} \,l_e^{k-3\,}m_{k-4} \,. \end{aligned}$$
(106)

Thus, it is straightforward to develop Euler–Bernoulli beam elements of arbitrary order. As an example, we provide the relevant matrices for a fifth-order ansatz in appendix.

4 Static condensation

Internal variables can be removed by static condensation. Thus, it is possible to eliminate the moments \(m_i\) at element level. For that, we split the matrix and right had side at element level in

$$\begin{aligned} \begin{bmatrix} {\mathbf {K}}_{II} &{} {\mathbf {K}}_{IM} \\ {\mathbf {K}}_{MI} &{} {\mathbf {K}}_{MM} \end{bmatrix} \,\begin{Bmatrix} {\mathbf {u}}_I \\ {\mathbf {m}}_M\end{Bmatrix} = \begin{Bmatrix} {\mathbf {R}}_I \\ {\mathbf {R}}_M\end{Bmatrix} \end{aligned}$$
(107)

and build the Schur complement leading with \( \bar{{\mathbf {K}}}_{II}= \left( {\mathbf {K}}_{II} - {\mathbf {K}}_{IM}\, {\mathbf {K}}_{MM}^{-1} {\mathbf {K}}_{MI}\right) \) to

$$\begin{aligned} \begin{aligned} \bar{{\mathbf {K}}}_{II} \,{\mathbf {u}}_I =&\,{\mathbf {R}}_{I} - {\mathbf {K}}_{IM}{\mathbf {K}}_{MM}^{-1} {\mathbf {R}}_{M} \\ {\mathbf {K}}_{MM}\, {\mathbf {m}}_M =&\left( {\mathbf {R}}_{M} - {\mathbf {K}}_{MI}\, {\mathbf {u}}_I \right) \end{aligned} \end{aligned}$$
(108)

It can be shown for any order of the ansatz used to derive the virtual element that the matrix \( \bar{{\mathbf {K}}}_{II}\) is equivalent to the matrix representing the cubic ansatz given in (61). This is consistent with the result that the third-order ansatz exactly solves the homogeneous part of the beam equation (50) and it is a well known fact that the nodal deflections \(w_i\) and the nodal rotations \(\theta _i\) are exact for any given right-hand side, see, e.g., [13] and [7].

However, the approximation of the deflection within the cubic beam element are only exact for \(q(x) =0\). Hence, as shown before, it makes sense to use the virtual element formulation to obtain higher-order approximations and thus better a representation of the beam deflection and with this also of the bending moment and shear force within the element.

Based on this observation, it is possible to analyze a beam problem by computing

  1. 1.

    the nodal deflections and rotations using the cubic beam formulation which is equivalent to the finite element beam. This yields the exact nodal degrees of freedom \( {\mathbf {u}}_I\).

  2. 2.

    Next the moments \({\mathbf {m}}_M\) follow from ((108))\(_2\) which complete the unknowns for the virtual element.

  3. 3.

    The higher-order approximation of the deflection \(w_\pi \) within the element can then be computed using the projector, e.g., (81) for the fourth or (133) for the fifth-order virtual element ansatz.

This approach is similar to a postprocessing step where first the problem is solved with the classical beam element, and then, a step follows that produces a higher-order solution at local element level using the virtual element formulation.

The same procedure can also be applied for the truss element. Here a linear ansatz solves the homogeneous Eq. (1). Thus, again an elimination of the internal degrees of freedom can be performed by using (108)\(_2\) which yields the stiffness matrix (10) related to the linear ansatz function. Again the same procedure, as mentioned above for the beam, can be used to compute the nodal degrees of freedom \(u_i\) and moments \(m_k\) which yields an enhanced approximation of \(u_\pi \) within the truss element by the virtual element formulation.

5 Application of the virtual element discretization to nonlinear beam formulations

The developed virtual beam elements can be applied in linear and nonlinear problems related to structural analysis. Here we use the methodology of Sects. 2 and 3 to construct a formulation for nonlinear response of Bernoulli–Euler beams. We assume that the beams undergo small strains but finite deflections and rotations. In this case, the static condensation approach, see above, cannot be employed since the nonlinear truss and beam equations will not be solved exactly by a linear and cubic polynomial, respectively.

5.1 Theoretical background and discretization

The associated strain measures for the axial strains \(\varepsilon \) and the curvature \(\kappa \) that can be found in textbooks, like [14]. The elongation \(\varepsilon \) and the curvature \(\kappa \) are given by

$$\begin{aligned} \begin{aligned} \varepsilon (x)&= \sqrt{\,[\,1+u'(x)]^2 + w'(x)^2}-1\,,\\ \kappa (x)&= \frac{[\,1+u'(x)]\,w''(x)-w'(x)\, u''(x)}{ [\,\varepsilon (x)+1\,]^2} \,. \end{aligned} \end{aligned}$$
(109)

Thus, the element formulations in Sects. 2 and 3 have to be combined in order to approximate the displacement u and the deflection w of the beam. Attention has to be paid that second derivatives of u appear in the curvature term which is contrary to the linear beam theory. In case or a linear constitutive relation, the potential describing the virtual beam element can be written in matrix form as

$$\begin{aligned} U({\varvec{u}}) = \frac{1}{2} \int \limits _0^l \varvec{\varepsilon }^T \,{\mathbb {C}}\,\varvec{\varepsilon } \,\text{ d } x - \int \limits _0^l {\varvec{u}}^T {\varvec{f}} \, \,\text{ d } x \end{aligned}$$
(110)

with the definitions

$$\begin{aligned} \begin{aligned} \varvec{\varepsilon }^T&= \langle \varepsilon (x)\,, \kappa (x)\rangle \,,\qquad {\mathbb {C}}= \begin{pmatrix} EA&{}0\\ 0&{} EI \end{pmatrix}\,, \\ {\varvec{u}}^T&= \langle u(x)\,,w(x)\rangle \qquad \text{ and }\,\,\, {\varvec{f}}^T = \langle f(x)\,, q(x)\rangle \,. \end{aligned} \end{aligned}$$
(111)

Note that \(U({\varvec{u}}) \) is highly nonlinear in terms of the deflection and axial displacement.

Now the strains have to be approximated by the virtual element ansatz functions where many different possibilities exist for the choice of the order of the ansatz functions. We will vary the ansatz order \(n_u\) for axial displacements from linear to cubic (\(n_u=1,2,3\)) and the ansatz order for the deflection \(n_w\) from \(3^{rd}\) to \(4^{th}\) order (\(n_w=3,4\)).

Next we provide the the projection matrices related to the axial displacement. The first-order part is given by

$$\begin{aligned} {\mathbf {N}}_\pi ^{(1)}(x) = \langle \begin{matrix} 1&x \end{matrix} \rangle \,,\qquad {\mathbb {P}}^{(1)} =\frac{1}{l_e} \begin{bmatrix} l_e &{}0\\ -1&{} 1 \end{bmatrix} \qquad \text{ with }\,\,\, \widehat{{\mathbf {u}}}_e^{(1)}=\left\{ \begin{matrix} u_1\\ u_2\end{matrix} \right\} \end{aligned}$$
(112)

For the second-order ansatz, the projection operators follow from (31)

$$\begin{aligned} {\mathbf {N}}_\pi ^{(2)}(x) = \langle \begin{matrix} 1&x&x^2 \end{matrix} \rangle \,,\qquad {\mathbb {P}}^{(2)} =\frac{1}{l_e^2} \begin{bmatrix} l_e^2 &{}0&{}0\\ -4 l_e&{} -2 l_e &{} 6 l_e \\ 3&{}3&{}-6 \end{bmatrix} \qquad \text{ with }\,\,\, \widehat{{\mathbf {u}}}_e^{(2)}=\left\{ \begin{matrix} u_1\\ u_2\\ m_0 \end{matrix} \right\} \end{aligned}$$
(113)

For the third-order ansatz, the projection can be obtained from the matrices in Appendix A.1. For that the equation, system with (124) and (125) has to be solved leading to

$$\begin{aligned} {\mathbf {N}}_\pi ^{(3)}(x) = \langle \begin{matrix} 1&x&x^2&x^3 \end{matrix} \rangle \,,\qquad {\mathbb {P}}^{(3)} =\frac{1}{l_e^2} \begin{bmatrix} l_e^2&{}0&{}0&{}0\\ -9 l_e^2&{} 3 l_e^2 &{} 36 l_e^2 &{} -60 l_e^2 \\ 18 l_e&{}-12 l_e&{}-96 l_e&{}180 l_e\\ -10&{}10&{}60&{}-180 \end{bmatrix} \end{aligned}$$
(114)

with \( [\widehat{{\mathbf {u}}}_e^{(3)}]^T=\langle \begin{matrix} u_1\,,u_2\,,m_0 \,,m_1\end{matrix} \rangle \). With these matrices, the ansatz for the axial displacement can be written in general form

$$\begin{aligned} u_\pi ^{(n_u)}= {\mathbf {N}}_\pi ^{(n_u)}(x)\, {\mathbb {P}}^{(n_u)} \,\widehat{{\mathbf {u}}}_e^{(n_u)} \end{aligned}$$
(115)

The first and second derivatives needed in (109) follow as

$$\begin{aligned} u'_\pi {}^{(n_u)}= {\mathbf {N}}'_\pi {} ^{(n_u)}(x)\, {\mathbb {P}}^{(n_u)} \,\widehat{{\mathbf {u}}}_e^{(n_u)} \qquad \text{ and } \,\,\, u''_\pi {} ^{(n_u)}= {\mathbf {N}}''_\pi {} ^{(n_u)}(x)\, {\mathbb {P}}^{(n_u)} \,\widehat{{\mathbf {u}}}_e^{(n_u)} \,. \end{aligned}$$
(116)

The same procedure can now be applied for the approximation of the deflection w using the third- and fourth-order projectors in (65) and (81). Again we can write

$$\begin{aligned} w_\pi ^{(n_u)}= {\mathbf {N}}_\pi ^{(n_w)}(x)\, {\mathbb {P}}^{(n_w)} \,\widehat{{\mathbf {w}}}_e^{(n_w)} \end{aligned}$$
(117)

where now the ansatz polynomial \({\mathbf {N}}_\pi ^{(n_w)}\) and the projection matrix \({\mathbb {P}}^{(n_w)}\) are related to the virtual beam elements in Sects. 3.1 and 3.2. The first and second derivatives needed in (109) follow as

$$\begin{aligned} w'_\pi {}^{(n_w)}= {\mathbf {N}}'_\pi {} ^{(n_w)}(x)\, {\mathbb {P}}^{(n_w)} \,\widehat{{\mathbf {w}}}_e^{(n_w)} \qquad \text{ and } \,\,\, w''_\pi {} ^{(n_w)}= {\mathbf {N}}''_\pi {} ^{(n_w)}(x)\, {\mathbb {P}}^{(n_w)} \,\widehat{{\mathbf {w}}}_e^{(n_w)} \,. \end{aligned}$$
(118)

The previous set of equations is sufficient to establish discretizations for beams in one dimension since it is related to the local coordinate system of the straight beam axis. For more complex structures in which the beams are located in different positions, the matrices and vectors have to be transformed to a global coordinate system. This can be performed by a transformation of the local nodal displacements and rotations \({\mathbf {u}}_I^{loc}\) at a node I which then can be expressed in terms of the global variables \({\mathbf {u}}_I^{glob}\) via

$$\begin{aligned} \left\{ \begin{matrix} u_I\\ w_I\\ \theta _I \end{matrix} \right\} ^{loc}= \begin{bmatrix}\cos \alpha &{}\sin \alpha &{}0\\ -\sin \alpha &{} \cos \alpha &{} 0 \\ 0&{}0&{}1 \end{bmatrix} \left\{ \begin{matrix} u_I\\ w_I\\ \theta _I \end{matrix} \right\} ^{glob} \end{aligned}$$
(119)

The internal variable \(m_i\) is not affected by this transformation.

The ansatz functions in (115) and (117) and their derivatives in (116) and (118) can now be inserted in (109). This yields the strains in terms of the local nodal unknowns and internal variables. These can be transformed via (119) to the global variables. Finally, the strain measures are inserted into the potential (110)

$$\begin{aligned} U= \frac{1}{2} \int \limits _0^l \widehat{\varvec{\varepsilon }}^T \,{\mathbb {C}}\,\widehat{\varvec{\varepsilon } }\,\text{ d } x - \int \limits _0^l {\mathbf {u}}^T {\mathbf {f}} \, \,\text{ d } x \,. \end{aligned}$$
(120)

The approximation of the strain measures for an ansatz of order \(n_u\,,n_w\) is given by

$$\begin{aligned} \begin{aligned} {\widehat{\varepsilon }}&= \sqrt{\,[\,1+{\mathbf {N}}'_\pi {} ^{(n_u)}\, {\mathbb {P}}^{(n_u)} \,\widehat{{\mathbf {u}}}_e^{(n_u)} ]^2 + ({\mathbf {N}}'_\pi {} ^{(n_w)}\, {\mathbb {P}}^{(n_w)} \widehat{{\mathbf {w}}}_e^{(n_w)}) ^2}-1\,,\\ {\widehat{\kappa }}&= \frac{[\,1+{\mathbf {N}}'_\pi {} ^{(n_u)}\, {\mathbb {P}}^{(n_u)} \,\widehat{{\mathbf {u}}}_e^{(n_u)} ]\,{\mathbf {N}}''_\pi {} ^{(n_w)}\, {\mathbb {P}}^{(n_w)} \,\widehat{{\mathbf {w}}}_e^{(n_w)} -{\mathbf {N}}'_\pi {} ^{(n_w)}\, {\mathbb {P}}^{(n_w)} \,\widehat{{\mathbf {w}}}_e^{(n_w)} \, {\mathbf {N}}''_\pi {} ^{(n_u)}\, {\mathbb {P}}^{(n_u)} \,\widehat{{\mathbf {u}}}_e^{(n_u)} }{ [\, {\widehat{\varepsilon }}+1\,]^2} \,. \end{aligned} \end{aligned}$$
(121)

The displacement approximation which is needed in the loading term in (120) is provided in terms of the nodal unknowns by \( {\mathbf {u}}^T \approx \widehat{{\mathbf {u}}}^T = \langle {\mathbf {N}}_\pi ^{(n_u)}\, {\mathbb {P}}^{(n_u)} \,\widehat{{\mathbf {u}}}_e^{(n_u)} \,, {\mathbf {N}}_\pi ^{(n_w)}\, {\mathbb {P}}^{(n_w)} \,\widehat{{\mathbf {w}}}_e^{(n_w)} \rangle \).

Insertion of (121) into the potential (120) yields a nonlinear function of the nodal degrees of freedom \(U(\widehat{{\mathbf {u}}})\) from which the residual and tangent matrix follow for the selected ansatz order

$$\begin{aligned} {\mathbf {R}}^{(n_u,n_w)} = \frac{\partial U(\widehat{{\mathbf {u}}})}{\partial \widehat{{\mathbf {u}}}} \qquad \text{ and } \,\,\, {\mathbf {K}}^{(n_u,n_w)}_T = \frac{\partial {\mathbf {R}}(\widehat{{\mathbf {u}}})}{\partial \widehat{{\mathbf {u}}}} \,. \end{aligned}$$
(122)

The differentiations are performed using automatic code generation tool AceGen, developed by [9], see also [10], which then generates the residual vector and tangent matrix.

5.2 Numerical example and comparison of different discretizations

With an example, we want to demonstrate the behavior of different formulations in the nonlinear range. A frame as depicted in Fig. 5a is loaded by a point load in vertical direction. It is simply supported at the bottom and the top right. The material data are given as follows: bending stiffness \( EI = 2\cdot 10^5\), axial stiffness \(EA=10^6\). The width of the frame is equal to its height (\(l=h=300\)); 20 beam elements are applied to discretized the structure, see Fig. 5b.

Fig. 5
figure 5

a Frame with vertical load and b discretization

The solution using virtual elements with different ansatz functions is studied in this example. We apply a classical Euler–Bernoulli beam element with linear ansatz for the axial displacement and cubic ansatz for the deflection. This element is named ”1st/3rd”. Such ansatz is not optimal since it will neglect the terms related to \(u''\) in the curvature term in (109). To account for a better approximation of u, an element is generated that uses a cubic ansatz for the axial displacement besides the cubic one for the deflection. This element is labeled ”3rd/3rd”. In order to see how a higher-order ansatz for the deflection affects the convergence behavior of the virtual beam elements a \(4^{th}\)- order ansatz is selected for the deflection together with a quadratic and cubic ansatz for the axial displacement. The related elements are named ”2nd/4th” and "3rd/4th,” respectively. For all formulations, the same discretization is used in order to investigate the effect of different ansatz orders.

All these element formulations are based on the Euler–Bernoulli theory. The results will be compared with with a simple finite element based on a Timoshenko theory, see, e.g., [14], which has a linear ansatz for the axial displacement, the deflection and the rotation. It is denoted by ”1st/1st.”. Different formulations are compared with respect to the response of the frame due to an increasing load. The load is increased in steps of \(\Delta F=5\) which yields the load deflection curves depicted in Fig. 6

Fig. 6
figure 6

Load deflection curves for several discretizations where the load is plotted versus the deflection under the load

It is interesting to see that the virtual element ”1st/3rd” which does not approximate all terms in the strain measure correctly yields a too stiff response. This is also true for the ”2nd/3rd” and ”2nd/4th” virtual element which has a quadratic ansatz for the axial displacement and only yields a constant term for \(u''\). Thus, the axial displacement in the nonlinear strain measure has to be approximated with at least a cubic ansatz to obtain results that are equivalent to the Timoshenko–Reissner finite beam element with linear ansatz functions for all terms for the given coarse mesh resolution. However, by raising the ansatz order for the deflection the virtual element produces better results which are also better than the ones using Timoshenko beam element with the same discretization. We remark that the result of the discretization using the ”3rd/4th” element with 20 virtual elements is equivalent to the converged solution of the Timoshenko–Reissner beam formulation with 2000 finite elements, as depicted in Fig. 6.

The deformed configuration at a load level of \(F=45\), solved by using the ”3rd/4th” virtual element, is shown in Fig. 7 which underlines the capability of the virtual elements to model nonlinear behavior leading to large deflections and rotations with high coarse mesh accuracy.

Fig. 7
figure 7

Deformed configuration for \(F=45\) using the virtual element ”3rd/4th”

6 Conclusion

Virtual element formulations were developed for truss and beam elements using different ansatz orders. The elements have the advantage that only the nodal values at the ends of the elements enter the formulation together with internal variables (moments) for higher-order ansatz functions. For the ansatz with lowest possible order (truss linear, beam cubic), the virtual elements coincide with classical finite elements. For higher-order ansatz functions, the virtual elements differ from known finite element formulations. The new virtual elements can be applied to linear and nonlinear problems.