Modify_Fluid_Types - nasa/gunns GitHub Wiki

GunnShow Wiki Modify Fluid/Compound/Reaction Types

Whenever the lists of fluid, compound, or chemical reaction types are modified in ms-utils, GunnShow must be updated in order to be able to properly use them. This requires a rebuild & install of the GunnShow plug-in.

All three of these types are represented in a similar way in the GunnShow code and the modifications to each are similar. Each type has one .cs file in the GunnShowLibrary project within the Visual Studio solution:

ms-utils/ Class GunnShow/GunnShowLibrary/ Class
properties/FluidProperties.hh Fluids/GunnShowFluids.cs
properties/ChemicalCompound.hh Chemistry/GunnShowCompounds.cs
properties/ChemicalReaction.hh Chemistry/GunnShowReactions.cs

The structure of these .cs files are the same. There are 3 places in the .cs file to modify to stay in sync with changes to the .hh file:

1. String type name

There is a string attribute defined for the type, whose string value must exactly match the enum value within the .hh file. For instance in the ChemicalReaction.hh file the enumeration Type:


        ////////////////////////////////////////////////////////////////////////////////////////////
        /// @brief    Enumeration of the types of Chemical Reactions.
        ///
        /// @details  This enumeration is used to index the array of Defined Chemical Reactions.
        ////////////////////////////////////////////////////////////////////////////////////////////
        enum Type {
            CO_REMOVAL       = 0,   ///<  2CO + O2 --> 2CO2
            CH4_REMOVAL      = 1,   ///<  CH4 + 2O2 --> CO2 + 2H2O
            H2_REMOVAL       = 2,   ///<  2H2 + O2 --> 2H2O
            NH3_REMOVAL      = 3,   ///<  2NH3 + H3PO4 --> (NH4)2(HPO4)
            SABATIER_RXN     = 4,   ///<  CO2 + 4H2 --> 2H2O + CH4
            NO_REACTION      = 5,   ///<  Invalid or number of reactions - Keep this last!
        };

is matched by these string definitions in GunnShowReactions.cs:


public static readonly string CO_REMOVAL = “CO_REMOVAL”;
public static readonly string CH4_REMOVAL = “CH4_REMOVAL”;
public static readonly string H2_REMOVAL = “H2_REMOVAL”;
public static readonly string NH3_REMOVAL = “NH3_REMOVAL”;
public static readonly string SABATIER_RXN = “SABATIER_RXN”;
public static readonly int NUM_REACTIONS = 5;

2. Number of types

The last value in the enum declaration in the .hh file defines the number of the types, which must be matched by a similar int type in the .cs class, as with NO_REACTION and NUM_REACTIONS in the example above.

3. String list in the .cs

The .cs file builds a list of the strings. This list must include the strings in order for that type to be used in GunnShow drawings. For example in GunnShowReactions.cs:

        public static string[] KnownReactions
        {
            get
            {
                knownReactions[0] = CO_REMOVAL;
                knownReactions[1] = CH4_REMOVAL;
                knownReactions[2] = H2_REMOVAL;
                knownReactions[3] = NH3_REMOVAL;
                knownReactions[4] = SABATIER_RXN;
                return knownReactions;
            }
        }
⚠️ **GitHub.com Fallback** ⚠️