# How to include prescribed boundary conditions in the Ritz Method

Using the Ritz method to find the displacement field in structural analysis can be done as follows. $U$ and $V$ are recpectively the internal and external energy components of a given structural element:

$$U+V=W$$

Expressing $U$ in terms of the strains $\varepsilon$ and the material consitutive matrix $F$: $$\frac12\int_V{\varepsilon^TF\varepsilon}dV + V=W$$ Representing the strains by $\varepsilon=Bu$, where $B$ is a matrix containing the kinematics derivatives and $u$ is the displacement vector: $$\frac12\int_V{u^TB^TFBu}dV + V=W$$ The exact displacement field $u$ can be approximated aa a set of Ritz trial functions:

$$u=g\{c\}+u_0$$

where $c$ are the Ritz constants and $u_0$ is a vector containing the prescribed displacements. Assuming that $V=K_2\{c\}$, the energy equation becomes:

$$U_0 + \left(\frac12\{c\}^TK_1 + K_2\right)\{c\}=W$$

with:

$$U_0=\frac12\int_V{u_0^TB^TFBu_0}dV$$ $$K_1=\int_V{g^TB^TFBg}dV$$

Applying the principle of total virtual work, which states that when a virtual change in the displacement field takes place there will be a corresponding change in the strain state (internal energy) so that the virtual change in the total work is zero:

$$\delta\left(U_0 + \left(\frac12\{c\}^TK_1 + K_2\right)\{c\} \right) =\delta W$$

$$\delta U_0 + \delta\left(\left(\frac12\{c\}^TK_1 + K_2\right)\{c\}\right) = 0$$

Part of this equation has the same format as this other answer. Using the same steps described there, this equation becomes:

$$\delta U_0 + K_1\{c\} + K_2 = 0$$

The question is: what to do with $U_0$ ? I want to solve $\{c\}$ considering the prescribed boundary conditions included in $U_0$, but from the equation above it seems that they will vanish in the variational statement. $U_0$ is a scalar value.

There was a simple mistake with catastrophic effects in my derivation.

From the question, recall that the exact displacement field $u$ can be approximated aa a set of Ritz trial functions:

$$u=g\{c\}+u_0$$(1)

where $c$ are the Ritz constants and $u_0$ is a vector containing the prescribed displacements. Assuming that $V=K_2\{c\}$, I made a false jump to this:

$$U_0 + \left(\frac12\{c\}^TK_1 + K_2\right)\{c\}=W$$(2)

Let's go back some steps and compare the results. The total potential work before substituting the approximated displacement field of Eq. (1) is:

$$W=\frac12\int_V{u^TB^TFBu}dV + V$$

Using the approximated displacement field of Eq. (1), and assuming that $V=K_2\{c\}$:

$$W=\frac12\int_V{ \left( \{c\}^Tg^T + u_0^T \right) B^TFB \left( \{c\}g + u_0 \right) }dV + K_2\{c\}$$

Here was the pitfall, I did not apply the distributive, which would give:

$$W = \frac12\{c\}^T \left( \int_V{ g^TB^TFBg }dV \right) \{c\} + \frac12 \{c\}^T \left( \int_V{ g^TB^TFBu_0 }dV \right) + \frac12 \left( \int_V{ u_0^TB^TTFBg }dV \right) \{c\} + \frac12 \int_V{ u_0^TB^TFBu_0 }dV + K_2\{c\}$$(3)

defining:

$$K_1 = \int_V{ g^TB^TFBg }dV$$ $$K_0 = \int_V{ u_0BTFBg }dV$$ $$U_0 = \frac12\int_V{ u_0^TB^TFBu_0 }dV$$

Rewritting Eq. (3):

$$W-U_0 = \frac12 \{c\}^T K_1 \{c\} + \frac12\{c\}^TK_0^T + \frac12K_0\{c\} + K_2\{c\}$$

Grouping the terms, recalling that $K_0\{c\}=\{c\}^TK_0^T$:

$$W-U_0 = \left( \frac12 \{c\}^T K_1 + K_0 + K_2 \right) \{c\}$$

Applying the principle of virtual work:

$$\delta( W-U_0 ) = 0 = \delta \left( \left( \frac12 \{c\}^T K_1 + K_0 + K_2 \right) \{c\} \right)$$

Note that $\delta W =0$ and $\delta U_0 = 0$, because the variational statement is build for the Ritz constants $\{c\}$. Following the same approach described in this other answer, the following equation can be obtained:

$$K_1\{c\} + K_0 + K_2 = 0$$

Which can be solved for $\{c\}$. Here the prescribed boundary conditions are included in $K_0$. compare this solution with the solution presented here, without prescribed boundary conditions.