Skip to content

GunnsFluidDistributedIf

Jason Harvey edited this page Feb 22, 2022 · 4 revisions

Background

This link is the GUNNS implementation of the Distributed Fluid Simulation Interface Standard (TODO link to reference). It is similar to GunnsFluidExternalSupply and GunnsFluidExternalDemand, but combines their functions into a single link, with improved performance and stability across high latency interfaces. This link is intended for combining fluid networks in separate simulations, but can also be used within the same simulation.

These links work in pairs, with each member of the pair residing in different networks, similar to the GunnsFluidExternalSupply and Demand. In this case, however, both links are of this same type. They implement the same kind of Supply and Demand roles as the former links, and they automatically handshake between themselves and swap roles when needed to ensure stability, by keeping the Supply role on the side with the larger local network capacitance.

How To Use In GunnsDraw

(Note this link is not available in the obsolete GunnShow tool.)

The picture below illustrates how to connect the GunnsFluidDistributedIf to a node in its network. This picture shows a pair of links in different networks, and the data that is transported between them across the interface.

In this picture, link_a is connected to Node 0 in the left-hand side network, and link_b is connected to Node 7, in the other network. Both nodes are capacitive, i.e. they have a capacitor-style link on them, such as a GunnsFluidCapacitor or GunnsFluidTank.

Port Connection Rules

These are limitations on the port connections to nodes that the link enforces in run-time:

  • Port 0 cannot connect to the Ground node.

Other Rules

These are extra rules you should always try to follow:

  • The connected node must be capacitive, as this link requires a pointer to the node’s capacitor link in its config data (below).
  • Both nodes in the paired networks should should have the same default volume, via their capacitor links. These GunnsFluidDistributedIf links unify the two nodes to act like one of those volumes.
  • If there are multiple of these links in the same network that can ‘see’ each other through conductive pathways, then they should be told about each other, to avoid interfering with each other. See the Input File Setup section below.

Configuration Data Parameters:

  • isPairMaster (default = false): One link in the pair should be designated as the master, by setting this flag True. This is used as a tie-breaker between the links when hand-shaking between the Supply and Demand roles. If both links have this flag as the same value, this can cause the interface to not function properly.
  • useEnthalpy (default = false): This determines whether the pair transfers fluid energy as temperature or specific enthalpy. Both links in the pair should use the same value here. When these are false, the mEnergy term in their interfacing data represents fluid temperature (in degrees Kelvin). When these are true, the mEnergy term is specific enthalpy, in (J/kg). A mismatch in this value between the links is very bad — make sure they are the same in both links! When both sides of the interface are using this GunnsFluidDistributedIf link, using either True or False in this field has identical performance and there is no advantage to either (but both links in the pair must use the same value!) However when interfacing to a non-GUNNS model, using Enthalpy (true) will be better for conserving energy, but using Temperature (false) will be better for matching temperature, if the other model doesn’t have identical fluid properties as GUNNS. Usually, Enthalpy will be the better choice.
  • demandOption (default = false): This is an optional setting to trade stability for increased flow in the interface. By default (false), the link favors stability, and may restrict flow across the interface more than you want. If you need more flow, and can handle more risk of instability in the interface, set this flag true in both links of the pair.
  • capacitorLink (default = 0, must not equal 0): This is the address of the GunnsFluidCapacitor or derived link connected to the same node as this link. For example in the picture above, this value for link_a would be: &network- >vol0.
  • mFluidSizesOverride (Input File only) (default = false): By default (false), this link will size the fluid mixture arrays in its mInData and mOutData interface data objects to match the number of fluids in its network. However, some external sim interfaces may require larger arrays. For example, you might have 1 bulk fluid type and zero trace compounds in your network, but the HLA FOM might require 6 bulk fluids and 4 trace compounds. In such a case, set this flag to true, and specify the sizes of the bulk and trace compound mixture arrays with the mNumFluidOverride and mNumTcOverride values, below. You can set these individually in the input file, or you can set them by calling the overrideInterfaceMixtureSizes function, described below. When this override is active, the link will fill any extra slots in the interface arrays with zeros, for both incoming and outgoing data.
  • mNumFluidOverride (Input File only) (default = 0): Use this in conjunction with mFluidSizesOverride above to specify the size of the bulk fluid mixture array to be sent across the interface.
  • mNumTcOverride (Input File only) (default = 0): Use this in conjunction with mFluidSizesOverride above to specify the size of the trace compounds mixture array to be sent across the interface.

Input Data Parameters:

  • malfBlockageFlag (default = false): Just like GunnsFluidExternalDemand, this malfunction can be used to isolate the pair from each other.
  • malfBlockageValue (default = 0.0, must be (0-1)): Same as GunnsFluidExternalDemand.
  • forceDemandMode (default = false): Setting this to true forces this side of the interface to always be in Demand mode regardless of the relative capacitances of both sides. This can be useful when interfacing with another implementation that doesn’t support Demand mode, for instance. This should be used with caution.
  • forceSupplyMode (default = false): Setting this to true forces this side of the interface to always be in Supply mode regardless of the relative capacitances of both sides.

Input File Setup:

Multiple Links Coordination:

Whenever there are multiple of these links in the same network with a conductive path between them, they will interfere with each other unless you tell them about each other. This interference can lead to instability and ‘blow ups’ in the interface. To tell the link about other such links, call each link’s addOtherIf function in the input file with the names of the other links. For example, here we have a network with 2 of these links, A and B:

network.A.addOtherIf(network.B)
network.B.addOtherIf(network.A)

Override Interface Mixture Array Sizes:

See mFluidSizesOverride above. You can set those terms directly in the link’s configuration data, or by calling the configuration data object’s overrideInterfaceMixtureSizes function. As an example, we will show both ways to override a link named A in a network named network to use 6 bulk fluids and 4 trace compounds, in the Trick input file:

Setting directly:

network.netConfig.A.mFluidSizesOverride = True
network.netConfig.A.mNumFluidOverride   = 6
network.netConfig.A.mNumTcOverride      = 4

Calling the function:

network.netConfig.A.overrideInterfaceMixtureSizes(6, 4)

Common Problems

  • TBD.

References

  • “Distributed Fluid Simulation Interface Standard” J. Harvey, Draft, June 2019.
Clone this wiki locally