CMS-Flow:Features: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
= Steering = | |||
Steering refers to the coupling process between CMS-Flow and CMS-Wave. In CMS versions < 4.0, the steering process is handled by the SMS interface while in newer versions >= 4.0, the steering process is done internally. The steering process in either is similar. First the wave model is run twice at time zero to the first steering interval. The wave information is then interpolated on to the flow grid and the flow model is run from time zero to the first steering interval. The flow information is then interpolated on the wave grid and the wave model is run for the second steering interval and the process is repeated until the simulation is complete. | |||
== SMS Steering (CMS Versions<=3.75)== | |||
== Inline Steering (CMS Versions>=4.0) == | |||
The significant wave height, peak wave period, wave unit vectors, and wave dissipation were linearly interpolated to the flow grid every steering interval and then linearly interpolated in time at every hydrodynamic time step. Wave variables such as wave length and bottom orbital velocities were updated every time step for wave-current interaction. | |||
When using such a large steering interval, it is important to consider how the water levels, current velocities and bed elevations, which are passed from the flow to the wave model, are estimated. | |||
For this application, and for most open coast applications, the nearshore waves are most sensitive to variations in water levels and not currents. Therefore, improved results can be obtained by predicting the water levels at the wave model time step based on a decomposition of the water levels into spatially constant and variable components. The spatially constant component is assumed to be equal to the tidal water surface elevation and the spatially variable component which includes wind and wave setup is estimated based on the last flow time step. The currents and bed elevations which are passed from the wave to flow grid are simply set to the last time step value. Other types of prediction methods could be used; however, the approach described above has been found to be sufficient for most applications and is simple to calculate. After each wave run, a surface roller model is also calculated on the wave grid and the roller stresses are added to the wave stresses before interpolating on to the flow grid. Even though CMS-Flow and CMS-Wave use different grids, the two models are in a single code which facilitates the model coupling and speeds up the computation by avoiding communication files, variable allocation and model initialization at every steering interval. | |||
'''Table 1. CMS-Flow cards related to steering''' | |||
{| border="1" | |||
! Card !! Arguments !! Default !! Range !! Description | |||
|- | |||
| CMS-WAVE_SIM_FILE || CHARACTER || none || none ||File name including path for the CMS-Wave sim file. | |||
|- | |||
| WAVE_SIM_FILE || CHARACTER || none || none ||Same as CMS-WAVE_SIM_FILE. | |||
|- | |||
| STEERING_INTERVAL || REAL || none || none || Sets the recurring hot start output time. | |||
|- | |||
| WAVE_WATER_LEVEL || CHARACTER || TIDAL_PLUS_VARIATION || LAST <nowiki>|</nowiki> TIDAL <nowiki>|</nowiki> TIDAL_PLUS_VARIATION|| Determines the method used to calculate the water levels passed to the wave model. | |||
|- | |||
| FLOW_EXTRAPOLATION_DISTANCE || REAL|| Calculated based on grid geometry || none || Determines the extrapolation distance used for flow variables on the wave grid. | |||
|- | |||
| WAVE_EXTRAPOLATION_DISTANCE || REAL|| Calculated based on grid geometry || none || Determines the extrapolation distance used for wave variables on the flow grid. | |||
|} | |||
<br style="clear:both" /> | |||
<br style="clear:both" /> | |||
= Hot Start = | = 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. | 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. |
Revision as of 15:29, 24 January 2011
Steering
Steering refers to the coupling process between CMS-Flow and CMS-Wave. In CMS versions < 4.0, the steering process is handled by the SMS interface while in newer versions >= 4.0, the steering process is done internally. The steering process in either is similar. First the wave model is run twice at time zero to the first steering interval. The wave information is then interpolated on to the flow grid and the flow model is run from time zero to the first steering interval. The flow information is then interpolated on the wave grid and the wave model is run for the second steering interval and the process is repeated until the simulation is complete.
SMS Steering (CMS Versions<=3.75)
Inline Steering (CMS Versions>=4.0)
The significant wave height, peak wave period, wave unit vectors, and wave dissipation were linearly interpolated to the flow grid every steering interval and then linearly interpolated in time at every hydrodynamic time step. Wave variables such as wave length and bottom orbital velocities were updated every time step for wave-current interaction.
When using such a large steering interval, it is important to consider how the water levels, current velocities and bed elevations, which are passed from the flow to the wave model, are estimated.
For this application, and for most open coast applications, the nearshore waves are most sensitive to variations in water levels and not currents. Therefore, improved results can be obtained by predicting the water levels at the wave model time step based on a decomposition of the water levels into spatially constant and variable components. The spatially constant component is assumed to be equal to the tidal water surface elevation and the spatially variable component which includes wind and wave setup is estimated based on the last flow time step. The currents and bed elevations which are passed from the wave to flow grid are simply set to the last time step value. Other types of prediction methods could be used; however, the approach described above has been found to be sufficient for most applications and is simple to calculate. After each wave run, a surface roller model is also calculated on the wave grid and the roller stresses are added to the wave stresses before interpolating on to the flow grid. Even though CMS-Flow and CMS-Wave use different grids, the two models are in a single code which facilitates the model coupling and speeds up the computation by avoiding communication files, variable allocation and model initialization at every steering interval.
Table 1. CMS-Flow cards related to steering
Card | Arguments | Default | Range | Description |
---|---|---|---|---|
CMS-WAVE_SIM_FILE | CHARACTER | none | none | File name including path for the CMS-Wave sim file. |
WAVE_SIM_FILE | CHARACTER | none | none | Same as CMS-WAVE_SIM_FILE. |
STEERING_INTERVAL | REAL | none | none | Sets the recurring hot start output time. |
WAVE_WATER_LEVEL | CHARACTER | TIDAL_PLUS_VARIATION | LAST | TIDAL | TIDAL_PLUS_VARIATION | Determines the method used to calculate the water levels passed to the wave model. |
FLOW_EXTRAPOLATION_DISTANCE | REAL | Calculated based on grid geometry | none | Determines the extrapolation distance used for flow variables on the wave grid. |
WAVE_EXTRAPOLATION_DISTANCE | REAL | Calculated based on grid geometry | none | Determines the extrapolation distance used for wave variables on the flow grid. |
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
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
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.
- Import CMS-Flow grid and solution file.
- Sample a time step of the solution datasets for use in the initial condition
- Click on Data | Data Calculator
- Under the Tools section, select Sample time steps.
- Under the Datasets section, click on the Water Elevation
- Click on Data | Data Calculator
- Export the initial condition datasets to an XMDF 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:
- Maximum current velocity
- Maximum water level
- Residual currents (vectors and magnitude)
- Hydroperiod
- Maximum spatial gradient for water levels
- Maximum spatial gradient for current magnitude
- Sediment Transport and Morphology Change
- Maximum total load transport rate, m^2/hr
- Net total load sediment transport rates, m^2/hr
- Average total load sediment transport rates, m^2/hr
- Gross total load sediment transport rates, m^2/hr
- Positive and negative total load transport rates (in x and y directions), m^2/hr
- Maximum spatial gradient of bathymetry
- Salinity Statistics
- 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:
- Tecplot snap shot (*.dat), and history files (*.his)
- 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.
Card | Arguments | Default | Range | Description |
---|---|---|---|---|
SOLUTION_SCHEME | CHARACTER | EXPLICIT | EXPLICIT | IMPLICIT | Determines the solution scheme used in CMS-Flow. |
Solver Options
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.
Card | Arguments | Default | Range | Description |
---|---|---|---|---|
MATRIX_SOLVER | CHARACTER | GMRES | GAUSS-SEIDEL | GAUSS-SEIDEL-SOR | BICGSTAB | GMRES | Selects the matrix solver for flow, sediment and salinity. |
HYDRO_MAX_ITERATIONS | INTEGER | Function of grid size | >0 | Sets the maximum number of iterations for the flow (hydro) solver (outer loop). |
PRESSURE_ITERATIONS | INTEGER | Depends on Solver | >0 | Sets the number of solver iterations for the pressure equation (inner loop). |
VELOCITY_ITERATIONS | INTEGER | Depends on Solver | >0 | Sets the number of solver iterations for the velocity or momentum equations (inner loop). |
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 |
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
Table 5. CMS-Flow cards related to numerical methods.
Card | Arguments | Default | Range | Description |
---|---|---|---|---|
ADVECTION_SCHEME | CHARACTER | EXPONENTIAL | NONE | HYBRID | EXPONENTIAL | HLPA | Sets the advection scheme for flow, sediment and salinity. |
Wetting and Drying
Table 5. CMS-Flow cards related to numerical methods.
DRYING_DEPTH | REAL | Calculated based on solution scheme and courant number | none | Sets to the time step for hydrodynamics in seconds. |
WATER_PONDING | CHARACTER | OFF | ON | OFF | Turns On or Off water ponding. If water ponding is Off, isolated bodies of water will become dry. |
ONE_CELL_WIDE_CHANNELS | CHARACTER | ON | ON | OFF | Limits wetting and drying to areas with at least 3 cells wide. When turned off, the model stability is improved. |
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 | Range | Description |
---|---|---|---|---|
NUM_THREADS | INTEGER | 1 | Determines the number of threads used for parallel processing. | |
OPENMP_THREADS | INTEGER | 1 | Determines the number of threads used for parallel processing. |
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:
- Setting up alternatives
- Creating batch file
- 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 Alternatives
In this example, 4 cases or alterantives are setup using the Matlab script below. The script copies the base setup files into subfolders and then modifies specific CMS-Flow cards in the *.cmcards file. The settings for each case are setup using a structure variable with field names corresponding to each CMS-Flow card (e.g. TIME_SERIES_INCREMENT). Separating each case into its own subfolder keeps the input and output separate and also allows for the different cases to be run at the same time.
% Matlab Script: setup_cases.m clear all flow = 'Flow_Shark'; wave = 'Wave_Shark'; ncases = 4; %Number of cases or alternatives r(1).MANNINGS_N_DATASET = '"Manning_Alt1.h5" "Flow_Shark/Datasets/ManningsN"'; r(1).WAVE_CURRENT_MEAN_STRESS = 'W09'; r(1).TIME_SERIES_INCREMENT = 1800; r(2).MANNINGS_N_DATASET = '"Manning_Alt1.h5" "Flow_Shark/Datasets/ManningsN"'; r(2).WAVE_CURRENT_MEAN_STRESS = 'DATA2'; r(2).TIME_SERIES_INCREMENT = 900; r(3).MANNINGS_N_DATASET = '"Manning_Alt2.h5" "Flow_Shark/Datasets/ManningsN"'; r(3).WAVE_CURRENT_MEAN_STRESS = 'W09'; r(3).TIME_SERIES_INCREMENT = 900; r(4).MANNINGS_N_DATASET = '"Manning_Alt2.h5" "Flow_Shark/Datasets/ManningsN"'; r(4).WAVE_CURRENT_MEAN_STRESS = 'DATA2'; r(4).TIME_SERIES_INCREMENT = 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 return
The script above requires the subroutine below.
function setcard(cmcardsfile,card,value) % setcard(file,card,value) % Overwrites or appends a CMS-Flow card % in the *.cmcards file copyfile(cmcardsfile,'temp') fid=fopen('temp','r'); fid2=fopen(cmcardsfile,'w'); nc=length(card); ok = false(1); if ~ischar(value) value = num2str(value); end while 1 tline = fgets(fid); if ~ischar(tline), break, end if strncmp(card,tline,nc) fprintf(fid2,'%s %s %s' ,card,value,tline(end)); ok = true(1); continue end nline = length(tline); if (~ok && strcmp(tline(1:min(nline,14)),'END_PARAMETERS')) fprintf(fid2,'%s %s %s',card,value,tline(end)); fprintf(fid2,'%s' ,tline); break end fprintf(fid2,'%s' ,tline); end fclose(fid); fclose(fid2); delete('temp') return
Batch File
Although it is possible to launch CMS from Matlab a batch file is preferable to use a batch file because it allows running all of the cases without opening Matlab.
% Matlab Script: create_bat.m cmsexe = 'cms2d_v4b42_x64p.exe'; %CMS-Flow executable batfile = 'run_cases.bat'; %Output batch file fid = fopen(batfile,'w'); for i=1:ncases cmcards = ['.\Case',int2str(i),'\',flow,'.cmcards']; %CMS-Flow cmcards file fprintf(fid,'START %s %s %s',cmsexe,cmcards,char(10)); end fclose(fid); return
The following text shows what the resulting batch file (*.bat) looks like
START cms2d_v4b42_x64p.exe .\Case1\Flow_Shark.cmcards START cms2d_v4b42_x64p.exe .\Case2\Flow_Shark.cmcards START cms2d_v4b42_x64p.exe .\Case3\Flow_Shark.cmcards START cms2d_v4b42_x64p.exe .\Case4\Flow_Shark.cmcards
To run the batch file, simply double click on the file and each case will launch separately in its own MS-DOS window.
Plotting
The following example reads the Observation Point time series output file (*_eta.txt) and plots the 3rd
% Matlab Script: plot_cases.m close all eta = cell(ncases,1); for i=1:ncases etafile = ['.\Case' ,int2str(i),'\',flow,'_eta.txt' ]; %Water elevation eta{i} = load(etafile); end figure hold on for i=1:ncases h = plot(eta{i}(:,1),eta{i}(:,3),'-'); %3 is the index is the observation point index end ylabel('Water elevation, m') xlabel('Elapsed Time, hr') 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 |