Interior compartments can get "contents" in several ways:

- An accident can occur which breaks a hole in the compartment,
- One can open a flood valve and let water run into the compartment,
- One can open the vent valves and let water run into the compartment, or
- Fluid can be pumped directly into the compartment.

Any of these processes is controlled by one of two commands. One of these "automatically" pumps water into compartments and will be discussed below. The other one is:

&COMPARTMENT, -FLAG(1), -OPTION(1), ... -FLAG(n), -OPTION(n)

Now, this syntax is different from the normal in that here there are two things which begin with a **-**. The basic distinction between a FLAG and an OPTION is that FLAGS
specify a class of action and OPTIONS are more specific. A single FLAG can apply to more than one OPTION.

To control accidental or intentional flooding one uses the four flags:

-FLOOD, :CMP_SEL(1), .... :CMP_SEL(n)-NO_FLOOD, :CMP_SEL(1), .... :CMP_SEL(n)-OPEN_VALVE, :CMP_SEL(1), .... :CMP_SEL(n)-DOWN_FLOOD, :CMP_SEL(1), .... :CMP_SEL(n)-DYNAMIC, :CMP_SEL(1), .... :CMP_SEL(n)

The **-FLOOD** flag tells MOSES that the compartments which match :CMP_SEL(i) will be open to the sea and that they will normally be full of water up to
the waterline. The **-NO_FLOOD** flag is used to reverse the process. When this is used, compartments revert to being filled as before it was flooded,
but with the *current* filling type (filling type is discussed below).

The **-OPEN_VALVE** specifies that all flood valves attached to the compartment are open. Here, ambient water will flow into the compartment, or
contents will flow out depending on the location of the valves, internal pressure, and amount of ballast in the compartment. This change of fluid in the compartment
occurs *statically*, and can be observed using **&STATUS COMPARTMENT**. The maximum volume of fluid in the compartment is limited by the last add ballast option specified.
This means that when first opening the valve, the pressure due to the ballast amount specified is included in the calculations. The ballast options **-AMOUNT**, **-FRACTION**, **-PERCENT**, or **-SOUNDING** are to be are the add ballast options.

The **-DOWN_FLOOD** option instructs MOSES to fill the compartment up to the waterline whenever the lowest vent point goes below the water. Here no
maximum need to be specified. This option is particularly useful for hydrostatic stability and capsizing studies. Down-flooding points on tanks that have been marked
with **-DOWN_FLOOD** are not used when computing down-flooding during a RARM command. Thus, this option can be used to get a correct picture of the stability. Notice that
when this command is issued, water may be drained from the compartment.

The **-DYNAMIC** option defines tanks which will be flooded dynamically when a time domain simulation is performed. In essence, this option opens the
valves of all holes with a type of F_VALVE at the beginning of a time domain simulation. Using this option is reasonably delicate. It should be the last item
specified on the command. Any reference to "dynamic" compartments after they are selected will *turn off* the dynamic behavior.

There are three options which influence this flooding:

-INT_PRE, :CMP_SEL(1), .... :CMP_SEL(n), INTPRE, EMP_FRACT-COMPRESSOR, :HOL_NAME(1), .... :HOL_NAME(n), PCOMP, FLCOMP-PUMP, :HOL_NAME(1), .... :HOL_NAME(n), PCOMP, FLCOMP

The **-INT_PRE** option is used to define the initial internal gage pressure (air pressure in the compartment minus atmospheric pressure) in the
compartment (ksi or mpa). If INTPRE is zero, then all vents in the compartment are open, if INTPRE is greater than zero, then all vent valves on the compartment will
be closed. If there are holes with a type of VENT, then there will be no internal pressure, otherwise the internal pressure will limit the capability of the
compartment to flood. EMP_FRACT specifies the percentage full of air in the compartment at the stated internal pressure. If this value is left blank, MOSES assumes
INTPRE is the pressure acting when the compartment is 100 percent full of air. The **-COMPRESSOR** and **-PUMP** compressor or a pump
attached to a compartment which will act during a time domain simulation. Here, PCOMP is the rated gage pressure (ksi or mpa), while FLCOMP is the rated flow rate of
the pump or compressor in cubic feet per minute or cubic meters per minute. The pump or compressor are connected to holes in the compartment and here :HOL_NAME(i) are
selectors for the holes which will receive the pump of compressor.

Now, to pump contents into a compartment one has the flags:

-CORRECT, :CMP_SEL(1), :CMP_SEL(2), ...-APPROXIMATE, :CMP_SEL(1), :CMP_SEL(2), ...-APP_NONE, :CMP_SEL(1), :CMP_SEL(2), ...-APP_WORST, :CMP_SEL(1), :CMP_SEL(2), ...-FULL_CG, :CMP_SEL(1), :CMP_SEL(2), ...-FCG_NONE, :CMP_SEL(1), :CMP_SEL(2), ...-FCG_WORST, :CMP_SEL(1), :CMP_SEL(2), ...-INPUT, AL, AT, Gx, Gy, Gz, :CMP_SEL(1), :CMP_SEL(2), ...-INITIAL,-ADDITIONAL,

and the options:

-PERCENT, :CMP_SEL(1), PERC(1), SPGC(1), ...-FRACTION, :CMP_SEL(1), FRAC(1), SPGC(1), ...-AMOUNT, :CMP_SEL(1), BAL(1), SPGC(1), ...-SOUNDING, :CMP_SEL(1), S(1), SPGC(1), ...

are available. In essence, the flags tell MOSES how to treat the contents and the options tell the amount of contents.

Before this can be described intelligibly, a bit of history is in order. When a compartment is not filled completely, its center of gravity moves about relative to the body when the body changes angle. Now, we simply compute the correct location of the center of gravity. In the past, however, this was a laborious computation and several methods were developed to approximate its location; i.e.

Xg = Xo + Ac

where Xg is the current CG location, Xo is the CG location in a reference position, A is a matrix (with only two non zero terms) of the derivative of the CG with
respect to angle changes, and c is the change in angle from the reference position. In perhaps more familiar terms, the A matrix contains all zeros except for the
first and second diagonal elements and these are the "free surface moments" divided by the current amount of ballast in the tank. We are being a bit vague here for a
reason. Different stability rules **require** that certain values be used for Xo and A in certain conditions. Thus the different filling types specified by the flags
above - a way to treat the problem approximately and satisfy the rules!

The filling FLAGS correspond to different choices of Xo and A as follows:

**-CORRECT**compute the CG and its derivative at each point in a simulation.**-APPROXIMATE**use the correct CG and its derivative when the compartment is filled.**-APP_NONE**use the correct CG when it is filled and use zero for the derivative (no free surface correction).**-APP_WORST**use the correct CG when it is filled and the derivative which yields the largest free surface moment. Here maximum is the maximum over the depth of the tank.**-FULL_CG**use the CG of the tank when it is full for the reference CG and use the correct derivative when the tank was filled.**-FCG_NONE**use the CG of the tank when it is full for the reference CG and zero for the derivative.**-FCG_WORST**use the CG of the tank when it is full for the reference CG and use the derivative which produces the maximum free surface moment.**-INPUT**use the input values for the CG and its derivative. Here AL and AT are the longitudinal and transverse derivatives in feet or meters/deg and Gx, Gy, and Gz are the X, Y, Z coordinates (feet or meters) of the CG in the part system.

The two flags **-INITIAL** and **-ADDITIONAL** define whether or not the compartments will be emptied before adding, or whether the
following fluid will be added to that which exists. For all of these flags, :CMP_SEL(i) is a selector which defines the compartments which will have their properties
altered.

The -FLAGS define how the amounts defined with **-PERCENT**, **-FRACTION**, **-AMOUNT** or **-SOUNDING** will
be treated. These options instruct MOSES to add ballast to the specified tanks; the only difference is the manner in which the amount of ballast is specified. With **-PERCENT**, one specifies the percentage full, with **-FRACTION**, he specifies the fraction full, with **-AMOUNT**, he specifies the amount of ballast
(bforce), and with **-SOUNDING** he specifies a sounding (feet or meters). SPGC is the specific gravity of the contents of a tank. If it is omitted,
then the last specific gravity provided for a tank will be retained. For new tanks, the default is the specific gravity of ambient water. If none of these flags is
specified, then all tanks mentioned will have a fill type defined by the **-FILL_TYPE** option of the **&DEFAULT** command. The values :CMP_SEL(i) which may follow these
options allows one to change the type of filling without altering the amount of ballast in the tanks.

This command is quite complicated and a few examples are in order:

&COMPARTMENT -CORRECT ONE TWO S@

will change the type of filling for tanks ONE, TWO, and all tanks which match S@ to CORRECT. A tank half full can be specified as:

&COMPARTMENT -PERCENT ONE 50

or

&COMPARTMENT -FRACTION ONE .5

A tank full of two different fluids can be defined by:

&COMPARTMENT -PERCENT ONE 50 1.025 &COMPARTMENT -ADDITIONAL ONE 50 .800

Here, the heavier fluid will be at the bottom of the tank, and the ballast will correctly reflect the combination of the fluids. The vertical CG, however, will be approximated by the center of volume of the two fluids.

For an example of moving water in a compartment statically, consider:

&COMPART -OPEN_VALVE -PERCENT ONE 50 -INT_PRE ONE 3 100

In this case, fluid will flow out of the compartment if the specified internal pressure is greater than the ambient pressure at the valve location.

To initially ballast a tank half full and have it flood dynamically, one issues:

&COMPARTMENT -PERCENT ONE 50 -DYNAMIC ONE

and to turn off dynamic flooding,

&COMPARTMENT -PERCENT ONE 50

To simulate a compressor attached to a compartment, consider the following:

&COMPART -DYNAMIC ONE -PERC ONE 50 -INT_PRE ONE 1E-5 .5 \ -COMPRE ONE .05 10000

Here, the vent valve is closed by providing a non-zero value for INTPRE. To analyze what happens as the compartment empties, one should issue a TDOM command.

To automatically ballast a body to achieve a desired condition, one should use the command:

&CMP_BAL, BODY_NAME, :CMP_SEL(1), -OPTIONS, ... :CMP_SEL(n) -OPTIONS

where the available options are:

-LIMITS, MIN, MAX-HARD

Here, BODY_NAME specifies the name of the body to be ballasted and :CMP_SEL(i) specifies the compartments in which ballast will be altered. MOSES will then move water
into and/or out of specified tanks until the body is in equilibrium. The minimum and maximum amount compartments will be ballasted can be defined with the **-LIMITS** option. All compartments mentioned *after* this option will not be ballasted below MIN percent full, nor will they be ballasted greater than MAX
percent full. If a **-LIMITS** was not used, all active compartments will have a minimum of the minimum allowed in the tank and a maximum of 100.