Training data for an AE2010/AE2011 language model

Overview

You will put together training data for a small language model. The aspiration is that this will be used for a model that can help the next cohort of AE2010/AE2011 students.

This coding assignment must be completed individually.

Due date: 20:00 on April 20th 2024 online via Canvas.

What you should submit

A single .json file that follows the format of the example below.

What the file should contain

A total of 16 Q&As that span incompressible flows, thermodynamics and compressible flows:

  • 7 Q&As must pose and answer a numerical question (requiring code).
  • 9 Q&As must pose and answer a conceptual question.

Extra credit: Additional Q&As that require generating a plot. Some examples include:

  • Plotting the Mach number in a supersonic wind tunnel with an assumed area ratio variation, inlet and exit condition.
  • Plotting curves on a T-s, p-V diagram based on appropriate conditions and calculations.

How your will file be graded

All theory / conceptual questions will be graded on a 5-point scale with the following breakdown:

  • Correct solution 3/5
  • Creativity in question 1/5 (e.g., “What is the first law” is not as creative as “How and why does one distinguish between shaft and flow work in the first law?”
  • Comprehensiveness (while being concise) in the solution, e.g., stating all the relevant assumptions, accounting for any possible edge cases.

All code-based questions will be graded on an 8-point scale with the following breakdown:

  • 5 points following the conceptual question rubric.
  • 4 points for code that runs as intended. Please ensure that you only use python with numpy and matplotlib libraries, and you avoid overly long / efficient code.

Q&As for code-based questions do not have to be elaborate, i.e., they can be relatively short as well.

You may find the two references below useful, though there are numerous other texts that you can use.

References.

Michael A. Boles, Yunus A Çengel, (2024) Thermodynamics: An Engineering Approach, McGraw-Hill.

John D. Anderson, Christopher P. Cadou (2024) Fundamentals of Aerodynamics, McGraw-Hill.

Example

Please see the example below. Note that all .json files begin with [ and end with ]. All Q&As have tags question and answer. The references tag may be used in both theory and coding Q&As. Additionally, coding solutions have both additional explanation tag.

Below you will find an example of a sample .json file. Note this example does not have as many Q&As as your submission should.

[
{
  "question": "Why do we have a heat exchanger in a supersonic wind tunnel?",
  "answer": "We have a heat exchanger to cool the fluid as a supersonic wind tunnel typically has a compressor that in addition to raising the stagnation pressure, will also increase the stagnation temperature."
},
{
  "question": "Can you elaborate upon the Kelvin-Planck statement on the second law of thermodynamics?",
  "answer": "It is impossible for any device that operates on a cycle to receive heat from a single reservoir and produce a net amount of work. In other words, a heat engine must exchange heat with a low temperature sink as well as a high temperature source to keep operating. Another way to interpret this is that no heat engine can have a thermal efficiency of 100%."
},
{
  "question": "A fluid with a density of 1000 kg/m^3 enters a pipe with a cross-sectional area of 0.1 m^2 at a velocity of 2 m/s. The pipe narrows to an area of 0.05 m^2. What is the fluid's velocity at the narrower section?",
  "answer": {
      "code": """
import numpy as np

rho = 1000  # Density (kg/m^3)
A1 = 0.1  # Area 1 (m^2)
v1 = 2  # Velocity 1 (m/s)
A2 = 0.05  # Area 2 (m^2)

# Apply the principle of continuity (A1*v1 = A2*v2)
v2 = (A1 * v1) / A2  

print("Velocity in the narrower section:", v2, "m/s")
      """,
      "explanation": "This code utilizes the principle of continuity for incompressible flow, which states that the mass flow rate remains constant. The equation A1*v1 = A2*v2 expresses this, where A represents cross-sectional area and v represents velocity.",
      "references": [
          "https://en.wikipedia.org/wiki/Continuity_equation",
          "https://www.khanacademy.org/science/physics/fluids/fluid-dynamics/a/what-is-volumetric-flow-rate" 
      ]
  }
}
{
  "question": "Calculate the work done by an ideal gas expanding isothermally from an initial volume of 2 L to a final volume of 5 L at a temperature of 300 K. Assume the gas behaves ideally.",
  "answer": {
      "code": """
      import numpy as np

      n = 1  # Moles of gas
      R = 8.314  # Gas constant (J/mol*K)
      T = 300  # Temperature (K)
      V1 = 2  # Initial volume (L)
      V2 = 5  # Final volume (L)

      # Work done in an isothermal process for an ideal gas
      work_done = n * R * T * np.log(V2 / V1)

      print("Work done by the gas:", work_done, "Joules")
      """,
      "explanation": "This code calculates work done in an isothermal process. It uses the formula W = nRT * ln(V2/V1), where 'n' is the number of moles, 'R' is the gas constant, 'T' is the temperature, and 'V1' and 'V2' are the initial and final volumes, respectively."
  }
},
{
  "question": "Heat is transferred to a heat engine from a furnace at a rate of 89 MW. If the rate of waste heat rejection to a nearby river is 50 MW, determine the net output and the thermal efficiency for this heat engine.",
  "answer": "Note that the rates of heat transfer to and from a heat engine are provided. The net power output and thermal efficiency are to be determined. Assuming that heat losses through the pipes and other components are negligible, the net power output is given by 80 - 50 = 30 MW. The thermal efficiency can then be determined via efficiency = 30 / 80 = 0.375 or 37.5%. "
},
{
  "question": "What exactly is a heat engine?",
  "answer": "A heat engine is a device that receives heat from a high temperature source (e.g., solar energy, oil furnace, nuclear reactor, etc.) and converts part of this heat to work. Usually the work output takes the form of a rotating shaft. A heat engine rejects the remaining waste heat to a low temperature sink (e.g., atmosphere, rivers, etc.). Heat engines operate on a cycle."
},
]