Frequently Asked Questions (FAQ) About

W2i and AGPM-2D

W2 Operation (Compiling)

 

When W2 runs and has an error, the command window flashes off before I can see the error message.

To keep the command window up to show the error message, you need to run W2 from the command window. The command window allows copy-paste of text, so it's easiest to copy-paste the folder path from file explorer rather than typing it all in. Here is how to do this:

In file explorer, browse to the W2 file folder ("\W2i\examples\myreservoir" or whatever).

Select and copy (PrtScrn) the folder path from explorer to the clipboard.

Open the command window.

Type "CD" and paste the folder path (rt-click at top of command window, select Edit... Paste...).

Use back arrow to go back to beginning of path, and use Del key to trim off the "C:" that preceded the folder path.

Hit Enter. (Later you can use up-down arrows to reuse this line)

To run W2, type "w2.exe" (or whatever your executable filename is) and hit Enter. (Later you can use up-down arrows to reuse this line)

How do I recompile W2 v3.2?

We suggest you read the W2i Help section on Compiling W2 for more thorough discussion. Compilation of the AGPM-enabled version of W2 v3.2 requires all files in the \w2\w2 workspace at compile time, including:

resource.fd
resource.h
screen_output.f90
w2.aps
w2.f90
w2.ico
w2.rc
w2_big.ico

First open the CVF workspace "w2_dialog.dsw" using CVF Fortran v6.6b or higher. This file shows which files in the \w2 workspace are needed to recompile the model. Compile using "Build All" to recompile after a code change to w2.f90 or other .f90 file in workspace.

Do I have to recompile W2 v2 when I change reservoir column or layer discretization?

Yes.  With CE-QUAL-W2 v2.11, each different configuration requires adjustment of the w2.inc file and recompilation of the W2 source code to handle dimensioning of the 2D arrays.  This is made easier by using the New Build routine's spreadsheet to make your column/layer changes, then use the New Build routine to adjust the w2.inc file and recompile W2.   In W2 v3, arrays are dynamically allocated, eliminating the need to recompile W2.

What files should be included in the W2 v2 compile?

Compilation of the AGPM-enabled version of CE-QUAL-W2 v2.11 requires the following files to be in the same directory (e.g., c:\win2dw2\examples\degray) at compile time:

       file                                  description
  w2_ms.for        MS Powerstation Fortran version of W2, with AGPM control code
  agpmw2.for      Fortran routines for opening and writing the AGPM plot file (OPENP, WRITEP)
  w2.inc             reservoir-specific INCLUDE file for 2D array dimensions

The w2.inc file will vary from one reservoir to the next to account for different # columns and rows.

Can I rename the W2 executable?

Yes, the executable (w2*.exe) derived from your compile can be renamed.  Some like the name to reflect the reservoir name in the INCLUDE file, as shown in these examples:

  Degray Reservoir                            w2degray.exe
  J Strom Thurmond Reservoir            w2jst.exe
  Cheatham Reservoir                        w2cheat.exe
  Raritan Reservoir                            w2rarit.exe

IMPORTANT NOTE:  To use the New Build and Pre-Processor features in WIN2DW2, the executable name should be left generic (w2_ms.exe).

What do the Fortran subroutines OPENP and WRITEP do?

OPENP opens the AGPM output file that AGPM will use to plot W2 results.  This file is a direct access, standard binary file with .w2p extension.  WRITEP is contained in W2's computational loop and it outputs W2 results for each output interval.  You control output interval using AGPM statements in the W2 control file (w2_con.npt).

What compiler should I use to recompile W2?

The W2 v2 source code distributed with AGPM and WIN2DW2 is w2_cvf.f90, which is the W2 code optimized for use with the Compaq Visual Fortran compiler 6.5+.  You may need to make minor changes for compatibility with your compiler

The W2 v2 source code distributed with AGPM and WIN2DW2 is w2_ms.for, which is the W2 code optimized for use with the MS Fortran Powerstation 4 compiler.  You may need to make minor changes for compatibility with your compiler.  There are also separate source codes available at Waterways Experiment Station that have I/O and other statements optimized for individual compilers.  If you use a compiler other than MS Fortran Powerstation 4, you may be able to obtain its version of the source (w2_xxx.for) from Tom Cole at Waterways Experiment Station (see FTP site in Technical Support section).  Any W2 source not included in this package would require addition of the AGPM code fragments to output the .w2p file that AGPM uses.

A word about binary files produced by different compilers:

AGPM code fragments in W2 create a binary plot file.   It is important to note that some compilers create proprietary binary outputs that are not readable by AGPM.  Only universal binary format is readable by AGPM.   Most compilers can be set to create universal binary output with internal options or switches if is not the default.  AGPM has been modified to work directly with the binary formats created by MS Fortran Powerstation 4 and Lahey compilers.

If W2 is compiled with Digital Visual Fortran compiler from its development environment, you must set an option to force use of universal binary.   This is done in DVF by enabling the /fpscomp:ioformat switch (Compatibility..PowerStation..I/O Format setting).  Note that this is the default if you use DVF's FL32 command from a command prompt.  Alternatively, you can use DVF's proprietary binary (i.e., no switch) if you change the *4 to a *1 in OPENP (routine in agpmw2.for that must be compiled with W2).

Which compiler produces the fastest-running W2 executable?

This is an important question if you intend to make long simulations with W2.  We have not done enough testing to compare all compilers, but we do know that the Digital Visual Fortran compiler v5+ produces an executable that is approximately twice as fast as that of MS Fortran Powerstation 4.

What code changes do I need to make another version of W2 to output the AGPM plot file?

If you obtain a W2 source for a different compiler, or if you prefer to use your own custom version of W2, you will need to modify it to produce the special plot file for AGPM (*.w2p).  To accomplish this, W2 requires several short code fragments embedded in W2.  You will need to emulate the code additions shown in the example  w2_cvf.f90 (W2 v3) or w2_ms.for (W2 v2) source files to handle the controls and output for AGPM plot file creation.

Code fragments required in CE-QUAL-W2 are preceded and ended with the comment line "C*****AGPM".  Search for this string in the c:\win2dw2\examples\degray\w2_ms.for file to identify W2 code modifications needed.  For example, the first code addition in the W2 v2 source appears like this:

C****AGPM
C
      LOGICAL AGPM
      CHARACTER*3 APLC
      CHARACTER*72 AGPMFN
      REAL NXTMAP
C
C****AGPM


Back to Tool

 

Loginetics, Inc.  Knoxville, TN