Fluid_Aspect_Course_4_2_2 - nasa/gunns GitHub Wiki

Fluid Aspect Course 4.2.2: Fluid States

Fluid State objects define a set of initial conditions of a fluid in the network. These get used to define the initial contents of nodes & links.

Eventually you’ll need to define at least one Fluid State object and you’ll usually end up with more than one. You don’t have to do them now and you can always add them later. Drop one into the network container from the GUNNS_Fluid.xml shape library like so:

Then edit the state by doing the following:

  • Name this state. This has to be a valid C-variable name. We recommend fluid, like fluidAmbient. Select the state and type the new name into its title bar.
  • Open the state list by clicking the ‘+’ symbol in the title bar.
  • Set the Temperature (in Kelvin) and Pressure (in kPa).
  • Leave Mass alone (zero).
  • Leave TC State alone (zero) for now, we’ll cover that later.
  • Edit the ‘GUNNS_…’ rows to list the same fluid types, and in the same order, as your network’s internal Fluid Config, then set each constituent’s initial mass fraction value. Here are some important rules to follow:
    • They all must sum to exactly 1.0. GunnsDraw doesn’t check this for you so make sure to get it right, otherwise you won’t know until the network throws errors at run-time.
    • A 0.0 is allowed. Use this for the fluid types that aren’t present in this particular state.
    • You must not mix liquid & gas mass fractions, because both phases are not allowed in any single fluid. GunnsDraw also doesn’t check this and you won’t know until run-time.

Here’s an example of my ambient air state when I’m done:

What if I want to enter mole fractions instead of mass?

Sorry, you’ll have to convert your desired mole fractions to mass fractions. Here’s some pseudocode for how to do it. You can also see our C++ implementation in gunns/core/GunnsFluidUtils::convertMoleFractionToMassFraction:

sum = 0.0
loop for each type i {
    temp[i] = Mole Fraction[i] * Molecular Weight[i]
    sum += temp[i]
}

loop for each type i {
    Mass Fraction[i] = temp[i] / sum
}

Previous Page / Next Page

⚠️ **GitHub.com Fallback** ⚠️