CMS-Flow:Features: Difference between revisions

From CIRPwiki
Jump to navigation Jump to search
Line 236: Line 236:


== Creating the Batch File ==
== Creating the Batch File ==
 
----
   flow = 'Flow_Shark';
<font size=2>
   wave = 'Wave_Shark';
  <font color=green>%create_bat.m</font>
cmsexe = 'cms2d_v4b42_x64p_wu_alex.exe';batfile = 'run_cases.bat';numgroup = 3;ncases = length(r);fid = fopen(batfile,'w');for i=1:ncases   cmcards = ['.\Case',int2str(i),'\',flow,'.cmcards'];           if mod(i,numgroup+1)~=0       fprintf(fid,'START %s %s %s',cmsexe,cmcards,char(10));   else       fprintf(fid,'START /WAIT %s %s %s',cmsexe,cmcards,char(10));   endendfclose(fid);return
   flow = <font  color=magenta>'Flow_Shark'</font>;
   wave = <font color=magenta>'Wave_Shark'</font>;
  cmsexe = <font color=magenta>'cms2d_v4b42_x64p.exe';
  batfile = <font color=magenta>'run_cases.bat';
  numgroup = 3;
  ncases = length(r);
  fid = fopen(batfile,<font color=magenta>'w'</font>);
  <font color=blue>for</font> i=1:ncases  
    cmcards = [<font color=magenta>'.\Case'</font>,int2str(i),<font color=magenta>'\'</font>,flow,<font color=magenta>'.cmcards'</font>];  
    <font color=blue>if</font> mod(i,numgroup+1)~=0  
      fprintf(fid,<font color=magenta>'START %s %s %s'</font>,cmsexe,cmcards,char(10));  
    <font color=blue>else </font>
      fprintf(fid,<font color=magenta>'START /WAIT %s %s %s'</font>,cmsexe,cmcards,char(10));  
    <font color=blue>end</font>
  <font color=blue>end</font>
  fclose(fid);
  <font color=blue>return</font>
</font>
----


=Units of Measurement=
=Units of Measurement=

Revision as of 19:41, 20 January 2011

Surface Roller

Table 1. CMS-Flow cards related to the surface roller

Card Arguments Range Default Description
CALC_ROLLER CHARACTER ON | OFF OFF Turns on or off the surface roller model in CMS.
ROLLER_DISSIPATION_COEFFICIENT REA 0.1 0.05-0.15 Roller dissipation coefficient.
ROLLER_EFFICIENCY_COEFFICIENT REAL 1.0 0.5-1.0 Roller efficiency coefficient.
ROLLER_SCHEME CHARACTER UPWIND1 | UPWIND2 | LAX UPWIND1 Determines the numerical scheme used for the surface roller calculation. UPWIND1 is a first order upwind scheme, UPWIND2 is a second order upwind scheme, and LAX is the second order Lax scheme.

Hot Start

The term Hot start refers to starting a simulation with an initial condition other zero (cold start). Hot starts are used for specifying initial conditions or restarting simulations at intermediate times. The hot start controls are set in the Flow tab of the CMS-Flow Model Control window.

Hot Start File

Figure 2. XMDFView showing the structure of the CMS Hot Start File.

The CMS hot start feature CMS lets the user restart simulations that have been stopped due to electric outages, hardware malfunctions, or model crashes. In the case of a model crash the user, may restart the model using larger solver iterations and/or time steps to stabilize the simulation. The user has the option to specify a hot start output time or an interval for outputting a recurring hot start file. Every time the hot start file is written, it overwrites the previous information. The CMS Hot Start file saves information on the water elevation (pressure), and current velocities. If the sediment transport is active, then the water depth, and sediment concentrations are also saved for each size class. The CMS hot start file is a binary XMDF file, has the name Hot_Start.h5 and is saved in the directory of the CMS-Flow files. Figure 1 shows the structure of the hot start file. After saving a CMS Hot Start file, it is a good idea to rename the file with a different name before using it as an initial conditions file. This way, the file will not be overwritten in future simulations.

Table 1. Hot Start CMS-Flow Cards

Card Arguments Default Range Description
HOT_START_OUTPUT_FILE CHARACTER none none Julian hour.
HOT_START_TIME REAL none none Sets the hot start output time.
AUTO_HOT_START_INTERVAL REAL none none Sets the recurring hot start output time.



Initial Conditions File

Figure 3. Dataset Toolbox showing a time step sample of the water elevation and current velocity datasets for use in a hot start (initial condition) file.

There are several situations where it is convenient to specify a user defined hot start file. For example, if the user forgets to setup the model output a hot start file or when running steady state conditions. A hot start file can easily be created and exported by the user from the SMS interface. The model requires at water levels, current velocities, concentrations, and water depths. Any datasets that are missing from the initial file. It is important to note that the names and paths of the initial condition datasets is important.

Table 2. Path and name for initial condition file variables.

Variable Path and Name
Water surface elevation Datasets\Water_Elevation
Current velocity Datasets\Current_Velocity
Sediment concentrations Datasets\Concentration
Salinity concentrations Datasets\Salinity


The steps for creating a user defined hot start or initial condition file from a CMS-Flow solution file are outlined below.

  1. Import CMS-Flow grid and solution file.
  2. Sample a time step of the solution datasets for use in the initial condition
    1. Click on Data | Data Calculator
      1. Under the Tools section, select Sample time steps.
      2. Under the Datasets section, click on the Water Elevation
  3. Export the initial condition datasets to an XMDF file
Figure 3. Dataset Toolbox showing a time step sample of the water elevation and current velocity datasets for use in a hot start (initial condition) file.
Figure 4. Dataset Toolbox showing a time step sample of the water elevation and current velocity datasets for use in a hot start (initial condition) file.


Table 3. CMS-Flow card for specifying the initial condition file.

Card Arguments Default Range Description
INITIAL_STARTUP_FILE CHARACTER none none Julian data in YYDDD with YY being last two digits of the year, and DDD the Julian day of the year.


Output

In addition to the variables specified in the SMS interface, CMS has the option to output advanced mode output including the bed shear stress, bed composition, wind speed, etc. The following advanced cards have been added to CMS v4.0 and higher for outputting additional output information, ASCII file output, and more.

Table 2. Advanced output datasets.

Card Arguments Description Default value
WAVE_OUT_TIMES_LIST integer Output time series id 0
EDDY_OUT_TIMES_LIST integer Output time series id 0
VISC_OUT_TIMES_LIST integer Output time series id. Same as EDDY_OUT_TIMES_LIST 0
STRESS_OUT_TIMES_LIST integer Output time series id 0
BED_SHEAR_STRESS_OUT_TIMES_LIST integer Output time series id. Same as BED_SHEAR_STRESS_OUT_TIMES_LIST 0
GLOBAL_TECPLOT_FILES ON | OFF Outputs Tecplot ASCII files OFF
GLOBAL_SUPER_FILES ON | OFF Outputs Tecplot ASCII files OFF

XMDF File

The standard CMS-Flow output is written to an XMDF file with the name <Case Name>_sol.h5. The bindary file may be written in compressed format using the card described in the table below.

Table 3. CMS-Flow card for compressing the XMDF output file

Card Arguments Description Default value
XMDF_COMPRESSION ON | OFF Compresses the h5 file by a factor of about 7 OFF

Statistics

CMS V4.0 has the option to calculate statistics over the whole model domain for a user-specified time period. This option is accessed using the advanced cardss. The starting time, end time, and time interval should be specified in hours with respect to the model start time. The time interval should be larger or equal to the hydrodynamic time step. When activated the global statistics will be output in the same solution file within a subfolder named stats.

This option outputs the statistics for hydrodynamics, sediment and salinity transport. If only the statistics for one group

  • The hydrodynamic statistics output are:
  1. Maximum current velocity
  2. Maximum water level
  3. Residual currents (vectors and magnitude)
  4. Hydroperiod
  5. Maximum spatial gradient for water levels
  6. Maximum spatial gradient for current magnitude
  • Sediment Transport and Morphology Change
  1. Maximum total load transport rate, m^2/hr
  2. Net total load sediment transport rates, m^2/hr
  3. Average total load sediment transport rates, m^2/hr
  4. Gross total load sediment transport rates, m^2/hr
  5. Positive and negative total load transport rates (in x and y directions), m^2/hr
  6. Maximum spatial gradient of bathymetry
  • Salinity Statistics
  1. Mean Salinity

Table 3. CMS-Flow cards related to output statistics

Card Arguments Description Default value
GLOBAL_STATISTICS [t0] [tn] [dt] Calculates global statistics if specified none
FLOW_STATISTICS [t0] [tn] [dt] Calculates flow statistics if specified none
SEDIMENT_STATISTICS [t0] [tn] [dt] Calculates sediment statistics if specified none
SALINITY_STATISTICS [t0] [tn] [dt] Calculates salinity statistics if specified none

ASCII Output Files

In addition to the XMDF output file, CMS-Flow provides the output two types of ASCII output files:

  1. Tecplot snap shot (*.dat), and history files (*.his)
  2. SMS Super ASCII files (*.sup, *.xy, *.dat)

The CMS-Flow cards used for outputting these two types of files are described in the Table below.

Table 4. CMS-Flow cards used to output Tecplot and SMS Super ASCII files.

Card Arguments Description Default value
GLOBAL_TECPLOT_FILES ON | OFF Outputs Tecplot ASCII files OFF
GLOBAL_SUPER_FILES ON | OFF Outputs Tecplot ASCII files OFF

Numerical Methods

Solution Scheme

This refers to the temporal discritization of the hydrodynamic, sediment and salinity transport equations. There are two options in CMS: 1. Implicit - First order backward Euler scheme. Uses a time step on the order of 5-15 minutes. Appropriate for cases which can be simulated with large computational time steps such as long term morphology change at inlets. 2. Explicit - First order forward Euler scheme. Uses a time step on the order of 0.5-1.0 second. Appropriate for cases that vary quickly in time such as flooding or barrier island breaching.

Matrix Solvers

The four different solvers implemented in the implicit solution scheme are the Gauss-Seidel, Gauss-Seidel with Successive-Over-Relaxation, BICGSTAB, and GMRES. The same solver is applied to flow, sediment and salinity. The default solver is the GMRES. The solver may be changed using the advanced card in the table below.

  • Advection scheme

As in the case of the implicit solution scheme, the same advection scheme is applied for the flow, sediment and salinity transport equations. There are three choices for advection schemes with upwinding in the implicit model: hybrid, exponential and HLPA. The hybrid scheme is fast but is the most diffusive. The exponential scheme is based on the 1D analytical solution to an advection-diffusion equation and produces very stable results. The HLPA is very stable and non-diffusive, but requires slightly more computational time. For most applications, the exponential scheme is recommended and is set as the default. The advection scheme may be change using the advanced card

  • Parallelization with OpenMP

Both Intel and AMD processors now are shipping chips with multiple cores/processors (henceforth referred to as "processors") available. CMS-Flow is now configured to make use of these extra processes that are available on newer machines.

Additional information on using Multiple Processors with CMS-Flow can be found here.

Table 5. CMS-Flow cards related to numerical methods.

Card Arguments Default value Description
SOLVER_TYPE GAUSS-SEIDEL | GAUSS-SEIDEL-SOR | BICGSTAB | GMRES GMRES Determines the numerical solver used
ADVECTION_SCHEME HYBRID | EXPONENTIAL | HLPA EXPONENTIAL Determines the advection scheme
NUM_THREADS INTEGER 1 Determines the number of threads used for parallel processing.
HYDRO_MAX_ITERATIONS integer 20 Maximum number of iterations (outer loop) for the hydrodynamics
PRESSURE_ITERATIONS integer 10 Number of solver iterations (inner loop) used to solver the pressure equation.
VELOCITY_ITERATIONS integer 5 Number of solver iterations (inner loop) used to solver the momentum equations.
SEDIMENT_MAX_ITERATIONS integer 20 Maximum number of iterations (outer loop) for the sediment transport
SALINITY_MAX_ITERATIONS integer 20 Maximum number of iterations (outer loop) for the salinity transport

Scripting

Scipting refers to the automation of running multiple CMS runs with different parameters, without manually having to create and edit each alternative. The scripting process can include the following steps:

  1. Setting up alternatives
  2. Creating batch file
  3. Plotting and analyzing results

Scripting can be done using a variety of software programs. The examples shown here were written in Matlab becase it is widely used, easy to read and convenient for plotting and analyzing results.

Setting up aleternatives


 %setup_cases.m
 flow = 'Flow_Shark';
 wave = 'Wave_Shark';
 ncases = 2;
 r(1).MATRIX_SOLVER = 'GMRES';
 r(1).HYDRO_TIMESTEP = 1800;
 r(2).MATRIX_SOLVER = 'BICGSTAB';
 r(2).HYDRO_TIMESTEP = 600;
 for i=1:ncases
   d = ['Case',int2str(i)];
   if ~exist(d,'dir')
     mkdir(d)
   end
   copyfile([wave,'.*'],d)
   copyfile([flow,'.*'],d)
   copyfile([flow,'_mp.h5'],d);
   copyfile([flow,'_grid.h5'],d)
   cards = fieldnames(r(i));
   file = ['.\',d,'\Flow_Shark.cmcards'];
   fork=1:length(cards)
     setcard(file,cards{k},r(i).(cards{k})); 
   end
 end


Creating the Batch File


 %create_bat.m
 flow = 'Flow_Shark';
 wave = 'Wave_Shark';
 cmsexe = 'cms2d_v4b42_x64p.exe';
 batfile = 'run_cases.bat';
 numgroup = 3;
 ncases = length(r);
 fid = fopen(batfile,'w');
 for i=1:ncases 
   cmcards = ['.\Case',int2str(i),'\',flow,'.cmcards']; 
   if mod(i,numgroup+1)~=0 
     fprintf(fid,'START %s %s %s',cmsexe,cmcards,char(10)); 
   else 
     fprintf(fid,'START /WAIT %s %s %s',cmsexe,cmcards,char(10)); 
   end
 end
 fclose(fid);
 return


Units of Measurement

Variable Units Symbol
Water Surface Elevation meters
Current Velocity meters per second
Flow Rate cubic meters per second
Salinity Concentration parts per thousand
Sediment Concentration kilogram per meter cubed
Sediment Transport meter squared per second
Bed Shear Stress kilogram per meter per second squared

CMS-Flow