Unraveling the mechanisms of packing of DNA inside viral capsids is of fundamental importance to understanding the spread of viruses. It could also help develop new applications to targeted drug delivery devices for a large range of therapies. In this article, we present a robust, predictive mathematical model and its numerical implementation to aid the study and design of bacteriophage viruses for application purposes. Exploiting the analogies between the columnar hexagonal chromonic phases of encapsidated viral DNA and chromonic aggregates formed by plank-shaped molecular compounds, we develop a first-principles effective mechanical model of DNA packing in a viral capsid. The proposed expression of the packing energy, which combines relevant aspects of the liquid crystal theory, is developed from the model of hexagonal columnar phases, together with that describing configurations of polymeric liquid crystals. The method also outlines a parameter selection strategy that uses available data for a collection of viruses, aimed at applications to viral design. The outcome of the work is a mathematical model and its numerical algorithm, based on the method of finite elements, and computer simulations to identify and label the ordered and disordered regions of the capsid and calculate the inner pressure. It also presents the tools for the local reconstruction of the DNA "scaffolding" and the center curve of the filament within the capsid.