A software package for solving grid equations in areas with geometry "stretched" along one of the spatial directions

. A method for solving grid equations in areas with geometry "stretched" along one of the spatial directions is proposed. Method proposed for model includes pollutants whose concentration in the Azov Sea, according to the analysis of scientific publications and environmental databases, exceeds the maximum permissible concentration (MPC). The mechanism of the preconditioner formation is described. The estimation of the minimum and maximum eigenvalues is performed. Using object-oriented analysis and design, a class library has been implemented to solve the problem of impurity propagation in a shallow reservoir. The architecture of an information system to support scientific research capable of functioning in conditions of using heterogeneous computing environments is described. The system is based on the requirement of the maximum possible use of free software in order to minimize capital and operational costs. The system uses classes that allow you to read and write information about the geometry of the object under study and the parameters of the calculated grid. Numerical experiments were carried out using the developed software package, including the proposed mathematical model, focused on the multiprocessor computing system (MCS). The dependences of the SLAE solution time on the number of diagonals and the order of the matrix are obtained. The number of iterations for solving grid equations has been experimentally determined depending on the ratio of the number of nodes in spatial coordinates.


Introduction
Among the works devoted to mathematical modeling of problems of hydrodynamics and hydrobiology, in particular the spread of pollutants in coastal systems, are the works of Russian scientists Matishov G.G., Muraveyko V.M., Berdnikov S.V., Ilyin G.V., Zuev A.N., Ilyichev V.G., Kravchenko V.V., etc.Leading foreign research centers and organizations, such as: Sweden's Meteorelogical and Hydrological Institute (SMHI, Sweden); Center for Water Research (CWR, Australia); National Oceanic and Atmospheric Administration (NOAA, USA); Centre for Ecology and Hydrology (CEH, Wallingford, United Kingdom); Korea Research Institute of Ships and Ocean Engineering (KRISO, Korea) are engaged in the development of information systems and software systems designed for predictive modeling and monitoring of aquatic ecosystems, which allow to obtain a detailed description of the objects under study [1][2].At the same time, the urgent task is to develop effective information systems focused on use in high-performance heterogeneous computing environments that allow real-time forecasts of the development of various emergencies [3][4][5][6][7].
The paper considers algorithms and software modules that implement the solution of grid equations in areas with geometry "elongated" along one of the spatial directions" arising from the numerical solution of problems of hydrodynamics and hydrobiology [8].

Problem statement
Let's consider the complete 3D system of equations of the pollutant distribution, including the oil and its refined products, in the computational domain -Azov Seawith the side surface ó , the water undisturbed surface 0  , the bottom H  , the variable depth Н in the Cartesian coordinate system for the axes Oz, Oy, Ox, directed vertically downwards, to the north and east, respectively.The model is based on the researches [9,10] and has the following form: The model includes pollutants whose concentration in the Azov Sea, according to the analysis of scientific publications and environmental databases, exceeds the maximum permissible concentration (MPC) [11][12][13][14].This model takes into account the water flow movement; microturbulent diffusion; interaction and gravitational subsidence of pollutants and plankton; biogenic, temperature and oxygen regimes; the influence of salinity.
Let's define the initial conditions: 0 (x, y, z,0) S (x, y, z), The computational domain G it is a closed area bounded by the undisturbed water surface 0  , the bottom ( , ) where i õ is the of i-th component by the bottom material;  is the given function.
We took into account the water exchange with the Black Sea, the flow of the Don River, the complex shape of the coastline, and the bottom relief at setting the boundary conditions.

Method for solving grid equations
As a result of the discretization of equations ( 1) -(4), we obtain a system of grid equations in matrix form: where A is a self-adjoint, positive definite Imagine A in the form: where  is the square tridiagonal matrix containing coefficients of grid equations for terms describing finite differences for second-order partial derivatives along all axes.The operator D  in the case of boundary conditions of the 2nd and 3rd kind ( 0 ô ó ) will be written as: The method of solving problem (5) will be based on an implicit iterative process: where B is the preconditioner, whose handling is significantly simpler than the original operator A in (5); n is the iteration number, 1 0 Equation (8) in the case of a stationary iterative process is represented as: ( ) . x will differ from the exact solution x by the amount of error n z : n n x x z =+ .Then equation ( 9) with respect to the error will be written as follows: .
multiply both parts of the last expression by 1/ 2 B , as a result we get: Let's introduce the replacement of variables: we get: ) .
The iterative process converges when the conditions are met: where ò is the parameter describing the convergence rate of the iterative method.
In equality ( 11) is represented as:

−+ 
Parameters ò and ô are from conditions min max 1 1 , : Here min , ü max ü are minimum and maximum values of the eigenvalues of the operator C , þ is the number of conditionality of the operator C .
The preconditioner will be formed as follows: .
Let's estimate the maximum eigenvalue taking into account the equalities Taking into account expressions ( 12), ( 13), the estimate of the maximum eigenvalue will have the form: ( Let 's estimate the minimum eigenvalue: The operation of stationary iterative methods requires a priori information about the values of the maximum and minimum eigenvalues of operators.In the case of choosing a preconditioner in the form of (15) for an arbitrary geometry of the computational domain, the complexity is caused by estimating the minimum proper number z  .

Architecture of the software module
Computer modeling of the assigned tasks, while meeting the requirements for accuracy and calculation speed, requires large computing resources that are not always available in production conditions.To increase the efficiency of using available technical means, the architecture of an information system for supporting scientific research is proposed, capable of functioning in conditions of using heterogeneous computing environments.
The system is based on the requirement of the maximum possible use of free software in order to minimize capital and operating costs.As the main operating system, it is proposed to use Ubuntu Server 22.04 with the nginx http server installed, the MariaDB database management system and the platform.NET Core 6.The application software of the system is developed in the form of a server part implemented as an ASP .NET Core MVC web application, and the client part, which is a number of services installed on all involved calculators.The interaction between these components of the system is provided through the use of the SignalR library.
The server part provides the solution of the following tasks: − management of user accounts of the system, including the assignment of roles; − configuration management of available computing resources; − managing the process of uploading simulation tasks to the server in the form of rpm packages; − managing the task monitoring service.The system and application software development process is managed using the Git version control system.Developers are working with the system's code base on their workstations, where local repositories of system component projects are deployed, synchronized with a remote repository accessible via a web service based on the Git version control system.
The system deployment, configuration and operation processes are managed by the administrator using any available SSH client, for example, ssh for Linux console terminal or Bitvise SSH Client for Windows.
The developed system is built using the principles of object-oriented design (Figure 1).The system is based on classes that allow reading and writing information about the geometry of the object under study and the parameters of the computational grid.These classes should implement the IGeometrySerializer and IgridSerializer interfaces, respectively.The initialized objects of the specified types are used to create Geometry Geometry objects and the Grid calculation grid, on the basis of which an object of the GridGeometryPreCalculated class is created, which is a geometry object with a superimposed calculation grid and precalculated parameters, such as, for example, node characteristics: internal, boundary or fictitious.
In order to provide the possibility of intermediate data storage for continuing calculations in case of emergency situations or transferring the task for calculation to other computing nodes, the gridgeometryprecalculated object is connected by an aggregation relationship with the IgridGeometryPreCalculat-edSerializer interface.Classes implementing the IgridGeometryPreCalculatedSerializer interface solve the tasks of serializing data in various formats (xml, json, storing data in relational databases, etc.).
The configured GridGeometryPreCalculated object is used when creating the SolverTask calculation task object, during which the user sets a number of modeling characteristics, the most important of which are the model parameters and the derivative calculation template.
Directly modeling is performed by the Solver class, which uses objects of the SolverTask class as tasks.The features of the Solver class are the possibility of dynamic control of computing devices by means of an aggregation relationship with an object of the IDeviceManager interface and the provision of work with an object of a system of linear algebraic equations by means of a composition relationship with an object of the SLAE class.
A distinctive feature of the SAE class is working with the Matrix object Matrix.The implementation of this interface in the work is the SparseMatrixRepSeq class, which provides efficient data storage with the elimination of duplication.

Results
The software implementation of the computational model in C# is based on the developed class library, which allows working with coordinates, geometry of the object under study (Figures 2, 3), consisting of a set of geometric primitives and computational grids The system allows you to set coordinates for one-dimensional (Coordinate1D class), twodimensional (Coordinate2D class) and three-dimensional (Coordinate3D class) coordinate systems.Coordinate classes are inherited from the abstract Coordinate class, which is directly used in computational algorithms.
The Geometry 1D, Geometry2D, and Geometry3D classes for describing the geometric shape of the objects under study are inherited from the Geometry abstract class and define one-dimensional, two-dimensional, and three-dimensional geometries, respectively.
The Geometry abstract class implements the operations of writing and reading data in XML format using the methods ExportToXml and ImportFromXml.
The most important element of the Geometry Abstract Class is the Geometry Elements property of the List<GeometryElement> type, which stores a set of geometry elements.

Fig. 2. Hierarchy of geometry classes
Geometry elements are also implemented for one-dimensional, two-dimensional and threedimensional cases in the form of successor classes of the abstract GeometryElement class, respectively GeometryElement1D, GeometryElement2D and GeometryElement3D.
The GeometryElement abstract class allows you to save the coordinates of the location of a geometry element inside a geometry object by initializing the CoordinateLocation property, work with the characteristics of materials through the MaterialCharacteristic property, and also saves a set of geometric primitives that make up this geometric element through the GeometryPrimitives property of the List<GeometryPrimitive> type.The class library allows you to work with one-dimensional, two-dimensional and threedimensional primitives by creating and initializing class objects co-responsibly GeometryPrimitive1D, GeometryPrimitive2D and GeometryPrimitive3D.These classes are inheritors of the Geometry Primitive abstract class.A one-dimensional primitive is a segment defined by the GeometryPrimitive1DLineSegment class, which is the successor of the Geome-tryPrimitive1D class.Two-dimensional primitives include the Genome-tryprimitive2dsquare rectangle, the GeometryPrimitive2DEllipse ellipse, and a free twodimensional shape defined by an array of coordinates of the boundary points of the GeometryPrimitive2DManualByCoordinates shape.Three-dimensional primitives include objects of the GeometryPrimitive3DParallelepiped and GeometryPrimitive3DCube classes, modeling a parallelepiped and a cube, respectively.
The geometric primitive abstract class contains the coordinates in element property of the coordinate type, which stores the coordinates of the location of the primitive relative to the coordinate of the geometric element.The IsCavity property of the bool type determines whether the primitive is a "cut-out" of the space.
Work with computational grids is provided by means of classes-heirs of the abstract Grid class: Grid1Dclass for working with a one-dimensional computational grid; Grid2Da class for working with a two-dimensional computational grid; Grid3Da class for working with a three-dimensional computational grid.
A distinctive feature of these classes is the ability to set an uneven calculation grid by filling in the StepTransitions lists for Grid1D, StepTransitions1 and StepTransitions2 for Grid2D, StepTransitionsX, StepTransitionsY and StepTransitionsZ for Grid3D.The Grid3D class has a mechanism for inserting "layers" of the grid using the methods InsertLayerX, InsertLayerY and In-sertLayerZ.

Discussion
A numerical experiment was carried out using the developed software package, including the proposed mathematical model, focused on the MCS.The algorithm of preliminary estimation of the time spent on the task execution based on the data of preliminary testing of the performance of the hardware platform is used.At the time of launching the control module of the computer system, the presence of the file is checked performance.xml.In the absence of a file, performance tests are performed, representing a number of tasks for solving SLOWS with different parameters, and their results are recorded in a file.The obtained data on the performance parameters are then used by the control modules of the computer system in the process of controlling the process of queuing the calculation problem based on the algorithm shown in Figure 5.
A numerical experiment was carried out to measure the number of iterations depending on the ratio of the number of nodes by spatial coordinates.Table 1 shows that the number of iterations required to solve the SLAE decreases from 256 to 36 with an increase in the Nx/Nz ratio.

Conclusions
A software implementation of the proposed method for solving grid equations for solving problems in areas with geometry "stretched" along one of the spatial directions has been developed.The architecture of the class library information system for solving the problem of impurity propagation in a shallow reservoir is described.The system is based on the requirement of the maximum possible use of free software in order to minimize capital and operating costs.Numerical experiments were carried out using the developed software package, including the proposed mathematical model, focused on the MVS.The dependences of the SLAE solution time on the number of diagonals and the order of the matrix are obtained.The number of iterations for solving grid equations has been experimentally determined depending on the ratio of the number of nodes in spatial coordinates.The number of iterations required to solve the SLA decreases from 256 to 36 with an increase in the Nx/Nz ratio, which indicates the high efficiency of the proposed method.

Fig. 1 .
Fig. 1.Generalized class diagram of the developed software package

Fig. 4 .
Fig. 4. Dependence of the SLAE solution time on the number of diagonals and the order of the matrix

Table 1 .
The results of a numerical experiment to measure the number of iterations depending on the ratio of the number of nodes in spatial coordinates.