The mechanical properties of many materials, such as concrete, cast iron, rocks, some structural graphites, refractory ceramics, etc., which are usually porous materials with an inhomogeneous structure, depend on the type of stress state. This manifests itself in the absence of unified diagrams of the relationship between stress and strain intensity for various types of stress state. Such dependence is typical of the materials characterized by the growth of deformation in the nonlinear region of deformation. For these materials, the processes of volumetric and shear deformation are interrelated, which is expressed in the appearance of volumetric deformations during torsion. When the linear constitutive relations are used to analyze the torsion problems of such materials, a significant error occurs. The parameter characterizing the type of stress state can be, for example, the ratio of the average stress to the stress intensity. This paper considers the linear constitutive relations, which take into account the dependence of the mechanical properties of the material on the type of stress state. The results of numerical solution of the problem of torsion of a circular pipe by reducing it to a system of ordinary differential equations are presented. The system of differential equations is solved using the 4-order Runge-Kutta method with automatic step selection and error estimation. The features of the implementation of the method are discussed. In the second part of the article, the results of numerical modeling of torsion problems of a circular pipe are described using a finite element analysis software, for which a special library that implements the considered constitutive relations is written. The features of the finite element analysis which were taken into account when writing the library code are shown. The results of the calculations demonstrate the presence of axial deformation during torsion. The results obtained by different methods are compared.