GunnsFluidExternalSupply - nasa/gunns GitHub Wiki

GunnsFluidExternalSupply

default_img

Background

This class inherits GunnsFluidSource, and is used in tandem with the GunnsFluidExternalDemand class to connect two separate Gunns networks together, with this class supplying pressure to and receiving demanded flow from the external demand-side network and applying the flow demand to the local node.

How To Use in GunnsDraw

This picture shows how to hook up the GunnsFluidExternalSupply in the local network and the GunnsFluidExternalDemand link in the external network and the simbus interfaces between the networks. The arrowheads in the supply & demand link shapes imply a flow direction from the supply node to the demand node, but in fact flow can go in either direction, and always flows from the higher-pressure side to the lower-pressure side, as a regular conductor would. The arrowheads simply indicate the direction of positive flow values.

default_img

Normally you'll pair up this Supply link with a Demand link as shown above. However this is optional, and you also have the option of using this link standalone. In lieu of a run-time simbus interface, you can specify the demand fluid properties in this link's Input Data, detailed below.

Port Connection Rules (These are limitations on the port connection to nodes that the link enforces in run-time):

  • Port 0 cannot be attached to Ground.
  • Port 1 must always be attached to Ground. This is an optional port in GunnsDraw, and GunnsDraw will automatically connect it to Ground if the port is not drawn.

Other Rules (These are extra rules you should always try to follow):

  • The supply node should be capacitive so put a fluid capacitor, tank, accum, etc on the node, even if with a very small volume.
  • The supply link should be used in the network with the higher local capacitance - which is usually the network that has the larger nearby volume.
  • In general, the interface location should be chosen where the supply network has a large nearby capacitance relative to the demanded flow rates. In other words, a location where typical interface flow rates will result in small pressure changes in the supply network. Such an interface is called "loosely coupled" because the demand network can't really affect the supply network. Loosely coupled interfaces are more stable. "Tightly coupled" interfaces, where even small demand flow rates cause large changes in the supply pressure, are very unstable and should be avoided whenever possible.

Configuration Data Parameters:

  • externalConfig (default = NULL, must != NULL): This must be set to the address of an External Fluid Config object that defines the types and order of fluid constituents in the demand network. This External Fluid Config object must be identical to the Internal Fluid Config of the demand network. This tells the supply link which fluid types and in what order the constituent mass fractions input from the demand link are. If the local network has the same fluid configuration as the external network, or if you are using this link standalone, you can reuse the network's Internal Fluid Config object.
  • convertToType (default = FluidProperties::NO_FLUID): This describes how to convert fluid constituents in incoming flow from the external network that aren't present in our local network. The options are any one of the fluid constituents in the local network's Internal Fluid Config (FuidProperties::GUNNS_N2, etc) or none of them (FluidProperties::NO_FLUID).
    If a local fluid type is specified, then any types in the external fluid that are not present in our local network are converted into the specified type. For instance, if the External Config consists of (GUNNS_O2, GUNNS_N2, GUNNS_CO2) and the local config consists of (GUNNS_N2, GUNNS_O2) and convertToType is GUNNS_N2, then the CO2 from the external network is converted into an equal number of moles of N2 when it enters our local network. Note that because of the difference in molecular weights, this means that mass is NOT conserved during this transformation. Moles are conserved instead, to improve pressure stability between ideal-gas networks.
    If NO_FLUID is specified, then any types in the external fluid not present in our local network are converted to ALL of the remaining types that are present, in the same proportions that those types have in the mixture. For instance, if in the above example the external fluid's mixture was (0.2, 0.79, 0.01) and convertToType were NO_FLUID, then the CO2 is converted into 0.2/0.99 parts O2 and 0.79/0.99 parts N2. Again, moles are conserved, not mass.
  • useNetworkCapacitance (default = false): Setting this true may help improve the stability of the interface with the external demand link in some cases. Setting this true causes this link to output the supply node network capacitance to the external demand link for use in its supply capacitance filter (see the GunnsFluidExternalDemand help page on how to make use of this). Use simbus to send this link's mSupplyCapacitance simbus output term to the external demand link's mSupplyCapacitance simbus input terms. Setting this term false causes the node network capacitance to not be calculated and the external demand will not use its mSupplyCapacitance values. NOTE: setting the term true and using this capability causes the GUNNS solver to use a small amount of extra CPU each pass when solving this network, so this capability should be used sparingly.

Input Data Parameters:

  • malfBlockageFlag (default = false): Initial state of the blockage malfunction activation flag. NOTE: the blockage malfunction is deliberately not implemented in this link and has no effect. To block the interface, use the blockage malfunction in the demand link instead.
  • malfBlockageValue (default = 0.0, must be (0-1)): Initial state of the blockage malfunction activation value.
  • The following terms can be used to specify the initial demand fluid properties, if desired. Normally, you'll pair this link with a Demand link as in the above picture, and these terms can be left with their default values. However, you can also use this link standalone without being pared to a Demand link. You can use the following parameters to set up the properties of a constant demand boundary condition on this link:
    • flowDemand (default = 0.0 kg/s): This is the initial demand mass flow rate. Positive values will remove mass from the supply node, and negative values will add mass to the supply node with the following temperature and mass fractions.
    • demandTemperature (default = 0.0 K): This is the initial temperature of any demand fluid added to the node. If this value is < DBL_EPSILON, the link will use the supply node's initial temperature instead.
    • demandMassFractions (default = 0): This is a pointer to an array specifying the initial mass fractions of any demand fluid added to the node. If this pointer is left 0 (NULL), then the fractions will be initialized to {1.0, 0.0 ...} instead. It is best to assign this array in the Trick Input File. NOTE: these fractions correspond to the externalConfig fluid types, not the network's Internal Fluid Config.

Common Problems

  • Stability issues with the demand link interface are discussed in the GunnsFluidExternalDemand help page.
  • Mass fraction errors: Health & Status messages from this link or the supply node, especially in the flavor of "mass fractions do not sum to 1", are usually due to a mismatch between the externalConfig config data and the demand network's fluid config, or improper simbus ICD transfer of the demand link's demand mass fractions to the supply link's demand mass fractions arrays. These arrays are always sized to match the sender's array size, so the mDemandMassFractions array writes & reads should transfer the full size of the demand link's mDemandMassFractions array. Likewise, the mSupplyMassFractions array writes & reads should transfer the full size of the supply link's mSupplyMassFractions array.

References

  • N/A
⚠️ **GitHub.com Fallback** ⚠️