The magnetic network extending from the photosphere (solar radius ≃ R⊙) to the lower corona ( R_⊙ +10 Mm) plays an important role in the heating mechanisms of the solar atmosphere. Here we develop further the models of the authors with realistic open magnetic flux tubes, in order to model more complicated configurations. Closed magnetic loops and combinations of closed and open magnetic flux tubes are modelled. These are embedded within a stratified atmosphere, derived from observationally motivated semi-empirical and data-driven models subject to solar gravity and capable of spanning from the photosphere up into the chromosphere and lower corona. Constructing a magnetic field comprising self-similar magnetic flux tubes, an analytic solution for the kinetic pressure and plasma density is derived. Combining flux tubes of opposite polarity, it is possible to create a steady background magnetic field configuration, modelling a solar atmosphere exhibiting realistic stratification. The result can be applied to the Solar and Heliospheric Observatory Michelson Doppler Imager (SOHO/MDI), Solar Dynamics Observatory Helioseismic and Magnetic Imager (SDO/HMI) and other magnetograms from the solar surface, for which photospheric motions can be simulated to explore the mechanism of energy transport. We demonstrate this powerful and versatile method with an application to HMI data.