DOI-USGS / COAWST

COAWST modeling system git repository
Other
105 stars 49 forks source link

switch file for WW3 inlet test #69

Closed YanJia1 closed 2 years ago

YanJia1 commented 2 years ago

Hi John, I try to run the WW3 case under the Inlet_test folder. It seems that there is no corresponding switch file. The only one I can find is switch_sandy. However, it does not work well with the ww3_shel.inp file under the inlet/WW3 folder. I have done some modifications following the sandy-case-shel.inp to uncommon the ice/mud settings, but still get the following report

*** WAVEWATCH III ERROR IN W3IOGR : ERROR IN OPENING mod_def.ww3 FILE IOSTAT = 29

I have no problem with the ROMS-SWAN coupling case, but a beginner on WW3. Thank you, Yan

jcwarner-usgs commented 2 years ago

i have not ran the ww3 inlet case in a while, and i can try to get to that today. can you try to copy the WW3/model/bin/switch_sandy toWW3/model/bin/switch_inlet_test and see if that works? if so, then we can modify the switch_inlet_test to be more specific to that case.

YanJia1 commented 2 years ago

Hi John, I tried your suggestion. It did not work, giving the same error report. I am working on a pure WW3 case, out of the COAWST frame. Try to learn how to set up those input files. I suspect that there are possible miss matches between the switch file and input files of the inlet test case. Thank you, Yan

jcwarner-usgs commented 2 years ago

how about you send a full output of the build process. start over script build.log ./coawst.bash when done type exit post the build.log here

YanJia1 commented 2 years ago

Hi John, here is the log file. Thank you. build.log

jcwarner-usgs commented 2 years ago

that looks like it compiled correctly! did you get a coawstM? type ls -ltr it also looks like this is a roms+ww3 setup. -j

YanJia1 commented 2 years ago

Hi John, It is a roms+ww3 setup for the inlet test. It generates a coaswstM. Below are the output and error reports, after submitting the job. rp-12116.out.log rp-12116.err.log

YanJia1 commented 2 years ago

Hi John, I got the coupled model run. The only file that needs to be modified is ww3_shel.inp. Uncomment lines 7-15, the ice and mud sections, as the switch_sandy file uses IC2 and BT4. Then the inlet_test case can use the switch_sandy file as its switch file. I did not know that I need to run ww3_grid and ww3_strt first to prepare files for WW3 to run. What a shame... I think the case can be closed. Thank you, Yan

jcwarner-usgs commented 2 years ago

if you look in the COAWST_User_Manual, Section 11, there are very detailed instructions step by step on how to run the code with WW3.

Section 11. Setting up a WAVEWATCH III application. As of July 2019 we have added WaveWatch III from tnbheir github site to the COAWST coupled system. WaveWatch can be run alone or coupled to ROMS, to WRF, or to both. For now we can only run one WW3 grid (ww3_shel), and if WW3 is coupled to another model(s), the other model(s) can run multiple grids. We are looking to incorporate the multi domain capability of WW3 in the future. .......

1) edit coawst.bash and set: export COAWST_APPLICATION=SANDY and set the root location of your code, such as: export MY_ROOT_DIR=/sand/usgs/users/jcwarner/tests/coawst_v3.3

2) We then need to set 5 WW3 environement settings.

1) COAWST_WW3_DIR is a pointer to root WW3 code, do not change.

export COAWST_WW3_DIR=${MY_ROOT_DIR}/WW3/model

2) WWATCH3_NETCDF can be NC3 or NC4. We need NC4 for COAWST. do not change.

export WWATCH3_NETCDF=NC4

3) WWATCH_ENV points to WW3 environment listing. do not change.

export WWATCH_ENV=${COAWST_WW3_DIR}/wwatch.env

4) NETCDF_CONFIG is needed by WW3. You need to set this:

export NETCDF_CONFIG=/usr/bin/nc-config This may require export NETCDF_CONFIG=/usr/bin/nf-config depending on your system.

5) WW3_SWITCH_FILE is like cpp options for WW3. You need to create it and

list the full name here. This is described below.

export WW3_SWITCH_FILE=switch_sandy

6) As with all applications, set the MPI and compiler information (this will depend on your system): export USE_MPI=on # distributed-memory parallelism export USE_MPIF90=on # compile with mpif90 script export which_MPI=openmpi # compile with OpenMPI library export FORT=ifort

7) Set the location of the header and analytical files: export MY_HEADER_DIR=${MY_PROJECT_DIR}/Projects/Sandy export MY_ANALYTICAL_DIR=${MY_PROJECT_DIR}/Projects/Sandy

8) For this description, we are saying to run WW3 by itself so edit Projects/Sandy/sandy.h and only list

define WW3_MODEL

9) The compiler flags for the WW3 build are taken from the Compilers/* file. For example, if you work on Linux with ifort, then the Compilers/Linux-ifort.mk file will be used for the WW3 build. You may also need to edit some WW3 specific build files. So if you selected ifort (for example), then we need to look at COAWST/WW3/model/bin/comp.Intel COAWST/WW3/model/bin/link.Intel Please look at these files (or the files needed for your compiler) to see if the flags are correct.

10) Create a switch file. The switch file is like the cppdefs file for roms. It tells WW3 what features to compile. We have a file COAWST/WW3/model/bin/switchsandy. List the full switch file name (new feature) in the coawst.bash file. The file should start with ‘switch’ Here is the switch_sandy:

F90 NOGRB COAWST LRB4 NC4 TRKNC DIST MPI PR3 UQ FLX0 LN1 ST4 STAB0 NL1 BT4 DB1 MLIM TR0 BS0 IC2 IS2 REF1 IG1 XX0 WNT2 WNX1 RWND CRT1 CRX1 TIDE O0 O1 O2 O2a O2b O2c O3 O4 O5 O6 O7

Please read the WW3 manual in the WW3 directory. Some important options are: NOPA DO NOT USE THIS. This is for stand alone WW3, and I have modified the build structure to be part of COAWST. So do not ever use it. COAWST ALWAYS list this. I have modified the build strucutrre to be part of COAWST (this is new as of June 2018.). SCRIP, SCRIPNC I don’t use the WW3 scrip but we may in the future. So these are not really needed. DIST, MPI These are to use mpi, needed.

11) compile the code by running ./coawst.bash at the command prompt. If it compiles correctly, you will get a coawstM.

12) Now we need to create some WW3 grids files. Here is a way to do that. There are probalbly many other ways to do this. You can use Tools/mfiles/mtools/create_ww3_grid_files to create an x, y, bath, and mask files for WW3. This m file uses the roms grid to create the WW3 files placed in Projects/Sandy/WW3: ww3_sandy_xcoord.dat, ww3_sandy_ycoord.dat, ww3_sandy_bathy.bot, and ww3_sandy_mapsta.inp.

13) Forcing files for WW3: again, there are probably many ways to do this, but here is one way. You can use Tools/mfiles/mtools/create_ww3_wind_forcing to create a wind forcing file ww3_sandy_wind_forc.dat.

14) We then need to create some WW3 run files using 4 of their utilities:

Utility ww3_grid

Utility ww3_strt

Utility ww3_prep

$ Define data files -------------------------------------------------- $ $ The first input line identifies the file format with FROM, IDLA and $ IDFM, the second (third) lines give the file unit number and name. 'NAME' 1 1 '(....)' '(....)' 40 'ww3_sandy_wind_forc.dat' This tells WW3 the name of the wind forcing file. cd to Projects/Sandy/WW3 and run ../../../WW3/exe/ww3_prep to create wind.ww3.

Utility ww3_shel

If we had coupled WW3 to WRF we could use F F Water levels F F Currents C F Winds And that would get coupled winds from WRF.

If we had coupled WW3 to ROMS, then we could use C F Water levels C F Currents T F Winds To get coupled fields from roms to ww3 and read a wind file.

If we had coupled WW3 to ROMS and to WRF, then we could use C F Water levels C F Currents C F Winds

You need to set the run times here: $ Type 1 : Fields of mean wave parameters 20121028 120000 1800 20121030 120000 and set to have the fields of Hwave, Dwave, and Lwave written out: $ HS LM T02 T0M1 T01 FP DIR SPR DP T T T T T T T T T

We do NOT need to run ../exe/ww3_shel because that would run the wave model. We will run the wave model as coawstM.

15) Now we are ready to run WW3. Cd to the root dir. Now we need to copy (or soft link) those ww3 files to the root location. cp Projects/Sandy/WW3/* . and use a run script to run the code on your system. We have run_coawst as an example of a run script, but you need to get a script that works on your system. You do not need to set the number of processors in any of the ww3 files. mpirun –np X ./coawstM Projects/Sandy/WW3/ww3_grid.inp

16) When the model is done you can visualize the output by using ./WW3/model/exe/ww3_ounf This will create a ww3.*.nc file called ww3.201210.nc.