Distributed Bi Directional Flow Fluid Interface Capacitance - nasa/gunns GitHub Wiki

Table of Contents

What is Capacitance

This article describes the fluid capacitance used by the GunnsFluidDistributed2WayBus interface and how to calculate it for your local model.

In general, the fluid capacitance, C, at a location is the amount of fluid moles, n, added to the location to raise its pressure, p, by unit. We can write this as C = dn/dp, and we use the base SI units of (mol/Pa). See the equations for calculating capacitance of a single volume in the section below, but realize that the capacitance we're after is more complicated than that of a single volume.

Both sides need to know how much each side's pressure will change in response to a given amount of flow across the interface. This helps maintain stability, by a) limiting the Demand-side's calculated flow rate to avoid overshooting the equilibrium pressure too much, and b) both sides knowing each other's capacitance allows them to negotiate swapping Supply & Demand roles to keep the Supply role on the side with the larger capacitance.

There are a few important features we need in the capacitance for this interface, which we'll detail further below:

  • The interface needs to know the capacitance of the entire local model, at the interface location. Therefore this must consider that some of the added mole spreads out throughout the other connected volumes in the local model.
  • It must reflect the dn/dp over exactly one timestep,
  • It must not include the effective capacitance added to the local model by this interface when it is in Demand mode, or any other interfaces in Demand mode.

Calculating Capacitance for the Interface

Multi-Volume Systems

Your model likely has more than one volume, connected to the interface location by flow restrictions such as pipes, valves, hatches, etc. that can open and close during runtime. For this reason, the capacitance at the interface changes when any of those flow restrictions change, such as valves & hatches opening or closing, pipes & filters getting clogged, etc. The capacitance of fluid in any volume also changes with the fluid temperature and flexible volume, and for non-ideal fluids, its mixture and density. Depending on how many of these effects are in your model, the capacitance of the entire model as seen by the interface might be impossible to calculate by hand. So, we recommend this method as a general solution of the interface capacitance:

The best way to calculate your capacitance is to perform a mock solution of your model - do a 'what-if' update of your model on the side. Take your initial model pressure, p0. Add a mole of fluid to your model, and solve the model for a new mock pressure pmock after one time step, considering all the flows throughout the model, fluid mixing and updated fluid mixture properties. Then compute the capacitance as:

C = 1/(pmock - p0)

Then throw away that mock solution and return your model to its normal modeled state. Pass the new value of C to the interface's processOutputs function.

Interactions with other Interfaces

An interface in Demand mode adds real capacitance to the local model, because it constrains the model pressure at its location. However, it is important that this effect not be included in its own capacitance calculation, or the capacitance calculation for any other interfaces exposed to it through flow pathways. If the capacitance included the Demand role interfaces, then it could create a feedback loop in the capacitances between the models that artificially amplifies their capacitance values to be much larger than their real capacitance, defeating the interface's stability.

Examples

Here is the ISS+VV example from the GunnsFluidDistributed2WayBus interface article, showing what is included in each of the 4 GunnsFluidDistributed2WayBus:

Distributed_Fluid_Capacitance_Examples

Below we show an example liquid coolant loop, where the heat exchanger is in another model, across the HLA interface, from the pump/accumulator package. In this case, since liquid has very little capacitance, most of the capacitance in this system comes from the flexible volume within the accumulator, and the lines themselves have almost zero capacitance. Also, the heat exchanger side, having only fixed lines, would have almost zero capacitance, and therefore would always be in the Demand role.

Distributed_Fluid_Capacitance_Examples_2

Equations for Capacitance in a Volume

You can directly calculate the capacitance of a single volume, shown below. However, if your model has multiple volumes connected by flow restrictions, then the capacitance value needed by the interface is much more complicated than this.

For ideal gasses at constant volume V and temperature T, the capacitance derives straight from the ideal gas law:

pV = nRT

n = pV/RT

C = dn/dp = d(pV/RT)/dp

C = V/RT,

with R being the universal gas constant.

For ideal gas in a non-constant volume as a function of pressure V = f(p), such as an inflatable:

C = (f + f'p) / RT

,

with f' being the derivative of f(p) with respect to pressure.

For non-ideal fluids in a constant volume, where you can describe the compressibility as change in density, ρ, over change in pressure: dρ/dp, capacitance is:

C = (V/MW) * dρ/dp

,

with MW being the fluid molecular weight to convert from mass density ρ to moles.

For non-ideal fluids in the above inflatable volume:

C = (f * dρ/dp + ρf') / MW

This is especially important for liquid systems: since liquids have very low compressibility, most of the capacitance in the system comes from the flexible liquid volume in accumulator bottles, stretchy lines/balloons, or open containers.

See Also

More about fluid capacitance and how it relates to volume and compressibility here.

More about the electrical-fluid-thermal analog for capacitance, and how it is implemented in GUNNS here.

What we're after for this interface is more akin to what GUNNS calls 'network capacitance'. More about GUNNS network capacitance here. This is GUNNS-specific and doesn't apply exactly to a non-GUNNS model, but helps explain the concept.

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