  Active regions (ARs) are typical magnetic structures found in the solar
atmosphere. We calculate several magnetohydrostatic (MHS) equilibrium models
that include the effect of a finite plasma-$\beta$ and gravity and that are
representative of these structures in three dimensions. The construction of the
models is based on the use of two Euler potentials, $\alpha$ and $\beta$, that
represent the magnetic field as ${\bf B}=\nabla \alpha \times \nabla \beta$.
The ideal MHS nonlinear partial differential equations are solved numerically
using finite elements in a fixed 3D rectangular domain. The boundary conditions
are initially chosen to correspond to a potential magnetic field (current-free)
with known analytical expressions for the corresponding Euler potentials. The
distinctive feature is that we incorporate the effect of shear by progressively
deforming the initial potential magnetic field. This procedure is quite generic
and allows us to generate a vast variety of MHS models. The thermal structure
of the ARs is incorporated through the dependence of gas pressure and
temperature on the Euler potentials. Using this method we achieve the
characteristic hot and over-dense plasma found in ARs, but we demonstrate that
the method can also be applied to study configurations with open magnetic field
lines. Furthermore, we investigate basic topologies that include neutral lines.
Our focus is on the force balance of the structures and we do not consider the
energy balance in the constructed models. In addition, we address the difficult
question of the stability of the calculated 3D models. We find that if the
plasma is convectively stable, then the system is not prone in general to
develop magnetic Rayleigh-Taylor instabilities.
