17.1.1. Example 1: Print the Value of the Pressure Drop Through a Pipe

! $Pin = massFlowAve("Pressure","inlet");
! $Pout = massFlowAve("Pressure","outlet");
! $dp = $Pin-$Pout;
! print "The pressure drop is $dp\n";

Note:  Function-specific Perl subroutines do not allow phase-specific evaluations; that is, you can get only bulk results (such as mass flow for all phases). A workaround is to use "evaluate" subroutine, which evaluates any CEL expression.

For example instead of

! $val = massFlow("Inlet", "Water")   # Does NOT work

you need to use:

! ($val, $units) = evaluate( "Water.massFlow()\@Inlet");