Overview
Comment: | Density CR (for SimpleGasTurbine). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4b5a41d7396d85072a140b0a38356e8d |
User & Date: | geraint@users.sourceforge.net on 2004-09-02 21:52:04 |
Other Links: | branch diff | manifest | tags |
Context
2004-09-02
| ||
22:04:06 |
Passes ${use_reduce} to mtt_make_sympar so that it can decide if to issue warnings about Reduce reserved words check-in: 1bcb3ff391 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
21:52:04 | Density CR (for SimpleGasTurbine). check-in: 4b5a41d739 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
21:51:30 | Polytropic CR (for SimpleGasTurbine). check-in: 896433377b user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Added mttroot/mtt/lib/cr/perl/Density.pm version [2d4c1c67cc].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | #------------------------------------------------------------------------------- # Model Transformation Tools #------------------------------------------------------------------------------- package Density; #------------------------------------------------------------------------------- # linear constitutive relationship with cosine modulation #------------------------------------------------------------------------------- use strict; use warnings; #------------------------------------------------------------------------------- # standard module header (see perlmod for explanation) #------------------------------------------------------------------------------- BEGIN { use Exporter (); our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(&Density); # CR name %EXPORT_TAGS = ( ); } #------------------------------------------------------------------------------- # declaration of specific component implementations #------------------------------------------------------------------------------- sub Density_r(@); # R #------------------------------------------------------------------------------- # main function: selects which subfunction to call #------------------------------------------------------------------------------- sub Density (@) { my $retval; $_ = $_[0]; s/\((.*)\)/$1/; # strip brackets my @args = split (/,/); # split arguments $_ = $args[0]; # get component type # select rule to use if (/^R|r$/) { $retval = Density_r (@args); } # if a substitution has been made ($retval) if ($retval) { return $retval; # return substituted expression } else # return nothing { return; } } #------------------------------------------------------------------------------- # R #------------------------------------------------------------------------------- sub Density_r (@) { my @args = @_; my $retval = ''; if ($#args == 15-1) { if ($args[2] eq 'ideal_gas') { my ($component, $required_output, $law, $R, $out_causality, $out_port, $Pressure, $P_causality, $P_port, $Temperature, $T_causality, $T_port, $Nothing, $N_causality, $N_port) = @args; if (($P_causality eq 'effort') and ($P_port == 1) and ($T_causality eq 'effort') and ($T_port == 2) and ($N_causality eq 'flow') and ($N_port == 3)) { if ($required_output eq 'density') { return "(($Pressure)/(($R)*($Temperature)))"; } elsif ($required_output eq 'specific_volume') { return "(($R)*($Temperature)/($Pressure))"; } } } elsif ($args[2] eq 'incompressible') { my ($component, $required_output, $law, $rho, $out_causality, $out_port, $Pressure, $P_causality, $P_port, $Temperature, $T_causality, $T_port, $Nothing, $N_causality, $N_port) = @args; if (($P_causality eq 'effort') and ($P_port == 1) and ($T_causality eq 'effort') and ($T_port == 2) and ($N_causality eq 'flow') and ($N_port == 3)) { if ($required_output eq 'density') { return "($rho)"; } elsif ($required_output eq 'specific_volume') { return "(1/($rho))"; } } } } if ($retval) { return $retval; } else { return; } } #------------------------------------------------------------------------------- 1; # return true |