NBSIR 87-3661

Research Information Center

National Bureau of Standards

Gaithersburg,' Maryland 20899

Indoor Air Quality Modeling

Phase II Report

James Axley

U.S. DEPARTMENT OF COMMERCE

National Bureau of Standards

National Engineering Laboratory

Center for Building Technology

Building Environment Division

Gaithersburg, MD 20899

October 1987

Prepared for: U.S. Environmental Protection Agency

U.S. Department of Energy

O'!

NBSIR 87-3661

INDOOR AIR QUALITY MODELING

PHASE II REPORT

James Axley

U.S. DEPARTMENT OF COMMERCE

National Bureau of Standards

National Engineering Laboratory

Center for Building Technology

Building Environment Division

Gaithersburg, MD 20899

October 1987

Prepared for: U.S. Environmental Protection Agency

U.S. Department of Energy

U.S. DEPARTMENT OF COMMERCE, C. William Verity, Acting Secretary

NATIONAL BUREAU OF STANDARDS, Ernest Ambler, Director

NBS: Indoor Air Quality Model

Phase II Report

ABSTRACT

ABSTRACT

This interim report presents the results of Phase II of the NBS General Indoor Air

Pollution Concentration Model Project. It describes the theoretical basis of a

general-purpose nonreactive contaminant dispersal analysis model for

buildings, the computational implementation of a portion of this model in the

program CONTAM86, and examples of the application of this model to practical

problems of contaminant dispersal analysis. Presently the model is being

extended to handle problems of reactive contaminant dispersal analysis and full computational implementation of all portions of the model is being completed.

The contaminant dispersal analysis model is based upon the idealization of

building air flow systems as an assemblages of flow elements connected to

discrete system nodes corresponding to well-mixed air zones within the

building and its HVAC system. Equations governing the air flow processes in

the building (e.g., infiltration, exfiltration, HVAC system flow, & zone-to-zone

flow) and equations governing the contaminant dispersal due to this flow,

accounting for contaminant generation or removal, are formulated by

assembling element equations so that the fundamental requirement of

conservation of mass is satisfied in each zone. The character and solution of

the resulting equations is discussed and steady and dynamic solution methods

outlined.

KEY WORDS: contaminant dispersal analysis , flow simulation, building

simulation, building dynamics, computer simulation techniques, discrete

analysis techniques,

ii
n

lilPi
NBS: Indoor Air Quality Model

Phase II Report

ACKNOWLEDGEMENTS

ACKNOWLEDGEMENTS

Although the author of this report assumes full responsibility for the contents of

the report it is important to acknowledge the contribution made by Richard Grot

and George Walton who together with the author acted, in effect, as a project

team.

Dr. Richard Grot of the Indoor Air Quality and Ventilation Group, Building

Environment Division, National Bureau of Standards closely supervised all

research reported in this document, providing essential critical evaluation and

guiding the direction of the work by applying his considerable experience in the

field and keen intellect to the task at hand. This he accomplished with his

always engaging sense of humor and tireless enthusiasm.

The indoor air quality model presented in this report is based largely upon the

work of George Walton of the Mechanical Systems and Controls Group,

Building Environment Division, National Bureau of Standards. In fact, the

present model should, properly, be presented as an extension of his earlier

work. George was involved in Phase I and the early part of Phase II of this

project and continued thereafter to provide his invaluable insight in the model

development effort.

This work was supported by the Department of Energy, Contract IAG: DE-AI01-

86CE21013, the Environmental Protection Agency, Contract IAG: DW13931103-01-2, and the Department of Architecture, Cornell University.

iii
NBS: Indoor Air Quality Model

Phase II Report

CONTENTS

CONTENTS

13 ob........ ...........

ACKNOWLEDGEMENTS ...............

CONTENTS .........

PART I - Theoretical Basis

1. General Considerations ...............

1.1 Definition of Problem . 1.2 Modeling Approaches . . . 1.3 The Well-Mixed Macroscopic Model .......

2. Contaminant Dispersal Analysis ...........

2.1 Element Equations ...............

2.2 System Equations

2.3 Boundary Conditions . . . . 2.4 Elimination of Massless DOFs ..........

2.5 Qualitative Analysis of System Equations . . . . . 2.6 Solution of System Equations ..........

2.6.1 Steady State Behavior ...........

2.6.2 Free Response Behavior ..........

2.6.3 Dynamic Behavior .............

3. Air Flow Analysis . 3.1 Pressure Variation within Zones .........

3.2 Element Equations

3.2.1 Flow Resistance Element Equations . . . . . 3.2.2 Fan/Pump Element Equations ........

3.3 System Equations . . . . 3.4 Simple Examples ...............

3.5 Solution of Flow Equations ...........

3.5.1 Successive Substitution . . . . 3.5.2 Newton-Raphson Iteration .........

3.5.3 Incremental Formulation ..........

iie

iv

. vii

1-1

1-2

1-4

1-6

2-1

2-1

2-3

2,5

2-7

2-8

2-17

2-18

2-18

2-19

3-1

3-1

3-3

3-3

3-14

3-18

3-20

3-26

3-26

3-30

3-33

4.

Summary and Directions of Future Work 4-1
NBS: Indoor Air Quality Model CONTENTS

Phase II Report

PART I References ......... Ref I -1

PART II - CONTAM86 Users Manual

5. General Instructions 5-1

6. Command Conventions 6-1

7. Introductory Example 7-1

8. Command Reference 8-1

8.1 Intrinsic Commands 8-1

8.1.1 HELP 8-1

8.1.2 ECHO .................... 8-1

8.1.3 LIST 8-1

8.1.4 PRINT A=<array> 8-1

8.1.5 DIAGRAM A=<array> 8-1

8.1 .6 SUBMIT F=<filename> 8-1

8.1.7 RETURN 8-2

8.1 .8 QUIT 8-2

8.2 CONTAM86 Commands 8-3

8.2.1 FLOWSYS 8-3

8.2.2 FLOWELEM 8-4

8.2.3 STEADY 8-4

8.2.4 TIMECONS 8-5

8.2.5 Dynamic Analysis 8-7

8. 2.5.1 FLOWDAT 8-7

8. 2.5. 2 EXCITDAT 8-9

8. 2.5. 3 DYNAMIC 8-10

8.2.5.4 Dynamic Analysis Example 8-11

8=2.6 RESET . . 8-13

9.

Example Problems 9-1

9.1

Single Zone Examples 9-1

9.1.1 Case 1: Contaminant Decay under

Steady Flow Conditions 9-2

9.1.2 Case 2: Contaminant Decay under

Unsteady Flow Conditions 9-7

9.1.3 Case 3: Contaminant Dispersal Analysis of an

v
NBS: Indoor Air Quality Model

Phase II Report

CONTENTS

Experimental Test ...........

9.2 Two Zone Example ............

9.3 Full-Scale Multi-zone Residential Example .

PART II References ...............

Appendix- FORTRAN 77 Source Code

. . . 9-10

. . . 9-14

. . . 9-19

. . Ref 11-1

VI
NBS: Indoor Air Quality Model

Phase II Report

PREFACE

PREFACE

The work reported here is a product of the General Indoor Air Pollution

Concentration Model Project initiated in 1985 at the National Bureau of

Standards with the support of the U. S. Environmental Protection Agency and

the U.S. Department of Energy. The fundamental objective of this project is to

develop a comprehensive validated computer model to simulate dynamic

pollutant movement and concentration variation in buildings. The scope of the

project is ambitious; a full-scale, multi-zone building contaminant dispersal

model that simulates flow processes (e.g., infiltration, dilution, & exfiltration) and

contaminant generation, reaction, and removal processes is being developed.

During the planning stage of this project it was decided to organize efforts into

three distinct phases:

Phase I: formulation of a general framework for the development of general

indoor air quality analysis models (see [1] for report of Phase I work),

Phase II: development of a residential-scale model, based on the simplifying

assumption that air is well-mixed within each building zone, providing

simple simulation of HVAC system interaction, and

Phase III: extension of modeling capabilities to allow more complete simulation

of HVAC system interaction and consideration of rooms that are not

well-mixed.

This report presents a model that satisfies the scope and objectives set for

Phase II of the "General Indoor Air Pollution Concentration Model" Project and,

as such, completes Phase II efforts. The report is organized in two parts. In the

first part of the report the theoretical basis of the model is presented;

Section 1: outlines the general aspects of indoor air quality simulation making

the distinction between contaminant dispersal analysis and air flow

analysis,

Section 2: presents the theoretical basis of contaminant dispersal analysis,

Section 3: presents the theoretical basis of air flow analysis.

VII
NBS: Indoor Air Quality Model

Phase II Report

PREFACE

The second part of the report presents the practical implementation of the

contaminant dispersal analysis model in the program CONTAM86;

Sections 5 -8: provide a users manual for the program CONTAM86, and

Section 9: gives examples of application of CONTAM86, and its underlying

theory, to problems of contaminant dispersal analysis.

The complete source code for CONTAM86 is listed in the appendix.

viii
NBS: Indoor Air Quality Model

Phase II Report

PART I Theoretical Basis

1. General Considerations

1. General Considerations

Airborne contaminants introduced into a building disperse throughout the

building in a complex manner that depends on the nature of air movement in-to

(infiltration), out-of (exfiltration), and within the building system, the influence of

the heating ventilating and air conditioning (HVAC) systems on air movement,

the possibility of removal, by filtration, or contribution, by generation, of

contaminants by the HVAC system, and the possibility of chemical reaction or

physical-chemical reaction (e.g., adsorption or absorption) of contaminants with

each other or the materials of the buildings construction and furnishings.

Fig. 1.1 Contaminant Dispersal in a Residence

Our immediate objective, here, is to develop a model of this dispersal process

for residential-scale building systems that comprehensively accounts for all of

these processes that affect the actual contaminant dispersal phenomena. We

shall, however, attempt, to develop this residential-scale modeling capability

within a more general context so that techniques developed here may be

extended to more complex problems of indoor air quality analysis. To this end,

in this section, the problem is given a general definition and the basic modeling

strategy used to address this problem is outlined.

1 -1
NBS: Indoor Air Quality Model

Phase II Report

PART I Theoretical Basis

1. General Considerations

1.1 Definition of Problem

The building air flow system may be considered to be a three dimensional field

within which we seek to completely describe the state of infinitesimal air

parcels. The state of an air parcel will be defined by its temperature, pressure,

velocity, and contaminant concentration (for each species of interest) - the state

variables of the indoor air quality modeling problem.

Air Parcel State Variables

Temperature: T(x,y,z,t)

Pressure: P(x,y,Z,t)

Flow Velocity: v(x,y,z,t)

0^

i, Concentration: C(x,y,Z,t), C(x,y,Z,t),

for species cx, 3, ...

3 ,

Fig. 1 .2 Air Parcel State Variables

Our immediate task is, then, to determine the spacial and temporal variation of

the species concentrations within a building due to thermal, flow, and

contaminant excitation driven by environmental conditions and the HVAC

system and its control given building characteristics and their control. That is,

we seek to determine;

0^ C(x,y,Z,t) ; Contaminant " <x" Concentration

3 / \ C(x,y,Z,t) ; Contaminant ”3" Concentration

where;

C = species mass concentration or mass fraction

1 -2
NBS: Indoor Air Quality Model

Phase II Report

PART I Theoretical Basis

1. General Considerations

[=] mass of species/mass of air

a, [3 = species type indices

x, y, z = spacial coordinates

t =time

and shall refer to the process of determining the spacial and temporal variation

of these species concentrations as contaminant dispersal analysis .

Contaminant dispersal analysis, for a single nonreactive species "a", depends

on the air velocity field and its variation with time;

^CCx.y.z.t) = "cC v(x,y,z,t) ) & B.C. : Contam. Dispersal Anal. (1.1)

But the air velocity field depends on the pressure field which is affected by the

temperature field through buoyancy and, completing the circle, the temperature

field is dependent on the velocity field;

where;

B.C = boundary conditions

v = air flow velocity

P = air pressure

T = air temperature

Flow Analysis 0.2)

Buoyancy Effects 0.3)

Thermal Analysis 0.4)

Thus, in general, contaminant dispersal analysis, for a single nonreactive

species, is complicated by a coupled nonlinear flow-thermal analysis problem.

Therefore, a comprehensive indoor air quality model will eventually have to

address the related flow and thermal problems.

For cases of reactive contaminants, contaminant dispersal analysis, itself, will

1 -3
NBS: Indoor Air Quality Model

Phase II Report

PART I Theoretical Basis

1„ General Considerations

become a coupled (and, generally, nonlinear) analysis problem as individual

species' concentrations will depend on other species' concentrations in

addition to the air velocity field;

In this report we shall focus on single, nonreactive species dispersal analysis

and the associated problem of flow analysis, for a completely defined thermal

field and its variation. The approach taken, however, has been formulated to be

compatible with thermal analysis modeling techniques developed earlier [2].

Presently, we are addressing the reactive, multiple species dispersal analysis

problem and see no difficulty with extending the approach to this more complex

situation.

1.2 Modeling Approaches

We shall attempt to solve the general field problems posed above by attempting

to determine the state of air at discrete points in the building air flow system. It

will be shown that this spacial discretization allows the formulation of systems

of ordinary differential equations that describe the temporal variation of the state

fields. Two basic approaches may be considered, one based upon the

microscopic equations of motion (i.e., continuity, motion, and energy equations

for fluids) and the other based upon a "well-mixed" zone simplification of

macroscopic mass, momentum, and energy balances for flow systems (for a

concise and complete review of these basic approaches see [3]).

n ^

^CCx.y.Z.t) = ^CCv,

P

C, C, ...)

: Species o< Dispersal Analysis

Q o

(X 2^ C(x,y,Z,t) = C(v, C, C, ...) Species p Dispersal Analysis

(1.5a)

(1.5b)

1 -4
NBS: Indoor Air Quality Model

Phase II Report

PART I Theoretical Basis

1. General Considerations

In the microscopic modeling approach one of several techniques of the

generalized finite element method, which includes the finite difference method

[4], could be used to transform the systems of governing partial differential

equations into systems of ordinary differential equations that then can be solved

using a variety of numerical methods. The macroscopic modeling approach

leads directly to similar systems of ordinary differential equations.

In both approaches the building air flow system is modeled as an assemblage

of discrete flow elements connected at discrete system nodes . Systems of

ordinary differential equations governing the behavior of elements are then

formed and assembled to generate systems of ordinary differential equations

that describe the behavior of the system as a whole (i.e., in terms of the spacial

and temporal variation of the discrete state variables). These systems of

equations may then be solved — given system excitation, initial conditions, and

boundary conditions — to complete the analysis.

Virtually all computational procedures, except those used to form the element

equations, would be practically identical for both approaches. From a practical

point of view, however, microscopic modeling will involve on the order of 1000

nodes per room while the macroscopic model will involve on the order of only

10 nodes/room to realize acceptably accurate results. With six state variables

1 -5
MBS: Indoor Air Quality Model

Phase II Report

PART I Theoretical Basis

1„ General Considerations

for a single species - temperature, pressure, three velocity components and

species concentration - the microscopic modeling approach can lead to

extremely large systems of equations that therefore limit its use, at this time, to

research inquiry. The macroscopic approach, resulting in systems of equations

that are on the order of two magnitudes smaller than the microscopic approach,

is a reasonable candidate for practical analysis, although it can not provide the

detail of the microscopic approach.

Within this report we shall limit consideration to the macroscopic approach,

although the specific techniques employed to implement this approach have

been formulated to be compatible with the microscopic approach and it is

expected that one may, in the future, be able to use both approaches in analysis

to gain the benefits of detail in specific areas of the building system and yet

account for full-system interaction.

I

Fig. 1.4 Possible Hybrid Micro-Macro Discretization

1.3 The Well-Mixed Macroscopic Model

Here, the building air flow system shall be modeled as an assemblage of flow

elements connected to discrete system nodes corresponding to well-mixed

air zones

.

1 -6
NBS: Indoor Air Quality Model

Phase II Report

PART 1 Theoretical Basis

1. General Considerations

Actual B uilding

Fig. 1.5 Well-Mixed Macroscopic Model

Limiting our attention to the contaminant dispersal and flow analysis problems

we associate with each system node the discrete variables or degrees of

freedom (DOFs) of pressure, air mass generation (typically zero), species

concentration, species mass generation, and temperature;

{P} - {p,, p 2 . p 3 . ...

}

; Pressure DOFs 0.6)

{W} = {Wi, w 2 , w 3. }

; Air Hass Generation DOFs 0.7)

ro - rc,, *c3

, ...

}

Species cx Cone. DOFs 0.8)

{

k

g) = re,, %, "Gj, ... }

: Species cx Gen. DOFs (1.9)

K>

f—

C\f 1— p p II

...

}

: Temp. DOFs (1.10)

as well as the key system characteristic of nodal volumetric mass, V-j, V2 , V3

, ... . The pressure, concentration, and temperature DOFs will approximate the

corresponding values of the state field variables at the spacial locations of the

system nodes.

With each element "e" in the system assemblage we note the element

connectivity - the system nodes that the element connects - and identify an

1 -7
MBS: Indoor Air Quality Model

Phase II Report

PART I Theoretical Basis

1. General Considerations

element air mass flow rate, we. The element mass flow rates will be related to

the nodal state variables through specific properties associated with each

particular element to form element equations

.

in the formulation of both the contaminant dispersal model, presented in

Section 2, and the flow model, presented in Section 3, we will assemble the

governing element equations to form equations governing the behavior of the

building system - the system equations - by demanding conservation of mass

flow at each system node.

1 -8
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

2. Contaminant Dispersal Analysis

In this section contaminant dispersal element equations are formulated.

Demanding continuity of mass flow at each system node these element

equations are then assembled to form contaminant dispersal equations

governing the behavior of the full building system. Finally, methods for solution

of the system equations are presented.

2.1 Element Equations

Two nodes2-1 and a total mass flow rate, we , will be associated with each

flow element, where flow from node i to j is defined to be positive. An element

species concentration, a

C® . and an element species mass flow rate, aw® . will

be associated with each element node, k=i, j

. The element species mass flow

rate is defined so that flow from each node into the element is positive.

Fig. 2 .1 Contaminant Dispersal Element DOFs

It follows from fundamental considerations that these element variables are

related directly to the element total mass flow rate as;

2-1 The distinction between element nodes and systems nodes must be made because the

element species concentration vdctor, { aCe

}, is taken as a subset of the system species

concentration vector, { aC}.

2-1
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2„ Contaminant Dispersal Analysis

-oi e- 1 e 1 1 O'

| W | . -1 Q_

a 1 " 0 -r

w | _ o i.

{

aCe

} ; for w* >

{

aCe

}

or

for w < 0

(2.1a)

(2.1 b)

(2.1c)

where;

{

aw

e

} =

{

aCe

} =

{“wf , a

wf}

T

{°Cf , “Cf}

1

; element species mass flow rate vector

; element species concentration vector

[f e

] = element total mass flow rate matrix

1 0

-1 0

0 -1

0 1

; for w

e > 0

; for w

e < 0

(2. Id)

(2.1e)

For the purposes here, element nodes will be selected to correspond to specific

system nodes, consequently, the element nodal species concentrations will

have a one-to-one correspondence with the corresponding system node

species concentrations.

If the element acts as a filter and removes a fraction, rj , of the contaminant

passing through the filter then the element flow rate matrix becomes;

[f ®] = element total mass flow rate matrix

= w

e

|

I

1

0

O

T— 1

1

I

; for w

e > 0 (2. If)

= w

e

I

" 0 (n-1

)-

0 1

; for w

e < 0 (2.ig)

2-2
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

The fraction, r| . is commonly known as the "filter efficiency" and may have

values in the range of 0.0 to 1 .0.

2J2 System Equations

System equations that relate the system concentration DOFs, {

a

C}, to the

system generation DOFs,{a

G}, may be assembled from the element equations

by first transforming the element equations to the system DOFs and then

demanding conservation of species mass flow at each system node.

There exists a one-to-one correspondence between each element’s

concentration DOFs, {

aCe

}, and the system concentration DOFs, {

a

C}, that may

be defined by a simple Boolean transformation;

For example, an element with nodes i & j (or 1 & 2 ) connected to system nodes

5 & 9, respectively, of a 12-node system would have ones in the 1st row, 5th

column and the 2nd row, 9th column and all other elements of the 2x12

Boolean transformation matrix would be set equal to zero.

In a similar manner, we may define a "system-sized vector" to represent the net

species mass flow rate from the system node into an element "e", {

aWe

} , and

relate it to the corresponding element species mass flow rate using the same

transformation matrix, as;

For an arbitrary system node n, with connected elements "a", "b", ... as indicated

below in Fig. 2.2, we then demand conservation of species mass as;

( 2 . 2)

where;

[ aB

e

] is an m x n Boolean transformation matrix consisting of zeros

and ones; m = the number of element nodes (here, m=2); n =

the number of system nodes

{

aw

e

} = [ aB

e

] T

{

awe

} (2.3)

2-3
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

< (elem. species mass flow) +

rate of change'' generation \

of = of

_ connected v species mass ) v species mass/.

elements

(2.4)

system node n

or,

aW

a +aWb

+ + V

n =

a Wn

-r vv n

-r ... -r v n G

^

v^

n

or, for the system as a whole;

X {“We

} + [V]{”} = {“G}

e = a,b,.„

(2.5)

( 2 . 6)

where;

[V] = diag(V 1s V2 , ...) ; the system volumetric mass matrix

Vj = the volumetric mass of node i

Fig. 2.2 Conservation of Species a Mass Flow at System Node n

2-4
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

Substituting relations (2.2) and (2.3) we obtain the final result;

= (

aG} (2.7a)

where;

[F] (2.7b)

e = a,b, ... = the system mass flow matrix

s A[f e

] ; the direct assembly sum of element flow matrices

Equation (2.7a) defines the contaminant dispersal behavior of the system as a

whole and is said to be assembled from the element equations through the

relation given by equation (2.7b). The assembly process, as formally

represented in equation (2.7b), has found widespread application in the

simulation of systems governed by conservation principles and is, therefore,

often represented by the so-called assembly operator A as indicated above. It should be noted that while the formal representation of the assembly process is

important from a theoretical point of view it is generally far more efficient,

computationally, to assemble the element equations directly, without explicitly

transforming them ( see, for example, the "LM Algorithm" in [24] ).

2.3 Boundary Conditions

The variation of concentration or generation rate, but not both, may be specified

at system nodes. Concentration or generation conditions in the discrete model

are equivalent to boundary conditions in the corresponding continuum model

and will, therefore, be referred to as such.

Formally then, we may distinguish between those DOFs for which concentration

will be specified, {

aCc}, and those for which generation rate will be specified,

{

aCg}, and partition the system of equations accordingly;

2-5
MBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

r

v dt^ * y

Using the second equation and simplifying we obtain;

[FggK “C

g

} + [Vgg]{ = {

aG

g

} - [Fgc]{“Cc }

or

[h{

ac} + m| ==•} = {a

E>

(2. 8)

(2.9a)

(2.9b)

where;

[F] = [F

gg] ; the generation driven mass flow matrix

{

aC} = {

aC

g

} ; the generation driven nodal concentration vector

{

a E} = { a G

g

} - [Fgc]{

aCc } ; the system excitation (2.9c)

It should be noted that the response of the system is driven by the system

excitation involving both specified contaminant mass generation rates and

contaminant concentrations which may, in general, vary with time.

Equation (2.9b), written in the standard form of a set of first order differential

equations similar to the form of equation (2.7a), most directly defines the

contaminant dispersal behavior of the system. The formation and solution of

equation (2.9b) will be considered the central task of contaminant dispersal

analysis.

The response of the system is defined by the solution of equation (2.9b) for the

generation rate specified DOFs, {

aCg}. The generation rates, {

aGc}, required to

maintain the specified concentrations, {

a Cc}, may be determined from the

response of the system to the specified excitation using the first equation of

2-6
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

equation (2.8) as;

{

aGc } [Fcc]{

aCc } + [Fcg]{aC

g

} + [Vcc] ( 2 . 10)

Alternatively, one may numerically imposed specified concentration conditions

by directly modifying equation (2.7a). The effect of an infinite source or sink, of

the desired concentration, may be effected by scaling the appropriate diagonal

terms of the system matrices by a large number and setting the corresponding

generation rates equal to the product of the specified concentration and the

scaled diagonal term. (The current version of CONTAM uses this strategy.)

2=4 Elimination of Massless DOFs

Often the analyst will define flow nodes within a complex building airflow system

to model zones having negligibly small volumetric masses (e.g., junctions in

HVAC system ductworks) and the analyst may prefer to model theses zones as

if their nodal volumetric masses were zero. Additionally, the response at such

nodes may be of little interest and the analyst may prefer to eliminate these

nodal DOFs from consideration.

If the system of equations (2.9b) is partitioned into those DOFs having zero

nodal volumetric masses, {

aCz}, and those having non-zero volumetric masses,

{ aGn}, as;

"TPNN

AF 1 zn

r « 'i a

cz

A A < L^nz 1Fnnj

A*. +

0 0

| 0 VnnJ

d

aGz dt

d

aCn dt

( 2 . 11 )

we may eliminate the massless DOFs from consideration by first solving for

these DOFs using the upper equation;

{

aCz } = [F - [F zn ]{

aCn } } ( 2 . 12)

2-7
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

and substituting this result in the lower equation to obtain;

[F]{ aC} + [V] (2.13a)

where;

[F] = [FnJIFJ-'lFzn ] ; the reduced system flow matrix (2.1 3b)

{

a E} = {

a En } - [Fzz]1 {aEz } ; the effective system excitation (2.13c)

{

aC} ^ {aCn }

[V] ^ [Vnn]

Equation (2.13a) is simply a reduced form of equation (2.9b); being a system of

smaller size it may be solved more efficiently. In addition, the elimination of

massless DOFs should help to avoid some numerical problems associated with

round-off error. Eventhough the massless DOFs have been eliminated from

consideration in equation (2.13a) their values may be recovered, at any time,

using equation (2.12). (The current version of CONTAM does not eliminate

massless DOFs.)

2.5 Qualitative Analysis of System Equations

It is important to keep in mind that we have developed equations that described

the contaminant dispersal behavior of building idealizations , based upon

assemblages of ideal flow elements, and have not, strictly speaking, developed

equations that govern the behavior of the actual buildings being considered.

Although it is hoped that these building idealizations will accurately describe

the behavior of the actual buildings being modeled it is possible that they will

not. In fact, it is quite possible to create idealizations that result in equations that

have no solution, at all.

In this section, therefore, we shall consider the conditions that must be met to

yield contaminant dispersal equations that have solutions and in so doing we

shall also learn something about the general qualitative character of the

solutions that are possible.

2-8
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

It should come as no surprise that building idealizations that satisfy

conservation of total mass flow (i.e., as distinguished from species mass flow)

will lead to system of equations that do, in fact, have solutions, but to get to this

seemingly obvious conclusion we shall have to consider the details of the

system flow and mass matrices and their impact upon the dynamic character of

the system as a whole.

System Flow Matrix

The system flow matrix [F], being a direct assembly sum of nonsymmetric

element matrices, will also, in general, be nonsymmetric. The details of the

assembly process reveal that the diagonal elements of the flow matrix are

always positive and the off-diagonal elements negative. Furthermore, if the total

mass flow into a system node is equal to the total mass flow out of a system

node, then the diagonal elements of the flow matrix will be less than or equal to

the "row sum" or the "column sum" of the corresponding off-diagonal elements.

More specifically, for a given system node i the diagonal element, Fjj , is simply

equal to the total mass flow out of a node, throw sum of row i equals the sum

of total mass flow into the node weighted by the filter efficiency factors (rj -

1 );

n row sum of row i = ^ 1 Fn 1 = weighted total mass flow into node i (2.1 4)

j = i j* i

and the column sum equals the sum of total mass flow out of the node weighted

by the filter efficiency factors (rj -

1 );

n column sum of col. i

| Fjj | = weighted total mass flow out of node i (2.1 5)

j=i

i* j

Therefore, if total mass flow is conserved at each node, we may assert;

2-9
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

( 2 . 16)

J* i

and

n

Fjj > ^|Fjj| s column sum of col. i (2.17)

j = i

j

where the equality is strict when filter efficiencies of the elements connected to

node i are zero (i.e., all rj = 0) and the inequality holds if any of the connected

outflow elements (for the row sum) or inflow elements (for the column sum) have

nonzero filter efficiencies.

If all elements of a flow system idealization have nonzero filter efficiencies then

the system flow matrix will be strictly diagonally dominant (i.e., for all i the

inequalities above will hold); a condition that insures, by itself, the possibility of

solution; that is to say, a sufficient condition to prove that the flow matrix would

be nonsingular. For the (unlikely) limiting case where all elements have filter

efficiencies equal to 1.0 the flow matrix becomes diagonal and, therefore, all

zones act as independent (i.e. .uncoupled) single zone systems.

At the other (more likely) extreme where all elements have filter efficiencies

equal to 0.0 the equalities of equations (2.16) and (2.17) hold for all nodes and

the flow matrix is no longer strictly diagonally dominant and, therefore, may not

be assumed to be nonsingular. We may show, however, that the important

submatrix of the flow matrix identified earlier as the generation driven mass flow

matrix is, in fact, nonsingular by demanding conservation of total mass flow of

all subassembiages of system nodes and their inter-connecting elements and

using some relatively esoteric theorems relating to the general class of matrices

known as M-matrices.

An M-matrix may be defined in a number of alternative, but equivalent ways.

Using the alternative employed by Funderlic and Plemmons [5] an M-matrix is a

square nonzero real matrix with all off-diagonal elements nonpositive that has

2-10
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

eigenvalues with nonnegative real parts. It may be shown [6] that a real square

matrix [A], with positive diagonal elements and nonpositive off-diagonal

elements;

a) is an M-matrix (possibly singular) if and only if it can be shown that

t [A] + ?ra ] is a nonsinoular M-matrix for all scalars % > 0 and

b) is a nonsinoular M-matrix if [A] is strictly diagonally dominant

In the case at hand, clearly [ [F] + £[l] ] is strictly diagonally dominant, and

therefore a nonsingular M-matrix, for all scalars % > 0; (if, of course, total mass

flow is conserved at all nodes). Thus we can conclude that [F] is an M-matrix,

although it will be singular for the limiting case when all filter efficiencies are

zero.

It has also been shown that each principal submatrix of an irreducible M-matrix

(other than the M-matrix itself) is a nonsinoular M-matrix [7]. The flow matrix

would be said to be reducible if it is possible, using an appropriate numbering

of the system nodes, to assemble the flow matrix in the form;

where F^ and F 2 2 are square matrices, otherwise [F] would be said to

irreducible. Recalling thatsuperdiagonal term, Fy ; j > i, corresponds to flow

from node j to node i and a subdiagonal term, Fjj ; j > i, corresponds to flow from

node i to node j, a flow matrix of the form of equation (2.18) would correspond to

a flow system idealization having a total mass flow from subassembly 2 to

subassembly 1 , without a return flow from 1 to 2, and, therefore, conservation of

total mass flow would be violated.

We may conclude, then, that;

a) the flow matrix, [F], will be an irreducible M-matrix and, therefore,

b) the generation driven mass flow matrix, [F] , a principal submatrix of the

flow matrix will be a nonsinoular M-matrix .

( 2 . 18)

2 = 11
NBS: Indoor Air Quality Model

Phase II Report

PART I « Theoretical Basis

2. Contaminant Dispersal Analysis

if they are formed based upon a flow idealization that satisfies conservation of

total mass flow

Inasmuch as the solution of the generation driven contaminant dispersal

equations (equation (2.9b)) is the central task of contaminant dispersal analysis

and the nonsingularity of the generation driven flow matrix is a necessary

perequisite to assure the possibility of solution of these equations, the

conclusion that the generation driven flow matrix will be nonsingular when the

flow system idealization satisfies the condition of total mass conservation is of

paramount importance. An additional property of nonsingular M-matrices

provides the additional benefit of allowing efficient numerical solution strategies

to be employed in the solution of these equations.

A Nonsingular M-matrices, and therefore, properly formed [F] matrices, have the

important additional property that they may be factored into the product of lower,

[L], and upper, [U], triangular matrices, [F] = [L][U] , by Gauss elimination

without the need of pivoting in an efficient and numerically stable manner (he.,

resulting in no more accumulation of error that that which would result if pivoting

were employed) [8]. Therefore, not only may we be certain that a properly

formed flow matrix will lead to the possibility of solution but it will also allow the

advantage of the use of very efficient methods of solution associated with LLJ

decomposition.

System Volumetric Mass Matrix

By definition the system volumetric mass matrix, [V], is diagonal and

nonnegative. In those instances when some nodal volumetric masses are so

small that the analyst prefers to modeled them with zero values the system of

contaminant dispersal equations may be reduced, by eliminating the massless

equations (see section 2.4), to a form having an all positive, and therefore,

nonsingular, volumetric mass matrix. The inversion of the positive volumetric

mass matrix is trivial;

[V]-

1 = diag( 1A/n , 1 Nz , ... 1/Vn ) ; V( * 0 (2.19)

2-12
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2, Contaminant Dispersal Analysis

System Equations - Steady Flow

The generation driven contaminant dispersal equations, equation (2.9b), may

now be rewritten in the form;

system being studied. For properly formed idealizations (being the product of a

positive diagonal matrix and a nonsingular M-matrix [9]) it will be a nonsingular

M-matrix and, therefore,

a) solutions to equation (2.20) will exist, and •

b) the product matrix may also be factored into the product of lower, [L], and

upper, [U], triangular matrices, [V]' 1 [F] = [L][U] , by Gauss elimination

without the need of pivoting in an efficient and numerically stable manner

.

We may gain some insight into the general character of solutions to equation

(2.20)

by considering the case of steady flow ( [F] constant) without excitation

(i.e., the homogeneous case);

( 2 . 20)

where, in general, the [F] will vary with time.

A

^ A The product matrix [V]~ [F] contains the essential dynamic character of the

( 2 . 21 )

Anticipating the result we try solutions of the form;

{

aC} = {

aO}e Vx

( 2 . 22)

where;

x = decay time constant

2-13
NBS‘ Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

{

a O } = vector of unknown magnitudes

which, when substituted into equation (2.21) lead to the standard eigenvalue

problem;

[ [V]~'[F ] - (1/x)tn ] {“$} = {0} (2.23)

The solution of this standard eigenvalue problem and its relation to the first

order system of differential being considered is discussed elsewhere [10], [11]

and is well beyond the scope of this report. Suffice it to say, for a properly

formed flow system idealization of n nodes there will be n solutions to this

eigenvalue problem consisting of n pairs of time constants, x, (or equivalently

their inverses, 1/x - the system eigenvalues) and their associated eigenvectors,

r®}

.

—1 ~ In some cases it may be possible to transform the product matrix [V] [F]

t by

similarity transformations, to diagonal form leaving the eigenvalues on the

diagonal as;

[sr1 [[vr1 [F]][S] =

(1/x,) 0 ... 0

0 (1/x2)

... 0

0 0 ... (1/xn) where;

[S] = the similarity transformation

(2.24)

For these cases it will be possible to express the general solution to the

homogeneous problem, equation (2.21), as a linear combination of simple

exponential decay terms;

{“C(t)} = a,{a

0, }e“(t/T,)

+ a2 {

a

<D2 }e (t/T2

)

... a„{aon }e (t/Tn) (2.25)

where the scalar coefficients, a 1f a2 , ... an , are determined from the initial

conditions using the similarity transformation employed as;

2-14
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

r 's a

C,(t=0)

a2

< • = [sr1

- aC2(t=0)

. a". “Cn (t=0)

(2.26)

The n pairs of time constants and associated eigenvectors are often referred to

as the system modes and the response of the system is often described in

terms of the degree to which each mode participates. From the form of the free

response, equation (2.25), it is clear that as time passes the contribution of

those modes with larger time constants will dominate the character of the

response until, eventually, the response, in all zones, will be dominated by the

mode with the largest time constant and therefore will appear to be a simple

exponential decay.

The similarity transformation [S] may be chosen as a matrix whose columns

equal the eigenvectors, in this case, and, therefore, by equation (2.26) we can

see that we may trigger a decay response in any single mode if we simply set

the initial conditions equal to the corresponding eigenvector (or a scalar

multiple of it), although, for some modes the eigenvectors will have negative

components that, for contaminant dispersal problems, would not be physically

admissible.

In general, the solution of the eigenvalue problem will be computationally

demanding. However, for the limiting case discussed earlier, when all flow

elements have filter efficiencies equal to 1.0, eigenanalysis is trivial. For this

case the product matrix [V] -1

[F] will be diagonal, therefore;

a) the time constants, Tj, will be simply equal to (V/F^),

b) the similarity transformation will be equal to the identity matrix,

c) the eigenvectors will be equal to the unit vector corresponding to each

DOF (i.e., the columns of the identity matrix), and

d) the scalar coefficients will equal the initial conditions corresponding to

each DOF { a,, a2

, ... an} = {

a C1 (t=0), a C2

(t=0), ... a Cn(t=0)}.

2-15
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2 Contaminant Dispersal Analysis

For this limiting case all zones act independently as single zone "systems" and,

therefore, these results follow directly from the more familiar single-zone theory.

For general contaminant dispersal systems we may apply the Gerschgorin

Theorem [10], given the volumetric mass matrix is diagonal, to obtain a poorly

bounded, but computationally inexpensive, estimate of the (real part of) system

time constants as;

; for all i (2.27)

This expression simplifies, exactly, to the values obtained for the limiting case

discussed above, when all filter efficiencies equal 1 . 0 , while at the other

extreme, when all filter efficiencies are 0 . 0 , it assures only that the system time

constant will fall within the range;

Min

f Vj ^

2F;;

< x <

ii J

all filter efficiencies = 0.0 (2.28)

as, in these cases the off-diagonal row sum will be equal to the diagonal value

of the flow matrix.

In some cases it will not be possible to diagonalize the product matrix [V]_1 [F],

but in these cases it will always be possible to transform the product matrix to a

form known as the Jordan canonical form, an upper block-triangular matrix with

the eigenvalues (inverse time constants) on the diagonal. For these cases, it

will still be possible to express the general solution to the homogeneous

problem, equation ( 2 . 21 ), as a combination of exponential decay terms, but now

some of these decay terms will have factors equal to powers of time (i.e., in

addition to terms like e

_

( t/x ) we will have to include terms like te-(t/T

) , t 2 e

_

( t/x

) ,

t30

-(t/x)

f etc.).

In all cases the system time constants will have positive real parts, as the

product matrix is a nonsingular M-matrix, and therefore all components making

up the general solution will approach zero with time. That is to say, the

2-16
NBS: Indoor Air Quality Model

Phase II Report

PART I • Theoretical Basis

2. Contaminant Dispersal Analysis

homogeneous contaminant dispersal equations are stable’, the concentration

at all nodes will (eventually) approach zero. Furthermore, following the

argument similar to that presented earlier in the discussion of the flow matrices,

we may show that the sum of the product matrix and its transpose;

[ [V]

-1

[F] + [[V]-

1 [F]]t

] is also a nonsingular M-matrix with positive (real parts of) eigenvalues and,

therefore, the sum of the squares of the system concentrations (he., the

Euclidean norm of the concentration vector) will decay at every instant of time

[12];

d[|{°C(t)||

2

dt

; t > o

where;

l|{“C(t)}||

2 = (|

a

C,(t)|

2

+ | aC2

(t )|

2

+ - l“cn

(t)|

2

)

(2.29)

These results are consistent with experience (and intuitive expectation) that

while some nodal concentrations may at first increase with time (e.g., due to

zone-to-zone mixing) in the long run all concentrations will diminish toward the

zero level and at all times (some reasonable measure of) the mean

concentration will also be diminishing.

The response of steady flow systems to nonzero excitation (i.e. , the

inhomogeneous case) may also be expressed in terms of linear combination of

the eigenvectors of the product matrix [V]

_1

[F]„ For practical contaminant

dispersal analysis, however, it is more convenient to solve the system equations

directly using numerical integration techniques that are not limited to steady

flow cases.

2.6 Solution of System Equations

The governing system of equations, equation (2.9b), have the form of a system

of first order linear differential equation with constant coefficients. In many

practical situations, however, the mass flow rates will not be constant in time,

and thus, in general, we may consider equation (2.9b) to be a system of first

order differential equations with nonconstant coefficients. Here we shall

consider the solution of these equations for;

2-17
NBS: Indoor Air Quality Model

Phase II Report

PART l - Theoretical Basis

2, Contaminant Dispersal Analysis

1) Steady State : steady contaminant generation rates under conditions of

steady element mass flow,

2) Free Response : transient decay of contaminant concentration under

conditions of steady element mass flow,

3) Dynamic Response : to steady flow with unsteady generation rates, to

unsteady flow with steady generation rates, or to unsteady flow with unsteady

generation rates.

In the discussion below, equation (2.9b) will be written dropping the hat, A

, to

simplify notation.

2.6.1 Steady State Behavior

For systems with steady element mass flows driven by steady contaminant

generation rates and/or specified concentrations the response of the system

will, eventually, come to a steady state (i.e., {da

C/dt} = 0 ) given by the solution

As discussed in section 2.5 above this equation may be solved by LU

decomposition without pivoting in an efficient and numerically stable manner.

2.6.2 Free Response Behavior

The free response behavior of steady flow systems has been discussed above

and shown to be closely related to the solution of the eigenproblem given by

equation (2.23) that yields system time constants and associated eigenvectors.

For steady flow systems knowledge of the system time constants provides

invaluable insight into the dynamic character of the system yet eigenanalysis is

computationally time consuming. It is, therefore, tempting to estimate the

system time constants, after single-zone theory, by the ratio of the volumetric

of;

[F]{ ac} = m (2.30)

2-18
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

mass of each zone to the total air flow out of the zone. This estimate of system

time constants will be designated as the nominal system time constants and,

from the discussion in section 2.5, may be represented as;

; the nominal system time constants (2.31)

For typical situations, however, the error bound on this estimate is very large

(see section 2.5) and this estimate of the actual system time constants is likely to

be a very poor estimate.

A variety of techniques exist that will provide better solutions to the governing

eigenvalue problem and thereby provide better estimates of the actual system

time constants [13]. The program CONTAM uses a relatively simple, published

procedure, based on Jacobi iteration, that transforms the product matrix,

[V]

-1

[F], to upper triangular form leaving the eigenvalues on the diagonal [14].

(The command TIMECONS in the program CONTAM reports both nominal and

actual time constants for comparative purposes.)

2.6.3 Dynamic Behavior

The governing systems of equations, equation (2.9b), may be solved for cases

of steady flow with general unsteady contaminant generation using any number

of different finite difference solution schemes. Here we shall employ a general

form predictor-corrector method.

For cases of unsteady flow it is likely that this same predictor-corrector solution

scheme will prove useful, providing, of course, the system flow matrix, [F], is

updated appropriately, although for cases of rapidly changing flow rates small

time steps may be required to control error. If difficulties arise, an iterative

scheme may have to be nested within the predictor-corrector time integration

scheme.

A finite difference scheme for the approximate integration of the semidiscrete

equation (2.9b) may be developed by dividing time domain into discrete steps;

tn+1 = t n + 5t ; n = 0,1,2,3... (2.15)

2-19
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

t 0 = initial time

where;

5t = integration time step (often constant but may be variable)

demanding the satisfaction of equation (2.9b) at each of these steps;

[F]{“C}n+1 + [V]{^jp} = {“E)n+1 (2.33)

where;

{“C} n+i ^ {“C(tn+1 )}

J d°C

1 {

d

a

C(tn+1 ) |

l dt J n+1 1 dt J

{

aE}n+1 ^ (a

E(tn+1 )}

Substituting into this equation the consistent difference approximation

represented by;

<“C>„, . rn„ * <23J>

where;

0 <0 < 1 0 = 0 corresponds to the Forward Difference scheme

0=1/2 corresponds to the Crank-Nicholson scheme

0 = 2/3 corresponds to the Galerkin scheme

0 = 1 corresponds to the Backward Difference scheme

a general implicit finite difference scheme is formulated;

[ 65t[F] + [V]

]j = { a E}n+1 - [F]

j

{

aC}n + (1+6)8tj ^f-} j

(2.35a)

2-20
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2. Contaminant Dispersal Analysis

or, equivalently;

[F] +

est

[V] {“C}n+1 - {“E}n+1 + 4)v]{“C}n + (i-e)8t

^

(2.35b)

Computationally it is useful to implement this general finite difference scheme,

equation (2.35), as a three step predictor-corrector algorithm;

{“C}n+1 ={“C} n + (1-0)5t|~-| ; predictor (2.36a)

[ (6St)[F] + [V]

]| ^

- {“E}n+1 - [F]{aC}n ; (i.e. eqn (2.35a) ) (2.36b)

f d

aC 1 {

aC}n+i - {aC}n+1 + (98t)|

^

; corrector (2.36c)

It should be noted that;

a) this algorithm is self-starting; given initial conditions, ( a C(t0 )} , equation

(2.33) may be solved to obtain an estimate of the initial rate of change of

nodal temperatures, {d a C(t 0

)/dt} , and the first predictor step, equation

(2.36a) may then be computed, and

b) equation (2.36b) may also be solved by LU decomposition, without the

need of pivoting; importantly then, the matrix [ (08t)[F] + [V] ] may first be

factored into the L and U product matrices and need not be refactored again

until there is a change in the system flow matrix (i.e., due to unsteady

element flows) and equation (2.36b) may then be solved, at minimum

computational cost by back and forward substitution using the LU factors, for

the first and each subsequent time step.

This predictor-corrector scheme has been analyzed by Taylor [15] and Huebner

[16] and a more general predictor-multicorrector scheme that includes this

implicit scheme has been analyzed by Hughes [17] for systems with constant

coefficient matrices (i.e.. [F] and [V] constant) . For 0 > 1/2 this scheme leads to

an unconditionally stable solution; 0 > 3/4 (approximately) leads to an

unconditionally stable non-oscillatory solution; beyond this, Taylor makes some

2-21
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

2o Contaminant Dispersal Analysis

recommendations regarding selection of 9 and step size, 8t, to limit error while

minimizing computational effort. (In the program CONTAM the default value of 0

is set to 0.75, and may be reset by the user, and an estimate of the time step

needed to limit error is reported (for the given initial conditions) using a method

developed by Taylor [15].)

2-22
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

3. Air Flow Analysis

In this section air flow element equations are formulated that relate mass flow

rate through flow elements to pressure differences across the elements, the

assembly of these element equations to form equations governing the flow

behavior of the building air flow system is discussed, and methods of solving

these equations are presented. The formulation of the air flow equations

presented herein is based, in large part, on the work of Walton [18], an example

presented by Carnahan et. al. [19], and Chapter 33 of the ASHRAE Handbook

1985 Fundamentals [20].

3.1 Pressure Variation within Zones

A general model of building airflow systems, the "well-mixed macroscopic

model", and system DOFs relating to this model were defined in Section 1.3 of

this report. For this model, fluid density within any zone i, p jf will be assumed

constant and thus the variation of static pressure within a zone, pj(z), will be

given by;

where;

z

i z

g

9c

= the elevation of node i relative to an arbitrary datum

= elevation relative to an arbitrary datum

= the acceleration due to gravity

= dimensional constant (1.0 (kg m)/(N s

2

)

)

(3.1)

3-1
NBS: Indoor Air Quality Model

Phase IE Report

PART I - Theoretical Basis

3. Air Flow Analysis

Fig. 3.1 Elevations Defined Relative to a Datum

Static pressures (i.e., under still conditions) acting on exterior surfaces may be

approximated as;

P(z) - P

a

; on exterior surfaces, calm conditions (3.2)

where Pa and pa are the atmospheric pressure and air density at the level of the

outdoor datum.

To account for pressures due to wind effects the pressure on any exterior

surface may be approximated using published wind pressure coefficients [21]

as;

P(Z) - P

a

; on exterior surfaces, windy conditions (3.3)

where Cp is a dimensionless pressure coefficient associated with the position

on the exterior surface and the characteristics of the wind and Uh is the wind

speed at the roof level of the building. Usually, local wind data will not be

3-2
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

available; reference [21] suggests one modification of equation (3.3) to allow

use of airport wind speed data.

(Strictly speaking equation (3.2) is exact for only a homogeneous atmosphere,

i.e., of constant density. Typically, however, the lower atmosphere, at the scale

of even the tallest buildings, has characteristics that fall between that of an

isothermal atmosphere and a homogeneous atmosphere and equation (3.2)

provides a very good estimate of air pressure for this range of conditions.

Equation (3.3), on the other hand, provides only very approximate estimates of

surface pressures. This is due to the great uncertainty of both pressure

coefficients and the local wind speeds.)

3.2 Element Equations

Two classes of elements will be developed here; the first class, flow resistance

elements, is a very general class that may be used to model a large variety of

flow paths that provide passive resistance to flow (e.g. , conduits, ducts,

ductwork assemblies, small orifices such as cracks, etc.); the second class is

developed to model fan-driven air flow. These two classes of elements should

allow modeling of a large variety of complex and complete building airflow

systems. It is anticipated, however, that special elements may need to be

developed, in the future, to provide better models of some flow paths (e.g., flow

through large openings such as doors and windows). Special elements may be

developed using the resistance and fan/pump element formulations as

examples of the general approach of element formulation.

3.2.1 Flow Resistance Element Equations

Resistance to flow will be modeled by flow elements having a single entry and

exit (e.g., simple ducts, openings between zones, orifices, etc.). Flow

components with multiple entries, exits, or both may be modeled as

assemblages of these simpler elements.

Flow resistance elements shall be two-node elements. With each node we

associate element pressure, Pf , temperature, Tf, and flow rate, w®, DOFs (i.e.,

for flow from the node into the element). Element nodes are selected to have

3-3
NBSc Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

the same elevation as the zone nodes they connect3

" 1

.

Fig. 3.2 Flow Resistance Element DOFs

Fluid flow within each flow resistance element is assumed to be incompressible,

isothermal, and governed by the Bernoulli equation as applied to duct design

[20];

pv

2

pv

2

(P. + ——") - (p, + ——) + -Q-piZ - Z ) - Zap (3.4)

1 2g 2 2g g

1 2 0

Where, for the purposes of developing the general element equations, the more

conventional flow variables, indicated below, have been used;

P1

, P2 = entry and exit pressures, respectively

Vi , V2 = entry and exit mean velocities, respectively

g c = dimensional constant, 1.0 (kg-m)/(N-sec2

) g = the acceleration of gravity (e.g., 9.80665 m/sec2

) p = density of fluid flowing through the element

z1 , z2 = elevations of entry and exits, respectively

we = mass flow rate through the element

3=1 The distinction between element nodes and system nodes must be made because the

element pressure vector, {Pe

}, is taken as a subset of the system pressure vector, {P}.

3-4
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3c Air Flow Analysis

£ Ap0 = the sum of all frictional and dynamic losses in the elements

Fig. 3.3 Conventional Flow Variables

2

The losses, £ Ap0 , are commonly related to the velocity pressure, pV0 / 2gc , of

the fluid flow at reference cross sections "o";

pV

Ap = C

0 °2g

( 3. 5 )

where; C0 = loss coefficient

- For conduits of constant cross-section:

with;

= f L/Deq

f = dimensionless friction factor (see Chapter 33

equation (22) and/or Chapter 2 equations (16), (17), &

(1 8) of ASIHRAE 1985 IHandbook of Fundamentals) * constant for turbulent flow (i.e. Re > 2 x 1

0

3

) =64/Re for laminar flow (i.e. Re < 2 x 1

0

3

) Re =' V0 De

q/|i

(i = the fluid viscosity

L = length of conduit

Deq = equivalent diameter of conduit = 4A/PW = 4(flow area)/(wetted perimeter)

- For "fittings" of air flow systems see Appendix B, Chapter 33,

ASIHRAE Handbook 1985 Fundamentals.

- For flow through an orifice (Chapter 2, ASHRAE 1985

Fundamentals):

( 1 H

cd Ad

D

4 \ - 1 )

3-5
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

Cd = orifice coefficient * constant for turbulent flow (0,6 typically) * (constant)/Re for laminar flow

D = diameter of approach to orifice

d = diameter of orifice opening

Thus the loss sum takes the form;

Zap = (—) (c pv

2

+ c pv

2

+ c pv

2

+ 2g 0 r o p

r o p q X

(3.6)

Recognizing that the mass flow rate, w©, at each of these sections must be

equal;

W

2 = *11 pV.A. - ... = pV^oo^pp^qq A = pV A - pV A = ... = pV A 0 (3.7) ^ 2 2

equation (3.6) may be rewritten in terms of mass flow rate as;

Iap^ = (l/2g p)(C /A 2

+ C /A 2+ C /A 2+ ... )(w

e

) 2

(3.8)

o ^c r oo P P q q

and equation (3.4) then simplifies to;

(P - P ) + -2£( z

e - ze

) = c

e (we

) 2

(3.9)

i 2 qi 2

where;

C

e = (l/2g p)( — 1/

A

2

+ ... C /A 2

+ C /A 2+ C /A 2

... + 1/A

2

) (3.10) 3 c r 1 o o p p q q 2

Equation (3.9) may now be rewritten in terms of the element pressure DOFs,

using equation (3.1), as;

3-6
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

(P

m

p>-S-(p (z r m m Zj + p(2 + P n(Z r n 2?

Z ) ) = C®(w

8

) 2

(3.11) n x

It may be seen from equation (3.1 1 ) that mass flow through element e is driven

by the absolute pressure differences between zones (Pm - P®) modified by

buoyancy effects created by density differences that are, in turn, due to zone

temperature differences.

Introducing a new variable, Be, for the buoyancy induced pressure component;

B

e = -?<P m

(z

m

- z®) + p(z, - 4) + - ZJ )

1 2

' r rV 2 n' x

equation (3.11) may be rewritten as;

e | (r.Z\-\/2, | ^e . J/2

w = (C ) ( P - P + B ) 1 1 m n

1

or

6 B/_X n 8\

w - a P - P + a B

m n

e n e D eu-1/2

where; a =(C P~P + B )

1 m n

1

(3.12)

(3.13a)

(3.13b)

(3.13c)

where the second form, equations (3.13b) and (3.13c), will provide the correct

sign for we.

Variation of Flow With Zone Pressure

It is useful, at this point, to develop analytical expressions for the variation of

mass flow with zone pressure. This expressions will be seen to be useful for

solving the nonlinear flow system equations using schemes based upon the

classical Newton-Raphson iteration method. Therefore, from equations (3.13b)

and (3.13c) we obtain;

3-7
MBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

^-= - —(C

E )~’5/2

( | P® -P®+B® | )'

/2

+ kce )" ,/2 (|P e -P

e +Be |)" 1/2

(3.14a)

9p

e 2 8pe m n 2

1 m n

' m m

9w_= - J-(C

e )“ 3/2 -^=-(

| P

e -P®+B® | )'

/2 - ~(C

e )"' /2

( | P® -P®+B® | ) U2

(3.14b)

,e 2

1 m n

1 2' m n

1 8P

n 8P

and from equation (3.10) we obtain;

3C® _ -2 9C

o . A -2 '"'-p

, A -2 £

3P

,

= ('/28

C P)<A 0

m

8P

8C _ 9 8C

+ A — + A —

+

q

m

P

0P®

m

) (3.15a)

8P

m

o r

e -9 ^8 -9 3C _ 9 8C

= (1/2g p)(A 2- + A

2 —^ + A

z ^ + ... ) e 3 c r o p q 8P 8P 8P 8P

(3.15b)

that is, the variation of Ce with pressure is simply a weighted sum of the

variation of individual pressure loss coefficients contributing to the total

pressure loss along the element. Analytical expressions for these partial

derivatives of the pressure loss coefficients are not easily formulated, but by

considering limiting cases of flow we can gain some insight.

In general, the loss coefficients depend, in a rather complex and poorly

understood way, upon the nature of flow, as indicated by the Reynolds number,

Re, and detailed characteristics of the flow geometry (e.g., roughness,

constrictions, etc.). For many situations, however, the loss coefficients are

practically constant for the limiting case of fully turbulent flow (i.e., Re > 1

0

6

), at

one extreme, and proportional to 1/Re for laminar flow (i.e., Re < 2 x 1

0

3

) at the

other;

C0 « constant (3.16)

for fully developed turbulent flow

C0 » C*

0/Re = c

*0 p/pD0V0 (3.17)

3-8
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

fully developed laminar flow

where; C*0 = constant

» For conduits of constant cross-section; = 64 L/Deq

- For "fittings" values of C*0 are not available; it may be

reasonable to estimate values based upon equivalent

lengths of conduits used in turbulent flow calculations

(e.g. see ASFIRAE 1985 Handbook of Fundamentals

Chptr 34).

- For flow through an orifice;

\x = fluid viscosity

D0 = a characteristic dimension of the flow geometry

In fully developed turbulent flow, with each of the pressure loss coefficients

constant, the partial derivatives of equations (3.15) become zero and

consequently the first term of equations (3.14) becomes zero and, using

equations (3.13), may be simplified to;

Limiting consideration to flow resistance elements of constant cross-section , we

may formulate a modified expression for laminar flow in an element, in a

manner similar to that used to formulate equations (3.1 3). We obtain;

- ??

9w e _ 1 e — d ; for fully turbulent flow (3.18a)

m

9w 6 - _ _i a

e

; for fully turbulent flow (3.18b)

n

(3.19a)

e where; (2g p/ji)( —

DA

C

o + P + —3— + C C

(3.19b)

o o

DA DA

P P q q

3-9
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

for which the evaluation of the variation of flow with pressure is straightforward;

; laminar flow, constant cross section

; laminar flow, constant cross section

It is instructive to compare the fully turbulent flow equation, equation (3,13) with

Ge constant, with this particular case (i.e., constant cross section) fully laminar

flow equation;

w = a, (P -P +B ) L m n

w = a (P - P + B ) m n

(P

e -Pe+ B

e

) | (P®-P^B e

) m n

1 TL m n

Fig. 3.4 Limiting Case Flow Relations- Elements of Constant Cross-Section

It is seen that a®, the tangent slope of the fully turbulent curve, becomes

unbounded as flow approaches zero-flow conditions while a® does not.

If the variations of the pressure loss coefficients, C0 , C

p , C

q

, ... , with flow are

well defined (i.e., for conduits: if the friction factor relations are reliable) then the

flow defined by equations (3.13) should asymptotically approach these two

curves at the upper and lower limits of flow. (Note: this is not to say that these

(3.20a)

(3.20b)

Pw

6 _ e _ 8P

m

8w e _ _

e ^

L

3 - 10
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

two curves provide an upper or lower bound to flow magnitude, in fact, they do

not (e.g., orifice flow: see reference [22] Fig. 18)).

Our purpose, here, is not to use these limiting-case flow relations in place of the

more general relation of equations (3.13), but rather to use these limiting cases

to provide an estimate of the variation of element flow with zone pressure to be

used in nonlinear solution algorithms. Specifically, we shall only employ

equations (3.19) and (3.20) for very low flow conditions, when the more general

expression for flow, equation (3.13b), and the approximation for the variation of

flow with pressure, equations (3.18), will tend to become unbounded.

Matrix Formulation of the Element Flow Equations

The element equations may be recast into matrix form, using the element DOFs

defined above, by first noting;

6 0 0 W = W = -w (3.21)

m n

thus;

(w®

e(

) = [a

e]{Pe

} + {w®} (3.22a)

where;

(3.22b)

- th0 0l0m0nt n0t mass flow rat0 V0ctor

(3.22c)

th0 0l0m0nt pr0ssur0 V0ctor

3-11
MBS: Indoor Air Quality Model

Phase H Report

PART I - Theoretical Basis

3. Air Flow Analysis

; for all but very low flow conditions (3.22d)

- matrix of pressure-flow

; for very low flow conditions

coefficients

(3.22e)

= a

e Be

{ 1 -1 }

T

: for all but very low flow conditions

: for very low flow conditions

bouyancy-induced mass flow rate vector

= a

LV{1 -u

T

(3.220

(3.22g)

and;

3{w J

net'

3{P e

}

= a

e L

: for all but very low flow conditions (3.23a)

: for very low flow conditions (3.23b)

The element pressure-flow coefficients a© and a® are defined in such a way that

they are always positive, therefore, the matrix of pressure-flow coefficients will

be positive semi-definite.

Some complicating details deserve special note;

a) the direction of flow will be determined by the sign of ( pm“ pn + ^

e

); if positive, the flow will be from m to n,

b) the density p, of the fluid flowing through the element, will depend on the

direction of flow;

3-12
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

; for flow from m to n

; for flow from n to m

c) the flow coefficient, C©, will also depend on the direction of flow due to the

dependency of p on direction and the dependency of the pressure loss

coefficients C0 that also, in general, depend on the direction of flow,

d) the pressure-flow coefficient matrix [ae] will also be flow-direction

dependent due to the flow-direction dependency of Ce and Be,

e) equation (3.22a) is highly nonlinear due to the flow-direction

dependencies, noted above, the dependency of the pressure-flow

coefficient matrix [ae] and the buoyancy-induced mass flow rate vector {w^}

on the pressure, and the dependency of density on fluid temperatures which

are, in turn, dependent on the rate of flow.

3 - 13
Total

Pressure

AP

NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3o Air Flow Analysis

3.2.2 Fan/Pump Element Equations

General operating characteristics of fans are discussed in the ASH R AE

Handbook and Product Directory: 1979 Equipment [23]. Flow behavior of fans

is generally described in terms of performance curves that have the following

typical form;

AdnaLEsrlornnancg Curve

Mass Flow Rate = pAV

Performance Curve Represented

as a Family of Linear Functions

W

o

Fig. 3.5 Fan Performance Curves

Performance curves may be easily converted to pressure-mass flow curves, by

scaling by the fluid density, and represented by the family of equations of the

general form;

e e e A n w = w - a AP

o

( 3. 24 )

where; W = the free delivery mass flow rate of the fan

o

e aAP2 / a (w ) ; the fan pressure-flow coefficient

= the effective pressure drop across the fan

This family of equations has the advantage of being able to represent saddle

shaped performance curves but , unfortunately, the members of the family used

3 - 14
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

to "capture" the saddle shape portion of the performance curve provide very

poor representations of the change of mass flow with changes of pressure and,

therefore, should not be expected to perform well when used with NewtonRaphson type nonlinear solution strategies.

For nonlinear solution techniques that require the determination of the change

of mass flow with changes of pressure we shall have to resort to a more

restricted form of representation having;

a

e = ae (AP) (3.25)

Unfortunately, a true saddle shape may not be represented with this form.

An attractive candidate for this more restricted form is offered by the following

polynomial form;

a

e = + a^AP + a^AP 2

+ ... (3.26)

orw = w - (aAP + a 0 AP + a 7 AP + ... ) (3.27)

o 1 2 3

where the coefficients, a® , a| , ..., would be determined by a best fit to published

or measured performance curve data.

Defining fan element degrees of freedom consistent with flow resistant element

degrees of freedom, as shown below, Fig. 3.6, and accounting for buoyancy

effects, as in the development of the flow resistant element equations, equation

(3.27) may be rewritten as;

0 0 0 / 0 n 0 D 0x

w = w - a (P ~ P + B ) o m n

(3.28)

or in terms of element flow rate DOFs as;

(3.29a)

3 - 15
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

r ^ i [a ] e = a

-I

1 J

(3.29b)

f 2 -I { w

B

) s = a

i— DO i

(3.29c)

{w } = w

E

{ i -i }

T

(3.29d)

Typically, the fan pressure-flow coefficient will be positive and therefore the

matrix of fan pressure-flow coefficients, [ae], will be negative semi-definite. To

account for the possibility of a system driving a fan beyond the shut off pressure

- free delivery range (i.e., to account for the possibility of back flow or pressure

assisted forward flow) the fan performance curve must be defined outside the

conventional range of flows.

Using the polynomial form of fan performance curve, equation (3.27), we may

develop analytical expressions for the variation of flow with zone pressures;

3 - 16
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

8we _ 0P

e n

e, n e n e D e N 2

-a - 2a,(P - P + B ) - 3a,(P - P + B

2 m n 3 m n m

(3.30a)

2 3w e n e /r^e n es - e /n e e n e N 2 = + a, + 2a JP - P + B ) + 3a (P - P + B ) +

1 2 m n 3 m n oP

n

or, in terms of the element mass flow rate DOFs;

(3.30b)

3(w ) — = (a®+2a®(P

e -Pe+

B

e )+3a®(Pe -Pe+

B

e

) 2+

...)

1 2 m n 3 m n

(3.31)

3 - 17
NEBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3o Air Flow Analysis

3.3 System Equations

Requiring conservation of mass at each flow-reiated node we demand;

fmass generation^

rate / - I

connected

elements

( net mass flow ^

vrate into element/

system node

(3.32)

the element equations may be assembled to form a system of equations, that

govern the flow behavior of the system, of the form;

{W} = [AKP} + {W + lW

0

} (3.33a)

where;

{W} = {w, , W

2

,

I—

CZ (3.33b)

{P} = (p p

i ’ 2

’ P }

T

n

(3.33c)

[A]

N

r „ = A [a

e

] + NP

A [a

e

] (3.33d) e=

1

e=1

{w

B

}

N

r „ - A {w®} +

e=l B

N

p

A{Wg}

e=1

D

' (3.33e)

{w

o

} = A {w e}

e=l

0

(3.33f)

N r , NF = the number of flow resistance and fan elements respectively

A = the element assembly operator; a combination Boolean

transformation and matrix summation (see section 2.2, [2] or [24]

for details)

The system flow matrix, [A], is the sum of positive semi-definite flow resistance

element matrices and negative semi-definite fan/pump element equations

3-18
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

and, therefore, may become negative definite! Given the "1 , -1 , 1 , -1” form of

the flow resistance element equations and the "-1 ,1 , -1 ,1" form of the

fan/pump element equations we need only check the diagonal elements of the

[A] matrix - if any are negative then [A] will be negative semi-definite otherwise

it will be positive semi-definite. As will be seen in the following examples,

transformation from a semi-definite to a definite matrix results upon the

specification of a single nodal pressure.

3-19
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

3=4 Simple Examples

Two two-zone air flow examples are considered below. For these examples

the density of air will be estimated using the ideal gas law as;

p

= (M/RXP/T) = ( —28 9645 kqAqmole /T ) _ Q 00348365 ( P / T ) 8314.41 N-m/kgmo1e“°K

where;

p = density [=] kg/m3

M = the mean molecular weight per mole of dry air

R = the universal gas constant

P = the absolute pressure [=] Pa (i.e., N/m2

) T = the absolute temperature [=] °K

Example 1

In the first example, illustrated below, two zones are linked by two flow

resistance elements, conduits in this case.

1 m

The temperature in zone 1 is maintained at 10 °C and that of zone 2 at 20 °C

or;

T1 =(10 + 273.15) = 283.15 °K

T2 = (20 + 273.15) = 293.15 °K

3-20
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

and we seek to determine the mass flow rates through these elements and the

zone pressures that will be induced by buoyancy-driven flow induced by these

zone temperature differences.

Zone Densities:

- assume sea level pressure 101.325 kPa

- p 10

o c

= 0.00348365 x (101.325/(10° + 273.15°) ) = 0.0012466 kg/m 3

- p 20 °c = 0.00348365 * (101.325/(20° + 273.15°) ) = 0.0012041 kg/m 3

Element Equations:

- Relative roughness = e/D = 0.00015/0.25 = 0.0006

- Friction factor; from ASHRAE Fundamentals, Chapter 2, Fig. 13; f = 0,032

- Cross sectional area; A = ttD2 /4 = it 0,252 /4 = 0.049 m2

- Pressure loss coefficient; CQ = f L/D = 0.032 * 1.0 - 0.25 = 0.128

- Element a ; connectivity 1-2

- Assume flow is from zone 2 to zone 1 thus p

= p20°C

Ca = (1/2g c p)( C 0 /A 2 0 ) = (1/(2 * 1 * 0.0012041)(0.128/0.0492

) = 22137

Ba = (g/gc)(p m(zm

-z,a) + p(z,a- z2 a)

+ pn

(z2 a-zn)

)

= (9. 81/1. 0)(0. 0012466(2-3.5) +0.0012041(3.5-3.5) + 0.0012041(3.5-2))

= -0.00062576 •

- Initial element matrices (from equations (16) ); (assume P a m = pa

R)

( 1 /Ca | pam

- pa

n+ sa | )V2 = (1/(22137 *

| 0 + (-0.00062576) | )V2 = 0.268679

a T {wj = { -0.00016813 0.00016813}

D

r a-, _ f 0.268679 -0.268679

Ld J ”

L -0.268679 0.268679

.

- Element b; connectivity 1-2

- Assume flow is from zone 1 to zone 2 thus p

= pio°c

3-21
NBS: indoor Air QuaEity Model

Phase H Report

PART i - Theoretical Basis

3. Air Flow Analysis

Cb = (1/2g c p)( C 0/A2 0 ) = (1/(2 x 1 x 0.0012466))(0.128/0.0492

) = 21382

Bb = (g/gc)(pm(2rn-Zib) + p(Zib ~ z2b) + Pn(z2b-zn)

)

= (9.8 1/ 1.0 )( 0.0 01 2466(2-0. 5) +0.0012466(0,5-0.5)

+ 0.0012041(0.5-2))

= 0.00062576

- Initial element matrices (from equations (16) > (assume Pbm = pb

n)

(1/Cb

| pbm

- pb

n+ Bb | )V2 = (1/(257923 x

| 0 + (0.00062576) | )V2 = 0.27338

{W^} = { 0,00017107 -0.00017107 }

T

D

r _b^ _ r 0.27338262 -0.27338262

La J ”

L -0.27338262 0.27338262.

System Equations:

The system equations may be assembled from the element equations; in this

case we obtain, assuming no mass generation in the zones;

0.54206194 -0.54206194] <j Pj 1 / 0.00000294"!

-0.54206194 0.54206194 J \p2 J

+ 1-0.00000294 J

As they stand this set of equations is singular - they describe only the pressure

difference between zones. If we specify the pressure in one zone, say Pi =

101.325, then a first estimate of P2 may be determined; P2 = 101.32500543.

The element arrays may then be recomputed with these new estimates of P-| &

P 2 and the system equations formed and solved. By repeating this process

until the results converge to acceptable accuracy a solution is obtained. For

this problem we obtain, upon convergence;

P] = 101.3250000 Pa (i.e., as specified)

P 2 = 101.3250814 Pa

3-22
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

Wa = -0.00016922 kg/sec

W& = 0.00016995 kg/sec

For comparison, the system equations at convergence are;

{

0*1 _ T 0.54216990 -0.5421699ol f P, \ f 0.00000515*1

l 0 J

~ 1-0.54216990 0.54216990 J \P2 J l -0.00000515 J

Example 2

In this example, illustrated below, two zones are linked by a flow resistance

element, identical to element "a" used in the example above, and a fan

element.

b b ^b „ w = w - C AP

o

= 0.0015 - 0.00001 AP

w [=] kg/sec

0 0.0015

EariEer f. QHTap.cg..Cur. v£

Fia. 3.8 Example 2 Flow Idealization

Again the temperature in zone 1 is maintained at 10 °C and that of zone 2 at

20 °C and we seek to determine the mass flow rates through the elements and

the zone pressures that will be induced by the combined effects of buoyancydriven and fan-driven flow.

Element Equations:

- Element a : connectivity 1-2 (as above)

- Initial element matrices (from example 1): (assume Pam = Pan )

a T {wj - { -0.00016813 0.00016813}

D

3-23
NBS= Indoor Air Quality Model

Phase II Report

PART 8 - Theoretical Basis

3o Air Flow Analysis

0.268679 -0.268679

-0.268679 0.268679

.

- Element b; connectivity 1-2

- From the fan performance curve, above, we obtain Cb= 0.00001 and wbQ - 0.0015

- Bb is equal to that calculated for the resistance element b above; Bb = 0.00062576

- Initial Element Matrices (from equations (18) > (assume pam = pa

n )

{W^}

B

/ b, {w }

o

{ - 0.00000001 0.00000001 }

{ 0.0015 -0.0015 }

T

-o.ooooi o.oooof

0.00001 - 0.00001 .

System Equations:

The system equations may be assembled from the element equations; in this

case we obtain, assuming no mass generation in the zones;

f o\ _ f 0.26866932 -0.26866932] f \ / -0.00016814*1

+ / 0.0015*1

loj "

L -0.26866932 0.26866932 J \P2 J ^ 0.00016814J L -0.0 0 15 J

Again we obtain a singular set of equations that describe the pressure

difference between zones. By specifying one zone pressure, say Pi =

101.325, a first estimate of P2 may be determined, in this iteration P2 = 101.32995727. Again, we iteratively update element matrices with these

estimates of zone pressures until results converge to acceptable accuracy.

Reasonably convergent results are;

P] - 101.32500000 Pa (i.e., as specified)

P 2 = 101.37379028 Pa

3-24
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

wa = -0.00149407 kg/sec

wb = 0.00150048 kg/sec

For comparison, the system equations at "convergence" are;

f o\ _ f 0.03022450 -0.03022450 1 f -0. 00001893^1 f 0 00151

l 0 J

~

L -0.03022450 0.03022450 J l 0.00001893 J

+ \ -0.0015 J

3-25
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

3.5 Solution of Flow Equations

Two classic nonlinear solution strategies and their variations;

a) Method of Successive Substitutions or Fixed-Point Iteration

Direct

Jacobi Iteration

Zeid's Modified Jacobi Iteration

Gauss-Seidel Iteration

Successive Overrelaxation Method

b) Newton-Raphson Method

Classic Newton-Raphson Method

Modified Newton-Raphson Method

and incremental formulations of these methods will be considered as

candidates for solving the system of nonlinear flow equations, equations (3.33).

To set the stage for a discussion of these solution methods we rewrite the

system equations, equations (3.33), in two alternate forms:

(F(P)} = [AKP} + {Wj + {W } - {W} = {0} ( 3. 35 ) B o

and

[AKP} - {g} - {W} - {VM - (W

B

) ( 3. 36 )

where, it is important to be mindful that [A] and {Wg} are both dependent on the

state of the system pressure variables, {P}, and may also vary with time if the

flow prblem is embedded in a dynamic thermal response problem.

3. 5.1 Successive Substitution

A class of nonlinear solution techniques have been developed and studied for

equations of the form of equation (3.36) with (a} not a function of the dependent

variable (P| that are based upon the use of an approximate inverse [C]. By

3-26
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3= Air Flow Analysis

adding the vector [C]{P} to both sides of equation (5.2);

[AKP) + [CKP} - {g} + tCKP} (3.37a)

{P} = {P} - [C]

_,

{ {g} - [AKPJ

}

(3.37b)

the governing equation is recast in a form that suggest a general iterative

scheme;

{P

k+I

} - {p

k

} - [C

k ]“'{ {g

k

} - [A

k

KP

k

} } (3.38)

where k is an iteration index. The term { {g k

} - [Ak]{Pk} } may be thought of as a

residual or error that could be monitored to evluate the convergence of the

method.

The choice of the [C] matrix is key to the success of this approach. Clearly [C]

must be nonsingular. Zeid shows, furthermore, that to ensure convergence [C]

must satisfy the following condition [25], [26];

| I [!] - [cf '[A] I I < 1 (3.39)

where the double bars || indicate any appropriate norm (e.g., maximum norm or Euclidean norm).

We shall consider the following alternatives, based on those developed for

systems with {g} not a function of the dependent variable {P};

Direct Iteration

The most straigtforward approach simply sets [C] = [A];

3-27
NBS: Indoor Air Quality Model

Phase IS Report

PART I - Theoretical Basis

3. Air Flow Analysis

{Pk+1

} = {Pk} + [Akr'{ {g

k }-[Ak ]{Pk

} } (3.40a)

or

{Pk+1

} = [Ak

r

1 {gk

} (3.40b)

Computationally, it is efficient to avoid inversion and instead successively solve

the system of equations;

[A

k ]{Pk * 1 } = {g

k

} (3.40c)

For systems with {g} * {g(P)} this method often does not converge [27] and,

therefore, will not be considered further.

Jacobi Iteration

Splitting the [A] matrix into upper and lower components as;

[A] - [D][ [L] + [I] + [LJ] ] ; [D] = diag (A

n

) (3.41)

we set [C] = [D] to obtain;

{Pk+1

} = {Pk} + [DV{ {g

k }-[Ak]{Pk

} } (3.42a)

or

{Pk+1

} = [Dkf

1 {gk

} - [ [L

k

] + [U

k ]]{Pk

} (3.42b)

For systems with {g} a (g(P)} this method converges if [Ak

] is strictly diagonally

dominant [25], [26]. In general, [A] will not be strictly diagonally dominant, thus . this method is not useful here .

Zeid's Modified Jacobi Iteration

Zeid has developed a modified form of Jacobi iteration that does not require

strict diagonal dominance [25], [26]. In this method we set;

3-28
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

[C ] - diag(cx..) ; ex.. - ; i = 1, 2, ... n (3.43)

for an n x n system. The rate of convergence for this approach is linear (i.e., the

error {PK+i} - {pk} in each step depends linearly on the error in the last step),

providing again {g} * {g(P)}.

Gauss-Seidel Iteration

Splitting the [A] matrix as before, equation (3.41), and setting [C] = [D][ [I] + [L]

{pk+1

} = {pk} + [i + L

k

r

1 [D

k

r

1 {{gk }-[Ak ]{Pk

}

}

(3.44a)

or

{Pk+1

} = - [L

k ]{Pk+1

} - [Uk ]{Pk} + [Dk

] - 1 {g

k } (3.44b)

For systems with {g} * (g(P)} the rate of convergence of this method is linear. In indicial notation this method is;

k r. =

A k ^k k

a ,,p, +

g.

A

k

.

(3.44c)

k + 1 k k

P. = P. + r. ; i = 1, 2, ... n (3.44d)

where r is the residual that may conveniently be monitored to evaluate

convergence.

Successive Overrelaxation Method

A variant of of Gauss-Seidel iteration, commonly know as the successive

overrelaxation or SOR method, attempts to to accellerate convergence by

scaling the residual by a relaxation factor

,

go, as;

3-29
MBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

{Pk+1

} = {Pk} + [I + lVidYV {g

k

} - [Ak]{Pk} } (3.45a)

or

{Pk+1

} = ~[Lk]{Pk+1

} + (1-w){Pk} + [[L

k

] + co[L

k]]{Pk

} - co[U

k]{Pk

} + co[D

k]~1 {g

k

} (3.45b)

where for co=1,Q this reduces to Gauss-Seide! iteration. In indicial notation this

method is;

A

k .Pk

'

»J J

A k rA A.P. +

k

3 ,

i - 1, 2, ... n

(3.45c)

(3.45d)

This method can only converge for 0 < co < 2 [28].

For the governing flow equations, equations (3.36), the forcing vector {g} will, in

general, depend upon the dependent variable {P} and thus the convergence

rates and conditions on convergence noted above can, at best, provide only

guidelines; we are not in a position at this time to say much about the

convergence of these adaptations of classical fixed-point methods.

Upon closer examination, however, we note that {g} = {WB

(P)} + {W0}, the sum

of a bouyancy-related flow vector, that is pressure dependentand a fan-related

flow vector that is not. If the flow is largely forced (i.e., by fans or wind-induced

pressure), so that the bouyancy-related flow is relatively small, then we should

expect these adapted methods to behave as theory predicts.

3.5=2 Newton-Raphson Iteration

The following development of the Newton-Raphson Method and its variants is

based largely oathe formulation presented by Bjork and Anderson [28].

3-30
NBS: Indoor Air Quality Model

Phase II Report

PART I « Theoretical Basis

3. Air Flow Analysis

Using Taylor's formula, generalized for a system of n equations, we may

approximate the function {F(P)}, from equation (3.35), from its value at a nearby

vector {Pk} as;

{F(P)} = {F(P

k )> + [F'(p

k )]{ {P} - {Pk

} } 0(1 I {PHPk} I I 2) (3.46)

where F' is the Jacobian defined as;

or

[F‘(P

k )l = 9{F(P)}

9{P}

9F.(P)

9P

(P}={P

k

)

{P}={P

k

}

(3.47a)

(3.47b)

Equation (3.46) leads naturally to the general form of the popular NewtonRaphson iterative method;

[F‘(P

k )]{APk *'} = - (F(Pk

)} (3.48a)

{P } - {P } + {AP } (3.48b)

where, again, k is the iteration index. Given an initial guess {Po} sufficiently

close to the solution the method will converge at a quadratic rate.

The high rate of convergence has made this approach popular, but the method

involves the formation of the n x n entries of the Jacobian and the solution of an

n x n system of equations at each iteration - tasks that become computationally

prohibitive as n increases.

Evaluation of the Jacobian

For the problem at hand, equation (3.35), the Jacobian involves the evaluation

of;

3-31
MBS: Indoor Air Quality Model

Phase SI Report

PART I - Theoretical Basis

3. Air Flow Analysis

9{F(P)}

9{ p} { P} = {p

k

}

9{ [AKP} + {WJ } D

(3.49a)

9{P} {P} = {P

k

}

or

9{P} {p} = {p

k

} e=l 0 {p

K

} (p

e (pk )} e=l 0{P

K

} (P

e (p

k

)}

(3.49b)

that is, the Jacobian is simply evaluated as an element assembly sum of the

element Jacobians evaluated at the element pressures {Pe} corresponding to

the current iterative estimate of the system pressure {Pk}.

Modified Newton-Raphson Iteration

To avoid some of the computational expense of forming and solving the

Newton-Raphson equations, (3.48), at each iteration, one may reform [A] , [F],

and {WB} only occaissonally, say every m steps, as;

[F'(P

P )KAP

k *'} = -[A P

]{P

k

} - {W P

} - {W } + {W} ; k=p, ... p*l (3.50)

B o

This modified Newton-Raphson method saves computation but at a cost of

convergence. Attempts have been made to compensate for a lower

convergence rate by using an overrelaxation factor , co, applied to the residual,

AP, calculated at each step, as;

the choice of o> is likely to be "problem dependent and the experience of the

analyst will be crucial" [29]; values of co « 2.0 are often used.

(3.51)

3-32
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

3.5.3 Incremental Formulation

When flow is driven primarily by fans (i.e., when the buoyancy-related flow is

relatively small) it may prove useful to approach a solution incrementally by

considering incremental increases in fan free delivery flow {W 0 }. After

Zienkkiewicz [27] we rewrite equation (3.35) in the form;

[A]{P> + {W J + A{ {W } - {W} } = {0} (3.52)

B o

and solve a series of nonlinear problems, incrementally increasing X to 1.0; the

solution at each increment may then be used as the initial guess of the solution

at the next increment. For increments of X suitably small we may be assured

that the initial guesses of the. incremental solutions will be sufficiently close to

the solution to guarantee convergence, rf the solution to;

[ A]{P} + (WJ = {0} (3.53)

D

is available (e.g., if {WB} is a zero vector) or can be computed.

For m increments of X;

m

X - 1/m , 2/m , ... m/m (3.54)

the Gauss-Seidel method, with overrelaxation becomes, in indicial notation;

m n+1

r.

i

m^k+1 v m A k m^k m. ,k itl .

. , > ^Z A.. P. -z A.. P. - W_ . + X(W. - W .) ”

’J J >J i B i i or

m . k A.,

ij

(3.55a)

m^k+1 m^k m k

P. = P. + 03 r. ; i=1, 2, ... n , (3.55b)

and the modified Newton-Raphson method, also with overrelaxation, becomes;

3-33
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

3. Air Flow Analysis

[F‘(

m

P

P )]{A

m

R

ki

'} = -[

m

A

P

]{

rn Pk

> - {"V} - m

X{ {W } - {W} } (3.56a)

B o

f m_k+ K r m,- k. , A m_k+k

{ P } = { P } + Ob{A P } ; k = p, p+1, ... p+1 (3.56b)

with updating of system arrays every 1+1 steps. In both cases, at each

increment, m, one iterates on k.

3-34
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

4. Summary and Directions of Future Work

4. Summary and Directions of Future Work

Sgmmgry

The theoretical basis of a building indoor air quality model has been presented

that provides for;

a) contaminant dispersal analysis of nonreactive contaminants, and

b) mechanical, wind, and thermally-driven air flow analysis

in multi-zone buildings of arbitrary complexity. It has been shown that both

contaminant dispersal analysis and air flow analysis equations may be

assembled from element equations that govern the behavior of discrete flow

elements in the building airflow system. The general, qualitative character of

these equations has been discussed and efficient numerical methods have

been presented for their solution.

This theoretical work extends the work of others (e.g., [18], [30], [31]) in that;

a) for both contaminant dispersal and flow analysis;

- the governing equations are assembled from element equations so that

systems of arbitrary complexity may be considered, existing

computational strategies based upon element assembly methods may be

employed, and formal analysis of the system equations is possible from

the new perspective of the element assembly operation,

- efficient numerical methods have been identified for the practical solution

of the governing equations, and

b) for contaminant dispersal analysis;

- filtering of contaminants has been accounted for,

- practical methods of accounting for unsteady flow conditions have been

identified,

4-1
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

4. Summary and Directions of Future Work

- the qualitative analysis of the multi-zone contaminant dispersal equations

has been extended demonstrating, importantly, that the conservation of

total air flow, alone, in a building idealization (without the need to place

special qualifications on zones isolated from exterior air infiltration, e.g.,

[31] p. 225) leads to nonsingular M-matrices that may be efficiently

factored to LU form, and

c) for flow analysis;

- element equations governing passive resistance air flow paths has been

extended to allow consideration of a variety of simple and complex air

flow paths,

- element equations governing fan-driven air flow have been developed

that may readily be assembled, with the general resistance element, to

allow analysis of building air flow systems of arbitrary complexity, and

- low-flow conditions have been modeled consistently with existing flow

theory in such a way that should help to avoid convergence problems

experienced by others (some preliminary computational studies indicate

success here).

In PART II of this report a program, CONTAM86, is presented that implements

the contaminant dispersal portion of the theory and examples of its application,

that provide preliminary validation, are discussed.

Directions of Future Work

In the near future, work will be directed toward the two general areas

considered thus far - contaminant dispersal analysis and air flow analysis. In

addition, the inverse contaminant dispersal problem will be considered (i.e., the

determination of airflows, in a multi-zone building system, from knowledge of

zonal concentrations due to known excitations). In the distant future, hopefully,

the coupled multi-zone building flow and thermal analysis problem and its

integration with the contaminant dispersal analysis problem will be considered

by integrating the building thermal analysis methods developed earlier [2] with

4-2
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

4. Summary and Directions of Future Work

the methods introduced here.

In the area of contaminant dispersal analysis the present theory will be

extended;

a) through the development of reaction elements , to allow modeling of the

dispersal of single and multiple reactive contaminants, and

b) through the development of one-dimensional convection-diffusion flow

elements , to allow modeling of the details of contaminant dispersal for flow

in duct-type flow passages.

In addition, an attempt will be made to develop elements to model the dynamics

of contaminant adsorption and absorption into the building fabric and

furnishings.

The flow analysis theory will be implemented to provide computational tools that

may be used in an integrated manner with the contaminant dispersal analysis

tools presently available in CONTAM86. An attempt will be made to evaluate

the several nonlinear solution strategies, discussed in section 3.5, so that

guidelines for their use may be formulated.

The inverse problem of determining multi-zone air flow rates from measured

contaminant concentration and generation rate data (e.g., as used in tracer gas

flow measuring techniques) will, also, be addressed. That the inverse problem

is inherently an ill-conditioned problem (i.e., small errors in concentration and

generation rate data typically result in large errors in estimated airflow

quantities) is not well appreciated, therefore, this effort will place an emphasis

on determination of the conditioning of the inverse problem, for specific

applications, and identification of strategies of formulating the inverse problem

to minimize ill-conditioning. Coupling the formulation and solution of specific

inverse analysis problems with the determination of their conditioning provides,

as an additional benefit, a means to place error bounds on the estimates of

airflows. Again, the inverse problem will be formulated using an element

assembly approach, to allow consideration of systems of arbitrary complexity,

and implemented so as to augment the computational tools available and

presently under development for dispersal and flow analysis.

4-3
*

-
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

PARTI References

PARTI References

[1] McNall, P., Walton, G., Silberstein, S., Axley, J., Ishiguro, K., Grot, R., &

Kusuda, T., Indoor Air Quality Modeling Phase I Report: Framework for

Development of General Models . NBSIR 85-3265, U. S. Dept, of Commerce,

National Bureau of Standards, October 1986

[2] Axley, J.W., DTAM1 : A Discrete Thermal Analysis Method for Building Energy

Simulation: Part I Linear Thermal Systems with DTAM1 Users' Manual , (presently under review for publication by the National Bureau of Standards,

Building Environment Division, Center for Building Technology)

[3] Bird, R.B., Stewart, W.E., & Lightfoot, E.N., Transport Phenomena. John Wiley

& Sons, Inc., N.Y., 1960

[4] Zienkiewicz, O.C. & Morgan, K., Finite Elements and Approximation . John

Wiley & Sons, N.Y., 1983, pp. 154-157

[5] Funderlic, R.E. & Plemmons, R.J.,

H LU Decomposition of M-Matrices by

Elimination Without Pivoting", Linear Algebra and Its Applications, Vol 41

,

pp. 99-110, Elsevier, North Hollands 981

[6] Plemmons, R.J., Noneaative Matrices in the Mathematical Sciences . Chapter

6: M-Matrices, Academic Press, 1979, p.137 and 147

[7] Ibid, pi 56

[8] Funderlic, R.E., Neumann, M., & Plemmons, R.J., "LU Decomposition of

Generalized Diagonally Dominant Matrices", Numer. Math., Springer-Verlag,

Vol 40, p 57-69, (1982) Theorem 4

[9] Graybill, F.A., Matrices with Applications in Statistics . Wadsworth, Belmont

CA., 1983 Section 1 1.4

[10] Noble, B., Applied Linear Algebra. Prentice-Hall, N.J., 1969

[11] Strang, G., Linear Algebra and Its Application . Academic Press, N.Y., 1980

Ref I -

1
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

PARTI References

[12] Ibid, p 213

[13] Wilkinson, J.H. & Reinsch, C., Handbook for Automatic Computation:

Volume II: Linear Algebra. Springer-Verlag, 1971 - Part II: The Algebraic

Eigenvalue Problem

[14] ibid., Contribution 11/12: "Solution to the Eigenproblem by a Norm Reducing

Jacobi Type Method", by P.J. Eberlein & Boothroyd

[15] Taylor, Robert L, *HEAT*. A Finite Element Computer Program for HeatConduction Analysis. Report 75-1, Prepared for: Civil Engineering

Laboratory, Naval Construction Battalion Center, Port Hueneme, California,

May 1975

[16] Huebner, K.H., & Thornton, E., The Finite Element Method for Engineers : Second Edition, John Wiley & Sons, New York, 1982

[17] Hughes, T.J., "Analysis of Some Fully-Discrete Algorithms for the OneDimensional Heat Equation", International Journal for Numerical Methods in

Engineering, Vol. 21, John Wiley & Sons, 1985

[18] Walton, G., Thermal Analysis Research Program Reference Manual. NBSIR

83-2655, U.S. Dept, of Com., National Bureau of Standards, Gaithersburg,

MD, March 83

[19] Carnahan, B., Luther, H.A., Wilkes, J.O., Applied Numerical Methods . John

Wiley & Sons, 1969

[20] ASHRAE, ASHRAE Handbook: 1985 Fundamentals . Chapter 33 Duct

Design,, ASHRAE, Atlanta, GA, 1985

[21] ASHRAE, ASHRAE Handbook: 1985 Fundamentals . Chapter 14 Airflow

Around Buildings, ASHRAE, Atlanta, GA, 1985

[22] ASHRAE, ASHRAE Handbook: 1985 Fundamentals . Chapter 2 Fluid Flow,

ASHRAE, Atlanta, GA, 1985

[23] ASHRAE, ASHRAE Handbook & Product Directory : 1979 Equipment,

Chapter 3 Fans, ASHRAE, New York, 1979

Ref I - 2
NBS: Indoor Air Quality Model

Phase II Report

PART I - Theoretical Basis

PARTI References

[24] Bathe, K.J., Finite Element Procedures in Engineering Analysis. Second

Edition . John Wiley & Sons, New York, 1982

[25] Zeid, I., "Fixed-Point Iteration to Nonlinear Finite Element Analysis. Part I: Mathematical Theory and Background," International Journal for Numerical

Methods in Engineering, Vol.21 , No.1 1 , John Wiley & Sons, New York, 1 985

[26] Zeid, I., "Fixed-Point Iteration to Nonlinear Finite Element Analysis. Part II: Formulation and Implementation," International Journal for Numerical

Methods in Engineering, Vol.21 , No.1 1 , John Wiley & Sons, New York, 1 985

[27] Zienkiewicz, O.C., The Finite Element Method. 3rd Edition . McGraw-Hill,

London, 1977, p. 452

[28] Bjork, A., Anderson, N., Numerical Methods . Prentice-Hall, Inc., New Jersey,

1974

[29] Chow, Y.K. & Kay, S., "On the Aitken Acceleration Method for Nonlinear

Problems", Computers & Structures, Vol. 19, No. 5/6, 1984, pp. 757-761

[30] Sinden, F.W., "Multi-Chamber Theory of Air Infiltration", Building and

Environment, Vol. 13, Pergamon Press, Great Britain, 1978, pp. 21-28

[31] Sandberg, M, "The Multichamber Theory Reconsidered from the Viewpoint

of Air Quality Studies", Building and Environment, Vol. 19, No. 4, Pergamon

Press, Great Britain, 1984, pp. 221-233

Ref I - 3

NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

5. General Instructions

5. General Instructions

The program CONTAM86 is a command processor5

' 1

; it responds to

commands in the order that they are presented and processes data associated

with each command. Commands may be presented to the program

interactively, using keyboard and monitor, or through the use of command/data

input files; that is to say, it offers two modes of operation - interactive and batch

modes.

For most practical problems of contaminant dispersal analysis the batch mode

of operation will be preferred. For these problems, analysis involves three basic

steps;

Step 1 : Idealization of the Building System and Excitation

Actual Building

• — Zone Node Flow Element -

2 -Node Number Element Flow- 4'

Air-Flow System Idealization

Fig. 5.1 Idealization of the Building System and Excitation

Idealization of the building flow system involves

a) discretization of the system as an assemblage of appropriate flow

elements connected at system nodes,

b) identification of boundary conditions, and

c) numbering of system nodes optimally (i.e., to minimize the bandwidth -

5-1 CONTAM86 is written in FORTRAN 77. The complete source code for the program may be

found in the attached appendix.

5-1
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

5. General Instructions

node number difference - of system equations).

The excitation (i.e., specified contaminant concentrations and generation rates)

may be modeled to be steady or defined in terms of arbitrary time histories. For

the latter case initial conditions of nodal contaminant concentration will have to

also be specified.

Step 2 : Preparation of Command/Data Input File

Ei.tL&2LEreparatiQn of input CommandiBatafila

In the batch mode, the program reads ASCII text files of commands and

associated data, collected together in distinct data groups, that define the

building flow idealization and excitation. The command/data input file may be

prepared with any available ASCII text editing program and given a file name,

<filename>, specified by the user. The <filename> must, however, consist of 8

or less alphanumeric characters and can not include an extension (i.e.,

characters separated from the filename by a period, ).

5-2
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

5. General Instructions

Step 3 : Execution of CONTAM86

Plot Output File

Command/data

Input File

<filename>. PLT

1

"

Binaru Data Files

<filename>

ooioV- 01100 00011

OOlOr

01100

00011

CONTAM

vj/

<filename>. FEL

<filename>.WDT

0010r

01100

00011 <filename>. EOT

Results Output File

<filename>.OUT

Fig. 5.3 Execution of CONTAM86

CONTAM86 is then executed. Initially CONTAM86 will be in the interactive

mode. To enter the batch mode the command "SUBMIT F=<filename>" may be

used to "submit" the command/data input file to the program. The program will

then proceed to form element and system arrays and compute the solution to

the posed problem. CONTAM86 reads the ASCII command/data input file and

creates an ASCII (i.e., printable) output file <filename>.OUT. The results of an

analysis, <filename>.OUT, may be conveniently reviewed using an ASCII

editor and, from the editor, portions or all of the results may be printed out. Key

response results are also written to the ASCII file <filename>.PLT in a format

that may easily be transferred to some spreadsheet and plotting programs (i.e.,

data values within each line are separated by the tab character) for plotting or

subsequent processing.

File Summary

Depending upon the commands processed, CONTAM86 will also create a

variety of binary files for out-of-core storage needed for subsequent processing.

A summary of files read and created includes;

Files Read

<filename> an ASCII input file specified by the user that contains

5-3
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

5. General Instructions

commands and associated data

Files Created

<filename>.OUT a printable ASCII output file that contains analysis

results

<filename>.PLT an ASCII output file that contains key analysis results in

a form that may be transferred to spreadsheet and/or

plotting programs

<filename>.FEl a binary file used for out-of-core storage of flow element

data

<filename>.WDT a binary file used for out-of-core storage of element flow

time history data

<filename>.EDT a binary file used for out-of-core storage of excitation

time history data

In the interactive mode <filename> is set to the default value of "CONTAM86"

and commands are read from the keyboard. A help command, "HELP" or

H H'\

will produce a screen listing of all available commands.

5-4
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

6. Comand Conventions

6. Command Conventions

Commands and their associated data (if any) may be single-line or multiple-line

command/data groups.

Single-Line Commands

Single line command/data groups begin with the command keyword and may

have any number of associated data items identified by data identifies of the

typical form;

COMMAND A=n1,n2,n3 B=n4 C=n5,n6 D=c1c2c3

where n1,n2,n3,... is numeric data and c1c2c3 is character data. In this

example the keyword COMMAND is the command keyword and the data

identifiers are A=, B=, C=, and D=.

Multiple-Line Commands

Multiple-line command/data groups are delimited by the command keyword and

the keyword END and may have any number of data subgroups terminated by

the symbol "<" within. They have the typical form of;

COMMAND A=n1,n2

nl I=n2,n3,n4 B=n5 C=c1c2c3c4

nl I=n2,n3,n4 B=n5 C=c1c2c3c4

nl I=n2,n3,n4 B=n5 C=c1c2c3c4

<

n1,n2,n3 D=n4,n5,n6 E=n7 F=c1c2c3

n1,n2,n3 D=n4,n5,n6 E=n7 F=c1c2c3

n1,n2,n3 D=n4,n5,n6 E=n7 F=c1c2c3

<

c1c2c3c4c5c6

END

6-1
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

6. Comand Conventions

Classes of Commands

Two general groups of commands are available, the "Intrinsic Commands" and

the "CONTAM86 Commands". The "Intrinsic Commands" are useful, primarily, in

the interactive mode allowing the user to examine system arrays generated by

the "CONTAM86 commands" and save them for further processing by the CAL80 command processor or other command processors based on the CALSAP

in-core management routines [1]. The "CONTAM86 Commands" provide

contaminant dispersal analysis operations.

CgmmandZdata lines

Normally the line length (i.e., the number of character and spaces on a line) is

limited to 80. A backslash "\" at the end of information on any line will, however,

allow the next line to be interpreted as a continuation of the first line providing

an effective line length of 160.

Use of the symbol "<" within in any line indicates the end of information on that

line. Information entered to the right of this symbol is ignored by the program

and may, therefore, be used to annotate a command/data input file.

An asterisk "*" at the beginning of any line will cause the line to be echoed as a

comment on the console and to the output file. Lines marked in this way may,

then, be used to annotate the output file and help indicate the progress of

computation when using the batch mode of operation.

Data. I de nti fie rs

Data identifiers and their associated data may be placed in any order within

each line of the command/data group with the exception that the first line of a

command/data group must begin with the command keyword. In some

instances data may not be associated with a data identifier, such data must be

placed first in a line.

Data

6-2
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

6. Comand Conventions

Decimal points are not required for real numeric data. Scientific notation of the

form nnE+nn or nn.nnE+nn (e.g., 5.79E-13) may be used. Simple arithmetic

expressions employing the conventional operators +, *, and / may be used.

The order of evaluation is sequential from left to right - unlike FORTRAN or other

programing languages where other "precedence" rules are used.

If fewer data values are supplied than required the missing data will assumed to

be zero, blank, or set to default values as appropriate.

6-3
Y . . ' "
NBS: Indoor Air Quality Model

Phase II Report

PART1I - CONTAM86 Users Manual

7. Introductory Example

7. Introductory Example

For purposes of contaminant dispersal analysis the specific command/data

groups that need to be included in a command/data input file will depend upon

the details of the flow system idealization, the nature of the excitation, and the

type of analysis to be computed. A specific introductory example, should

however, provide some useful insight into the more general aspects of

contaminant dispersal analysis using CONTAM86

Consider the two-story residence with basement shown, in section, below. In this residence interior air is circulated by a forced-air furnace and exterior air

infiltrates the house through leaks around the two first floor windows. The flow

system may be idealized using flow elements to model the ductwork, room-toroom, and infiltration flow paths as shown below.

Actual gu ying Air-Flow System Idealization

Fig 7.1 Hypothetical Residential Example

For this building idealization we shall consider the hypothetical problem of

determining the steady state distribution of CO2 generated by a kerosene

heater placed in room "2", distributed by the furnace flow system operated at

constant conditions, and diluted by infiltration at a constant rate. The C02

7-1
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

7. Introductory Example

generation rate is assumed to be 0.55 kg/hr, exterior C02 concentration is

assumed to be 760 jig CO2/ g air, and the assumed air volumetric flow rates are

indicated on the drawings above.

The CONTAM86 command/data file to complete this steady state analysis is

listed below. Command/data groups needed to complete a time constant

analysis and dynamic analysis for this building idealization are presented as

examples in the reference section of this manual.

7-2
NBS: Indoor Air Quality Model

Phase II Report

PART1I - CONTAM86 Users Manual

7o Introductory Example

Command/data File for Residential Example

Note: CONTAM86 keywords and identifies are displayed in boldface below.

Description

Column

Command/data File

1

Comments: * Comments * Six-Zone (7-Node) Example

Comments * Units: kg, m, hr

Comments * Concentration [=] kg-C02/kg-air

Comments * Generation rate [=] kg-C02/hr

Comments * System Definition: FLOWSYS N=7 < System has 7 Nodes

Boundary Conditions 7 BC=C < Ext. "Zone" Cone. Spec.

END

Flow Element Data: FLOWELEM

Element Number & Connectivity, 1 1=1,2 < Flow Element 1 2 1=1,3 < Flow Element 2

3 1=7,2 < Flow Element 3

4 1=2,7 < Flow Element 4

5 1=7,3 < Flow Element 5

6 1=3,7 < Flow Element 6

7 1=2,4 < Flow Element 7

8 1=3,5 < Flow Element 8

9 1=4,6 < Flow Element 9

10 1=5,6 < Flow Element 10

11 1=6,1 < Flow Element 1

1

END

Steady State Solution: STEADY < (Air Density 1 .2 kg/m3)

Flow Element Mass Flow Rates 1,2 W=70*1 .2 < Supply Ducts

3,6 W=20‘1.2 < Infiltration

7,10 W=70*1 .2 < Return Loop

11 W=140*1.2 < Main Return Duct

Contaminant Excitation

<

2 CG=0.55 < Node 2: Generation Rate

7 CG=0. 000760 < Node 7: Ext. C02 Cone.

END

Return to Interactive Mode RETURN

Details are given on the following pages for each of CONTAM86'

7-3
'
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

8. Command Reference

8.1 Intrinsic Commands

8.1.1 HELP

The command HELP, or simply H, will produce a list of all available commands,

in abbreviated form.

8.1.2 ECHO

The command ECHO-ON acts to cause computed results normally directed to

the results output file to be echoed to the screen. The command ECHO-OFF

turns this feature off. At start-up CONTAM86 is set to ECHO-ON. Selective use

of ECHO-ON and ECHO-OFF can speed computation as writing results to the

screen consumes a significant amount of time.

8.1.3 LIST

The command LIST, or simply L, will produce a list of all arrays currently in the

in-core array database.

8.1.4 PRINT A=<arrayname>

The command PRINT A=<arrayname> or simply P A=<arrayname> will "print"

array named <arrayname>, a one-to four character name, to the screen.

8.1.5 DIAGRAM A=<arrayname>

The command DIAGRAM A=<arrayname> will "print" a diagram of array named

<arrayname>, a one-to four character name, to the screen indicating position of

zero and nonzero terms. (Character arrays can not be diagramed.)

8.1 .6 SUBMIT F=<filename>

The command SUBMIT F=<filename> will cause the program to switch to

batch mode and read all subsequent commands from the file <filename>.

8-1
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

8.1.7 RETURN

The command RETURN returns the operation of the program from batch mode

to interactive mode. RETURN or QUIT will normally be the last line of batch

command/data input files.

8.1.8 QUIT

The command QUIT or simply Q terminates execution of the program and

returns the user to the control of the operating system.

8-2
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

8.2 CONTAM86 Commands

The following conventions will be used for the command definitions presented

in this section;

- an ellipses, indicates unlimited repetition of similar data items or data

lines within a data subgroup

- square brackets, [...], indicate optional data,

- numeric data is indicated by lower case n, as nl ,n2, ... , and

- character data by lower case c, as cl

.

8.2.1 FLOWSYS

The size of the flow system and boundary conditions of system nodes are

defined with the following command/data group;

FLOWSYS N=n1

n2,n3,n4 BC=c1

END

where; nl = the number of flow nodes

n2,n3,n4 = first node, last node, node increment of a series of nodes

with identical boundary conditions

cl = boundary condition code; C for concentration prescribed

nodes; G for generation prescribed nodes; (default = C)

The direct species mass generation rate qt the species concentration - but not

both - may be specified at each node to establish boundary conditions of

prescribed contaminant generation or concentration.

If this boundary condition data is omitted all nodes will be assumed to be

species mass generation rate DOFs. Typically, nodes associated with outdoor

environmental conditions will be assigned specific contaminant concentrations

8-3
NBS: Indoor Air Quality Model

Phase II Report

PARTI1 - CONTAM86 Users Manual

8. Command Reference

and nodes associated with indoor air zones will be assigned specific species

generation rates although zero generation rates will often be appropriate for

these nodes.

See the introductory example presented earlier for an example of the use of this

command.

8.2.2 FLOWELEM

Two-node flow elements may be added to the flow system assemblage with the

following command/data group;

FLOWELEM

nl I=n2,n3 GEN=n4 E=n5

• • e END

where; nl

n2, n3

n4

n5

= the element number

= the element node numbers

= generation increment (default = 1) = the element filter efficiency (default = 1.0)

Element data must be supplied in numerical order. Omitted data is automatically

generated by incrementing the preceding node numbers by the current

generation increment. Generated elements will have the properties of the

current element.

See the introductory example presented earlier for an example of the use of this

command.

8.2.3 STEADY

The response of the system to steady contaminant generation with steady

element mass flow may be computed with the following command/data group;

STEADY

n1,n2,n3 W=n4

8-4
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

n5,n6,n7 CG=n8

END

where; nl ,n2,n3 = first element, last element, element number increment of a

series of elements with identical mass flow rates

n4 = element total mass flow rate; (default = 0.0)

n5,n6,n7 = first node, last node, node increment of a series of nodes

with identical excitation

n8 = contaminant concentration or contaminant generation

rate, as appropriate to the boundary condition of the node;

(default = 0.0)

Net total mass flow rate at each system node will be reported, but computation

will ngl be aborted if net mass flow is nonzero. The analyst must assume the

responsibility to check continuity of mass flow from these reported values.

See the introductory example presented earlier for an example of the use of this

command.

8.2.4 TIMECONS

System time constants, nominal and actual, may be computed with the following

command/data group;

TIMECONS [E=n1]

n2,n3,n4 W=n5

<

n6,n7,n8 V=n9

END

where; nl = optional convergence parameter, epsilon ; (default = machine precision)

n2,n3,n4 = first element, last element, element number increment of a

8-5
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

series of elements with identical mass flow rates

n5 = element total mass flow rate; (default = 0.0)

n6,n7,n8 = first node, last node, node increment of a series of nodes

with identical volumetric masses

n9 = nodal volumetric mass; (default = 0.0)

The nominal time constants are computed for each node as the quotient of the

nodal volumetric mass divided by the total air flow out of a zone. The actual

time constants are computed using an eigenanalysis routine that is a variant of

Jacobi iteration adapted for nonsymmetric matrices [2]. It should be noted that

the actual time constants are likely to be very different from the nominal time

constants for systems having well-coupled zones. Be advised: eigenanalysis of

the flow system matrices is a time consuming task.

To determine the time constants associated with the building idealization

presented earlier, in the introductory example, the following command/data

group would have to be added to the command/data file.

Example

TIMECONS < (Air Density 1 .2 kg/m3)

1,2 W=70*1.2

3,6 W=20*1.2

7,10 W-70*1 .2

11 W=140*1.2

< Supply Ducts < Infiltration < Return Loop

< Main Return Duct <

1 V=1 .2*1.0

2,3 V=1.2*40.0

4,5 V=1 .2*30.0

6 V=1 .2*0.1

< Node 1 Vol. Mass

< Nodes 2 & 3 Vol. Mass

< Nodes 4 & 5 Vol. Mass

< Node 6 Vol. Mass

7 V=1 .2*1 .0E+06

END

< Node 7 Ext. Vol. Mass

8-6
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

8.2.5 Dynamic Analysis

The response of the system, including transients, to general dynamic excitation,

may be computed using the command DYNAMIC. The dynamic solution

procedure used is driven by discrete time histories of excitation and element

mass flow data that must firs! be generated with the commands FLOWDAT and

EXCITDAT. (In future releases of CONTAM element mass flow data may also

be generated by a detailed flow analysis of the flow system.)

8.2.5.1 FLOWDAT

Discrete time histories of element mass flow rate may be defined, in step-wise

manner, from given element mass flow data, as illustrated below;

Data

Value

1

i

>

i

i 1^

Given Data Value

TIME(1) TIME(2) TIME(3) TIME(4)

Fig. 8.1 Arbitrarily Defined Time History Data

or, alternatively, discrete time histories of element mass flow data, defined in a

step-wise manner at equal time-step intervals along piece-wise linear

segments, may be generated from given element mass flow data over a time

range defined by an initial time, Tj, a final time, Tf, and a generation time

increment, AT, as illustrated below;

8-7
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

using the following command/data group;

FLOWDAT [T-n1,n2,n3]

TIME=n4

n5,n6,n7 W=n8

<

TIME=n4

complete

n5,n6,n7 W~n8

<

END

where; nl ,n2,n3 = initial time, final time, time step increment used for

the piece-wise linear generation option

n4 = time value for subsequent data subgroups

n5,n6,n7 = first element, last element, element number increment of a

series of elements with identical mass flow data

n8 = prescribed element mass flow: (default = 0.0)

If data values n1,n2,n3 are specified, step-wise time histories will be generated

from the given data, along piece-wise linear segments as illustrated in Fig. 8.2

above, otherwise the given data will be used directly, as illustrated in Fig. 8.1

above.

At least two "TIME" data subgroups must be provided. FLOWDAT writes the

generated time history to the file <filename>.WDT so that this data may

subsequently be accessed by the command DYNAMIC.

[additional TIME data, as necessary, to define the

excitation time history]

8-8
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

S.2.5.2 EXCITDAT

Discrete time histories of excitation data may be defined in the two ways

discussed above for the FLOWDAT command using the following

command/data group;

EXCITDAT [T=n1,n2,n3]

TIME=n4

n5,n6,n7 CG=n8

<

TIME=n4

n5,n6,n7 CG=n8

[additional TIME data, as necessary, to define the

complete excitation time history]

<

END

where; nl ,n2,n3 = initial time, final time, time step increment used for

the piece-wise linear generation option

n4 = time value for subsequent data subgroups

n5,n6,n7 = first node, last node, node number increment of a series

of nodes with identical excitation data

n8, = prescribed contaminant concentration fir prescribed

contaminant generation rate (as appropriate to node

boundary condition): (default = 0.0)

If data values n1,n2,n3 are specified, step-wise time histories will be generated,

from the given data, along piece-wise linear segments as illustrated in Fig. 8.2

above, otherwise the given data will be used directly, as illustrated in Fig. 8.1

above.

At least two "TIME" data subgroups must be provided. EXCITDAT writes the

generated time history to the file <filename>.EDT so that it may subsequently be

accessed by the command DYNAMIC.

8-9
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

8.2.5.S DYNAMIC

The response of the system to excitation defined by the EXCITDAT command,

using the prescribed element flow data defined by the FLOWDAT command,

may be computed using the following command/data group;

DYNAMIC

T=n1,n2,n3 [THETA=n4] [Pl=n5] [PS=n6]

n7,n8,n9 \A=n1Q

<

n7,n8,n9 IC=n1

1

END /

where; nl ,n2,n3 = initial time, final time, time step increment

n4 = integration parameter, 0, where 0 < 0 < 1 ; (default =

0.75) instability may result for 0 < 0.5,

n5 = response results print interval; (default = 1)

n6 = plot file results scale factor; if not equal to 0.0, an ASCII

file, <filename>.PLT, of concentration response results will

be created with values scaled by the factor n6

n7,n8,n9 = first node, last node, node increment of a series of

nodes with identical data

nIO = nodal volumetric mass; (default = 0.0)

nil = initial nodal concentration; (default = 0.0)

The response is computed using the predictor-corrector method discussed in

PART I of this report. With this method, the system flow matrix is updated at the

discrete times used to define element flow rate time histories and the system

excitation is updated at the discrete times used to define excitation time

histories, as illustrated below;

8-10
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

Flow

Data

Value

Flow Time Step

Generated by

FLOWDAT

Time

Excitation

Data

Value

Generated by

EXCITDAT

Excitation Time Step

Time

The accuracy of the computed response is, therefore, dependent upon the

choice of the flow data time step, the excitation data time step, and the

integration time step chosen by the analyst. Furthermore, the flow data and

excitation data time steps may be nonconstant. The analyst should, therefore,

consider investigating the effects of the choice of these time step variables to

gain a sense of the error they induce.

8.2.5.4 Dynamic Analysis Example

To provide an example of a command/data sequence needed for dynamic

analysis we may consider an extension to the introductory example presented

earlier; the analysis of the dynamic response of the given building system,

under conditions of constant air flows, to a step change in CO2 generation.

Specifically, to consider the case where the kerosene heater is turned on and

then turned off 133 minutes later the following command/data group would have

8-11
NBS: Indoor Air Quality Model PARTII - CONTAM86 Users Manual

Phase II Report 8. Command Reference

to be added to the command/data file used in the introductory example.

FLOWDAT

*

* Element flow rates modeled as constant.

TIME=0

1,2 W=70*1.2

3,6 W=20*1.2

7,10 W=70*1 .2 11 W=140*1.2

< Supply Ducts < Infiltration < Return Loop

< Main Return Duct <TIME=5

1,2 W=70*1.2

3,6 W=20*1.2

7,10 W=70*1 .2 11 W=140*1.2

END

< Supply Ducts < Infiltration < Return Loop

< Main Return Duct

EXCITDAT

TIME=0

< Nodal Excitation

*

* Kerosene heater turned on at time = 0 mins.

it

2 CG=0.55

7 CG=0.000760

<TIME=1 33/60

< Node 2: Generation Rate < Node 7: Ext. C02 Cone.

it

* Kerosene heater turned off at time = 133 mins.

*

2 CG=0.0

7 CG=0.000760

< Node 2: Generation Rate < Node 7: Ext. C02 Cone.

<TIME=5

2 CG=0.0

7 CG=0.000760

END

DYNAMIC

< Node 2: Generation Rate < Node 3: Ext. C02 Cone.

T=0,4,0.1 PS=1 .OE+6

1 V=1. 2*1.0

2,3 V=1.2*40.0

4,5 V=1.2*30.0

6 V=1 .2*0.1

7 V=1 .2*1 .0E+06

< Time-step; Plot Scale < Node 1 Vol. Mass

< Nodes 2 & 3 Vol. Mass

< Nodes 4 & 5 Vol. Mass

< Node 6 Vol. Mass

< Node 7 Ext. Vol. Mass

<

1,7 IC=0. 000760

END

< Initial Concentrations

8-12
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

8. Command Reference

8.2.6 RESET

The command RESET resets the system in preparation for a new analysis

problem (i.e. , key internal variables are re-initialized, contaminant dispersal

analysis system arrays are deleted from memory, and existing binary files are

deleted from disk storage). The system is automatically reset, if necessary,

upon execution of the FLOWSYS command.

RESET may be used to delete binary files that would otherwise be left on disk at

the termination of the program.

8-13

NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

9. Example Problems

9.1 Single Zone Examples

It is useful to first consider a single zone building air flow system that exchanges

indoor air with the exterior environment. Such a single zone system may be

modeled as an assemblage of two flow elements, corresponding to inlet and

exhaust flow paths, connected to two system nodes, corresponding to the inside

air zone and the exterior environment "zone” as illustrated below;

Fig. 6.1 A Single Zone Building and Corresponding Flow Model

The equations governing this simplest flow system have the following general

form;

' dc/

£ CM 1

1 r >

r c, 'v, o

dt

r n ^1

< >

r

< > = < _-W! W 2 _ lc 2j L o vj dC 2

dt J

where;

w-, , w2 = intake and exhaust element flow rates, respectively

C-i , C2 = interior and exterior contaminant concentrations, respectively

V1f V2 = interior and exterior volumetric masses, respectively

G-i, G2 = interior and exterior contaminant generation rates,

respectively.

9-1
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

From a consideration of mass continuity we require w1 = w2 = w and therefore

equations (9.1) may be rewritten in expanded form as;

With these equations in hand we shall proceed to consider three cases;

Case 1 : Contaminant Decay under Steady Flow Conditions

Case 2: Contaminant Decay under Unsteady Flow Conditions

Case 3: Contaminant Dispersal Analysis of an Experimental Test

In all three cases, system characteristics will be based on those of an

experimental test reported by Traynor, et. al [3] involving measurements of

pollutant emissions from portable kerosene heaters.

9.1.1 Case 1: Contaminant Decay under Steady Flow Conditions

Consider the particularly simple, and familiar, case of contaminant decay from

some initial value, C-,(t=0), under steady flow conditions, w = constant, with

concentration in the exterior environment maintained at the zero level, C2 = 0.

Under these conditions equation (9.2a) simplifies to;

W C, - W C 2 + - Gj

'dt (9.2a)

-w Ci + w C2 + = G2

dt

(9 .2b)

dt

0 (9.3)

whose exact solution is;

c, = c,(t=o) e (V,/w)

(9.4)

9-2
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

(the quotient (V-,/w) is commonly know as the time constant of the system).

This exact solution is compared, below, to approximate solutions generated

with the program CONTAM using integration time steps of At = 2.0, 1.0, and 0.5

hrs with C-|(t=0) = 1.0 x 10"6 kg / kg air, V-j = 31.87 kg, and w = 12.75 kg/hr (i.e.,

0.4 air changes per hour).

Fig. 9.2 Single Zone Model: Contaminant Decay under Steady Flow Conditions

The accuracy of the general predictor-corrector method used to approximate the

response of this system is related to the time constant of the system being

studied. In this case the time constant is (31.87 kg/12.75 kg/hr) = 2.5 hr. From

the results of this single study, then, it appears that using an integration time

increment equal to a fraction of the system time constant will assure practically

accurate results.

Case 1 : Command/data Input File for At = 0.5

The CONTAM command/data file and resulting results output file are listed

below. It should be noted that a large number was used for the volumetric mass

9-3
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

of the exterior "zone” to affect a model of a practically infinite contaminant sink.

FLOWSYS N=2

2 BC=C

END

FLOWELEM

1 1= 1,

2

2 1 =2,1

END

FLOWDAT

TIME=0

1 W=12 . 7 5

2 W=12 . 7 5 <TIME=15

1 W=12 . 7 5

2 W=12 .75

END

EXCITDAT

TIME=0

1 CG=0 .

0

2 CG=0 . <TIME=15

1 CG=0 .

0

2 CG=0 . END

DYNAMIC

T=0, 10, 0 .5

1 V=31 . 87

2 V=1 . OE+9

<

1 IC=1 . OE-O 6

2 IC=0.0

END

RETURN

< Single-Zone (2-Node) Example

< Flow Element 1 < Flow Element 2

< Element Mass Flow Rates [=] kg/hr

< Nodal Excitation

< Node 1: Zero Generation Rate

< Node 2: Zero Concentration

[=] kg/hr

[=] kg C02/kg

< Node 1: Zero Generation Rate [=] kg/hr

< Node 2: Zero Concentration [=] kg C02/kg

< Initial Time, Final Time, Time Step Increment

< Node 1: Volumetric Mass [=] kg

< Node 2: Volumetric Mass [=] kg

< Node 1: Initial Concentration [=] kg C02/kg

< Node 2: Initial Concentration [=] kg C02/kg

Case 1 : Results Output File

I CONTAM: Contaminant Dispersal Analysis for Building Systems I Ver-10-8 6 Jim Axley - Cornell & NBS

MTOT : 50000 ==== FLOWSYS: FLOW SYSTEM CONTROL VARIABLES

Number of flow system nodes 2 == Node Boundary Conditions

Negative Eqtn-# = concentration-prescribed boundary.

Positive Eqtn-# = generation-prescribed boundary.

9-4
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

Node

1

Eqtn-# Node Eqtn-#

1 2-2 Node Eqtn-# Node Eqtn-# Node Eqtn-#

= FLOWELEM: FLOW ELEMENTS

Elem

1

2

I-Node J-Node

1 2

2 1

Filter Efficency

.000

.000

===== FLOWDAT: ELEMENT FLOW TIME HISTORY DATA

== Generation Control Variables

Initial time .000

Final time 15.0

Time, step increment 15.0

== Element Mass Flow Time History Data

Time

:

.000

Elem

1

Value

12.7

Elem

2

Value

12.7

Elem Value Elem Value Elem Value

Time

:

15.0

Elem Value Elem Value Elem Value Elem Value Elem Value

1 12.7 2 12.7

===== EXCITDAT : EXCITATION TIME HISTORY DATA

== Generation Control Variables

Initial time .000

Final time 15.0

Time step increment 15.0 == Nodal Excitation Time History Data

== Time: .000

Node

1 == Time

:

= independent DOFs

Value Node Value Node

.000 2 * .000

15.0

"U" = undefined DOFs.

Value Node Value Node Value

= independent DOFs

Node Value Node Value

1 .000 2 * .000 ==== DYNAMIC: DYNAMIC SOLUTION

Node

"U" = undefined DOFs.

Value Node Value Node Value

9-5
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

== Solution Control Variables

Initial time .000

Final time 10.0

Time step increment ............ .500

Integration parameter: alpha ... .750

Results print interval ......... 1 == Nodal Volumetric Mass

*" = independent DOFs "U" = undefined DOFs.

Node Value Node Value Node Value Node Value Node Value

1 31.9 2* 0.100E+10

== Initial Conditions: Nodal Concentrations

= independent DOFs "U” = undefined DOFs.

Node

1 —— IT 1 Qfwrv

Value

0 .100ET“1 t" p 1 /~v t*?

Node Value Node

05 2* .000

D a +• o T a 4- o ——- ———— —-

Value Node Value Node Value

11 l. r iuw Time non

:

. UUU

Elem

1

Value

12.7

Elem Value Elem

2 12.7

Value Elem Value Elem Value

== Net Total Mass Flow

= independent DOFs "U" = undefined DOFs.

Node Value Node Value Node Value Node Value Node Value

1 .000 2 * .000 == Excitation Update ========================================= Time: .000 "*" = independent DOFs "U" = undefined DOFs.

Node Value Node Value Node Value Node Value Node Value

1 .000 2 * .000 == Time Step Estimate for Initial Conditions

-- NOTE: Estimated time step to limit error to approx. 5.00% is: .925

Specified time step is: .500 == Response ================================================== Time: .500 "*" = independent DOFs "U" = undefined DOFs.

Node Value Node Value Node Value Node Value Node Value

1 0.826E-06 2* -0.593E-30

= independent DOFs "U" = undefined DOFs.

9-6
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

Node Value Node Value Node Value Node Value Node Value

1 0.682E-06 2* -0.187E-29

== Response ================================================== Time: 1.50

= independent DOFs "U" = undefined DOFs.

Node Value Node Value Node Value Node Value Node Value

1 0 . 564E-0 6 2* -0.372E-29

== Response ================================================== Time: 2.00

= independent DOFs "U" = undefined DOFs.

Node Value Node Value Node Value Node Value Node Value

1 0.466E-06 2* -0.603E-29

== Response ================================================== Time: 2.50

_ independent DOFs "U" = undefined DOFs.

Node Value Node Value Node Value Node Value Node Value

1 0 . 385E-0 6 2* -0.874E-29

== Response ================================================== Time: 3.00

= independent DOFs "U" = undefined DOFs.

Node Value Node Value Node Value Node Value Node Value

1 0.318E-06 2* -0 . 118E-28

( et cetera ) —

== Response ================================================== Time: 10.0

= independent DOFs "U" = undefined DOFs.

Node Value Node Value Node Value Node Value Node Value

1 0 . 219E-07 2* -0.686E-28

9.1.2 Case 2: Contaminant Decay under Unsteady Flow Conditions

To investigate the consequence of unsteady flow on the nature of the behavior

of the "real" system and the numerical characteristics of its simulation we shall

extend Case 1 by considering the decay of a contaminant under conditions of

linearly increasing flow rates, that is to say with;

w = w° t : t > 0.0 (9-5)

The decay problem is now governed by the equation;

9-7
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

w° t C, + = o

’dt c 1 (t=0) = 1.0 (9.6a)

or

w° t dt ii -to o

ii oii

-4

—

<_7 (9.6b)

The second form, with variables t and C^ separated, may be integrated directly

to obtain the exact solution;

_

t 2

C, = 1.0 2 (2V,/w°) (6.7)

Again this exact solution is compared to approximate solutions generated with

the program CONTAM86, below. For this case, however, the numerical

consequences of both integration time step, At, and step-wise approximation of

the unsteady flow, Atw, (i.e., the flow approximation time step) can be

considered. (The solution was generated for V-, = 31.87 kg, and w° = 3.187

kg/hr2

.)

In this case, using an integration time step equal to the flow approximation time

step, At = Atw, (i.e., updating the system flow matrix at each time step) provides

practically accurate results for even the relatively large time step of 2.0 hr (see

Figure 9.3). Updating the system flow matrix every other time step introduces

an offset error equal to the flow approximation time step (when compared to

results obtained with updating at each time step) for the first time step that is

gradually diminished with each successive time step (see Figure 9.4). This

initial offset error results because of the initial zero flow condition; in other cases

the initial error would not be expected to be as great.

9-8
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

Fia. 9.3 Single Zone Contaminant Decay under Unsteady Flow Conditions

with Flow Updating at Each Integration Time Step

Fia. 9.4 Single Zone: Contaminant Decay under Unsteady Flow Conditions

with Flow Updating at Every Other Integration Time Step

9-9
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

Case 2: Command/data Input File for At = 1 .0 and Atw = 2.0

The CONTAM command/data file used for one of these studies is listed below.

It should be noted that a large number was used for the volumetric mass of the

exterior "zone" to affect a model of a practically infinite contaminant sink.

FLOWSYS N=2 < Single-Zone (2-Node) Example

2 BC=C

END

FLOWELEM

1 1=1 , 2

2 1 =2,1

END

FLOWDAT

TIME=0

1 W=0 .

0

2 W=0 . <TIME=12

1 W=38 .244

2 W=38 .244

END

EXCITDAT

TIME=0

1 CG=0 o 0

2 CG=0 .

0

<TIME=15

1 CG=0 .

0

2 CG=0 . END

DYNAMIC

T=0, 10, 1 .

0

1 V=31 . 87

2 V=1 . 0E+9

<

< Flow Element 1 < Flow Element 2

T=0 , 12 , 2 < Element Mass Flow Rates [=3 kg/hr

< t=0 : w = 3.187 X 0.0 = 0.0

< t=12 : w = 3.187 X 12 = 38.244

< Nodal Excitation

< Node 1: Zero Generation Rate [=] kg/hr

< Node 2: Zero Concentration [=] kg C02/kg

< Node 1: Zero Generation Rate [=] kg/hr

< Node 2: Zero Concentration [=] kg C02/kg

< Initial Time, Final Time, Time Increment

< Node 1: Volumetric Mass [=] kg

< Node 2: Volumetric Mass [=] kg

1 IC=1.0E-06 < Node 1: Initial Concentration [=] kg C02/kg

2 IC=0.0 < Node 2: Initial Concentration [=] kg C02/kg

END

RETURN

9.1.3 Case 3: Contaminant Dispersal Analysis of an Experimental Test

As noted above Traynor, et.al. reported the time variation of contaminant

concentrations in a single zone system generated by portable kerosene

heaters. In this example the variation of NO concentration, Ci , in a single zone

system is computed, using measured properties of the system and NO

generation rate, and compared to experimental results. The properties of the

9-10
NBS: Indoor Air Quality Model

Phase II Report

PART1I - CONTAM86 Users Manual

9. Example Problems

system and excitation used in the model are as follows;

single zone volumetric mass = 31.87 kg (based on the reported volume of

27 m3 and an assumed air density of 1.18 03 kg/m3 corresponding to 26 °C

and 1 atm)

G-i : NO generation rate = 0.000186 kg/hr constant for one hour, zero

thereafter (based on the product of the reported emission rate of 23.7 pg/kJ

times the fuel consumption of 7830 kJ/hr)

V2 : exterior "zone" volumetric mass = 1 .0 - 109 kg (infinite sink modeled as a

large number)

C2 : exterior "zone" ambient concentration = 0.0 kg NO/kg air (based on

reported initial conditions)

w: air mass flow rate = 12.43 kg/hr (based on reported air change rate of 0.39

ACH)

Experimental results are compared below, Figure 9.66, to analytical results

using two integration time steps. The reported generation rate time history is

shown in Figure 9.5.

NO

Generation

Rate

(g/hr)

Time (hr)

Fig. 9.5 NO Generation Rate Time History Models

9-11
NBS: Indoor Air Quality Model

Phase II Report

PART1I - COMTAM86 Users Manual

9. Example Problems

NO

icentrat

Cpig/g)

Fig. 9.6 Single Zone: NO Contaminant Dispersal Analysis of an Experimental

lesl

Traynor, et. al. also studied the time variation of C02 concentration generated

by portable kerosene heaters in the same single zone system. Experimental

results for one of these studies are compared to analytical results below, Figure

9.7. Again, the predicted results agree well with measured data.

9-12
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

C02

icerttrat

C|JLg/g)

Time (hr)

Fig. 9.7 Single Zone: COo Contaminant Dispersal Analysis of an Experimental

lesl

Case 3: Command/data Input File for At = 0.10. NO Generation Rate History #1

The CONTAM command/data file used for one of these studies is listed below.

It should be noted that a large number was used for the volumetric mass of the

exterior "zone" to affect a model of a practically infinite contaminant sink.

FLOWSYS N=2

2 BC=C

END

FLOWELEM

1 1= 1,2

2 1 =2,1

END

FLOWDAT

TIME=0

1 W=12 . 43

2 W=12 . 43

<TIME=3 .

5

1 W=12 . 43

2 W=12 . 43

END

< Single-Zone (2-Node) Example

< Flow Element 1 < Flow Element 2

< Element Mass Flow Rates [=] kg/hr

< 0.39 Air Changes Per Hour

< 0.39 Air Changes Per Hour

9-13
NBS: Indoor Air Quality Model

Phase li Report

PARTII - CONTAM86 Users Manual

9. Example Problems

EXCITDAT

TIME=0 .

0

1 CG=0. 000186

2 CG=0 .

0

<TIME=1 .

0

1 CG=0 . 0

2 CG=0 .

0

<TIME=3 .

5

1 CG=0 .

0

2 CG=0 . <END

DYNAMIC

T=0,2,0.1

1 V=31 . 87

2 V=1 . OE+9

<

1 IC=0.0

2 XC=0.0

END

RETURN

< Nodal Excitation

< Node 1: Generation Rate [=] kg/hr

< Node 2: Concentration [=] kg NO/kg

< Node 1: Generation Rate [=] kg/hr

< Node 2: Concentration [=] kg NO/kg

< Node 1: Generation Rate [=] kg/hr

< Node 2 : Concentration [=] kg NO/kg

< Initial Time, Final Time, Time Increment

< Node 1: Volumetric Mass [=] kg

< Node 2: Volumetric Mass [=] kg

< Node 1: Initial Concentration [=] kg NO/kg

< Node 2: Initial Concentration [=] kg NO/kg

9.2 Two Zone Example

In another study Traynor et. al. [4] studied the variation of contaminant

concentration generated by portable kerosene heaters in a multi-room

residence that was modeled as a two-zone flow system. In this study a

kerosene heater was placed in a master bedroom that was allowed to

exchange air with the rest of the house and the exterior environment under a

variety of test conditions. Here we shall attempt to model one of these tests that

allowed relatively large flow rates between the master bedroom and the rest of

the house.

For this test Traynor et. al. report the time history of the flow rate between the

master bedroom and the rest of the house, the whole-house infiltration rate, and

the volumes of the master bedroom and the rest of the house. The contaminant

generation rate produced by the kerosene heater was reported in the earlier

study discussed above. The heater was operated for a period of 133 minutes.

Based on these reports a two-zone building and its corresponding flow model

may be formulated as illustrated below (Figure 9.8).

9-14
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

It will be assumed that infiltration will be equal to exfiltration for each zone (i.e.

,

w3 = w4 and w5 = w6 ) given by the product of the reported whole-house

infiltration rate (0.35 ACH) and the respective volumetric masses. The average

indoor air temperature of 16 °C will be used to compute volumetric mass

quantities and mass flow rates from the reported values (i.e., a constant density

of 1 .22 kg/m3 is assumed for air).

The "inter-room" mass flow rate time histories (i.e., w^t) or equivalently w2

(t) ), based on the reported volumetric flow rate histories, are plotted below along

with the computed variation of C02 concentration in each zone, figures 9.9 and

9.10.

9-15
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

Fig. 9.10 Two Zone Example: Response Based on Measured Flow and COo Generation Data

The peak C02 concentration measured during the test was 3709 pg/g (2440

ppm) that compares very well with the predicted concentration of 3769 pg/g

(2480 ppm). It should be noted, however, that the reported flow rates were

determined to an accuracy of only ± 33 % so the close agreement of

experimental and analytical peak values must be considered to be largely

fortuitous.

Traynor et. al. also reported inter-room temperature differences for the test

considered above which suggested thermal equilibrium had been achieve by

the time the heater was shut off (i.e., the temperature difference between the

master bedroom and the rest of the house remained relatively steady. Based

on this observation the inter-room mass flow rate was assumed to have also

reached steady state (i.e., the rightmost extrapolated portion of Figure 9.9

above) for the purposes of analysis.

It is interesting, then, to consider a hypothetical extension of this test - How

would C02 concentration vary under these (apparently) steady conditions? To

answer this question an additional analysis was computed using the flow time

history reported above (Figure 9.9), with flow assumed constant after 1.7 hours,

and a constant generation rate (i.e., without shutting off the heater). The results

9-16
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

of this study are plotted below. The program CONTAM, in this instance, was

used to estimate both the steady state and the dynamic response of the system.

Fig. 9.11 Two Zone Example: Hypothetical Constant CO;? Generation Rate

Response

Command/data Input File

The CONTAM command/data file used for the first study is listed below. It should be noted that a large number was used for the volumetric mass of the

exterior "zone" to affect a model of a practically infinite contaminant sink.

FLOWSYS N=3 < Two-Zone (3-Node) Example

3 BC=C

END

FLOWELEM

< Exterior "Zone" (Node 3) V

1 1=2,1 < Flow Element 1

2 1=1,2 < Flow Element 2

3 1=1,3 < Flow Element 3

4 1=3,1 < Flow Element 4

5 1=2,3 < Flow Element 5

6 1=3,2

END

< Flow Element 6

FLOWDAT

TIME=0

1 W=0

2 W=0

T=0, 180/60, 0 .

1

< Element Mass

< Inter-Room Flow

< Inter-Room Flow

9-17
NBS: Indoor Air Quality Model

Phase II Report

PARTII » CONTAM86 Users Manual

9- Example Problems

3 W=0. 35*205*1. 22 < 0.35 ACH

4 W=0. 35*205*1. 22 < 0.35 ACH

5 W=0. 35*31*1. 22 < 0.35 ACH

6 W=0. 35*31*1. 22 < 0.35 ACH

TIME=28/60

1 W=250*l .22 < Inter-Room Flow

2 W=250*l . 22 < Inter-Room Flow

3 W=0. 35*205*1. 22 < 0.35 ACH

4 W=0. 35*205*1. 22 < 0.35 ACH

5 W=0 .35*31*1 .22 < 0.35 ACH

6 W=0 .35*31*1.22 < 0.35 ACH

<TIME=52 / 60

1 W=500*l .22 < Inter-Room Flow

2 W=500*l .22 < Inter-Room Flow

3 W=0 .35*205*1.22 < 0.35 ACH

4 W=0. 35*205*1. 22 < 0.35 ACH

5 W=0 .35*31*1 .22 < 0.35 ACH

6 W=0. 35*31*1. 22

<TIME=7 6/60

< 0.35 ACH

1 W=12Q5*1 . 22 < Inter-Room Flow

2 W=1205*l . 22 < Inter-Room Flow

3 W=0 .35*205*1.22 < 0.35 ACH

4 W=0 .35*205*1.22 < 0,35 ACH

5 W=0 .35*31*1 .22 < 0.35 ACH

6 W=0 .35*31*1.22 < 0.35 ACH

<TIME=101/ 60

1 W=3375*l . 22 < Inter-Room Flow

2 W=3375*l .22 < Inter-Room Flow

3 W=0. 35*205*1. 22 < 0.35 ACH

4 W=0. 35*205*1. 22 < 0.35 ACH

5 W=0. 35*31*1. 22 < 0.35 ACH

6 W=0 .35*31*1.22 < 0.35 ACH

<TIME=210/60

1 W=3375*l .22 < Inter-Room Flow

2 W=3375*l . 22 < Inter-Room Flow

3 W=0. 35*205*1. 22 < 0.35 ACH

4 W=0. 35*205*1. 22 < 0.35 ACH

5 W=0. 35*31*1. 22 < 0.35 ACH

6 W=0 .35*31*1.22 < 0.35 ACH

END

EXCITDAT < Nodal Excitation

TIME=0 .

0

2 CG=0 .549 < Node 2: Generation Rate [=] kg/hr

3 CG=0. 000760 < Node 3: Exterior C02 Concentratio:

< kg C02/kg

TIME=133/60

2 CG=0 .

0

3 CG=0. 000760

<TIME=210/60

2 CG=0 .

0

< Kerosene heater turned off at 133 minutes.

< Node 2: Generation Rate [=] kg/hr

< Node 3: Exterior C02 Concentration [=] kg C02/kg

< Node 2: Generation Rate [=] kg/hr

9-18
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

3 CG=0. 000760

<END

DYNAMIC

T=0, 150/60, 0.1

1 V=205*l . 22

2 V=31*l .22

3 V=1 . 0E+0 9 <

1 IC=0. 000760

2 IC=0. 000760

3 IC=0. 000760

END

RETURN

< Node 3: Exterior C02 Concentration [=] kg C02/kg

< Initial Time, Final Time, Time Increment

< Node 1: Volumetric Mass [=] kg

< Node 2: Volumetric Mass [=] kg

< Node 3: Exterior Volumetric Mass [=] kg

< Node 1: Initial Concentration [=] kg C02/kg

< Node 2: Initial Concentration [=] kg C02/kg

< Node 3: Initial Concentration [=] kg C02/kg

9.7 Full-Scale Multi-zone Residential Example

To provide an example of a more complex multi-zone problem consider the

hypothetical full-scale residential flow system illustrated below. In this example,

C02 generated in one room of a two story four room residence is dispersed

throughout the building by the hot-air system and diluted by outside air

infiltration at the rate of 0.5 ACH in the two lower rooms. The C02

is generated

by a portable kerosene heater, whose generation characteristics are assumed

to be the same as that used above in the single zone examples, is operated for

133 minutes and then turned off. The results of the analysis are plotted below

illustrating the detailed dynamic variation of pollutant concentration in the

building air flow system.

9-19
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

r *

• — Zone Node Flow Element — m

2 — Node Number Element Flow -

Air-Flow System Idealization

Fig. 9.12 Full-Scale Residence and Corresponding Flow Model

C02

Concentration

g/g

9000

8000

7000

6000

5000

4000

3000

2000

1000

0

JK

-sf

m

|

D' a, n

< V\ *"

]

<:v3. / i n

i J * 1-m. J

* ==

ru

3 /

u/ Node 1 Node 2

Node 3

• D' Node 4

Node 5

1

i *

L_

B m

0.0 0.5 1.0 1.5 2.0 2.5

Time (hr)

3.0 3.5 4.0

Fig. 9.13 Residential Example Response Results

9-20
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

Command/data Input File

The CONTAM command/data input file used for this study is listed below.

FLOWSYS N=7

7 BC=C

END

FLOWELEM

1 1-1,2

2 1-1,3

3 1=7,2

4 1=2,7

5 1=7,3

6 1=3,7

7 1=2,4

8 1=3,5

9 1=4,6

10 1=5,6

11 1=6,1

END

TIMECONS

1.2 W=70*l .

2

3,6 W=20*l .

2

7,10 W=7 0*1.2

11 W=140*l .

2

<

1 V=l. 2*1.0

2.3 V-l. 2*40.0

4.5 V=l. 2*30.0

6 V=l. 2*0.1

7 V=1 . 2*1 . 0E+0

6

END

FLOWDAT

TIME=0

1,2 W=70*l .2

3.6 W=20*l .

2

7,10 W=70*l . 11 W=1 40 *1 .

2

<TIME=5

1,2 W=70*l .

2

3,6 W=20*l . 7,10 W=70*l .

2

11 W=140*l .

2

END

EXCITDAT

TIME=0

2 CG=0 .549

7 CG=0. 000760

<TIME=133/60

2 CG=0 .

0

7 CG=0. 000760

< Six-Zone (7-node) Example

< Exterior "Zone" (Node 7) Will Have Cone. Specified

< Flow Element 1 < Flow Element 2 < Flow Element 3 < Flow Element 4 < Flow Element 5 < Flow Element 6 < Flow Element 7 < Flow Element 8 < Flow Element 9 < Flow Element 10

< Flow Element 11

< 0.50 Building ACH each

< 0.25 Room ACH each

< 0.50 Building ACH each

< 1.00 Building ACH

< Node 1: Volumetric Mass [=] kg

< Nodes 2 & 3: Volumetric Mass [=] kg

< Nodes 4 & 5: Volumetric Mass [=] kg

< Node 6: Volumetric Mass [=] kg

< Node 7: Exterior Volumetric Mass [=] kg

< Element Mass Flow Rates [=] kgm/hr

< 0.50 Building ACH each

< 0.25 Room ACH each

< 0.50 Building ACH each

< 1.00 Building ACH

<

<<

<

0.50

0.25

0.50

1.00

Building ACH each

Room ACH each

Building ACH each

Building ACH

< Nodal Excitation

< Node 2: Generation Rate [=] kg/hr

< Node 7: Exterior C02 Concentration [=] kg C02/kg

< Kerosene Heater Turned Off at 133 minutes

< Node 2 : Generation Rate [=] kg/hr

< Node 7: Exterior C02 Concentration [=] kg C02/kg

9-21
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

<TXME=5

2 CG=0 . 0 < Node 2:

3 CG=0 .000760 < Node 3: <END

DYNAMIC

T=0, 4,0.5 < Initial

1 V=l. 2*1.0 < Node 1

:

2,3 V=1 .2*40 .

0

< Nodes 2

4,5 V=l. 2*30.0 < Nodes 4

6 V=1 .2*0 .

1

< Node 6

:

7 V=

< 1.2*1. 0E+09 < Node 7

:

1,7 IC=0. 000760 < Initial

END

RETURN

Generation Rate [=] kg/hr

Exterior C02 Concentration [=] kg C02/kg

Time, Final Time, Time Increment

Volumetric Mass [=] kg

& 3: Volumetric Mass [=] kg

& 5: Volumetric Mass [=3 kg

Volumetric Mass [=] kg

Exterior Volumetric Mass [=] kg

Concentration [=] kg C02/kg

It will be noticed that, in this case, system time constants were to be computed.

The results of the time constants analysis are listed below;

===== TIMECONS: TIME CONSTANTS - CONTAMINANT DISPERSAL SYSTEM

Convergence parameter, epsilon, ... 0.100E-15

== Element Mass Flow Rates

Elem Value Elem Value Elem Value Elem Value Elem

1 84.0 2 84.0 3 24.0 4 24.0 5

6

11

24.0

168.

7 84.0 8 84.0 9 84.0 10

== Net Total Mass Flow

»* *»» = independent DOFs 3 c

3 II undefined DOFs.

Node Value Node Value Node Value Node Value Node

1 .000 2 .000 3 .000 4 .000 5

6 .000 7* .000

== Nodal Volumetric Mass

"*" = independent DOFs "U" = undefined DOFs.

Node

1

6

Value Node

1.20 2

.120 7*

Value Node

48.0 3

0 . 120E+07

Value

48.0

Node

4

Value

36.0

Node

5

Nominal Time Constants

Node

1

6

Value Node

0 . 714E-02 2

0 . 714E-03 7

Value Node

. 444 3

0 .250E+05

Value

.444

Node

4

Value

.429

Node

5

== Actual Time Constants

Value

24.0

84.0

Value

.000

Value

36.0

Value

. 429

9-22
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

9. Example Problems

Num.

1

6

Value Num.

0 . 714E-03 2

3.73 7

Value

0 .714E-02

-0.852E+16

Num.

3

Value

.230

Num. Value

4 .429

Num.

5

Value

.444

Number of iterations used . .

.

11

9-23
.

.
NBS: Indoor Air Quality Model

Phase II Report

PARTII - CONTAM86 Users Manual

PART II References

PARTII References

[1] Wilson, E. L. & Hoit, M. I., "A Computer Adaptive Language for the

Development of Structural Analysis Programs," Computers & Structures, Vol.

19, No. 3, pp 321-338, 1984

[2] Eberlein, P.J. & Boothroyd, J., "Contribution 11/12: Solution to the

Eigenproblem by a Norm Reducing Jacobi Type Method," Handbook for

Automatic Computation: Volume II: Linear Algebra, Wilkinson, J.H. &

Reinsch,& Reinsch, C. - editors, Springer-Verlag, 1971

[3] Traynor, G.W., Allen, J.R., Apte, M.G., Girman, J.R., & Hollowell, C.D.,

"Pollution Emissions from Portable Kerosene-Fired Space Heaters",

Environmental Science & Technology, Vol. 17, June 1983, pp. 369-371

[4] Traynor, G.W., Apte, M.G., Carruthers, A.R., Dillworth, J.F., Grimsrud, D.T., &

Thompson, W.T., "Indoor Air Pollution and Inter-Room Pollutant Transport

Due to Unvented Kerosene-Fired Space Heaters,", Lawrence Berkeley

Laboratory - University of California, Applied Science Division, LBL-17600,

Feb., 1984

Ref II -

1
V
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

Appendix - FORTRAN 77 Source Code

The program CONTAM86 is listed below. In this listing you will note that compiler directives

to "include"code stored in separate "include

files" are used. These "include files" contain

common block data specifications that are shared by many subroutines. The contents of

these include files are listed on the last page of

this appendix.

cC—3.0 COMMAND PROCESSOR LOOP

C

c

C 3.1 CHECK BLANK COMMON STORAGE

C

30 NSTOR - (IDIR-NEXT-20) *IP (1) /IP (2) IF (NSTOR. LE .100) WRITE (NTH, 2300) NSTOR

2300 FORMAT

(

' **•* WARNING: Array etorage available -',19,' real nurrtoer a .

'

)

C

C 3.2 GET COMMAND LINE

C

PROGRAM CONTAM

-PRO : CONTAM - BUILDING CONTAMINANT DISPERSAL ANALYSIS PROGRAM VERSION FY86

Developed by JAMES AXLEY

Dept. of Architactura, Cornall University

Building Environment Division, NBS

Fall, 1986 Using;

A) GAL-SAP Library of subroutinas davalopad by ED WILSON,

U.C. BERKELEY

B) Microsoft FORTRAN V2.2 Corqpiler for Appla Macintosh

For Mac

1. Sat logical unit number*, in SUBROUTINE INITIO, as; NTR - 9 ; NTH - 9 ; NCMD - 9 2. INCLUDE stataraents usa <filanaraa> . INC (i.a., without ')

3. In SUBROUTINE PROMPT usa: WRITE (NTW, ' (A, \) * ) STRING

C) IBM PC Profassional FORTRAN (Ryan-McFarland)

1. Sat logical unit numbers, in SUBROUTINE INITIO, as; NTR - 5 ; NTW - 6 ; NCMD - 5 2. INCLUDE statements usa '<filaname>.INC' (i.a., with ')

3. In SUBROUTINE PROMPT usa: WRITE (NTW, ’ (A) ' ) STRING

Memory for dynamically allocated/definad arrays is located in vector IA (MTOT) in blank cottrnon . To increase or decrease this area altar the dimension of IA, in the section 0.0 below, sat

MTOT, in section 1.0 below, equal to this new dimension, and

reconcile the coda. As integers are 4 bytes wide, memory dedicated to IA(KTOT) is equal to tfTOT*4 bytes.

IMPLICIT REAL*8 (A-H,0-Z)

C—0.0 DATA SPECIFICATIONS 6 COMMON STORAGE

C

IF (MODE. EQ. ’INTER r

) CALL PROMPT ( ' CMND> '

)

CALL FREE

IF (MODE . EQ .' BATCH ' ) CALL FREEWR (NTW) C

C 3.3 INTERPRET COMMAND LINE

C

C GET COMMAND 6 ARRAY NAMES, IF ANY

C CALL FREEC (

' \NCMND,8,1)

CALL FREEC ('A', Ml (1), 4, 7) C

C INTRINSIC COMMANDS

C

IF ( (NNCMND.EQ. 'H') .OR. (NNCMND.EQ. ' HELP * ) ) THEN

IF (MODE. EQ. 'BATCH*) THEN WRITE (NTW, 2310) WRITE (NOT, 2310) CALL RETRN

ELSECALL HELP

END IF

ELSEIF (NNCMND.EQ. 'ECHO-ON') THEN

ECHO - .TRUE.

ELSEIF (NNCMND . EQ .' ECHO-OFF ' ) THEN

ECHO - .FALSE.

ELSEIF ( (NNCMND.EQ. *L') .OR. (NNCMND.EQ. 'LIST') ) THEN

IF ( MODE. EQ. 'BATCH' ) THEN WRITE (NTW, 2310) WRITE (NOT, 2310) CALL RETRN

ELSECALL LIST

END IF

ELSEIF ( (NNCMND.EQ. *P’) .OR. (NNCMND.EQ. 'PRINT' ) ) THEN

CALL PRINT

COMMON MTOT, NP,IA( 20000)

INCLUDE ARYCOM. INC INCLUDE IOCOM. INC INCLUDE CMDCOM. INC INCLUDE CNTCOM86 . INC

LOGICAL ERR

CC—1.0 INITIALIZE INTERNAL VARIABLES

C

ELSEIF ( (NNCMND.EQ. 'D') .OR. (NNCMND.EQ. 'DIAGRAM' ) ) THEN CALL DIACRM

ELSEIF (NNCMND.EQ. 'SUBMIT') THEN

IF (MODE . EQ .

’ BATCH ’ ) THEN

WRITE (NTW, 2310) WRITE (NOT, 2310) CALL RETRN

ELSECALL SUBMIT

ENDIF

MTOT - 20000 CALL INITAR (MTOT) CALL INITIO CALL INITCN

ERR - .FALSE.

ELSEIF (NNCMND.EQ. 'RETURN') THEN

IF ( MODE. EQ. 'INTER') THEN

WRITE (NTW, 2320) ELSECALL RETRN

END IF

CC—2.0 WRITE BANNER

C CALL BANNER (NTW) CALL BANNER (NOT) WRITE (NOT, 2200) (FNAME (1 : LFNAME) // ' . OUT'

)

2200 FORMAT ( / ' —— RESULTS OUTPUT FILE: ’

, (A)

)

ELSEIF ( (NNCMND.EQ. 'Q') .OR. (NNCMND.EQ. 'QUIT') ) THEN

STOP

CC CONTAM COMMANDS

C ELSEIF (NNCMND.EQ. 'FLOWSYS') THEN Append -1
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

CALL FLOSYS C INITCN SUBROUTINE INITCN ELSEIF (NNCMND . EQ . ' FLOWELEM * ) THEN C —SUBxINITCN - INITIALIZES CONTAM LABELED COMMON /CNTCOM/ CALL FLOELM

ELSEIF (NNCMND .. EQ . ’ STEADY ' ) THEN CALL STEADY

ELSEIF (NNCMND . EQ . ’ TIMECONS *

) THEN CALL TIMCON

ELSEIF (NNCMND . EQ . ’ FLOWDAT ’ ) THEN CALL FLODAT

ELSEIF (NNCMND . EQ . ’ EXCITDAT * ) THEN CALL EXCDAT

ELSEIF (NNCMND . EQ . ’ DYNAMIC * ) THEN CALL DYNAM

INCLUDE CNTCOM06 . INC

NFNOD - 0 NFEQN - 0 MFBAN - 0 NFELM - 0 MPV - 0 MPF - 0 MPC - 0 MPG - 0 MPKEQ - 0 EP - 1.0D-16 RETURN

END

ELSEIF (NNCWiD . EQ . ’ RESET * ) THEN CALL RESET

C BANNER SUBROUTINE BANNER (LUN) C—SUB' BANNER - WRITES PROGRAM BANNER TO LOGICAL UNIT LUN

ELSEWRITE (NTW, 2330)

IF ( MODE. EQ. ’BATCH’) THEN CALL RETRN

ENDIF

COMMON MTOT.NP, IA(1)

WRITE (LUN, 2000) MTOT

2000 FORMAT (//, 1X,78(1H-),/,

9

I

C 0 N T A M 8 6’ ,T79, '

|

Contaminant Diaparaal Analyaia for Building Syatama

’

ENDIF ..T79, '

| ,/,

GO TO 30 .

'

1 Varaion FY86 - Jim Axlay - Cornall t NBS',

T79, •

| ' ,/,lX.78UH-),/,6SX, ' OTOT: , 19) 2310 FORMAT (

’

**** ERROR: Command not dafinad in BATCH raoda . *

)

2320 FORMAT (

’

**** ERROR: Command not dafinad in INTERACTIVE raoda .

*

)

RETURN

2330 FORMAT (

’

END

**** ERROR: Command not dafinad •>

C

END —

c

SUBROUTINE INITAR (MTOT) C—SUB:INITAR - INITIALIZES DYNAMIC ARRAY MANAGER VARIABLES

C IN BLANK COMMON AND LABELED COMMON /ARYCOM/

-INITAR INTRINSIC COMMANDS

INCLUDE ARYCOM. INC

NUMA - 0 NEXT - 1 IDIR - MTOT

IP(1) - 4 IP (2) - 8 IP (3) - 1 RETURN

END

SUBROUTINE HELP C—SUB: HELP - PROVIDES ON-SCREEN HELP

CC—HELP LIST —

C

C .

’ HELP (H) Liat available commands .

’

,

c

SUBROUTINE INITIO C—SUB: INITIO - INITIALIZES LABELED COMMON /IOCOM/

C OPENS DEFAULT RESULTS OUTPUT FILE

INCLUDE IOCOM. INC LOGICAL FOUND

NTR - 9 NTW - 9 NCMD - 9 NIN - 10 NOT - 11 ND1 - 12 ND2 - 13 ND3 - 14 ND4 - 15 FNAME - ’CONTAM’ LFNAME - 6 EXT - ’ CALL NOPEN (NOT, (FNAME (1 : LFNAME) // ’ .OUT’) , ’FORMATTED’) MODE - ’INTER’ ECHO - .TRUE. RETURN

END

-INITIO

INCLUDE IOCOM. INC

WRITE (NTW, 2000) PAUSE ' — Entar <CR> to continua. WRITE (NTW, 2010) PAUSE * — Entar <CR> to continua. WRITE (NTW, 2020) PAUSE ’ — Entar <CR> to continua. WRITE (NTW, 2030) PAUSE * — Entar <CR> to continua. WRITE (NTW, 2040)

HELP LISTS — INTRINSIC COMMANDS’,//,

Liat avai labia comman da .

' , /, Echo raaulta to acraan. ',/, Do not acho raaulta to acraan.*,/,

Liat tha diractory of all arraya.’,/, A»<array> Print array naraad <array>.',/, DIAGRAM (D) A-<array> Diagram array naraad Ml.',/, SUBMIT F-<filanama> Raad comnan da from batch <filanama> .

' , /, RETURN Laat command in batch <filanama> . ’ , /, QUIT (Q) Quit program.’/)

2000 FORMAT (/,*

.’ HELP (H)

.* ECHO-ON

. ’ ECHO-OFF

.* LIST (L)

.

’ PRINT (P)

2010 FORMAT ( /

,

CONTAM COMMANDS’,//, Append -2
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

FLOWSYS N-nl Flowsystere control variables.',,/, IL - 5 n2 , n3, n4 BC-cl nl - number of flow nodes',/. C n2,n3,n4 - node: first. last. incr .

'

,/, IC - IDIR

END cl - boundary conditioni ; G or c\//. DO 100 • 1-1 , NUMA

FLOWELEM Flow element cortreand/data group.’,/, IL - IL -f 1 nl I-n2,n3 E-n4 nl - element number',/. ILOC - 1 n2,n3 - element end nodes',/. 1ST - 0 END n4 - filter efficiency' .//. LA 6 - IAIIC+6) STEADY Steady state solution.'. /, LA7 - IA ( IC+7 > nl, n2, n3 W-n4 nl,n2,n3 - elere: first. last, incr .

'

IA9 - IA(IC+9>

n4 - element flow rate' C CHECK FOR LOCATION AND

n5, n6, n7 CG—n8 n5,n6,n7 - node: first. last. incr .

'

,/

,

IFUA9.CT.0) ILOC-2

n8 - prescribed cone, or gen. rate '

,

/, IF ( IA7 . LT . 0 ) ILOC-2

END’) IF (IA7 .EQ.—1) IST-1 ORMAT ( /

,

IF (IA7 .EQ.-2) 1ST—

2

TIMECONS E-nl Time constant solution. nl - epsilon' ,/

,

IF (IA9 .CT. 0) 1ST3

n2, n3, n4 W—n5 n2,n3,n4 - elera: first. last. incr .

'

IPN - IC - 1

. .

.

n5 - element flow rate' ,/

,

DO 10 J-l, 4

: ',/, IPN - IPN « 1 n6, n7, n8 V-n9 n6,n7,n8 - node: first. last. incr .

'

10 NAM(J) - CHAR (IA (IPN)

)

END*) FORMAT (/, FLOWDAT [T-nl,n2,n3] TIME-nl

nl, r*2, n3 W-n4

END ' , //, EXCITDAT [T-nl,n2,n3] TIME-nl nl,n2,n3 CG-n4

:',/, END*) FORMAT (/, DYNAMIC T-nl,n2,n3 [A-n4] [PI« n7,n8,n9 V-nlO

n9 - nodal volumetric mass',/.

Generate element flow time histories.',/,

nl - time',/, nl,n2,n3 - elera: first, last, incr.',/,

n4 - element mass flow rate.',/.

Generate excitation time histories. ',/, nl - tiros',/, nl,n2,n3 - node: first, last, incr.',/,

n4 - excitation: cone, or gen. rate.',/.

n7,n8,n9 IC-nll

END ',//, RESET

Dynamic solution.',/,

n5] [PS-n6] ' , /, nl,n2,n3 - init, final, incr ; n4 -alpha',/,

n5 - print interval; n6 - plot scale',/, n7,n8,n9 - node: first, last, incr.',/, nlO - nodal volumetric mass',/,

nil - initial nodal concentration',/.

Reset CONTAM for new problem. '

)

—WRITE DATA TO TERMINAL

IF (IST.EQ. 0) WRITE (NTW, 1100) (NAM< J) , J-l, 4)

,

* IA(IC+4),IA(IC+5), (TYPE (K, IA6) , K-l, 9)

,

* (LOC (L, ILOC ) , L-l, 4)

IF (1ST. EQ. 1) WRITE (NTW, 1100) (NAM ( J) , J-l , 4 )

,

* IA(IC+4) , IA(IC+5) , (TYPE (K, IA6) , K-l, 9)

,

* (LOC (L, ILOC) , L-l, 4 ) , (STOR (M, 1) , M-l, 13)

IF (1ST. EQ. 2) WRITE (NTW, 1300) (NAM ( J) , J-l , 4 )

,

* IA(IC+4) , (LOC (L, ILOC) , L-l, 4) , (STOR (M, 2) , M-l, 13)

IF (IST.EQ. 3) WRITE (NTW, 1200) (NAM ( J) , J-l, 4 )

,

* IA(IC+4) , IA(IC+5) , IA(IC+6) , (LOC (L, ILOC) , L-l, 4 )

,

* (STOR (M, 2) , M-l, 13)

IC - IC + 10 —CHECK FOR NUMBER OF LINES PRINTED

IF (IL.LT. 20) CO TO 100 IF(I.EQ.NUMA) CO TO 100 CALL PROMPT (* ** Do you want more ? (Y/N) ') READ (NTR, 2200)

IF ( (CHK.EQ. 'n' ) .OR. (CHK.EQ. *N' ) ) GOTO 900 IL - 0 WRITE (NTW, 2000) 100 CONTINUE

900 RETURN

SUBROUTINE LIST C—SUB -.LIST - LIST DIRECTORY OF ALL ARRAYS IN BLANK COMMON

CC—HELP LIST

C

C .' LIST (L) List the directory of all arrays.',/,

CCOMMON MTOT,NP,IA(l)

INCLUDE ARYCOM. INC INCLUDE IOCOM. INC

1000 FORMAT (* — LIST: ARRAY LIST',//,

* ' Name', 2X, 'Number *,2X, 'Number ’ , 5X, 'Data', 5X,

* ’ Location * , 5X, ' Storage ' , /, 8X, ’ Rows ' , 2X,

* 'Columns ', 5X, 'Type *, 19X, 'Type ’, /) 1100 FORMAT (IX, 4A1, 2X, 14, 4X, 14, 5X, 9A1, 4X, 4A1, 4X, 13A1) 1200 FORMAT (IX, 4 Al, ' NI-’,I4,’ NR-', 14,' NC- ’ , 14 , 5X, 4A1, 4X, 13A1

)

1300 FORMAT (IX, 4 A1,3X, 'RECORD LENGTH - ’ , 16, 7X, 4A1, 4X, 13A1) 2000 FORMAT () 2200 FORMAT (1A1) END

PRINT CHARACTER*! NAM (4 ), LOC (4, 2) , TYPE (9, 3) , STOR (13, 2) CHARACTER*1 CHK

C DATA TYPE/ * I '

,

1 ’R\

2 •c\

C DATA LOC/'C’, '0', 'R', 'E', 'D', 'I', 'S', 'K'/

C DATA STOR/’S', 'E', 'Q', *U', 'E', 'N', 'T', 'I', *A', 'L', ’ ',' ',’ ',

1 *D’, 'I', 'R', 'E', 'C', 'T', ' ', 'A', 'C', 'C*, ’E', 'S', 'S*/

C

C LIST DIRECTORY OF ALL ARRAYS IN DATA BASE IF(NUMA.EQ.O) GO TO 900

C

C WRITE HEADER FOR SCREEN LISTING OF FILE DATA

WRITE (NTW, 1000)

C

C START COUNT OF LINES TO SCREEN

SUBROUTINE PRINT C—SUB: PRINT - COMMAND TO "PRINT" ARRAY TO RESULTS OUTPUT FILE

CC—HELP LIST

C

C .' PRINT (P) A-<array> Print array named <array>.',/,

C

COMMON MTOT.NP, IA(1) INCLUDE ARYCOM. INC INCLUDE IOCOM. INC INCLUDE CMDCOM. INC

C PRINT OF REAL OR INTEGER ARRAY CALL PROMH(l)

C LOCATE MATRIX TO BE PRINTED

IF (ECHO) WRITE (NTW, 2000) Ml WRITE (NOT, 2000) Ml Append -3
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

CALL LOCATE (Ml, NA, NR, NC) IF (NA. EQ . 0) THEN WRITE (NTH, 2010) Ml WRITE (NOT, 2010) Ml CALL ABORT

RETURN ELSEIF (NAoLT.0) THEN

WRITE (NTW, 2020) Ml WRITE (NOT, 2020) Ml CALL ABORT

RETURN

ELSE

IF (NP .EQ. 1) CALL IPRT (IA (NA) , NR, NC) IF (NP . EQ. 2) CALL RPRT ( IA (NA) , NR, NC) ENDIF

RETURN

C 2000 FORMAT (/'- print OF ARRAY " ' , 4A1, 8 " 8 ) 2010 FORMAT (

’

**** ERROR: Array *•' , 4A1, ' " does not exist

2020 FORMAT

(

8 **** ERROR: Array *\4A1, ' " is out of cor®

END

C SUBROUTINE IPRT (N, NR, NC) C—SUB: IPRT - PRINTS INTEGER ARRAY TO RESULTS OUTPUT FILE

DIMENSION N (NR, NC)

INCLUDE IOCOM. INC

NUMC - 14 DO 100 1*1 , NC, NUMC

IN - I NUMC - 1 IF (IN.GT.NC) IN - NC WRITE (NOT, 2000) (K, K-I, IN) IF (ECHO) WRITE (NTW, 2000) (K, K-I, IN) DO 100 J-l, NR

WRITE (NOT, 2001) J, (N ( J, K) , K-I, IN) IF (ECHO) WRITE (NTW, 2001) J, (N ( J, K) , K-I, IN) 100 CONTINUE

C RETURN

2000 FORMAT ( /* COL# -’,1415)

2001 FORMAT (* ROW 8 , 14 , 1415) END

C SUBROUTINE RPRT (A, NR, NC) C—SUB: RPRT - PRINTS REAL ARRAY TO RESULTS OUTPUT FILE

IMPLICIT REAL*8 (A-H,0-Z) DIMENSION A (NR, NC)

INCLUDE IOCOM. INC

XMAX - 0.00

DO 50 1-1, NR

DO 50 J—1, NC

XX - DABS (A (I, J) ) IF (XX. CT. XMAX) XMAX - XX

50 CONTINUE

M - 1 IF (XMAX. LT. 99999.) M - 2 IF (XMAX. LT. 0.1000) M - 1 IF (XMAX. EQ. 0.0) M - 2 C NUMC - 6 DO 100 I - 1 , NC , NUMC

IN - I NUMC - 1 IF (IN.GT.NC) IN - NC WRITE (NOT, 2000) (K, K-I, IN) IF (ECHO) WRITE (NTW, 2000) (K, K-I, IN) DO 100 J—1, NR

IF(M.EQ.l) THEN WRITE (NOT, 2001) J, (A ( J, K) , K-I, IN) IF (ECHO) WRITE (NTW, 2001) J, (A ( J, K) , K-I, IN) ELSEIF (M.EQ. 2) THEN

WRITE (NOT, 2002) J, (A ( J, K) , K-I, IN) IF (ECHO) WRITE (NTW, 2002) J, (A( J, K) , K-I, IN) ENDIF

100 CONTINUE

C RETURN

2000 FORMAT ( /

* COL# -’,6112)

2001 FORMAT (' ROW°,I4 , 6E12 . 5) 2002 FORMAT (’ ROW’ , 14 , 6F12 . 5) END

SUBROUTINE DIAGRM

C—SUB; DIAGRM - COMMAND TO "DIAGRAM" ARRAY TO RESULTS OUTPUT FILE

CC—HELP LIST

CC . ' DIAGRAM (D) A-<array> Diagram array named Ml.',/, C~

COMMON KTOT, NP, IA (1)

INCLUDE IOCOM. INC IPRT INCLUDE CMDCOM.INC

C PRINT OF REAL OR INTEGER ARRAY CALL PROMH(l)

C LOCATE MATRIX TO BE PRINTED

IF (ECHO) WRITE (NTW, 2000) Ml WRITE (NOT, 2000) Ml CALL LOCATE (Ml, NA, NR, NC) IF (NA.EQ.O) THEN WRITE (NTW, 2010) Ml WRITE (NOT, 2010) Ml CALL ABORT

RETURN

ELSEIF (NA.LT.O) THEN WRITE (NTW, 2020) Ml WRITE (NOT, 2020) Ml CALL ABORT

RETURN

ELSE

IF (NP.EQ.l) CALL IDIAGR(IA(NA) ,NR,NC)

IF (NP .EQ. 2) CALL RDIAGR (IA (NA) , NR, NC) ENDIF

RETURN

C RPRT 2000 FORMAT (/ 8 DIAGRAM OF ARRAY "\4A1, 8 " 8 ) 2010 FORMAT r **** ERROR; Array " 8 ,4A1, 8 " does not exist. 8 ). 2020 FORMAT (

8 **** ERROR; Array "\4A1,’" is out of cor®.’) END

c IDIAGR SUBROUTINE IDIAGR (N, NR, NC) C—SUB: IDIAGR - "DIAGRAMS" INTEGER ARRAY TO RESULTS OUTPUT FILE

INTEGER N (NR, NC) CHARACTER*! ICON (36)

INCLUDE IOCOM. INC

C DIAGRAM INTEGER ARRAY

NUMC - 36 DO 200 1-1, NC, NUMC

IN - I NUMC - 1 IF (IN.GT.NC) IN - NC WRITE (NOT, 2000) (INT(K/10) , K-I, IN) WRITE (NOT, 2010) ( (K-INT(K/10) *10) , K-I, IN) IF (ECHO) WRITE (NTW, 2000) (INT (K/10) , K-I, IN) IF (ECHO) WRITE (NTW, 2010) ( (K-INT (K/10) *10) , K-I, IN) DO 200 J-l, NR

DO 100 K-I, IN ICON (K) - '*’ IF (N ( J, K) . EQ. 0) ICON (K) - ’ 8 100 CONTINUE

WRITE (NOT, 2020) J, (ICON (K) , K-I , IN) IF (ECHO) WRITE (NTW, 2020) J, (ICON (K) , K-I, IN) 200 CONTINUE

C Append -4
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

RETURN

2000 FORMAT ( /* COL# -’ , 36 (IX, II)

)

2010 FORMAT (7X,36(1X,I1))

2020 FORMAT (* ROW’, 13, 36 (IX, Al)

)

END

C RDIACR SUBROUTINE RDIACR (A, NR, NC) C—SUB: RDIACR - "DIAGRAMS* REAL ARRAY TO RESULTS OUTPUT FILE

O—

——RETRN SUBROUTINE RETRN

C—SUB : RETRN - RETURNS TO INTERACTIVE MODE

CC—HELP LIST

C

C RETURN Last cotwnand in batch <filanams> . ’ , /, C

INCLUDE IOCOM. INC

REAL*0 A (NR, NC) CHARACTER* 1 ICON (36)

INCLUDE IOCOM. INC

C DIAGRAM INTEGER ARRAY

NUMC - 36 DO 200 1*1, NC, NUMC

IN - I NUMC - 1 IF (IN .CT.NC) IN - NC WRITE (NOT, 2000) (INT (K/10) , K-I, IN) WRITE (NOT, 2010) ( (K-INT(K/10) *10) , K-I, IN) IF (ECHO) WRITE (NTW, 2000) (INT (K/10) , K-I, IN) IF (ECHO) WRITE (NTW, 2010) ( (K-INT (K/10) *10) , K-I, IN) DO 200 J—1, NR

DO 100 K-I, IN ICON (K) - ’*’ IF(A(J,K) .EQ.0.0D0) ICON(K) - ’ * 100 CONTINUE WRITE (NOT, 2020) J, (ICON (K) , K-I, IN) IF (ECHO) WRITE (NTW, 2020) J, (ICON (K) , K-I, IN) 200 CONTINUE

C RETURN

CLOSE (NCMD) CLOSE (NOT) FNAME - * CONTAM 1 LFNAME - 6 OPEN (NOT, FILE- (FNAME (1 : LFNAME) // ’ .OUT') , STATUS- * OLD ’

,

+ FORM- ’ FORMATTED ’

)

REWIND NOT

10 READ (NOT, *, END-20) GO TO 10 20 BACKSPACE (NOT) NCMD - NTR

MODE - 'INTER'

WRITE (NTW, 2010) WRITE (NOT, 2010) 2010 FORMAT ( ’ **** CONTAM raturnad to INTERACTIVE raoda .

’

)

RETURN

END

C C C C C CONTAMCOMMANDS C C C C C 2000 FORMAT (/’ COL# - ’ , 36 (IX, II)

)

2010 FORMAT (7X, 36 (IX, II)

)

2020 FORMAT (* ROW’ , 13, 36 (IX, Al)

)

END

C———————————————————————-—SUBMIT

SUBROUTINE SUBMIT C—SUB: SUBMIT - SWITCHES TO BATCH MODE AND OPENS BATCH COMMAND FILE

C

C—HELP LIST

C

C .

’ SUBMIT F-<filanaraa> Raad commands from batch <filanaraa> .

’ , /, C

INCLUDE IOCOM. INC LOGICAL FOUND

SUBROUTINE FLOSYS

C—SUB: FLOSYS - COMMAND TO READ 6 PROCESS FLOW SYSTEM CONTROL VARIABLES

C ESTABLISHES FLOW SYSTEM EQUATION NUMBERS 4 B.C. CC—HELP LIST

C FLOWSYS N-nl n2,n3,n4 BC-cl

n2,n3,n4 V-n5

END’,//,

Flowsystare control variablas .

’ , /, nl - nurabar of flow nodas’,/, n2,n3,n4 - noda: first, last, incr.’,/,

cl - boundary condition; G or C’,/,

n5 - nodal voluraatric mass’,/.

CALL FREEC(’F\ FNAME, 12,1) INQUIRE (FILE-FNAME (1 :LENTRM (FNAME) ), EXI ST-FOUND)

IF (FOUND) THEN

MODE - ’BATCH’ NCMD - NIN

LFNAME - LENTRM( FNAME) WRITE (NTW, 2010) FNAME WRITE (NOT, 2010) FNAME

2010 FORMAT (* **** CONTAM sat to BATCH mods using fila: \A)

OPEN (NCMD, FILE-FNAME (1 : LFNAME) , STATUS- ’OLD ’

)

REWIND NCMD CLOSE (NOT) CALL NOPEN (NOT, (FNAME (1 : LFNAME) // * .OUT’) , ’FORMATTED’) CALL BANNER (NOT) WRITE (NOT, 2020) (FNAME (1 : LFNAME) //’ .OUT’

)

2020 FORMAT ( / ’ —— RESULTS OUTPUT FILE: ’ , (A)

)

ELSEWRITE (NTW, 2030) 2030 FORMAT (’ — NOTE: Submit fila not found.’) CALL ABORT

ENDIF

RETURN

END

COMMON MTOT, NP, IA(1)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC

LOGICAL ERR INTEGER I JK (3) EXTERNAL BCDAT0

ERR - .FALSE.

Cc—1.0 READ NUMBER OF FLOW SYSTEM NODES

C CALL FREEI ( ’N’ , NFNOD, 1)

IF (NFNOD . LE . 0) THEN

WRITE (NTW, 2100) WRITE (NOT, 2100) ERR - . TRUE

.

CO TO 400 ENDIF

2100 FORMAT (’ *** ERROR: Nurabar of flow systare nodas must ba graatar’,

+ ’ than 0. ’

)

IF ( MODE. EQ. ’INTER’) THEN WRITE (NTW, 2110) WRITE (NTW, 2120) NFNOD Append -5
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

WRITE (NTH, 2130) END IF

C—HELP LIST

C Flow element conroand/data group.',/,

nl «*> •Icmtnt number' , /, n2,n3 - element and nodes',/,

n4 » filter eff iciency ' , //, C

C .

* FLOWELEM

C .

• nl I-n2,n3 E-n4

C . * ... C .'END

WRITE (NOT, 2110) WRITE (NOT, 2120) NFNOD WRITE (NOT, 2130) 2110 FORMAT (/,' TM- FLOWSYS: FLOW SYSTEM CONTROL VARIABLES’)

2120 FORMAT (/ + ’ Number of flow system nodes ......',15) 2130 FORMAT (/, ' — Node Boundary Conditions')

NFEQN - NFNOD

CC—2.0 DEFINE KEQ ARRAY AND NUMBER EQUATIONS IN NODE ORDER

C CALL DELETE (' KEQ ') CALL DEFINI( 'KEQ ', MPKEQ, NFNOD, 1) NN - 0 DO 20 N-MPKEQ, MPKEQ+NFNOD1

NN - NN+1

20 IA (N) - NN

C

C—3.0 PROCESS BOUNDARY CONDITION DATA

C CALL DATGEN (BCDAT0, 0, ERR)

CC—4.0 REPORT BC IF NO ERROR ENCOUNTERED, ELSE ABORT

C 400 IF (ERR) THEN CALL DELETE ('KEQ ') MPKEQ - 0 ERR - .FALSE. CALL ABORT

ELSE

IF (ECHO) WRITE (NTW, 2400) WRITE (NOT, 2400)

IF (ECHO) WRITE (NTW, 2410) ( (N) , IA (N+MPKEQ-1 ) , N-l , NFNOD) WRITE (NOT, 2410) ( (N) , IA (N+MPKEQ-1) , N-l, NFNOD) ENDIF

RETURN

2400 FORMAT (/,

. 6X, 'Negative Eqtn-# - concentration-prescribed boundary.',/,

. 6X, 'Positive Eqtn-# - generation-prescribed boundary.',//,

. 4X, 5

(

' Node Eqtn '

, 2X)

)

2410 FORMAT ( (4X, 5 ( 16, IX, 16, 2 X) )

)

END

c BCDAT0 SUBROUTINE BCDAT0 (N, ERR) C—SUB:BCDAT0 - READS FLOW B.C. DATA

C COMMON MTOT,NP, IA(1)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC LOGICAL ERR

CHARACTER BC*1

CALL FREEC ( *C ' , BC, 1, 1) IF((BC.NE.'C') .AND. (BC.NE.’C)) THEN WRITE (NTW, 2000) BC WRITE (NOT, 2000) BC ERR - .TRUE. RETURN

ELSEIF (BC.EQ. 'CM THEN

LA (N+MPKEQ-1) - -IA (N+MPKEQ-1) ENDIF RETURN

COMMON MTOT,NP,IA(l)

INCLUDE IOCOM. INC INCLUDE CNTCOM86. INC

REAL*8 EFF LOGICAL ERR EXTERNAL FLOWEO

ERR - .FALSE. WRITE (NOT, 2000) WRITE (NTW, 2000) 2000 FORMAT (/, ' «— FLOWELEM: FLOW ELEMENTS')

C

C—1.0 CHECK TO SEE IF SYSTEM NODES 4 EQUATION NUMBERS ARE DEFINED

C

IF (NFNOD oEQ.0) THEN WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT

(

+ » **»<> ERROR: Number of flow system nodes - 0.',/,

+ ' FLOWSYS conmand roust be executed.') CALL ABORT

RETURN

ENDIF C

C—2 . 0 OPEN <filenarae> . FEL

C

IF (NFELM.EQ.0)

+ CALL NOPEN(NDl, (FNAME(liLFNAME) //' . FEL'), 'UNFORMATTED')

IF (NFELM.CToO) THEN

WRITE (NTW, 2200) WRITE (NOT, 2200) CALL ABORT

RETURN

ENDIF 2200 FORMAT ( '   ERROR: Flow elements have already been defined.')

CC—3.0 GET ELEMENT DATA

C NELDOF - 2 CALL ELGEN (FLOWEO, IA (MPKEQ) , NELDOF , NFNOD , MFBAN, ERR)

C IF ERR ABORT COMMAND

30 IF (ERR) THEN NFELM - 0 CALL ABORT

CLOSE (ND1) RETURN

END IF C

C—4.0 REPORT ELEMENT DATA

C REWIND (ND1) WRITE (NOT, 2400)

IF (ECHO) WRITE (NTW, 2400) 2400 FORMAT (/,' Elem I-Node J-Node Filter Efficency') DO 40 N-l, NFELM

READ (ND1) LM1, LM2, EFF

IF (ECHO) WRITE (NTW, 2410) N, LM1, LM2 , EFF

40 WRITE (NOT, 2410) N, LM1, LM2 , EFF 2410 FORMAT (3 (5X, 15) , 5X, G10.3)

C

C—5.0 CLOSE ELEMENT DATA FILE

C

2000 FORMATC ** *• ERROR: Boundary condition ',A1,* not available.')

END

CLOSE (ND1) RETURN

END

SUBROUTINE FLOELM

C—SUB : FLOELM - COMMAND TO READ 4 PROCESS FLOW ELEMENT DATA

C

SUBROUTINE FLOWEO (NEL, LM, ERR)

C —SUB: FLOWEO - READS ADDITIONAL ELEMENT DATA

C WRITES FLOW ELEMENT DATA TO LOGICAL UNIT ND1 Append -6
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC

REAL'S EFF INTEGER LM(2),NEL

LOGICAL ERR

CC—1.0 GET FILTER EFFICIENCY

C EFF - 0.0 CALL FREER (’E\ EFF, 1) IF (EFF.LT.0.0D0) THEN WRITE (NTH, 2100) WRITE (NOT, 2100) 2100 FORMAT

(

« *•** ERROR: Filtar afficiancias must ba graatar than 0. ERR - .TRUE. RETURN

ENDIF

C

C —2 . 0 WRITE ELEMENT INFORMATION TO ND1 - <filanara* . FEL>

C WRITE (ND1) LM(1) , LM(2), EFF NFELM - NEL

C—2.0 DEFINE AND INITIALIZE ARRAYS

CALL DELETE (’WE CALL DELETE (’C CALL DELETE (’F CALL DEFINR (

'

F

CALL DEFINR (’C CALL DEFINR (’WE CALL ZEROR (LA (MPC) , NFEQN, 1) CALL ZEROR ( IA ( MPWE ), NFELM, 1)

')

*)

*>

’ , MPF, NFEQN, 2*MFBAN-1

)

’, MPC, NFEQN, 1) MPWE, NFELM, 1)

C —3.0 GET ELEMENT FLOW RATES (WE) C CALL READWE (ERR) IF (ERR) THEN CALL ABORT

RETURN

ENDIF

CC—4.0 FORM (F) C ALLOW "END" BEFORE EXCITATION DATA TO JUST FORM COMPACT [ C OPEN (ND1, FILE- (FNAME (1 : LFNAME) //' .FEL’ ) , STATUS-’ OLD ’

,

FORM- ’ UNFORMATTED ’

)

REWIND ND1

RETURN

END

SUBROUTINE STEADY

C—SUB : STEADY - COMMAND TO FORM STEADY PROBLEM [F] (C) - (G) 6 SOLVE

C SOLUTION (C) IS WRITTEN OVER (G) C -HELP LISTc .

’ STEADY Staady stata solution.*,/. C

c .

’ nl,n2,n3 W-n4 nl,n2,n3 - alare: first, last. incr .

* , /, c

c n4 - alamant flow rata',/.

c .' n5, n6, n7 CG-n8 n5,n6,n7 - noda: first, last. incr .

* , /, c n8 praseribad cone, or gan. rata ' , /, c END’,//,

CALL FORMF (IA (MPKEQ) , IA (MPF) , IA(MPWE) , ’BAND’ , ERR) IF (ERR) THEN CALL ABORT

RETURN

ENDIF

CLOSE (ND1) CALL FREECC * , ENDFLAC, 3, 1) IF (ENDFLAG . EQ .

’ END * ) RETURN

-5.0 FORM (G)

CALL FORMC (ERR) IF (ERR) THEN

CALL ABORT

RETURN

ENDIF

IMPLICIT REAL*8 (A-H, O-Z) COMMON MTOT, NP, IA (1) C—6.0 MODIFY (C) AND (F) FOR PRESCRIBED CONCENTRATIONS

C CALL MODIF (IA (MPKEQ) , IA (MPF) , IA (MPC) ,NFNOD, NFEQN, MFBAN) INCLUDE IOCOM. INC INCLUDE CMDCOM. INC INCLUDE CNTCOM8 6 . INC

C

C—7.0 SOLVE

C

LOGICAL ERR

CHARACTER ENDFLAG*3

ERR - .FALSE.

WRITE (NOT, 2000) WRITE (NTH, 2000) 2000 FORMAT (/, ' —- STEADY: STEADY STATE SOLUTION’)

CC—1.0 CHECK IF FLOW SYSTEM AND ELEMENT DATA ARE DEFINED

C

CALL FACTCA (IA (MPF) , NFEQN, MFBAN, ERR)

IF (ERR) THEN CALL ABORT

RETURN

ENDIF CALL SOLVCA (IA( MPF ) ,IA( MPC) , NFEQN, MFBAN, ERR)

IF (ERR) THEN

CALL ABORT

RETURN

ENDIF

C

C —8 . 0 REPORT SOLUTION

C IF (NFEQN. EQ.O) THEN

WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT

(

’ •*** ERROR: Nurebar of flow systarn DOF* - 0.’,/,

+ ' FLOWSYS command must b» axacutad.') RETURN

ELSEIF (NFELM. EQ.O) THEN

WRITE (NTW, 2110) WRITE (NOT, 2110) 2110 FORMAT

(

+ * *«•* ERROR: Nurnbar of flow flow alarasnts - 0.’,/,

+ * FLOWELEM command must ba axacutad.’) RETURN

ENDIF

IF (ECHO) WRITE (NTW, 2800) WRITE (NOT, 2800) 2800 FORMAT (/, ' — Rasponsa: Noda Concentrations '

)

CALL REPRTN (IA(MPG) , IA(MPKEQ) , NFEQN, NFNOD)

C

C—9 . 0 DELETE ARRAYS

C CALL DELETE (’WE ’) CALL DELETE (*G ’) CALL DELETE (’F ’)

RETURN

END

C SUBROUTINE READWE (ERR)

F)

READWE

Append -7
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

C —SUB: README - READS i REPORTS ELEMENT TOTAL MASS FLOW RATE DATA

C COMMON MTOT,NP, IA(1)

CALL CDAT1 (IA(MPC) , IA(MPKEQ) , NFEQN, NFNOD. MFBAN, N, ERR)

RETURN INCLUDE IOCOM.INC

INCLUDE CNTCOM8 6 . INC

END

LOGICAL ERR c GDAT1 SUBROUTINE GDAT1 (G, KEQ, NFEQN, NFNOD, MFBAN, N, ERR) EXTERNAL WEDATO C—SUB. CDATI - READS CONTAMINANT EXCITATION DATA

c WRITE (NTW, 2000) WRITE (NOT, 2000)

COMMON MTOT.NP, IA(1)

2000 FORMAT!/, ' " El.ra.nt Mo*» Flow Rata. ’

)

CALL DATCEN (WEDATO, NFELM, ERR)

INCLUDE IOCOM.INC

IF (ERR) RETURN REAL'S G (NFEQN), CDAT, CDAT

INTEGER KEQ (NFNOD) CALL REPRTE (IA(MPWE) , NFELM) LOGICAL ERR

RETURN CALL FREER <’C’,CDAT,1>

END NEQ - KEQ(N)

c WEDATO

NNEQ - ABS (NEQ)

SUBROUTINE WEDATO (N, ERR) IF (NEQ.NE.O) THEN C—SUB: WEDATO - CALLS WEDATI PASSING ARRAYS G (NNEQ) - CDAT

C ELSE COMMON MTOT,NP, IA(1) WRITE (NTW, 2000) N WRITE (NOT, 2000) N INCLUDE CNTCOM86 . INC 2000 FORMAT (’ **•* ERROR: Node *,I5,’ is not a defined flow node.’) ERR - .TRUE. LOGICAL ERR RETURN

CALL WEDAT1 (IA(MPWE) , NFELM, N)

END IF

RETURN

RETURN

END

END

C MODIF

C WEDATI SUBROUTINE MODIF (KEQ, F,C, NFNOD, NFEQN, MFBAN) SUBROUTINE WEDAT1 (WE, NFELM, N) C—SUB: WEDATO - READS ELEMENT MASS FLOW RATE DATA C—SUB: MOD IP - MODIFIES (F) AND (C) FOR C-PRESCRIBED DOFS

C REAL*8 F (NFEQN, 2 •MFBAN-1) ,C (NFEQN) REAL*8 WE (NFELM) INTEGER KEQ (NFNOD)

CALL FREER! ’W’ , WE (N) , 1) DO 10 N-l, NFNOD NEQ - KEQ (N) RETURN NNEQ - ABS (NEQ) END IF (NEQ.LT. 0) THEN

F (NNEQ, MFBAN) - F (NNEQ, MFBAN) *1 . 0D1

5

C FORMG G (NNEQ) - G (NNEQ) *F (NNEQ, MFBAN) SUBROUTINE FORMG (ERR) END IF

C —SUB: FORMS - READS l REPORTS NODAL CONTAMINANT GENERATION RATE DATA 10 CONTINUE

RETURN COMMON MTOT,NP,IA(l) END

INCLUDE IOCOM.INC

INCLUDE CNTCOM86 . INC SUBROUTINE TIMCON C—SUB:TIMCON - COMMAND TO FORM CONTAM. DISPERSAL EIGENVALUE PROBLEM LOGICAL ERR C EXTERNAL CDATO C [ [V]-l [F] - (1/T) [I] (E) - (0) c WRITE (NOT, 2100) C WHERE: (V) - FLOW VOLUMETRIC MASS MATRIX (DIAGONAL) WRITE (NTW, 2100) C [F] - FLOW SYSTEM FLOW MATRIX

2100 FORMAT (/, C (E) - (RIGHT) EIGENVECTORS

+ ' — Excitation: Contaminant Concentration or Generation’) C T CONTAM. DISPERSAL TIME CONSTANTS

c CALL DATCEN (CDATO, NFNOD. ERR) C TO EVALUATE TIME CONSTANTS. EIGENVECTORS ARE NOT FOUND. C—HELP LIST CALL REPRTN (IA(MPC) , IA(MPKEQ) , NFEQN, NFNOD) C

C .’ TIMECONS E-nl Time constant solution, nl - epsilon’,/. RETURN

END

C .’ n2,n3,n4 W-n5 n2,n3,n4 - elem: first, last, incr.’,/.

C .’ ... n5 « element flow rate’,/.

c CDATO

C .’ END’)

SUBROUTINE CDATO (N, ERR) C—SUB: CDATO - CALLS CDAT1 PASSING ARRAYS

C —

C IMPLICIT REAL* 8 (A-H, 0— Z) COMMON MTOT,NP, IA(1) COMMON MTOT,NP, IA(1)

INCLUDE CNTCOM86 . INC INCLUDE IOCOM.INC

LOGICAL ERR

INCLUDE CNTCOM8 6 . INC

Append -8
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

LOGICAL ERR WRITE (NOT, 2500) CHARACTER ENDFLAG*3 2500 FORMAT (/, * — Nominal Tirt» Conatanta’)

ERR - .FALSE.

CC—0.0 WRITE HEADER AND READ PRECISION

C WRITE (NOT, 2000) WRITE (NTW, 2000) 2000 FORMAT (/, + ’ —— TIMECONS: TIME CONSTANTS - CONTAMINANT DISPERSAL SYSTEM

EP1 - EP CALL FREER (’E\EP1,1)

WRITE (NOT, 2010) EP1 WRITE (NTW, 2010) EP1 2010 FORMAT(/' Convarganca paxaraatar, apailon, . ..*, G10.3)

C

C —1.0 CHECK IF FLOW SYSTEM AND ELEMENT DATA ARE DEFINED

C IF (NFEQN . EQ . 0) THEN

WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT

(

+ » ERROR: Nurabar of flow ayatara DOFa - 0.*,/,

+ ’ FLOWSYS command rnuat ba axacuted. '

)

RETURN

ELSEIF (NFELM.EQ.0) THEN WRITE (NTW, 2110) WRITE (NOT, 2110) 2110 FORMAT ( + * ***• ERROR: Nurabar of flow flow alaraanta - 0.',/,

+ ’ FLOWELEM command must ba axacutad. ') RETURN

ENDIF

CC—2 . 0 DEFINE AND INITIALIZE ARRAYS

C CALL CALL

CALL

CALL

CALL

CALL

CALL

CALL

DELETE (’WE DELETE (’V DELETE ( 'F DEFINRf’F DEFINR (

*

V

DEFINRCWE

')

*)

')’,MPF, NFEQN, NFEQN)

* , MPV, NFEQN, 1)

* , MPWE, NFELM, 1) ZEROR ( IA ( MPV) , NFEQN , 1

)

ZEROR ( IA ( MPWE )

, NFELM, 1) CC—3.0 GET ELEMENT FLOW RATES (WE)

C CALL READWE (ERR) IF (ERR) THEN

CALL ABORT

RETURN

END IF

CC—4.0 FORM [F] (ALLOW "END" BEFORE VOL. MASS DATA TO JUST FORM [F])

C OPEN (ND1, FILE- (FNAME (1 : LFNAME) // ’ .FEL’ ) , STATUS-' OLD’

,

+F0RM- • UNFORMATTED *

)

REWIND ND1

CALL FORMF (IA (MPKEQ) , IA(MPF) , IA(MPWE) , ’FULL’, ERR) IF (ERR) THEN CALL ABORT

RETURN

ENDIF

CLOSE (ND1) CALL FREEC ( ’

’ , ENDFLAG, 3, 1) IF (ENDFLAG.EQ. ’END’ ) RETURN

CC—5.0 GET NODAL VOLUMETRIC MASS AND REPORT NOMINAL TIME CONSTANTS

C CALL READV (ERR) IF (ERR) THEN

CALL ABORT

RETURN

ENDIF

IF (ECHO) WRITE (NTW, 2500)

CALL REPRTT(IA(MPF) ,IA( MPV) , NFEQN, 1) CC—6.0 PREMULTIPLY (F) BY [V] INVERSE

C CALL VINVF(IA(MPF) , IA( MPV) , NFEQN, EP, ERR)

IF (ERR) THEN

CALL ABORT

RETURN

END IF

CC—7.0 SOLVE EIGENVALUE PROBLEM

C IF (ECHO) WRITE (NTW, 2700) WRITE (NOT, 2700) 2700 FORMAT (/, ’ “ Actual Tima Conatanta’) WRITE (NTW, 2710) 2710 FORMAT (/, ’ — NOTE: Computation of actual tirna conatanta ', ’may taka conaidarabla tirna.') NIT - 0

CALL EIGEN2 (IA (MPF) , IA (MPF) , NFEQN, NIT, EP1) C

C —8.0 REPORT TIME CONSTANTS 4 ITERATION INFORMATION

C CALL REPRTT (IA (MPF) , IA(MPV) , NFEQN, 2) WRITE (NTW, 2800) ABS (NIT) WRITE (NOT, 2800) ABS (NIT) 2800 F0RMAT(/* Nurabar of itarationa uaad ,..',I5)

IF ( (NIT.LT.0) .OR. (NAIT.EQ. 50) ) THEN WRITE (NTW, 2810) WRITE (NOT, 2810) 2810 FORMAT (’ *** WARNING: Procaadura did not convarga.’)

END IF

C

C—9.0 DELETE ARRAYS

C CALL DELETE (’WE ') CALL DELETE ('V *) CALL DELETE ( ’ F ’)

RETURN

END

C VINVF SUBROUTINE VINVF (F, V, NFEQN, EP, ERR) C—SUB: VINVF: EVALUATES [V]-1[F] : CALLED BY TIMCON

INCLUDE IOCOM.INC

REAL* 8 F (NFEQN, 1), V (NFEQN), EP, EPZERO LOGICAL ERR

C

C—1.0 FIND MAX VOLUMETRIC MASS TO ESTABLISH RELATIVE MACHINE ZERO

C VMAX - 0.0D0

DO 10 1-1, NFEQN

IF(V(I) .CT.VMAX) VMAX-V(I)

10 CONTINUE

EPZERO - EP*VMAX

CC—2.0 EVALUATE PRODUCT [V]-1[F]: ERR IF DIV BY MACHINE ZERO

C DO 20 1-1, NFEQN

VII - V(I)

IF (VII. LE. EPZERO) THEN WRITE (NTW, 2000) I WRITE (NOT, 2000) I ERR - .TRUE. RETURN

ENDIF 2000 FORMAT

(

' ERROR: Voluraatric reaaa laaa than ralativa machina zero.’,/, ’ Equation nurabar: ’,15) DO 20 J-l, NFEQN

F (I, J) - F (I, J) /VII

20 CONTINUE Append -9
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

RETURN

END

C REPRTT SUBROUTINE REPRTT (F, V, NFEQN, OPT) C—SUB: REPRTT - REPORTS TIME CONSTANTS: CALLED BY TIMCON

INCLUDE IOCOM.INC

REAL* 8 F (NFEQN, 1) ,V (NFEQN) INTEGER OPT

IF (OPT.EQo 1) THEN

C

C—1.0 REPORT NOMINAL TIME CONSTANTS V(I, I) /F (I, I) C WRITE (NOT, 2010)

IF (ECHO) WRITE (NTH, 2010) WRITE (NOT, 2020) (N f V(N)/F(N,N), N-l, NFEQN) IF(ECBO) WRITE (NTW, 2020) (N, V(N)/F(N,N), N-l, NFEQN)

ELSE

C

C

C

cc

c

c

c

c

c

c

c

c

c

c

c

c

cTIME (3) MPWE WE (NFELM)

: START TIME, ENDTIME, TIMESTEP

: CURRENT ELEMENT MASS FLOW VALUES TIME HISTORY DATA

DAT ( 1

)

DAT (2)

Tire* histories of excitation data are defined as step-wise functions of time using arbitrary values or, optionally,

generated intermediate values of equal step size.

TM(2) TM (1)

MPTDAT TDAT ( 2 ) : CURRENT ARBITRARY TIME VALUES

MPWDAT WDAT (NFELM, 2) : CORRESPONDING ELEM. FLOW DATA

COMMON /FLODT/ MPTDAT, MPWDAT

REAL*8 TIME (3) LOGICAL ERR CHARACTER ENDFLAG*3

C

C —2.0 REPORT ACTUAL TIME CONSTANTS

C WRITE (NOT, 2040)

IF (ECHO) WRITE (NTW, 2040) WRITE (NOT, 2020) (N, 1 . 0D0/F (N, N) , N-l, NFEQN)

IF (ECHO) WRITE (NTW, 2020) (N, 1 . 0D0/F (N, N) , N-l, NFEQN)

END IF

2010 FORMAT (/, 6X, 4 (2X, 'Node Value’, 3X)

)

2020 FORMAT ( (6X, 4 (16, 1X,G11.3) )

)

2040 FORMAT (/, 6X, 4 (2X, ’Nura. Value’, 3X)

)

RETURN

END C-——

——————————————-—————m————

FLODAT

SUBROUTINE FLODAT C—SUB -.FLODAT - COMMAND TO READ ELEMENT FLOW DATA 4 GENERATE STEPWISE

C TIME HISTORIES OF FLOW DATA AND WRITES TIME HISTORIES

C IN FORMAT;

C

C TIME

C (WE (I) ,1-1, NFELM)

C TIME

C (WE (I) ,1-1, NFELM)

Cc

C TO FILE <filenarae> . WDT

C

C OPTIONALLY EQUAL STEP TIME HISTORIES MAY BE GENERATED C—HELP LIST

C

C .' FLOWDAT [T-nl,n2,n3] Generate element flow time histories.',/,

C .' TIME-nl nl - time’,/,

C nl,n2,n3 W-n4 nl,n2,n3 - node: first, last, incr.',/,

C .’ ... n4 - element mass flow rate.',/,

C .' :',/,

C .’ END’,//,

C

c IMPLICIT REAL* 8 (A-H, 0-2)

CC— CAL-SAP: DATA 4 COMMON STORAGE

C COMMON KTOT.NP, IA(1)

INCLUDE IOCOM.INC

INCLUDE CNTCOM8 6 . INC

ERR - .FALSE. WRITE (NOT, 2000) WRITE (NTW, 2000) 2000 FORMAT (/, ' —— FLOWDAT: ELEMENT FLOW TIME HISTORY DATA’)

CC—1.0 CHECK TO SEE IF ELEMENTS HAVE BEEN DEFINED

C

IF (NFELM. EQ.0) THEN WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT

(

' **• ERROR: Number of flow elements - 0.’,/,

+ ' FLOWELEM command must be executed.') CALL ABORT

RETURN

ENDIF CC—2.0 GET DATA GENERATION CONTROL DATA

C TIME (1) - 0.0D0 TIME (2) - 0.0D0

TIME (3) - 0.0D0 CALL FREER ( 'T' , TIME (1) , 3) IF (TIME (3) .LT.0.0D0) THEN WRITE (NTW, 2200) WRITE (NOT, 2200) 2200 FORMAT (' ***• ERROR: Time step may not be negative.') CALL ABORT

RETURN

ELSEIF (TIME (3) .GT.0.0D0) THEN

IF (TIME (2) .LT.TIME (1) ) THEN WRITE (NTW, 2210) WRITE (NOT, 2210) 2210 FORMAT

(

+ ' ERROR: Final time must be greater than initial time.') CALL ABORT

RETURN

ENDIF

IF (ECHO) WRITE (NTW, 2220) WRITE (NOT, 2220) 2220 FORMAT (/, ' — Generation Control Variables')

IF (ECHO) WRITE (NTW, 2230) (TIME (I) , 1-1, 3) WRITE (NOT, 2230) (TIME (I) , 1-1, 3) 2230 FORMAT (/,

.’ Initial time ’,G10.3,/,

.* Final time ’,C10.3,/,

.* Time step increment *,G10.3) ENDIF

CC— FLODAT: DATA 4 COMMON STORAGE

C

C DICTIONA RY OF VARIABLES

C

C POINTER VARIABLE DESCRIPTION

C

cC—3.0 OPEN <filename> .WDT

C CALL NOPEN (ND1, ( FNAME ( 1 : LFNAME ) //’ .WDT’ ) , ’UNFORMATTED’

)

C

C—4.0 READ 4 GENERATE FLOW DATA

C Append -10
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

WRITE (NOT, 2400) WRITE (NTW, 2400) 2400 FORMAT (/, ’ — Element Maes Flow Tims History Data')

C

C 4.1 DEFINE 4 INITIALIZE ARRAYS

C CALL DELETE (’TDAT’) CALL DELETE (’WDAT’) NWDAT - 1 IF(TIME(3) .CT.0.0D0) THEN CALL DELETE (’WE ’) CALL DEFINR ( ’WE ’ , MPWE, NFELM, 1) CALL ZEROR (IA (MPWE) , NFELM, 1) NWDAT - 2 END IF CALL DEFINR (’ WDAT ’ , MPWDAT, NFELM, NWDAT) CALL DEFINR (* TDAT ’,MPTDAT, 1,2) CALL ZEROR ( IA (MPWDAT) , NFELM, NWDAT) CALL ZEROR (IA(MPTDAT) ,1,2) C

C 4.2 GENERATE VALUES 4 WRITE TO <filenarae> . WDT

C IF(TIME(3) .CT.0.0D0) THEN CALL CENWD1 (IA(MPWE) , lA(MPTDAT) , IA (MPWDAT) , TIME, ERR) IF (ERR) THEN

CALL ABORT

RETURN

ENDIF ELSECALL GENWD2 (IA(MPTDAT) ,IA( MPWDAT) , ERR) IF (ERR) THEN CALL ABORT

RETURN

ENDIF ENDIF

C

C—5.0 DELETE ARRAYS, CLOSE ELEMENT FLOW DATA FILE, SKIP TO "END*

C CALL DELETE (’ TDAT’) CALL DELETE (’WDAT*) CALL DELETE (’WE ’)

CLOSE (ND1)

IF ( MODE. EQ. ’BATCH’) THEN

500 IF(EOC) RETURN CALL FREE GO TO 500 ENDIF

RETURN

END

C GENWD1 SUBROUTINE CENWD1 (WE, TDAT, WDAT, TIME, ERR) C—SUB: GENWD1 - GENERATES ELEMENT MASS FLOW DATA, AT EQUAL TIME STEP

C INTERVALS, FROM GIVEN ARBITRARY DISCRETE TIME DATA

C IMPLICIT REAL*8 (A-fl, O-Z)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC

C

C FLOWDAT: DATA 4 COMMON STORAGE

C COMMON /FLODT/ MPTDAT, MPWDAT LOGICAL ERR

C

c GENWD1: DATA 4 COMMON STORAGE

C ,REAL*8 WE (NFELM) , TDAT (2) , WDAT (NFELM, 2) , TIME (3) C

C—1 . 0 GET FIRST TWO TIME HISTORY RECORDS ( TDAT ( 1 ) , WDAT (NFELM, 1) ) C CALL GETTDT (TDAT) IF(EOC) THEN

WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT ( ’ **** ERROR: Insufficient data.’)

ERR - .TRUE. RETURN

END IF CALL GETWDT (WDAT, ERR) IF (ERR) RETURN

CALL GETTDT (TDAT) IF(EOC) THEN WRITE (NTW, 2100) WRITE (NOT, 2100) ERR - .TRUE. RETURN

ELSEIF (TDAT ( 1 ) . LT . TDAT ( 2 ) ) THEN

WRITE (NTW, 2110) WRITE (NOT, 2110) 2110 FORMAT ( * **** ERROR: Tima data out of sequence.*)

ERR - .TRUE. RETURN

ENDIF CALL GETWDT (WDAT, ERR)

IF (ERR) RETURN

CC—2 . 0 GENERATION TIME LOOP

C DO 200 T—TIME (1) , TIME (2) , TIME (3) C

C 2.1 UPDATE EXCITATION FUNCTION DATA IF NEEDED

C 20 IF (T.GT.TDAT(l) ) THEN CALL GETTDT (TDAT) IF(EOC) THEN WRITE (NTW, 2100) WRITE (NOT, 2100) ERR - .TRUE. RETURN

ELSEIF (TDAT (1 ) .LT. TDAT (2) ) THEN

WRITE (NTW, 2110) WRITE (NOT, 2110) ERR - .TRUE. RETURN

ENDIF CALL GETWDT (WDAT, ERR)

IF (ERR) RETURN

GO TO 20 END IF

CC 2.2 COMPUTE INTERPOLATION FRACTION

C XT - (T-TDAT ( 2 ) ) / (TDAT ( 1

) -TDAT ( 2 )

)

C

C -2.3 COMPUTE (WE(T))

C CALL ZEROR (WE, NFELM, 1)

DO 23 N-l, NFELM

WE (N) - WDAT (N, 2) XT* (WDAT (N, 1) -WDAT (N, 2) ) 23 CONTINUE

C

C 2.4 WRITE TIME, (WE (T) ) TO ND1

C

WRITE (ND1) T WRITE (ND1) (WE (I) ,1-1, NFELM)

200 CONTINUE

CC—3.0 WRITE ONE ADDITIONAL TIME VALUE TO DISK

C WRITE (ND1) T

RETURN

END

c GETTDT

SUBROUTINE GETTDT (TDAT)

C—SUB : GETTDO - UPDATES TIME DATA VALUES

C INCLUDE IOCOM. INC

Append -11
NBS: indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

REALMS TDAT ( 2

)

C RETURN C—1.0 UPDATE OLD VALUES END

C TDAT (2) - TDAT ( 1

)

CC—2.0 READ NEK VALUE

C

C CHECK FOR END-OF-COMMAND "END" IF(EOC) THEN

EOD - .TRUE. RETURN

END IF

IF (MODE . EQ. ' INTER* ) CALL PROMPT (* TIME> '

)

CALL FREE

IF ( MODE. EQ. ’BATCH’) CALL FREEWR (NTH) C CHECK FOR END-OF-COMMAND "END"

IF(EOC) THEN

EOD - .TRUE. RETURN

ENDIF CALL FREER (

' E ' , TDAT ( 1 ) , 1

)

C REPORT

IF (ECHO) WRITE (NTW, 2020) TDAT (1) WRITE (NOT, 2020) TDAT(l) 2020 FORMAT (/,* — Tim*: ’ ,C10.3)

RETURN

END

C— — GETHDT

SUBROUTINE GETHDT (WDAT, ERR) C—SUBs GETHDT - UPDATES ELEMENT FLOW DATA VALUES

C INCLUDE CNTCOM86. INC

LOGICAL ERR

REAL*8 WDAT (NFELM, 2

)

EXTERNAL WDAT0

CC—1.0 UPDATE ’OLD* DATA VALUES; INITIALIZE 'NEW* DATA VALUES

C DO 10 N-l, NFELM

WDAT (N, 2) - WDAT (N, 1) 10 WDAT (N, 1) - 0.0D0

CC—2.0 READ NEW VALUES

C CALL DATCEN (WDATO, NFELM, ERR) IF (ERR) RETURN

CALL REPRTE (WDAT (1,1), NFELM)

RETURN

END

CC — GENWD2

SUBROUTINE: GENWD2 (TDAT, WDAT, ERR) C—SUB: CENWD2 - GENERATES ELEMENT MASS FLOW DATA, AT GIVEN TIME STEP

C INTERVALS, FROM GIVEN DISCRETE TIME DATA

C —

IMPLICIT REALMS (A-H, O-Z)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC

C

C FLOWDAT: DATA 4 COMMON STORAGE

C COMMON /FLODT/ MPTDAT, MPWDAT

LOGICAL ERR EXTERNAL WDATO

C

C GENWD2 . DATA 4 COMMON STORAGE

C REAL*8 TDAT (2 ), WDAT (NFELM, 1)

C

C—1.0 GET FIRST TIME HISTORY RECORD ( TDAT ( 1 ) , WDAT (NFELM, 1) ) C CALL CETTDT (TDAT) IF(EOC) RETURN TDAT (2) » TDAT ( 1

)

CALL DATGEN (WDATO, NFELM, ERR)

IF (ERR) RETURN CALL REPRTE (WDAT (1,1), NFELM) WRITE (ND1) TDAT ( 1

)

WRITE (ND1 ) (WDAT (1,1), 1-1, NFELM)

CC—2 c 0 GET ADDITIONAL TIME HISTORY RECORDS

C

20 CALL CETTDT (TDAT) IF (IOC) GO TO 300

IF (TDAT ( 1 ) . LT . TDAT ( 2 ) ) THEN

WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT (» **** ERROR: Tim* data out of s*qu«ne«.') ERR - .TRUE. RETURN

ENDIF TDAT (2) “ TDAT ( 1

)

CALL DATCEN (WDATO, NFELM, ERR)

IF (ERR) RETURN CALL REPRTE (WDAT (1,1), NFELM) WRITE (ND1) TDAT ( 1

)

WRITE (ND1) (WDAT (1,1) ,1-1, NFELM) GO TO 20 C

C—3.0 WRITE ONE ADDITIONAL TIME VALUE TO DISK WDATO C SUBROUTINE WDATO (N, ERR) C—SUB: WDATO - CALLS WDAT11 PASSING ARRAYS

C COMMON ffTOT, NP, IA(1)

300 WRITE (ND1) TDAT ( 1

)

RETURN

END

INCLUDE CNTCOM86 . INC

COMMON /FLODT/ MPTDAT, MPWDAT LOGICAL ERR

CALL WDAT1 (IA (MPWDAT) , NFELM, N)

RETURN

END

c WDAT1 SUBROUTINE WDAT1 (WDAT, NFELM, N) C—SUB:WDAT1 - READS ELEMENT MASS FLOW RATE TIME HISTORY DATA

C REAL* 8 WDAT (NFELM, 1)

CALL FREER (’W\ WDAT (N,l),l)

c—

TM——TM—— -——EXCDAT

SUBROUTINE EXCDAT C—SUB: EXCDAT - COMMAND TO READ EXCITATION DATA 4 GENERATE STEPWISE

C TIME HISTORIES OF EXCITATION VALUES, E (NFEQN) , AND

C WRITES TIME HISTORIES IN FORMAT;

C

C TIME

C (E (I) ,1-1, NFEQN)

C TIME

C (E (I) , 1-1, NFEQN)

Cc

C TO FILE <filanam*> . EDT

C—HELP LIST

C

C .’ EXCITDAT [T-nl,n2,n3] Canarata axcitation tim* historiaa .

' , /, C .' TIME-nl nl - tire*',/, C .' nl,n2,n3 CG-n4 nl,n2,n3 - noda: first, last, incr.',/. Append -12
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

C .* ... n4 - excitation: cone, or gen. rate.’,/,

C .’

C .’ END’,//,

C

C IMPLICIT REAL* 8 (A-H, O-Z)

COMMON KTOT, NP, IA (1)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC

C— EXCDAT: DATA 4 COMMON STORAGE

CC DICTIONA RY OF

C

C POINTER VARIABLE

C

C TIME (3) C MPE E(NFELM)

C

C TIME HISTORY

CC DAT ( 1

)

C

c

c

c

c

C DAT (2) C

C TM(2) TM (1) C

C MPTDAT TDAT ( 2

)

C MPEDAT EDAT (NFNOD , 2

)

C

VARIABLES

DESCRIPTION

: START TIME, ENDTIME, TIMESTEP

: CURRENT EXCITATION VALUES DATA

Time histories of excitation data are defined as step-wise functions of tiros using arbitrary values or, optionally,

generated intermediate values of equal step size.

: CURRENT ARBITRARY TIME VALUES

: CORRESPONDING EXCITATION DATA

COMMON /EXCDT/ MPTDAT, MPEDAT

REAL*8 TIME (3) CHARACTER ENDFLAG*3 LOGICAL ERR

ERR - .FALSE. WRITE (NOT, 2000) WRITE (NTW, 2000) 2000 FORMAT (/, ’ — EXCITDAT: EXCITATION TIME HISTORY DATA’)

CC—1.0 CHECK TO SEE IF FLOW SYSTEM HAS BEEN DEFINED

C

IF (NFEQN.EQ.0) THEN WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT

(

* **** ERROR: Number of flow system DOFs - 0.*,/,

+ * FLOWSYS coremand must be executed.') CALL ABORT

RETURN

ENDIF

CC—2.0 GET DATA GENERATION CONTROL DATA

C TIME (1) - 0.0D0 TIME (2) - 0.0D0 TIME (3) - 0.0D0 CALL FREER (’T\ TIME (1) ,3) IF (TIME (3) . LT. 0 . 0D0) THEN WRITE (NTW, 2200) WRITE (NOT, 2200) 2200 FORMATC **** ERROR: Tims step may not be negative.') CALL ABORT

RETURN

ELSEIF (TIME (3) .GT.0.0D0) THEN

IF (TIME (2) .LT.TIME (1) ) THEN WRITE (NTW, 2210) WRITE (NOT, 2210) 2210 FORMAT

(

+* **** ERROR: Final time must be greater than initial time.') CALL ABORT

RETURN

ENDIF

IF (ECHO) WRITE (NTW, 2220) WRITE (NOT, 2220) 2220 FORMAT (/, ' — Generation Control Variables’)

IF (ECHO) WRITE (NTW, 2230) (TIME (I) , 1-1 , 3) WRITE (NOT, 2230) (TIME (I) , 1-1 , 3) 2230 FORMAT (/,

.' Initial time ',C10.3,/, Final time ',C10.3,/,

.' Time step increment ' , G10.3) ENDIF

C

C—3.0 OPEN <filename> . EDT

C CALL NOPEN (ND1, ( FNAME ( 1 : LFNAME ) /

/

' .EDT’) , ’UNFORMATTED’)

CC—4.0 READ 4 GENERATE EXCITATION DATA

C WRITE (NOT, 2400)

IF (ECHO) WRITE (NTW, 2400) 2400 FORMAT (/, ' — Nodal Excitation Time History Data')

C

C 4.1 DEFINE 4 INITIALIZE ARRAYS

C CALL DELETE ('TDAT') CALL DELETE ('EDAT') CALL DELETE (’E ’) CALL DEFINR (

' E ' , MPE, NFEQN, 1) CALL ZEROR ( IA( MPE ), NFEQN, 1) NEDAT - 1 IF (TIME (3) . GT . 0 . 0D0) NEDAT - 2 CALL DEFINR (‘EDAT’, MPEDAT, NFNOD, NEDAT) CALL DEFINR (’ TDAT’, MPTDAT, 1,2) CALL ZEROR (IA (MPEDAT) , NFNOD, NEDAT) CALL ZEROR (IA (MPTDAT) ,1,2)

C

C 4.2 GENERATE VALUES 4 WRITE TO <f ilenaras> . EDT

C IF(TIME(3) .CT.0.0D0) THEN CALL GENED 1 (IA(MPKEQ) , IA(MPE) , IA (MPTDAT) , IA (MPEDAT) , TIME, ERR)

IF (ERR) THEN

CALL ABORT

RETURN

ENDIF

ELSECALL CENED2 (IA(MPKEQ) , IA(MPE) , IA (MPTDAT) , IA (MPEDAT) , ERR)

IF (ERR) THEN CALL ABORT

RETURN

ENDIF

ENDIF

CC—5.0 DELETE ARRAYS, CLOSE ELEMENT FLOW DATA FILE, SKIP TO "END"

C CALL DELETE ('TDAT') CALL DELETE (’EDAT') CALL DELETE ('E ')

CLOSE (ND1)

IF ( MODE. EQ. ’BATCH’) THEN

500 IF(EOC) RETURN CALL FREE GO TO 500 ENDIF

RETURN

END

C GENED 1 SUBROUTINE GENED 1 (KEQ, E, TDAT, EDAT, TIME, ERR) C—SUB: CENED1 - GENERATES EXCITATION DATA, AT EQUAL TIME STEP

C INTERVALS, FROM GIVEN ARBITRARY TIME DATA

C

IMPLICIT REAL*8 (A-H, O-Z)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC Append - 1

3
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

LOGICAL ERR

CC CENED1: DATA 4 COMMON STORAGE

C REAL*8 E(NFEQN) ,TDAT(2) , EDAT (NFNOD , 2) , TIME (3) INTEGER KEQ (NFNOD) CC—1.0 GET FIRST TWO TIME HISTORY RECORDS ( TDAT ( 2 ) , EDAT (NFNOD, 2 ) ) C CALL GETTDT (TDAT) IF(EOC) THEN

WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT ( ' **•* ERROR: Insufficient data.’) ERR - .TRUE. RETURN

ENDIF CALL GETEDT (EDAT, ERR) IF (ERR) RETURN

CALL GETTDT-(TDAT) IF(EOC) THEN

WRITE (NTW, 2100) WRITE (NOT, 2100) ERR - .TRUE. RETURN

ELSEIF (TDAT(l) .LT.TDAT(2) ) THEN WRITE (NTW, 2110) WRITE (NOT, 2110) 2110 FORMAT (' **** ERROR: Tims data out of sequence.') ERR - .TRUE. RETURN

ENDIF CALL GETEDT (EDAT, ERR)

IF (ERR) RETURN

C

C —2.0 GENERATION TIME LOOP

C DO 200 T-TIME(l) , TIME (2) , TIME (3) C

C 2.1 UPDATE EXCITATION FUNCTION DATA IF NEEDED

C 20 IF (T . CT . TDAT ( 1 ) ) THEN CALL GETTDT (TDAT) IF(EOC) THEN WRITE (NTW, 2100) WRITE (NOT, 2100) ERR - .TRUE. RETURN ELSEIF (TDAT ( 1) .LT. TDAT (2) ) THEN WRITE (NTW, 2110) WRITE (NOT, 2110) ERR - .TRUE. RETURN ENDIF CALL GETEDT (EDAT, ERR) IF (ERR) RETURN

GO TO 20 ENDIF

C

C 2.2 COMPUTE INTERPOLATION FRACTION

C XT - (T-TDAT ( 2 ) ) / (TDAT ( 1

) -TDAT ( 2 )

)

C

C 2.3 COMPUTE (E (T)

}

C CALL ZEROR (E, NFNOD, 1)

DO 23 N-l, NFNOD NEQ - ABS (KEQ (N)

)

IF (NEQ.NE.0) E (NEQ) - EDAT(N, 2) XT* (EDAT (N, 1) -EDAT (N, 2)

)

23 CONTINUE

C

C 2.4 WRITE TIME, { E (T) ) TO ND1

C

200 CONTINUE

C

C—3.0 WRITE ONE ADDITIONAL TIME VALUE TO DISK

C WRITE (ND1) T

RETURN

END

C GETEDT

SUBROUTINE GETEDT (EDAT, ERR) C—SUB: GETEDT - UPDATES EXCITATION DATA VALUES

C

COMMON MTOT, NP, IA (1)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC

CC— GETEDT: DATA 4 COMMON STORAGE

C LOGICAL ERR REAL*8 EDAT (NFNOD, 2) EXTERNAL EDATO

C

C—1 . 0 UPDATE ’OLD' DATA VALUES; INITIALIZE 'NEW' DATA VALUES

C DO 10 N-l, NFNOD

EDAT (N, 2) - EDAT (N, 1) 10 EDAT(N, 1) - 0.0D0

CC—2.0 READ NEW VALUES

C CALL DATCEN (EDATO, NFNOD, ERR)

IF (ERR) RETURN

CALL REPRTN (EDAT (1, 1) , IA(MPKEQ) , NFNOD , NFNOD

)

RETURN

END

C EDATO SUBROUTINE EDATO (N, ERR) C—SUB: EDATO - CALLS EDAT1 PASSING ARRAYS

C COMMON MTOT, NP, IA (1) INCLUDE CNTCOM86 . INC COMMON /EXCDT/ MPTDAT, MPEDAT

LOGICAL ERR

CALL EDAT1 (IA (MPEDAT) , NFNOD, N)

RETURN

END

C EDAT1 SUBROUTINE EDAT1 (EDAT, NFNOD, N) C—SUB: EDATO - READS EXCITATION TIME HISTORY DATA

C REAL*8 EDAT (NFNOD, 1)

CALL FREER CC\ EDAT (N,l),l)

RETURN

END

c GENED2 SUBROUTINE GENED2 ( KEQ, E , TDAT, EDAT, ERR

)

C—SUB: GENED2 - GENERATES EXCITATION DATA FROM GIVEN TIME DATA

IMPLICIT REAL*8 (A-H, O-Z)

COMMON MTOT, NP, IA (1)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC

WRITE (ND1) T WRITE (ND1) (E (I) , 1-1, NFEQN)

LOGICAL ERR EXTERNAL EDATO Append -14
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

c

c CENED2: DATA ft COMMON STORAGE

C R£AL*8 TDAT (2) , EDAT (NFNOD, 1) , E (NFEQN) INTEGER KEQ (NFNOD)

CC—1.0 GET FIRST TIME HISTORY RECORD ( TDAT (1) , EDAT (NFNOD, 1) ) C CALL GETTDT (TDAT) IF(EOC) RETURN TDAT (2) - TDAT ( 1

)

CALL DATGEN(EDAT0, NFNOD, ERR) IF (ERR) RETURN

DO 10 N-l, NFNOD NEQ - ABS (KEQ (N)

)

10 IF (NEQ.NE . 0) E (NEQ) - EDAT (N, 1) CALL REPRTN(E, IA(MPKEQ) , NFEQN, NFNOD) WRITE (ND1) TDAT (1) WRITE (ND1) (E (I) ,1-1, NFEQN)

CC—2.0 GET ADDITIONAL TIME HISTORY RECORDS

C 20 CALL GETTDT (TDAT) IF(EOC) CO TO 300

IF (TDAT ( 1 ) . LT . TDAT ( 2 ) ) THEN

WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT (' ERROR: Tiro* data out of aaqfuanca.') ERR - .TRUE. RETURN

END IF TDAT (2) - TDAT (1) CALL DATGEN(EDAT0, NFNOD, ERR) DO 22 N-l, NFNOD NEQ - ABS (KEQ (N)

)

22 IF (NEQ.NE. 0) E (NEQ) - EDAT (N, 1) CALL REPRTN (E, IA (MPKEQ) , NFEQN, NFNOD) WRITE (ND1 ) TDAT ( 1

)

WRITE (ND1) (E (I) ,1-1, NFEQN) GO TO 20

CC—3.0 WRITE ONE ADDITIONAL TIME VALUE TO DISK

C 300 WRITE (ND1) TDAT ( 1

)

DICTIONARY OF VARIABLES

VARIABLE

TIME (3) TWDAT

TEDAT PINT

P SCALE

DESCRIPTION

START TIME, END TIME, TIME INCREMENT

TIME OF NEXT ELEMENT FLOW RATE RECORD

TIME OF NEXT EXCITATION RECORD RESPONSE RESULTS PRINT INTERVAL

RESULTS PLOT FILE SCALE FACTOR POINTERS TO BLANK COMMON LOCATIONS

MPFS FS (NFEQN, 2*MFBAN-1)

MPC C (NFEQN) MPCD CD (NFEQN) MPCDD CDD (NFEQN) MPC C (NFEQN)

[F*] DYNAM ALC. MATRIX (ASYM-COMPACT) CURRENT (C) CURRENT d(C)/dt CURRENT d/dt (d(C)/dt) CURRENT (C)

ERR - .FALSE.

WRITE (NOT, 2000) WRITE (NTW, 2000) 2000 FORMAT (/, ' —— DYNAMIC: DYNAMIC SOLUTION*)

C—1 . 0 CHECK IF SYSTEM, ELEMENT, AND EXCITATION DATA ARE DEFINED ft AVAIL

C IF (NFEQN. EQ.O) THEN WRITE (NTW, 2100) WRITE (NOT, 2100) 2100 FORMAT

(

* *** ERROR: Nurnbar of flow *y*tam DOF* - 0.*,/,

+ * FLOWSYS command must ba axacutad.’) CALL ABORT

RETURN

ELSEIF (NFELM.EQ.0) THEN

WRITE (NTW, 2110) WRITE (NOT, 2110) 2110 FORMAT

(

• •••* ERROR: Nurnbar of flow alarnant* - 0.',/,

+ ' F LOWELEM command rauat ba axacutad.') CALL ABORT

RETURN

ENDIF

RETURN

END

•DYNAM SUBROUTINE DYNAM C—SUB: DYNAM - COMMAND TO FORM ft SOLVE DYNAMIC PROBLEM

C

c [F (t) ) (C) + [V)d{C)/dt - (C(t)}

c

C * EXCITATION, (G) AND PRESCRIBED (C), UPDATED AT DISCRETE

C TIMES USED TO DEFINE EXCITATION (READ FROM ND1)

C * FLOW MATRIX, [F] , UPDATED AT DISCRETE TIMES USED TO

C DEFINED ELEMENT FLOW RATES (READ FROM ND2)

C —HELP LIST

C .' DYNAMIC Dynamic aolution .

’ , /, C .' T-nl,n2,n3 A-n4 nl,n2,n3 - init, final, incr; n4 -alpha',/,

C .

* n5,n6,n7 IC-n8 n5,n6,n7 - noda: fir*t, la*t, incr.’,/.

C .' ... n8 - nodal initial concantration* ' , /, C .’ C .* END',//,

C

IMPLICIT R£AL*8 (A-H, O-Z)

COMMON MTOT, NP , IA ( 1

)

INCLUDE IOCOM. INC INCLUDE CNTCOM0 6 . INC

COMMON /DYNM/ TWDAT, TEDAT

LOGICAL ERR, FOUND REAL*8 TIME (3), PSCALE

INTEGER PINT

INQUIRE (FILE- (FNAME (1 : LFNAME) // ' . FEL ’), EXIST-FOUND)

IF (.NOT. FOUND) THEN WRITE (NTW, 2120) (FNAME (1: LFNAME) //' .FEL’

)

WRITE (NOT, 2120) (FNAME (1: LFNAME) //' .FEL’

)

2120 FORMAT ( ' **** ERROR: Elaraant data fila ',A, ' not found.',/,

+ ' F LOWELEM command must ba axacutad.') CALL ABORT

RETURN

ENDIF

INQUIRE (FILE- (FNAME (1: LFNAME)//' . WDT’ ) , EXIST-FOUND)

IF ( . NOT . FOUND ) THEN

WRITE (NTW, 2130) (FNAME (1 : LFNAME) //' .WDT*

)

WRITE (NOT, 2130) (FNAME (1 : LFNAME) //’ .WDT'

)

2130 FORMAT ( * **** ERROR: Flow data fila ’,A,

’

not found.’,/,

' FLOWDAT commend must ba axacutad.') CALL ABORT

RETURN

ENDIF

INQUIRE (FILE- (FNAME (1 : LFNAME) // ’ . EDT ' ) , EXIST-FOUND)

IF (.NOT. FOUND) THEN

WRITE (NTW, 2140) (FNAME (1 : LFNAME) //*. EDT '

)

WRITE (NOT, 2140) (FNAME (1 : LFNAME) //'. EDT '

)

2140 FORMAT ( ' •*** ERROR: Excitation data fila ’,A,

'

not found.’,/,

+ ' EXCITDAT command mu*t ba axacutad.') CALL ABORT

RETURN

ENDIF

C

C—2 .

0

GET DYNAMIC SOLUTION CONTROL VARIABLES

C WRITE (NTW, 2200) WRITE (NOT, 2200) Append -15
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

2200 FORMAT (/* -— Solution Control Variablas '

)

IF ( MODE. EQ. ’INTER’) CALL PROMPT (’ DATA> ’

)

CALL FREE

IF ( MODE. EQ. ’BATCH’) CALL FREEWR (NTH) TIME (1) - 0.0D0

TIME (2) - 0.0D0 TIME (3) - 0.0D0 CALL FREER (*T\ TIME (1) , 3) IF(TIME(3) .LE.0.0D0) THEN

WRITE (NTH, 2210) WRITE (NOT, 2210) 2210 FORMAT C •*** ERROR: Tim* stop must bo graatar than 0.0.') CALL ABORT

RETURN

ELSEIF (TIME (2) .LT.TIME (1) ) THEN WRITE (NTW, 2220) WRITE (NOT, 2220) 2220 FORMAT

(

+ ’ • ««* ERROR: Final time must bo graatar than initial tirno.') CALL ABORT

RETURN

END IF

IF (ERR) THEN

CALL ABORT

RETURN

ENDIF

C

C—5.0 GET NODAL INITIAL CONCENTRATIONS

C CALL READ IC (ERR) IF (ERR) THEN CALL ABORT

RETURN

ENDIF

CC—6.0 OPEN ELEMENT, FLOW AND EXCITATION DATA FILES, ft PLOT FILE

C OPEN (ND1 , FILE- ( FNAME ( 1 : LFNAME )//’. FEL ’), STATUS- v OLD ’

,

FORM— ’ UNFORMATTED *

)

REWIND ND1

OPEN (ND2, FILE- ( FNAME (1: LFNAME)//' . WDT ’) , STATUS- ’ OLD ’

,

FORM- ’ UNFORMATTED '

)

REWIND ND2 READ (ND2) TWDAT

ALPHA - 0.75D0 CALL FREER (’A’, ALPHA, 1) IF( (ALPHA. LT.0.0D0) .OR. ( ALPHA. GT . 1 . 0D0) ) THEN WRITE (NTW, 2230) WRITE (NOT, 2230) 2230 FORMAT (’ ERROR: Alpha must bo in rang* 0.0 to 1.0.’) CALL ABORT

RETURN

ENDIF

PINT - 1 CALL FREEI (

* I '

, PINT, 1) IF (PINT.LT. 0) THEN WRITE (NTW, 2240) WRITE (NOT, 2240) 2240 FORMAT (’ **** ERROR: Rasults print interval roust ba > 0.') CALL ABORT

RETURN

ENDIF

PSCALE - 0.0D0 CALL FREER ('S', PSCALE, 1)

IF (ECHO) WRITE (NTW, 2250) (TIME (I) , X-l, 3) , ALPHA, PINT

WRITE (NOT, 2250) (TIME (I) , 1-1, 3) , ALPHA, PINT

2250 FORMAT (/,Initial tin* ’,G10.3,/, Final tiraa ’,G10.3,/,

.' Tiro stap incraront *,G10.3,/,

.' Intagration pararotar: alpha .... ’,G10.3,/,

.' Rasults print intarval ’,16) IF (PSCALE. NE.0.0D0) THEN

IF (ECHO) WRITE (NTW, 2260) PSCALE WRITE (NOT, 2260) PSCALE

ENDIF

2260 FORMAT (' Rasults plot-fila sea la factor .. * ,G10.3)

C

C—

3

C

c

C —

4

C

0 DEFINE AND INITIALIZE SYSTEM ARRAYS

CALL DELETE (’WE CALL DELETE ('C CALL DELETE ('C CALL DELETE (*F CALL DELETE (’V CALL DEFINR (

'

V

CALL DEFINR (’F CALL DEFINR (’C CALL DEFINR (’C CALL DEFINR (’WE CALL ZEROR ( IA ( MPV) , NFEQN , 1

)

CALL ZEROR ( IA (MPC) , NFEQN, 1)

’)

')

’)

')

’)

’, MPV, NFEQN, 1)

’ , MPF, NFEQN, 2*MFBAN-1)

’, MPC, NFEQN, 1)

’, MPC, NFEQN, 1)

* , MPWE, NFELM, 1)

.0 GET NODAL VOLUMETRIC MASS

CALL READY (ERR)

OPEN (ND3, FILE- (FNAME (1: LFNAME)//’ . EDT ’), STATUS- ’ OLD ’

,

FORM- • UNFORMATTED 5 ) REWIND ND3

READ (ND3) TEDAT

IF ( PSCALE. NE.0.0D0) THEN CALL NOPEN (ND4, (FNAME (1 : LFNAME) // ’ . PLT * ) , ’FORMATTED’) ENDIF

CC—0.0 DEFINE ADDITIONAL SOLUTION ARRAYS

C CALL DELETE (*FS ') CALL DELETE (’CD ’) CALL DELETE

(

V CDD ’) CALL DEFINR (’CDD 9 , MPCDD, NFEQN, 1) CALL DEFINR (’CD *, MPCD, NFEQN, 1) CALL DEFINR (*FS ’ , MPFS, NFEQN, 2*MFBAN-1) CALL ZEROR (IA( MPCD ), NFEQN, 1) CALL ZEROR (IA(MPCDD), NFEQN, 1) CC—9.0 CALL PREDIC TO DO THE WORK

C CALL PREDIC (IA(MPKEQ) , IA (MPF) , IA(MPFS) , IA(MPV) , IA(MPG) , IA(MPC) , IA(MPCD ) , IA (MPCDD) , TIME, ALPHA, NFNOD , NFEQN, MFBAN , PINT, PSCALE , ERR)

IF (ERR) CALL ABORT

CC—10.0 DELETE UNNEEDED ARRAYS ft CLOSE FILES

C CALL DELETE (*FS ') CALL DELETE CCD ’) CALL DELETE (’CDD c )

CLOSE (ND1) CLOSE (ND2) CLOSE (ND3) CLOSE (ND4

)

C

C—11.0 SKIP TO END-OF-COMMAND DELIMITER 'END' C

IF (MODE. EQ. ’INTER’) RETURN

IF (MODE. EQ. ’BATCH') THEN

1100 IF(EOC) RETURN CALL FREE

GO TO 1100 ENDIF

END

READIC SUBROUTINE READIC (ERR) C—SUB: READIC - READS ft REPORTS INITIAL CONCENTRATION CONDITIONS DATA

C COMMON MTOT, NP, IA (1)

INCLUDE IOCOM. INC Append -16
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

INCLUDE CNTCOM86 . INC

LOGICAL ERR EXTERNAL ICDATO

WRITE (NTH, 2000) WRITE (NOT, 2000) 2000 FORMAT (/, ' — Initial Condition*: Nodal Concentration*

'

CALL DATCEN( ICDATO, NFNOD, ERR)

IF (ERR) RETURN

CALL REPRTN (IA (MPC) , IA(MPKEQ) , NFEQN, NFNOD)

RETURN

END

C SUBROUTINE ICDATO (N, ERR) C—SUB: ICDATO - CALLS ICDAT1 PASSING ARRAYS

C COMMON MTOT,NP,IA(l)

INCLUDE CNTCOM86 . INC

LOGICAL ERR

DICTIONARY OF VARIABLES

Cc

cC VARIABLE

C-DUMMY

DESCRIPTIONID (NNOD)

K (NEQN, 2 "MBAN- 1) KS (NEQN,

2

# MBAN-1)

C (NEQN)

E (NEQN) T (NEQN) TD (NEQN) TDD (NEQN) TIME (3) ALPHA

NNOD NEQN

MBAN PINT

PSCALE

ERR

EQUATION NUMBER/CODE (ORDERED BY EQTN #) EQTN • OF NODE N - ABS(ID(N))

ID (N) - 0 : NODE IS NOT DEFINED DOF

ID (N) - POS : NODE IS E-PRESCRIBED DOF

ID (N) - NEC : NODE IS T-PRESCRIBED DOF

[K] MATRIX: ASYM-BANDED COMPACT-STORED

[*•] - [C] aDT [K] MATRIX (SCALED FOR NEG ID) CURRENT [C] (ORDERED BY EQTN #) CURRENT (E) (ORDERED BY EQTN *) CURRENT (T) (ORDERED BY EQTN #) CURRENT (dT/dt) (ORDERED BY EQTN #) INITIAL (d/dt{ dT/dt)) TO EST TIME STEP START TIME, END TIME, TIME INCREMENT INTEGRATION PARAMETER NUMBER OF SYSTEM NODES NUMBER OF EQUATIONS

HALF BANDWIDTH OF SYSTEM OUTPUT RESULTS PRINT INTERVAL

RESULTS PLOT-FILE SCALE FACTOR

ERROR FLAG

CALL ICDAT1 (IA (MPKEQ) , IA (MPC) , NFNOD, NFEQN, N, ERR)

RETURN

END

C 1CDATI SUBROUTINE ICDAT1 (KEQ, C, NFNOD, NFEQN, N, ERR) C—SUB:ICDAT1 - READS INITIAL CONCENTRATION CONDITIONS DATA

C INCLUDE IOCOM. INC

INTEGER KEQ (NFNOD) REAL*8 C (NFEQN) , CDAT

LOGICAL ERR

CDAT - 0.0D0 CALL FREER (’C’, CDAT, 1) IF (CDAT.LT.0.0D0) THEN

WRITE (NTW, 2000) WRITE (NOT, 2000) ERR - .TRUE. RETURN

END IF 2000 FORMAT(' ***• ERROR: Nodal concentrations may not be negative.*)

NEQ - ABS (KEQ (N)

)

C(NEQ) - CDAT

RETURN

END

C —PREDIC SUBROUTINE PREDIC ( ID , K, KS , C„ E, T, TD , TDD , TIME , ALPHA, NNOD , NEQN , MBAN

,

'PINT, PSCALE, ERR) C-SUB: PREDIC - PREDICTOR-CORRECTOR 1ST O.D.E. EQUATION SOLVER

C TIME STEP ESTIMATE BASED ON METHOD IN "HEAT*

C BY R.L. TAYLOR - U.C. BERKELEY

C SOLVES EQUATION;

CC [K(t))(T> (C) (dT/dt) - (E (t)

)

C

C WHERE; [K(t) ] - STORED IN COMPACT ASYMMETRIC BANDED FORM

C (C) - DIAGONAL; STORED AS VECTOR

C (E (t) ) - EXCITATION; DEFINED PIECE-WISE LINEAR

C

C BASED ON DIFFERENCE APPROXIMATION;

C

C (T)n+1 - (T)n (1-a) DT( dT/dt ) n (a) DT(dT/dt }n+l

C

C WHERE; a • "alpha*, an integration parameter

C - 0 correspond* to Forward Difference method

C - 1 correspond* to Backward Difference method

C - 1/2 correspond* to Crank-Nicholson method (unstable)

C DT - time step increment

IMPLICIT REAL*8 (A-H,0-Z)

INCLUDE IOCOM. INC

C

C PREDIC: DATA 4 COMMON STORAGE

C REAL*8 K(NEQN,2*MBAN-1) , KS (NEQN, 2*MBAN-1) ,C (NEQN) ,E (NEQN) ,T (NEQN)

,

+TD (NEQN) , TDD (NEQN) , TIME ( 3) , ALPHA, PSCALE

INTEGER PINT, ID (NNOD) LOGICAL ERR, TDOF, KUPDAT, EUPDAT

C

C—1 . 0 FORM INITIAL [K] C CALL UPDATK(K,TIME(1) , KUPDAT, ERR)

IF (ERR) RETURN

C

C—2 . 0 COMPUTE INITIAL TEMPERATURE RATES: (dT(0)/dt) FROM

C

C (C) (dT(0)/dt) - { E (0) } - [K] (T (0)

)

CC 2.1 GET INITIAL EXCITATION

C CALL UPDATE (E, TIME (1) , EUPDAT, ERR)

IP (ERR) RETURN

C

C 2.2 FORM RHS: (dT/dt)-0 FOR *T*-DOF, (E)-[K]{T) FOR *E*-DOF : SOLVE

C DO 22 I-1,NEQN

C * T* -DOF : SET ( dT/dt )-0

IF (TDOF (I, ID, NNOD) ) THEN

C *T*-DOF: CHECK FOR dT/dt INFINITE

IF(T(I) .NE.E(I) ) THEN WRITE (NTW, 2220) I WRITE (NOT, 2220) I 2220 FORMAT ( ’ •*** ERROR: Can not corrpute for step change’,

+ * in dependent variable number:*, IS) ERR - .TRUE. RETURN

ELSE

TD (I) - 0.0D0

END IF

C ’ E ’ -DOF : FORM (E]-(K)(T) WHERE (K) IS IN COMPACT STORAGE

ELSETEMP - E (I) K1 - MAX (1, MBAN- I +1) K2 - MIN (2*MBAN-1, MBAN+NEQN-I) DO 20 KK-K1 , K2

J - I + KK - MBAN

TEMP - TEMP - K (I , KK) *T(J)

20 CONTINUE

C SOLVE

TD (I) - TEMP/C (I) Append -17
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

22 END IF

CC—3.0 COMPUTE TAYLOR'S TIMESTEP CHECK

C IF (ECHO) WRITE (NTH, 2300) WRITE (NOT, 2300) 2300 FORMAT(/,* —° Tiraa Stap Eatiraata for Initial Conditions’)

C

C 3.1 COMPUTE INITIAL RATE OF TEMP RATES

C FORM AND SOLVE: [C] d(dT/dt ) /dt - -[K){dT/dt)

C DO 32 I-l.NEQN

IF (TDOF ( I , ID , NNOD ) ) THEN

TDD (I) - 0.0D0

ELSETEMP - 0.0D0

K1 - MAX (1, MBAN-I+1)

K2 - MIN (2*MBAN-1, MBAN+NEQN-I)

DO 30 KK-K1,K2

J - I KK - MEAN TEMP - TEMP - K (I, KK) *TD (J) 30 CONTINUE

TDD (I) - TEMP/C (I) 32 ENDIF

C

C 3.2 COMPUTE NORMS: ||{T(0))||, I I (dT (0) /dt )| | , I I d/dt (dT (0) /dt }|

|

C TN - 0.0D0 TDN - 0.0D0 TDDN - 0.0D0

DO 34 N-l, NEQN TN - TN T (N) **2 TDN - TDN TD (N) **2

34 TDDN - TDDN TDD(N)**2

TN - SQRT (TN) TDN - SQRT (TDN) TDDN - SORT (TDDN)

C

C 3.3 EVALUATE TAYLORS EXPRESSION FOR TIME STEP ESTIMATE

C B - 0.05D0

IF (TDDN.NE.0.0D0) THEN

DTEST - (B*TDN SQRT (B*B*TDN*TDN 2 . 0D0*B*TN*TDDN) ) /TDDN C IF (ECHO) WRITE (NTW, 2320) B*100.0D0, DTEST, TIME (3) WRITE (NOT, 2320) B*100.0D0, DTEST, TIME ( 3) 2320 FORMAT (/* — NOTE: Eatiraatad tiraa atap to limit arror to*,

.* approx. ', F5. 2, *% ia:’,C10.3,/

. * Spaeifiad tiraa atap ia:’,G10.3) ELSE

IF (ECHO) WRITE (NTW, 2340) WRITE (NOT, 2340) 2340 FORMAT (/’ — NOTE: Unabla to aatiraata tiraa atap to limit * .'arror for tha givan ayatare. *

)

END IF

CC—4.0 FORM AND FACTOR [K*J C CALL FORMKS (ID, K, KS, C, ALPHA, TIME (3) ,NN0D,NEQN, MBAN) CALL FACTCA(KS,NEQN, MBAN, ERR) IF (ERR) RETURN

CC—5.0 TIME STEP THRU SOLUTION

C ADT - ALPHA*TIME (3) DTA - (1.0D0 - ALPHA) *TIME (3)

I STEP - 0

DO 500 TM-TIME(1)+TIME(3) , TIME (2) , TIME (3)

I STEP - I STEP 1 CC 5.1 UPDATE (K), FORM AND FACTOR [K*

)

C CALL UPDATE (K, TM, KUPDAT, ERR)

IF (ERR) RETURN

IF (KUPDAT) THEN CALL FORMKS (ID, K,KS,C, ALPHA, TIME ( 3) , NNOD, NEQN, MBAN) CALL FACTCA(RS, NEQN, MBAN, ERR)

IF (ERR) RETURN

ENDIF

C

C 5.2 FORM (E) C CALL UPDATE (E, TM, EUPDAT, ERR)

IF (ERR) RETURN

C

C 5.3 PREDICT Ts (T) - (T) (1-a) DT(dT/dt

}

C DO 51 N-l. NEQN

IF (TDOF (N, ID, NNOD) ) THEN

T(N) - E(N) ELSE

T(N) - T(N) DTA*TD(N) ENDIF

51 CONTINUE

C

C 5.4 FORM RHS: (E)-(K) (T) FOR FLUX-DOF, (dT/dt ) *DIAC [K*] FOR TEMP-DOF

C CALL RHS (ID, T,TD,E,K,KS, NNOD, NEQN, MBAN)

C

C 5.5 SOLVE FOR (dT/dt)

C CALL SOLVCA(KS,TD, NEQN, MBAN, ERR)

IF (ERR) RETURN

C

C 5.6 CORRECT T: (T) - (T) aDT{dT/dt)

C DO 55 N-l, NEQN

IF (TDOF (N, ID, NNOD) ) THEN

T (N) - E (N) ELSE

T(N) - T(N) ADT*TD(N) ENDIF

55 CONTINUE

C

C 5.7 REPORT RESULTS

C

IF (MOD (ISTEP, PINT) .EQ.O) THEN

IF (ECHO) WRITE (NTW, 2510) TM

WRITE (NOT, 2510) TM

2510 FORMAT ( / ,

* — Raaponaa \46(1H-),’ Tiraa: *,610.3) CALL REPRTN(T, ID, NEQN, NNOD)

-WRITE TO FILE <filanaraa>.PLT for plotting

IF (PSCALE .NE . 0 . 0D0) THEN WRITE (ND4, 2530) TM, (CHAR(9) ,T(I) *PSCALE, I-1,NEQN)

2530 FORMAT (F10 . 3, (10 (Al, E10 . 4) )

)

ENDIF

ENDIF

500 CONTINUE

RETURN

END

C — UPDATE SUBROUTINE UPDATE (K, TM, KUPDAT, ERR) C—SUB: UPDATE - UPDATES [K]-[F] IF ELEMENT MASS FLOW RATES CHANCE

COMMON MTOT, NP, LA (1)

INCLUDE IOCOM. INC INCLUDE CNTCOM86. INC

COMMON /DYNM/ TWDAT, TEDAT

REAL*8 K (NFEQN, 2*MFBAN-1) , TM, TWDAT, TEDAT

LOGICAL ERR, KUPDAT

CC—1.0 UPDATE ELEMENT FLOW RATES IF (TM. CE . TWDAT)

C CALL UPDAT (ND2 , TM, TWDAT, IA (MPWE) , NFELM, KUPDAT, ERR)

IF (KUPDAT) THEN

IF (ECHO) WRITE (NTW, 2000) TM

WRITE (NOT, 2000) TM

2000 FORMAT (/, ' — Elaraant Flow Rata Updata ' ,30(1H-),

* Tiraa: ’,G10.3)

CALL REPRTE (IA(MPWE) , NFELM)

CALL FORMF(IA(MPKEQ) , K, IA( MPWE) , ’BAND’ , ERR) Append -18
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

ENDIF RETURN

END

C — — UP DATE SUBROUTINE UPDATE (E, TM, EUPDAT, ERR)

C —SUB : UPDATE - UPDATES (E)-(C) IF EXCITATION CHANCES

COMMON MTOT,NP, IA(1)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC

COMMON /DYNM/ TWDAT, TEDAT

REALMS E (NFEQN) , TM, TWDAT, TEDAT LOGICAL ERR, EUPDAT

CALL UPDAT (ND3, TM, TEDAT, E, NFEQN, EUPDAT, ERR) IF (EUPDAT) THEN

IF (ECHO) WRITE (NTH, 2000) TM

WRITE (NOT, 2000) TM

2000 FORMAT (/,' — Excitation Update , ,37(1H-),’ Tirae: *,010.3) CALL REPRTN (E, IA (MPKEQ) , NFEQN, NFNOD) ENDIF RETURN

END

C UPDAT SUBROUTINE UPDAT (LUN, T, TD, D, ND, UPDATE, ERR) C—SUB: UPDAT

C SEARCHES A SEQUENTIAL DATA RECORD, ON UNIT LUN, OF THE FORM;

C TD

C (D(I) ,1-1, ND)

C TD

C (D(I) ,1-1, ND)

C

C TO UPDATE DATA VALUES TO CURRENT TIME, "T" . IF DATA VALUES ARE

C UPDATED LOGICAL * UPDATE" IS SET TO TRUE.

C

C TD : DISCRETE TIME VALUE

C : UPDATED TO NEXT VALUE

C D (I) : CORRESPONDING DISCRETE DATA VALUES

C

C UPDAT MUST BE "PRIMED" BY READING FIRST TD VALUE TO MEMORY

C

INCLUDE IOCOM. INC

REAL*8 D (ND) , T,TD LOGICAL ERR, UPDATE

UPDATE - .FALSE.

10 IF(T.GE.TD) THEN

C UPDATE DISCRETE DATA VALUES

READ (LUN, ERA-800, END-900) (D (I) , 1-1, ND) IF (ERR) RETURN

UPDATE - .TRUE.

C GET NEXT DISCRETE TIME

READ (LUN, ERP-800, END-900) TD

IF (ERR) RETURN

CO TO 10 ELSERETURN

ENDIF

800 ERR - .TRUE. WRITE (NTW, 8000) WRITE (NOT, 8000) 8000 FORMAT ( ’ ***• ERROR: Tiraa hiatory data file read error.’) RETURN

900 ERR - .TRUE. WRITE (NTW, 9000) WRITE (NOT, 9000) 9000 FORMAT

(

+» ERROR: EOF encountered on time hiatory data file.’,/,

+' Inaufficient time hiatory data.') RETURN

END

c FORMKS SUBROUTINE FORMKS ( ID , K, KS , C , ALPHA, DT, NNOD , NEQN , MBAN) C—SUB : FORMKS - FORMS;

C [K*J - [C] * aDT(K]

C

C SCALES (K"] - [K" ) "1 . 0D15 FOR ’T’-DOF

C IMPLICIT REAL"8 (A-H, O-Z)

REAL"8 K(NEQN, 2*MBAN-1) , KS (NEQN, 2®MBAN-1) , C (NEQN) INTEGER ID (NNOD) LOGICAL TDOF

ADT - ALPHA*DT

DO 10 N-l, NEQN

DO 10 M—1, 2"MBAN-1

10 KS (N, M) -ADT*K(N,M)

DO 20 N-l, NEQN

20 KS (N, MBAN) - KS (N, MBAN) * C(N)

DO 30 N-l, NEQN

30 IF (TDOF (N, ID, NNOD) ) KS (N, MBAN) - KS (N, MBAN) *1 . 0D15

RETURN

END

C RHS SUBROUTINE RHS (ID, T, TD, E, K, KS, NNOD, NEQN, MBAN) C-SUB:RHS - FORMS RHS OF [K*](dT/dt) - (E*) C

C (E* (t) } - [E(t> ]-[K] (T(t) ) ; FOR ’E’-DOF

C (E* (t) ) - (dT (t) /dt ) "DIAC OF [K*] ; FOR ’T’-DOF

C

C

C (EM IS WRITTEN OVER (TD) C [K] 4 [K*] ARE AYSM-BANDED COMPACT STORED

C

IMPLICIT REAL"8 (A-H, O-Z)

REAL*8 T (NEQN) ,TD (NEQN) , E (NEQN) , K (NEQN, 2*MBAN-1) , KS (NEQN, 2* MBAN-1) INTEGER ID (NNOD) LOGICAL TDOF

DO 20 1-1, NEQN

C SCALE BY DIAGONAL FOR TEMP PRESCRIBED NODES

IF (TDOF (I, ID, NNOD) ) THEN

TD (I) - TD (I) "KS (I, MBAN)

C FORM [E] - [K] (T) WHERE (K) IS IN COMPACT STORAGE

ELSE

TEMP - E(I) K1 - MAX ( 1 , MBAN-I +1

)

K2 - MIN (2*MBAN-1, MBAN+NEQN-I) DO 10 KX-K1, K2 J - I KK - MBAN

TEMP - TEMP - K (I, KK) *T ( J) 10 CONTINUE

TD (I) - TEMP

ENDIF

20 CONTINUE

RETURN

END

C TDOF FUNCTION TDOF (NEQ, ID, NNOD) C-FUN : TDOF - DETERMINES IF EQUATION NUMBER NEQ IS A TEMPERATURE DOF LOGICAL TDOF INTEGER ID (NNOD) TDOF - .FALSE. DO 10 N-l, NNOD

IF ( (ID (N) . LT . 0 ) .AND. (ABS(ID(N) ) . EQ.NEQ) ) THEN

TDOF - . TRUE

.

RETURN

ENDIF

10 CONTINUE

RETURN Append -19
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

END LOGICAL ERR

SUBROUTINE RESET

C—SUB: RESET - COMMAND TO RESET CONTAM BY RE-INITIALIZING POINTERS AND

C COUNTERS AND DELETES ARRAYS LEFT BY CONTAM IN BLANK COMMON

C—HELP LIST C

CALL INITCN

RETURN

END

CALL VDAT1 (IA(MPKEQ) , IA(MPV) , NFNOD, NFEQN, N, ERR>

RETURN

END

C — — VDAT1 SUBROUTINE VDAT1 (KEQ, V, NFNOD, NFEQN, N, ERR) C—SUBjVDATI - READS NODE VOLUME DATA

C INCLUDE IGCOM. INC

C C

C C

C CONTAM UTILITIES C

C C

C C

C NDCHK SUBROUTINE NDCHK (ND, MAXNUM, NDIM, ERR)

C —SUB : NDCHK - CHECKS FOR OUT-OF-RANCE ELEMENT NODE NUMBERS

INCLUDE IOCOM. INC

C

C

c

c

c

c

c

c

c

c

LOGICAL ERR DIMENSION ND (NDIM) DICTIONARY OF VARIABLESVARIABLE DESCRIPTION

INPUT

ND NODE NUMBER ARRAY MAXNUM LARGEST ALLOWABLE NUMBER NDIM DIMENSION OF NODE NUMBER ARRAY OUTPUT

ERR ERROR FLAG

DO 10 N-l.NDIM

NN - ND(N>- IF (NN.LE. 0. OR. NN.CT. MAXNUM) THEN WRITE (NTH, 2000) NN

ERR-. TRUE. ENDIF

10 CONTINUE

RETURN

2000 FORMAT (’ ERROR: (Ganaratad) nurabar ',15, * i« out of rang*.') END

INTEGER KEQ (NFNOD) REAL*8 V (NFEQN) ,VDAT LOGICAL ERR

CALL FREER ( ’V’ , VDAT, 1) IF ( VDAT . LT . 0 . 0D0 ) THEN WRITE (NTW, 2000) WRITE (NOT, 2000) ERR - .TRUE. RETURN

END IF 2000 FORMAT(’ •*** ERROR: Nodal voluraatric mass may not ba negative.') NEQ - ABS (KEQ (N)

)

V(NEQ) - VDAT

RETURN

END

C DATGEN SUBROUTINE DATGEN (DATA0 , HAXNO, ERR) C—SUB -.DATGEN - READS AND GENERATES DATA BY INCREMENTING RULE;

C nl, n2, n3 - FIRST , LAST «, INCREMENT

C GIVEN DATA LINE OF FORM

C nl,n2,n3 Dl-n4,n5,... D2-n6,n7,... ate.

C CALLS SUBROUTINE w DATAO" TO READ DATA (Dl, D2, ate.)

C RETURNS WHEN DATA LINE IS BLANK, IS •:*, OR IS "END"

C CHECKS ALL GENERATED NUMBERS .LE. MAXNO FOR MAXNO.GT.O

C INCLUDE IOCOM. INC

LOGICAL ERR, FIRSTL

INTEGER I JK (3) EXTERNAL DATAO

ERR - .FALSE. FIRSTL - .TRUE.

c —

SUBROUTINE READV (ERR) C—SUB:R£ADV - READS 4 REPORTS NODE VOLUME DATA

C COMMON MTOT, NP, IA (1)

INCLUDE IOCOM. INC INCLUDE CNTCOM86 . INC

READV C

C—1 .0 GET LINE OF DATA

C 100 IF ( MODE. EQ. 'INTER') CALL PROMPT*' DATA> '

)

CALL FREE

IF (MODE . EQ .’ BATCH * ) CALL FREEWR (NTW) CC—2.0 CHECK FOR "END"

C LOGICAL ERR EXTERNAL VDATO

WRITE (NTW, 2000) WRITE (NOT, 2000) 2000 FORMAT*/,' — Nodal Voluraatric Mass') CALL DATGEN (VDATO, NFELM, ERR)

IF (ERR) RETURN

CALL REPRTN(IA(MPV) , IA(MPKEQ) , NFEQN, NFNOD)

IF(EOC) THEN

IF (FIRSTL) THEN WRITE (NTW, 2200) WRITE (NOT, 2200) 2200 FORMAT*' **** ERROR: Data axpactad; "END" found.’) ERR - .TRUE. RETURN

ELSERETURN

ENDIF END IF

RETURN

END

C SUBROUTINE VDATO (N, ERR) C—SUB: VDATO - CALLS VDAT1 PASSING ARRAYS

C COMMON MTOT, NP, IA (1)

INCLUDE CNTCOM86 . INC

CC—3.0 GET INCREMENTING RULE; RETURN IF IJK(l).EQ.O

C IJK(l) - 0 CALL FREEI (

'' ',IJK(1),3)

IF (IJK(l) . EQ.O) RETURN

IF (IJK(2) .EQ.O) IJK(2)-IJK(1)

IF(IJK(3) .EQ.O) IJK(3) -1 DO 300 N-IJK(l), I JK (2) , IJK(3)

IF (MAXNO.GT.O) CALL NDCHK (N, MAXNO, 1, ERR)

IF (ERR) RETURN CALL DATAO (N, ERR) Append -20
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

IF (ERR) RETURN

300 CONTINUE

FIRSTL - .FALSE. CO TO 100

END

SUBROUTINE ELCEN (ELEMO, KEQ, NELDOF, NSYNOD, MSYBAN, ERR) -SUBsELEMIN - READS ELEMENT NUMBER, CONNECTIVITY, 4 GENERATION DATA GENERATES MISSING ELEMENTS, UPDATES SYSTEM BANDWIDTH CALLS "ELEMO" TO READ ELEMENT PROPERTY DATA

RETURNS WHEN DATA LINE IS BLANK, IS **:", OR IS "END" CHECKS ALL GENERATED NODE NUMBERS .LE. NSYNOD

** CURRENTLY LIMITED TO FOUR-NODE ELEMENTS OR LESS ** DICTIONARY OF VARIABLES

VARIABLE

INPUT

ELEMO NELDOF KEQ

NSYNOD OUTPUT

MSYBAN

ERR LOCAL

LMNEW, LMOLD

NOLD, NNEW

INCR

DESCRIPTION

PROCEDURE NAME TO READ ELEMENT PROPERTY DATA NUMBER OF ELEMENT DEGREES OF FREEDOM

SYSTEM EQUATION NUMBERS (BY NODE NUMBER) NUMBER OF SYSTEM NODES

SYSTEM BAND WIDTH ERROR FLAG

ELEMENT LOCATION/CONNECTIVITY DATA

ELEMENT NUMBERS GENERATION INCREMENT

RETURN

ENDIF

c GENERATE MISSING ELEMENTS

IF (NNEW.GT.NOLD+1) THEN

DO 24 N-NOLD+1, NNEW-1,

1

DO 22 1-1, NELDOF

22 LMOLD (I) - LMOLD (I) + INCR CALL NDCHK ( LMOLD , NSYNOD , NELDOF , ERR) IF (ERR) RETURN CALL ELEMO (N, LMOLD, ERR)

IF (ERR) RETURN

24 CONTINUE

END IF

C DO NEW ELEMENT

NOLD - NNEW

DO 26 1-1, NELDOF

26 LMOLD (I) - LMNEW(I)

CALL NDCHK (LMOLD, NSYNOD, NELDOF, ERR)

IF (ERR) RETURN CALL ELBAN (KEQ, LMOLD, MSYBAN, NELDOF, NSYNOD) CALL ELEMO (NOLD, LMOLD, ERR)

IF (ERR) RETURN

GO TO 20

2200 FORMAT(* **•* ERROR: El«n»nt number *,15,' is out of ordsr . '

)

END

C ELBAN SUBROUTINE ELBAN ( KEQ, LM, MSYBAN, NELDOF, NSYNOD)

C—SUB: ELBAN - COMPUTES ELEMENT BANWIDTH 4 UPDATES SYSTEM BANDWIDTH

DIMENSION LM (NELDOF) , KEQ (NSYNOD)

INCLUDE IOCOM. INC

LOGICAL ERR

INTEGER NELDOF, LMNEW (4) , LMOLD (4) , NOLD, NNEW, KEQ (NSYNOD) EXTERNAL ELEMO

CC—1.0 GET FIRST LINE OF ELEMENT DATA

C INCR - 0 IF ( MODE. EQ. ’INTER*) CALL PROMPTC DATA> ’

)

CALL FREE

IF (MODE. EQ. ’BATCH*) CALL FREEWR(NTW)

C CHECK FOR "END"

IF(EOC) RETURN NOLD - 0 CALL FREEK’ *,NOLD,l)

IF (NOLD . EQ . 0) RETURN CALL FREEI( ’I’, LMOLD (1), NELDOF)

CALL NDCHK (LMOLD, NSYNOD, NELDOF, ERR) IF (ERR) RETURN CALL ELBAN (KEQ, LMOLD, MSYBAN, NELDOF, NSYNOD) CALL ELEMO (NOLD, LMOLD, ERR)

IF (ERR) RETURN

CC—2.0 GET NEXT LINE OF ELEMENT DATA

C

20 IF ( MODE. EQ. ’INTER’) CALL PROMPTC DATA> ’

)

CALL FREE

IF ( MODE. EQ. ’BATCH’) CALL FREEWR (NTW) C CHECK FOR "END"

IF(EOC) RETURN

C GET NEW ELEMENT INFORMATION NNEW - 0 CALL FREEIC *,NNEW,1)

IF (NNEW.EQ. 0) RETURN CALL FREEI (

’ I

’ , LMNEW (1) , NELDOF) CALL FREEK *N\ INCR, 1) IF (INCR.EQ. 0) INCR-1

C CHECK NUMERICAL ORDER

IF (NNEW. LE. NOLD) THEN WRITE (NTW, 2200) NNEW

WRITE (NOT, 2200) NNEW

ERR-. TRUE.

c DICTIONARY OF VARIABLES

C

C VARIABLE

C INPUT

C LM

C NELDOF

C MSYBAN

C KEQ

C NSYNOD

C OUTPUT

C MSYBAN

C MAX - ABS (KEQ (LM (1) )

)

MIN - ABS (KEQ (LH (2) )

)

DO 10 1-1, NELDOF

NN - ABS (KEQ (LM (I) )

)

IF (NN.CT.MAX) MAX-NN

IF (NN.LT.MIN) MIN-NN

10 CONTINUE

MELBAN - MAX-MTN+1

IF (MELBAN.CT. MSYBAN) MSYBAN-MELBAN

RETURN

END

C REPRTN SUBROUTINE REPRTN (X , KEQ, NX, NKEQ) C—SUB: REPRTN - REPORTS VECTOR (X)IN NODE ORDER SEQUENCE

C X (NX) - VECTOR OF VALUES ORDERED BY EQUATION NUMBER

C KEQ(NKEQ) - EQUATION NUMBERS ORDERED BY NODE NUMBER

C NEC - INDEPENDENT DOF

C 0 - UNDEFINED DOF

C POS - DEPENDENT DOF

C INDEPENDENT DOFS ARE FLAGGED WITH A

’*’ C UNDEFINED DOF ARE FLACED WITH A "U"

IMPLICIT REAL*8 (A-H, O-Z)

INCLUDE IOCOM. INC

REAL*0 X (NX) , XX (5) INTEGER KEQ(NKEQ) CHARACTER* 1 FLC(5)

WRITE (NOT, 2000)

IF (ECHO) WRITE (NTW, 2000)

DESCRIPTION

ELEMENT LOCATION/CONNECTIVITY ARRAY NUMBER OF ELEMENT DEGREES OF FREEDOM CURRENT SYSTEM BANDWIDTH SYSTEM EQUATION NUMBERS (BY NODE NUMBER) NUMBER OF SYSTEM NODES

UPDATED SYSTEM BAND WIDTH

Append -21
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

2000 FORMAT (/, .13X, '"*" - independent DOF* *U" - undefined DOF *.',//,

. 6X, 4 (2X, ’Node Value* , 3X) )

DO 100 N-1,NKEQ,

4

NN - MIN (N+3, NKEQ) DO 10 I-N,NN,1 NEQ - KEQ(I) NNEQ - ABS (NEQ) IF (NEQ. LT. 0) THEN

XX (I—N+l) - X (NNEQ)

FLG (I-N+l) - ELSEIF (NEQ. EQ. 0) THEN

XX (I-N+l) - 0.0D0 FLG (I-N+l) - ’U’ ELSE

XX (I-N+l) - X (NNEQ) FLC (I-N+l) - ’ ’ END IF 10 CONTINUE

IF (ECHO) WRITE (NTH, 2010) (I, FLC (I-N+l) , XX (I-N+l) , I-N, NN) 100 WRITE (NOT, 2010) (I, FLC (I-N+l) , XX (I-N+l) , I-N, NN)

2010 FORMAT ( (6X, 4 (16, 1A1, Cll . 3) )

)

RETURN

END

C REPRTE SUBROUTINE REPRTE (X, NX)

C—SUB: REPRTE - REPORTS VECTOR {X JIN ELEMENT ORDER SEQUENCE

C X (NX) - VECTOR OF VALUES ORDERED BY ELEMENT NUMBER

IMPLICIT REAL*8 (A-H, 0-2)

INCLUDE IOCOM. INC

DIMENSION X (NX)

WRITE (NOT, 2000)

IF (ECHO) WRITE (NTW, 2000) WRITE (NOT, 2010) (N, X(N), N-1,NX)

IF (ECHO) WRITE (NTW, 2010) (N, X(N), N-1,NX)

2000 FORMAT (/, 6X, 4 (2X, ’Elera Value*, 3X)

)

2010 FORMAT ((6X, 4(16, IX, Cll . 3) )

)

RETURN

END

C FORMF SUBROUTINE FORMF (KEQ, F, WE, FORM, ERR) C—SUB: FORMF - CALLS FORMFO TO FORM SYSTEM FLOW MATRIX

C ARRAY CONT USED TO CHECK NODAL MASS FLOW CONTINUITY COMMON MTOT, NP, IA (!)

INCLUDE CNTCOM8 6 . INC

IMPLICIT REAL* 8 (A-H, O-Z)

INCLUDE IOCOM » INC INCLUDE CNTCOM86 . INC

REAL* 8 F (NFEQN, 1) , WE (NFELM) , ELF (2, 2), CONT (NFEQN) , EFF INTEGER KEQ(NFNOD), LM(2) LOGICAL ERR CHARACTER FORM*

4

CC—1.0 FOR EACH ELEMENT FORM ELEMENT FLOW MATRIX AND ADD TO [F] C ACCUMULATE TOTAL MASS FLOW (CONTINUITY) AT EACH NODE

REWIND ND1 DO 10 N-l, NFELM

READ (ND1, ERR-900, END-900) LM(1) , LM(2) , EFF W - WE(N)

N1 - ABS ( KEQ ( LM ( 1 ) )

)

N2 - ABS (KEQ (LM(2) )

)

IF(W.CT.O.ODO) THEN

ELF (1,1) - W

ELF (1,2) - 0.0D0

ELF (2,1) - -W* (1 . 0D0—EFF) ELF (2,2) - 0.0D0 CONT (Nl) - CONT (Nl) + W

CONT (N2 ) - CONT (N2 ) - W

ELSEIF (W.LT.0.0D0) THEN

ELF (1,1) - 0.0D0

ELF (1,2) - W* (1 .000—EFF) ELF (2,1) - 0.0D0

ELF (2,2) - -W CONT (Nl) - CONT (Nl) + W

CONT (N2) - CONT (N2) - W

ELSECO TO 10 ENDIF

IF (FORM. EQ. ’BAND*) CALL ADDCA( KEQ, NFNOD, ELF, F, 2, NFEQN, MFBAN, LM) IF (FORM .EQ. ’FULL’) CALL ADDA (KEQ, NFNOD, ELF, F, 2, NFEQN, LM) 10 CONTINUE

C

C—2 . 0 REPORT NET TOTAL MASS FLOW

C WRITE (NOT, 2200)

IF (ECHO) WRITE (NTW, 2200) 2200 FORMAT ( /

, * — Net Total Maas Floe*) CALL REPRTN (CONT, KEQ, NFEQN, NFNOD)

RETURN

900 WRITE (NTW, 2900) WRITE (NOT, 2900) 2900 FORMAT

(

+ ' ERROR: Read or EOF error on flow element data file’) ERR - .TRUE. RETURN

REAL* 8 F (NFEQN, 1), WE (NFELM) INTEGER KEQ (NFNOD), MPCONT LOGICAL ERR CHARACTER FORM*4

END

c —ADDCA

SUBROUTINE ADDCA (KEQ, NSYNOD, ELA, SYA, NELDOF, NSYDOF, MSYBAN, LM) C—SUB: ADDCA - ADDS ELEMENT ARRAY TO COMPACT ASYMMETRIC SYSTEM ARRAY CALL DELETE (’CONT*) CALL DEF INR(* CONT MPCONT, NFEQN, 1) CALL ZEROR (IA( MPCONT) , NFEQN, 1)

IF (FORM. EQ. 'BAND’) CALL ZEROR (F, NFEQN, 2* MFBAN- 1) IF (FORM .EQ. ’FULL*) CALL ZEROR (F, NFEQN, NFEQN) CALL FORMFO ( KEQ, F, WE, IA( MPCONT), FORM, ERR)

CALL DELETE (* CONT’)

RETURN

END

C FORMFO SUBROUTINE FORMFO (KEQ, F, WE, CONT, FORM, ERR) C—SUB: FORMFO - FORMS SYSTEM FLOW MATRIX

C ARRAY CONT USED TO CHECK NODAL MASS FLOW CONTINUITY

C

‘ REAL*8 ELA (NELDOF, NELDOF) , SYA (NSYDOF, 1) INTEGER KEQ (NSYNOD) ,LM (NELDOF) C

C DICTIONARY OF

CC VARIABLE

C KEQ (NSYNOD) : C NSYNOD : C ELA (NELDOF, NELDOF) : C SYA(NSYDOF, 2* MSYBAN- 1) : C NELDOF

C NSYDOF : C MSYBAN : C LM (NELDOF) : C

c

VARIABLES

DESCRIPTION SYSTEM NODAL EQUATION NUMBERS NUMBER OF SYSTEM NODES ELEMENT ARRAY

COMPACTED ASYM. SYSTEM ARRAY

NUMBER OF ELEMENT DECREES OF FREEDOM NUMBER OF SYSTEM DECREES OF FREEDOM

HALF BANDWIDTH OF SYSTEM ARRAY ELEMENT LOCATION/CONNECTIVITY

DO 20 1-1, NELDOF Append -22
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

II - ABS (KEQ (LM (I) )

)

DO 10 J-l,NELDOF

JJ - MSYBAN - II ABS(KEQ(LM(J) )

)

SYA(II,JJ) - SYA (II, JJ) ELA(I,J)

10 CONTINUE

20 CONTINUE

RETURN

END

C- ADDA SUBROUTINE ADDA (KEQ, NSYNOD, ELA, SYA, NELDOF, NSYDOF, LM)

C—SUB:ADDCA - ADDS ELEMENT ARRAY TO FULL ASYMMETRIC SYSTEM ARRAY

C REAL* 8 ELA (NELDOF , NELDOF ) , SYA (NSYDOF, 1) INTEGER KEQ (NSYNOD ) , LM (NELDOF

)

C

C DICTIONARY 0

C

C VARIABLE

C KEQ (NSYNOD)

C NSYNOD

C ELA (NELDOF, NELDOF)

C SYA (NSYDOF, 2 *MSYBAN-1)

C NELDOF

C NSYDOF

C MSYBAN

C LM (NELDOF)

C

c DO 20 I -1, NELDOF

II - ABS (KEQ (LM(I) )

)

DO 10 J-l, NELDOF

JJ - ABS (KEQ (LM( J) )

)

SYA (II, JJ) - SYA (II, JJ) + ELA (I, J) 10 CONTINUE

20 CONTINUE

RETURN

END

C C

C C

C COMMAND PROCESSOR UTILITIES C

c c

c c

c

C NOPEN SUBROUTINE NOPEN (LUN, FNAME, FRM)

C —SUB: NOPEN - OPENS A FILE AS A NEW FILE WHETHER IT EXISTS OR NOT

C LUN - LOGICAL UNIT NUMBER

C FNAME - FILENAME

C FRM - FORM; ’UNFORMATTED’ OR ’FORMATTED’

INTEGER LUN CHARACTER FNAME* (*), FRM* (*) LOGICAL FOUND

INQUIRE (FILE-FNAME. EXIST-FOUND)

IF (FOUND) THEN

OPEN (LUN, FILE-FNAME, STATUS- ’OLD’ , FORM-FRM) IF (FRM. EQ. ’FORMATTED’) THEN WRITE (LUN, 2000) LUN

2000 FORMAT (16) ELSEIF (FRM. EQ. ’UNFORMATTED’) THEN WRITE (LUN) LUN

ENDIF CLOSE (LUN, STATUS- ’ DELETE »

)

OPEN (LUN, FILE-FNAME, STATUS- ’NEW’ , FORM-FRM) ELSEOPEN (LUN, FILE-FNAME, STATUS- ’NEW' , FORM-FRM)

END IF

RETURN

END

C PROMPT SUBROUTINE PROMPT (STRING) C—SUB: PROMPT - INLINE PROMPT

INCLUDE IOCOM. INC CHARACTER STRING* (*) WRITE (NTW, ’ (A, \) * ) STRING

RETURN

END

C PROMH SUBROUTINE PROMH (N) C—SUB: PROMH - "HOLLERITH PROMPT"

COMMON MTOT.NP, IA(1)

INCLUDE IOCOM. INC CHARACTER* 1 NCMND.M

COMMON /CMND/ NCMND (8) , M(4, 7)

C PROMPT FOR ARRAY NAMES

IF ( MODE. EQ. ’BATCH’) GO TO 900 DO 200 I— 1,

N

100 IF (M(l, N) .NE. ’ ’) GO TO 200 WRITE (NTW, 2000) N CALL FREE CALL FREECC ’

, M(l, N) , 8, 1) CO TO 100 200 CONTINUE

900 RETURN

2000 FORMAT (’ ** Entar array nan "’,111,’*: ’) END

C PROMI SUBROUTINE PROMI (NR, NC) C—SUB: PROMI - "INTEGER PROMPT"

INCLUDE IOCOM. INC

C ASK FOR NUMBER OF ROWS AND COLUMNS

IF (MODE. EQ. ’BATCH*) CO TO 900 100 IF(NR.CT.O) GO TO 200 CALL PROMPT (’ *• Entar nurabar of rows: ’) CALL FREE CALL FREEH’ \NR,1)

GO TO 100

200 IF(NC.GT.O) GO TO 900 CALL PROMPT (* ** Entar nurabar of columns: ’) CALL FREE CALL FREEH’ *,NC,1) GO TO 200

C

900 RETURN

END

C ABORT SUBROUTINE ABORT C—SUB: ABORT - ABORTS COMMAND AND RETURNS TO INTERACTIVE MODE

C INCLUDE IOCOM. INC

WRITE (NTW, 2000) WRITE (NOT, 2000) 2000 FORMAT (’ ***• COMMAND ABORTED’)

IF (MODE. EQ. ’BATCH’) CALL RETRN

RETURN

END

C

C C C CALSAPX LIBRARY C

C C C AN EXTENSION OF "CAL-SAP" LIBRARY OF SUBROUTINES C C DEVELOPED BY ED WILSON, U.C. BERKELEY C

C

C

C 1.0 FREE-FIELD INPUT SUBROUTINES

C

C FREE

F VARIABLES

DESCRIPTION

: SYSTEM NODAL EQUATION NUMBERS

: NUMBER OF SYSTEM NODES

: ELEMENT ARRAY

: COMPACTED ASYMc SYSTEM ARRAY

: NUMBER OF ELEMENT DECREES OF FREEDOM

: NUMBER OF SYSTEM DEGREES OF FREEDOM

: HALF BANDWIDTH OF SYSTEM ARRAY C

: ELEMENT LOCATION/CONNECTIVITY

Append -23
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

SUBROUTINE FREE

C-—SUB : FREE - READ LINE OF FREE FIELD DATA

C COMMENTS LINES ECHOED TO SCREEN

INCLUDE IOCOM. INC INCLUDE FRECOM. INC

CC-0.0- INITIALIZE VARIABLES

C EOD - .FALSE. EOC - .FALSE. DO 5 1-1,160

5 LINE (I) - * * CC-1.0 GET LINE OF DATA

C

10 I - 1 II- 80 READ (NCMD, 1000, ERR-100) (LINE (K) , K-I, II)

C CHECK FOR ADDITIONAL LINE

JJ - LENTRM (LLINE) DO 12 K—I, JJ

IF (LINE (K) .EQ. V V) THEN

I - K II- K+79

READ (NCMD, 1000, ERR-100) (LINE (KK) , KK-I, II) 1000 FORMAT (80A1) CO TO 14 ENDIF

12 CONTINUE

C CHECK FOR COMMENT

14 IF (LINE (1) .EQ. '’) THEN

IF (MODEoEQ. “BATCH 1

' ) CALL FREEWR(NTW) CALL FREEWR (NOT) GO TO 10 ENDIF

CC-2.0 DETERMINE LENGTH-OF-INFORMATION

C JJ - LENTRM (LLINE)

CC-3.0 DETERMINE LENCTH-OF-DATA AND CONVERT DATA TO UPPER CASE

C ISP - ICHAR ( ’ ') IA - ICHAR(’a') DO 30 I-1,JJ

IF (LINE (I) .EQ. ’<*) GO TO 32 NN - ICHAR (LINE (I)

)

IF(NN.CE.IA) LINE (I ) - CHAR (NN- ISP)

30 CONTINUE

32 II - I - 1 CC-4.0 CHECK FOR END-OF-DATACROUP & END-OF-COMMAND

C IF (LINE (1) .EQ. *<’) EOD - .TRUE.

IF (LINE (1) //LINE (2) //LINE (3) .EQ. ’ END ’ ) EOC - .TRUE.

RETURN

C ERROR IN READ

100 WRITE (NOT, 2000) WRITE (NTW, 2000) 2000 FORMAT ( ’ *** ERROR; Error in reading input lina.*) CALL ABORT

END

C FREEWR SUBROUTINE FREEWR (LUN)

C—SUB: FREEWR - WRITE COMMAND/DATA LINE TO FILE LUN

C LUN - LOGICAL UNIT NUMBER TO WRITE TO

INCLUDE IOCOM. INC INCLUDE FRECOM. INC

WRITE (LUN, 2000) (LINE (I) , 1-1, JJ) 2000 FORMAT (1X,80A1)

RETURN

END

C— — FREEFN SUBROUTINE FREEFN (SEP, NC, FOUND) C—SUB: FREEFN - FINDS NEXT NC-CHARACTER SEPARATOR IN INPUT FILE

C SEP (NC) *1 - CHARACTER STRING

INCLUDE IOCOM. INC INCLUDE FRECOM. INC

CHARACTER* 1 SEP(NC) LOGICAL FOUND

FOUND - .FALSE.

50 CALL FREE

IF (NC .LE. II) THEN

DO SO N-l , NC

60 IF (SEP (N) .NB.LINE (N) ) GO TO 50 FOUND - .TRUE. RETURN

ELSE

CO TO 50 ENDIF

RETURN

END

C FREER SUBROUTINE FREER (IC, DATA, NUM) C—SUB: FREER - FIND AND INTERPRET REAL DATA

C IC*i - DATA IDENTIFIER CHARACTER

C DATA - REAL DATA RETURNED

C NUM - NUMBER OF DATA VALUES TO EXTRACT

IMPLICIT REAL*8 (A-H,0-Z) DIMENSION DATA (10) CHARACTER IC*1

INCLUDE FRECOM. INC

C —FIND REAL STRING —

90 1-0

IF (IC . EQ. *

* ) CO TO 250 DO 100 1-1,11

IF ( (LINE (I) .EQ. IC) .AND . (LINE (I+l) .EQ. ? -' ) ) GO TO 250 100 CONTINUE

RETURN

C EXTRACT REAL DATA

250 DO 260 J-l, NUM

260 DATA (J) -0.0

DO 300 J-l, NUM

JJ-0

270 IF(I.CT.II) GO TO 300 CALL FREER1 ( I , XX , NN

)

IF ( JJ.NE . 0) GO TO 275 DATA(J) - XX GO TO 290

C ARITHMETRIC STATEMENT

275 IF ( JJ.EQ. 1) DATA (J) -DATA (J)*XX

IF ( JJ.EQ. 2) DATA (J) -DATA (J) /XX

IF (JJ.EQ. 3) DATA (J) -DATA (J)+XX

IF (JJ.EQ. 4) DATA (J) -DATA (J) -XX

IF (JJ.NE. 5) CO TO 290

C EXPONENTIAL DATA

JJ - DABS (XX) IF (JJ.EQ. 0) GO TO 290 DO 280 K-l, JJ

IF (XX. LT. 0.0) DATA ( J) - DATA(J)/10.

IF (XX. CT. 0.0) DATA ( J) - DATA (J) *10. 280 CONTINUE

C SET TYPE OF STATEMENT

290 JJ-0

IF (LINE (I) . EQ. ' * * ) JJ-1 Append -24
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

IF (LINE (I) .EQ. */*) JJ-2

IF (LINE (I) .EQ. '+' ) JJ-3

IF (LINE (I) .EQ. *-*) JJ-4

IF (LINE (I) .EQ. ’EM JJ-5

IF (LINE (1+1) .EQ. *-* ) JJ-0

IF ( JJ.NE . 0) CO TO 270

IF (NN.CT. 9) RETURN

300 CONTINUE

RETURN

END

C FREER1 SUBROUTINE FREER1 (I, XX, NN) C-SUB: FREER1 - INTERPRETS A SINGLE REAL VALUE

IMPLICIT R£AL*8 (A-H.O-Z)

INCLUDE FRECOM. INC

C CONVERT STRING TO REAL FLOATING POINT NUMBER —

IF (LINE (1+1) .EQ. ’ -' ) I-I+l Y-0

IS-1 XX-0.0

IF (LINE (1+1) .EQ. *-* ) THEN IS—

1

I-I+l ELSEIF (LINE (1+1) . EQ. *+* ) THEN

IS-1 I-I+l

ELSECONTINUE

ENDIF 267 IF (LINE ( 1+1 ) . NE . * ') GO TO 270 I-I+l

IF(I.CT.II) GO TO 300 GO TO 267 270 I-I+l

IF(I.CT.II) GO TO 300

IF ( (LINE (I) .EQ. f ’) .AND. (LINE (1+1) .EQ. * ')) CO TO 270 NN - ICflAR ( LINE (I) ) - ICHARCO*)

XN-ISIGN (NN, IS) IF (LINE (I) .NE. ' .

* ) GO TO 275 Y—1.0 GO TO 270

275 IF(LINE(I) .EQ. f *

) GO TO 300

IF (LINE (I) .EQ. ' ,

' ) GO TO 300

IF ( (NN.LT. 0) .OR. (NN.CT. 9) ) GO TO 300 IF(Y.EQ.O) GO TO 280 Y-Y/10

.

XN-XN*Y

XX-XX+XN

GO TO 270

280 XX-10 . *XX+XN

GO TO 270

300 RETURN

END

c FREEI SUBROUTINE FREEI ( IC , IDATA, NUM)

C —SUB: FREEI - FIND AND INTERPRET INTEGER DATA

C IC*1 - DATA IDENTIFIER CHARACTER

C IDATA - INATECER DATA RETURNED

C NUM - NUMBER OF DATA VALUES TO EXTRACT

CHARACTER* 1 IC,LNE DIMENSION IDATA (72)

INCLUDE FRECOM. INC

DO 250 J—1 , NUM

ISICN - 1 C SKIP BLANKS BETWEEN INTEGERS

215 IF (LINE (1+1) .NE. *

’ ) GO TO 220 I-I+l IF(I.CT.II) GO TO 900 CO TO 215 220 I-I+l IF(I.CT.II) GO TO 230

C CHECK FOR SIGN

LNE - LINE (I) IF (LNE.NE. *-* ) GO TO 225 ISICN - -1 CO TO 220

C EXTRACT INTEGER

225 IF (LNE . EQ. *

• ) CO TO 230

IF (LNE.EQ. ’ ,

' ) CO TO 230

IF (LNE.EQ. * :

' ) CO TO 230 NN - ICflAR (LNE) - I CHAR ( 'O’

)

IF ( (NN.LT. 0) .OR. (NN.CT. 9) ) GO TO 900 IDATA (J) -10* IDATA (J) +NN

CO TO 220

C SET SIGN

230 IDATA (J) - IDATA (J)* ISICN

250 CONTINUE

900 RETURN

END

c FREEC SUBROUTINE FREEC (IC, IDATA, NC, NUM) C—SUB: FREEC - FIND AND INTERPRET CHARACTER DATA

C IC*1 - DATA IDENTIFIER CHARACTER

C IDATA - CHARACTER DATA RETURNED

C NC - NUMBER OF CHARACTERS PER DATA VALUE

C NUM - NUMBER OF DATA VALUES TO EXTRACT

CHARACTER* 1 IC, IDATA DIMENSION IDATA (NC, NUM)

INCLUDE FRECOM. INC

C FIND DATA IDENTIFIER

90 1-0

IF (IC.EQ. ’ ’) GO TO 200 DO 100 1-2,11

IF ( (LINE (1-1) .EQ. IC) . AND . (LINE (I) .EQ. ’ - ’ ) ) CO TO 200

100 CONTINUE

RETURN

-EXTRACT CHARACTER DATA —

N oo DO 210 J-l.NUM

DO 210 N-l.NC

210 IDATA (N,J)-' ’

DO 300 J-l.NUM

260 I-I + l IF(I.CT.II) CO TO 400

IF (LINE (I) .EQ. ') GO TO 260 IF(LINE(I) .EQ. 1 ’) GO TO 260 DO 290 N-1,NC

IF (LINE (I) .EQ. '

:

CO TO 300

IF (LINE (I) .EQ. ' ’) GO TO 300

IF (LINE (I) .EQ. ') CO TO 300 IDATA (N,J) - LINE (I) IF (N.EQ.NC) CO TO 290 I-I + l 290 CONTINUE

300 CONTINUE

400 RETURN

END

C FIND INTEGER STRING

90 1-0

IF (IC.EQ. * ') CO TO 200 DO 100 1-1,11

IF ( (LINE (I) .EQ. IC) .AND . (LINE (1+1) .EQ. *-* ) ) GO TO 200

100 CONTINUE

RETURN

C ZERO INTEGER STRING

200 DO 210 J—1, NUM

210 IDATA (J)-0

IF (LINE (1+1) .EQ. ) I-I+l

C LENTRM FUNCTION LENTRM (STRING) C—FUN: LENTRM - DETERMINES LENGTH OF TRIMMED STRING - A STRING WITH

C TRAILING BLANKS REMOVED

C

C LENTOT s THE TOTAL LENGTH OF THE STRING

C LENTRM : THE LENGTH OF THE TRIMMED STRING

C CHARACTER STRING* (*) INTEGER LENTOT, LENTRM Append -25
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

LENTOT - LEN (STRING)

DO 10 I -LENTOT, 1 , -1

IF (STRING (I si) .NE. * *> GO TO 20

10 CONTINUE

20 LENTRM - I

RETURN

END

CC 2.0 DYNAMIC ARRAY MANAGEMENT

C

C DEFINR SUBROUTINE DEFINR (NAME, NA, NR, NC) C—SUB: DEFINR - DEFINE DIRECTORY AND RESERVE STORAGE

C FOR REAL ARRAY IN DATABASE

C NAME - NAME OF ARRAY

C NA BLANK COMMON POINTER TO ARRAY (RETURNED)

C NR NUMBER OF ROWS

C NC NUMBER OF COLUMNS

C COMMON MTOT, NP, IA (1) CHARACTER*! NAME (4) NP - 2 CALL DEFIN (NAME, NA, NR, NC) RETURN

END

C DEFINI SUBROUTINE DEFINI (NAME, NA, NR, NC)

C—SUB : DEFINI - DEFINE DIRECTORY AND RESERVE STORAGE

C FOR INTEGER ARRAY IN DATABASE

C NAME - NAME OF ARRAY

C NA BLANK COMMON POINTER TO ARRAY (RETURNED)

C NR NUMBER OF ROWS

C NC NUMBER OF COLUMNS

C COMMON KTOT, NP, IA(1) CHARACTERS NAME (4) NP - 1 CALL DEFIN (NAME, NA, NR, NC) RETURN

END

C DEFINC SUBROUTINE DEFINC (NAME, NA, NR, NC) C—SUB: DEFINC - DEFINE DIRECTORY AND RESERVE STORAGE

C FOR CHARACTER* 1 (HOLLERITH) ARRAY IN DATABASE

C NAME - NAME OF ARRAY

C NA BLANK COMMON POINTER TO ARRAY (RETURNED)

C NR NUMBER OF ROWS

C NC NUMBER OF COLUMNS

C CHARACTER*! NAME (4) COMMON MTOT,NP,IA(l)

NP - 3 CALL DEFIN (NAME, NA, NR, NC) RETURN

END

CC

C

c

c

c

c

c

c-cc

c

c

c

c

c

c

c

c-c

c

c

c

cc

ccc*

100

900 2000

NEXT - NEXT AVAILABLE STORAGE LOCATION

IDIR - START OF DIRECTORY IN BLANK COMMON

IP - NUMBER OF LOCICALS CONTAINED IN DATA TYPE LENR - NUMBER OF LOCICALS IN PHYSICAL RECORD

NP - TYPE OF DATA

- 1 INTEGER DATA

- 2 REAL DATA

- 3 LOGICAL DATA

-DIRECTORY DEFINITION FOR CORE OR SEQUENTIAL FILES

XDXR(1,N) - NAME OF ARRAY - INAMB (4 CHAR.) IDIR (5, N) - NUMBER OF ROWS - NR

IDIR(6, N) - NUMBER OF COLUMNS - NC IDIR (7, N) - TYPE OF DATA - NP

IDIR (8, N) - INCORE ADDRESS - NA

- -1 IF SEQUENTIAL FILE ON DISK

- -2 IF DIRECT ACCESS ON DISK

IDIR(9,N) - SIZE OF ARRAY

IDIR (10, N) - 0 IF IN CORE STORAGE -DIRECTORY DEFINITION FOR DIRECT ACCESS FILES IDIR (5, N) - NUMBER OF INTEGERS

IDIR(6,N) - NUMBER OF REAL WORDS

IDIR (7, N) - NUNBER OF LOCICALS

IDIR (8, N) - NUMBER OF LOGICAL RECORDS

IDIR(9,N) - LOGICAL RECORD NUMBER

IDIR (10, N) - LUN IF ON LOGICAL UNIT LUN

EVALUATE STORAGE REQUIREMENTS

NSIZE - (NR*NC*IP (NP) -1) / (IP (1) *2) NSIZE - NSIZE*2 2 NA - NEXT

NEXT - NEXT NSIZE

SET UP NEW DIRECTORY NUMA - NUMA + 1 IDIR - IDIR - 10

I - IDIR CHECK STORAGE LIMITS

IF (I .GE .NEXT) GO TO 100

I - NEXT - X + MTOT - 1 WRITE (NTW, 2000) I, MTOT

WRITE (NOT, 2000) I, MTOT

PAUSE

STOP CALL ICON (NAME, IA( I) ) IA(I+4) - NR

IA(I+5) - NC

IA (1+6) - NP

IA ( 1+7 ) - NA

IA (1+8) - NSIZE

IA (1+9) - 0 RETURN FORMAT

(

» **** ERROR: Insufficient blank COMMON storage.',/,

' * Storage required MTOT -',17,/, Storage available MTOT -’,17)

END

C SUBROUTINE DEFDIR (NAME, NR, NC, ISTR) C—SUB : DEFDIR - DEFINE DIRECTORY FOR OUT-OF-CORE FILE

c NAME - NAME OF ARRAY

c NR - NUMBER OF ROWS

c NC - NUMBER OF COLUMNS

c ISTR - OUT OF CORE FLAG

C- C DEFIN COMMON KTOT, NP, I* (1) SUBROUTINE DEFIN (NAME, NA, NR, NC) INCLUDE ARYCOM.INC

C -DEFINE AND RESERVE STORAGE FOR ARRAY INCLUDE IOCOM.INC

COMMON WTOT.NP, IA(1) INCLUDE ARYCOM.INC

INCLUDE IOCOM.INC

CHARACTER* 1 NAME (4) C DEFIN VARIABLES

C NAME - NAME OF ARRAY - 4 LOCICALS MAXIMUM

C NA - LOCATION OF ARRAY IF IN BLANK COMMON

C NR - NUMBER OF ROWS

C NC - NUMBER OF COLUMNS

C MTOT - END OF DIRECTORY

C NUMA - NUMBER OF ARRAYS IN DATA BASE

CHARACTER* 1 NAME Ml

C EVALUATE STORACE REQUIREMENTS

IF (NP.EQ.O) NF - 2 C SET UP NEW DIRECTORY NUMA - NUMA + 1 IDIR - IDIR - 10

I - IDIR

C CHECK STORACE LIMITS

IF (I.CE.NEXT) CO TO 100

I - NEXT - I + MTOT - 1 WRITE (NTN, 2000) I, MTOT Append -26

DEFDIR
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

WRITE (NOT, 2000) I , MTOT

PAUSE

STOP

100 CALL ICON (NAME, IA (I) ) IA (1+4) - NR

IA (1+5) - NC

IA(I+6) - NP

IA (1+7 ) - ISTR

IA (1+8) - 0 IA (1+9) - 0 900 RETURN

2000 FORMAT

(

*' *** ERROR: Insufficient blank COMMON storage.',/,

** Storage required MTOT -’,17,/,

* ' Storage available MTOT -’,17) END

C SUBROUTINE LOCATE (NAME, NA, NR, NC) C—SUB : LOCATE - LOCATE ARRAY "NAME- AND RETURN

C NA - POINTER TO LOCATION IN BLANK COMMON

C NR - NUMBER OF ROWS

C NC - NUMBER OF COLUMNS

C COMMON MTOT, NP, IA(1)

CHARACTER* 1 NAME DIMENSION NAME ( 4 ) , INAME ( 4

)

C LOCATE AND RETURN PROPERTIES ON ARRAY NA - 0 CALL ICON (NAME, INAME)

I - IFIND (INAME, 0) IF(I.EQ.O) CO TO 900

C RETURN ARRAY PROPERTIES NA - IA (1+7) NR - IA (1+4

)

NC - IA (1+5) NP - IA (1+6) 900 RETURN

END

C SUBROUTINE DELETE (NAME)

C—SUB: DELETE - DELETE ARRAY "NAME" FROM DATABASE

COMMON MTOT, NP, IA (1

)

INCLUDE ARYCOM . INC INCLUDE IOCOM. INC

CHARACTER* 1 NAME DIMENSION NAME (4) , INAME (4) C DELETE ARRAY FROM STORAGE

100 CALL ICON (NAME, INAME)

I - IFIND (INAME, 0) IF(I.EQ.O) CO TO 900

C CHECK ON STORAGE LOCATION

200 NSIZE - IA (1+8)

C SET SIZE OF ARRAY NEXT - NEXT - NSIZE NUMA - NUMA - 1 NA - IA (1+7)

C CHECK IF OUT OF CORE OR DIRECT ACCESS

IF (NA.CT. 0) CO TO 500 WRITE (NTW, 1000) NAME WRITE (NOT, 1000) NAME

CO TO 800

500 IF (NA . EQ . NEXT) CO TO 800

C COMPACT STORAGE

II - NA + NSIZE NNXT - NEXT - 1 DO 700 J-NA, NNXT

IA ( J) - IA (II) 700 II - II + 1 C COMPACT AND UPDATE DIRECTORY

800 NA - I - IDIR

IDIR - IDIR + 10

IF (NA.EQ.O) CO TO 900 NA - NA/10

DO 860 K—1, NA

II - I + 9

DO 850 J-1,10

IA (II) - IA (II—10) 850 II - II - 1 IF(IA(I+7) LE.O) CO TO 860

IF (IA(I+9) .EQ.O) IA ( 1+7 ) - IA(I+7) - NSIZE

860 I - I - 10

C 900 RETURN

1000 FORMAT ( ' — Naras *,4A1,' is being used for an’,

* ' OUT-OF-CORE file.',/)

END

C~ ICON SUBROUTINE ICON (NAME, INAME) CHARACTER*1 NAME (4) DIMENSION INAME (4) C CONVERT LOCICALS TO INTEGER DATA LOCATE DO 100 1-1,4

100 INAME (I) - XCHAR ( NAME (I) ) C RETURN

END

C FUNCTION IFIND (INAME, LUN) C—FUN: IFIND - FIND COMMON MTOT , NP , IA ( 1

)

INCLUDE ARYCOM. INC

DIMENSION INAME (4) C FIND ARRAY LOCATION

I - IDIR

DO 100 N—1, NUMA

IF (LUN.NE . IA(I+9) ) CO TO

IF (INAME (1) .NE.IA(I )) IF (INAME (2) .NE. IA(I+1)

)

IF (INAME (3) .NE.IA(I+2))

IF (INAME (4) . EQ. IA(I+3)

)

100 I - I + 10

I - 0 200 IFIND - I

100 CO TO 100 GO TO 100 GO TO 100 GO TO 200

DELETE C RETURN

END

C

C 3.0 MATRIX OPERATION UTILITIES

C

C SUBROUTINE ZEROI (IA, NR, NC) C—-SUB : ZERORI - SET ARRAY IA(NR,NC) TO 0 DIMENSION LA (NR, NC) DO 10 1-1, NR

DO 10 J-l, NC

IA ( I , J) - 0 10 CONTINUE

RETURN

END

IFIND

ZEROI

C ZEROR SUBROUTINE ZEROR (A, NR, NC) C—SUB: ZEROR - SET ARRAY A (NR, NC) TO 0.0 REAL*8 A (NR, NC) DO 10 I—1 , NR

DO 10 J-l, NC A(I,J) - 0.0D0

10 CONTINUE

RETURN

END

C FACTCA SUBROUTINE FACTCA (A, NEQ, MBAND, ERR) C—SUB : FACTCA - FACTORS COMPACT ASYMMETRIC MATRIX

C FACTORS [A] - [L] [U] C [L) [U] IS WRITTEN OVER [A] C (A) MAYBE SYM OR ASYM, POSITIVE DEFINITE

C (A) HAS SEMI -BANDWIDTH MBAND & IS STORED COMPACTLY

C FROM: HUEBNER 4 THORNTON "THE FINITE ELEMENT METHOD FOR ENCRS .

Append -27
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

IMPLICIT REAL*8 (A-H,0-Z)

INCLUDE IOCOM.INC

DIMENSION A(NEQ,2*MBAND-1) LOGICAL ERR

NCOLS - 2*MBAND-1

KMXN - MBAND 1 DO 50 N-1,NEQ

IF (A(N, MBAND) .EQ.0.0D0) GO TO 60 IF(A(N, MBAND) .EQ.1.0D0) GO TO 20

C - 1.0D0/A(N, MBAND) DO 10 K-KMIN, NCOLS

IF(A(N,K) .EQ.0.0D0) CO TO 10 A(N, K) - C*A(N,K)

10 CONTINUE

20 CONTINUE

DO 40 L-2, MBAND

JJ - MBAND - L 1

I - N L - 1 IF (I .CToNEQ) GO TO 40

IF (A(I, JJ) .EQ.0.0D0) GO TO 40

KI - MBAND + 2 - L

KF - NCOLS + 1 - L

J - MBAND

DO 30 K-KI, KF

J - J 1 IF(A(N, J) .EQ.0.0D0) GO TO 30 A(I,K) - A ( I , K) - A(I, JJ) *A(N, J) 30 CONTINUE

40 CONTINUE

50 CONTINUE

RETURN

60 ERR - .TRUE. WRITE (NTW, 2000) N WRITE (NOT, 2000) N RETURN

2000 FORMAT (' ERROR: SUB:FACTCA - Equation* may be singular.',/,

+ * Diagonal of aquation number ',15,' i* zero.') END

SUBROUTINE SOLVCA(A, B, NEQ, MBAND, ERR)

C—SUB : SOLVCA -SOLVES COMPACT ASYMMETRIC FACTORED MATRIX

CC

c

c

ccSOLVES [L] [U] (X) - (B)

[L) [U] IS WRITTEN OVER (A) [L]tU)»(A] HAS SEMI-BANDWIDTH MBAND t IS STORED COMPACTLY

SOLUTION IS WRITTEN OVER ( B > FROM: HUEBNER 6 THORNTON "THE FINITE ELEMENT METHOD FOR ENCRS .

IMPLICIT REAL*8 (A-H,0-Z)

INCLUDE IOCOM.INC

DIMENSION A (NEQ, 2*MBAND-1 )

,

B (NEQ) LOGICAL ERR

LL - MBAND 1 DO 50 M-l, NEQ

N - NEQ h* 1 — M

DO 40 L-LL, NCOLS

IF(A(N,L) .EQcO.ODO) GO TO 40 K - N + L - MBAND

B(N) - B (N) - A (N, L) *B (K) 40 CONTINUE

50 CONTINUE

RETURN

60 ERR - .TRUE. WRITE (NTW, 2000) N RETURN

2000 FORMAT (' **** ERROR: SUB: SOLVCA - Equation* may be singular.',/,

*>’ Diagonal of equation number ',15,' ia zero.') END

: EICEN2 SUBROUTINE EIGEN2 (A, T, N, TMX, EP) -SUB: EICEN2 - Unsyrametric Eigen Analysis Routine Based on code from: Wilkinson, J.H. 6 Reinseh, C., Linear Algebra, SpringerVerlag, 1971 Solves eigenproblem for real matrix A(N,N), sym. or unsyre. , by

a sequence of Jacobi-like transformations [T]-1[A)[T] where [T]- [T1)[T2][T3] Each [Ti] is of the form [Ri] [Si] where;

Rs Rk,k - Rra, m - cos (x) Ri e i “ 1 S: Sk,k « Sre, ra - cosh(y) Si,i - 1

; Rra, k - -Rk,m - sin(x)

Ri, j - 0 ; (i, j - k, re)

; Sra, k - Sk„ra - -sinh(y)

Si, j - 0 ; (i, j - k,m)

in which x,y are determined by the elements of [Ai]

.

In the limiting matrix real eigenvalues occupy the diagonal while

real and imaginary parts of conplex eigen values occupy the diagonal and off-diagonal corners of 2x2 blocks centered on diag

.

Array T(N,N) must be provided to receive eigenvectors.

TMX-0 : eigenvectors not generated and A(N,N) may be passed as T (N, N) TMX<0 : generate left, [T]-l, transformations

TMX>0 : generate right, [T] , transformations

Eigenvectors of real eigenvalues occurr as rows (cols) of [T]-l

( [T] ) . Eigenvectors for a conplex eigenvalue pair aj,i 1 iaj,j+l

may be formed by tj 1 itj+1 where tj, tj+1 are the corresponding

rows (cols) of [T)-l ( [T]

)

Iterations are limited to 50 maximum. On exit from the procedure

TMX records the number of iterations performed. Failure to converge is indicated by TMX-50 or, if all transformations in one iteration are the identity matrix, by TMX<0.

The machine dependent variable EP is set to IE-08 and should be reset for machine precision available. DICTIONARY OF VARIABLES

C —VARIABLE

INPUT

DESCRIPTION

— ^°ntUUMU i c A (N, N) Array to be analyzed.

1.0 REDUCTION OF (B) c N System size

DO 30 N-l, NEQ

c TMS Control parameter

IF (A(N, MBAND) .EQ.0.0D0) CO TO 60 c T(N,N) Array to receive eigenvectors.

IF (A(N, MBAND) .EQ.1.0D0) CO TO 10 c TMX Iteration count/iteration flag

B (N) - B (N) /A (N, MBAND) C LOCAL

10 CONTINUE

c EP Pr.ei.lon

DO 20 L-2, MBAND IMPLICIT R£AL*8(A-H,0-Z>

JJ - MBAND - L + 1 REAL*8 A(N,N) ,,T(N,N> ,EP

I - N + L -1 INTEGER N, TMX

IF(I.CT.NEQ) CO TO 20 LOGICAL MARK, LEFT, RIGHT

IF (A(I,JJ) .EQ.0.0D0) CO TO 20

c

B (I) - B (I) - A (I, JJ) *B (N) 20 CONTINUE

30 CONTINUE

C —2.0 BACKSUBSTITUTION

C—0.0 INITIALIZE CONTROL VARIABLES

C IF(EP.LE.O.ODO) EP - 1 . 0D-8 EPS - SQRT(EP) LEFT - .FALSE. RIGHT - .FALSE. Append -28
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

IF (TMX.LT. 0) THEN C LEFT - .TRUE. IF (ABS (C) .LE.EP) THEN

ELSEIF (TMX.GT.O) THEN CX - 1.0D0 RIGHT - .TRUE. SX - O.ODO ENDIF ELSE MARK - .FALSE. COT2X - D/C

C SIC - SIGN (1.0, COT2X)

C—1.0 INITIALIZE [T] AS IDENTITY MATRIX COTX - COT2X + ( SIC* SQRT (1.0D0 COT2X*COT2X)

)

C SX - SIC/SORT (1.0D0 COTX*COTX)

IF (TMX.NE . 0) THEN CX - SX*COTX

DO 10 I-1,N ENDIF

T(I,I) - 1.0D0

DO 10 J-I+1,N IF(YH.LT. O.ODO) THEN

T(I,J) - O.ODO TEM - CX T ( J, I) - 0.0D0 CX - SX

10 CONTINUE SX - -TEM

ENDIF ENDIF

cC—2.0 MAIN LOOP COS2X - CX*CX - SX*SX

C SIN2X - 2 . 0D0*SX*CX

DO 26 IT-1,50 D - D*COS2X + C*SIN2X

C H - H*COS2X - HJ*SIN2X C—2.1 IF MARK IS SET DEN - C 2 . 0D0* (E*E D*D)

C TRANSFORMATIONS OF PREVIOUS ITERATION WERE OMITTED TANHY - (E*D - H/2.0D0)/DEN

C PROCEEDURE WILL NOT CONVERGE C

C C COMPUTE ELEMENTS OF [Si) IF (MARK) THEN C TMX - 1-IT IF (ABS (TANHY) .LE.EP) THEN RETURN CHY - 1.0D0 ENDIF SHY - O.ODO

C ELSE C—2.2 COMPUTE CONVERGENCE CRITERIA CHY - 1 . ODO/SQRT (1 . 0D0 - TANHY*TANHY)

c SHY - CHY*TANHY

DO 20 I-1,N-1 ENDIF

All = All, I) C DO 20 J-X+1,N C COMPUTE ELEMENTS OF [Ti] - [Ri] [Si] AIJ - A (I, J) C AJI - A ( J, I) Cl - CHY*CX - SHY*SX

IF ( (ABS (AIJ+AJI) .CT. EPS) .OR. C2 - CHY*CX SHY*SX

( (ABS (AIJ-AJI) .CT. EPS) .AND. (ABS (AII-A( J, J) ) .CT.EPS) )

)

THEN SI - CHY*SX SHY*CX GOTO 21 S2 - -CHY*SX + SHY*CX

ENDIF C 20 CONTINUE C APPLY TRANSFORMATION IF WARRANTED

TMX - IT -1 C RETURN IF | (ABS (SI) .GT.EP) .OR. (ABS (S2) .CT.EP)) THEN

C MARK - .FALSE. C—2.3 BEGIN NEXT TRANSFORMATION C TRANSFORMATION ON THE LEFT

c DO 23 1*1,

N

21 MARK - .TRUE. AKI - AIK, I) DO 25 K-l.N-l AMI - A (M, I) DO 25 M-K+1,N A (K, I) - C1*AKI S1*AMI

H - 0.0D0 A (M, I) - S2*AKI C2*AMI

G - 0.0D0 IF (LEFT) THEN

HJ - 0.0D0 TKI - TIK, I) YH - O.ODO TMI - TIM, I) DO 22 I-l.N T(K, I) - C1*TKI + S1*TMI AIK - All, K) T(M, I) - S2*TKI + C2*TMI AIM - All, M) ENDIF

TE - AIK*AIK 23 CONTINUE

TEE - AIM*AIM c TRANSFORMATION ON THE RIGHT

YH - YH + TE - TEE DO 24 I-1,N

IF(II.NE.K) .AND. (I.NE.M)) THEN AIK - A (I, K) AKI - A|K, I) AIM - A (I, M) AMI - AIM, I) All, K) - C2*AIK - S2*AIM

H - H + AKI*AMI - AIK*AIM All, M) - -S1*AIK + C1*AIM

TEP - TE + AMI*AMI

IF (RIGHT) THEN

TEM - TEE + AKI*AKI TIK - TII, K) TIM - T II, M) G - G TEP + TEM

T (I, K) - C2*TIK - S2*TIM

HJ - HJ - TEP + TEM

T (I, M) - -S1*TIK + C1*TIM

ENDIF

ENDIF

22 CONTINUE

24 CONTINUE

H - H + H ENDIF

D - AIK, K) - AIM, M) 25 CONTINUE AKM - A(K, M) 26 CONTINUE AMK - A (M, K) TMX - 50 C - AKM AMK

E - AKM - AMK RETURN

c END

C COMPUTE ELEMENTS OF [Ri] Append -29
NBS: Indoor Air Quality Model

Phase II Report

Appendix - FORTRAN 77 Source Code

Include Files:

c

C CALSAPX ARRAY MANAGEMENT SARYCOM.INC

C COMMON /ARYCOM/ NUMA, NEXT, IDIR, IP (3)

C VARIABLE

C MTOT

C NP

C IA(WTOT)

C NUMA

C NEXT

C IDIR

C IP (3) C

DESCRIPTION

SIZE OF BLANK COMMON VECTOR IA CURRENT DATA TYPE: 1-INTEGER: 2-REAL; 3-CHAR. BLANK COMMON VECTOR NUMBER OF ARRAYS IN BLANK COMMON DATA BASE NEXT AVAILABLE STORAGE LOCATION IN BLANK COMMON

START OF DIRECTORY IN BLANK COMMON NUMBER OF BYTES IN INTEGER, REAL, CHARACTER DATA

C CALSAPX I/O FILE MANAGEMENT SIOCOM.INC

INTEGER LFNAME LOGICAL ECBO, EOD, EOC CHARACTER*1 FNAME'12, EXT*3, MODE'S COMMON /IOCOM1/NTR, NTH, NCMD , NIN, NOT, ND1,ND2,ND3,ND4,

+LFNAME, ECBO, EOD, EOC COMMON /IOCOM2 / MODE, EXT, FNAME -VARIABLE DESCRIPTION

/IOCOM/ NTR LOGICAL UNIT NUMBER FOR TERMINAL-READ (KEYBOARD) NTH LOGICAL UNIT NUMBER FOR TERMINA-WRITE (SCREEN) NCMD LOGICAL UNIT NUMBER FOR COMMAND/DATA INPUT

NIN LOGICAL UNIT NUMBER FOR INPUT DATA ASCII FILE NOT LOGICAL UNIT NUMBER FOR OUTPUT DATA ASCII FILE

ND1 thru ND4 LOGICAL UNIT NUMBERS FOR GENERAL USE FNAME*12 RESULTS OUTPUT FILE NAME LFNAME LENGTH OF FILENAME WITH TRAILING BLANKS REMOVED

EXT' 3 RESULTS OUTPUT FILE EXTENSION

MODE COMMAND MODE: • INTER ’ -INTERACTIVE ,

1 BATCH • -BATCH ECHO WHEN .TRUE. ECHO RESULTS OUTPUT TO NTW (SCREEN) EOD END-OP-DATA LOGICAL

EOC END-OF-COf*1AND LOGICAL

REAL'S EP COMMON /CNTCOM/NFNOD , NFEQN, MFBAN, NFELM, EP, +MPV, MPF , MPC , MPC , MPKEQ, MPWE

-VARIABLE

ERR NFNOD NFEQN

MFBAN NFELM

EP POINTERS

POINTER—ARRAY

-DESCRIPTION- DO-WHILE TERMINATOR FLAG NUMBER OF FLOW SYSTEM NODES NUMBER OF FLOW SYSTEM EQUATIONS

- NFNOD (CURRENT VERSION)

(HALF) BANDWIDTH OF FLOW SYSTEM EQUATIONS NUMBER OF FLOW ELEMENTS

MACHINE PRECISION TO BLANK COMMON LOCATIONS

c MPV V (NSNOD) : VOLUMETRIC MASSES

c MPF F (NFEQN, 2*MSBAN-1)

:

FLOW MATRIX (UNSYMMETRIC)

c MPC C (NFEQN) : CONTAMINANT CONCENTRATION

c MPC C (NFEQN) : CONTAMINANT GENERATION

c MPKEQ KEQ (NFNOD) : SYSTEM EQUATION NUMBERS

WE (NFELM)

0 - UNDEFINED

NEC - CONCENTRATION PRESCRIBED DOF POS - GENERATION PRESCRIBED DOF ELEMENT MASS FLOW RATES

c

C CALSAPX FREE-FIELD INPUT SFRECOM.INC

C CHARACTER LINE'l, LLINE'160

COMMON /CLINE 1/ LINE (ISO) COMMON /CLINE2/ II, JJ EQUIVALENCE (LLINE, LINE (1)

)

SAVE /CLINE1/, /CLINE2/

C VARIABLE

C LINE (160)

C II

C JJ

C

C

•DESCRIPTION COMMAND LINE BUFFER END-OF-DATA IN LINE BUFFER END-OF-INFORMATION IN LINE BUFFER INFORMATION - DATA : COMMENTS

C

C CALSAPX COMMAND MANAGEMENT SCMDCOM. INC

C CHARACTER'l NCMND , Ml, M2, M3, MS, MS, M6 , Ml , NNCMND * 8 COMMON /CMND/ NCMND (8),M1(S),M2(S>,M3(4),M4M),M5(S),M6M),M7M)

EQUIVALENCE (NNCMND , NCMND ( 1 ) )

C VARIABLE DESCRIPTION —

C NCMND (8) *1 CURRENT COMMAND

C NNCMND'8 CURRENT COMMAND

C Ml (6) to Ml (6) CURRENT ARRAY NAMES

C

CC CONTAM COMMON STORAGE SCNTCOM86 . INC

C Append -30
NBS-1 14A (rev. 2 -ec) U.S. DEPT. OF COMM.

4.

1 . BIBLIOGRAPHIC DATA

SHEET (See instructions

)

PUBLICATION OR

REPORT NO.

NBSIR 87 3661

2. Performing Organ. Report NoJ 3.

TITLE AND SUBTITLE

Inddbr Air ^Quality Modeling - Phase II Report

Residential Indoor Air Quality Simulation

Publication Date

5. AUTHOR(S)

James W. Axley

6. PERFORMING ORGANIZATION (If joint or other than NBS, see instructions

)

7. Contract/Grant No.

NATIONAL BUREAU OF STANDARDS

DEPARTMENT OF COMMERCE

WASHINGTON, D.C. 20234

8.

Type of Report & Period Covered

9.

SPONSORING ORGANIZATION NAME AND COMPLETE ADDRESS (Street. City. State. ZIP

)

U.S. Environmental Protection Agency U.S. Department of Energy

Washington, DC 20460 1000 Independence Ave. , SW

Washington, DC 20585

10.

SUPPLEMENTARY NOTES

Document describes a computer program; SF-185, FIPS Software Summary, is attached.

11.

ABSTRACT (A 200-word or less factual summary of most significant information. If document includes a significant

bi bl iography or literature survey, mention it here)

This interim report presents the results of Phase II of the NBS General Indoor Air

Pollution Concentration Model Project. It describes the theoretical basis of a generalpurpose nonreactive contaminant dispersal analysis model for buildings, the computational implementation of a portion of this model in the program CONTAM86, and examples of

the application of this model to practical problems of contaminant dispersal analysis.

Presently the model is being extended to handle problems of reactive contaminant dispersal analysis and full computational implementation of all portions of the model is

being completed.

The contaminant dispersal analysis model is based upon the idealization of building

air flow systems as an assemblages of flow elements connected to discrete system nodes

corresponding to well-mixed air zones within the building and its HVAC system. Equations

governing the air flow processes in the building (e.g., infiltration, exfiltration, HVAC

system flow, and zone-to-zone flow) and equations governing the contaminant dispersal

due to this flow, accounting for contaminant generation or removal, are formulated by

assembling element equations so that the fundamental requirement of conservation of mass

is satisfied in each zone. The character and solution of the resulting equations is

discussed and steady and dynamic solution methods outlines.

12.

KEY WORDS (Six to twelve entries; alphabetical order; capitalize only proper names; and separate key words by semicolon s) contaminant dispersal analysis; flow simulation; building simulation; building dynamics;

computer simulation techniques; discrete analysis techniques.

13. AVAILABILITY 14. NO. OF

PRINTED PAGES

XlXU Unlimited

| | For Official Distribution. Do Not Release to NTIS 156

Order From Superintendent of Documents, U.S. Government Printing Office, Washington, D.C.

20402. 15. Price

Order From National Technical Information Service (NTIS), Springfield, VA. 22161 $18.95

USCOMM-DC 6043-P80
'

-

*

,

.

fVfcSs

:

‘ imm

ipnsi