Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 Linking a Completely Stirred.

Slides:



Advertisements
Similar presentations
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
Advertisements

Constructing Conceptual Site Model (CSM) Diagrams using the Simulation Editor EXAMPLE Constructing Conceptual Site Model (CSM) Diagrams using the Simulation.
FRAMES-2.0 Workshop U.S. Nuclear Regulatory Commission Bethesda, Maryland November 15-16, 2007 Pacific Northwest National Laboratory Richland, Washington.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
GMS Linkage with FRAMES Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005.
Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 Geo-Reference Icon.
1 Module 12 Computation and Configurations –Formal Definition –Important Terms –Examples.
Java Library Java provides a huge library or collection of useful programs A gold mine of well-tested code that can save you countless hours of development.
Module 12 Computation and Configurations Formal Definition Examples.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
Block Scope By Greg Butler Purpose The purpose of this presentation is to familiarize the student with the concept of variable scope, as it relates to.
Java for Robots How to program an NXT robot with a Java Brain Bert G. Wachsmuth Seton Hall University.
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Laboratory Study October, The very first example, traditional "Hello World!" program: public class first { public static void main (String[ ]
Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 Auto Testing.
Data Objects (revisited) Recall that values are stored in data objects, and that each data object holds one value of a particular type. Data objects may.
Framework for Risk Analysis in Multimedia Environmental Systems - Version 2 (FRAMES-2) Overview FRAMES-2.0 Workshop U.S. Nuclear Regulatory Commission.
FRAMES-2.0 Workshop U.S. Nuclear Regulatory Commission
1 Introduction to Java Brief history of Java Sample Java Program Compiling & Executing Reading: => Section 1.1.
Providing Password Protection and Limited Access to Models and Applications FRAMES-2.0 Workshop U.S. Nuclear Regulatory Commission Bethesda, Maryland November.
Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 GENII Version 2.0 Overview and.
FRAMES-2.0 Workshop U.S. Nuclear Regulatory Commission Bethesda, Maryland November 15-16, 2007 Pacific Northwest National Laboratory Richland, Washington.
Registering GMS Related Components with FRAMES Registering GMS Related Components with FRAMES Groundwater Modeling System RT3D and MT3DMS FRAMES-2.0 Workshop.
Scientific Computing Division A tutorial Introduction to Fortran Siddhartha Ghosh Consulting Services Group.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
Hierarchical Modeling Linking to Science-Support Models EXAMPLE Hierarchical Modeling Linking to Science-Support Models Groundwater Modeling System RT3D.
Working with arrays (we will use an array of double as example)
Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 Packager/Unpackager.
Procedural programming in Java Methods, parameters and return values.
Framework Development Environment (FDE) Editors FRAMES-2.0 Workshop U.S. Nuclear Regulatory Commission Bethesda, Maryland November 15-16, 2007 Pacific.
Lecture 3: Getting Started & Input / Output (I/O) “TRON” Copyright 1982 (Walt Disney Productions)
Control Structures (B) Topics to cover here: Sequencing in C++ language.
Framework for Risk Analysis in Multimedia Environmental Systems Version 2 (FRAMES-2) Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific.
Rapid Risk Assessment Preparedness, Response, Recovery, and Mitigation Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest.
Object-oriented Design and Programming Conrad Huang PC204, Fall 2004.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 3.
Importing a Spreadsheet and Placing it under the Tools Menu FRAMES-2.0 Workshop U.S. Nuclear Regulatory Commission Bethesda, Maryland November 15-16, 2007.
ViewersViewers FRAMES-2.0 Workshop U.S. Nuclear Regulatory Commission Bethesda, Maryland November 15-16, 2007 Pacific Northwest National Laboratory Richland,
Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 DICtionary Editor.
Simulation Editor Basic Features FRAMES-2.0 Workshop U.S. Nuclear Regulatory Commission Bethesda, Maryland November 15-16, 2007 Pacific Northwest National.
Reading input from the console input. Java's console input The console is the terminal window that is running the Java program I.e., that's the terminal.
Files Review For output to a file: –FileOutputStream variable initialized to filename (String) and append/not append (boolean) –PrintWriter variable initialized.
1 CSC 533: Programming Languages Spring 2014 Subprogram implementation  subprograms (procedures/functions/subroutines)  subprogram linkage  parameter.
Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 Constituent Data Editor.
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
Biological Science to Working FRAMES 2.0 Model Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November.
A Sample Program #include using namespace std; int main(void) { cout
SUMMARY OF CHAPTER 2: JAVA FUNDAMENTS STARTING OUT WITH JAVA: OBJECTS Parts of a Java Program.
ITM 3521 ITM 352 Functions. ITM 3522 Functions  A function is a named block of code (i.e. within {}'s) that performs a specific set of statements  It.
Packaging Simulations for Transfer to Remote Locations EXAMPLE Packaging Simulations for Transfer to Remote Locations (Simulation Packager/Unpackager)
Chapter 8 Arrays and the ArrayList Class Arrays of Objects.
Object-Oriented programming for Beginners LEAPS Computing 2015
I/O Basics.
Stack Lesson xx   This module shows you the basic elements of a type of linked list called a stack.
Chapter 4 Procedural Methods.
Arrays & Functions Lesson xx
User Group Meeting | 2017 | Jeju Island, Korea
Principles and Applications of Backward-in-Time Modeling of Contaminants in the Environment Roseanna M. Neupauer Department of Civil, Environmental, and.
Stack Memory 2 (also called Call Stack)
An Introduction to Java – Part I, language basics
CSC 533: Programming Languages Spring 2015
Java Programming Function Introduction
Chapter 7 Procedural Methods.
Java Programming Function Introduction
CSC 533: Programming Languages Spring 2018
CSC 533: Programming Languages Spring 2019
Modeling Water Treatment Using the Contaminant Transport Module
Presentation transcript:

Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 Linking a Completely Stirred Tank Reactor (CSTR) to FRAMES-2

2 Completely Stirred Tank Reactor Outflow Water Flux (Q) Outflow Contaminant Concentration (C 2 ) Inflow Water Flux (Q) Inflow Contaminant Concentration (Co) Initial Concentration at t=0, Ci Control Volume Concentration (C 2 ) Soil

3 Where C 2 and C 1 = outflow concentrations at t 2 and t 1, respectively t2 and t1 = time C o = Inflow concentration R f = Retardation Factor λ = First-order degradation/decay rate V T = Total Volume (soil, water, air) Θ = moisture content Q = Inflow and Outflow rates Β d = Bulk density K d = Instantaneous Partitioning Distribution Coefficient

4 Derivations here Need to PDF Derivations and place them here

Directly Linking an Illustrative FORTRAN Model to FRAMES-2 Using FRAMES-2 API Function Calls 1. Link Model to FRAMES-2 2. Use FRAMES-2 Approach to Produce Data 3. Use FRAMES-2 Approach to Consume Data

Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 Front End Linkage

7 Front-end linkage Purpose Show the differences in versions of FORTRAN for getting commandline arguments Show how FORTRAN, Java, C/C++ are all very similar Show that only a few lines of code can get these arguments

8 Front-End Linkage Lahey FORTRAN Use “Module” Use F2ModuleDev GetCL reads Commandline into a character * variable GetCL(commandline) Internal read to read pieces of commandline read(commandline),path,sim ulation,module MS-Derived FORTRAN Compaq, Digital, Powerstation Use “Module” Use F2ModuleDev GetArg(1,path) path=trim(path)//char(0) GetArg(2,simulation) path=trim(path)//char(0) GetArg(3,module) path=trim(path)//char(0)

9 Front-End Linkage (cont.) Java import FRAMES2API.F2ModuleDev Standard main provides arguments public static int main(String[] argv) path=argv[0]; simulation=argv[1]; module=argv[2] C/C++ #include “Developer\F2ModuleDevC.h” Standard main provides arguments void main(int arg,char **argv) path=argv[1]; simulation=argv[2]; module=argv[3];

10 Define pid and I/O Files Define a Process IDentifier (pid) function of path, simulation, moduleId, and is used in all subsequent calls to the API and can be thought of as a way to state who is making changes or reading datasets. pid=OpenIO(path,simulation,moduleId) Define the name and location of the input (CSTRInput) and output (CSTROutput) DICtionaries, cross- correlated to pid and moduleId InputDataSet=IconGetUIDataSet(pid,moduleId,"CSTRInput",1) OutputDataSet=IconGetOutputDataset(pid,moduleid,"CSTROut put",1)

Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 Replace the FORTRAN Write Statement with a FRAMES-2 API Function Call

12 FORTRAN Write Statement: WRITE(21,FMT='(3E10.3)') t, c, Q*c Time Replace the FORTRAN Write Statement with a FRAMES-2 API Function Call for Time (t), Concentration (c), and Flux (Q*c) Concentration Desired Output Given: 1. You are familiar with or wrote the code. 2. You will define a system DICtionary, titled “CSTROutput”. The code internally denotes this file name as the variable OutputDataSet. 3. The code uses indices to track Chemical Names (e.g., 1 = Chemical #1) as “chem”, and Time as “TimeIdx”. 4. This model is a zero-dimension model. 5. The variables t and c are Real and have units of yr and mg/L, respectively.

13 CSTROutput DICtionary

14 Note: Dimension of 2 DIC: CSTROutput Variable: Conc Units: “mg/L” Indices: Chemical Name Time Note: “Real”

FRAMES-2 API Function Call Documentation

Summary of Known Information: 1. “t” for time, “c” for concentration, and Q*c for flux are Real (i.e., Floats). The names for t, c, and Q*c are Time, Conc, and Flux, respectively. 2. t has units of years, c has units of mg/L, and Q*c has units of g/yr. 3. t, c, and Q*c have two indices each: one Chemical Name, which is tracked in the model by the index “chem”, and one based on time, which is tracked in the model by the index “TimeIdx”. 4. OutputDataSet is the variable file name, storing the input file name of CSTROutput. The FRAMES-2 API Function Calls would be DataSetWriteReal2: DataSetWriteReal2(pid, dataset, variable, unit, index1, index2, value) Where pid = pidpid = pidpid = pid dataset = OutputDataSetdataset = OutputDataSetdataset = OutputDataSet variable = “Time”variable = “Conc”variable = “Flux” unit = “yr”unit = “mg/L”unit = “g/yr” index1 = chemindex1 = chem index1 = chem index2 = TimeIdxindex2 = TimeIdx index2 = TimeIdx value = tvalue = c value = Q*c Producing a FRAMES-2 API Write calls of call DataSetWriteReal2(pid, OutputDataSet, "Time", "yr", Chem, TimeIdx, t) call DataSetWriteReal2(pid, OutputDataSet, "Conc", "mg/L", Chem, TimeIdx, c) call DataSetWriteReal2(pid, OutputDataSet, “Flux", “g/yr", Chem, TimeIdx, Q*c)

Workshop U.S. Nuclear Regulatory Commission Rockville, Maryland Pacific Northwest National Laboratory November 15-17, 2005 Replace a FORTRAN Read Statement with a FRAMES-2 API Function Call for Total Concentration (Ct)

20 Original FORTRAN Read Statement: READ(20,FMT='(f8.3)')Ct Example Problem Read the Initial Total Concentration (Ct) in g/cm 3 Given: 1. You are familiar with or wrote the code. 2. You have already created or will create an user-friendly input dataset, based on the DICtionary, titled “CSTRInput”. The code internally denotes this file name as the variable InputDataSet. 3. The code uses indices to track Chemical Names (e.g., 1 = Chemical #1, 2 = Chemical #2, etc.), and this index is labeled “chem”. 4. This model is a zero-dimension model. 5. The variable Ct is a Real (i.e., Float).

Note: Dimension of 1 Note: “Real” DIC: CSTRInput Variable: Ct Index: Chemical Name Units: “g/cm 3 ”

FRAMES-2 API Function Call Documentation

25 Summary of Known Information: 1. You have already created or will create an user-friendly input dataset, based on the DICtionary, titled “CSTRInput”. The code internally denotes this file name as the variable “InputDataSet”. 2. The code uses indices to track Chemical Names (e.g., 1 = Chemical #1, 2 = Chemical #2, etc.), and this variable is labeled “chem”. 3. This model is a zero-dimension model. 4. The input concentration Ct variable is a Real (i.e., Float) with units of g/cm 3 The FRAMES-2 API Function Calls would be DataSetReadReal1: DataSetReadReal1(pid, dataset, variable, unit, index1) wherepid = pid dataset = InputDataSet variable = “Ct” unit = “g/cm^3” index1 = chem Producing a FRAMES-2 API Read call of Ct=DataSetReadReal1(pid, InputDataSet, "Ct", "g/cm^3", chem)