scieee AI-readable full text Open interactive document viewer

Study of the modelling of the behaviour of a jet engine

Balado Ordax, Ramiro

Abstract

This thesis explores the necessities of simulators of the behaviour of turbomachinery and proposes an implementation of such a simulator. This simulator consists in the model of a turbojet, which is described and implemented, and an algebra subsystem that takes the model and produces a viable solution. Models for the different components of a turbojet are described. An algebra subsystem analogous to SPICE for electric circuits is proposed and developed. The results are examined, analyzed and discussed

Full text

Aeronautical Engineering Masters Thesis Study of the Modelling of the Behaviour of a Jet Engine Report Balado Ordax, Ramiro Thesis Director: Nejjari Akhi-elarab, Fatiha April 2021 Abstract This thesis explores the necessities of simulators of the behaviour of turbomachinery and proposes an implementation of such a simulator. This simulator consists in the model of a turbojet, which is described and implemented, and an algebra subsystem that takes the model and produces a viable solution. Models for the different components of a turbojet are described. An algebra subsystem analogous to SPICE for electric circuits is proposed and developed. The results are examined, analyzed and discussed. Contents 1 Introduction 1 1.1 Scope ......................................... 1 1.2 Requirements .................................... 1 1.3 Background ..................................... 2 1.3.1 Causal modeling .............................. 3 1.3.2 Non-causal modeling ........................... 5 2 Architecture 7 2.1 Requirements .................................... 7 2.2 Clean Architecture ................................. 7 2.3 Domain Architecture ................................ 8 2.4 Program Architecture ................................ 9 2.5 Infrastructure .................................... 10 3 Component Model 13 3.1 Gas source ...................................... 14 3.2 Turbine ........................................ 15 3.3 Combustor ...................................... 16 3.4 Boundaries ...................................... 16 3.4.1 Fluid Boundary ............................... 17 3.4.2 Axial Boundary ............................... 18 3.5 Component assembly ................................ 18 3.6 Case Study: BMT 120 KS .............................. 19 3.6.1 Geometry .................................. 19 3.6.2 Performance ................................. 20 4 Algebra Subsystem 23 4.1 Gradient Descent .................................. 23 4.2 Lagrange multipliers ................................ 24 4.3 Newton-Raphson method ............................. 24 4.4 Halley’s method ................................... 25 4.5 Implementation ................................... 25 4.5.1 Jacobian matrix ............................... 27 5 Simulation Results 29 5.1 Stable solution .................................... 29 5.2 Convergence of the simulation .......................... 30 5.2.1 Dependence on relaxation factor ..................... 34 5.3 Operating line .................................... 37 6 Conclusions 41 7 Future Work 43 List of Figures 1.1 Common uses of turbines ............................. 3 1.2 Causal model of a double spool turbojet[1]................... 4 2.1 Overview of the relationship of the core subsystems .............. 8 2.2 Architecture of the program with two types of requests using the same use case .......................................... 9 3.1 Diagram representing a single spool turbojet .................. 13 3.2 Diagram with models and boundaries ...................... 18 3.3 Schematized geometry of the boundaries of the turbine ............ 19 3.4 Compressor performance map. Pressure ratio [6]............... 21 3.5 Compressor performance map. Isentropic efficiency [6]............ 21 3.6 Turbine performance map. Pressure ratio [6].................. 22 3.7 Turbine performance map. Isentropic efficiency [6].............. 22 4.1 One iteration of Newton’s method for a 1D problem. ............. 24 5.1 Values for temperature, pressure and velocity at each boundary. ...... 30 5.2 Temperature, pressure and velocity in a typical jet engine.[12]........ 31 5.3 Iterations to converge, ω=0.5 .......................... 32 5.4 Solution drift, ω=0.5 ............................... 32 5.5 Iterations to converge, stable variables, logarithmic axis, ω=0.5 ...... 33 5.6 Iterations to converge, unstable variables, logarithmic axis, ω=0.5 ..... 33 5.7 Iterations to converge, ω=0.25 .......................... 34 5.8 Solution drift, ω=0.25 ............................... 35 5.9 Iterations to converge, ω=0.75 .......................... 35 5.10 Solution drift, ω=0.75 ............................... 36 5.11 Iterations to converge, ω=1.0 .......................... 36 5.12 Solution drift, ω=1.0 ............................... 37 5.13 Variables as a function of fuel mass flow .................... 38 List of Tables 3.1 Section dimensions ................................. 20 5.1 Values for the different parameters in the simulation ............. 29 5.2 Invalid results for different values of ω...................... 37 Chapter 1 Introduction This study has the objective of exploring the necessities and possibilities when simulating the behavior of a turbomachine. In order to do this, we will take a hands on approach as we develop each of the necessary subsystems and encounter their limitations and behavior when these subsystems are combined. More specifically, the main objective of this project is to successfully study, design and develop a system to simulate the behaviour of turbomachinery based on its constitutive components. This system must be easily adaptable and extensible, so that new constitutive components can be easily developed and integrated into it. Once this system has been developed, it will be executed and the results that are produced will be analyzed for convergence and adequacy. The modelling of the components will be developed in Chapter 3. The development of the solver for non-linear system of equations will be discussed in Chapter 4. The execution of the program and the analysis of the results that are produced will be discussed in Chapter 5. 1.1. Scope The scope of this work consists in the following points: • Design and verification of a non-linear equation solver. • Design and verification of turbomachinery component models. • Analysis of the results. 1.2. Requirements • System that solves non-linear equations. • Model for a gas source component. 1 Masters Thesis •Ramiro Balado Ordax •April 2021 called the Domain, which implements the necessary business logic. Any behavior that is directly related to how the program is required to behave should be implemented here. The next layer outwards, which serves to interact with the domain, is the application layer. Its purpose is to allow user agents to interact with the domain, irrespective of which way they require to do so. These use cases serve to connect and allow the flow of data from diferent parts of the domain. It serves as the glue that connects and provides access to common actions that user agents might want to run. The outermost layer is the infrastructure layer. This layer adapts the specific way in which a user agent might interact with the system and adapts the input/output received so that the application layer can accept it. This layer will of course implement any input parsing from the command line or standard input, but also needs to implement the connection to other external services, such as databases or filesystems. By separating the use case from its infrastructure counterpart, we allow for the possibility to give access to the same use case from different sources, such as command line parameters, standard input, network sockets or a messaging system. By following these rules, we make sure dependencies only point inward, that is, an inner layer will never depend on an outer layer. Instead, it will depend on an interface defined on a deeper layer. In other words, we make sure the dependency inversion principle is maintained from the outer layers inwards. 2.3. Domain Architecture Keeping all these requirements in mind, the final domain architecture was designed to facilitate the decoupling and replaceability of each subsystem, while being relatively simple to describe, develop, operate and maintain. An overview in broad strokes of the domain of the system can be observed in Figure 2.1. Algebra Subsystem : Component Model : Variable : Constraint : Observes Modifies Defines Reads Figure 2.1: Overview of the relationship of the core subsystems The Algebra subsystem has the basic task of finding the adequate values for the variables for which all the constraints are maintained. The way this is accomplished will be described in detail in Chapter 4. The Model subsystem has the task of modelling the system that we want to solve. In essence, the Model defines the relationship between the constraints, and the variables 8 Masters Thesis •Ramiro Balado Ordax •April 2021 these constraints depend on. The Model is described in more depth in Chapter 3. The Variables serve the essential purpose of describing the state of the system. It is these variables that determine the current estimate that best fits the model. The Constraints model equations of the form f(~ x) = 0 and serve the purpose of giving the algebra subsystem information about how far the system is from convergence, and how changing each Variable affects them. The algebra subsystem can request the value of each constraint and its derivative with respect to any given variable, and based on that modify the current variables to better approximate the solution. As can be seen, the algebra and model subsystems do not depend on each other, but instead depend on a common interface composed of Variables and Constraints. There are additional domain services that help in encapsulating and segregating the behavior of each of the subsystems, like Register classes, tasked with keeping track of the necessary instances of constraints, variables and models, and Model Factories, which help in the creation and registration of the model instances. 2.4. Program Architecture The wider program architecture is developed in a way to give access to the different use cases that are implemented. Each use case is implemented the same way the domain is implemented, by taking any dependencies from the domain that it needs. The next layer is the infrastructure layer, which groups console command controllers, http controllers and event listeners, and their routers. The specific way in which these are called is up to the router, but they ought to provide a generic interface that allows for routing the requests,commands or events properly to the destinations. All of these controllers are grouped and executed by the appropriate router. This class routes the commands, requests or events based on their destination. A graphical representation of a typical command or request flow is depicted in Figure 2.2. HTTP Request Console Command Figure 2.2: Architecture of the program with two types of requests using the same use case For now, the behavior of the system is fully determined by the command line parameters that are given. As such, the class App parses the command line parameters and forwards them to the appropriate controller based on a simple routing table. If the system 9 Masters Thesis •Ramiro Balado Ordax •April 2021 was interactive we would need an additional class that would implement the event loop and dispatch each event to the registered listeners. In order to encapsulate the instantiation of this class, a Kernel class helps with the wiring of all the dependencies of each class and the instantiation of the App. This could be easily replaced with a dependency injection framework, but it is not necessary for now. It is worth mentionting that by taking the required dependencies in the constructor, we are explicitly avoiding the ’Service locator’ antipattern, which consists in a Service locator class that is passed to all other classes and helps them find their dependencies. The reason this antipattern is very noxious is widely documented. From lack of testability and opacity of dependencies to turning compilation errors into runtime errors. We also want to avoid the ’Courier’ antipattern. This antipattern emerges when we request values through the constructor parameters that are not needed by the class, simply to forward them to the constructor of member objects. Instead, we should request that any of these member objects be already constructed, and ask for a instance of the member object that we need. A related antipattern is the ’Control Freak’ antipattern, which consists of creating our own dependencies, instead of asking for them to be given externally. If we follow these rules, the development of the program will be much easier and painless. Each class has its dependencies declared on the constructor, which means they can be easily tested. Additionally, by having a Kernel and App class that encapsulates the running of the entire program, the main function is greatly simplified. It could be even written in a single line, but to increase readability, it will be split into three lines, as such: Listing 2.1: main.cpp 1#include " Kernel . hpp " 2 3int main(int argc, char** argv ) { 4auto kernel = Kernel(); 5auto app = kernel . build (); 6return app ->run(argc , argv); 7} 2.5. Infrastructure As C++ is a compiled language, a build system has to be used. The build system used in the project is cmake, helped by conan, a dependency management system. Conan can be configured through two different configuration files. In this case, the conanfile.py Python version has been used, as it allows for greater flexibility. As for dependencies, the only dependency of the code is Eigen, a library for linear algebra. As this library is header-only, it does not have to be precompiled and linked. It will be compiled as it is needed. Nevertheless, conan makes sure the library is accessible and at the right version. Other libraries, such as localization or database libraries, could be added as well, but it has been considered unnecessary, as currently the program has no need for any other kind of feature that would require a library. 10 Masters Thesis •Ramiro Balado Ordax •April 2021 In order to guarantee the repeatability of the compilation process, the compilation will take place in a docker container. This docker container contains conan and the necessary compiler to compile the project. 11 Chapter 3 Component Model The basic premise of the model is to be able to define a turbomachinery based on its constitutive parts. These parts should be connected to each other through standardized interfaces or boundaries. As a reference, we will describe the basic components necessary to describe a single spool turbojet. A single spool turbojet can be split into a few distinct modules, as shown in Figure 3.1. Figure 3.1: Diagram representing a single spool turbojet Air enters the turbojet from the atmosphere, in this case modelled as an inlet tank, gets compressed by the compressor, gets ignited and its temperature raised in the combustor, expands through the turbine and exits into the atmosphere, again modelled as the outlet tank. The energy extracted from the fluid in the turbine is transmitted through an axle to the compressor, so that it can compress the fresh air. These components can be reduced to three canonical components: The inlet and outlet tanks can be modelled as a gas source and are described in Section 3.1. The compressor and turbine both transform fluid energy into mechanical energy. As such, they’ll be modelled within the same component described in Section 3.2. Finally, the combustor will be described in Section 3.3. In order to interconnect all the components we will need boundaries that allow for fluid and mechanical power to be conveyed. These boundaries will be described in Section 3.4. 13 Masters Thesis •Ramiro Balado Ordax •April 2021 3.1. Gas source . A gas source, called ’Tank’ in the code, is an unlimited, static source of gas at a given pressure and temperature. It has a single interface and serves as the starting and ending points for the pneumatic system. The gas coming from the tank accelerates outwards, keeping its total energy constant, and expanding according to a specific thermodynamic process. In this case, the logical choice is an isentropic process. In the case when the flow is inward, the same thing applies, the only difference being that the stagnation temperature may not coincide with the specified temperature of the tank, and is exclusively dependent on the boundary state. These relationships can be described according to the following equations: ˙ Es+˙ Eb=0 (3.1) Ts Tb =Pt Pbγ−1 γ (3.2) Ts=(Ttif ˙ m≥0 Tsif ˙ m<0(3.3) Where E is the energy of the fluid, T is the temperature, P is the pressure, the subscript s denotes stagnation variables, the subscript b denotes boundary variables, and the subscript tdenotes tank variables. Once each equation is converted into the form f(x) = 0 and simplified accordingly, the following is obtained: hs−(hb+v2 b 2) = 0 (3.4) Ts Tb−Pt Pbγ−1 γ=0 (3.5) (Ts−Tt=0 if ˙ m≥0 0=0 if ˙ m<0(3.6) Where h is the specific enthalpy, v is the speed of the flow. Notice that the derivative of this last constraint with respect of ˙ m is discontinuous at ˙ m= 0. It will not pose much problem for now, but there exist ways of providing information to the algebra subsystem so that this issue can be fixed[5]. 14 Masters Thesis •Ramiro Balado Ordax •April 2021 3.2. Turbine A turbine in this model is a module capable of interacting with both the flow of fluid and an axle, being capable of both extracting energy from the flow or injecting energy into it. As such, it contains two fluid boundaries, the first one typically considered input and the second output, and an axial boundary that allows for the extracted power to be transmitted to other machinery. There are four necessary equations that describe this module. The first three are the following: ˙ m1+˙ m2=0 (3.7) E1+E2+ηmW=0 (3.8) T1 T2 =ηP1 P2γ−1 γ (3.9) Where ˙ m is the mass flow of the fluid, ηm is the mechanical efficiency of the power transmission, η is the isentropic efficiency of the flow, and γ is the specific heat ratio of the gas. The last equation is related to the performance map of the turbine/compressor. For the turbine at hand, the performance map was described in terms of pressure ratio as a function of rotational speed ω and corrected mass flow ˙ mcorr , and can be described in general terms as such: P2 P1 =πperf(ω,˙ mcorr)(3.10) In any case, it should be an equation that describes the operational point of the turbine/compressor. The isentropic efficiency used in Equation 3.9 is also obtained from a performance map, and also depends on the operational point of the module. The reciprocal of the efficiency has to be used in the case when the axial power is negative, that is, when the module is acting as a compressor. The same applies to the mechanical efficiency ηmused in Equation 3.8. Again, for the equations that are not already in the proper form, setting these equations to zero by moving all the factors to one side results in the following: T1 T2−ηP1 P2γ−1 γ=0 (3.11) P2 P1−πperf(ω,˙ mcorr) = 0 (3.12) In the context of turbomachinery, a performance map is a diagram that describes the behavior of such system in a wide range of operational values. For the case of compressors 15 Masters Thesis •Ramiro Balado Ordax •April 2021 and turbines, these maps usually relate the rotating speed with other variables, such as the mass flow, pressure ratio across the element or efficiency. 3.3. Combustor The combustor in this system is the module in charge of increasing the temperature of the gas by injecting fuel and reacting it with the oxygen in it. This adds energy to the flow which can be extracted using the previously mentioned turbine. It interacts with two fluid boundaries, the input and output, and has an additional variable describing the fuel mass flow. This module must therefore take into account the chemical reactions that are taking place. In this case, a very simple model is used in which all the heat energy contained in the fuel is released, regardless of the proportion of the reagents. This is a very glaring limitation of the given module, but it is not meant as a realistic simulation, merely as a proof of concept. As for the thermodynamic process that the fluid undergoes, it can be described as being quasi-isobaric. In this case, a simple pressure loss factor will be applied, but more sophisticated methods relating pressure drop with kinetic energy can be modelled[3]. The equations that describe this module are the following: ˙ m1+˙ m2+˙ mf=0 (3.13) E1+E2+Ef=0 (3.14) P1−Patm = (P2−Patm)/ηp(3.15) Where ˙ mf is the mass fuel flow, Patm is the atmospheric pressure and ηp is the combustor pressure loss efficiency. Care must be taken with the sign of the mass fuel flow. Since, by convention, positive flow is outwards, injecting fuel into the module must result in a negative value. This last equation can be transformed into an adequate form, and results in the following: ηpP1−P2+Patm(1−ηp) = 0 (3.16) 3.4. Boundaries Boundaries help in assembling a system based on its individual parts. They help in sharing some state between two (or more) modules. In this section two types of boundaries are described. A fluid boundary, that transmits fluid, and an axial boundary, which connects two rotating modules. More boundaries can be developed as are needed. For example, a thermal boundary could be created to simulate heat transfer between two components. 16 Masters Thesis •Ramiro Balado Ordax •April 2021 3.4.1. Fluid Boundary A fluid boundary is designed to help construct a pneumatic circuit between all the different components that interact with the fluid. It contains the fluid state, described by a pair intensive variables, in this case pressure P and temperature T , but any other pair of state variables can be chosen, according to the State postulate, and one extensive variable that helps in quantifying how much actual fluid is being transferred. In this case, the combination of fluid velocity v and geometrical cross section A is used, but any other variable that quantifies the size or amount of fluid, such as the mass flow or volume flow, could also be considered. For extensive properties, a sign criteria has to be chosen. In this case, positive velocity is considered to be outward, consistent with the outward pointing surface vector enveloping the module. As such, for both ends of a fluid boundary, the value of the velocity must be opposite one another. Inside this module we can also define some functions to extract useful information from the fluid at the boundary, such as its internal and kinetic energy, enthalpy or mass flow, and their variants per unit mass. This way, we place the role of keeping track of the fluid characteristics away from the modules and into the boundaries. The following equations are implemented: ek=v2 2(3.17) h=u+P/ρ(3.18) e=h+ek(3.19) ˙ m=Avρ(3.20) ˙ mcorr =˙ m√T/P(3.21) Where ek is the specific kinetic energy, h is the specific enthalpy, u is the internal energy, ρ is the density, e is the total potential energy of the flow, ˙ m is the mass flow and ˙ mcorr is the corrected mass flow. The values of the density ρ and the specific internal energy u are obtained according to ideal gas relationships. For ρ , the value is taken to be P/rT , where r is the specific gas constant of the fluid. For u , the value is taken to be u=cvT . From this, the value of h simplifies to h=cvT+rT , which further simplifies to h=cpT , since cp=cv+r , proving that the enthalpy of an ideal gas does not depend on the pressure, it only depends on the temperature. More complex systems, in which these properties are calculated based on tabulated data of each of the fluid components can be implemented. The choice of using and ideal gas is for simplicity and ease of development. 17 Masters Thesis •Ramiro Balado Ordax •April 2021 4.2. Lagrange multipliers The Lagrange multipliers method is another method for finding a maximum or minimum of a function subject to certain constraints [9]. Since each of the constraints will be implemented as different multipliers, we could try to minimize the distance with respect to the current point. The problem with Lagrange multipliers is that it requires transforming the constraints into a very specific form with a lot of mathematical manipulation. This can get tiring and hard to analyze and debug. 4.3. Newton-Raphson method The Newton-Raphson method, sometimes simply called Newton’s method, is a method for finding the roots of nonlinear equations [10]. Its basic premise is finding the intersection between the hyperplane tangent to the solution at the current best estimate and the zero hyperplane. As this procedure is repeated, the best estimate approaches the solution. A single iteration of this method can be visually seen in Figure 4.1. Figure 4.1: One iteration of Newton’s method for a 1D problem. For the one dimensional case, the procedure can be visually seen in Figure 4.1, and mathematically described as such: xn+1=xn−f(xn) f0(xn)(4.2) This method can be extended to solve sets of nonlinear equations [11]. This is done 24 Masters Thesis •Ramiro Balado Ordax •April 2021 analogously, replacing the value of f(xn) and f0(xn) by their respective multidimensional counterparts F(Xn), and the Jacobian matrix JF(Xn): Xn+1=Xn−JF(Xn)−1F(Xn)(4.3) Calculating the inverse might not always be feasible, so we will implement it in the form Ax =b so that the solver of linear systems of equations can apply all the optimizations that it might require. As such, the equation to solve is the following: JF∆Xn=−F(Xn)(4.4) This method converges much faster than Gradient descent, since it directly finds an estimate of the root of the system of equations. In an ideal case, this method can converge quadratically. On the other hand, it can have trouble finding a solution if the initial guess is far from the root or the function is not sufficiently smooth. For these cases, the behavior can be improved by applying some relaxation method to the factor ∆Xn . If instead of incrementing the current guess by ∆Xn , we increment it by ω∆Xn , where ω will typically be less than one, the method will have a lower tendency of diverging or oscillating. On the other hand, the convergence order is reduce and it might take several more iterations to converge. Cases where ω are bigger than one can be conceived. Generally, if the current guess is close to the root, setting ω to be the multiplicity of the root will preserve the quadratic convergence. It is also possible to estimate the value of ω by running a few iterations and measuring the current rate of convergence, and setting ωaccordingly. 4.4. Halley’s method Halley’s method is very similar to Newton’s method, but it additionally uses the second derivative to make a more informed guess each iteration [11]. Halley’s method can bee interpreted as fitting an approximant (called Padé approximant) of the kind (a+bx)/( 1 +cx) , based on the value, first and second derivatives. This family of methods that includes Newton’s method for degree 1 and Halley’s method for degree 2 is called the Householder’s methods, and can be extended to any degree of derivative that is necessary [11]. Halley’s method would help solve the system of equations much more stably than Newton’s method, but it adds additional complexity in implementing second derivatives to the constraints. Halley’s method could still work if the second derivatives are set to zero, in which case is identical to Newton’s method, but we would lose all the benefits of this method. Additionally, Halley’s method for sets of equations uses a three dimensional Hessian matrix, which the Eigen library does not provide stable support for. 4.5. Implementation Considering all the factors, the Newton-Raphson method has been chosen, as it is the one that provides the most benefits, with little relative downsides. As we mentioned in 25 Masters Thesis •Ramiro Balado Ordax •April 2021 Chapter 2, we will be using the Eigen library for everything related to linear algebra. Firstly, we will be encapsulating all of this behavior in its own class, aptly named NewtonMethod. The first step is to define exactly what the algorithm consists of, which steps we need to take to solve the problem. By looking at the equation that serves as the base for Newton’s method, we immediately see that this is an iterative method, and as such, we will need a function that executes one iteration of this algorithm. Inside this method, we will firstly extract the values F(Xn) and Jacobian matrix JF(Xn) for the constraints. As the constraints usually depend only on a small set of variables, such as the boundaries or any internal variables to the module, the jacobian will be a sparse matrix, as it saves memory space and can allow for optimizations, since the algorithm can use all the zeros to simplify a lot of the work it has to do. We now have all the values that we need to calculate ∆Xn . Before doing so, we have to initialize the solver that we will use. In this case, two different solvers have been tried. Firstly, the Eigen::SparseQR solver. This solver is specifically developed to work well with sparse matrices. In order to use this solver, we have to create an instance of the class by passing it which kind of sparse matrix we are using ( Eigen::SparseMatrix<double> in our case), and an sparse matrix ordering method. When a sparse matrix is solved, a permutation matrix is generated so that the solving is more efficient. The ordering method specifies in which way this permutation matrix is produced. In this case, the Eigen::COLAMDOrdering was chosen, as it seems to be the most commonly used. After all this is specified, we can construct our Eigen::SparseQR solver instance. After this, we have to set a pivot threshold. Eigen uses this threshold to determine which columns are linearly dependent and which are not. As no real reference was given, the arbitrary number of 10 −10 was chosen. This value can be tuned after enough data has been gathered based on the typical workload that it will need to solve. Next, we can pass our Jacobian matrix to the solver instance using the Eigen::SparseQR ::compute() method. This method analyzes the structure of the sparse matrix, based on the zeros of the matrix generates the permutation matrix, and finally decomposes the matrix into two matrices: Q and R. If the zero pattern on the sparse matrix does not change, we could call the method Eigen::SparseQR::analyzePattern() once so that the permutation matrix would only need to be generated once. Subsequent runs would only need to call Eigen::SparseQR::factorize() , which would skip the generation of the permutation matrix. We are finally ready to solve the system. We only need to call the method Eigen:: SparseQR::solve() with our constraint values. This will return a vector with the deltas that we need to modify the variables by. Please note that we will be passing the constraint values without negating them. This will mean that the returned deltas will need to be subtracted, not added, to the variables. The second solver that has been used is a dense solver. It is much easier to operate, and in general finds better solutions than the sparse one. To use this solver, we simply have to convert the Jacobian to a dense form by calling Eigen::SparseMatrix:: toDense() , then decomposing it into the QR factorization by calling Eigen::MatrixBase:: 26 Masters Thesis •Ramiro Balado Ordax •April 2021 fullPivHouseholderQr() , and finally calling Eigen::FullPivHouseholderQR::solve() with the constraint values. Both of these systems have been tested. In general, it has been found that they produce the same results in most occasions, but the sparse method produces unexpected results in some cases. As such, the dense method will be used. Once the deltas are obtained, it is time to update the current variables. This is done according to the following equation: Xn+1=Xn−ω∆Xn(4.5) Where ω is the relaxation factor. This factor is initialized to 0.5, but can be overridden at any point by calling the appropriate setter. 4.5.1. Jacobian matrix Another issue that we have not discussed yet is obtaining the Jacobian based on the constraints. This is handled by the JacobianCalculator class. This class takes a list of constraints and, for each one, calculates its gradient based on the derivative with respect to all the variables that influence this constraint. This gradient is returned in the form of triplets, which are a combination of the i and j indices of the matrix and the value of the derivative. Once all the triplets are calculated, the sparse matrix can be constructed based on these. The derivative with respect to each variable is calculated by calling the method Constraint::getValueDerivative() with each of the variables that are returned when calling Constraint::getDependentParameters(). 27 Chapter 5 Simulation Results After both the component models and the algebra subsystem have been implemented, they can be integrated with each other and executed together. For all the cases below, the values shown in Table 5.1 for the different constants and parameters will be used. Parameter Value Patm 1013 hPa Tatm 288 K ηmech 0.95 γ1.4 cp1000 J/(kg K) ηp0.9 ηcomb 0.9 hcomb 43.1 MJ/kg Table 5.1: Values for the different parameters in the simulation 5.1. Stable solution The first objective when running our simulation is finding a stable solution. In order to do that we must initialize the system with rough approximations of the variables. How good these values must be will be analyzed subsequently. Once a rough first estimate is found, the algebra subsystem can be executed and our stable point will be found. For a value of ˙ mf=1.45 g/s for our control variable, the results are shown in Figure 5.1. At a general first glance, these values look about like what we would expect to see in a single spool turbojet, such as the results depicted in Figure 5.2. In the inlet the air is accelerated by the suction of the compressor. As such, we would expect to see an increase in the speed of the flow due to a small drop in pressure. The temperature is supposed to remain fairly stable, as the pressure drop is not that big. 29 Masters Thesis •Ramiro Balado Ordax •April 2021 Figure 5.1: Values for temperature, pressure and velocity at each boundary. The job of the compressor is to increase the pressure of the fluid, therefore the pressure sees a high jump, together with the temperature. We would expect the temperature to rise accordingly, as it’s modelled as a quasi-isentropic process. There is not much to say about the velocity. We would expect it to remain relatively stable, with no significant changes. Within the combustion chamber, fuel is injected and burnt to increase the temperature of the fluid. Therefore, we expect to have a big jump in the temperature of the flow. The pressure within the combustion chamber is usually expected to be constant or have a slight decrease to avoid reversing the flow. The velocity usually increases, but depending on the geometry it could remain roughly constant. After the gas has been expanded through the turbine, it exits with a much lower pressure, roughly atmospheric, and a higher velocity. As a consequence of extracting a lot of energy from the fluid, its temperature should decrease. 5.2. Convergence of the simulation As discussed previously, it is important to know how rough our initial approximation has to be in order for the system to converge to a stable solution. In order to evaluate the convergence of the system with respect to the variables, a use case has been implemented. 30 Masters Thesis •Ramiro Balado Ordax •April 2021 Figure 5.2: Temperature, pressure and velocity in a typical jet engine.[12] This use case modifies each variable through a range of values, and attempts to get the system to converge. Once the system has converged, it estimates how many iterations it took to converge. This is done by taking the constraint remainder of the stable point, and asserting that when the remainder is close to it, we consider the system to have converged. As can be intuitively seen in Figure 5.3, the variables can be split into two sets. The variables that show a stable behavior, and the variables that show an erratic behavior. This difference can be more easily observed if we plot the divergence from the solution as the iterative process is done. This relationship can be seen in Figure 5.4. As can be seen, after the end of the iterative process, most variables end very close to the original proposed solution. The difference is merely a few thousandths of a percent. In some other cases, the solution can be as far as twice the magnitude. The criteria that was chosen for dividing the two sets is crossing the threshold of 0.01 while the distance from the solution is less than 25%, as 1% is considered enough deviation to pose significant issues. Two of the variables that are considered stable cross such threshold, but do it in the vicinity of 50% initial deviation, which is the limit as to what would be considered acceptable. The stable variables, whose convergence is shown in Figure 5.5 as a function of the variation with respect to the stable point, are half of the variables, and behave as one should expect, logarithmically as one increases the distance from the stable point. For the 31 Masters Thesis •Ramiro Balado Ordax •April 2021 Figure 5.3: Iterations to converge, ω=0.5 Figure 5.4: Solution drift, ω=0.5 32 Masters Thesis •Ramiro Balado Ordax •April 2021 Figure 5.5: Iterations to converge, stable variables, logarithmic axis, ω=0.5 case of the unstable variables, shown in Figure 5.6, we can see that for near values the convergence is logarithmic. It is only when the initial deviation is bigger than 5% that irregularities in convergence start to show up. Figure 5.6: Iterations to converge, unstable variables, logarithmic axis, ω=0.5 33 Chapter 6 Conclusions The end result of this project is a functional simulation program for non-causal models. A system to solve non-linear equations has been described and developed using the Newton-Raphson method. This system has been tested with different models. Models for each of the modules in a turbojet have been defined, implemented and tested. A way for these modules to interact has also been implemented in the form of boundaries and has been tested. Each of these models have been assembled to form a single spool turbojet. The model as a whole has been tested and produced adequate and stable results. These results match what we would expect for a turbojet. Based on these results, the operating line for the turbojet has been generated by modifying the control parameters. The convergence of the system based on its inputs has been studied. The results have been analyzed and some limitations of the system have been observed. The range for which these limitations appear has been identified based on the results and can serve as a starting point for further optimizations. This analysis has been conducted for different values of the relaxation factor. Reducing the relaxation factor increases the stability of the system, while making the convergence slower. An adequate value for this parameter is proposed. The project has an estimated cost of 10,500 €. 41 Chapter 7 Future Work Even though this project succeeded in accomplishing its goals, there are parts that could be expanded to obtain a deeper understanding of the necessities and specific traits of methods to solve non-linear systems of equations, as well as the behavior of turbomachinery. An evident next step to take is to extend this program to simulate dynamic behavior. This could be done in steps, first taking the fluid as stationary but the mechanical parts as dynamic, with the next step being modelling the dynamics of the fluid itself. The way the fluid state is calculated does not allow for the thermodynamic gas properties to change, such as specific heat or molecular mass. This is critical when calculating the process of combustion, since the gas properties change significantly. A way to encapsulate this state could be implemented into a separate class, which would store the concentration of each species and their properties. This would increase the amount of variables and constraints, since every mass conservation constraint would be multiplied by the number of species that the system supports. Even though this method of solving systems is able to work for a big number of variables, the computation power required to do increases quadratically. If the system is left running on a single core, the computing speed would be significantly reduced. Therefore, it would be useful to determine ways to distribute the solving of the system to multiple processing cores. This would allow for the computing time to remain constant, at the expense of using more parallel computing resources. An in depth analysis will have to be taken to understand why the sparse and dense methods produce diverging results in some instances. Related to this, it would be useful to investigate other ways of solving non-linear systems. As seen in Chapter 5, the behavior when the fuel mass flow increases past a threshold produces undefined results. This might be due to the limited range of values in the performance map of either the turbine or the compressor. Regardless, it is necessary to investigate and find the reason for this behavior. The modeling of the combustion process in the combustor is very simplistic and should not be used in real world applications. A first step in improving this is by calculating the stoichiometric relationships and the amount of each reagent present in the mixture. 43 Masters Thesis •Ramiro Balado Ordax •April 2021 A next step to take is to use a thermochemical library to more accurately determine the concentration of each of the products. One of the most common sources of error in this system are human mistakes when defining the equations and their derivatives. This can be alleviated by implementing the equations in a language that supports symbolic representations of equations. This could be accomplished by developing tools to convert this symbolic representation into the necessary structures to interface with the system[13]. As discussed in Chapter 1, Modelica is a valid candidate for such a task. 44 Bibliography [1] Modular Lumped-Parameters Dynamic Model for Gas Turbines: Validation and Application to a Small Scale Externally Fired Gas Turbine. Vol. Advanced Energy Systems. ASME International Mechanical Engineering Congress and Exposition. Nov. 2005, pp. 369– 378. doi:10.1115/IMECE2005-80720. [2] Tom Egel. Real time simulation using non-causal physical models. Tech. rep. SAE Technical Paper, 2009. [3] Kurt Seldner. Generalized simulation technique for turbojet engine system analysis. National Aeronautics and Space Administration, 1972. [4] Peter Fritzson. “Modelica—A language for equation-based physical modeling and high performance simulation”. In: International Workshop on Applied Parallel Computing. Springer. 1998, pp. 149–160. [5] Nathan E Smith et al. “Implementing Conditional Inequality Constraints for Optimal Collision Avoidance”. In: Journal of Aeronautics and Aerospace Engineering (2017). [6] Francis Oppong. “Micro gas turbine performance evaluation.” PhD thesis. Stellenbosch: Stellenbosch University, 2016. [7] F Oppong, SJ van der Spuy, and TW von Backström. “Upgrading the BMT120 KS micro gas turbine”. In: R&D Journal 33 (2017), pp. 22–31. [8] Sebastian Ruder. “An overview of gradient descent optimization algorithms”. In: arXiv preprint arXiv:1609.04747 (2016). [9] David G Luenberger. Optimization by vector space methods. John Wiley & Sons, 1997. [10] Carl T Kelley. Solving nonlinear equations with Newton’s method. SIAM, 2003. [11] Werner C Rheinboldt. Methods for solving systems of nonlinear equations. SIAM, 1998. [12] Fundamentals of Gas Turbine Engines.url: www.cast-safety.org/pdf/3_engine_ fundamentals.pdf. [13] George Giorgidze and Henrik Nilsson. “Higher-order non-causal modelling and simulation of structurally dynamic systems”. In: Proceedings of the 7th International Modelica Conference; Como; Italy; 20-22 September 2009. 043. Linköping University Electronic Press. 2009, pp. 208–218. 45