Download presentation
Presentation is loading. Please wait.
Published byColleen Maxwell Modified over 9 years ago
1
MS 698: 2014 Implementing a Hydrodynamic Model - Part 2 Julia Moriarty 14 February 2014
2
Previously… Governing Equations Horizontal and Vertical Grid Time-Stepping (Mode-splitting) Compiling and Running 1D Test Case Basic plots in MATLAB This Week Changing Inputs, Outputs Practice Plotting
3
Types of Input What types of input did we change last class?
4
Types of Input 1.Header file: sed_toy.h 2.Analytical files: ana_smflux.h, etc. 3.NetCDF files: boundary_conditions.nc, etc. Not in SED_TOY 4.‘The’ input file: ocean_sed_toy.in
5
The Header File: ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … … Examples of header files for test cases Header file for model run: sed_toy.h
6
The Header File: sed_toy.h ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … …
7
What does the header file do? Defines or undefines options, usually related to the model setup and parameterizations Model Code: e.g. *.h, *.F
8
What does the header file do? Defines or undefines options, usually related to the model setup and parameterizations Model Code: e.g. *.h, *.F Model Code used for your model run: PROJECT/Build/*.f90 Compile
9
What does the header file do? Defines or undefines options, usually related to the model setup and parameterizations Model Code: e.g. *.h, *.F Model Code used for your model run: PROJECT/Build/*.f90 Compile
10
What options are available for header files? ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … … cppdefs.h lists all options for header files -also see ROMS wiki: https://www.myroms.org/wi ki/index.php/Documentation _Portal
11
Model Forcing: Analytical files vs. NetCDF files Both analytical and NetCDF files provide ways to force your model (e.g. winds, model bathymetry, boundary information) – Only use one at a time for a particular forcing NetCDF files provide timeseries of data, more complicated model grids Analytical files are useful for simple forcing functions, e.g. constant or sinusoidal wind forcing, constant water depth, etc.
12
Analytical Files: e.g. ana_smflux.h ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … …
13
Analytical Files: ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … … Original copies of analytical files: ana_*.h Edited copies of analytical files stored in one of these directories
14
Analytical Files: ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … … Original copies of analytical files: ana_*.h Edited copies of analytical files stored in one of these directories Steps: 1.Specify directory for edited analytical files in build.bash (In this class, we used Include, not Functionals) 2.Copy original ana_*.h file to your PROJECT/Functionals or Include directory 3.Edit ana_*.h file(s) 4.(Re)compile code
15
NetCDF Files: ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … …
16
NetCDF Files: ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … … Examples of NetCDF forcing files (and *.in files) NetCDF forcing files may be stored anywhere, but are often stored here.
17
‘The’ Input Files Main input file: ocean.in Ocean.in calls other input files – sediment.in, floats.in, stations.in, …
18
‘Input Files’: ocean.in, sediment.in ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … … Examples of input files (and NetCDF forcing files) Input files may be stored anywhere, but it are often stored here.
19
What’s in ocean.in? Timesteps Open boundary conditions Basic horizontal and vertical grid information Directions for output files Paths for other input and output files (e.g. NetCDF files, sediment_sed_toy.in, ocean_his.nc) … and much more … The second half of the ocean.in file is a glossary explaining all of the different parameters in ocean.in
20
Editing Code and Input Files
21
Useful Linux Tools for Editing Code: Be creative: *,..,., ‘|more’, ‘> outfile.txt’ work with most commands CommandDescription diff file1.txt file2.txtPrints out a line-by-line comparison of file1.txt and file2.txt to the command line. diff file1.txt file2.txt > file1_vs_file2.txtCreates file1_vs_file2.txt, which is a line-by-line comparison of file1.txt and file2.txt grep SED_TOY ana_smflux.hPrints out line numbers of all occurrences of “SED_TOY” in ana_smflux.h to the command line grep SED_TOY ana_*.hPrints out line numbers of all occurrences of “SED_TOY” in all files starting with “ana_” and ending in (“.h”) to the command line grep SED_TOY * |morePrints out line numbers of all occurrences of “SED_TOY” in all files in this directory in the command line. The “|more” makes Linux print out only one page’s worth of text at a time. Press the spacebar or Enter to scroll through results. From within Emacs: Ctrl-s When prompted (at the bottom of the window) enter a string to search for, e.g. ‘SED_TOY’ Searches for “SED_TOY” within the file you have open in Emacs. This is case sensitive. Emacs begins searching from wherever your cursor is, moving downward in the document. To search upwards, use ‘Ctrl-r’ instead of ‘Ctrl-s’.
22
Other Useful Linux Tools: Be creative: ‘*’, ‘..’, ‘|more’, ‘> outfile.txt’ work with most commands Be careful with case-sensitive commands CommandDescription more file.txtScroll through file.txt in the command line ls */*/*.inList any file ending in “.in” that is located two directories below the current working directory. ls../../ana_*List all files starting with “ana_” that are located two directories above the current working directory ls../../trunk/ROMS/Functionals/ana_*List all files starting with “ana_” that are located two directories up, and then within the trunk/ROMS/Functionals directory tail ocean_sed_toy.logPrint out the last few lines of the file ocean_sed_toy.log tail –f ocean_sed_toy.logPrint out the lines of the file ocean_sed_toy.log as the file is written From within ROMS model code: write(6,*) ‘text’ variable Prints out “ text value_of_variable” to the log file in ROMS.
23
Is ROMS doing what you think its doing? ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … … Check output files *.f90 files are human- readable versions of the compiled code
24
Is ROMS doing what you think its doing? ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … … Check, then check again -Is the model code correct? -Does the model produce reasonable output? -Trouble shoot: -Look at *.f90’s, log file -Use write statements
25
Overview of Output Files History Files: ocean_his.nc – Stores time-series of instantaneous output. Time-Averaged Results: ocean_avg.nc – Stores time-series of time averaged values. Restart File: ocean_rst.nc – Used to restart a model run from exactly where it ended. Log File: ocean_sed_toy.log – Text file with information on model configuration, error messages, and much more. – Only created if specified in the oceanS command: oceanS Results/ocean_sed_toy.log &
26
ROMS Output ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … … Output files may be stored anywhere, but are often stored here.
27
ROMS Output: Location specified in ocean.in ROMS_OneD trunk PROJECT Results Build External ROMS Include Functionals External Include Functionals … …
28
Manipulating Output Files “Directions” for output files in ocean_*.in: – NHIS – number of time-steps between writing fields into history file – NDEFHIS – number of time-steps between the creation of a new history file. NDEFHIS = 0 creates a single history file. – HISNAME – name and path for history file – Hout(*) – Tells model if it should prints out each variable to the history file
29
Questions? >> Start lab activity
30
Manipulating Time Steps DT – Time-step (baroclinic) in seconds NDTFAST – number of barotropic time-steps between each baroclinic time step NTIMES – Total number of baroclinic timesteps. DSTART – First Timestamp of model “Δt in history file” = DT * NHIS “Total Model Time” = DT*NTIMES
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.