Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
scrollbar

Table of Contents

XBeach

XBeach is a two-dimensional model for wave propagation, long waves and mean flow, sediment transport and morphological changes of the nearshore area, beaches, dunes and backbarrier during storms.

Example FEWS general adapter run config

XBeach Module Adapter - summary

This page describes the XBeach module adapter, its functions, and provides an example for configuring a XBeach run in FEWS.

The pre-adapter creates the model specific output by replacing tags in template files:

  • zs0file.txt for water level input file zs0file.txt
  • bcfile.txt and bc.timeXXX.sp2 for SWAN spectrum input files
  • params.txt for run information

Furthermore, the pre-adapter writes log messages to a log file called xbeach.log.

There is no post-adapter, since XBeach can be configured to use netcdf as output format that is readable by FEWS.

XBeach pre-adapter
Anchor
preadapter
preadapter

Model pre-adapter for running a XBeach model from Delft-FEWS.

Class name: nl.deltares.xbeach.XBeachPreAdapter

Properties

No specific properties need to be configured for a model run.

There is however extra functionality provided via the properties but this is not needed if the model is setup correctly.
Configured properties starting with "PARAM_" will be added or replaced literally without "PARAM_" (and in lower case) in the params.txt file which defines the parameters for an XBeach model run.
This functionality should only be used as a debug option and only by someone that understands the XBeach properties in params.txt. To setup a model make sure you use a correctly configured params.txt so this functionality is not needed.

Notes for users

  • For all files that are written by this adapter, if the file to be written already exists, then it will be overwritten.
  • This program writes log messages to a log file called xbeach.log.
  • This program does not make use of a template file, parameters are automatically added and replaced in params.txt without the use of tags.
  • This program uses the information in the specified netcdf run file as input and uses this information to do the following actions:
    1. Create the water level input file: zs0file.txt, see water level conversion
    2. Create the SWAN spectrum input files bcfile.txt and bc.timeXXX.sp2, see wave spectrum conversion
    3. Replace or add the parameters 'tstart' and 'tstop' in params.txt, see parameter conversion

System requirements

  • This program needs Java version 1.7 or higher.
  • This program needs the following Java libraries:
    • castor-0.9.5.jar
    • commons-httpclient-3.0.1.jar
    • Delft_Util.jar
    • fews-xbeach-adapter.jar
    • log4j-1.2.14.jar
    • netcdf-4.2.jar
    • slf4j-api-1.5.6.jar
    • slf4j-log4j12-1.5.6.jar
    • xercesImpl.jar

Xbeach post-adapter
Anchor
postadapter
postadapter

There is no need for an Xbeach post-adapter since XBeach can be configured to use netcdf as output format that is readable by FEWS.

Example configuration generalAdapterRun

A complete example model run configuration file can be found here: XBeachAdapterRun.xml
Information how to prepare a FEWS environment to be able to use the FEWS model adapter can be found here: XBeach FEWS setup

Start up activities

As a first activity it can be useful to delete all files present in the workDir, if for example it would be filled with files from a previous run.

Code Block
xml
xml
titlestart up activities
		<startUpActivities>
			<purgeActivity>
				<filter>workDir*</filter>
			</purgeActivity>
		</startUpActivities>

Export activities

The first steps in the general adapter run are the data set, netcdf and run file export activities. The <exportDataSetActivity> will extract a zip file with the module instance id as file name located in "Config\ModuleDataSetFiles\" of the FEWS environment to the workdir. The <exportNetcdfActivity>'s will be a netcdf file (bcfile.nc) containing Swan wave spectra over time and a netcdf file (zs0file.nc) containing water level over time. The <exportNetcdfRunFileActivity> will be a netcdf run file that contains information needed by the pre-adapter. The information will be automatically filled by the general adapter but properties can be configured as extra information. For example properties starting with "PARAM_" will be added or replaced literally without "PARAM_" (and in lower case) in the params.txt file which defines the parameters for an XBeach model run. An example is given in the config below as <string key="PARAM_OUTPUTFORMAT" value="netcdf"/> this adds or replaces parameter 'outputformat' in params.txt and assigns the value 'netcdf'. All parameters should however be already correctly set in params.txt so these property should not be necessary.

Code Block
xml
xml
titleexport activities
		<exportActivities>
			<exportDataSetActivity>
				
Code Block

<?xml version="1.0" encoding="UTF-8"?>
<generalAdapterRun xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/generalAdapterRun.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.wldelft.nl/fews">
	<general>
		<piVersion>1.8</piVersion>
		<rootDir>rootDir</rootDir>
		<workDir>workDir</workDir>
		<exportDir>exportDir</exportDir>
		<importDir>importDir</importDir>
		<dumpFileDir>dumpFileDir</dumpFileDir>
		<dumpDir>dumpDir</dumpDir>
		<diagnosticFile>pi_diag.xml</diagnosticFile>
	</general>
	<activities>
		<exportActivities>
			<exportNetcdfActivity>
				<exportFile>swanxbinput.nc</exportFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>Run_XBeach</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>EnDens</parameterId>
						<domainParameterId>AFREQ</domainParameterId>
						<domainParameterId>NDIR</domainParameterId>
						<locationId>Dummy</locationId>
						<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="hour"/>
						<relativeViewPeriod unit="hour" start="-24" end="0"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>1</synchLevel>
					</timeSeriesSet>
				</timeSeriesSets>
			</exportNetcdfActivity>
			<exportNetcdfActivity>
				<exportFile>1xbinput.nc</exportFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>Run_XBeach</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>H_mean</parameterId>
						<locationId>Dummy</locationId>
						<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="minute" multiplier="10"/>
						<relativeViewPeriod unit="hour" start="-24" end="0"/>
						<readWriteMode>add originals</readWriteMode>
					</timeSeriesSet>
				</timeSeriesSets>
			</exportNetcdfActivity>
			<exportRunFileActivity>
				<description>This pi run file is passes as argument to XBeachPreAdapter</description>
				<exportFile>pi_run\pi-run.xml</exportFile>
				<properties>
					<description>Specific configuration required for MyPreAdapter and MyPostAdapter</description>
					<string key="TIDE_VARIABLE" value="H_mean"/>
					<string key="TIME_VARIABLE" value="time"/>
					<string key="PARAM_TUNITS" value="seconds since 2001-01-01"/>
					<string key="PARAM_OUTPUTFORMAT" value="netcdf"/>
					<string key="PARAM_TSTOP" value="36000"/>
				</properties>
			</exportRunFileActivity>
		</exportActivities>
		<executeActivities>
			<executeActivity>
				<command>
					<className>com.deltares.fews.xbeachadapters.preadapter.XBeachPreAdapter</className>
					<binDir>adapter\bin</binDir>
				</command>
				<arguments>
					<argument>pi_run\pi-run.xml</argument>
				</arguments>
				<timeOut>99999999</timeOut>
			</executeActivity>
			<executeActivity>
				<command>
					<executable>runxb.bat</executable>
				</command>
				<timeOut>99999999</timeOut>
			</executeActivity>
		</executeActivities>
		<importActivities>
			<importPiNetcdfActivity>
				<importFile>xboutput.nc</importFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>Run_XBeach</moduleInstanceId>
			</exportDataSetActivity>
			<valueType>grid</valueType><exportNetcdfActivity>
				<exportFile>bcfile.nc</exportFile>
				<parameterId>H_max</parameterId><timeSeriesSets>
						<locationId>Dummy</locationId><timeSeriesSet>
						<timeSeriesType>external historical</timeSeriesType><moduleInstanceId>Run_XBeach</moduleInstanceId>
						<timeStep unit="hour"/><valueType>scalar</valueType>
						<readWriteMode>add originals<<parameterId>EnDens</readWriteMode>parameterId>
						<<domainParameterId>AFREQ</timeSeriesSet>domainParameterId>
				<		<domainParameterId>NDIR</timeSeriesSets>domainParameterId>
						<<locationId>Dummy</importPiNetcdfActivity>locationId>
		</importActivities>
	</activities>
</generalAdapterRun>

The first steps in the general adapter run are the netcdf and run file export activities, the exported files will be a netcdf file (swanxbinput.nc) containing Swan golf spectra over time and a netcdf file (1xbinput.nc) containing water level over time. The exported run file will contain properties that can be used by the pre adapter. For example:

  • TIDE_VARIABLE: name of netcdf variable containing water level
  • PARAM_TUNITS: meaning of the time values in XBeach input and output files. For example "seconds since 2001-01-01"
  • PARAM_OUTPUTFORMAT: XBeach parameter specifying the output format. Has to be "netcdf" for FEWS to import
  • PARAM_TSTOP: XBeach parameter specifying end of XBeach run: for example "36000" which in this case means after 10 hours

Properties starting with "PARAM_" will be passed literally to XBeach without "PARAM_"

Code Block

		<exportActivities>
			<exportNetcdfActivity>
				<exportFile>swanxbinput.nc</exportFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>Run_XBeach</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>EnDens</parameterId>
						<domainParameterId>AFREQ</domainParameterId>
						<domainParameterId>NDIR</domainParameterId>
						<locationId>Dummy</locationId>
						<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="hour"/>
						<relativeViewPeriod unit="hour" start="-24" end="0"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>1</synchLevel>
					</timeSeriesSet>
				</timeSeriesSets>
			</exportNetcdfActivity>
			<exportNetcdfActivity>
				<exportFile>1xbinput.nc</exportFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>Run_XBeach</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>H_mean</parameterId>
						<locationId>Dummy</locationId>
						<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="minute" multiplier="10"/>
						<relativeViewPeriod unit="hour" start="-24" end="0"/>
						<readWriteMode>add originals</readWriteMode>
					</timeSeriesSet>
				</timeSeriesSets>
			</exportNetcdfActivity>
			<exportRunFileActivity>
				<description>This pi run file is passes as argument to XBeachPreAdapter</description>
				<exportFile>pi_run\pi-run.xml</exportFile>
				<properties>
					<description>Specific configuration required for MyPreAdapter and MyPostAdapter</description>
					<string key="TIDE_VARIABLE" value="H_mean"/>
					<string key="TIME_VARIABLE" value="time"/>
					<string key="PARAM_TUNITS" value="seconds since 2001-01-01"/>
					<string key="PARAM_OUTPUTFORMAT" value="netcdf"/>
					<string key="PARAM_TSTOP" value="36000"/>
				</properties>
			</exportRunFileActivity>
		</exportActivities>
				<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="hour"/>
						<relativeViewPeriod unit="hour" start="-24" end="0"/>
						<readWriteMode>add originals</readWriteMode>
						<synchLevel>1</synchLevel>
					</timeSeriesSet>
				</timeSeriesSets>
			</exportNetcdfActivity>
			<exportNetcdfActivity>
				<exportFile>zs0file.nc</exportFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>Run_XBeach</moduleInstanceId>
						<valueType>scalar</valueType>
						<parameterId>H_mean</parameterId>
						<locationId>Dummy</locationId>
						<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="minute" multiplier="10"/>
						<relativeViewPeriod unit="hour" start="-24" end="0"/>
						<readWriteMode>add originals</readWriteMode>
					</timeSeriesSet>
				</timeSeriesSets>
			</exportNetcdfActivity>
			<exportNetcdfRunFileActivity>
				<description>This run file is passed as argument to XBeachPreAdapter</description>
				<exportFile>run.nc</exportFile>
				<properties>
					<string key="PARAM_OUTPUTFORMAT" value="netcdf"/>
				</properties>
			</exportNetcdfRunFileActivity>
		</exportActivities>

Execute activities

The next steps are the execute activities.
The first will be the pre-adapter. This program will read the run.nc input file and use the contents for instructions on which directory and files should be used to convert to the correct XBeach input format. The pre-adapter generates a log file called XBeach.log, which can be read into FEWS by coupling line patterns to FEWS log messages.
The second execute activity will be the module run. XBeach generates different log files with different meaning, in the configuration below, all line from XBerror.txt are coupled to error messages in FEWS, all lines from XBwaring.txt are coupled to info messages in FEWS and all lines in XBlog.txt are coupled to debug messages in FEWS.

Code Block
xml
xml
titleexecute activities
		<executeActivities>
			<executeActivity>
				<command>
					<className>nl.deltares.xbeach.XBeachPreAdapter</className>
					<binDir>adapter\bin</binDir>
				</command>
				<arguments>
					<argument>run.nc</argument>
				</arguments>
				<logFile>
					<file>XBeach.log</file>
					<errorLinePattern>ERROR*</errorLinePattern>
					<warningLinePattern>WARN*</warningLinePattern>
					<infoLinePattern>INFO*</infoLinePattern>
					<debugLinePattern>DEBUG*</debugLinePattern>
				</logFile>
				<timeOut>99999999</timeOut>
			</executeActivity>
			<executeActivity>
				<command>
					<executable>xbeach.exe</executable>
				</command>
				<logFile>
					<file>XBerror.txt</file>
					<errorLinePattern>*</errorLinePattern>
				</logFile>
				<logFile>
					<file>XBwarning.txt</file>
					<infoLinePattern>*</infoLinePattern>
				</logFile>
				<logFile>
					<file>XBlog.txt</file>
					<debugLinePattern>*</debugLinePattern>
				</logFile>
				<timeOut>99999999</timeOut>
			</executeActivity>
		</executeActivities>

 

Anchor
wavespectrumconversion
wavespectrumconversion

Wave spectrum conversion

"bcfileThe next steps are the execute activities. The first will be the pre adapter. This program will read the pi-run.xml input file and use the properties for instructions on which directory and files should be used to convert to the correct XBeach input format. In this example "swanxbinput.nc" will be used to write the golf wave spectra into the following format:

  • wavesbcfile.txt referencing to golf wave spectrum files and a time of how long these should be used in each calculation step
Code Block

FILELIST
  3600.0      1.0 egx.loct001.sp2
  3600.0      1.0 egx.loct002.sp2
  3600.0      1.0 egx.loct003.sp2
  3600.0      1.0 egx.loct004.sp2
  3600.0      1.0 egx.loct005.sp2
  3600.0      1.0 egx.loct006.sp2
  3600.0      1.0 egx.loct007.sp2
  3600.0      1.0 egx.loct008.sp2
  3600.0      1.0 egx.loct009.sp2
  3600.0      1.0 egx.loct010.sp2
  • egx.loct001.sp2 containing a golf spectrum
none
none
titlewaves.txt
FILELIST
3600.0      1.0 bc.time001.sp2
3600.0      1.0 bc.time002.sp2
3600.0      1.0 bc.time003.sp2
3600.0      1.0 bc.time004.sp2
3600.0      1.0 bc.time005.sp2
3600.0      1.0 bc.time006.sp2
3600.0      1.0 bc.time007.sp2
3600.0      1.0 bc.time008.sp2
3600.0      1.0 bc.time009.sp2
3600.0      1.0 bc.time010.sp2
  • bc.time001.sp2 containing a wave spectrum
  • The conversion will use either "EnDens" or "VaDens" variable from "bcfile.nc" for the values, using the unitstring specified with the variable
Code Block
none
none
titlebc.time001.sp2
SWAN   1                                Swan standard spectral file, version
$   Data exported by FEWS for SWAN
$   Project:                 ;  run number:
TIME                                    time-dependent data
     1                                  time coding option
LONLAT                                  locations in spherical coordinates
     1                                  number of locations
   4.6019540   52.6194688
AFREQ                                   1/s
    25                                  number of frequencies
    0.0500
    0.0566
    0.0642
   ...
    0.7791
    0.8827
    1.0000
NDIR                                    degrees
    36                                  number of directions
  265.0000
  255.0000
  245.0000
  ...
  -65.0000
  -75.0000
  -85.0000
QUANT
     1                                  number of quantities in table
VaDens                                  id
m2/Hz/degrees                           unit
   -0.9900E+02                          exception value
20010101.000000                         date and time
FACTOR
    0.0011500214
     0     0     0     0     0     0
Code Block

SWAN   1                                Swan standard spectral file, version
$   Data exported by FEWS for SWAN
$   Project:                 ;  run number:     
TIME                                    time-dependent data
     1                                  time coding option
LONLAT                                  locations in spherical coordinates
     1                                  number of locations
   4.6019540   52.6194688
AFREQ                                   1/s
    25                                  number of frequencies
    0.0500
    0.0566
    0.0642
    0.0727
    0.0824
    0.0933
    0.1057
    0.1198
    0.1357
    0.1538
    0.1742
    0.1974
    0.2236
    0.2533
    0.2870
    0.3252
    0.3684
    0.4174
    0.4729
    0.5357
    0.6070
    0.6877
    0.7791
    0.8827
    1.0000
NDIR                                    degrees
    36                                  number of directions
  265.0000
  255.0000
  245.0000
  235.0000
  225.0000
  215.0000
  205.0000
  195.0000
  185.0000
  175.0000
  165.0000
  155.0000
  145.0000
  135.0000
  125.0000
  115.0000
  105.0000
   95.0000
   85.0000
   75.0000
   65.0000
   55.0000
   45.0000
   35.0000
   25.0000
   15.0000
    5.0000
   -5.0000
  -15.0000
  -25.0000
  -35.0000
  -45.0000
  -55.0000
  -65.0000
  -75.0000
  -85.0000
QUANT
     1                                  number of quantities in table
EnDens                                  id
m                                       unit
   -0.9900E+02                          exception value
20010101.000000                         date and time
FACTOR
    0.0011500214
     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
     1     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1
    40    27     9     3     3     3     2     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     2     9    28
   610   294    70    17    24    31    17     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1     2     6    67   303   626
  4916  1621   268    57   119   193   145    23     0     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     2    22     2   138  1780  5295  7229
 13782  3341   415    94   287   659   803   340     0     6     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     5   110     0  2483 14433 28039 27099
 14186  2446   257    68   290   982  1874  1407     5     3     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0    23   199    13 18569 52381 62127 39577
 10369  1638   231    37    90   431  1241  1598   227     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1     0   134     0  6006 60920 99999 80353 37089
  8225  1923   361    54    17    70   324   770   448     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     2     0   243     0 19514 61735 77305 54223 24535
  6742  1962   381    88    21     6    30   143   211     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     5    11   135  1424 17649 39514 42814 28100 15442
  5744  2480   622   147    34     5     1     8    30     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1     5    17    43   755  5862 14973 26004 27283 16631  9808
  4448  2618  1011   228    41     6     0     0     2     2     0     0     0     0     0     0     0     0     0     0     0     0     0     0     2     6    17    56   314  2681  7085 12219 16272 15103  9139  6001
  2853  2150   977   217    34     5     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     2     7    21    43   137  1166  4059  6894 10203 11026  8682  5250  3507
  1818  1588   752   160    20     4     1     0     0     0     2     0     0     0     0     0     0     0     0     0     0     0     1     7    22    47   115   452  2618  4596  7073  7853  7279  4838  2895  2116
  1064   927   597   168    23     3     0     0     0     0     2     0     0     0     0     0     0     0     0     0     0     2     6    17    43   115   351  1453  3434  4082  5334  4763  3704  2374  1383  1151
   517   534   423   142    23     2     0     0     0     0     0     0     0     0     0     0     0     0     0     0     2     5    14    31    94   320  1057  2305  2936  3430  3899  2690  1796  1182   789   561
   243   299   202    87    17     1     0     0     0     0     0...     0     0     0
     0     0     0     0     0     20     0 4    110    27 0   77  0 270   830 ... 1571  1849  22370  2438  2162 0 1571  1097  0
 756   329 0  262
   1370   112  0  87   0 51    120     10     0     0     0     0     0...     0     0     0
     01     01     0     0     20     30     80    22 0   70  0 235   589 0  892  1188 ... 1367  1479  14750  1019   7040   581   2431
    9840   120
 27   86  9  40   3 34    183     53     12     0     0     0     0...     2  0   9  0  28
   0610   294  0  70   0 17    024    31 0   17  1   0  3   0  7   0 15    50...   180 67  421 303  505 626
  6834916  1621 727  268 856   81057   734119   555193   432145   357 23  137   1170   142
  1  55   ... 21 1780  5295  87229
 13782  3341  4 415    294   287  0 659   803 0  340   0  0   0  6   0  ... 14433 28039 027099
 14186  2446  0 257    068   290  0 982  1874  01407     05     03     2... 52381 62127 39577
 10369 4 1638   12231    37   110 90  230 431  3241241  1598 413  227 458   450 0  519   430... 99999 80353 31937089
  8225 252 1923  282 361  190  54 137   12317    87
70   324 24   770 13  448   3  0   1  ... 77305 54223 024535
  6742  1962 0  381   0 88    021     06    30 0  143   0211     0     0... 42814 28100 15442
  5744 0 2480   622 0  147   0 34    1 5    2 1    6 8   20 30   63  0 115   164 ... 27283 21216631  9808
 237 4448  2982618  1011 277  228 258   20141   203  6 183   134 0  116   0 83    742    62
 2    6 ... 15103  9139 7 6001
  2853  12150   977  0 217    034     05     01     0     0     0     0...  8682  5250 0 3507
  1818  01588   752  0 160    020     04     01     20     70    25 0   58   ... 92 4838  1172895  2116
 144 1064  148 927  157 597  162 168  149  23 131   123 3  112   0 98    800    58 0   27  0  16
   ...  62374  1383  1151
 3  517   0534   423  0 142    023     02     0     0     0     0     0...  1182   0789   561
  0 243   299 0  202   0 87    017     01     20     70    23 0   44  0  67   ... 69  756  84 329   98 262
   90137   112 89   87 85   51 76   12 68    651    56 0   51  0  39   0 20    10

Code Block

		<executeActivities>
			<executeActivity>
				<command>
					<className>com.deltares.fews.xbeachadapters.preadapter.XBeachPreAdapter</className>
					<binDir>adapter\bin</binDir>
				</command>
				<arguments>
					<argument>pi_run\pi-run.xml</argument>
				</arguments>
				<timeOut>99999999</timeOut>
			</executeActivity>
			<executeActivity>
				<command>
					<executable>runxb.bat</executable>
				</command>
				<timeOut>99999999</timeOut>
			</executeActivity>
		</executeActivities>

In this example "1xbinput.nc" will be used to write the time dependent water levels to a file named "tide.txt". The first column specifies the time (meaning defined in "PARAM_TUNITS") and the second column water level. For now the adapter only supports the water level as a single boundary condition but XBeach has to possibility to also use 2 or 4 resulting in 1 or 3 extra columns.

Code Block

  0.0000000e+000 -2.2000000e-002
  6.0000000e+002  2.2000000e-002
  1.2000000e+003  6.4999998e-002
  1.8000000e+003  1.0800000e-001
  2.4000000e+003  1.5200000e-001
  3.0000000e+003  1.9400001e-001
  3.6000000e+003  2.3700000e-001
  4.2000000e+003  2.7900001e-001
  4.8000000e+003  3.1999999e-001
  5.4000000e+003  3.6100000e-001
  6.0000000e+003  4.0099999e-001
  6.6000000e+003  4.4100001e-001
  7.2000000e+003  4.7900000e-001
  7.8000000e+003  5.1700002e-001
  8.4000000e+003  5.5400002e-001
  9.0000000e+003  5.8999997e-001
  9.6000000e+003  6.2400001e-001
  1.0200000e+004  6.5700001e-001
  1.0800000e+004  6.9000000e-001
  1.1400000e+004  7.2000003e-001
  1.2000000e+004  7.5000000e-001
  1.2600000e+004  7.7800000e-001
  1.3200000e+004  8.0500001e-001
  1.3800000e+004  8.2999998e-001
  1.4400000e+004  8.5299999e-001
  1.5000000e+004  8.7500000e-001
  1.5600000e+004  8.9499998e-001
  1.6200000e+004  9.1399997e-001
  1.6800000e+004  9.3000001e-001
  1.7400000e+004  9.4599998e-001
  1.8000000e+004  9.5899999e-001

The pre adapter will also convert all run file string properties starting with "PARAM_" to XBeach parameters in "params.txt".
It reads an existing "params.txt" and searches for a line starting with the specified parameter and replaces the whole line with "parameter = value" or adds a new line in the same format when the parameter was not present yet.

0     ...   243    98   120
    86    40    34    18     5     1     0     0     0     0     ...   137   117   142
    55    21     8     4     2     0     0     0     0     0     ...   137   123    87
    24    13     3     1     0     0     0     0     0     0     ...    83    74    62
     6     7     1     0     0     0     0     0     0     0     ...    58    27    16
     6     3     0     0     0     0     0     0     0     0     ...    39    20    10

Anchor
waterlevelconversion
waterlevelconversion

Water level conversion

In this example "zs0file.nc" will be used to write the time dependent water levels to a file named "zs0file.txt". The first column specifies the time (meaning defined in "PARAM_TUNITS") and the second column water level. For now the adapter only supports the water level as a single boundary condition but XBeach has to possibility to also use 2 or 4 resulting in 1 or 3 extra columns.

Code Block
none
none
titlezs0file.txt
0.0000000e+000 -2.2000000e-002
6.0000000e+002  2.2000000e-002
1.2000000e+003  6.4999998e-002
1.8000000e+003  1.0800000e-001
2.4000000e+003  1.5200000e-001
3.0000000e+003  1.9400001e-001
3.6000000e+003  2.3700000e-001
4.2000000e+003  2.7900001e-001
4.8000000e+003  3.1999999e-001
5.4000000e+003  3.6100000e-001
6.0000000e+003  4.0099999e-001
6.6000000e+003  4.4100001e-001
7.2000000e+003  4.7900000e-001
7.8000000e+003  5.1700002e-001
8.4000000e+003  5.5400002e-001
9.0000000e+003  5.8999997e-001
9.6000000e+003  6.2400001e-001
1.0200000e+004  6.5700001e-001
1.0800000e+004  6.9000000e-001
1.1400000e+004  7.2000003e-001
1.2000000e+004  7.5000000e-001
1.2600000e+004  7.7800000e-001
1.3200000e+004  8.0500001e-001
1.3800000e+004  8.2999998e-001
1.4400000e+004  8.5299999e-001
1.5000000e+004  8.7500000e-001
1.5600000e+004  8.9499998e-001
1.6200000e+004  9.1399997e-001
1.6800000e+004  9.3000001e-001
1.7400000e+004  9.4599998e-001
1.8000000e+004  9.5899999e-001

Anchor
parameterconversion
parameterconversion

Parameter conversion

It is possible to change model parameters as defined in params.txt from FEWS. The pre-adapter will convert all run file properties starting with "PARAM_" to XBeach parameters in "params.txt". Example: params.txt.
It reads the existing "params.txt" and searches for a line starting with the specified parameter and replaces the whole line with "parameter = value" or adds a new line in the same format when the parameter was not present yet.

Code Block
none
none
titlesample of params.txt
Code Block

----------------------------------------------------

Grid input

nx       = 154
ny       = 70
xfile    = x.grd
yfile    = y.grd
xori     = 101627.84
yori     = 513562.63
alfa     = -8
depfile  = egmondxbeach.dep
posdwn    = -1
thetanaut = 0
thetamin  = -40
thetamax  = 40
dtheta    = 10
vardx     = 1
----------------------------------------------------
NumericsGrid input
CFLnx       = 0.8
eps154
ny       = 0.01
----------------------------------------------------
Time input
tstart70
xfile    = 0x.grd
tstopyfile  = 36000
taper	 = 100
tintgy.grd
xori     = 3600
tintm101627.84
yori     = 3600
tintp  513562.63
depfile  = 60egmondxbeach.dep
----------------------------------------------------
GeneralNumerics constantsinput
rhoCFL      = 10250.8
geps        = 90.8101
----------------------------------------------------
BoundaryTime condition options
zs0file  = tide.txt
tideloc  = 1
zs0      = 0
paulrevere = 0
instat   = 5
leftwave = 1
rightwave = 1input
tstart   = 0.
tstop = 36000
----------------------------------------------------
WaveGeneral calculation optionsconstants
breakrho    = 1
roller   = 11025
betag     = 0.1
refl 	 = 0
gamma    = 0.45
delta    = 0.0 
n        = 10.
bcfile   = waves.txt
front    = 0
snel     = 1
oldwbc   = 09.81
----------------------------------------------------
Boundary condition options
zs0file  = zs0file.txt
tideloc  = 1
----------------------------------------------------
Wave calculation options
bcfile   = bcfile.txt
----------------------------------------------------
Flow calculation options
nuh      = 0.1
nuhfac   = 1.0
C        = 55.
umin     = 0.01
----------------------------------------------------
Sediment transport calculation options
facua    = 0.10
D50      = 0.0002
D90      = 0.0003
ngd      = 1
nd  ------
Sediment transport calculation options
facua     = 300.10
structD50   = 0
sedtrans = 1
sourcesink = 0.0002
----------------------------------------------------
Morphological calculation options
morfac   = 10
morstart = 3600
wetslp   = 0.15
morphology = 1
----------------------------------------------------
Output options
outputformat = netcdf
nglobalvar = 3
zs
zb
wetz
nmeanvar = 6
H
thetamean
uu
vv
DR
zs netcdf
nglobalvar = 3
tunits = seconds since 2001-01-01

Executing model run

The next activity will be executing the XBeach model run. So far this This is done by a .bat file to be able to run the running xbeach.exe in a other directory the workdir containing the input files. It would be preferable to change this in such a way that the .bat file will not be neededmodel files.

Code Block
xml
xml
titlemodule run execute activity

			<executeActivity>
				<command>
					<executable>runxb<executable>xbeach.bat<exe</executable>
				</command>
				<timeOut>99999999</timeOut>
			</executeActivity>

Import activities

The last part of the general adapter run is importing the Xbeach XBeach output. In the case xboutput.nc contains all parameter, output and grid information of the run. This can be visualized in FEWS after defining the needed parameters, location and grid. How to do this can be found here: XBeach FEWS setup

Code Block
xml
xml
titlemodel run output import activity

		<importActivities>
			<importPiNetcdfActivity>
				<importFile>xboutput.nc</importFile>
				<timeSeriesSets>
					<timeSeriesSet>
						<moduleInstanceId>Run_XBeach</moduleInstanceId>
						<valueType>grid</valueType>
						<parameterId>H_max</parameterId>
						<locationId>Dummy</locationId>
						<timeSeriesType>external historical</timeSeriesType>
						<timeStep unit="hour"/>
						<readWriteMode>add originals</readWriteMode>
					</timeSeriesSet>
				</timeSeriesSets>
			</importPiNetcdfActivity>
		</importActivities>