## Assignment 1

One-dimensional Compressible Flow with Heat Addition and Friction

### Introduction In this exercise, you will investigate one-dimensional flows using the 1D solver available in CFLOW. In total four tasks should be solved of which two deals with 1D flow with friction, one with 1D flow with heat addition, and in the final task, a normal shock should be investigated.

OBS Read chapters 1-3 in the course book before starting with the exercise!

When you have done the assignment, you should write a short report and hand in for assessment of this course element (instructions at the bottom of this page).

The CFLOW solver is a solver for simulation of compressible flows based on an explicit time-marching finite-volume-method (FVM) approach for which you can find a thorough description in the lectures on time-marching methods (Lectures 13 and 14). In order to be able to solve the tasks, you will have to make changes to the solver settings in accordance with the task description such as tube geometry, number of cells, number of time steps, boundary conditions, and initial flow properties. In order for the solver to run in a stable manner, you will also need to make changes to the solver numerics settings in some of the cases. In cases with steep gradients or discontinuities, extra damping will be needed. The extra damping is activated in the Numerics section. Pressure damping is used for shocks and density damping is for cases with steep temperature gradients. Note that for compressible flows, the CFL-number is defined as:

$$CFL=\frac{\Delta t(c+|u|)}{\Delta x}$$

where $$\Delta t$$ is the time step size, $$c$$ is the speed of sound, $$u$$ is the fluid velocity, and $$\Delta x$$ is the local cell size. Since the solver uses explicit time marching, it is important that the CFL-number is below unity, otherwise the computation may diverge. You can find more details on the numerics of compressible flow solvers in the lecture notes on time-marching methods.

Detailed description of the solver settings and solver functionality can be found in the solver manual. ##### Computational Domain

The figure below shows a schematic representation of the computational domain in CFLOW. Note that the solver is of finite-volume-method (FVM) type, which means that it solves for cell averages of flow properties. ##### Convergence

The convergence history is visualized in the solver log. Depending on task, the number of iterations needed in order to reach convergence will vary. In case the solver is not converged when the specified number of iterations are completed, increase the number of iterations and restart the solver. ##### Postprocessing

CFLOW will produce graphs of $$\rho$$, $$u$$, $$p$$, $$T$$, $$M$$, $$p_o$$, and $$T_o$$ for each obtained solution. Study the graphs and make sure that you can explain what you see. ##### Export

When done with one of the tasks below, save the CFLOW state to a JavaScript data base file (JSON) using the export functionality. The file can later be used to restore the solver state and should be submitted in Canvas along with the report. All of the following tasks (taken from the course book) should be solved both analytically and numerically. Note that in order to be able to apply the correct boundary conditions in the numerical simulations, you will need to solve the problems analytically first!

### Task 1 - 1D flow with friction (A)

Problem 3.12, (1 atm = 101325 Pa)

Air flows through a pipe with the inside diameter 0.02 m and the length 40.0 m. At the pipe exit the Mach number is $$M_2$$=0.5 and the pressure and temperature are $$P_2$$=1.0 atm and $$T_2$$=270.0 K, respectively. The flow can be assumed to be one-dimensional with a local friction coefficient of $$\bar{f}$$=0.005.

Remember to export the solver state to a JSON-file when you are done with the task.

### Task 2 - 1D flow with friction (B)

Problem 3.13, (1 ft = 0.3048 m, 520$$^\circ$$R = 288.889$$^\circ$$K)

Consider the adiabatic flow of air through a pipe of 0.2 ft inside diameter and 3.0 ft length. The inlet flow conditions are $$M_1$$=2.5, $$P_1$$=0.5 atm, and $$T_1$$=520.0$$^\circ$$R. Assume 1D flow and a local friction coefficient of $$\bar{f}$$=0.005. Note that you will need to change the boundary conditions to supersonic, since we have supersonic flow.

Remember to export the solver state to a JSON-file when you are done with the task.

Problem 3.8

Consider air entering a heated duct at $$P_1$$=1.0 atm and $$T_1$$=288.0 K. Ignore the effects of friction. Assume choked exit conditions, i.e. the amount heat added is enough to make the flow sonic at the exit, if the inlet Mach number is a) $$M_1$$=2.0 and b) $$M_1$$=0.2

In order to be able to simulate this flow using CFLOW, you will need to make assumptions regarding the geometry. Since it is a 1D flow, the geometry is not needed when solving the problem analytically but let's assume that the pipe is circular duct with the length 1.0 m and diameter 1.0 cm. In order to get a stable simulation for the supersonic case you will need to add some extra artificial numerical damping. This is done under the Numerics section of the solver settings. Set the pressure damping to 0.5. It might also be helpful to use non-reflective boundary condition at the outlet. If you still face with convergence problems, you can experiment with different initial conditions.

Note that the heat flux per unit area (W/m2) specified in the CFLOW solver settings is not the same as the heat flux in the course book, where it is defined as heat added per unit mass (J/kg). The following formula can be used to convert between the different definitions

$$\dot{q}_{wall}=\frac{q_{mass}\dot{m}}{lb}$$

where $$\dot{q}_{wall}$$ is the heat flux per unit area (W/m2), $$q_{mass}$$ is the heat added per unit mass (J/kg), $$\dot{m}$$ is the mass flow (kg/s), $$l$$ is the total length of the tube (m), and $$b$$ is the circumferential length of the tube (m).

Remember to export the solver state to a JSON-file when you are done with the task.

### Task 4 - Normal shock

Problem 3.4

Consider a normal shock wave in air. The upstream conditions are given by $$M_1$$=3.0, $$P_1$$=1.0 atm, and $$\rho_1$$=1.23 kg/m$$^3$$. Again, you will need to make assumptions about the geometry to be able to solve the problem numerically in CFLOW. Use the same pipe geometry as in Task 3. Before setting up the problem you must calculate the downstream flow condition analytically. In geometry settings, chose a two-region pipe and then initialize the flow setting the upstream conditions in region 1 and the downstream conditions in region 2.

Remember to export the solver state to a JSON-file when you are done with the task.

### Assignment Report

In order to complete the assignment, a report should be written and handed in for assessment. Add a section in the report for each of the tasks above including:

1. Given data
2. Analytical solution
• Hand-written calculations can be included as images
3. CFLOW solver settings
1. Geometry settings
2. Mesh properties
3. Numerics
• numerical scheme
• artificial damping (if applicable)
• time integration
4. Run parameters
5. Gas properties
6. Initial flow field
7. Boundary conditions
• selected boundary condition type and specified values for both left and right boundary
8. Sources
4. Solver convergence
• Residual plot
• Do you consider the solution to be converged enough? Justify your answer
• Where there any problems getting the solver to converge for this specific case. If so, speculate on the cause for this behavior.
5. Results
• Flow field plots (Mach number, Temperature, Pressure)
• Additional flow field plots if it shows something of interest (for example total pressure and/or total temperature)
• Comment on what you see (specific flow features that can be observed)
• Do the results make sense?
6. Discussion
• Are there any significant deviations from the analytical/theoretical solution? If so, what is the reason for the deviations? (Might be difficult to answer exactly but a speculation will do)
• Are there any indications of numerical errors in the solution?
• wiggles in flow field data
• changes in total temperature for cases that should be adiabatic
• changes in total pressure for cases that should be isentropic
• other indications of numerical errors
If you see anything in your solutions that you think is an indication of numerical errors, try to explain why those errors appears.

When done, submit the report along with the exported JSON-files in Canvas