diff --git a/.travis.yml b/.travis.yml index fa2dbf58f..16cda5ff5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,106 +1,116 @@ -language: c -sudo: false # use container based build -notifications: - email: false +# language: c +# sudo: false # use container based build +# notifications: +# email: false -matrix: - fast_finish: true - include: - # Image Driver - - compiler: gcc - os: linux - env: TESTID='image' - addons: - apt_packages: - - libnetcdf-dev - - netcdf-bin - - netcdf-doc - - gfortran - - valgrind - # open-mpi is built from source in image.travis - # Image Driver with rvic-routing - - compiler: gcc - os: linux - env: TESTID='image' EXTENSION='ROUT=rout_rvic' - addons: - apt_packages: - - libnetcdf-dev - - netcdf-bin - - netcdf-doc - - gfortran - - valgrind - # open-mpi is built from source in imagervic.travis - # CESM Driver - - compiler: gcc - os: linux - env: TESTID='cesm' - addons: - apt_packages: - - libnetcdf-dev - - netcdf-bin - - netcdf-doc - - gfortran - # open-mpi is built from source in cesm.travis - # Classic Driver - - compiler: clang - os: linux - env: TESTID='classic' - addons: - apt_packages: - - valgrind - sources: - - ubuntu-toolchain-r-test - - compiler: gcc - os: linux - env: TESTID='classic' - addons: - apt_packages: - - valgrind - sources: - - ubuntu-toolchain-r-test - - compiler: gcc - os: linux - env: TESTID=classic USE_CC=gcc-5 - addons: - apt: - packages: - - gcc-5 - - gcc-5-multilib - - linux-libc-dev:i386 - - valgrind - sources: - - ubuntu-toolchain-r-test - - compiler: clang - os: linux - env: TESTID=classic USE_CC=clang-3.6 - addons: - apt: - packages: - - clang-3.6 - - valgrind - sources: - - llvm-toolchain-precise-3.6 - - ubuntu-toolchain-r-test - - compiler: gcc - os: osx - env: TESTID=classic BREW_INSTALLS=valgrind - allow_failures: - # OSX build moved to allowed failures because throughput was so slow on travis - - compiler: gcc - os: osx - env: TESTID=classic BREW_INSTALLS=valgrind -before_install: - - source ci/vic_install_utils - - source ci/${TESTID}.travis - - install_miniconda - - vic_before_install -install: - - vic_install -before_script: - - vic_before_script -script: - - vic_script -after_success: - - vic_after_success -after_failure: - - vic_after_failure +# matrix: +# fast_finish: true +# include: +# # Image Driver +# - compiler: gcc +# os: linux +# env: TESTID='image' +# addons: +# apt_packages: +# - libnetcdf-dev +# - netcdf-bin +# - netcdf-doc +# - gfortran +# - valgrind +# # open-mpi is built from source in image.travis +# # Image Driver with rvic-routing +# - compiler: gcc +# os: linux +# env: TESTID='image' EXTENSION='ROUT=rout_rvic' +# addons: +# apt_packages: +# - libnetcdf-dev +# - netcdf-bin +# - netcdf-doc +# - gfortran +# - valgrind +# # open-mpi is built from source in imagervic.travis +# # CESM Driver +# - compiler: gcc +# os: linux +# env: TESTID='cesm' +# addons: +# apt_packages: +# - libnetcdf-dev +# - netcdf-bin +# - netcdf-doc +# - gfortran +# # open-mpi is built from source in cesm.travis +# # Classic Driver +# - compiler: clang +# os: linux +# env: TESTID='classic' +# addons: +# apt_packages: +# - valgrind +# sources: +# - ubuntu-toolchain-r-test +# - compiler: gcc +# os: linux +# env: TESTID='classic' +# addons: +# apt_packages: +# - valgrind +# sources: +# - ubuntu-toolchain-r-test +# - compiler: gcc +# os: linux +# env: TESTID=classic USE_CC=gcc-5 +# addons: +# apt: +# packages: +# - gcc-5 +# - gcc-5-multilib +# - linux-libc-dev:i386 +# - valgrind +# sources: +# - ubuntu-toolchain-r-test +# - compiler: clang +# os: linux +# env: TESTID=classic USE_CC=clang-3.6 +# addons: +# apt: +# packages: +# - clang-3.6 +# - valgrind +# sources: +# - llvm-toolchain-precise-3.6 +# - ubuntu-toolchain-r-test +# - compiler: gcc +# os: osx +# env: TESTID=classic BREW_INSTALLS=valgrind +# allow_failures: +# # OSX build moved to allowed failures because throughput was so slow on travis +# - compiler: gcc +# os: osx +# env: TESTID=classic BREW_INSTALLS=valgrind +# # CESM Driver, started failing when travis upgraded to gcc5 +# - compiler: gcc +# os: linux +# env: TESTID='cesm' +# addons: +# apt_packages: +# - libnetcdf-dev +# - netcdf-bin +# - netcdf-doc +# - gfortran +# before_install: +# - source ci/vic_install_utils +# - source ci/${TESTID}.travis +# - install_miniconda +# - vic_before_install +# install: +# - vic_install +# before_script: +# - vic_before_script +# script: +# - vic_script +# after_success: +# - vic_after_success +# after_failure: +# - vic_after_failure diff --git a/LICENSE.txt b/LICENSE.txt index d7f105139..cbbe45d29 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,339 +1,21 @@ -GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {description} - Copyright (C) {year} {fullname} - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - {signature of Ty Coon}, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. +MIT License + +Copyright (c) 2021 VIC Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ci/requirements.yml b/ci/requirements.yml index d13b1ce93..640f22054 100644 --- a/ci/requirements.yml +++ b/ci/requirements.yml @@ -2,7 +2,7 @@ name: vic_test_env channels: - conda-forge dependencies: - - python=3.5 + - python=3.6 - numpy - scipy - pytest diff --git a/docs/Development/ModelDevelopment.md b/docs/Development/ModelDevelopment.md index 0f1e5178a..53b0c412b 100644 --- a/docs/Development/ModelDevelopment.md +++ b/docs/Development/ModelDevelopment.md @@ -2,7 +2,7 @@ We encourage any users who have modified (or would like to modify) VIC, either to fix bugs or develop new features, to contact us and coordinate development work with us. The VIC model source code is archived in Git and is publicly available through [GitHub](https://github.com). To access the source code, visit [GitHub](https://github.com), create an account, and visit [github.com/UW-Hydro/VIC](https://github.com/UW-Hydro/VIC). The routing model will soon be added to the archive as well. -VIC is an [open source](open-source-philosophy.md) development model and is released under the terms of the [GNU General Public License v2 (GPL).](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) +VIC is an [open source](open-source-philosophy.md) development model and is released under the terms of the [MIT License](https://opensource.org/licenses/MIT). Instructions for using Git and GitHub to access the VIC code and contribute changes are here: diff --git a/docs/Development/ReleaseNotes.md b/docs/Development/ReleaseNotes.md old mode 100644 new mode 100755 index 851395ee9..aa925ee0d --- a/docs/Development/ReleaseNotes.md +++ b/docs/Development/ReleaseNotes.md @@ -15,6 +15,39 @@ To check which release of VIC you are running: ------------------------------ +## VIC 5.1.0 (December 14, 2021) + +This is a maintanence release that includes numerous bug fixes and a few model enhancements. All code changes were included in the two release candidates (5.1.0.rc1 and 5.1.0.rc2). See the notes below from the two release candidates for more details. + +#### Announcements + +1. VIC is now shared under the MIT license ([GH#917](https://github.com/UW-Hydro/VIC/pull/917)). +2. Travis-CI was disabled folling the platform's migration to travis-ci.com. See [GH#919](https://github.com/UW-Hydro/VIC/issues/919) for more details ([GH918](https://github.com/UW-Hydro/VIC/pull/918)). + +## VIC 5.1.0 rc2 (September 28, 2020) + +#### Bug Fixes: + +1. Fixed datetime handling bug in unit test module ([GH#796](https://github.com/UW-Hydro/VIC/pull/796)) + +2. Removed descriptions of forcing disaggregation options from documentation of classic driver global parameter file ([GH#831](https://github.com/UW-Hydro/VIC/pull/831)) + +3. Removed descriptions of forcing disaggregation options from documentation of image driver global parameter file ([GH#833](https://github.com/UW-Hydro/VIC/pull/833)) + +4. Fixed segmentation fault in lake model caused by incorrect passing of pointer argument to `vic_run()`. ([GH#826]((https://github.com/UW-Hydro/VIC/pull/826)) + +5. Relaxed some of the validation of lake parameters, to allow them to be null in cells containing no lakes. ([GH#826]((https://github.com/UW-Hydro/VIC/pull/826)) + +6. Fixed passing of lake data structures to `generate_default_lake_state()`. ([GH#826]((https://github.com/UW-Hydro/VIC/pull/826)) + +7. Separated the dimensions of arrays related to lake basin shape and of arrays related to the number of lake simulation layers. ([GH#826]((https://github.com/UW-Hydro/VIC/pull/826)) + +8. Added global parameter option to set the maximum number of (dynamic) lake simulation layers. ([GH#826]((https://github.com/UW-Hydro/VIC/pull/826)) + +9. Fixed bug causing ET to be 0 in pure bare soil tiles. ([GH#823]((https://github.com/UW-Hydro/VIC/pull/823)) + +------------------------------ + ## VIC 5.1.0 rc1 @@ -94,6 +127,23 @@ This is a minor update from VIC 5.0.1. The VIC 5.1.0 includes new features, such - Updates the cesm_interface_c.c routine in the CESM driver to populate the nrecs, endyear, endmonth and endday fields in the global_param struct to make them available to vic_finalize for timing tables (specifically the secs/day columns). + 1. [GH#800](https://github.com/UW-Hydro/VIC/pull/800) + + - Updates the default namelist settings for the CESM driver to include output filenames consistent with the RASM naming conventions, default thermal nodes to 10, `FULL_ENERGY` to `TRUE`, and sets defaults for daily and monthly mean output. + + 1. [GH#866](https://github.com/UW-Hydro/VIC/pull/866) + + - Updates the default output variables for the CESM driver. Also updates the VIC5 parameter file location to be the RASM inputdata directory and updates the name of the VIC5 parameter file to the new VIC5 parameters. + + 1. [GH#869](https://github.com/UW-Hydro/VIC/pull/869) + - Adds support to the CESM driver for 25km resolution RASM runs. + + 1. [GH#871](https://github.com/UW-Hydro/VIC/pull/871) + - Adds initial state files to default 50km and 25km builds so that these are used by other groups running RASM rather than VIC5 starting up from a clean start. + + 1. [GH#880](https://github.com/UW-Hydro/VIC/pull/880) + --Adds option STATENAME_CESM to the option_struct so that statefiles in the CESM driver can be in accordance with RASM naming conventions for model components. + 3. Speed up NetCDF operations in the image/CESM drivers ([GH#684](https://github.com/UW-Hydro/VIC/pull/684)) These changes speed up image driver initialization, forcing reads, and history writes by only opening and closing each input netCDF file once. @@ -126,6 +176,18 @@ This is a minor update from VIC 5.0.1. The VIC 5.1.0 includes new features, such Previously the change in cold content of the snowpack term (deltaCC in the snow_data_struct) would get unreasonably large if the Hedstrom and Pomeroy 1998 equation used to calculate snow density, which depends only on air temperature, was calculated with air temperatures above about 2 deg C. We use this term to calculate the ground flux from the snowpack and snow depth, which resulted in extremely small snow depths and unreasonably large ground fluxes from the snowpack (and thus changes in snowpack cold content). Now there is a cap on new snow density with the new parameter SNOW_NEW_SNOW_DENS_MAX as well as a snow depth below which we disregard the ground flux from the snowpack (1.e-8). +11. Added new option BULK_DENSITY_COMB that enables soil bulk density (mineral and organic) to be read from the parameters file ([GH#817](https://github.com/UW-Hydro/VIC/pull/817)) + + The option BULK_DENSITY_COMB enables soil bulk density (mineral and organic) to be read in as a parameter when the option is set to true in the global parameter file. Default is false. + +12. Turns on `ORGANIC_FRACT` option that previously existed in VIC 4 and enables the `BULK_DENSITY_COMB` option to be used in conjunction with it ([GH#837](https://github.com/UW-Hydro/VIC/pull/837)) + + The option `ORGANIC_FRACT`, if set to True, means that the organic fraction of the soil, soil density of the organic matter, and bulk density of the organic matter (if `BULK_DENSITY_COMB` is set to false) will be read in from the parameter file. If `BULK_DENSITY_COMB` is set to True, the bulk density of the organic matter will not be read in separately. Default is false. + +13. Added new option `MAX_SNOW_ALBEDO` that enables new snow albedo to be read in from the parameters file ([GH#835](https://github.com/UW-Hydro/VIC/pull/835)) + + The option `MAX_SNOW_ALBEDO`, if set to true in the global parameter file, means that new snow albedo will be read in from the parameter file and used in the snow routines for all vegetation types except for bare soil. + 10. Miscellaneous clean-up: [GH#723](https://github.com/UW-Hydro/VIC/pull/723) diff --git a/docs/Development/Testing.md b/docs/Development/Testing.md index cd7096d3a..5902b68a1 100644 --- a/docs/Development/Testing.md +++ b/docs/Development/Testing.md @@ -46,12 +46,3 @@ The VIC test suite uses a set of Python utilities and libraries to execute the s --classic=vic/drivers/classic/vic_classic.exe \ --data_dir=${SAMPLES_PATH}/data \ --examples=./tests/examples/examples.cfg - -## Travis - -VIC uses the [Travis CI](http://travis-ci.org/) continuous integration system. VIC's build tests on Travis test the compilation of the main VIC drivers using a range of environments: - -- *Compilers*: `gcc` and `clang` -- *Platforms*: `Linux` and `OSX` - -The Travis tests also run the **unit**, **system**, and **examples** tests described above. diff --git a/docs/Development/open-source-philosophy.md b/docs/Development/open-source-philosophy.md index afcb6d398..97d9948e3 100644 --- a/docs/Development/open-source-philosophy.md +++ b/docs/Development/open-source-philosophy.md @@ -1,6 +1,6 @@ # VIC Model Open Source Philosophy -VIC is Open Source software. We have licensed the source code with the [GNU GPL v2.0 license](http://www.gnu.org/licenses/gpl-2.0.html). This license provides very few restrictions on use. +VIC is Open Source software. We have licensed the source code with the [MIT license](https://opensource.org/licenses/MIT). This license provides very few restrictions on use. Our rationale for moving the VIC model development to the open source community is that we want: - to encourage other researchers and developers to contribute to the VIC development, and diff --git a/docs/Development/working-with-git.md b/docs/Development/working-with-git.md index 35e190352..fac4b5209 100644 --- a/docs/Development/working-with-git.md +++ b/docs/Development/working-with-git.md @@ -128,6 +128,9 @@ To register the deletion of a file: This will bring up a commit log in your default editor. The list of files whose changes will be committed (i.e. were registered via "git add" etc) is shown in the header at the top of the file. If you disagree with this list, exit the editor and do "git add" etc as necessary to correct the list, and then try "git commit" again. If satisfied with the list of changed files, add a description of the set of changes (including a brief description of the problem that motivated the changes). Save and exit. +### 3. Correcting code syntax issues prior to creating a PR +After completing your code commits, you also need to check that your code is compliant with VIC style conventions for indentation and spacing. Please make sure you have `uncrustify` installed (version `0.64` or later). Once you have installed `uncrustify`, you should navigate to the `...VIC/tools/code_format` directory in the VIC repo and run `uncrustify`, which you can do by running the script in that directory, `./run_uncrustify.bash`. A simple `git diff --name-only` will list all files that `uncrustify` has updated the syntax for. If any files come up that you have edited, you should commit those syntax edits. + ### Pushing commits to your fork After committing your changes, you should push them to your fork (which has the alias `origin`) stored on GitHub: diff --git a/docs/Documentation/Definitions.md b/docs/Documentation/Definitions.md index 82395653b..3c58cb0e5 100644 --- a/docs/Documentation/Definitions.md +++ b/docs/Documentation/Definitions.md @@ -7,7 +7,7 @@ VIC uses the regression published by Kimball et. al. to improve the estimation o This parameter is the temperature of the soil at the [damping depth](#dp). This temperature is often assumed to be the same as the average annual air temperature. This temperature is used as the bottom boundary of all thermal flux calculations made for the soil column. ### b_infilt -The b_infilt parameter is the parameter used to describe the Variable Infiltration Curve. This is typically a value that is adjusted during the calibration of the VIC model. Parameter values range from 10-5 to 0.4. Higher values will produce more runoff. 0.2 is often used as a starting value. +The b_infilt parameter is the parameter used to describe the Variable Infiltration Curve. This is typically a value that is adjusted during the calibration of the VIC model. Parameter values range from $10^{-5}$ to 0.4. Higher values will produce more runoff. 0.2 is often used as a starting value. ### bubble The bubble parameter is the bubbling pressure, h, for the soil texture type (see, e.g., Table 5.3.2 in Rawls, et al (Handbook of Hydrology)). This parameter is necessary for running the VIC model with `FULL_ENERGY==TRUE` or `FROZEN_SOIL==TRUE`. Values must be > 0.0. @@ -38,16 +38,16 @@ Cell numbers are assigned to each grid cell beginning with 1 at the upper left c Depth is the depth of each layer in meters. Though this can be changed in the calibration process, initially it can be set to the breakdown of layer depths selected by combining the 11 individual soil layers of the Penn State University STATSGO data (for example, the Ksat data). ### dp -This is the soil theraml damping depth. It is defined as the depth in the soil column at which the soil temperature remains nearly constant annually. This is the depth to which soil thermal flux calculations will be made, and is often set to 4m. The constant temperature at this boundary is defined with the parameter [avg_T](#avg_t). +This is the soil thermal damping depth. It is defined as the depth in the soil column at which the soil temperature remains nearly constant annually. This is the depth to which soil thermal flux calculations will be made, and is often set to 4m. The constant temperature at this boundary is defined with the parameter [avg_T](#avg_t). ### Ds -The soil parameter `Ds` represents the fraction of the Dsmax parameter at which non-linear base-flow occurs. This is typically a parameter that is adjusted during the calibration of the VIC model. An initial value of 0.001 may be used. Typically this value is small (less than 1). +The soil parameter `Ds` represents the fraction of the Dsmax parameter at which non-linear baseflow occurs. This is typically a parameter that is adjusted during the calibration of the VIC model. An initial value of 0.001 may be used. Typically this value is small (less than 1). ### Dsmax The parameter Dsmax is the maximum velocity of baseflow for each grid cell. This can be estimated using the saturated hydraulic conductivity, [Ksat](#ksat), for each grid cell multiplied by the slope of the grid cell. The values for [Ksat](#ksat) can be averaged for the layers for which baseflow will be included. When working in decimal degrees, the elevation data for the basin should be projected to an equal area map projection, in order to have horizontal dimensions in the same units as the vertical dimensions so that the slopes computed in Arc/Info are meaningful values. ### expt -The Exponent (`expt`) parameter is the exponent, `n`, from the Brooks-Corey relationship (see, e.g., Table 5.1.1 in Rawls, et al). Values can be estimated from the table of soil hydraulic properties indexed by soil texture [(see table here)](soiltext.md). Values should be > 3.0. +The exponent (`expt`) parameter is the exponent, `n`, from the Brooks-Corey relationship (see, e.g., Table 5.1.1 in Rawls, et al). Values can be estimated from the table of soil hydraulic properties indexed by soil texture [(see table here)](soiltext.md). Values should be > 3.0. Reference: Rawls et al., Infiltration and Soil Water Movement, In: _Handbook of Hydrology_, D. Maidment (ed.), 1993 @@ -69,7 +69,7 @@ The soil texture data is then imported into Arc/Info, where it is indexed to val Default value is set to 0 m/s, which works well when the model is forced with daily or monthly winds. ### NLAYER -`NLAYER` is the number of soil moisture layers to be used by the model. Typically the number of layers is 2 or 3. The model cannot be run in energy balance mode with fewer than 3 layers (the top layer is thin 5-15cm), but the water balance model used to have only 2 layers. The model has not been tested with more than 3 layers, so problems may develop. +`NLAYER` is the number of soil moisture layers to be used by the model. Typically the number of layers is 2 or 3. The model cannot be run in energy balance mode with fewer than 3 layers (the top layer is thin, 5-15cm), but the water balance model used to have only 2 layers. The model has not been tested with more than 3 layers, so problems may occur if you run the model with more than three layers. ### NODES `NODES` defines the number of soil thermal nodes used by the model to explicitly solve soil thermal fluxes. At this time the explicit solution of the soil thermal fluxes occurs only when the model is run with the frozen soil algorithm activated. The model uses a node at the surface, a node at the bottom of the thin (5-15cm) top layer, and a node at the damping depth. If more nodes are defined they are distributed evenly between the bottom of the top layer and the damping depth. More nodes improves the accuracy of the soil heat flux solution, but also increases the computational time. We recommend at least 5 nodes. @@ -110,20 +110,28 @@ Default value is set to 0 m/s, which works well when the model is forced with da \* Table copied from Texas A&M University Institute for Scientific Computation Web Page. ### phi_s -The parameter phi_s is the unitless soil moisture diffusion coefficient. This parameter is designed for the future inclusion of soil moisture diffusion in the VIC model moisture trasport equations. Currently this feature has not been implemented so a value of -999 can be used as a placeholder. +The parameter `phi_s` is the unitless soil moisture diffusion coefficient. This parameter is designed for the future inclusion of soil moisture diffusion in the VIC model moisture trasport equations. Currently this feature has not been implemented so a value of -999 can be used as a placeholder. ### resid_moist -Residual moisture content is the amount of soil moisture that cannot be removed from the soil by drainage or evapotranspiration. Values are provided to the model as soil moisture contents (volume of residual soil moisture content / total volume of soil) [mm/mm]. When residual soil moisture is defined as 0 mm/mm the soil hydraulic conductivity relationship collapses to Campbell (1974), otherwise it follows Brooks and Corey (1964). +Residual moisture content is the amount of soil moisture that cannot be removed from the soil by drainage or evapotranspiration. When residual soil moisture is defined as 0 mm/mm the soil hydraulic conductivity relationship collapses to Campbell (1974), otherwise it follows Brooks and Corey (1964). + +Values are provided to the model as soil moisture contents (volume of residual soil moisture content / total volume of soil) [mm/mm]. Note that these units are different from the input units of critical (Wcr_FRACT) and wilting point (Wpwp_FRACT), which are fractions of porosity [mm/mm]. Brooks, R. H. and A. T. Corey, Hydraulic Properties of Porous Media, Hydrology Paper 3, Colorado State University, Fort Collins, Colo, 1964. Campbell, G. S., A Simple Method for Determining Unsaturated Conductivity from Moisture Retention Data, Soil Sci., vol. 117, pp. 311-314, 1974. -### ROOT_ZONES -ROOT_ZONES is the number of root zones used in the vegetation parameter file to define the root distribution. This allows the rooting distribution to be defined independently of both vegetation type and soil layer depth. When soil moisture layer depths are changed during calibration, the model uses linear distribution based on the defined root zones to redistribute root fractions. +### root_zone +The parameter `root_zone` is the number of root zones used in the vegetation parameter file to define the root distribution. This allows the rooting distribution to be defined independently of both vegetation type and soil layer depth. When soil moisture layer depths are changed during calibration, the model uses linear distribution based on the defined root zones to redistribute root fractions. No default value is set, this parameter must be defined in the global parameter file. +### root_depth +The parameter `root_depth` describes the thickness of the root zone (the sum of depths is the total depth of root penetration) + +### root_fract +`root_fract` is the fraction of root in the current root zone. + ### rough Surface roughness of bare soil, expressed in meters, can be set to a value 0.001, and adjusted according to local data. @@ -131,7 +139,7 @@ Surface roughness of bare soil, expressed in meters, can be set to a value 0.001 The surface roughness of the snowpack, expressed in meters, can be set to an initial value of 0.0005, and can then be adjusted according to local data. ### Wcr_FRACT -The parameter Wcr_FRACT (Wcr) is the fractional soil moisture (expressed as a fraction of the maximum soil moisture; max. soil moisture = porosity * layer depth) at the critical point, which is the water content below which hydraulic conductivity begins to fall below saturated values, as does transpiration. This is set at 70% of the field capacity, in accordance with the different soil textures. Field Capacity is defined as the water content at a tension of -33kPa. +The parameter `Wcr_FRACT` (Wcr) is the fractional soil moisture (expressed as a fraction of the maximum soil moisture; max. soil moisture = porosity * layer depth) at the critical point, which is the water content below which hydraulic conductivity begins to fall below saturated values, as does transpiration. This is set at 70% of the field capacity, in accordance with the different soil textures. Field Capacity is defined as the water content at a tension of -33kPa. Soil textures are from the STATSGO database (USDA NRCS), which has been compiled from a state-by-state format into a U.S. database, available through Penn State University at [http://dbwww.essc.psu.edu/geotree/dbtop/amer_n/us_48/data/soilprop/statsgo_geo/soiltext/doc.html](http://dbwww.essc.psu.edu/geotree/dbtop/amer_n/us_48/data/soilprop/statsgo_geo/soiltext/doc.html) @@ -155,3 +163,57 @@ This reports 16 different soil texture classes for 11 layers, which cover a dept ### Ws The parameter Ws is the fraction of maximum soil moisture where non-linear baseflow occurs. As with the [`Ds`](#ds) parameter, this is generally adjusted during the calibration phase of applying the VIC model. Values for Ws are typically greater than 0.5. An initial value of 0.9 can be used. + +### quartz +The parameter `quartz` describes the quartz content of the soil. + +### soil_density +The parameter `soil_density` describes the soil particle density and a value of 2685 kg/m3 is typically used. + +### fs_active +The parameter `fs_active` describes whether or not the frozen soil algorithm is activated for a grid cell. A value of 0 indicates that the frozen soil routine is not run for the grid cell even if soil temperatures fall below 0 C. A value of 1 indicates that the frozen soil routine is run. + +### veg_class +The parameter `veg_class` refers to the vegetation class identification number. There have typically been 12 vegetation classes in VIC but newer versions of the model allow for more than 12 vegetation classes. + +### veg_descr +The parameter `veg_descr` describes the vegetation class. + +### Nveg +The parameter `Nveg` describes the number of active vegetation classes (or types) in a grid cell. + +### Cv +The parameter `Cv` describes the fraction of the grid cell covered by each active vegetation class. + +### LAI +LAI is the leaf area index, typically one value per month is used. If `VEGPARAM_LAI` is `TRUE` in the global parameter file, then each vegetation tile must inluce a line for LAI. + +### overstory +`Overstory` is a flag to indicate if the current vegetation type has an overstory or not. A value of 1 indicates an overstory, a value of 0 indicates no overstory. + +### rarc +The parameter `rarc` represents the architectural resistance of each vegetation type. It is typically set to ~2 s/m. + +### rmin +The parameter `rmin` refers to the minimum stomatal resistance of each vegetation type. It is typically set to ~100 s/m. + +### RGL +`RGL` is the minimum incoming shortwave radiation at which there will be transpiration. It typically has a value of 30 W/m2 for trees and for crops about 100 W/m2. + +### rad_atten +The parameter `rad_atten` is the radiation attenuation factor. It is normally set to 0.5 but may need to be adjusted for high latitudes. + +### wind_atten +The paraemeter `wind_atten` is the wind speed attenuation through the overstory. The default value is typically 0.5. + +### trunk_ratio +The parameter `trunk_ratio` is the ratio of total tree height that refers to the trunk (does not include branches). The default value is typically 0.2. + +### albedo +`albedo` refers to the shortwave albedo and is specific to each vegetation type. + +### veg_rough +The parameter `veg_rough` refers to the roughness length of the vegetation type and is typically 0.123 * vegetation height. + +### displacement +The parameter `displacement` is the vegetation displacement height and is typically 0.67 * vegetation height. diff --git a/docs/Documentation/Drivers/Classic/GlobalParam.md b/docs/Documentation/Drivers/Classic/GlobalParam.md index ab28f10a6..c8a3b7839 100644 --- a/docs/Documentation/Drivers/Classic/GlobalParam.md +++ b/docs/Documentation/Drivers/Classic/GlobalParam.md @@ -86,19 +86,6 @@ Generally these default values do not need to be overridden. | MIN_WIND_SPEED | float | m/s | Minimum allowable wind speed.

Default = 0.1 m/s. | | AERO_RESIST_CANSNOW | string | N/A | Options for aerodynamic resistance in snow-filled canopy:
  • **AR_406** = Multiply by 10 for latent heat, but do NOT multiply by 10 for sensible heat. When no snow in canopy, use surface aero_resist instead of overstory aero_resist. (As in VIC 4.0.6).
  • **AR_406_LS** = Multiply by 10 for both latent and sensible heat. When no snow in canopy, use surface aero_resist instead of overstory aero_resist.
  • **AR_406_FULL** = Multiply by 10 for both latent and sensible heat. Always use overstory aero_resist (snow or bare).
  • **AR_410** = Apply stability correction, instead of multiplying by 10, for both latent and sensible heat. Always use overstory aero_resist (snow or bare).

    *NOTE*: this option exists for backwards compatibility with earlier releases and likely will be removed in later releases.

    Default = AR_406_FULL. | -## Meteorological Forcing Disaggregation Parameters - -Generally these default values do not need to be overridden. - -| Name | Type | Units | Description | -|-----------------|--------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| PLAPSE | string | TRUE or FALSE | Options for computing grid cell average surface atmospheric pressure (and density) when it is not explicitly supplied as a meteorological forcing:
  • **FALSE** = Set surface atmospheric pressure to constant 95.5 kPa (as in earlier releases).
  • **TRUE** = Lapse surface atmospheric pressure (and density) from sea level to the grid cell average elevation.

    *NOTE 1*: air pressure is already lapsed to grid cell or band elevation when computing latent heat; this option only affects computation of sensible heat.

    *NOTE 2*: this option exists for backwards compatibility with earlier releases and likely will be removed in later releases (the TRUE option will become the standard behavior).

    Default = TRUE. | -| SW_PREC_THRESH | float | mm | Minimum daily precipitation, above which incoming shortwave is dimmed by 25%, when shortwave is not supplied as a forcing but instead is estimated from daily temperature range.

    *Note*: This option's purpose is to avoid erroneous dimming of estimated shortwave when using forcings that have been aggregated or re-sampled from a different resolution. Re-sampling can sometimes smear small amounts of precipitation from neighboring cells into cells that originally had no precipitation. The appropriate value of SW_PREC_THRESH must be found through examination of the forcings.

    Default = 0 mm (any precipitation causes dimming) | -| MTCLIM_SWE_CORR | string | TRUE or FALSE | This controls VIC's estimates of incoming shortwave (when shortwave is not supplied as a forcing) in the presence of snow. When shortwave is supplied as a forcing, this option is ignored.
  • **TRUE** = Adjust incoming shortwave for snow albedo effect.
  • **FALSE** = Do not adjust shortwave (as in earlier releases).

    Default = TRUE. | -| VP_ITER | string | N/A | This controls VIC's iteration between estimates of shortwave and vapor pressure:
  • **VP_ITER_NEVER** = Never iterate; make estimates separately.
  • **VP_ITER_ALWAYS** = Always iterate once (as in previous releases).
  • **VP_ITER_ANNUAL** = Iterate once for arid climates (based on annual Precip/PET ratio) and never for humid climates.
  • **VP_ITER_CONVERGE** = Always iterate until shortwave and vp stabilize.

    Default = VP_ITER_ALWAYS. | -| VP_INTERP | string | TRUE or FALSE | This controls sub-daily humidity estimates:
  • **TRUE** = Interpolate daily VP estimates linearly between sunrise of one day to the next.
  • **FALSE** = Hold VP constant for entire day (as in previous releases).

    Default = TRUE. | -| LW_TYPE | string | N/A | This controls the algorithm used to estimate clear-sky longwave radiation:
  • **LW_TVA** = Tennessee Valley Authority algorithm (1972) (this option is what previous releases used)
  • **LW_ANDERSON** = Algorithm of Anderson (1964)
  • **LW_BRUTSAERT** = Algorithm of Brutsaert (1975)
  • **LW_SATTERLUND** = Algorithm of Satterlund (1979)
  • **LW_IDSO** = Algorithm of Idso (1981)
  • **LW_PRATA** = Algorithm of Prata (1996)

    Default = LW_TVA. | -| LW_CLOUD | string | N/A | This controls the algorithm used to estimate the influence of clouds on total longwave:
  • **LW_CLOUD_BRAS** = Method from Bras textbook (this option is what previous releases used)
  • **LW_CLOUD_DEARDORFF** = Algorithm of Deardorff (1978)

    Default = LW_CLOUD_DEARDORFF. | ## Carbon Parameters @@ -235,6 +222,7 @@ The following options only take effect when the lake model is running. | LAKE_PROFILE | string | TRUE or FALSE | Options for describing lake profile:
  • **FALSE** = VIC computes a parabolic depth-area profile for the lake basin
  • **TRUE** = VIC reads user-specified depth-area profile from the lake parameter file

    Default = FALSE. | | EQUAL_AREA | string | TRUE or FALSE | Options for computing grid cell areas:
  • **FALSE** = Grid cell boundaries and centers fall on a regular lat-lon grid, i.e. grid cells appear as squares when plotted in geographic projection; this means that the grid cells do not have equal areas.
  • **TRUE** = Grid cells have equal area, i.e. they appear as squares when plotted in an equal-area projection; this means that their boundaries do not fall on a regular lat-lon grid and the cell centers are not equally-spaced in latitude and longitude.

    Default = FALSE. | | RESOLUTION | float | decimal degrees of latitude or area in km2 | Options for grid cell resolution:
  • If **EQUAL_AREA = FALSE**: width of grid cells, in decimal degrees latitude or longitude.
  • If **EQUAL_AREA = TRUE**: area of grid cells, in km2.

    Default = none; this MUST be set by the user to match the grid cell size if the lake model is running. | +| LAKE_NODES | integer | n/a | Maximum number of lake layers to use during simulations (the actual number of active nodes varies with lake depth). If not specified, this will default to the value of the MAX_LAKE_NODES pre-compile definition. Note: this cannot exceed MAX_LAKE_NODES.

    Default = MAX_LAKE_NODES. | # Define Output Files diff --git a/docs/Documentation/Drivers/Classic/SoilParam.md b/docs/Documentation/Drivers/Classic/SoilParam.md index a52e4f3eb..caaacfb8a 100644 --- a/docs/Documentation/Drivers/Classic/SoilParam.md +++ b/docs/Documentation/Drivers/Classic/SoilParam.md @@ -46,7 +46,7 @@ To help in understanding this file, an example file has been attached at the bot | (11\*Nlayer+14) | rough | m | 1 | Surface roughness of bare soil | | (11\*Nlayer+15) | snow_rough | m | 1 | Surface roughness of snowpack | | (11\*Nlayer+16) | annual_prec | mm | 1 | Average annual precipitation. | -| (11\*Nlayer+17):(12\*Nlayer+16) | resid_moist | fraction | Nlayer | Soil moisture layer residual moisture. | +| (11\*Nlayer+17):(12\*Nlayer+16) | resid_moist | fraction | Nlayer | Soil moisture layer residual moisture content in units of residual moisture content volume / total layer volume [mm/mm]. | | (12\*Nlayer+17) | fs_active | 1 or 0 | 1 | If set to 1, then frozen soil algorithm is activated for the grid cell. A 0 indicates that frozen soils are not computed even if soil temperatures fall below 0C. | | **(Optional)** | frost_slope | C | 1 | Slope of uniform distribution of soil temperature (if SPATIAL_FROST == TRUE in the [global parameter file](GlobalParam.md)). | | **(Optional)** | max_snow_distrib_slope | m | 1 | Maximum slope of the snow depth distribution. This is only used if SPATIAL_SNOW == TRUE in the [global parameter file](GlobalParam.md).

    This parameter should be set to twice the spatial average snow depth at which coverage == 1.0. In other words, if we define depth_thresh to be the minimum spatial average snow depth below which coverage < 1.0, then max_snow_distrib_slope = 2*depth_thresh.

    *NOTE*: Partial snow coverage is **only** computed when the snow pack has started **melting** and the `spatial average snow pack depth <= max_snow_distrib_slope/2`. During the accumulation season, coverage is 1.0. Even after the pack has started melting and `depth <= max_snow_distrib_slope/2`, new snowfall resets coverage to 1.0, and the previous partial coverage is stored. Coverage remains at 1.0 until the new snow has melted away, at which point the previous partial coverage is recovered. | diff --git a/docs/Documentation/Drivers/Image/GlobalParam.md b/docs/Documentation/Drivers/Image/GlobalParam.md index d080294ec..53fbdc589 100644 --- a/docs/Documentation/Drivers/Image/GlobalParam.md +++ b/docs/Documentation/Drivers/Image/GlobalParam.md @@ -88,20 +88,6 @@ Generally these default values do not need to be overridden. | MIN_WIND_SPEED | float | m/s | Minimum allowable wind speed.

    Default = 0.1 m/s. | | AERO_RESIST_CANSNOW | string | N/A | Options for aerodynamic resistance in snow-filled canopy:
  • **AR_406** = Multiply by 10 for latent heat, but do NOT multiply by 10 for sensible heat. When no snow in canopy, use surface aero_resist instead of overstory aero_resist. (As in VIC 4.0.6).
  • **AR_406_LS** = Multiply by 10 for both latent and sensible heat. When no snow in canopy, use surface aero_resist instead of overstory aero_resist.
  • **AR_406_FULL** = Multiply by 10 for both latent and sensible heat. Always use overstory aero_resist (snow or bare).
  • **AR_410** = Apply stability correction, instead of multiplying by 10, for both latent and sensible heat. Always use overstory aero_resist (snow or bare).

    *NOTE*: this option exists for backwards compatibility with earlier releases and likely will be removed in later releases.

    Default = AR_406_FULL. | -## Meteorological Forcing Disaggregation Parameters - -Generally these default values do not need to be overridden. - -| Name | Type | Units | Description | -|-----------------|--------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| PLAPSE | string | TRUE or FALSE | Options for computing grid cell average surface atmospheric pressure (and density) when it is not explicitly supplied as a meteorological forcing:
  • **FALSE** = Set surface atmospheric pressure to constant 95.5 kPa (as in earlier releases).
  • **TRUE** = Lapse surface atmospheric pressure (and density) from sea level to the grid cell average elevation.

    *NOTE 1*: air pressure is already lapsed to grid cell or band elevation when computing latent heat; this option only affects computation of sensible heat.

    *NOTE 2*: this option exists for backwards compatibility with earlier releases and likely will be removed in later releases (the TRUE option will become the standard behavior).

    Default = TRUE. | -| SW_PREC_THRESH | float | mm | Minimum daily precipitation, above which incoming shortwave is dimmed by 25%, when shortwave is not supplied as a forcing but instead is estimated from daily temperature range.

    *Note*: This option's purpose is to avoid erroneous dimming of estimated shortwave when using forcings that have been aggregated or re-sampled from a different resolution. Re-sampling can sometimes smear small amounts of precipitation from neighboring cells into cells that originally had no precipitation. The appropriate value of SW_PREC_THRESH must be found through examination of the forcings.

    Default = 0 mm (any precipitation causes dimming) | -| MTCLIM_SWE_CORR | string | TRUE or FALSE | This controls VIC's estimates of incoming shortwave (when shortwave is not supplied as a forcing) in the presence of snow. When shortwave is supplied as a forcing, this option is ignored.
  • **TRUE** = Adjust incoming shortwave for snow albedo effect.
  • **FALSE** = Do not adjust shortwave (as in earlier releases).

    Default = TRUE. | -| VP_ITER | string | N/A | This controls VIC's iteration between estimates of shortwave and vapor pressure:
  • **VP_ITER_NEVER** = Never iterate; make estimates separately.
  • **VP_ITER_ALWAYS** = Always iterate once (as in previous releases).
  • **VP_ITER_ANNUAL** = Iterate once for arid climates (based on annual Precip/PET ratio) and never for humid climates.
  • **VP_ITER_CONVERGE** = Always iterate until shortwave and vp stabilize.

    Default = VP_ITER_ALWAYS. | -| VP_INTERP | string | TRUE or FALSE | This controls sub-daily humidity estimates:
  • **TRUE** = Interpolate daily VP estimates linearly between sunrise of one day to the next.
  • **FALSE** = Hold VP constant for entire day (as in previous releases).

    Default = TRUE. | -| LW_TYPE | string | N/A | This controls the algorithm used to estimate clear-sky longwave radiation:
  • **LW_TVA** = Tennessee Valley Authority algorithm (1972) (this option is what previous releases used)
  • **LW_ANDERSON** = Algorithm of Anderson (1964)
  • **LW_BRUTSAERT** = Algorithm of Brutsaert (1975)
  • **LW_SATTERLUND** = Algorithm of Satterlund (1979)
  • **LW_IDSO** = Algorithm of Idso (1981)
  • **LW_PRATA** = Algorithm of Prata (1996)

    Default = LW_TVA. | -| LW_CLOUD | string | N/A | This controls the algorithm used to estimate the influence of clouds on total longwave:
  • **LW_CLOUD_BRAS** = Method from Bras textbook (this option is what previous releases used)
  • **LW_CLOUD_DEARDORFF** = Algorithm of Deardorff (1978)

    Default = LW_CLOUD_DEARDORFF. | - ## Carbon Parameters The following options only apply to carbon cycling. @@ -191,6 +177,7 @@ The following options only take effect when the lake model is running. | LAKE_PROFILE | string | TRUE or FALSE | Options for describing lake profile:
  • **FALSE** = VIC computes a parabolic depth-area profile for the lake basin
  • **TRUE** = VIC reads user-specified depth-area profile from the lake parameter file

    Default = FALSE. | | EQUAL_AREA | string | TRUE or FALSE | Options for computing grid cell areas:
  • **FALSE** = Grid cell boundaries and centers fall on a regular lat-lon grid, i.e. grid cells appear as squares when plotted in geographic projection; this means that the grid cells do not have equal areas.
  • **TRUE** = Grid cells have equal area, i.e. they appear as squares when plotted in an equal-area projection; this means that their boundaries do not fall on a regular lat-lon grid and the cell centers are not equally-spaced in latitude and longitude.

    Default = FALSE. | | RESOLUTION | float | decimal degrees of latitude or area in km2 | Options for grid cell resolution:
  • If **EQUAL_AREA = FALSE**: width of grid cells, in decimal degrees latitude or longitude.
  • If **EQUAL_AREA = TRUE**: area of grid cells, in km2.

    Default = none; this MUST be set by the user to match the grid cell size if the lake model is running. | +| LAKE_NODES | integer | n/a | Maximum number of lake layers to use during simulations (the actual number of active nodes varies with lake depth). If not specified, this will default to the value of the MAX_LAKE_NODES pre-compile definition. Note: this cannot exceed MAX_LAKE_NODES.

    Default = MAX_LAKE_NODES. | # Define Output Files diff --git a/docs/Documentation/Drivers/Image/Params.md b/docs/Documentation/Drivers/Image/Params.md index ef05570c5..97a8a624b 100644 --- a/docs/Documentation/Drivers/Image/Params.md +++ b/docs/Documentation/Drivers/Image/Params.md @@ -49,7 +49,7 @@ Below is a list of soil parameters. | rough | [lat, lon] | m | double | 1 | Surface roughness of bare soil | | snow_rough | [lat, lon] | m | double | 1 | Surface roughness of snowpack | | annual_prec | [lat, lon] | mm | double | 1 | Average annual precipitation | -| resid_moist | [nlayer, lat, lon] | fraction | double | Nlayer | Soil moisture layer residual moisture | +| resid_moist | [nlayer, lat, lon] | fraction | double | Nlayer | Soil moisture layer residual moisture content in units of residual moisture content volume / total layer volume [mm/mm]. | | fs_active | [lat, lon] | 1 or 0 | int | 1 | If set to 1, then frozen soil algorithm is activated for the grid cell. A 0 indicates that frozen soils are not computed even if soil temperatures fall below 0C. | | frost_slope | [lat, lon] | C | double | 1 | Slope of uniform distribution of soil temperature (if SPATIAL_FROST == TRUE in the global parameter file). | | max_snow_distrib_slope | [lat, lon] | m | double | 1 | Maximum slope of the snow depth distribution. This is only used if SPATIAL_SNOW == TRUE in the global parameter file. This parameter should be set to twice the spatial average snow depth at which coverage == 1.0. In other words, if we define depth_thresh to be the minimum spatial average snow depth below which coverage < 1.0, then max_snow_distrib_slope = 2depth_thresh. NOTE*: Partial snow coverage is only computed when the snow pack has started melting and thespatial average snow pack depth <= max_snow_distrib_slope/2. During the accumulation season, coverage is 1.0. Even after the pack has started melting anddepth <= max_snow_distrib_slope/2, new snowfall resets coverage to 1.0, and the previous partial coverage is stored. Coverage remains at 1.0 until the new snow has melted away, at which point the previous partial coverage is recovered. | diff --git a/docs/index.md b/docs/index.md index 790ae0ff6..d37f40ab0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,12 +1,12 @@ # Variable Infiltration Capacity (VIC) Macroscale Hydrologic Model -[![Build Status](https://travis-ci.org/UW-Hydro/VIC.png?branch=develop)](https://travis-ci.org/UW-Hydro/VIC) [![VIC Users Listserve](https://img.shields.io/badge/VIC%20Users%20Listserve-Active-blue.svg)](https://mailman.u.washington.edu/mailman/listinfo/vic_users) [![Join the chat at https://gitter.im/UW-Hydro/VIC](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/UW-Hydro/VIC?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![GitHub license](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/UW-Hydro/VIC/master/LICENSE.txt) [![Documentation Status](https://readthedocs.org/projects/vic/badge/?version=latest)](http://vic.readthedocs.org/en/latest/) +[![VIC Users Listserve](https://img.shields.io/badge/VIC%20Users%20Listserve-Active-blue.svg)](https://mailman.u.washington.edu/mailman/listinfo/vic_users) [![Join the chat at https://gitter.im/UW-Hydro/VIC](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/UW-Hydro/VIC?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/UW-Hydro/VIC/master/LICENSE.txt) [![Documentation Status](https://readthedocs.org/projects/vic/badge/?version=latest)](http://vic.readthedocs.org/en/latest/) [![DOI](https://zenodo.org/badge/7766/UW-Hydro/VIC.svg)](https://zenodo.org/badge/latestdoi/7766/UW-Hydro/VIC) !!! note You are viewing the documentation for VIC version 5 (VIC-5). Relative to VIC-4, this version includes many infrastructure improvements. Those enhancements are described in [Hamman et al, 2018](https://doi.org/10.5194/gmd-11-3481-2018). -VIC ([Liang et al., 1994](Documentation/References.md)) is a macroscale hydrologic model that solves full water and energy balances, originally developed by Xu Liang at the University of Washington. VIC is a research model and in its various forms it has been applied to most of the major river basins around the world, as well as [globally](links.md). The VIC model is distributed under the [GNU GPL v2.0](http://www.gnu.org/licenses/gpl-2.0.html) license. If you make use of this model, please acknowledge the appropriate references listed on the [references](Documentation/References.md) page. These should include [Liang et al., 1994](Documentation/References.md), [Hamman et al., 2018](Documentation/References.md) for VIC-5, and any references relevant to the features you are using, which are cited in the feature descriptions on the [Model Overview](Overview/ModelOverview.md) page. +VIC ([Liang et al., 1994](Documentation/References.md)) is a macroscale hydrologic model that solves full water and energy balances, originally developed by Xu Liang at the University of Washington. VIC is a research model and in its various forms it has been applied to most of the major river basins around the world, as well as [globally](links.md). The VIC model is distributed under the [MIT license](https://opensource.org/licenses/MIT). If you make use of this model, please acknowledge the appropriate references listed on the [references](Documentation/References.md) page. These should include [Liang et al., 1994](Documentation/References.md), [Hamman et al., 2018](Documentation/References.md) for VIC-5, and any references relevant to the features you are using, which are cited in the feature descriptions on the [Model Overview](Overview/ModelOverview.md) page. Development and maintenance of the current official version of the VIC model is led by the [UW Hydro | Computational Hydrology group](http://uw-hydro.github.io/) in the [Department of Civil and Environmental Engineering](http://www.ce.washington.edu) at the [University of Washington](http://www.washington.edu). Every new application addresses new problems and conditions that the model may not currently be able to handle, and as such the model is always under development. The VIC model is an open source development project, which means that contributions are welcome, including to the VIC documentation. diff --git a/readme.md b/readme.md index bd3825921..6c30ef941 100644 --- a/readme.md +++ b/readme.md @@ -3,10 +3,9 @@ | VIC Links & Badges | | |------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | VIC Documentation | [![Documentation Status](https://readthedocs.org/projects/vic/badge/?version=latest)](http://vic.readthedocs.org/en/latest/) | -| Travis Build | [![Build Status](https://travis-ci.org/UW-Hydro/VIC.png)](https://travis-ci.org/UW-Hydro/VIC) | | VIC Users Listserve | [![VIC Users Listserve](https://img.shields.io/badge/VIC%20Users%20Listserve-Active-blue.svg)](https://mailman.u.washington.edu/mailman/listinfo/vic_users) | | Developers Gitter Room | [![Join the chat at https://gitter.im/UW-Hydro/VIC](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/UW-Hydro/VIC?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | -| License | [![GitHub license](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://raw.githubusercontent.com/UW-Hydro/VIC/master/LICENSE.txt) | +| License | [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/UW-Hydro/VIC/master/LICENSE.txt) | | Current Release DOI | [![DOI](https://zenodo.org/badge/7766/UW-Hydro/VIC.svg)](https://zenodo.org/badge/latestdoi/7766/UW-Hydro/VIC) | ---------- diff --git a/tests/unit/shared/test_vic_time.py b/tests/unit/shared/test_vic_time.py index caba01dfe..f6a3b8d4f 100644 --- a/tests/unit/shared/test_vic_time.py +++ b/tests/unit/shared/test_vic_time.py @@ -371,6 +371,6 @@ def test_strpdmy(): for date in dates: date_str = date.strftime(date_format) vic_lib.strpdmy(date_str.encode(), date_format.encode(), dmy) - expected = date.to_datetime() + expected = pd.to_datetime(date) actual = dmy_to_datetime(dmy) assert abs(expected - actual) < datetime.timedelta(seconds=1) diff --git a/tests/unit/vic_run/test_modify_Ksat.py b/tests/unit/vic_run/test_modify_Ksat.py index 13a0c2184..521f61d02 100644 --- a/tests/unit/vic_run/test_modify_Ksat.py +++ b/tests/unit/vic_run/test_modify_Ksat.py @@ -1,6 +1,6 @@ from vic import lib as vic_lib import numpy as np -from scipy.interpolate.interpolate_wrapper import linear +from scipy.interpolate import interp1d def test_linear_interp(): @@ -8,7 +8,8 @@ def test_linear_interp(): x = np.arange(n, dtype=np.float) y = np.arange(n, dtype=np.float) new_x = np.arange(n, dtype=np.float) + 0.5 - scipy_new_y = linear(x, y, new_x) + f = interp1d(x, y, bounds_error=False, fill_value='extrapolate') + scipy_new_y = f(new_x) np.testing.assert_almost_equal(scipy_new_y[:5], [0.5, 1.5, 2.5, 3.5, 4.5]) for i in range(n - 1): assert vic_lib.linear_interp(new_x[i], x[i], x[i + 1], diff --git a/tests/unit/vic_run/test_snow_utility.py b/tests/unit/vic_run/test_snow_utility.py index a7c393a68..ffc6e082b 100644 --- a/tests/unit/vic_run/test_snow_utility.py +++ b/tests/unit/vic_run/test_snow_utility.py @@ -2,7 +2,8 @@ from vic.vic import ffi from vic import lib as vic_lib - +# TODO: add in vegetation-dependent snow albedo check +@pytest.mark.xfail def test_snow_albedo_new_snow(): assert vic_lib.snow_albedo( 0.1, 1., 0.7, -77, 3600., 0, diff --git a/vic/drivers/cesm/Makefile b/vic/drivers/cesm/Makefile index dbc95dd22..d2c681f62 100644 --- a/vic/drivers/cesm/Makefile +++ b/vic/drivers/cesm/Makefile @@ -3,26 +3,6 @@ # # VIC CESM Driver Makefile # FOR BUILD TESTING ONLY - # - # @section LICENSE - # - # The Variable Infiltration Capacity (VIC) macroscale hydrological model - # Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - # and Environmental Engineering, University of Washington. - # - # The VIC model is free software; you can redistribute it and/or - # modify it under the terms of the GNU General Public License - # as published by the Free Software Foundation; either version 2 - # of the License, or (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU General Public License for more details. - # - # You should have received a copy of the GNU General Public License along with - # this program; if not, write to the Free Software Foundation, Inc., - # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ############################################################################## # ----------------------------------------------------------------------- diff --git a/vic/drivers/cesm/bld/build_vic_namelist b/vic/drivers/cesm/bld/build_vic_namelist index 29dd75f1f..8efba83eb 100755 --- a/vic/drivers/cesm/bld/build_vic_namelist +++ b/vic/drivers/cesm/bld/build_vic_namelist @@ -91,7 +91,7 @@ def copy_to_rundir(grid_config, caseid, rundir, casedocs): # copy file copy_clean_vic_config(grid_config[filekey], dst_file, - header=header, rundir=rundir, **grid_config) + header=header, rundir=rundir, caseid=caseid, **grid_config) # update the grid config grid_config[filekey] = dst_file diff --git a/vic/drivers/cesm/bld/vic.globalconfig.txt b/vic/drivers/cesm/bld/vic.globalconfig.txt old mode 100644 new mode 100755 index 46bfe6b52..25a646346 --- a/vic/drivers/cesm/bld/vic.globalconfig.txt +++ b/vic/drivers/cesm/bld/vic.globalconfig.txt @@ -1,9 +1,10 @@ # VIC Global Configuration File -NODES 50 +NODES 10 OUT_TIME_UNITS DAYS # Soil Temperature Options +FULL_ENERGY TRUE FROZEN_SOIL TRUE QUICK_FLUX FALSE QUICK_SOLVE FALSE @@ -12,6 +13,7 @@ IMPLICIT TRUE EXP_TRANS TRUE # Snow Options +MAX_SNOW_ALBEDO TRUE SNOW_DENSITY DENS_SNTHRM BLOWING FALSE BLOWING_VAR_THRESHOLD FALSE @@ -21,6 +23,8 @@ BLOWING_FETCH FALSE BLOWING_SPATIAL_WIND FALSE # MISC +BULK_DENSITY_COMB TRUE +ORGANIC_FRACT TRUE CORRPREC FALSE CLOSE_ENERGY TRUE COMPUTE_TREELINE FALSE @@ -35,6 +39,8 @@ CANOPY_LAYERS 3 RC_MODE RC_JARVIS # Input Files and PATHS +INIT_STATE {vic_initstate} +STATENAME_CESM TRUE CONSTANTS {vic_constants} LOG_DIR {rundir}/ PARAMETERS {vic_params} @@ -54,26 +60,35 @@ DOMAIN_TYPE FRAC frac DOMAIN_TYPE YDIM nj DOMAIN_TYPE XDIM ni -OUTFILE fluxes +OUTFILE {caseid}.vic.ha AGGFREQ NDAYS 1 OUT_FORMAT NETCDF4_CLASSIC -OUTVAR OUT_PREC -OUTVAR OUT_RAINF -OUTVAR OUT_SNOWF -OUTVAR OUT_AIR_TEMP -OUTVAR OUT_SWDOWN -OUTVAR OUT_LWDOWN -OUTVAR OUT_PRESSURE -OUTVAR OUT_WIND -OUTVAR OUT_DENSITY -OUTVAR OUT_REL_HUMID -OUTVAR OUT_QAIR -OUTVAR OUT_VP -OUTVAR OUT_VPD +HISTFREQ NMONTHS 1 OUTVAR OUT_RUNOFF OUTVAR OUT_BASEFLOW +OUTVAR OUT_PREC OUTVAR OUT_EVAP -OUTVAR OUT_SWE +OUTVAR OUT_SOIL_TEMP +OUTVAR OUT_SOIL_TNODE OUTVAR OUT_SOIL_MOIST +OUTVAR OUT_DELTAH +OUTVAR OUT_SWE +OUTVAR OUT_DELTACC +OUTVAR OUT_ADVECTION +OUTVAR OUT_RFRZ_ENERGY +OUTVAR OUT_SNOW_FLUX +OUTVAR OUT_SNOW_SURF_TEMP +OUTVAR OUT_WATER_ERROR +OUTVAR OUT_ENERGY_ERROR +OUTVAR OUT_GRND_FLUX +OUTVAR OUT_SURF_TEMP +OUTVAR OUT_AIR_TEMP +OUTVAR OUT_RAD_TEMP OUTVAR OUT_ALBEDO -OUTVAR OUT_SOIL_TEMP +OUTVAR OUT_LATENT +OUTVAR OUT_SENSIBLE +OUTVAR OUT_SWDOWN +OUTVAR OUT_LWDOWN +OUTVAR OUT_SWNET +OUTVAR OUT_LWNET +OUTVAR OUT_R_NET diff --git a/vic/drivers/cesm/bld/vic.inputfiles.cfg b/vic/drivers/cesm/bld/vic.inputfiles.cfg old mode 100644 new mode 100755 index ece335b52..a665d8f68 --- a/vic/drivers/cesm/bld/vic.inputfiles.cfg +++ b/vic/drivers/cesm/bld/vic.inputfiles.cfg @@ -1,5 +1,13 @@ [wr50a] vic_domain = ${DIN_LOC_ROOT}/share/domains/domain.lnd.wr50a_ar9v4.100920.nc -vic_params = ${VIC5TESTDIR}/vic_params_wr50a_vic5.0.dev_20160328.nc +vic_params = ${DIN_LOC_ROOT}/lnd/vic/param/new_vic5_params_wr50a_ar9v4_all_options.nc vic_global_param = vic.globalconfig.txt vic_constants = vic.constants.txt +vic_initstate = ${DIN_LOC_ROOT}/lnd/vic/init_state.wr50a_ar9v4.nc + +[wr25b] +vic_domain = ${DIN_LOC_ROOT}/share/domains/domain.lnd.wr25b_ar9v4.170413.nc +vic_params = ${DIN_LOC_ROOT}/lnd/vic/param/new_vic5_params_wr25b_ar9v4_all_options.nc +vic_global_param = vic.globalconfig.txt +vic_constants = vic.constants.txt +vic_initstate = ${DIN_LOC_ROOT}/lnd/vic/init_state.wr25b_ar9v4.nc diff --git a/vic/drivers/cesm/include/vic_driver_cesm.h b/vic/drivers/cesm/include/vic_driver_cesm.h index b883b3f79..51e8ec557 100644 --- a/vic/drivers/cesm/include/vic_driver_cesm.h +++ b/vic/drivers/cesm/include/vic_driver_cesm.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for CESM-VIC routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_DRIVER_CESM_H diff --git a/vic/drivers/cesm/readme.md b/vic/drivers/cesm/readme.md index 44f6077b3..ce9951a9a 100644 --- a/vic/drivers/cesm/readme.md +++ b/vic/drivers/cesm/readme.md @@ -18,7 +18,7 @@ The CESM driver for VIC can be built in two ways. 1. The `Makefile` is in the root driver directory is configured to build the CESM driver as a shared object. This makefile is provided for testing purposes only. -1. The `bld/` directory contains the build scripts used by the CESM `$case.build` script. To build the model in this configuration, follow these temporary steps on Garnet, Spirit, or Lightning: +1. The `bld/` directory contains the build scripts used by the CESM `$case.build` script. To build the model in this configuration, follow these temporary steps on Topaz or Thunder: ```bash # Get vic5 input data @@ -42,14 +42,19 @@ The CESM driver for VIC can be built in two ways. git checkout develop # follow typical steps to build RASM - # NOTE: only set DEBUG flag to TRUE if running RI compset + # NOTE: only set DEBUG flag to TRUE if running RI or RI_CRUNCEP compset # (it does not work with WRF) cd $HOME/rasm_vic5/scripts today=$(date +'%Y%m%d') - compset=RI # adjust for compset - mach=spirit_intel # adjust for machine - case_name=vic5.${compset}.test.${today}a - create_newcase -case ${case_name} -res w5a_a94 -compset ${compset} -mach ${mach} + # adjust for compset + compset=RI + # adjust for machine + mach=thunder_intel + # adjust for resolution + # w5a_a94 for 50km VIC/WRF, w2b_a94 for 25km VIC/WRF + res=w5a_a94 + case_name=vic5.${compset}.${res}.test.${today}a + create_newcase -case ${case_name} -res ${res} -compset ${compset} -mach ${mach} cd ${case_name} ./cesm_setup ./xmlchange -file env_build.xml -id DEBUG -val TRUE @@ -59,6 +64,5 @@ The CESM driver for VIC can be built in two ways. ** Supported Machines ** - [x] Thunder - - [x] Lightning - - [x] Garnet + - [x] Topaz - [ ] Copper *(Not currently supported by RASM)* diff --git a/vic/drivers/cesm/src/cesm_def_mod_f.F90 b/vic/drivers/cesm/src/cesm_def_mod_f.F90 index 1c50abdaa..5932c36eb 100644 --- a/vic/drivers/cesm/src/cesm_def_mod_f.F90 +++ b/vic/drivers/cesm/src/cesm_def_mod_f.F90 @@ -3,26 +3,6 @@ !! !! Fortran definitions of VIC C structures see cesm_def.h for more on the !! c/fortran type defs -!! -!! @section LICENSE -!! -!! The Variable Infiltration Capacity (VIC) macroscale hydrological model -!! Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -!! and Environmental Engineering, University of Washington. -!! -!! The VIC model is free software; you can redistribute it and/or -!! modify it under the terms of the GNU General Public License -!! as published by the Free Software Foundation; either version 2 -!! of the License, or (at your option) any later version. -!! -!! This program is distributed in the hope that it will be useful, -!! but WITHOUT ANY WARRANTY; without even the implied warranty of -!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -!! GNU General Public License for more details. -!! -!! You should have received a copy of the GNU General Public License along with -!! this program; if not, write to the Free Software Foundation, Inc., -!! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. MODULE vic_cesm_def_mod diff --git a/vic/drivers/cesm/src/cesm_interface_c.c b/vic/drivers/cesm/src/cesm_interface_c.c index 9b46ceeb1..12b02e03e 100644 --- a/vic/drivers/cesm/src/cesm_interface_c.c +++ b/vic/drivers/cesm/src/cesm_interface_c.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * C interface for CESM driver. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/cesm/src/cesm_interface_f.F90 b/vic/drivers/cesm/src/cesm_interface_f.F90 index df510caa8..15dea7958 100644 --- a/vic/drivers/cesm/src/cesm_interface_f.F90 +++ b/vic/drivers/cesm/src/cesm_interface_f.F90 @@ -2,26 +2,6 @@ !! @section DESCRIPTION !! !! Fortran interface for CESM driver. Uses the Fortran/C ISO_C_BINDING. -!! -!! @section LICENSE -!! -!! The Variable Infiltration Capacity (VIC) macroscale hydrological model -!! Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -!! and Environmental Engineering, University of Washington. -!! -!! The VIC model is free software; you can redistribute it and/or -!! modify it under the terms of the GNU General Public License -!! as published by the Free Software Foundation; either version 2 -!! of the License, or (at your option) any later version. -!! -!! This program is distributed in the hope that it will be useful, -!! but WITHOUT ANY WARRANTY; without even the implied warranty of -!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -!! GNU General Public License for more details. -!! -!! You should have received a copy of the GNU General Public License along with -!! this program; if not, write to the Free Software Foundation, Inc., -!! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. MODULE vic_cesm_interface diff --git a/vic/drivers/cesm/src/cesm_mpi_utils.c b/vic/drivers/cesm/src/cesm_mpi_utils.c index 2f1b3140b..6c5fcc0ca 100644 --- a/vic/drivers/cesm/src/cesm_mpi_utils.c +++ b/vic/drivers/cesm/src/cesm_mpi_utils.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * MPI support routines for VIC's CESM driver - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/cesm/src/cesm_print_library_f.F90 b/vic/drivers/cesm/src/cesm_print_library_f.F90 index 5dd982785..d3a7e33e2 100644 --- a/vic/drivers/cesm/src/cesm_print_library_f.F90 +++ b/vic/drivers/cesm/src/cesm_print_library_f.F90 @@ -2,26 +2,6 @@ !! @section DESCRIPTION !! !! Fortran print library for CESM VIC coupling -!! -!! @section LICENSE -!! -!! The Variable Infiltration Capacity (VIC) macroscale hydrological model -!! Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -!! and Environmental Engineering, University of Washington. -!! -!! The VIC model is free software; you can redistribute it and/or -!! modify it under the terms of the GNU General Public License -!! as published by the Free Software Foundation; either version 2 -!! of the License, or (at your option) any later version. -!! -!! This program is distributed in the hope that it will be useful, -!! but WITHOUT ANY WARRANTY; without even the implied warranty of -!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -!! GNU General Public License for more details. -!! -!! You should have received a copy of the GNU General Public License along with -!! this program; if not, write to the Free Software Foundation, Inc., -!! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. MODULE vic_cesm_print_library diff --git a/vic/drivers/cesm/src/cesm_put_data.c b/vic/drivers/cesm/src/cesm_put_data.c index efb37311f..a94411f4d 100644 --- a/vic/drivers/cesm/src/cesm_put_data.c +++ b/vic/drivers/cesm/src/cesm_put_data.c @@ -5,26 +5,6 @@ * * Sign convention: positive value <=> downward flux * Units: see notes in code or seq_flds_mod.F90 - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/cesm/src/display_current_settings.c b/vic/drivers/cesm/src/display_current_settings.c index 85a0dc2d9..3b47ace7f 100644 --- a/vic/drivers/cesm/src/display_current_settings.c +++ b/vic/drivers/cesm/src/display_current_settings.c @@ -3,26 +3,6 @@ * * This routine displays the current settings of options defined in the header * files and the global parameter file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -58,6 +38,7 @@ display_current_settings(int mode) fprintf(LOG_DEST, "Maximum Array Sizes:\n"); fprintf(LOG_DEST, "MAX_FRONTS\t\t%2d\n", MAX_FRONTS); fprintf(LOG_DEST, "MAX_FROST_AREAS\t\t\t%2d\n", MAX_FROST_AREAS); + fprintf(LOG_DEST, "MAX_LAKE_BASIN_NODES\t\t%2d\n", MAX_LAKE_BASIN_NODES); fprintf(LOG_DEST, "MAX_LAKE_NODES\t\t%2d\n", MAX_LAKE_NODES); fprintf(LOG_DEST, "MAX_ZWTVMOIST\t\t%2d\n", MAX_ZWTVMOIST); fprintf(LOG_DEST, "MAX_LAYERS\t\t%2d\n", MAX_LAYERS); @@ -283,6 +264,18 @@ display_current_settings(int mode) else { fprintf(LOG_DEST, "ORGANIC_FRACT\t\tFALSE\n"); } + if (options.BULK_DENSITY_COMB) { + fprintf(LOG_DEST, "BULK_DENSITY_COMB\t\tTRUE\n"); + } + else { + fprintf(LOG_DEST, "BULK_DENSITY_COMB\t\tFALSE\n"); + } + if (options.MAX_SNOW_ALBEDO) { + fprintf(LOG_DEST, "MAX_SNOW_ALBEDO\t\tTRUE\n"); + } + else { + fprintf(LOG_DEST, "MAX_SNOW_ALBEDO\t\tFALSE\n"); + } fprintf(LOG_DEST, "\n"); if (options.VEGLIB_PHOTO) { @@ -403,6 +396,14 @@ display_current_settings(int mode) fprintf(LOG_DEST, "SAVE_STATE\t\tFALSE\n"); } + if (options.STATENAME_CESM) { + fprintf(LOG_DEST, "STATENAME_CESM\t\tTRUE\n"); + } + else { + fprintf(LOG_DEST, "STATENAME_CESM\t\tFALSE\n"); + } + + fprintf(LOG_DEST, "\n"); fprintf(LOG_DEST, "Output Data:\n"); fprintf(LOG_DEST, "Result dir:\t\t%s\n", filenames.result_dir); diff --git a/vic/drivers/cesm/src/get_global_param.c b/vic/drivers/cesm/src/get_global_param.c index ef0c6ff82..8a26cb14f 100644 --- a/vic/drivers/cesm/src/get_global_param.c +++ b/vic/drivers/cesm/src/get_global_param.c @@ -3,26 +3,6 @@ * * This routine reads the VIC model global control file, getting values for * global parameters, model options, and debugging controls. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -278,6 +258,11 @@ get_global_param(FILE *gp) "NETCDF3_64BIT_OFFSET, NETCDF4_CLASSIC, or NETCDF4."); } } + // Define state file name format if using CESM conventions + else if (strcasecmp("STATENAME_CESM", optstr) == 0) { + sscanf(cmdstr, "%*s %s", flgstr); + options.STATENAME_CESM = str_to_bool(flgstr); + } /************************************* Define parameter files @@ -338,6 +323,14 @@ get_global_param(FILE *gp) sscanf(cmdstr, "%*s %s", flgstr); options.ORGANIC_FRACT = str_to_bool(flgstr); } + else if (strcasecmp("BULK_DENSITY_COMB", optstr) == 0) { + sscanf(cmdstr, "%*s %s", flgstr); + options.BULK_DENSITY_COMB = str_to_bool(flgstr); + } + else if (strcasecmp("MAX_SNOW_ALBEDO", optstr) == 0) { + sscanf(cmdstr, "%*s %s", flgstr); + options.MAX_SNOW_ALBEDO = str_to_bool(flgstr); + } else if (strcasecmp("VEGLIB_PHOTO", optstr) == 0) { sscanf(cmdstr, "%*s %s", flgstr); options.VEGLIB_PHOTO = str_to_bool(flgstr); @@ -412,6 +405,9 @@ get_global_param(FILE *gp) sscanf(cmdstr, "%*s %s", flgstr); options.LAKE_PROFILE = str_to_bool(flgstr); } + else if (strcasecmp("LAKE_NODES", optstr) == 0) { + sscanf(cmdstr, "%*s %zu", &options.Nlakenode); + } /************************************* Define output files @@ -504,6 +500,10 @@ validate_filenames(filenames_struct *filenames) // Validate lake parameter information if (options.LAKES) { log_err("Lakes are not implemented in CESM driver"); + if (options.Nlakenode < 1 || options.Nlakenode > MAX_LAKE_NODES) { + log_err("LAKE_NODES must be between 1 and %d.", + MAX_LAKE_NODES); + } } } diff --git a/vic/drivers/cesm/src/print_library_cesm.c b/vic/drivers/cesm/src/print_library_cesm.c index 6b7d04aae..65b57e0c4 100644 --- a/vic/drivers/cesm/src/print_library_cesm.c +++ b/vic/drivers/cesm/src/print_library_cesm.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Print library. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/cesm/src/vic_cesm_alloc.c b/vic/drivers/cesm/src/vic_cesm_alloc.c index ad9adb84e..f5da6c74b 100644 --- a/vic/drivers/cesm/src/vic_cesm_alloc.c +++ b/vic/drivers/cesm/src/vic_cesm_alloc.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Allocate memory for VIC structures. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/cesm/src/vic_cesm_finalize.c b/vic/drivers/cesm/src/vic_cesm_finalize.c index 3ee935726..5878f5418 100644 --- a/vic/drivers/cesm/src/vic_cesm_finalize.c +++ b/vic/drivers/cesm/src/vic_cesm_finalize.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Finalize VIC run by freeing memory and closing open files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/cesm/src/vic_cesm_init_library.c b/vic/drivers/cesm/src/vic_cesm_init_library.c index ab2b73d23..8c72edde5 100644 --- a/vic/drivers/cesm/src/vic_cesm_init_library.c +++ b/vic/drivers/cesm/src/vic_cesm_init_library.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Initilization library. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/cesm/src/vic_cesm_start.c b/vic/drivers/cesm/src/vic_cesm_start.c index e79ccb173..09a77bccd 100644 --- a/vic/drivers/cesm/src/vic_cesm_start.c +++ b/vic/drivers/cesm/src/vic_cesm_start.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * These routine handles the startup tasks for the CESM driver. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include // Do we need this line? diff --git a/vic/drivers/cesm/src/vic_cesm_time.c b/vic/drivers/cesm/src/vic_cesm_time.c index d7083e51f..c21630810 100644 --- a/vic/drivers/cesm/src/vic_cesm_time.c +++ b/vic/drivers/cesm/src/vic_cesm_time.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * CESM driver time handling - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/cesm/src/vic_force.c b/vic/drivers/cesm/src/vic_force.c index 6a368fe5c..1936bac1d 100644 --- a/vic/drivers/cesm/src/vic_force.c +++ b/vic/drivers/cesm/src/vic_force.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Unpack forcing data. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -230,6 +210,28 @@ vic_force(void) } } + // Checks on fcanopy and LAI + for (i = 0; i < local_domain.ncells_active; i++) { + for (v = 0; v < options.NVEGTYPES; v++) { + vidx = veg_con_map[i].vidx[v]; + if (vidx != NODATA_VEG) { + for (j = 0; j < NF; j++) { + if (veg_hist[i][vidx].fcanopy[j] < MIN_FCANOPY || + veg_hist[i][vidx].LAI[j] == 0) { + if (current == 0) { + // Only issue this warning once + log_warn( + "cell %zu, veg %d substep %zu fcanopy %f < " + "minimum of %f; setting = 0", i, vidx, j, + veg_hist[i][vidx].fcanopy[j], MIN_FCANOPY); + } + veg_hist[i][vidx].fcanopy[j] = 0; + veg_hist[i][vidx].LAI[j] = 0; + } + } + } + } + } // Put average value in NR field for (i = 0; i < local_domain.ncells_active; i++) { diff --git a/vic/drivers/cesm/src/vic_populate_model_state.c b/vic/drivers/cesm/src/vic_populate_model_state.c index 4eac3393f..b46fb6ddf 100644 --- a/vic/drivers/cesm/src/vic_populate_model_state.c +++ b/vic/drivers/cesm/src/vic_populate_model_state.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Populate model state. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -72,8 +52,8 @@ vic_populate_model_state(char *runtype_str, generate_default_state(&(all_vars[i]), &(soil_con[i]), veg_con[i], dmy_current); if (options.LAKES) { - generate_default_lake_state(&(all_vars[i]), &(soil_con[i]), - lake_con[i]); + generate_default_lake_state(&(all_vars[i].lake_var), + &(soil_con[i]), lake_con[i]); } } } diff --git a/vic/drivers/classic/Makefile b/vic/drivers/classic/Makefile index 139e49571..3fe9a9e77 100644 --- a/vic/drivers/classic/Makefile +++ b/vic/drivers/classic/Makefile @@ -2,26 +2,6 @@ # @section DESCRIPTION # # VIC Classic Driver Makefile - # - # @section LICENSE - # - # The Variable Infiltration Capacity (VIC) macroscale hydrological model - # Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - # and Environmental Engineering, University of Washington. - # - # The VIC model is free software; you can redistribute it and/or - # modify it under the terms of the GNU General Public License - # as published by the Free Software Foundation; either version 2 - # of the License, or (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU General Public License for more details. - # - # You should have received a copy of the GNU General Public License along with - # this program; if not, write to the Free Software Foundation, Inc., - # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ############################################################################## # ----------------------------------------------------------------------- diff --git a/vic/drivers/classic/include/vic_driver_classic.h b/vic/drivers/classic/include/vic_driver_classic.h index 85cfe0b6e..472e95ef3 100644 --- a/vic/drivers/classic/include/vic_driver_classic.h +++ b/vic/drivers/classic/include/vic_driver_classic.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for vic_driver_classic routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_DRIVER_CLASSIC_H diff --git a/vic/drivers/classic/src/alloc_atmos.c b/vic/drivers/classic/src/alloc_atmos.c index c41584040..ee53966c6 100644 --- a/vic/drivers/classic/src/alloc_atmos.c +++ b/vic/drivers/classic/src/alloc_atmos.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Allocate and free memory for the atmos data struct - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/alloc_veg_hist.c b/vic/drivers/classic/src/alloc_veg_hist.c index 840e360ce..31d638cee 100644 --- a/vic/drivers/classic/src/alloc_veg_hist.c +++ b/vic/drivers/classic/src/alloc_veg_hist.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Allocate and free memory for the veg_hist data struct - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/check_files.c b/vic/drivers/classic/src/check_files.c index 10ddccb1e..77a5c548b 100644 --- a/vic/drivers/classic/src/check_files.c +++ b/vic/drivers/classic/src/check_files.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine opens files for soil, vegetation, and global parameters. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/check_save_state_flag.c b/vic/drivers/classic/src/check_save_state_flag.c index 86dccb7d7..f0bbc5d98 100644 --- a/vic/drivers/classic/src/check_save_state_flag.c +++ b/vic/drivers/classic/src/check_save_state_flag.c @@ -3,26 +3,6 @@ * * Function to check whether model state should be saved for the current * time step - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/check_state_file.c b/vic/drivers/classic/src/check_state_file.c index 171f8120a..114f2bafb 100644 --- a/vic/drivers/classic/src/check_state_file.c +++ b/vic/drivers/classic/src/check_state_file.c @@ -4,26 +4,6 @@ * This subroutine opens a model state file and verifys that the starting date, * number of layers and number of thermal nodes in the file agrees with what * was defined in the model global control file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/close_files.c b/vic/drivers/classic/src/close_files.c index da75f2db5..ff623717c 100644 --- a/vic/drivers/classic/src/close_files.c +++ b/vic/drivers/classic/src/close_files.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine closes all forcing data files, and output files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/compute_cell_area.c b/vic/drivers/classic/src/compute_cell_area.c index 69747e483..5fcdd2ce8 100644 --- a/vic/drivers/classic/src/compute_cell_area.c +++ b/vic/drivers/classic/src/compute_cell_area.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This subroutine computes grid cell area. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include diff --git a/vic/drivers/classic/src/display_current_settings.c b/vic/drivers/classic/src/display_current_settings.c index f0c5d7c8f..41431b090 100644 --- a/vic/drivers/classic/src/display_current_settings.c +++ b/vic/drivers/classic/src/display_current_settings.c @@ -3,26 +3,6 @@ * * This routine displays the current settings of options defined in the header * files and the global parameter file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -60,6 +40,7 @@ display_current_settings(int mode) fprintf(LOG_DEST, "Maximum Array Sizes:\n"); fprintf(LOG_DEST, "MAX_FRONTS\t\t%2d\n", MAX_FRONTS); fprintf(LOG_DEST, "MAX_FROST_AREAS\t\t%2d\n", MAX_FROST_AREAS); + fprintf(LOG_DEST, "MAX_LAKE_BASIN_NODES\t\t%2d\n", MAX_LAKE_BASIN_NODES); fprintf(LOG_DEST, "MAX_LAKE_NODES\t\t%2d\n", MAX_LAKE_NODES); fprintf(LOG_DEST, "MAX_ZWTVMOIST\t\t%2d\n", MAX_ZWTVMOIST); fprintf(LOG_DEST, "MAX_LAYERS\t\t%2d\n", MAX_LAYERS); @@ -295,6 +276,19 @@ display_current_settings(int mode) else { fprintf(LOG_DEST, "ORGANIC_FRACT\t\tFALSE\n"); } + if (options.BULK_DENSITY_COMB) { + fprintf(LOG_DEST, "BULK_DENSITY_COMB\t\tTRUE\n"); + } + else { + fprintf(LOG_DEST, "BULK_DENSITY_COMB\t\tFALSE\n"); + } + if (options.MAX_SNOW_ALBEDO) { + fprintf(LOG_DEST, "MAX_SNOW_ALBEDO\t\tTRUE\n"); + } + else { + fprintf(LOG_DEST, "MAX_SNOW_ALBEDO\t\tFALSE\n"); + } + fprintf(LOG_DEST, "\n"); fprintf(LOG_DEST, "Input Veg Data:\n"); diff --git a/vic/drivers/classic/src/get_dist.c b/vic/drivers/classic/src/get_dist.c index 9be0f8c21..0d1434a48 100644 --- a/vic/drivers/classic/src/get_dist.c +++ b/vic/drivers/classic/src/get_dist.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate distance between two locations. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/get_force_type.c b/vic/drivers/classic/src/get_force_type.c index 98bde93f5..9b84b581c 100644 --- a/vic/drivers/classic/src/get_force_type.c +++ b/vic/drivers/classic/src/get_force_type.c @@ -3,26 +3,6 @@ * * This routine determines the current forcing file data type and stores its * location in the description of the current forcing file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -109,15 +89,11 @@ get_force_type(char *cmdstr, else if (strcasecmp("SWDOWN", optstr) == 0) { type = SWDOWN; } - /* type 13: vegetation cover fraction */ - else if (strcasecmp("FCANOPY", optstr) == 0) { - type = FCANOPY; - } - /* type 14: wind speed [m/s] */ + /* type 13: wind speed [m/s] */ else if (strcasecmp("WIND", optstr) == 0) { type = WIND; } - /* type 15: unused (blank) data */ + /* type 14: unused (blank) data */ else if (strcasecmp("SKIP", optstr) == 0) { type = SKIP; } diff --git a/vic/drivers/classic/src/get_global_param.c b/vic/drivers/classic/src/get_global_param.c index 064c98c76..8917538b7 100644 --- a/vic/drivers/classic/src/get_global_param.c +++ b/vic/drivers/classic/src/get_global_param.c @@ -3,26 +3,6 @@ * * This routine reads the VIC model global control file, getting values for * global parameters, model options, and debugging controls. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -446,6 +426,14 @@ get_global_param(FILE *gp) sscanf(cmdstr, "%*s %s", flgstr); options.ORGANIC_FRACT = str_to_bool(flgstr); } + else if (strcasecmp("BULK_DENSITY_COMB", optstr) == 0) { + sscanf(cmdstr, "%*s %s", flgstr); + options.BULK_DENSITY_COMB = str_to_bool(flgstr); + } + else if (strcasecmp("MAX_SNOW_ALBEDO", optstr) == 0) { + sscanf(cmdstr, "%*s %s", flgstr); + options.MAX_SNOW_ALBEDO = str_to_bool(flgstr); + } else if (strcasecmp("VEGLIB", optstr) == 0) { sscanf(cmdstr, "%*s %s", filenames.veglib); } @@ -544,6 +532,9 @@ get_global_param(FILE *gp) sscanf(cmdstr, "%*s %s", flgstr); options.LAKE_PROFILE = str_to_bool(flgstr); } + else if (strcasecmp("LAKE_NODES", optstr) == 0) { + sscanf(cmdstr, "%*s %zu", &options.Nlakenode); + } /************************************* Define output files @@ -1337,6 +1328,10 @@ get_global_param(FILE *gp) log_err("LAKES = TRUE and COMPUTE_TREELINE = TRUE are " "incompatible options."); } + if (options.Nlakenode < 1 || options.Nlakenode > MAX_LAKE_NODES) { + log_err("LAKE_NODES must be between 1 and %d.", + MAX_LAKE_NODES); + } } /********************************* diff --git a/vic/drivers/classic/src/initialize_files.c b/vic/drivers/classic/src/initialize_files.c index 15935fb4f..f956b06bc 100644 --- a/vic/drivers/classic/src/initialize_files.c +++ b/vic/drivers/classic/src/initialize_files.c @@ -3,26 +3,6 @@ * * This subroutine initalizes all filefilenames before they are called by * the model. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/initialize_forcing_files.c b/vic/drivers/classic/src/initialize_forcing_files.c index 150fe9832..370f09ce3 100644 --- a/vic/drivers/classic/src/initialize_forcing_files.c +++ b/vic/drivers/classic/src/initialize_forcing_files.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This subroutine initalizes the forcing file parameters - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/make_in_and_outfiles.c b/vic/drivers/classic/src/make_in_and_outfiles.c index a30d89e85..f989e702e 100644 --- a/vic/drivers/classic/src/make_in_and_outfiles.c +++ b/vic/drivers/classic/src/make_in_and_outfiles.c @@ -3,26 +3,6 @@ * * This program builds the files names for input and output of grided data * files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/open_state_file.c b/vic/drivers/classic/src/open_state_file.c index 62c03b1bb..7365ee26a 100644 --- a/vic/drivers/classic/src/open_state_file.c +++ b/vic/drivers/classic/src/open_state_file.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This subroutine opens the model state file for output. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/parse_output_info.c b/vic/drivers/classic/src/parse_output_info.c index d661e1f6d..709b0ba76 100644 --- a/vic/drivers/classic/src/parse_output_info.c +++ b/vic/drivers/classic/src/parse_output_info.c @@ -3,26 +3,6 @@ * * This routine reads the VIC model global control file, getting information * for output variables list (if any). - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -35,29 +15,29 @@ parse_output_info(FILE *gp, stream_struct **streams, dmy_struct *dmy_current) { - extern option_struct options; - - char cmdstr[MAXSTRING]; - char optstr[MAXSTRING]; - char flgstr[MAXSTRING]; - short int streamnum; - char varname[MAXSTRING]; - int outvarnum; - char freq_type_str[MAXSTRING]; - char freq_value_str[MAXSTRING]; - char format[MAXSTRING]; - char typestr[MAXSTRING]; - int type; - char multstr[MAXSTRING]; - char aggstr[MAXSTRING]; - double mult; - unsigned short int freq; - int freq_n; - dmy_struct freq_dmy; - unsigned short int agg_type; - int found; - size_t nstream_vars[MAX_OUTPUT_STREAMS]; - bool default_outputs = false; + extern option_struct options; + + char cmdstr[MAXSTRING]; + char optstr[MAXSTRING]; + char flgstr[MAXSTRING]; + short int streamnum; + char varname[MAXSTRING]; + int outvarnum; + char freq_type_str[MAXSTRING]; + char freq_value_str[MAXSTRING]; + char format[MAXSTRING]; + char typestr[MAXSTRING]; + int type; + char multstr[MAXSTRING]; + char aggstr[MAXSTRING]; + double mult; + unsigned short int freq; + int freq_n; + dmy_struct freq_dmy; + unsigned short int agg_type; + int found; + size_t nstream_vars[MAX_OUTPUT_STREAMS]; + bool default_outputs = false; /** Read through global control file to find output info **/ diff --git a/vic/drivers/classic/src/print_library_classic.c b/vic/drivers/classic/src/print_library_classic.c index d53fdfe33..571c84b1d 100644 --- a/vic/drivers/classic/src/print_library_classic.c +++ b/vic/drivers/classic/src/print_library_classic.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Print library. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/read_atmos_data.c b/vic/drivers/classic/src/read_atmos_data.c index 0930987b1..1cf9e93af 100644 --- a/vic/drivers/classic/src/read_atmos_data.c +++ b/vic/drivers/classic/src/read_atmos_data.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine reads in atmospheric data values from a binary/ascii file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/read_forcing_data.c b/vic/drivers/classic/src/read_forcing_data.c index 71f4720f6..7b285bbff 100644 --- a/vic/drivers/classic/src/read_forcing_data.c +++ b/vic/drivers/classic/src/read_forcing_data.c @@ -4,26 +4,6 @@ * This subroutine controls the order and number of forcing variables read from * the forcing data files. Two forcing files are allowed, variables, time step * and file format must be defined in the global control file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/read_initial_model_state.c b/vic/drivers/classic/src/read_initial_model_state.c index d9e609975..400a48129 100644 --- a/vic/drivers/classic/src/read_initial_model_state.c +++ b/vic/drivers/classic/src/read_initial_model_state.c @@ -8,26 +8,6 @@ * vegetation type and snow band. However moisture variables from the * distributed precipitation model are averaged so that the model is restarted * with mu = 1. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/read_lakeparam.c b/vic/drivers/classic/src/read_lakeparam.c index b64a43009..2651e2b32 100644 --- a/vic/drivers/classic/src/read_lakeparam.c +++ b/vic/drivers/classic/src/read_lakeparam.c @@ -5,26 +5,6 @@ * * It will either calculate the lake area v. depth profile from a parabolic * curve or read in constant values depending on the LAKE_PROFILE flag. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -73,11 +53,11 @@ read_lakeparam(FILE *lakeparam, "in the lake parameter file is < 1; increase this number " "to at least 1.", temp.numnod, soil_con.gridcel); } - if (temp.numnod > MAX_LAKE_NODES) { - log_err("Number of lake nodes (%zu) in cell %d specified in the " - "lake parameter file exceeds the maximum allowable (%d), " - "edit MAX_LAKE_NODES in user_def.h.", temp.numnod, - soil_con.gridcel, MAX_LAKE_NODES); + if (temp.numnod > MAX_LAKE_BASIN_NODES) { + log_err("Number of lake basin nodes (%zu) in cell %d specified in " + "the lake parameter file exceeds the maximum allowable " + "(%d), edit MAX_LAKE_BASIN_NODES in vic_def.h.", + temp.numnod, soil_con.gridcel, MAX_LAKE_BASIN_NODES); } fscanf(lakeparam, "%lf", &temp.mindepth); if (temp.mindepth < 0) { diff --git a/vic/drivers/classic/src/read_snowband.c b/vic/drivers/classic/src/read_snowband.c index 3fa146f5c..03de7413a 100644 --- a/vic/drivers/classic/src/read_snowband.c +++ b/vic/drivers/classic/src/read_snowband.c @@ -3,26 +3,6 @@ * * This routine reads snow band median elevaton, and precipitation fraction for * use with the snow model. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/read_soilparam.c b/vic/drivers/classic/src/read_soilparam.c index a71abd14c..16c53a632 100644 --- a/vic/drivers/classic/src/read_soilparam.c +++ b/vic/drivers/classic/src/read_soilparam.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine reads soil parameters for each grid cell. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -46,8 +26,6 @@ read_soilparam(FILE *soilparam, char *token; size_t layer; int i, tempint, j; - double Wcr_FRACT[MAX_LAYERS]; - double Wpwp_FRACT[MAX_LAYERS]; double off_gmt; double tempdbl; size_t length; @@ -438,6 +416,29 @@ read_soilparam(FILE *soilparam, } } + if (options.BULK_DENSITY_COMB) { + /* read soil bulk density */ + for (layer = 0; layer < options.Nlayer; layer++) { + token = strtok(NULL, delimiters); + while (token != NULL && (length = strlen(token)) == 0) { + token = strtok(NULL, delimiters); + } + if (token == NULL) { + log_err("Can't find values for SOIL BULK DENSITY for " + "layer %zu in soil file", layer); + } + sscanf(token, "%lf", &(temp->bulk_density)[layer]); + } + } + else { + for (layer = 0; layer < options.Nlayer; layer++) { + temp->bulk_density[layer] = + (1 - + temp->organic[layer]) * temp->bulk_dens_min[layer] + + temp->organic[layer] * temp->bulk_dens_org[layer]; + } + } + /* read cell gmt offset */ token = strtok(NULL, delimiters); while (token != NULL && (length = strlen(token)) == 0) { @@ -458,7 +459,7 @@ read_soilparam(FILE *soilparam, log_err("Can't find values for CRITICAL POINT for layer %zu " "in soil file", layer); } - sscanf(token, "%lf", &(Wcr_FRACT[layer])); + sscanf(token, "%lf", &(temp->Wcr[layer])); } /* read layer wilting point */ @@ -471,7 +472,7 @@ read_soilparam(FILE *soilparam, log_err("Can't find values for WILTING POINT for layer %zu " "in soil file", layer); } - sscanf(token, "%lf", &(Wpwp_FRACT[layer])); + sscanf(token, "%lf", &(temp->Wpwp[layer])); } /* read soil roughness */ @@ -523,7 +524,7 @@ read_soilparam(FILE *soilparam, log_err("Can't find values for RESIDUAL MOISTURE CONTENT for " "layer %zu in soil file", layer); } - sscanf(token, "%lf", &(temp->resid_moist)[layer]); + sscanf(token, "%lf", &(temp->resid_moist[layer])); } /* read frozen soil active flag */ @@ -593,10 +594,6 @@ read_soilparam(FILE *soilparam, Compute Soil Layer Properties *******************************************/ for (layer = 0; layer < options.Nlayer; layer++) { - temp->bulk_density[layer] = - (1 - - temp->organic[layer]) * temp->bulk_dens_min[layer] + - temp->organic[layer] * temp->bulk_dens_org[layer]; temp->soil_density[layer] = (1 - temp->organic[layer]) * temp->soil_dens_min[layer] + @@ -642,8 +639,9 @@ read_soilparam(FILE *soilparam, Compute Soil Layer Critical and Wilting Point Moisture Contents ****************************************************************/ for (layer = 0; layer < options.Nlayer; layer++) { - temp->Wcr[layer] = Wcr_FRACT[layer] * temp->max_moist[layer]; - temp->Wpwp[layer] = Wpwp_FRACT[layer] * temp->max_moist[layer]; + temp->Wcr[layer] *= temp->max_moist[layer]; + temp->Wpwp[layer] *= temp->max_moist[layer]; + temp->resid_moist[layer] *= temp->depth[layer] * MM_PER_M; if (temp->Wpwp[layer] > temp->Wcr[layer]) { log_err("Calculated wilting point moisture (%f mm) is " "greater than calculated critical point moisture " @@ -651,15 +649,13 @@ read_soilparam(FILE *soilparam, "file, Wpwp_FRACT MUST be <= Wcr_FRACT.", temp->Wpwp[layer], temp->Wcr[layer], layer); } - if (temp->Wpwp[layer] < temp->resid_moist[layer] * - temp->depth[layer] * MM_PER_M) { + if (temp->Wpwp[layer] < temp->resid_moist[layer]) { log_err("Calculated wilting point moisture (%f mm) is " "less than calculated residual moisture (%f mm) " "for layer %zu.\n\tIn the soil parameter file, " "Wpwp_FRACT MUST be >= resid_moist / (1.0 - " - "bulk_density/soil_density).", - temp->Wpwp[layer], temp->resid_moist[layer] * - temp->depth[layer] * MM_PER_M, layer); + "bulk_density/soil_density).", temp->Wpwp[layer], + temp->resid_moist[layer], layer); } } @@ -845,195 +841,13 @@ read_soilparam(FILE *soilparam, /************************************************* Compute soil moistures for various values of water table depth - Here we use the relationship (e.g., Letts et al., 2000) - w(z) = { ((zwt-z)/bubble)**(-1/b), z < zwt-bubble - { 1.0, z >= zwt-bubble - where - z = depth below surface [cm] - w(z) = relative moisture at depth z given by - (moist(z) - resid_moist) / (max_moist - resid_moist) - zwt = depth of water table below surface [cm] - bubble = bubbling pressure [cm] - b = 0.5*(expt-3) - Note that zwt-bubble = depth of the free water surface, i.e. - position below which soil is completely saturated. - - This assumes water in unsaturated zone above water table - is always in equilibrium between gravitational and matric - tension (e.g., Frolking et al, 2002). - - So, to find the soil moisture value in a layer corresponding - to a given water table depth zwt, we integrate w(z) over the - whole layer: - - w_avg = average w over whole layer = (integral of w*dz) / layer depth - - Then, - layer moisture = w_avg * (max_moist - resid_moist) + resid_moist - - Instead of the zwt defined above, will actually report free - water surface elevation zwt' = -(zwt-bubble). I.e. zwt' < 0 - below the soil surface, and marks the point of saturation - rather than pressure = 1 atm. - - Do this for each layer individually and also for a) the top N-1 layers - lumped together, and b) the entire soil column lumped together. - *************************************************/ + soil_moisture_from_water_table(temp, options.Nlayer); - /* Individual layers */ - tmp_depth = 0; - for (layer = 0; layer < options.Nlayer; layer++) { - b = 0.5 * (temp->expt[layer] - 3); - bubble = temp->bubble[layer]; - tmp_resid_moist = temp->resid_moist[layer] * temp->depth[layer] * - MM_PER_M; // in mm - zwt_prime = 0; // depth of free water surface below top of layer (not yet elevation) - for (i = 0; i < MAX_ZWTVMOIST; i++) { - temp->zwtvmoist_zwt[layer][i] = -tmp_depth * CM_PER_M - - zwt_prime; // elevation (cm) relative to soil surface - w_avg = (temp->depth[layer] * CM_PER_M - zwt_prime - - (b / - (b - - 1)) * bubble * - (1 - - pow((zwt_prime + bubble) / bubble, - (b - 1) / b))) / - (temp->depth[layer] * CM_PER_M); // in cm - if (w_avg < 0) { - w_avg = 0; - } - if (w_avg > 1) { - w_avg = 1; - } - temp->zwtvmoist_moist[layer][i] = w_avg * - (temp->max_moist[layer] - - tmp_resid_moist) + - tmp_resid_moist; - zwt_prime += temp->depth[layer] * CM_PER_M / - (MAX_ZWTVMOIST - 1); // in cm - } - tmp_depth += temp->depth[layer]; - } - - /* Top N-1 layers lumped together (with average soil properties) */ - tmp_depth = 0; - b = 0; - bubble = 0; - tmp_max_moist = 0; - tmp_resid_moist = 0; - for (layer = 0; layer < options.Nlayer - 1; layer++) { - b += 0.5 * (temp->expt[layer] - 3) * temp->depth[layer]; - bubble += temp->bubble[layer] * temp->depth[layer]; - tmp_max_moist += temp->max_moist[layer]; // total max_moist - tmp_resid_moist += temp->resid_moist[layer] * temp->depth[layer] * - MM_PER_M; // total resid_moist in mm - tmp_depth += temp->depth[layer]; - } - b /= tmp_depth; // average b - bubble /= tmp_depth; // average bubble - zwt_prime = 0; // depth of free water surface below top of layer (not yet elevation) - for (i = 0; i < MAX_ZWTVMOIST; i++) { - temp->zwtvmoist_zwt[options.Nlayer][i] = -zwt_prime; // elevation (cm) relative to soil surface - w_avg = (tmp_depth * CM_PER_M - zwt_prime - - (b / - (b - - 1)) * bubble * - (1 - - pow((zwt_prime + bubble) / bubble, (b - 1) / b))) / - (tmp_depth * CM_PER_M); // in cm - if (w_avg < 0) { - w_avg = 0; - } - if (w_avg > 1) { - w_avg = 1; - } - temp->zwtvmoist_moist[options.Nlayer][i] = w_avg * - (tmp_max_moist - - tmp_resid_moist) + - tmp_resid_moist; - zwt_prime += tmp_depth * CM_PER_M / (MAX_ZWTVMOIST - 1); // in cm - } - - /* Compute zwt by taking total column soil moisture and filling column from bottom up */ - tmp_depth = 0; - for (layer = 0; layer < options.Nlayer; layer++) { - tmp_depth += temp->depth[layer]; - } - zwt_prime = 0; // depth of free water surface below soil surface (not yet elevation) - for (i = 0; i < MAX_ZWTVMOIST; i++) { - temp->zwtvmoist_zwt[options.Nlayer + 1][i] = -zwt_prime; // elevation (cm) relative to soil surface - // Integrate w_avg in pieces - if (zwt_prime == 0) { - tmp_moist = 0; - for (layer = 0; layer < options.Nlayer; layer++) { - tmp_moist += temp->max_moist[layer]; - } - temp->zwtvmoist_moist[options.Nlayer + 1][i] = tmp_moist; - } - else { - tmp_moist = 0; - layer = options.Nlayer - 1; - tmp_depth2 = tmp_depth - temp->depth[layer]; - while (layer > 0 && zwt_prime <= tmp_depth2 * CM_PER_M) { - tmp_moist += temp->max_moist[layer]; - layer--; - tmp_depth2 -= temp->depth[layer]; - } - w_avg = - (tmp_depth2 * CM_PER_M + temp->depth[layer] * CM_PER_M - - zwt_prime) / (temp->depth[layer] * CM_PER_M); - b = 0.5 * (temp->expt[layer] - 3); - bubble = temp->bubble[layer]; - tmp_resid_moist = temp->resid_moist[layer] * - temp->depth[layer] * MM_PER_M; - w_avg += - -(b / - (b - - 1)) * bubble * - (1 - - pow((zwt_prime + bubble - tmp_depth2 * - CM_PER_M) / bubble, - (b - 1) / b)) / (temp->depth[layer] * CM_PER_M); - tmp_moist += w_avg * - (temp->max_moist[layer] - - tmp_resid_moist) + tmp_resid_moist; - b_save = b; - bub_save = bubble; - tmp_depth2_save = tmp_depth2; - while (layer > 0) { - layer--; - tmp_depth2 -= temp->depth[layer]; - b = 0.5 * (temp->expt[layer] - 3); - bubble = temp->bubble[layer]; - tmp_resid_moist = temp->resid_moist[layer] * - temp->depth[layer] * MM_PER_M; - zwt_prime_eff = tmp_depth2_save * CM_PER_M - bubble + - bubble * - pow( - (zwt_prime + bub_save - tmp_depth2_save * - CM_PER_M) / bub_save, b / b_save); - w_avg = - -(b / - (b - - 1)) * bubble * - (1 - - pow((zwt_prime_eff + bubble - tmp_depth2 * - CM_PER_M) / bubble, - (b - 1) / b)) / (temp->depth[layer] * CM_PER_M); - tmp_moist += w_avg * - (temp->max_moist[layer] - - tmp_resid_moist) + tmp_resid_moist; - b_save = b; - bub_save = bubble; - tmp_depth2_save = tmp_depth2; - } - temp->zwtvmoist_moist[options.Nlayer + 1][i] = tmp_moist; - } - zwt_prime += tmp_depth * CM_PER_M / (MAX_ZWTVMOIST - 1); // in cm - } - - /* Compute soil albedo in PAR range (400-700nm) following eqn 122 in Knorr 1997 */ + /************************************************* + Compute soil albedo in PAR range (400-700nm) + following eqn 122 in Knorr 1997 + *************************************************/ if (options.CARBON) { temp->AlbedoPar = 0.92 * param.ALBEDO_BARE_SOIL - 0.015; if (temp->AlbedoPar < param.PHOTO_ALBSOIPARMIN) { diff --git a/vic/drivers/classic/src/read_veglib.c b/vic/drivers/classic/src/read_veglib.c index af7853846..ab87898a6 100644 --- a/vic/drivers/classic/src/read_veglib.c +++ b/vic/drivers/classic/src/read_veglib.c @@ -4,26 +4,6 @@ * This routine reads in a library of vegetation parameters for all vegetation * classes used in the model. The veg class number is used to reference the * information in this library. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -115,6 +95,9 @@ read_veglib(FILE *veglib, temp[i].albedo[j]); } } + if (options.MAX_SNOW_ALBEDO) { + fscanf(veglib, "%lf", &temp[i].max_snow_albedo); + } for (j = 0; j < MONTHS_PER_YEAR; j++) { fscanf(veglib, "%lf", &temp[i].roughness[j]); } diff --git a/vic/drivers/classic/src/read_vegparam.c b/vic/drivers/classic/src/read_vegparam.c index 13ea80878..cadfdbe69 100644 --- a/vic/drivers/classic/src/read_vegparam.c +++ b/vic/drivers/classic/src/read_vegparam.c @@ -5,26 +5,6 @@ * * It also relates each vegetation class in the cell to the appropriate * parameters in the vegetation library. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/vic_classic.c b/vic/drivers/classic/src/vic_classic.c index 51be1d43d..24fc0f328 100644 --- a/vic/drivers/classic/src/vic_classic.c +++ b/vic/drivers/classic/src/vic_classic.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Classic driver of the VIC model - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/vic_classic_timing.c b/vic/drivers/classic/src/vic_classic_timing.c index 275a06d4d..030c2e027 100644 --- a/vic/drivers/classic/src/vic_classic_timing.c +++ b/vic/drivers/classic/src/vic_classic_timing.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Write vic timing table for classic driver - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/vic_force.c b/vic/drivers/classic/src/vic_force.c index 09f1fb770..a52929cec 100644 --- a/vic/drivers/classic/src/vic_force.c +++ b/vic/drivers/classic/src/vic_force.c @@ -3,26 +3,6 @@ * * This routine initializes atmospheric variables for both the model time step, * and the time step used by the snow algorithm (if different). - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -260,13 +240,15 @@ vic_force(force_data_struct *force, veg_hist_data[FCANOPY][v][uidx]; } } - // Check on fcanopy - if (veg_hist[rec][v].fcanopy[i] < MIN_FCANOPY) { + // Checks on fcanopy and LAI + if (veg_hist[rec][v].fcanopy[i] < MIN_FCANOPY || + veg_hist[rec][v].LAI[i] == 0) { log_warn( - "rec %zu, veg %zu substep %zu fcanopy %f < minimum of %f; setting = %f", rec, v, i, - veg_hist[rec][v].fcanopy[i], MIN_FCANOPY, - MIN_FCANOPY); - veg_hist[rec][v].fcanopy[i] = MIN_FCANOPY; + "rec %zu, veg %zu substep %zu fcanopy %f < " + "minimum of %f; setting = 0", rec, v, i, + veg_hist[rec][v].fcanopy[i], MIN_FCANOPY); + veg_hist[rec][v].fcanopy[i] = 0; + veg_hist[rec][v].LAI[i] = 0; } } if (NF > 1) { diff --git a/vic/drivers/classic/src/vic_populate_model_state.c b/vic/drivers/classic/src/vic_populate_model_state.c index cd7d7aeaf..a6cd70245 100644 --- a/vic/drivers/classic/src/vic_populate_model_state.c +++ b/vic/drivers/classic/src/vic_populate_model_state.c @@ -10,26 +10,6 @@ * provided the model initializes all variables with defaults and the user * should expect to throw out the beginning of the simulation period as model * start-up. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -90,7 +70,7 @@ vic_populate_model_state(all_vars_struct *all_vars, // else generate a default state generate_default_state(all_vars, soil_con, veg_con, dmy_current); if (options.LAKES) { - generate_default_lake_state(all_vars, soil_con, lake_con); + generate_default_lake_state(lake, soil_con, lake_con); } } diff --git a/vic/drivers/classic/src/write_data.c b/vic/drivers/classic/src/write_data.c index f240f51c5..dffa362d0 100644 --- a/vic/drivers/classic/src/write_data.c +++ b/vic/drivers/classic/src/write_data.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This subroutine writes all output variables to output files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/write_header.c b/vic/drivers/classic/src/write_header.c index 751e1acd9..cfffeea61 100644 --- a/vic/drivers/classic/src/write_header.c +++ b/vic/drivers/classic/src/write_header.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This subroutine writes a header for all output files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/write_model_state.c b/vic/drivers/classic/src/write_model_state.c index cc4c4a6bd..f71505296 100644 --- a/vic/drivers/classic/src/write_model_state.c +++ b/vic/drivers/classic/src/write_model_state.c @@ -10,26 +10,6 @@ * vegetation type and snow band. However moisture variables from the * distributed precipitation model are averaged so that the model is restarted * with mu = 1. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/classic/src/write_output.c b/vic/drivers/classic/src/write_output.c index f8794d37d..958e6f7c0 100644 --- a/vic/drivers/classic/src/write_output.c +++ b/vic/drivers/classic/src/write_output.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Write output data. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/image/Makefile b/vic/drivers/image/Makefile index 1403f5b2a..c491b2caa 100644 --- a/vic/drivers/image/Makefile +++ b/vic/drivers/image/Makefile @@ -2,26 +2,6 @@ # @section DESCRIPTION # # VIC Image Driver Makefile - # - # @section LICENSE - # - # The Variable Infiltration Capacity (VIC) macroscale hydrological model - # Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - # and Environmental Engineering, University of Washington. - # - # The VIC model is free software; you can redistribute it and/or - # modify it under the terms of the GNU General Public License - # as published by the Free Software Foundation; either version 2 - # of the License, or (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU General Public License for more details. - # - # You should have received a copy of the GNU General Public License along with - # this program; if not, write to the Free Software Foundation, Inc., - # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ############################################################################## # ----------------------------------------------------------------------- diff --git a/vic/drivers/image/include/vic_driver_image.h b/vic/drivers/image/include/vic_driver_image.h index 25d828df7..8f4c794e7 100644 --- a/vic/drivers/image/include/vic_driver_image.h +++ b/vic/drivers/image/include/vic_driver_image.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for vic_driver_image routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_DRIVER_IMAGE_H diff --git a/vic/drivers/image/src/check_save_state_flag.c b/vic/drivers/image/src/check_save_state_flag.c index 3b046df35..29d6297a6 100644 --- a/vic/drivers/image/src/check_save_state_flag.c +++ b/vic/drivers/image/src/check_save_state_flag.c @@ -3,26 +3,6 @@ * * Function to check whether model state should be saved for the current * time step - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/image/src/display_current_settings.c b/vic/drivers/image/src/display_current_settings.c index e02df18cf..758c710b0 100644 --- a/vic/drivers/image/src/display_current_settings.c +++ b/vic/drivers/image/src/display_current_settings.c @@ -3,26 +3,6 @@ * * This routine displays the current settings of options defined in the header * files and the global parameter file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -62,6 +42,7 @@ display_current_settings(int mode) fprintf(LOG_DEST, "Maximum Array Sizes:\n"); fprintf(LOG_DEST, "MAX_FRONTS\t\t%2d\n", MAX_FRONTS); fprintf(LOG_DEST, "MAX_FROST_AREAS\t\t%2d\n", MAX_FROST_AREAS); + fprintf(LOG_DEST, "MAX_LAKE_BASIN_NODES\t\t%2d\n", MAX_LAKE_BASIN_NODES); fprintf(LOG_DEST, "MAX_LAKE_NODES\t\t%2d\n", MAX_LAKE_NODES); fprintf(LOG_DEST, "MAX_ZWTVMOIST\t\t%2d\n", MAX_ZWTVMOIST); fprintf(LOG_DEST, "MAX_LAYERS\t\t%2d\n", MAX_LAYERS); @@ -292,6 +273,18 @@ display_current_settings(int mode) else { fprintf(LOG_DEST, "ORGANIC_FRACT\t\tFALSE\n"); } + if (options.BULK_DENSITY_COMB) { + fprintf(LOG_DEST, "BULK_DENSITY_COMB\t\tTRUE\n"); + } + else { + fprintf(LOG_DEST, "BULK_DENSITY_COMB\t\tFALSE\n"); + } + if (options.MAX_SNOW_ALBEDO) { + fprintf(LOG_DEST, "MAX_SNOW_ALBEDO\t\tTRUE\n"); + } + else { + fprintf(LOG_DEST, "MAX_SNOW_ALBEDO\t\tFALSE\n"); + } fprintf(LOG_DEST, "\n"); if (options.VEGLIB_PHOTO) { diff --git a/vic/drivers/image/src/get_global_param.c b/vic/drivers/image/src/get_global_param.c index 1957716c8..98caaf5eb 100644 --- a/vic/drivers/image/src/get_global_param.c +++ b/vic/drivers/image/src/get_global_param.c @@ -3,26 +3,6 @@ * * This routine reads the VIC model global control file, getting values for * global parameters, model options, and debugging controls. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -429,6 +409,14 @@ get_global_param(FILE *gp) sscanf(cmdstr, "%*s %s", flgstr); options.ORGANIC_FRACT = str_to_bool(flgstr); } + else if (strcasecmp("BULK_DENSITY_COMB", optstr) == 0) { + sscanf(cmdstr, "%*s %s", flgstr); + options.BULK_DENSITY_COMB = str_to_bool(flgstr); + } + else if (strcasecmp("MAX_SNOW_ALBEDO", optstr) == 0) { + sscanf(cmdstr, "%*s %s", flgstr); + options.MAX_SNOW_ALBEDO = str_to_bool(flgstr); + } else if (strcasecmp("VEGLIB_PHOTO", optstr) == 0) { sscanf(cmdstr, "%*s %s", flgstr); options.VEGLIB_PHOTO = str_to_bool(flgstr); @@ -498,6 +486,9 @@ get_global_param(FILE *gp) sscanf(cmdstr, "%*s %s", flgstr); options.LAKE_PROFILE = str_to_bool(flgstr); } + else if (strcasecmp("LAKE_NODES", optstr) == 0) { + sscanf(cmdstr, "%*s %zu", &options.Nlakenode); + } /************************************* Define output files @@ -993,6 +984,10 @@ get_global_param(FILE *gp) log_err("LAKES = TRUE and COMPUTE_TREELINE = TRUE are " "incompatible options."); } + if (options.Nlakenode < 1 || options.Nlakenode > MAX_LAKE_NODES) { + log_err("LAKE_NODES must be between 1 and %d.", + MAX_LAKE_NODES); + } } // Default file formats (if unset) diff --git a/vic/drivers/image/src/vic_force.c b/vic/drivers/image/src/vic_force.c index 4b879b61f..459715659 100644 --- a/vic/drivers/image/src/vic_force.c +++ b/vic/drivers/image/src/vic_force.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Read atmospheric forcing data. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -186,14 +166,17 @@ vic_force(void) // Optional inputs if (options.LAKES) { // Channel inflow to lake - d3start[0] = global_param.forceskip[0] + global_param.forceoffset[0] + - j; - get_scatter_nc_field_double(&(filenames.forcing[0]), - param_set.TYPE[CHANNEL_IN].varname, - d3start, d3count, dvar); - for (j = 0; j < NF; j++) { - for (i = 0; i < local_domain.ncells_active; i++) { - force[i].channel_in[j] = (double) dvar[i]; + // If channel_in not supplied, it defaults to 0 from calloc + if (param_set.TYPE[CHANNEL_IN].SUPPLIED) { + d3start[0] = global_param.forceskip[0] + + global_param.forceoffset[0] + j; + get_scatter_nc_field_double(&(filenames.forcing[0]), + param_set.TYPE[CHANNEL_IN].varname, + d3start, d3count, dvar); + for (j = 0; j < NF; j++) { + for (i = 0; i < local_domain.ncells_active; i++) { + force[i].channel_in[j] = (double) dvar[i]; + } } } } @@ -429,20 +412,27 @@ vic_force(void) param.SNOW_MAX_SNOW_TEMP, &(force[i].prec[j]), 1); } - // Check on fcanopy + } + + // Checks on fcanopy and LAI + for (i = 0; i < local_domain.ncells_active; i++) { for (v = 0; v < options.NVEGTYPES; v++) { vidx = veg_con_map[i].vidx[v]; if (vidx != NODATA_VEG) { for (j = 0; j < NF; j++) { - if ((veg_hist[i][vidx].fcanopy[j] < MIN_FCANOPY) && - ((current == 0) || - (options.FCAN_SRC == FROM_VEGHIST))) { - // Only issue this warning once if not using veg hist fractions - log_warn( - "cell %zu, veg` %d substep %zu fcanopy %f < minimum of %f; setting = %f", i, vidx, j, - veg_hist[i][vidx].fcanopy[j], MIN_FCANOPY, - MIN_FCANOPY); - veg_hist[i][vidx].fcanopy[j] = MIN_FCANOPY; + if (veg_hist[i][vidx].fcanopy[j] < MIN_FCANOPY || + veg_hist[i][vidx].LAI[j] == 0) { + if (current == 0 || options.FCAN_SRC == FROM_VEGHIST) { + // Only issue this warning once + log_warn( + "cell %zu, veg %d substep %zu either fcanopy " + "%f < minimum of %f or LAI %f == 0; setting " + "both LAI and fcanopy to 0", i, vidx, j, + veg_hist[i][vidx].fcanopy[j], MIN_FCANOPY, + veg_hist[i][vidx].LAI[j]); + } + veg_hist[i][vidx].fcanopy[j] = 0; + veg_hist[i][vidx].LAI[j] = 0; } } } diff --git a/vic/drivers/image/src/vic_image.c b/vic/drivers/image/src/vic_image.c index 5fb5f0c66..5ef26166c 100644 --- a/vic/drivers/image/src/vic_image.c +++ b/vic/drivers/image/src/vic_image.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Stand-alone image mode driver of the VIC model - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/image/src/vic_image_finalize.c b/vic/drivers/image/src/vic_image_finalize.c index b08ea7a86..231cdb643 100644 --- a/vic/drivers/image/src/vic_image_finalize.c +++ b/vic/drivers/image/src/vic_image_finalize.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Finalize VIC by freeing memory and closing open files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/image/src/vic_image_init.c b/vic/drivers/image/src/vic_image_init.c index cbb29eb93..d16ca5e57 100644 --- a/vic/drivers/image/src/vic_image_init.c +++ b/vic/drivers/image/src/vic_image_init.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Initialize model parameters for image driver. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/image/src/vic_image_start.c b/vic/drivers/image/src/vic_image_start.c index 5a2ee4f12..f390fccee 100644 --- a/vic/drivers/image/src/vic_image_start.c +++ b/vic/drivers/image/src/vic_image_start.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine handles the startup tasks for the image driver. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/image/src/vic_populate_model_state.c b/vic/drivers/image/src/vic_populate_model_state.c index 4ea9ab7db..392c024b0 100644 --- a/vic/drivers/image/src/vic_populate_model_state.c +++ b/vic/drivers/image/src/vic_populate_model_state.c @@ -8,26 +8,6 @@ * to initialize the model state. If no state file is provided then the * model initializes all variables with defaults and the user should expect * to throw out the beginning of the simulation period as model spin-up. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -57,8 +37,8 @@ vic_populate_model_state(dmy_struct *dmy_current) generate_default_state(&(all_vars[i]), &(soil_con[i]), veg_con[i], dmy_current); if (options.LAKES) { - generate_default_lake_state(&(all_vars[i]), &(soil_con[i]), - lake_con[i]); + generate_default_lake_state(&(all_vars[i].lake_var), + &(soil_con[i]), lake_con[i]); } } } diff --git a/vic/drivers/python/include/vic_driver_python.h b/vic/drivers/python/include/vic_driver_python.h index d18d47a7b..c6d5ed5e8 100644 --- a/vic/drivers/python/include/vic_driver_python.h +++ b/vic/drivers/python/include/vic_driver_python.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for vic_driver_image routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_DRIVER_PYTHON_H diff --git a/vic/drivers/python/setup.py b/vic/drivers/python/setup.py index 68e00de93..19d8ce13e 100644 --- a/vic/drivers/python/setup.py +++ b/vic/drivers/python/setup.py @@ -124,7 +124,7 @@ def make_cffi_headers(): 'zwtvmoist_zwt', 'zwtvmoist_moist'] - args = ['gcc', '-std=c99', '-E', + args = [os.environ.get('CC') or 'gcc', '-std=c99', '-E', '-P', os.path.join(vic_root_abs_path, 'vic', 'drivers', 'python', 'src', 'globals.c'), '-I%s' % os.path.join(vic_root_abs_path, 'vic', 'drivers', diff --git a/vic/drivers/python/src/display_current_settings.c b/vic/drivers/python/src/display_current_settings.c index 8764ab752..aa13ca618 100644 --- a/vic/drivers/python/src/display_current_settings.c +++ b/vic/drivers/python/src/display_current_settings.c @@ -3,26 +3,6 @@ * * This routine displays the current settings of options defined in the header * files and the global parameter file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -55,6 +35,7 @@ display_current_settings(int mode) fprintf(LOG_DEST, "Maximum Array Sizes:\n"); fprintf(LOG_DEST, "MAX_FRONTS\t\t%2d\n", MAX_FRONTS); fprintf(LOG_DEST, "MAX_FROST_AREAS\t\t\t%2d\n", MAX_FROST_AREAS); + fprintf(LOG_DEST, "MAX_LAKE_BASIN_NODES\t\t%2d\n", MAX_LAKE_BASIN_NODES); fprintf(LOG_DEST, "MAX_LAKE_NODES\t\t%2d\n", MAX_LAKE_NODES); fprintf(LOG_DEST, "MAX_ZWTVMOIST\t\t%2d\n", MAX_ZWTVMOIST); fprintf(LOG_DEST, "MAX_LAYERS\t\t%2d\n", MAX_LAYERS); @@ -257,6 +238,18 @@ display_current_settings(int mode) else { fprintf(LOG_DEST, "ORGANIC_FRACT\t\tFALSE\n"); } + if (options.BULK_DENSITY_COMB) { + fprintf(LOG_DEST, "BULK_DENSITY_COMB\t\tTRUE\n"); + } + else { + fprintf(LOG_DEST, "BULK_DENSITY_COMB\t\tFALSE\n"); + } + if (options.MAX_SNOW_ALBEDO) { + fprintf(LOG_DEST, "MAX_SNOW_ALBEDO\t\tTRUE\n"); + } + else { + fprintf(LOG_DEST, "MAX_SNOW_ALBEDO\t\tFALSE\n"); + } fprintf(LOG_DEST, "\n"); if (options.VEGLIB_PHOTO) { diff --git a/vic/drivers/python/src/globals.c b/vic/drivers/python/src/globals.c index ebd62c189..71ce25205 100644 --- a/vic/drivers/python/src/globals.c +++ b/vic/drivers/python/src/globals.c @@ -3,26 +3,6 @@ * * Top level wrapper for globals used in vic_run but defined at the global * level. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/python/vic/driver.py b/vic/drivers/python/vic/driver.py index 70dbe399f..592248d03 100644 --- a/vic/drivers/python/vic/driver.py +++ b/vic/drivers/python/vic/driver.py @@ -2,26 +2,6 @@ @section DESCRIPTION Python driver for VIC - - @section LICENSE - - The Variable Infiltration Capacity (VIC) macroscale hydrological model - Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - and Environmental Engineering, University of Washington. - - The VIC model is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. """ from .vic import lib diff --git a/vic/drivers/python/vic/vic.py b/vic/drivers/python/vic/vic.py index 0a610ca05..ab7abbf6b 100644 --- a/vic/drivers/python/vic/vic.py +++ b/vic/drivers/python/vic/vic.py @@ -2,26 +2,6 @@ @section DESCRIPTION cffi wrapper for vic_run - - @section LICENSE - - The Variable Infiltration Capacity (VIC) macroscale hydrological model - Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - and Environmental Engineering, University of Washington. - - The VIC model is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. """ from ._vic import ffi diff --git a/vic/drivers/shared_all/include/vic_driver_shared_all.h b/vic/drivers/shared_all/include/vic_driver_shared_all.h index b60a97808..395e5cf1c 100644 --- a/vic/drivers/shared_all/include/vic_driver_shared_all.h +++ b/vic/drivers/shared_all/include/vic_driver_shared_all.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for vic_driver_shared_all routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_DRIVER_SHARED_H @@ -634,7 +614,7 @@ void free_streams(stream_struct **streams); void free_vegcon(veg_con_struct **veg_con); void generate_default_state(all_vars_struct *, soil_con_struct *, veg_con_struct *, dmy_struct *); -void generate_default_lake_state(all_vars_struct *, soil_con_struct *, +void generate_default_lake_state(lake_var_struct *, soil_con_struct *, lake_con_struct); void get_default_nstreams_nvars(size_t *nstreams, size_t nvars[]); void get_parameters(FILE *paramfile); diff --git a/vic/drivers/shared_all/include/vic_version.h b/vic/drivers/shared_all/include/vic_version.h index f3062b87c..4ff988c16 100644 --- a/vic/drivers/shared_all/include/vic_version.h +++ b/vic/drivers/shared_all/include/vic_version.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for build time metadata - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_VERSION_H diff --git a/vic/drivers/shared_all/src/agg_data.c b/vic/drivers/shared_all/src/agg_data.c index 5c2934690..45fca51ba 100644 --- a/vic/drivers/shared_all/src/agg_data.c +++ b/vic/drivers/shared_all/src/agg_data.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Initialize output structures. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/alarms.c b/vic/drivers/shared_all/src/alarms.c index 9b3e19e5e..1d4fa77d7 100644 --- a/vic/drivers/shared_all/src/alarms.c +++ b/vic/drivers/shared_all/src/alarms.c @@ -3,26 +3,6 @@ * * This file includes routines that calculate and raise alarms for writing * history and state files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/calc_root_fraction.c b/vic/drivers/shared_all/src/calc_root_fraction.c index ff9efb9a1..790581b4d 100644 --- a/vic/drivers/shared_all/src/calc_root_fraction.c +++ b/vic/drivers/shared_all/src/calc_root_fraction.c @@ -4,32 +4,25 @@ * This routine computes the fraction of roots in each soil layer based on the * root zone distribution defined in the vegetation parameter file. Roots are * assumed to be linearly distributed within each root zone. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include /****************************************************************************** * @brief This routine computes the fraction of roots in each soil layer. + * + * Overview: take the union of the set of soil layer boundaries and + * the set of root zone boundaries, and define depth intervals 'dD' + * that are the spaces between these boundaries. For each soil layer, + * the total root fraction is the sum of root fractions in all of the + * dD[i] that fall within the layer. To accomplish this sum + * efficiently, first compute root density (fraction per unit depth) + * as: + * root_dens[zone] = fract[zone] / depth[zone] + * Assign root densities to each dD[i] as: + * root_dens[i] = root_dens[zone] for the zone that dD[i] is in + * Then, compute each layer's total root fraction as: + * root[layer] = sum_over_i(dD[i] * root_dens[i]) *****************************************************************************/ void calc_root_fractions(veg_con_struct *veg_con, @@ -41,128 +34,135 @@ calc_root_fractions(veg_con_struct *veg_con, int veg; size_t layer; size_t zone; - size_t i; - size_t n_iter; + size_t ltmp; + double Lsum; + double Lsumprev; + double Zsum; + double Dsum; + double Dsumprev; + double dD; double sum_fract; + double *root_dens; double dum; - double Zstep; - double Zsum; - double Lstep; - double Lsum; - double Zmin_fract; - double Zmin_depth; - double Zmax; + + root_dens = calloc(options.ROOT_ZONES, sizeof(double)); Nveg = veg_con[0].vegetat_type_num; for (veg = 0; veg < Nveg; veg++) { - sum_fract = 0; - layer = 0; - Lstep = soil_con->depth[layer]; - Lsum = Lstep; - Zsum = 0; - zone = 0; + // Check that root fractions sum to 1.0 + dum = 0.0; + for (zone = 0; zone < options.ROOT_ZONES; zone++) { + dum += veg_con[veg].zone_fract[zone]; + } + if (!assert_close_double(dum, 1, 0, 1e-4)) { + log_err("Input root fractions do not sum to 1.0: %f, " + "veg class: %d", dum, veg_con[veg].veg_class); + } - n_iter = 0; - while (zone < options.ROOT_ZONES) { - n_iter++; - if (n_iter > MAX_ROOT_ITER) { - log_warn("veg=%d of Nveg=%d", veg, Nveg); - log_warn("zone %zu of %zu ROOT_ZONES", zone, - options.ROOT_ZONES); - log_err("stuck in an infinite loop"); + // Compute density of root fractions in each root zone + for (zone = 0; zone < options.ROOT_ZONES; zone++) { + if (veg_con[veg].zone_depth[zone] > 0) { + root_dens[zone] = veg_con[veg].zone_fract[zone] / + veg_con[veg].zone_depth[zone]; } + else { + root_dens[zone] = 1.0; + } + } - Zstep = veg_con[veg].zone_depth[zone]; - if ((Zsum + Zstep) <= Lsum && Zsum >= Lsum - Lstep) { - /** CASE 1: Root Zone Completely in Soil Layer **/ - sum_fract += veg_con[veg].zone_fract[zone]; + layer = 0; + zone = 0; + Lsum = soil_con->depth[layer]; + Lsumprev = 0; + Zsum = veg_con[veg].zone_depth[zone]; + Dsum = 0; + Dsumprev = 0; + sum_fract = 0; + + while (layer < options.Nlayer || zone < options.ROOT_ZONES) { + // Determine the depth interval for consideration + // Depth intervals span from the previous layer or zone boundary + // to the next layer or zone boundary. + if (Lsum <= Zsum && layer < options.Nlayer) { + Dsum = Lsum; } else { - /** CASE 2: Root Zone Partially in Soil Layer **/ - if (Zsum < Lsum - Lstep) { - /** Root zone starts in previous soil layer **/ - Zmin_depth = Lsum - Lstep; - Zmin_fract = linear_interp(Zmin_depth, Zsum, Zsum + Zstep, - 0, - veg_con[veg].zone_fract[zone]); - } - else { - /** Root zone starts in current soil layer **/ - Zmin_depth = Zsum; - Zmin_fract = 0.; - } - if (Zsum + Zstep <= Lsum) { - /** Root zone ends in current layer **/ - Zmax = Zsum + Zstep; - } - else { - /** Root zone extends beyond bottom of current layer **/ - Zmax = Lsum; - } - sum_fract += linear_interp(Zmax, Zsum, Zsum + Zstep, 0, - veg_con[veg].zone_fract[zone]) - - Zmin_fract; + Dsum = Zsum; } + dD = Dsum - Dsumprev; + Dsumprev = Dsum; - /** Update Root Zone and Soil Layer **/ - if (Zsum + Zstep < Lsum) { - Zsum += Zstep; - zone++; + // Add root fraction in this interval to the running total + // for this layer + if (zone < options.ROOT_ZONES) { + sum_fract += dD * root_dens[zone]; } - else if (Zsum + Zstep == Lsum) { - Zsum += Zstep; - zone++; - if (layer < options.Nlayer) { - veg_con[veg].root[layer] = sum_fract; - sum_fract = 0.; + + // Assign the total root fraction for this soil layer + // Wait to do this until we've completed a soil layer + // and either we're not at the final soil layer, + // or we're at the final layer and we've completed all root zones + if (Lsum > Lsumprev && Dsum == Lsum && + (layer < options.Nlayer - 1 || + (zone >= options.ROOT_ZONES - 1 && Dsum == Zsum))) { + // Assign the total root fraction + ltmp = layer; + if (layer >= options.Nlayer - 1) { + ltmp = options.Nlayer - 1; } + veg_con[veg].root[ltmp] = sum_fract; + + // Reset running total for next layer + sum_fract = 0; + } + + // Decide whether to increment layer or zone + if (Lsum < Zsum) { + // zone extends beyond layer, so increment layer + // it's ok to exceed limit; this tells algorithm we're done layer++; if (layer < options.Nlayer) { - Lstep = soil_con->depth[layer]; - Lsum += Lstep; + Lsumprev = Lsum; + Lsum += soil_con->depth[layer]; } - else if (layer == options.Nlayer && zone < options.ROOT_ZONES) { - Zstep = (double) veg_con[veg].zone_depth[zone]; - Lstep = Zsum + Zstep - Lsum; - if (zone < options.ROOT_ZONES - 1) { - for (i = zone + 1; i < options.ROOT_ZONES; i++) { - Lstep += veg_con[veg].zone_depth[i]; - } - } - Lsum += Lstep; + else { + // We have reached the bottom of the soil column; + // extend Lsum to include all remaining roots within + // the final soil layer + Lsum = Zsum; } } - else if (Zsum + Zstep > Lsum) { + else if (Lsum > Zsum) { + // layer extends beyond zone, so increment zone + // it's ok to exceed limit; this tells algorithm we're done zone++; - if (layer < options.Nlayer) { - veg_con[veg].root[layer] = sum_fract; - sum_fract = 0.; + if (zone < options.ROOT_ZONES) { + Zsum += veg_con[veg].zone_depth[zone]; + } + else { + // We have reached the bottom of the root zone; + // extend Zsum to include the remainder of the soil layer + Zsum = Lsum; } + } + else { + // layer and zone end at the same depth, so increment both + // it's ok to exceed limit; this tells algorithm we're done layer++; if (layer < options.Nlayer) { - Lstep = soil_con->depth[layer]; - Lsum += Lstep; + Lsumprev = Lsum; + Lsum += soil_con->depth[layer]; } - else if (layer == options.Nlayer) { - Lstep = Zsum + Zstep - Lsum; - if (zone < options.ROOT_ZONES - 1) { - for (i = zone + 1; i < options.ROOT_ZONES; i++) { - Lstep += veg_con[veg].zone_depth[i]; - } - } - Lsum += Lstep; + zone++; + if (zone < options.ROOT_ZONES) { + Zsum += veg_con[veg].zone_depth[zone]; } } } - if (sum_fract > 0 && layer >= options.Nlayer) { - veg_con[veg].root[options.Nlayer - 1] += sum_fract; - } - else if (sum_fract > 0) { - veg_con[veg].root[layer] += sum_fract; - } - + // Final check on root fractions. If they don't sum to 1, throw error + // Otherwise, rescale by sum to eliminate small rounding errors dum = 0.; for (layer = 0; layer < options.Nlayer; layer++) { if (veg_con[veg].root[layer] < 1.e-4) { @@ -170,12 +170,16 @@ calc_root_fractions(veg_con_struct *veg_con, } dum += veg_con[veg].root[layer]; } - if (dum == 0.0) { - log_err("Root fractions sum equals zero: %f , Vege Class: %d", - dum, veg_con[veg].veg_class); + if (!assert_close_double(dum, 1, 0, 1e-4)) { + log_err("Soil layer root fractions do not sum to 1.0: %f, " + "veg class: %d", dum, veg_con[veg].veg_class); } - for (layer = 0; layer < options.Nlayer; layer++) { - veg_con[veg].root[layer] /= dum; + else { + for (layer = 0; layer < options.Nlayer; layer++) { + veg_con[veg].root[layer] /= dum; + } } } + + free((char *) root_dens); } diff --git a/vic/drivers/shared_all/src/cmd_proc.c b/vic/drivers/shared_all/src/cmd_proc.c index 884eea9c5..413997b30 100644 --- a/vic/drivers/shared_all/src/cmd_proc.c +++ b/vic/drivers/shared_all/src/cmd_proc.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine checks the command line for valid program options. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -136,17 +116,13 @@ print_license() fprintf(stdout, "\n Variable Infiltration Capacity (VIC) macroscale hydrologic\n"); fprintf(stdout, - " model version %s, Copyright (C) 2016 Computational\n", - SHORT_VERSION); - fprintf(stdout, - " Hydrology Group, Dept. of Civil and Environmental Engineering,\n"); + " model, version %s\n\n", SHORT_VERSION); fprintf(stdout, - " University of Washington. VIC comes with ABSOLUTELY NO\n"); + " MIT LICENSE\n\n"); fprintf(stdout, - " WARRANTY. This is free software, you may redistribute it\n"); + " Copyright (C) 2021 VIC Developers\n\n"); fprintf(stdout, - " under certain conditions; see LICENSE.txt for details.\n\n"); - + " See LICENSE.txt for details.\n\n"); fprintf(stdout, " Report Bugs and Issues to : https://github.com/UW-Hydro/VIC/issues\n"); fprintf(stdout, diff --git a/vic/drivers/shared_all/src/compress_files.c b/vic/drivers/shared_all/src/compress_files.c index 429fb0757..12da72bd6 100644 --- a/vic/drivers/shared_all/src/compress_files.c +++ b/vic/drivers/shared_all/src/compress_files.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This subroutine compresses the file "string" using a system call. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/compute_derived_state_vars.c b/vic/drivers/shared_all/src/compute_derived_state_vars.c index bff4c87a7..8d6da8326 100644 --- a/vic/drivers/shared_all/src/compute_derived_state_vars.c +++ b/vic/drivers/shared_all/src/compute_derived_state_vars.c @@ -4,26 +4,6 @@ * This routine computes the state variables (energy balance, water balance, * and snow components) that are derived from the variables that are stored in * state files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -136,12 +116,12 @@ compute_derived_state_vars(all_vars_struct *all_vars, if (FIRST_VEG) { FIRST_VEG = false; set_node_parameters(soil_con->Zsum_node, - soil_con->max_moist_node, + soil_con->porosity_node, soil_con->expt_node, soil_con->bubble_node, soil_con->alpha, soil_con->beta, soil_con->gamma, soil_con->depth, - soil_con->max_moist, soil_con->expt, + soil_con->porosity, soil_con->expt, soil_con->bubble, options.Nnode, options.Nlayer); } @@ -156,7 +136,7 @@ compute_derived_state_vars(all_vars_struct *all_vars, energy[veg][band].Cs_node, soil_con->Zsum_node, energy[veg][band].T, - soil_con->max_moist_node, + soil_con->porosity_node, soil_con->expt_node, soil_con->bubble_node, tmpM[veg][band], diff --git a/vic/drivers/shared_all/src/compute_lake_params.c b/vic/drivers/shared_all/src/compute_lake_params.c index 9ed1325bc..3705b7293 100644 --- a/vic/drivers/shared_all/src/compute_lake_params.c +++ b/vic/drivers/shared_all/src/compute_lake_params.c @@ -3,26 +3,6 @@ * * This subroutine computes dependent lake parameters from the specified * lake parameters. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/compute_treeline.c b/vic/drivers/shared_all/src/compute_treeline.c index 0881ec940..4086b914b 100644 --- a/vic/drivers/shared_all/src/compute_treeline.c +++ b/vic/drivers/shared_all/src/compute_treeline.c @@ -13,26 +13,6 @@ * while grass and shrubs will remain). This is to serve as a preliminary fix * for high elevation "glaciers", a more permanent version would actually allow * for vegetation types to be excluded from various snow bands. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/forcing_utils.c b/vic/drivers/shared_all/src/forcing_utils.c index af9f7feef..1bf2e4dff 100644 --- a/vic/drivers/shared_all/src/forcing_utils.c +++ b/vic/drivers/shared_all/src/forcing_utils.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Library of utilities for processing meteorological forcings. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/free_all_vars.c b/vic/drivers/shared_all/src/free_all_vars.c index fd157310d..4d0402c8f 100644 --- a/vic/drivers/shared_all/src/free_all_vars.c +++ b/vic/drivers/shared_all/src/free_all_vars.c @@ -5,26 +5,6 @@ * * This include all grid cell specific variables (soil, vegetation, energy, * snow). - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/free_vegcon.c b/vic/drivers/shared_all/src/free_vegcon.c index 97980c9e8..842e23b8b 100644 --- a/vic/drivers/shared_all/src/free_vegcon.c +++ b/vic/drivers/shared_all/src/free_vegcon.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This subroutine frees all components of the veg_con structure. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/generate_default_lake_state.c b/vic/drivers/shared_all/src/generate_default_lake_state.c index d755e6fe2..00c27d39b 100644 --- a/vic/drivers/shared_all/src/generate_default_lake_state.c +++ b/vic/drivers/shared_all/src/generate_default_lake_state.c @@ -3,26 +3,6 @@ * * This routine initializes the lake model state (energy balance, water balance, * snow components) to default values. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -32,7 +12,7 @@ * and snow components) to default values. *****************************************************************************/ void -generate_default_lake_state(all_vars_struct *all_vars, +generate_default_lake_state(lake_var_struct *lake, soil_con_struct *soil_con, lake_con_struct lake_con) { @@ -40,10 +20,6 @@ generate_default_lake_state(all_vars_struct *all_vars, size_t k; - lake_var_struct lake; - - lake = all_vars->lake_var; - /************************************************************************ Initialize lake state variables TBD: currently setting depth to depth_in from parameter file, but @@ -52,10 +28,10 @@ generate_default_lake_state(all_vars_struct *all_vars, want control over initial depth) ************************************************************************/ if (options.LAKES) { - lake.ldepth = lake_con.depth_in; - for (k = 0; k < lake.activenod; k++) { + lake->ldepth = lake_con.depth_in; + for (k = 0; k < lake->activenod; k++) { // lake model requires FULL_ENERGY set to true - lake.temp[k] = soil_con->avg_temp; + lake->temp[k] = soil_con->avg_temp; } } } diff --git a/vic/drivers/shared_all/src/generate_default_state.c b/vic/drivers/shared_all/src/generate_default_state.c index cfcda7dc7..f61a3ff78 100644 --- a/vic/drivers/shared_all/src/generate_default_state.c +++ b/vic/drivers/shared_all/src/generate_default_state.c @@ -3,26 +3,6 @@ * * This routine initializes the model state (energy balance, water balance, and * snow components) to default values. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/get_parameters.c b/vic/drivers/shared_all/src/get_parameters.c index 2fb271627..862ecf324 100644 --- a/vic/drivers/shared_all/src/get_parameters.c +++ b/vic/drivers/shared_all/src/get_parameters.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine reads the VIC model parameters file - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/history_metadata.c b/vic/drivers/shared_all/src/history_metadata.c index 75746a94c..3c0a13d44 100644 --- a/vic/drivers/shared_all/src/history_metadata.c +++ b/vic/drivers/shared_all/src/history_metadata.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine sets the metadata structure for VIC output variables - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/initialize_energy.c b/vic/drivers/shared_all/src/initialize_energy.c index 8cdfc6bfa..bde480705 100644 --- a/vic/drivers/shared_all/src/initialize_energy.c +++ b/vic/drivers/shared_all/src/initialize_energy.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Initialize energy structure. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/initialize_global.c b/vic/drivers/shared_all/src/initialize_global.c index 5bf50dc65..91567759b 100644 --- a/vic/drivers/shared_all/src/initialize_global.c +++ b/vic/drivers/shared_all/src/initialize_global.c @@ -3,26 +3,6 @@ * * This subroutine initalizes all global parameters before they are called by * the model. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/initialize_options.c b/vic/drivers/shared_all/src/initialize_options.c index 528af2e5d..804ec443a 100644 --- a/vic/drivers/shared_all/src/initialize_options.c +++ b/vic/drivers/shared_all/src/initialize_options.c @@ -3,26 +3,6 @@ * * This subroutine initalizes all options before they are called by * the model. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -72,6 +52,8 @@ initialize_options() // Model dimensions options.Ncanopy = 3; options.Nfrost = 1; + options.Nlakebasnode = MAX_LAKE_BASIN_NODES; + options.Nlakenode = MAX_LAKE_NODES; options.Nlayer = 3; options.Nnode = 3; options.ROOT_ZONES = 0; @@ -84,6 +66,8 @@ initialize_options() options.JULY_TAVG_SUPPLIED = false; options.LAI_SRC = FROM_VEGLIB; options.ORGANIC_FRACT = false; + options.BULK_DENSITY_COMB = false; + options.MAX_SNOW_ALBEDO = false; options.VEGLIB_FCAN = false; options.VEGLIB_PHOTO = false; options.VEGPARAM_ALB = false; @@ -91,6 +75,7 @@ initialize_options() options.VEGPARAM_LAI = false; // state options options.STATE_FORMAT = UNSET_FILE_FORMAT; + options.STATENAME_CESM = false; options.INIT_STATE = false; options.SAVE_STATE = false; // output options diff --git a/vic/drivers/shared_all/src/initialize_parameters.c b/vic/drivers/shared_all/src/initialize_parameters.c index 680674942..a86315a07 100644 --- a/vic/drivers/shared_all/src/initialize_parameters.c +++ b/vic/drivers/shared_all/src/initialize_parameters.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Initialize parameters structure. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/initialize_snow.c b/vic/drivers/shared_all/src/initialize_snow.c index 01b84423b..6b5e6a808 100644 --- a/vic/drivers/shared_all/src/initialize_snow.c +++ b/vic/drivers/shared_all/src/initialize_snow.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine initializes the snow variable arrays for each new grid cell. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/initialize_soil.c b/vic/drivers/shared_all/src/initialize_soil.c index 8850fb3bd..1234e1398 100644 --- a/vic/drivers/shared_all/src/initialize_soil.c +++ b/vic/drivers/shared_all/src/initialize_soil.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine initializes the soil variable arrays for each new grid cell. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/initialize_veg.c b/vic/drivers/shared_all/src/initialize_veg.c index d61f1a0a9..b748b4a71 100644 --- a/vic/drivers/shared_all/src/initialize_veg.c +++ b/vic/drivers/shared_all/src/initialize_veg.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine initailizes the vegetation variable array. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/input_tools.c b/vic/drivers/shared_all/src/input_tools.c index 82e3d904f..70e49c696 100644 --- a/vic/drivers/shared_all/src/input_tools.c +++ b/vic/drivers/shared_all/src/input_tools.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This file includes routines to help parse and process VIC input files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/make_all_vars.c b/vic/drivers/shared_all/src/make_all_vars.c index ba1252172..9fa1bb7ee 100644 --- a/vic/drivers/shared_all/src/make_all_vars.c +++ b/vic/drivers/shared_all/src/make_all_vars.c @@ -3,26 +3,6 @@ * * This routine creates an array of structures that contain information about a * cell's states and fluxes. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/make_cell_data.c b/vic/drivers/shared_all/src/make_cell_data.c index 19702eeae..e86d95c31 100644 --- a/vic/drivers/shared_all/src/make_cell_data.c +++ b/vic/drivers/shared_all/src/make_cell_data.c @@ -3,26 +3,6 @@ * * This subroutine makes an array of type cell, which contains soil column * variables for a single grid cell. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/make_dmy.c b/vic/drivers/shared_all/src/make_dmy.c index ea113fd79..0f2e6b87c 100644 --- a/vic/drivers/shared_all/src/make_dmy.c +++ b/vic/drivers/shared_all/src/make_dmy.c @@ -3,26 +3,6 @@ * * This subroutine creates an array of structures that contain information * about the day, month and year of each time step. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/make_energy_bal.c b/vic/drivers/shared_all/src/make_energy_bal.c index 1d104e6aa..2c05da64e 100644 --- a/vic/drivers/shared_all/src/make_energy_bal.c +++ b/vic/drivers/shared_all/src/make_energy_bal.c @@ -3,26 +3,6 @@ * * This routine makes an array of frozen soil data structures, one for each * vegetation type and bare soil. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/make_snow_data.c b/vic/drivers/shared_all/src/make_snow_data.c index 78e1a2d6b..24bfdcc66 100644 --- a/vic/drivers/shared_all/src/make_snow_data.c +++ b/vic/drivers/shared_all/src/make_snow_data.c @@ -3,26 +3,6 @@ * * This routine makes an array of snow cover data structures, one for each * vegetation type plus bare soil. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/make_veg_var.c b/vic/drivers/shared_all/src/make_veg_var.c index 0c35e4257..98ff74ba0 100644 --- a/vic/drivers/shared_all/src/make_veg_var.c +++ b/vic/drivers/shared_all/src/make_veg_var.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine makes an array of vegitation variables for each vegitation type. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/open_file.c b/vic/drivers/shared_all/src/open_file.c index 0144bd83e..679c1bdd4 100644 --- a/vic/drivers/shared_all/src/open_file.c +++ b/vic/drivers/shared_all/src/open_file.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Open a file named by string and associate a stream with it. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/print_library_shared.c b/vic/drivers/shared_all/src/print_library_shared.c index 22002cb27..002ae4e32 100644 --- a/vic/drivers/shared_all/src/print_library_shared.c +++ b/vic/drivers/shared_all/src/print_library_shared.c @@ -2,32 +2,12 @@ * @section DESCRIPTION * * Print library. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include /****************************************************************************** - * @brief Print dell data structure. + * @brief Print cell data structure. *****************************************************************************/ void print_cell_data(cell_data_struct *cell, @@ -516,11 +496,17 @@ print_option(option_struct *option) option->LAKE_PROFILE ? "true" : "false"); fprintf(LOG_DEST, "\tORGANIC_FRACT : %s\n", option->ORGANIC_FRACT ? "true" : "false"); + fprintf(LOG_DEST, "\tBULK_DENSITY_COMB : %s\n", + option->BULK_DENSITY_COMB ? "true" : "false"); + fprintf(LOG_DEST, "\tMAX_SNOW_ALBEDO : %s\n", + option->MAX_SNOW_ALBEDO ? "true" : "false"); fprintf(LOG_DEST, "\tSTATE_FORMAT : %d\n", option->STATE_FORMAT); fprintf(LOG_DEST, "\tINIT_STATE : %s\n", option->INIT_STATE ? "true" : "false"); fprintf(LOG_DEST, "\tSAVE_STATE : %s\n", option->SAVE_STATE ? "true" : "false"); + fprintf(LOG_DEST, "\tSTATENAME_CESM : %s\n", + option->STATENAME_CESM ? "true" : "false"); fprintf(LOG_DEST, "\tNoutstreams : %zu\n", option->Noutstreams); } @@ -1011,11 +997,6 @@ print_soil_con(soil_con_struct *scon, fprintf(LOG_DEST, "\t%f", scon->max_moist[i]); } fprintf(LOG_DEST, "\n"); - fprintf(LOG_DEST, "\tmax_moist_node :"); - for (i = 0; i < nnodes; i++) { - fprintf(LOG_DEST, "\t%f", scon->max_moist_node[i]); - } - fprintf(LOG_DEST, "\n"); fprintf(LOG_DEST, "\tmax_snow_distrib_slope: %f\n", scon->max_snow_distrib_slope); fprintf(LOG_DEST, "\tphi_s :"); @@ -1028,6 +1009,11 @@ print_soil_con(soil_con_struct *scon, fprintf(LOG_DEST, "\t%f", scon->porosity[i]); } fprintf(LOG_DEST, "\n"); + fprintf(LOG_DEST, "\tporosity_node :"); + for (i = 0; i < nnodes; i++) { + fprintf(LOG_DEST, "\t%f", scon->porosity_node[i]); + } + fprintf(LOG_DEST, "\n"); fprintf(LOG_DEST, "\tquartz :"); for (i = 0; i < nlayers; i++) { fprintf(LOG_DEST, "\t%f", scon->quartz[i]); diff --git a/vic/drivers/shared_all/src/put_data.c b/vic/drivers/shared_all/src/put_data.c index a94ec9845..b7ecb454b 100644 --- a/vic/drivers/shared_all/src/put_data.c +++ b/vic/drivers/shared_all/src/put_data.c @@ -3,26 +3,6 @@ * * This routine converts data units, and stores finalized values in an array * for later output to the output files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/set_output_defaults.c b/vic/drivers/shared_all/src/set_output_defaults.c index 82c4769af..648d25f02 100644 --- a/vic/drivers/shared_all/src/set_output_defaults.c +++ b/vic/drivers/shared_all/src/set_output_defaults.c @@ -3,26 +3,6 @@ * * Set the output_stream and out_data structures to default values. These can * be overridden by the user in the global control file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/soil_moisture_from_water_table.c b/vic/drivers/shared_all/src/soil_moisture_from_water_table.c index c01f991c9..cd3306000 100644 --- a/vic/drivers/shared_all/src/soil_moisture_from_water_table.c +++ b/vic/drivers/shared_all/src/soil_moisture_from_water_table.c @@ -36,26 +36,6 @@ * * Do this for each layer individually and also for a) the top N-1 layers * lumped together, and b) the entire soil column lumped together. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -88,8 +68,6 @@ soil_moisture_from_water_table(soil_con_struct *soil_con, for (j = 0; j < nlayers; j++) { b = 0.5 * (soil_con->expt[j] - 3); bubble = soil_con->bubble[j]; - tmp_resid_moist = soil_con->resid_moist[j] * - soil_con->depth[j] * MM_PER_M; // mm // depth of free water surface below top of layer (not yet elevation) zwt_prime = 0; for (i = 0; i < MAX_ZWTVMOIST; i++) { @@ -108,26 +86,24 @@ soil_moisture_from_water_table(soil_con_struct *soil_con, } soil_con->zwtvmoist_moist[j][i] = w_avg * (soil_con->max_moist[j] - - tmp_resid_moist) + - tmp_resid_moist; + soil_con->resid_moist[j]) + + soil_con->resid_moist[j]; zwt_prime += soil_con->depth[j] * CM_PER_M / (MAX_ZWTVMOIST - 1); // cm } tmp_depth += soil_con->depth[j]; } /* Top N-1 layers lumped together (with average soil properties) */ - tmp_depth = 0; b = 0; bubble = 0; tmp_max_moist = 0; tmp_resid_moist = 0; + tmp_depth = 0; for (j = 0; j < nlayers - 1; j++) { b += 0.5 * (soil_con->expt[j] - 3) * soil_con->depth[j]; bubble += soil_con->bubble[j] * soil_con->depth[j]; - tmp_max_moist += soil_con->max_moist[j]; // total max_moist - // total resid_moist in mm - tmp_resid_moist += soil_con->resid_moist[j] * soil_con->depth[j] * - MM_PER_M; + tmp_max_moist += soil_con->max_moist[j]; + tmp_resid_moist += soil_con->resid_moist[j]; tmp_depth += soil_con->depth[j]; } b /= tmp_depth; // average b @@ -185,14 +161,13 @@ soil_moisture_from_water_table(soil_con_struct *soil_con, zwt_prime) / (soil_con->depth[j] * CM_PER_M); b = 0.5 * (soil_con->expt[j] - 3); bubble = soil_con->bubble[j]; - tmp_resid_moist = soil_con->resid_moist[j] * soil_con->depth[j] * - MM_PER_M; w_avg += -(b / (b - 1)) * bubble * (1 - pow((zwt_prime + bubble - tmp_depth2 * CM_PER_M) / bubble, (b - 1) / b)) / (soil_con->depth[j] * CM_PER_M); - tmp_moist += w_avg * (soil_con->max_moist[j] - tmp_resid_moist) + - tmp_resid_moist; + tmp_moist += w_avg * (soil_con->max_moist[j] - + soil_con->resid_moist[j]) + + soil_con->resid_moist[j]; b_save = b; bub_save = bubble; tmp_depth2_save = tmp_depth2; @@ -201,8 +176,6 @@ soil_moisture_from_water_table(soil_con_struct *soil_con, tmp_depth2 -= soil_con->depth[j]; b = 0.5 * (soil_con->expt[j] - 3); bubble = soil_con->bubble[j]; - tmp_resid_moist = - soil_con->resid_moist[j] * soil_con->depth[j] * MM_PER_M; zwt_prime_eff = tmp_depth2_save * CM_PER_M - bubble + bubble * pow((zwt_prime + bub_save - tmp_depth2_save * CM_PER_M) / bub_save, @@ -214,7 +187,8 @@ soil_moisture_from_water_table(soil_con_struct *soil_con, (b - 1) / b)) / (soil_con->depth[j] * CM_PER_M); tmp_moist += w_avg * (soil_con->max_moist[j] - - tmp_resid_moist) + tmp_resid_moist; + soil_con->resid_moist[j]) + + soil_con->resid_moist[j]; b_save = b; bub_save = bubble; tmp_depth2_save = tmp_depth2; diff --git a/vic/drivers/shared_all/src/timing.c b/vic/drivers/shared_all/src/timing.c index 2fb2c2c38..053710c75 100644 --- a/vic/drivers/shared_all/src/timing.c +++ b/vic/drivers/shared_all/src/timing.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Routines to calculate and store model runtime timing. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/update_step_vars.c b/vic/drivers/shared_all/src/update_step_vars.c index 474d0df3d..02eeda92d 100644 --- a/vic/drivers/shared_all/src/update_step_vars.c +++ b/vic/drivers/shared_all/src/update_step_vars.c @@ -3,26 +3,6 @@ * * This subroutine updates data structures with values for the current * time step. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/vic_history.c b/vic/drivers/shared_all/src/vic_history.c index c05ca8332..db56cd5f9 100644 --- a/vic/drivers/shared_all/src/vic_history.c +++ b/vic/drivers/shared_all/src/vic_history.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine contains routines for computing and saving VIC history files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/vic_log.c b/vic/drivers/shared_all/src/vic_log.c index a11cdd2c7..be2140942 100644 --- a/vic/drivers/shared_all/src/vic_log.c +++ b/vic/drivers/shared_all/src/vic_log.c @@ -6,26 +6,6 @@ * * Note: this should only be applied to veg types that have a canopy, e.g. * trees and shrubs, but not grass or tundra vegetation. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -50,10 +30,10 @@ finalize_logging(void) void get_current_datetime(char *cdt) { - char ymd[MAXSTRING]; - struct tm *timeinfo; - unsigned int seconds_since_midnight; - time_t curr_date_time; + char ymd[MAXSTRING]; + struct tm *timeinfo; + unsigned long long seconds_since_midnight; + time_t curr_date_time; curr_date_time = time(NULL); if (curr_date_time == -1) { @@ -62,13 +42,13 @@ get_current_datetime(char *cdt) timeinfo = localtime(&curr_date_time); - seconds_since_midnight = (unsigned int) curr_date_time % CONST_CDAY; + seconds_since_midnight = (unsigned long long) curr_date_time % CONST_CDAY; if (strftime(ymd, MAXSTRING - 1, "%Y%m%d", timeinfo) == 0) { log_err("Something went wrong converting the current time info to ymd"); } - sprintf(cdt, "%s-%05d", ymd, seconds_since_midnight); + snprintf(cdt, MAXSTRING, "%s-%05d", ymd, seconds_since_midnight); } /****************************************************************************** diff --git a/vic/drivers/shared_all/src/vic_time.c b/vic/drivers/shared_all/src/vic_time.c index 144fe742f..aee28b83e 100644 --- a/vic/drivers/shared_all/src/vic_time.c +++ b/vic/drivers/shared_all/src/vic_time.c @@ -5,26 +5,6 @@ * * Ported from Unidata and Jeff Whitaker's netcdftime.py module: * https://github.com/Unidata/netcdf4-python/blob/master/netcdftime/netcdftime.py - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_all/src/zero_output_list.c b/vic/drivers/shared_all/src/zero_output_list.c index e6a325e71..09b353738 100644 --- a/vic/drivers/shared_all/src/zero_output_list.c +++ b/vic/drivers/shared_all/src/zero_output_list.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine resets the values of all output variables to 0. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/include/vic_driver_shared_image.h b/vic/drivers/shared_image/include/vic_driver_shared_image.h index 97f486213..51b7bab9d 100644 --- a/vic/drivers/shared_image/include/vic_driver_shared_image.h +++ b/vic/drivers/shared_image/include/vic_driver_shared_image.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for vic_driver_shared_image routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_DRIVER_SHARED_IMAGE_H diff --git a/vic/drivers/shared_image/include/vic_image_log.h b/vic/drivers/shared_image/include/vic_image_log.h index 151f2c191..2b650fbe8 100644 --- a/vic/drivers/shared_image/include/vic_image_log.h +++ b/vic/drivers/shared_image/include/vic_image_log.h @@ -66,7 +66,7 @@ #define check_nc_status(A, M, ...) if (A != NC_NOERR) {log_ncerr(A, M, \ ## __VA_ARGS__); \ errno = 0; exit( \ - EXIT_FAILURE); } + EXIT_FAILURE);} #define log_mpi_err(e, M, ...) print_trace(); \ print_mpi_error_str(e); fprintf(LOG_DEST, \ diff --git a/vic/drivers/shared_image/include/vic_mpi.h b/vic/drivers/shared_image/include/vic_mpi.h index 39173995f..d3b024403 100644 --- a/vic/drivers/shared_image/include/vic_mpi.h +++ b/vic/drivers/shared_image/include/vic_mpi.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for vic_mpi routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_MPI_H diff --git a/vic/drivers/shared_image/src/alloc_atmos.c b/vic/drivers/shared_image/src/alloc_atmos.c index 7438704e4..c06a309f4 100644 --- a/vic/drivers/shared_image/src/alloc_atmos.c +++ b/vic/drivers/shared_image/src/alloc_atmos.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Allocate and free memory for the force data struct - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/alloc_veg_hist.c b/vic/drivers/shared_image/src/alloc_veg_hist.c index d920e05c4..1a52f6657 100644 --- a/vic/drivers/shared_image/src/alloc_veg_hist.c +++ b/vic/drivers/shared_image/src/alloc_veg_hist.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Allocate and free memory for the veg_hist data struct - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/check_domain_info.c b/vic/drivers/shared_image/src/check_domain_info.c index b32c0d00d..e34ed36c2 100644 --- a/vic/drivers/shared_image/src/check_domain_info.c +++ b/vic/drivers/shared_image/src/check_domain_info.c @@ -3,26 +3,6 @@ * * Routines to compare the global domain to the other VIC input files, such as * parameter or state files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/get_global_domain.c b/vic/drivers/shared_image/src/get_global_domain.c index 8d288ef7c..b3ec80b71 100644 --- a/vic/drivers/shared_image/src/get_global_domain.c +++ b/vic/drivers/shared_image/src/get_global_domain.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Get global domain data from file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -36,7 +16,7 @@ get_global_domain(nameid_struct *domain_nc_nameid, { int *run = NULL; int *mask = NULL; - int typeid; + int typeid; double *var = NULL; size_t i; size_t j; diff --git a/vic/drivers/shared_image/src/get_nc_dimension.c b/vic/drivers/shared_image/src/get_nc_dimension.c index 2561a1e4e..51c12d959 100644 --- a/vic/drivers/shared_image/src/get_nc_dimension.c +++ b/vic/drivers/shared_image/src/get_nc_dimension.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Get netCDF dimension. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/get_nc_field.c b/vic/drivers/shared_image/src/get_nc_field.c index cf3404122..a04e9ba3d 100644 --- a/vic/drivers/shared_image/src/get_nc_field.c +++ b/vic/drivers/shared_image/src/get_nc_field.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Functions to support reading from netCDF field. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/get_nc_var_attr.c b/vic/drivers/shared_image/src/get_nc_var_attr.c index 4e1c07839..cc97f9868 100644 --- a/vic/drivers/shared_image/src/get_nc_var_attr.c +++ b/vic/drivers/shared_image/src/get_nc_var_attr.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Get netCDF variable attribute. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/get_nc_var_type.c b/vic/drivers/shared_image/src/get_nc_var_type.c index d75586a2f..9412ea441 100644 --- a/vic/drivers/shared_image/src/get_nc_var_type.c +++ b/vic/drivers/shared_image/src/get_nc_var_type.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Get netCDF variable type. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/get_nc_varndimensions.c b/vic/drivers/shared_image/src/get_nc_varndimensions.c index 1f70b1adc..9c1d71a4b 100644 --- a/vic/drivers/shared_image/src/get_nc_varndimensions.c +++ b/vic/drivers/shared_image/src/get_nc_varndimensions.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Get netCDF dimension. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/init_library.c b/vic/drivers/shared_image/src/init_library.c index 725f4fe7a..5ea379061 100644 --- a/vic/drivers/shared_image/src/init_library.c +++ b/vic/drivers/shared_image/src/init_library.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Initilization library. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -96,7 +76,7 @@ initialize_soil_con(soil_con_struct *soil_con) soil_con->Zsum_node[i] = 0.; soil_con->expt_node[i] = 0.; soil_con->gamma[i] = 0.; - soil_con->max_moist_node[i] = 0.; + soil_con->porosity_node[i] = 0.; } for (i = 0; i < MAX_FROST_AREAS; i++) { diff --git a/vic/drivers/shared_image/src/initialize_files.c b/vic/drivers/shared_image/src/initialize_files.c index 5e1677223..5a822ad63 100644 --- a/vic/drivers/shared_image/src/initialize_files.c +++ b/vic/drivers/shared_image/src/initialize_files.c @@ -3,26 +3,6 @@ * * This subroutine initalizes all filefilenames before they are called by * the model. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/parse_output_info.c b/vic/drivers/shared_image/src/parse_output_info.c index 8977eb605..f9772a5aa 100644 --- a/vic/drivers/shared_image/src/parse_output_info.c +++ b/vic/drivers/shared_image/src/parse_output_info.c @@ -3,26 +3,6 @@ * * This routine reads the VIC model global control file, getting information * for output variables list (if any). - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/print_library_shared_image.c b/vic/drivers/shared_image/src/print_library_shared_image.c index 1872928ae..7302bb90a 100644 --- a/vic/drivers/shared_image/src/print_library_shared_image.c +++ b/vic/drivers/shared_image/src/print_library_shared_image.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Print library. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/put_nc_attr.c b/vic/drivers/shared_image/src/put_nc_attr.c index 90c05e842..7db04f74f 100644 --- a/vic/drivers/shared_image/src/put_nc_attr.c +++ b/vic/drivers/shared_image/src/put_nc_attr.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Put attribute to netCDF file - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/set_force_type.c b/vic/drivers/shared_image/src/set_force_type.c index c4a523386..a4928d9c8 100644 --- a/vic/drivers/shared_image/src/set_force_type.c +++ b/vic/drivers/shared_image/src/set_force_type.c @@ -3,26 +3,6 @@ * * This routine determines the current forcing file data type and stores its * location in the description of the current forcing file. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/state_metadata.c b/vic/drivers/shared_image/src/state_metadata.c index 4071f2470..b9da7744a 100644 --- a/vic/drivers/shared_image/src/state_metadata.c +++ b/vic/drivers/shared_image/src/state_metadata.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine sets the metadata structure for VIC state variables - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/vic_alloc.c b/vic/drivers/shared_image/src/vic_alloc.c index 005089375..97464e583 100644 --- a/vic/drivers/shared_image/src/vic_alloc.c +++ b/vic/drivers/shared_image/src/vic_alloc.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Allocate memory for VIC structures. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/vic_finalize.c b/vic/drivers/shared_image/src/vic_finalize.c index 26043e199..e104d18fc 100644 --- a/vic/drivers/shared_image/src/vic_finalize.c +++ b/vic/drivers/shared_image/src/vic_finalize.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Finalize VIC run by freeing memory and closing open files. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/vic_image_run.c b/vic/drivers/shared_image/src/vic_image_run.c index 06215c852..9f5b928b8 100644 --- a/vic/drivers/shared_image/src/vic_image_run.c +++ b/vic/drivers/shared_image/src/vic_image_run.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Run function for image mode driver. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -39,7 +19,7 @@ vic_image_run(dmy_struct *dmy_current) extern domain_struct local_domain; extern option_struct options; extern global_param_struct global_param; - extern lake_con_struct lake_con; + extern lake_con_struct *lake_con; extern double ***out_data; extern stream_struct *output_streams; extern save_data_struct *save_data; @@ -67,11 +47,11 @@ vic_image_run(dmy_struct *dmy_current) timer_start(&timer); vic_run(&(force[i]), &(all_vars[i]), dmy_current, &global_param, - &lake_con, &(soil_con[i]), veg_con[i], veg_lib[i]); + &(lake_con[i]), &(soil_con[i]), veg_con[i], veg_lib[i]); timer_stop(&timer); put_data(&(all_vars[i]), &(force[i]), &(soil_con[i]), veg_con[i], - veg_lib[i], &lake_con, out_data[i], &(save_data[i]), + veg_lib[i], &(lake_con[i]), out_data[i], &(save_data[i]), &timer); } diff --git a/vic/drivers/shared_image/src/vic_image_timing.c b/vic/drivers/shared_image/src/vic_image_timing.c index e9b8a94a2..4894dc4e1 100644 --- a/vic/drivers/shared_image/src/vic_image_timing.c +++ b/vic/drivers/shared_image/src/vic_image_timing.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Write vic timing table for image-like drivers - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/vic_init.c b/vic/drivers/shared_image/src/vic_init.c index 8301a3f2b..e3800e024 100644 --- a/vic/drivers/shared_image/src/vic_init.c +++ b/vic/drivers/shared_image/src/vic_init.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Initialize model parameters - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -202,6 +182,18 @@ vic_init(void) } } + // new_snow_albedo + if (options.MAX_SNOW_ALBEDO) { + for (j = 0; j < options.NVEGTYPES; j++) { + d3start[0] = j; + get_scatter_nc_field_double(&(filenames.params), "max_snow_albedo", + d3start, d3count, dvar); + for (i = 0; i < local_domain.ncells_active; i++) { + veg_lib[i][j].max_snow_albedo = (double) dvar[i]; + } + } + } + // LAI and Wdmax if (options.LAI_SRC == FROM_VEGLIB || options.LAI_SRC == FROM_VEGPARAM) { for (j = 0; j < options.NVEGTYPES; j++) { @@ -260,7 +252,7 @@ vic_init(void) } } - // default value for fcanopy + // fcanopy for (j = 0; j < options.NVEGTYPES; j++) { if (options.FCAN_SRC == FROM_DEFAULT) { for (k = 0; k < MONTHS_PER_YEAR; k++) { @@ -272,7 +264,6 @@ vic_init(void) else { veg_lib[i][j].fcanopy[k] = MIN_FCANOPY; } - veg_lib[i][j].fcanopy[k] = 1.0; } } } @@ -589,29 +580,55 @@ vic_init(void) } } - // bulk_dens_org: organic bulk density for each soil layer + if (!options.BULK_DENSITY_COMB) { + // read in bulk_dens_org: + // organic bulk density for each soil layer + for (j = 0; j < options.Nlayer; j++) { + d3start[0] = j; + get_scatter_nc_field_double(&(filenames.params), + "bulk_density_org", + d3start, d3count, dvar); + for (i = 0; i < local_domain.ncells_active; i++) { + soil_con[i].bulk_dens_org[j] = (double) dvar[i]; + } + } + } + // soil_dens_org: organic soil density for each soil layer for (j = 0; j < options.Nlayer; j++) { d3start[0] = j; - get_scatter_nc_field_double(&(filenames.params), "bulk_density_org", + get_scatter_nc_field_double(&(filenames.params), "soil_density_org", d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { - soil_con[i].bulk_dens_org[j] = (double) dvar[i]; + soil_con[i].soil_dens_org[j] = (double) dvar[i]; } } - - // soil_dens_org: organic soil density for each soil layer + } + // bulk density of mineral and organic soil + if (options.BULK_DENSITY_COMB) { for (j = 0; j < options.Nlayer; j++) { d3start[0] = j; - get_scatter_nc_field_double(&(filenames.params), "soil_density_org", + get_scatter_nc_field_double(&(filenames.params), + "bulk_density_comb", d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { - soil_con[i].soil_dens_org[j] = (double) dvar[i]; + soil_con[i].bulk_density[j] = (double) dvar[i]; } } } + else { + for (i = 0; i < local_domain.ncells_active; i++) { + for (j = 0; j < options.Nlayer; j++) { + soil_con[i].bulk_density[j] = + (1 - soil_con[i].organic[j]) * + soil_con[i].bulk_dens_min[j] + + soil_con[i].organic[j] * soil_con[i].bulk_dens_org[j]; + } + } + } + // Wcr: critical point for each layer - // Note this value is multiplied with the maximum moisture in each layer + // Note this value is multiplied with the maximum moisture in each layer for (j = 0; j < options.Nlayer; j++) { d3start[0] = j; get_scatter_nc_field_double(&(filenames.params), "Wcr_FRACT", @@ -622,7 +639,7 @@ vic_init(void) } // Wpwp: wilting point for each layer - // Note this value is multiplied with the maximum moisture in each layer + // Note this value is multiplied with the maximum moisture in each layer for (j = 0; j < options.Nlayer; j++) { d3start[0] = j; get_scatter_nc_field_double(&(filenames.params), "Wpwp_FRACT", @@ -654,6 +671,7 @@ vic_init(void) } // resid_moist: residual moisture content for each layer + // Note this value is multiplied with the maximum moisture in each layer for (j = 0; j < options.Nlayer; j++) { d3start[0] = j; get_scatter_nc_field_double(&(filenames.params), "resid_moist", @@ -714,9 +732,6 @@ vic_init(void) for (i = 0; i < local_domain.ncells_active; i++) { for (j = 0; j < options.Nlayer; j++) { // compute layer properties - soil_con[i].bulk_density[j] = - (1 - soil_con[i].organic[j]) * soil_con[i].bulk_dens_min[j] + - soil_con[i].organic[j] * soil_con[i].bulk_dens_org[j]; soil_con[i].soil_density[j] = (1 - soil_con[i].organic[j]) * soil_con[i].soil_dens_min[j] + soil_con[i].organic[j] * soil_con[i].soil_dens_org[j]; @@ -757,6 +772,7 @@ vic_init(void) for (j = 0; j < options.Nlayer; j++) { soil_con[i].Wcr[j] *= soil_con[i].max_moist[j]; soil_con[i].Wpwp[j] *= soil_con[i].max_moist[j]; + soil_con[i].resid_moist[j] *= soil_con[i].depth[j] * MM_PER_M; if (soil_con[i].Wpwp[j] > soil_con[i].Wcr[j]) { sprint_location(locstr, &(local_domain.locations[i])); log_err("Calculated wilting point moisture (%f mm) is " @@ -766,16 +782,15 @@ vic_init(void) "Wpwp_FRACT MUST be <= Wcr_FRACT.\n%s", soil_con[i].Wpwp[j], soil_con[i].Wcr[j], j, locstr); } - if (soil_con[i].Wpwp[j] < soil_con[i].resid_moist[j] * - soil_con[i].depth[j] * MM_PER_M) { + if (soil_con[i].Wpwp[j] < soil_con[i].resid_moist[j]) { sprint_location(locstr, &(local_domain.locations[i])); log_err("Calculated wilting point moisture (%f mm) is " "less than calculated residual moisture (%f mm) for " "layer %zd.\n\tIn the soil parameter file, " "Wpwp_FRACT MUST be >= resid_moist / " "(1.0 - bulk_density/soil_density).\n%s", - soil_con[i].Wpwp[j], soil_con[i].resid_moist[j] * - soil_con[i].depth[j] * MM_PER_M, j, locstr); + soil_con[i].Wpwp[j], soil_con[i].resid_moist[j], + j, locstr); } } @@ -1343,27 +1358,22 @@ vic_init(void) max_numnod = 0; for (i = 0; i < local_domain.ncells_active; i++) { lake_con[i].numnod = (size_t) ivar[i]; - if (lake_con[i].lake_idx == -1) { - if (lake_con[i].numnod != 0) { - log_err("cell %zu lake_idx is %d (lake not present) " - "which requires numnod to be 0, but numnod is " - "%zu.", i, lake_con[i].lake_idx, - lake_con[i].numnod); + if (lake_con[i].lake_idx >= 0 && + lake_con[i].lake_idx < (int) veg_con[i][0].vegetat_type_num) { + if (!(lake_con[i].numnod > 0 && + lake_con[i].numnod < MAX_LAKE_BASIN_NODES)) { + log_err("cell %zu numnod is %zu but we must have 1 " + "<= numnod < %d.", i, lake_con[i].numnod, + MAX_LAKE_BASIN_NODES); + } + else if (!(lake_con[i].numnod <= options.Nlakebasnode)) { + log_err("cell %zu numnod is %zu but this exceeds " + "the file lake_node dimension length of %zu.", + i, lake_con[i].numnod, options.Nlakebasnode); + } + if (lake_con[i].numnod > max_numnod) { + max_numnod = lake_con[i].numnod; } - } - else if (!(lake_con[i].numnod > 0 && - lake_con[i].numnod < MAX_LAKE_NODES)) { - log_err("cell %zu numnod is %zu but we must have 1 " - "<= numnod < %d.", i, lake_con[i].numnod, - MAX_LAKE_NODES); - } - else if (!(lake_con[i].numnod <= options.NLAKENODES)) { - log_err("cell %zu numnod is %zu but this exceeds " - "the file lake_node dimension length of %zu.", - i, lake_con[i].numnod, options.NLAKENODES); - } - if (lake_con[i].numnod > max_numnod) { - max_numnod = lake_con[i].numnod; } } @@ -1372,19 +1382,13 @@ vic_init(void) d2start, d2count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { lake_con[i].mindepth = (double) dvar[i]; - if (lake_con[i].lake_idx == -1) { - if (lake_con[i].mindepth != 0) { - log_err("cell %zu lake_idx is %d (lake not present) " - "which requires mindepth to be 0, but mindepth " - "is %f.", i, lake_con[i].lake_idx, - lake_con[i].mindepth); + if (lake_con[i].lake_idx >= 0 && + lake_con[i].lake_idx < (int) veg_con[i][0].vegetat_type_num) { + if (!(lake_con[i].mindepth >= 0)) { + log_err("cell %zu mindepth is %f but must be >= 0.", + i, lake_con[i].mindepth); } } - else if (lake_con[i].lake_idx != -1 && - !(lake_con[i].mindepth >= 0)) { - log_err("cell %zu mindepth is %f but must be >= 0.", - i, lake_con[i].mindepth); - } } // wfrac @@ -1392,18 +1396,13 @@ vic_init(void) d2start, d2count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { lake_con[i].wfrac = (double) dvar[i]; - if (lake_con[i].lake_idx == -1) { - if (lake_con[i].wfrac != 0) { - log_err("cell %zu lake_idx is %d (lake not present) " - "which requires wfrac to be 0, but wfrac is " - "%f.", i, lake_con[i].lake_idx, lake_con[i].wfrac); + if (lake_con[i].lake_idx >= 0 && + lake_con[i].lake_idx < (int) veg_con[i][0].vegetat_type_num) { + if (!(lake_con[i].wfrac >= 0 && lake_con[i].wfrac <= 1)) { + log_err("cell %zu wfrac is %f but we must have " + "0 <= wfrac <= 1.", i, lake_con[i].wfrac); } } - else if (lake_con[i].lake_idx != -1 && - !(lake_con[i].wfrac >= 0 && lake_con[i].wfrac <= 1)) { - log_err("cell %zu wfrac is %f but we must have " - "0 <= wfrac <= 1.", i, lake_con[i].wfrac); - } } // depth_in (initial depth for a cold start) @@ -1411,19 +1410,13 @@ vic_init(void) d2start, d2count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { lake_con[i].depth_in = (double) dvar[i]; - if (lake_con[i].lake_idx == -1) { - if (lake_con[i].depth_in != 0) { - log_err("cell %zu lake_idx is %d (lake not present) " - "which requires depth_in to be 0, but depth_in is " - "%f.", i, lake_con[i].lake_idx, - lake_con[i].depth_in); + if (lake_con[i].lake_idx >= 0 && + lake_con[i].lake_idx < (int) veg_con[i][0].vegetat_type_num) { + if (!(lake_con[i].depth_in >= 0)) { + log_err("cell %zu depth_in is %f but must be >= 0.", + i, lake_con[i].depth_in); } } - else if (lake_con[i].lake_idx != -1 && - !(lake_con[i].depth_in >= 0)) { - log_err("cell %zu depth_in is %f but must be >= 0.", - i, lake_con[i].depth_in); - } } // rpercent @@ -1431,25 +1424,19 @@ vic_init(void) d2start, d2count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { lake_con[i].rpercent = (double) dvar[i]; - if (lake_con[i].lake_idx == -1) { - if (lake_con[i].rpercent != 0) { - log_err("cell %zu lake_idx is %d (lake not present) " - "which requires rpercent to be 0, but rpercent is " - "%f.", i, lake_con[i].lake_idx, - lake_con[i].rpercent); + if (lake_con[i].lake_idx >= 0 && + lake_con[i].lake_idx < (int) veg_con[i][0].vegetat_type_num) { + if (!(lake_con[i].rpercent >= 0 && + lake_con[i].rpercent <= 1)) { + log_err("cell %zu rpercent is %f but we must have " + "0 <= rpercent <= 1.", i, lake_con[i].rpercent); } } - else if (lake_con[i].lake_idx != -1 && - !(lake_con[i].rpercent >= 0 && - lake_con[i].rpercent <= 1)) { - log_err("cell %zu rpercent is %f but we must have " - "0 <= rpercent <= 1.", i, lake_con[i].rpercent); - } } // lake depth-area relationship for (i = 0; i < local_domain.ncells_active; i++) { - for (j = 0; j <= MAX_LAKE_NODES; j++) { + for (j = 0; j <= MAX_LAKE_BASIN_NODES; j++) { lake_con[i].z[j] = 0; lake_con[i].Cl[j] = 0; } @@ -1491,22 +1478,9 @@ vic_init(void) // validate depth-area relationship for (i = 0; i < local_domain.ncells_active; i++) { - // validate top node - if (lake_con[i].lake_idx == -1) { - if (lake_con[i].z[0] > 0) { - log_err("cell %zu lake_idx is %d (lake not present) " - "which requires max depth to be 0, but max depth " - "is %f.", i, lake_con[i].lake_idx, - lake_con[i].z[0]); - } - if (lake_con[i].Cl[0] > 0) { - log_err("cell %zu lake_idx is %d (lake not present) " - "which requires max area fraction to be 0, but " - "max area fraction is %f.", i, - lake_con[i].lake_idx, lake_con[i].Cl[0]); - } - } - else { + if (lake_con[i].lake_idx >= 0 && + lake_con[i].lake_idx < (int) veg_con[i][0].vegetat_type_num) { + // validate top node if (!(lake_con[i].z[0] > 0)) { log_err("cell %zu lake basin max depth is %f but must " "be > 0.", i, lake_con[i].z[0]); @@ -1531,33 +1505,32 @@ vic_init(void) else { lake_con[i].Cl[0] = veg_con[i][lake_con[i].lake_idx].Cv; } - } - // valdate other nodes - if (options.LAKE_PROFILE) { - for (j = 1; j < lake_con[i].numnod; j++) { - if (!(lake_con[i].z[j] > 0 && - lake_con[i].z[j] < lake_con[i].z[j - 1])) { - log_err("cell %zu lake basin node %zu depth is %f " - "but must be > 0 and < node %zu depth %f.", - i, j, lake_con[i].z[j], j - 1, - lake_con[i].z[j - 1]); - } - if (!(lake_con[i].Cl[j] > 0 && - lake_con[i].Cl[j] < lake_con[i].Cl[j - 1])) { - log_err("cell %zu lake basin node %zu area fraction " - "is %f but must be > 0 and < node %zu area " - "fraction %f.", i, j, lake_con[i].Cl[j], j - 1, - lake_con[i].Cl[j - 1]); + // valdate other nodes + if (options.LAKE_PROFILE) { + for (j = 1; j < lake_con[i].numnod; j++) { + if (!(lake_con[i].z[j] > 0 && + lake_con[i].z[j] < lake_con[i].z[j - 1])) { + log_err("cell %zu lake basin node %zu depth is %f " + "but must be > 0 and < node %zu depth %f.", + i, j, lake_con[i].z[j], j - 1, + lake_con[i].z[j - 1]); + } + if (!(lake_con[i].Cl[j] > 0 && + lake_con[i].Cl[j] < lake_con[i].Cl[j - 1])) { + log_err("cell %zu lake basin node %zu area fraction " + "is %f but must be > 0 and < node %zu area " + "fraction %f.", i, j, lake_con[i].Cl[j], + j - 1, + lake_con[i].Cl[j - 1]); + } } } - } - } - // compute other lake parameters here - for (i = 0; i < local_domain.ncells_active; i++) { - soil_con[i].cell_area = local_domain.locations[i].area; - compute_lake_params(&(lake_con[i]), soil_con[i]); + // compute other lake parameters here + soil_con[i].cell_area = local_domain.locations[i].area; + compute_lake_params(&(lake_con[i]), soil_con[i]); + } } } diff --git a/vic/drivers/shared_image/src/vic_init_output.c b/vic/drivers/shared_image/src/vic_init_output.c index ecd3fd751..429417dae 100644 --- a/vic/drivers/shared_image/src/vic_init_output.c +++ b/vic/drivers/shared_image/src/vic_init_output.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Initialize output structures. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -324,6 +304,13 @@ initialize_history_file(nc_file_struct *nc, check_nc_status(status, "Error defining time bounds dimension in %s", stream->filename); + if (options.LAKES) { + status = nc_def_dim(nc->nc_id, "lake_node", nc->lake_node_size, + &(nc->lake_node_dimid)); + check_nc_status(status, "Error defining lake_node dimension in %s", + stream->filename); + } + // define the netcdf variable time status = nc_def_var(nc->nc_id, "time", NC_DOUBLE, 1, &(nc->time_dimid), &(nc->time_varid)); @@ -694,6 +681,7 @@ initialize_nc_file(nc_file_struct *nc_file, nc_file->band_size = options.SNOW_BAND; nc_file->front_size = MAX_FRONTS; nc_file->frost_size = options.Nfrost; + nc_file->lake_node_size = MAX_LAKE_NODES; nc_file->layer_size = options.Nlayer; nc_file->ni_size = global_domain.n_nx; nc_file->nj_size = global_domain.n_ny; diff --git a/vic/drivers/shared_image/src/vic_mpi_support.c b/vic/drivers/shared_image/src/vic_mpi_support.c index 761a77d16..51c981e19 100644 --- a/vic/drivers/shared_image/src/vic_mpi_support.c +++ b/vic/drivers/shared_image/src/vic_mpi_support.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * MPI support routines for VIC - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -488,7 +468,7 @@ create_MPI_option_struct_type(MPI_Datatype *mpi_type) MPI_Datatype *mpi_types; // nitems has to equal the number of elements in option_struct - nitems = 53; + nitems = 56; blocklengths = malloc(nitems * sizeof(*blocklengths)); check_alloc_status(blocklengths, "Memory allocation error."); @@ -706,6 +686,14 @@ create_MPI_option_struct_type(MPI_Datatype *mpi_type) offsets[i] = offsetof(option_struct, ORGANIC_FRACT); mpi_types[i++] = MPI_C_BOOL; + // bool BULK_DENSITY_COMB; + offsets[i] = offsetof(option_struct, BULK_DENSITY_COMB); + mpi_types[i++] = MPI_C_BOOL; + + // bool MAX_SNOW_ALBEDO; + offsets[i] = offsetof(option_struct, MAX_SNOW_ALBEDO); + mpi_types[i++] = MPI_C_BOOL; + // unsigned short STATE_FORMAT; offsets[i] = offsetof(option_struct, STATE_FORMAT); mpi_types[i++] = MPI_UNSIGNED_SHORT; @@ -718,6 +706,10 @@ create_MPI_option_struct_type(MPI_Datatype *mpi_type) offsets[i] = offsetof(option_struct, SAVE_STATE); mpi_types[i++] = MPI_C_BOOL; + // bool STATENAME_CESM + offsets[i] = offsetof(option_struct, STATENAME_CESM); + mpi_types[i++] = MPI_C_BOOL; + // make sure that the we have the right number of elements if (i != (size_t) nitems) { log_err("Miscount: %zd not equal to %d.", i, nitems); diff --git a/vic/drivers/shared_image/src/vic_nc_info.c b/vic/drivers/shared_image/src/vic_nc_info.c index 6867f5b84..8fd2ddc9b 100644 --- a/vic/drivers/shared_image/src/vic_nc_info.c +++ b/vic/drivers/shared_image/src/vic_nc_info.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Setup netCDF output variables. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/drivers/shared_image/src/vic_restore.c b/vic/drivers/shared_image/src/vic_restore.c index e08b6ee75..f270666f5 100644 --- a/vic/drivers/shared_image/src/vic_restore.c +++ b/vic/drivers/shared_image/src/vic_restore.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Read initial model state. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -728,7 +708,7 @@ vic_restore(void) } // lake layer surface areas: lake_var.surface[ndix] - for (j = 0; j < options.NLAKENODES; j++) { + for (j = 0; j < options.Nlakenode; j++) { d3start[0] = j; get_scatter_nc_field_double(&(filenames.init_state), state_metadata[ @@ -756,7 +736,7 @@ vic_restore(void) } // lake layer temperatures: lake_var.temp[nidx] - for (j = 0; j < options.NLAKENODES; j++) { + for (j = 0; j < options.Nlakenode; j++) { d3start[0] = j; get_scatter_nc_field_double(&(filenames.init_state), state_metadata[STATE_LAKE_LAYER_TEMP].varname, @@ -968,9 +948,10 @@ check_init_state_file(void) } if (options.LAKES) { dimlen = get_nc_dimension(&(filenames.init_state), "lake_node"); - if (dimlen != options.NLAKENODES) { + if (dimlen != options.Nlakenode) { log_err("Number of lake nodes in state file does not " - "match parameter file"); + "match LAKE_NODES (%zu) in global parameter file", + options.Nlakenode); } } } diff --git a/vic/drivers/shared_image/src/vic_start.c b/vic/drivers/shared_image/src/vic_start.c index 32cbc2c57..687b69d28 100644 --- a/vic/drivers/shared_image/src/vic_start.c +++ b/vic/drivers/shared_image/src/vic_start.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine handles the startup tasks. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -122,8 +102,13 @@ vic_start(void) "snow_band"); } if (options.LAKES) { - options.NLAKENODES = get_nc_dimension(&(filenames.params), - "lake_node"); + options.Nlakebasnode = get_nc_dimension(&(filenames.params), + "lake_node"); + if (options.Nlakebasnode < 1 || + options.Nlakebasnode > MAX_LAKE_BASIN_NODES) { + log_err("lake_node dimlen must be between 1 and %d.", + MAX_LAKE_BASIN_NODES); + } } // Check that model parameters are valid diff --git a/vic/drivers/shared_image/src/vic_store.c b/vic/drivers/shared_image/src/vic_store.c index 005728d81..788cd0005 100644 --- a/vic/drivers/shared_image/src/vic_store.c +++ b/vic/drivers/shared_image/src/vic_store.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Save model state. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -61,10 +41,18 @@ vic_store(dmy_struct *dmy_state, set_nc_state_file_info(&nc_state_file); // create netcdf file for storing model state - sprintf(filename, "%s.%04i%02i%02i_%05u.nc", - filenames.statefile, dmy_state->year, - dmy_state->month, dmy_state->day, - dmy_state->dayseconds); + if (options.STATENAME_CESM) { + sprintf(filename, "%s.vic.r.%04i-%02i-%02i-%05u.nc", + filenames.statefile, dmy_state->year, + dmy_state->month, dmy_state->day, + dmy_state->dayseconds); + } + else { + sprintf(filename, "%s.%04i%02i%02i_%05u.nc", + filenames.statefile, dmy_state->year, + dmy_state->month, dmy_state->day, + dmy_state->dayseconds); + } initialize_state_file(filename, &nc_state_file, dmy_state); @@ -966,12 +954,12 @@ vic_store(dmy_struct *dmy_state, for (j = 0; j < options.Nnode; j++) { d3start[0] = j; for (i = 0; i < local_domain.ncells_active; i++) { - dvar[i] = (double) all_vars[i].lake_var.soil.layer[j].moist; + dvar[i] = (double) all_vars[i].lake_var.energy.T[j]; } gather_put_nc_field_double(nc_state_file.nc_id, nc_var->nc_varid, nc_state_file.d_fillvalue, - d2start, nc_var->nc_counts, dvar); + d3start, nc_var->nc_counts, dvar); for (i = 0; i < local_domain.ncells_active; i++) { dvar[i] = nc_state_file.d_fillvalue; } @@ -1031,7 +1019,7 @@ vic_store(dmy_struct *dmy_state, // lake layer surface areas: lake_var.surface[ndix] nc_var = &(nc_state_file.nc_vars[STATE_LAKE_LAYER_SURF_AREA]); - for (j = 0; j < options.NLAKENODES; j++) { + for (j = 0; j < options.Nlakenode; j++) { d3start[0] = j; for (i = 0; i < local_domain.ncells_active; i++) { dvar[i] = (double) all_vars[i].lake_var.surface[j]; @@ -1073,7 +1061,7 @@ vic_store(dmy_struct *dmy_state, // lake layer temperatures: lake_var.temp[nidx] nc_var = &(nc_state_file.nc_vars[STATE_LAKE_LAYER_TEMP]); - for (j = 0; j < options.NLAKENODES; j++) { + for (j = 0; j < options.Nlakenode; j++) { d3start[0] = j; for (i = 0; i < local_domain.ncells_active; i++) { dvar[i] = (double) all_vars[i].lake_var.temp[j]; @@ -1081,7 +1069,7 @@ vic_store(dmy_struct *dmy_state, gather_put_nc_field_double(nc_state_file.nc_id, nc_var->nc_varid, nc_state_file.d_fillvalue, - d2start, nc_var->nc_counts, dvar); + d3start, nc_var->nc_counts, dvar); for (i = 0; i < local_domain.ncells_active; i++) { dvar[i] = nc_state_file.d_fillvalue; } @@ -1321,6 +1309,7 @@ set_nc_state_file_info(nc_file_struct *nc_state_file) nc_state_file->band_size = options.SNOW_BAND; nc_state_file->front_size = MAX_FRONTS; nc_state_file->frost_size = options.Nfrost; + nc_state_file->lake_node_size = options.Nlakenode; nc_state_file->layer_size = options.Nlayer; nc_state_file->ni_size = global_domain.n_nx; nc_state_file->nj_size = global_domain.n_ny; @@ -1886,7 +1875,7 @@ initialize_state_file(char *filename, "long_name", strlen("lake_node"), "lake_node"); check_nc_status(status, "Error adding attribute in %s", filename); - status = nc_put_att_text(nc_state_file->nc_id, dz_node_var_id, + status = nc_put_att_text(nc_state_file->nc_id, lake_node_var_id, "standard_name", strlen( "lake_node_number"), "lake_node_number"); @@ -2159,11 +2148,16 @@ initialize_state_file(char *filename, dvar[i] = nc_state_file->d_fillvalue; } } + for (i = 0; i < MAXDIMS; i++) { + dimids[i] = -1; + dcount[i] = 0; + } free(dvar); if (options.LAKES) { // lake nodes dimids[0] = nc_state_file->lake_node_dimid; + dstart[0] = 0; dcount[0] = nc_state_file->lake_node_size; ivar = malloc(nc_state_file->lake_node_size * sizeof(*ivar)); check_alloc_status(ivar, "Memory allocation error"); @@ -2171,12 +2165,13 @@ initialize_state_file(char *filename, for (j = 0; j < nc_state_file->lake_node_size; j++) { ivar[j] = (int) j; } - status = nc_put_vara_int(nc_state_file->nc_id, lake_node_var_id, dstart, - dcount, ivar); + status = nc_put_vara_int(nc_state_file->nc_id, lake_node_var_id, + dstart, dcount, ivar); check_nc_status(status, "Error writing lake nodes"); for (i = 0; i < MAXDIMS; i++) { dimids[i] = -1; + dstart[i] = 0; dcount[i] = 0; } free(ivar); diff --git a/vic/drivers/shared_image/src/vic_write.c b/vic/drivers/shared_image/src/vic_write.c index 88e697b2c..05a0b0263 100644 --- a/vic/drivers/shared_image/src/vic_write.c +++ b/vic/drivers/shared_image/src/vic_write.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Write output to netcdf file - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_rvic/include/rout.h b/vic/extensions/rout_rvic/include/rout.h index b770c1c51..454551eab 100644 --- a/vic/extensions/rout_rvic/include/rout.h +++ b/vic/extensions/rout_rvic/include/rout.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for rvic routing routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef ROUT_RVIC_H #define ROUT_RVIC_H diff --git a/vic/extensions/rout_rvic/include/rout_extension_name.h b/vic/extensions/rout_rvic/include/rout_extension_name.h index df8698e3d..b335bb083 100644 --- a/vic/extensions/rout_rvic/include/rout_extension_name.h +++ b/vic/extensions/rout_rvic/include/rout_extension_name.h @@ -2,25 +2,5 @@ * @section DESCRIPTION * * Header file for rvic routing routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #define EXTENSION_RVIC diff --git a/vic/extensions/rout_rvic/rout.mk b/vic/extensions/rout_rvic/rout.mk index 519deb49e..153033463 100644 --- a/vic/extensions/rout_rvic/rout.mk +++ b/vic/extensions/rout_rvic/rout.mk @@ -2,26 +2,6 @@ # @section DESCRIPTION # # VIC Routing Extension Makefile Include - # - # @section LICENSE - # - # The Variable Infiltration Capacity (VIC) macroscale hydrological model - # Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - # and Environmental Engineering, University of Washington. - # - # The VIC model is free software; you can redistribute it and/or - # modify it under the terms of the GNU General Public License - # as published by the Free Software Foundation; either version 2 - # of the License, or (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - # GNU General Public License for more details. - # - # You should have received a copy of the GNU General Public License along with - # this program; if not, write to the Free Software Foundation, Inc., - # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ############################################################################## # make a list of all *.h files in routing folder diff --git a/vic/extensions/rout_rvic/src/cshift.c b/vic/extensions/rout_rvic/src/cshift.c index 7ff2ba2bd..a1062cf15 100644 --- a/vic/extensions/rout_rvic/src/cshift.c +++ b/vic/extensions/rout_rvic/src/cshift.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Function to shift columns or rows one position (used in convolution) - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_rvic/src/rout_alloc.c b/vic/extensions/rout_rvic/src/rout_alloc.c index efda3bb57..8f3f5fb59 100644 --- a/vic/extensions/rout_rvic/src/rout_alloc.c +++ b/vic/extensions/rout_rvic/src/rout_alloc.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Allocate memory for Routing structures. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_rvic/src/rout_convolution.c b/vic/extensions/rout_rvic/src/rout_convolution.c index fdee6a3af..6d9955499 100644 --- a/vic/extensions/rout_rvic/src/rout_convolution.c +++ b/vic/extensions/rout_rvic/src/rout_convolution.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Convolution part of the routing - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_rvic/src/rout_finalize.c b/vic/extensions/rout_rvic/src/rout_finalize.c index 9083eb430..2ea81a871 100644 --- a/vic/extensions/rout_rvic/src/rout_finalize.c +++ b/vic/extensions/rout_rvic/src/rout_finalize.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * clean up functions for routing extension - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_rvic/src/rout_init.c b/vic/extensions/rout_rvic/src/rout_init.c index 4f33b6c22..2ae478d46 100644 --- a/vic/extensions/rout_rvic/src/rout_init.c +++ b/vic/extensions/rout_rvic/src/rout_init.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Initialize routing model parameters - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_rvic/src/rout_run.c b/vic/extensions/rout_rvic/src/rout_run.c index 1239fb728..be8900819 100644 --- a/vic/extensions/rout_rvic/src/rout_run.c +++ b/vic/extensions/rout_rvic/src/rout_run.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Run routing over the domain. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_rvic/src/state_metadata_extension.c b/vic/extensions/rout_rvic/src/state_metadata_extension.c index 0e4ac875c..eac1b23ff 100644 --- a/vic/extensions/rout_rvic/src/state_metadata_extension.c +++ b/vic/extensions/rout_rvic/src/state_metadata_extension.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Save model state. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_rvic/src/vic_restore_extension.c b/vic/extensions/rout_rvic/src/vic_restore_extension.c index 10cc9dca8..00dbbb354 100644 --- a/vic/extensions/rout_rvic/src/vic_restore_extension.c +++ b/vic/extensions/rout_rvic/src/vic_restore_extension.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Save model state. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_rvic/src/vic_store_extension.c b/vic/extensions/rout_rvic/src/vic_store_extension.c index 6fed8c230..2b0035f55 100644 --- a/vic/extensions/rout_rvic/src/vic_store_extension.c +++ b/vic/extensions/rout_rvic/src/vic_store_extension.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Save model state. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_stub/include/rout.h b/vic/extensions/rout_stub/include/rout.h index 436fa4e04..d7e7822b8 100644 --- a/vic/extensions/rout_stub/include/rout.h +++ b/vic/extensions/rout_stub/include/rout.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for rout_stub routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef ROUT_STUB_H diff --git a/vic/extensions/rout_stub/include/rout_extension_name.h b/vic/extensions/rout_stub/include/rout_extension_name.h index 10201513c..f6ec3d51c 100644 --- a/vic/extensions/rout_stub/include/rout_extension_name.h +++ b/vic/extensions/rout_stub/include/rout_extension_name.h @@ -2,25 +2,5 @@ * @section DESCRIPTION * * Header file for stub - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #define EXTENSION_STUB diff --git a/vic/extensions/rout_stub/src/rout.c b/vic/extensions/rout_stub/src/rout.c index ca7585b6f..eea3b39e6 100644 --- a/vic/extensions/rout_stub/src/rout.c +++ b/vic/extensions/rout_stub/src/rout.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * dummy functions for the rout_stub extension - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_stub/src/state_metadata_extension.c b/vic/extensions/rout_stub/src/state_metadata_extension.c index f848ebb6f..92f7db6ad 100644 --- a/vic/extensions/rout_stub/src/state_metadata_extension.c +++ b/vic/extensions/rout_stub/src/state_metadata_extension.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Save model state. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_stub/src/vic_restore_extension.c b/vic/extensions/rout_stub/src/vic_restore_extension.c index 99bde10cc..7160805b9 100644 --- a/vic/extensions/rout_stub/src/vic_restore_extension.c +++ b/vic/extensions/rout_stub/src/vic_restore_extension.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Save model state. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/extensions/rout_stub/src/vic_store_extension.c b/vic/extensions/rout_stub/src/vic_store_extension.c index 71dfb7782..3372c51b0 100644 --- a/vic/extensions/rout_stub/src/vic_store_extension.c +++ b/vic/extensions/rout_stub/src/vic_store_extension.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Save model state. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/include/vic_def.h b/vic/vic_run/include/vic_def.h index a78dbc15d..c4e87903b 100644 --- a/vic/vic_run/include/vic_def.h +++ b/vic/vic_run/include/vic_def.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Definition header file - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_DEF_H @@ -63,6 +43,7 @@ #define MAX_NODES 50 /**< maximum number of soil thermal nodes */ #define MAX_FRONTS 3 /**< maximum number of freezing and thawing front depths to store */ #define MAX_FROST_AREAS 10 /**< maximum number of frost sub-areas */ +#define MAX_LAKE_BASIN_NODES 20 /**< maximum number of points to define lake basin shape */ #define MAX_LAKE_NODES 20 /**< maximum number of lake thermal nodes */ #define MAX_ZWTVMOIST 11 /**< maximum number of points in water table vs moisture curve for each soil layer; should include points at lower and upper boundaries of the layer */ @@ -228,13 +209,13 @@ typedef struct { bool LAKES; /**< TRUE = use lake energy code */ size_t Ncanopy; /**< Number of canopy layers in the model. */ size_t Nfrost; /**< Number of frost subareas in model */ - size_t Nlakenode; /**< Number of lake thermal nodes in the model. */ + size_t Nlakebasnode; /**< Number of points defining lake basin shape. */ + size_t Nlakenode; /**< Number of lake layers in the model. */ size_t Nlayer; /**< Number of layers in model */ size_t Nnode; /**< Number of soil thermal nodes in the model */ bool NOFLUX; /**< TRUE = Use no flux lower bondary when computing soil thermal fluxes */ size_t NVEGTYPES; /**< number of vegetation types in veg_param file */ - size_t NLAKENODES; /**< number of lake layers in lake_param file */ unsigned short int RC_MODE; /**< RC_JARVIS = compute canopy resistance via Jarvis formulation (default) RC_PHOTO = compute canopy resistance based on photosynthetic activity */ size_t ROOT_ZONES; /**< Number of root zones used in simulation */ @@ -279,11 +260,14 @@ typedef struct { FROM_VEGPARAM = use LAI values from the veg param file */ bool LAKE_PROFILE; /**< TRUE = user-specified lake/area profile */ bool ORGANIC_FRACT; /**< TRUE = organic matter fraction of each layer is read from the soil parameter file; otherwise set to 0.0. */ + bool BULK_DENSITY_COMB; /**< TRUE = soil bulk density (combined mineral and organic matter) read from soil parameter file; otherwise set to 0.0 */ + bool MAX_SNOW_ALBEDO; /**< TRUE = maximum snow albedo taken from the parameter file if veg type is not bare soil; otherwise use param option */ // state options unsigned short int STATE_FORMAT; /**< TRUE = model state file is binary (default) */ bool INIT_STATE; /**< TRUE = initialize model state from file */ bool SAVE_STATE; /**< TRUE = save state file */ + bool STATENAME_CESM; /**< TRUE = use CESM statefile naming conventions */ // output options size_t Noutstreams; /**< Number of output stream */ @@ -359,8 +343,8 @@ typedef struct { // Soil Constraints double SOIL_RARC; /**< Architectural resistance (s/m) of soil when computing soil evaporation via Penman-Monteith eqn */ - double SOIL_RESID_MOIST; /**< Default residual moisture content of soil colum */ - double SOIL_SLAB_MOIST_FRACT; /**< Volumetric moisture content (fraction of porosity) in the soil/rock below the bottom soil layer; this assumes that the soil below the bottom layer has the same texture as the bottom layer. */ + double SOIL_RESID_MOIST; /**< Default residual moisture content (fraction of porosity) of soil column */ + double SOIL_SLAB_MOIST_FRACT; /**< Moisture content (fraction of porosity) in the soil/rock below the bottom soil layer; this assumes that the soil below the bottom layer has the same texture as the bottom layer. */ double SOIL_WINDH; /**< Default wind measurement height over soil (m) */ // Vegetation Parameters @@ -581,13 +565,13 @@ typedef struct { double init_moist[MAX_LAYERS]; /**< initial layer moisture level (mm) */ double max_infil; /**< maximum infiltration rate */ double max_moist[MAX_LAYERS]; /**< maximum moisture content (mm) per layer */ - double max_moist_node[MAX_NODES]; /**< maximum moisture content (mm/mm) per node */ double max_snow_distrib_slope; /**< Maximum slope of snow depth distribution [m]. This should equal 2*depth_min, where depth_min = minimum snow pack depth below which coverage < 1. Comment, ported from user_def.h, with questionable units: SiB uses 0.076; Rosemount data imply 0.155cm depth ~ 0.028mm swq. */ double phi_s[MAX_LAYERS]; /**< soil moisture diffusion parameter (mm/mm) */ double porosity[MAX_LAYERS]; /**< porosity (fraction) */ + double porosity_node[MAX_NODES]; /**< porosity (fraction) per node */ double quartz[MAX_LAYERS]; /**< quartz content of soil (fraction of mineral soil volume) */ double organic[MAX_LAYERS]; /**< organic content of soil (fraction of total soil volume) */ - double resid_moist[MAX_LAYERS]; /**< residual moisture content of soil layer */ + double resid_moist[MAX_LAYERS]; /**< residual moisture content of soil layer (mm) */ double rough; /**< soil surface roughness (m) */ double snow_rough; /**< snow surface roughness (m) */ double soil_density[MAX_LAYERS]; /**< soil particle density (kg/m^3) */ @@ -663,6 +647,8 @@ typedef struct { library */ bool overstory; /**< TRUE = overstory present, important for snow accumulation in canopy */ + double max_snow_albedo;/**< new maximum snow albedo from Barlage et al + 2005 (fraction) */ double rad_atten; /**< radiation attenuation due to canopy, default = 0.5 (N/A) */ double rarc; /**< architectural resistance (s/m) */ @@ -1015,9 +1001,9 @@ typedef struct { typedef struct { // Lake basin dimensions size_t numnod; /**< Maximum number of lake nodes for this grid cell */ - double z[MAX_LAKE_NODES + 1]; /**< Elevation of each lake node (when lake storage is at maximum), relative to lake's deepest point (m) */ - double basin[MAX_LAKE_NODES + 1]; /**< Area of lake basin at each lake node (when lake storage is at maximum) (m^2) */ - double Cl[MAX_LAKE_NODES + 1]; /**< Fractional coverage of lake basin at each node (when lake storage is at maximum) (fraction of grid cell area) */ + double z[MAX_LAKE_BASIN_NODES + 1]; /**< Elevation of each lake node, relative to lake's deepest point (m) */ + double basin[MAX_LAKE_BASIN_NODES + 1]; /**< Area of lake basin at each lake node (when lake storage is at maximum) (m^2) */ + double Cl[MAX_LAKE_BASIN_NODES + 1]; /**< Fractional coverage of lake basin at each node (when lake storage is at maximum) (fraction of grid cell area) */ double b; /**< Exponent in default lake depth-area profile (y=Ax^b) */ double maxdepth; /**< Maximum allowable depth of liquid portion of lake (m) */ double mindepth; /**< Minimum allowable depth of liquid portion of lake (m) */ diff --git a/vic/vic_run/include/vic_log.h b/vic/vic_run/include/vic_log.h index 819e17457..fbe041076 100644 --- a/vic/vic_run/include/vic_log.h +++ b/vic/vic_run/include/vic_log.h @@ -126,17 +126,17 @@ void setup_logging(int id, char log_path[], FILE **logfile); // here means that it just doesn't print a message, it still does the // check. MKAY? #define check_debug(A, M, ...) if (!(A)) {debug(M, ## __VA_ARGS__); errno = 0; \ - exit(EXIT_FAILURE); } + exit(EXIT_FAILURE);} #define check(A, M, ...) if (!(A)) {log_err(M, ## __VA_ARGS__); errno = 0; exit( \ - EXIT_FAILURE); } + EXIT_FAILURE);} #define check_alloc_status(A, M, \ ...) if (A == NULL) {log_err(M, ## __VA_ARGS__); \ errno = 0; exit( \ - EXIT_FAILURE); } + EXIT_FAILURE);} #define sentinel(M, ...) {log_err(M, ## __VA_ARGS__); errno = 0; exit( \ - EXIT_FAILURE); } + EXIT_FAILURE);} #define check_mem(A) check((A), "Out of memory.") @@ -144,8 +144,8 @@ void setup_logging(int id, char log_path[], FILE **logfile); E), E, __FUNCTION__, __LINE__) #define error_response(F, C, M, ...) {Response_send_status(F, &HTTP_ ## C); \ - sentinel(M, ## __VA_ARGS__); } + sentinel(M, ## __VA_ARGS__);} #define error_unless(T, F, C, M, ...) if (!(T)) \ - error_response(F, C, M, ## __VA_ARGS__) + error_response(F, C, M, ## __VA_ARGS__) #endif diff --git a/vic/vic_run/include/vic_physical_constants.h b/vic/vic_run/include/vic_physical_constants.h index 307b82be3..0bd604154 100644 --- a/vic/vic_run/include/vic_physical_constants.h +++ b/vic/vic_run/include/vic_physical_constants.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * VIC Physical Constants Header File - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_PHYSICAL_CONSTANTS diff --git a/vic/vic_run/include/vic_run.h b/vic/vic_run/include/vic_run.h index 9c6e4cfbd..b63bbd765 100644 --- a/vic/vic_run/include/vic_run.h +++ b/vic/vic_run/include/vic_run.h @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Header file for vic_run routines - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #ifndef VIC_RUN_H @@ -41,7 +21,7 @@ void alblake(double, double, double *, double *, double *, double *, double, double, double, unsigned int *, double, bool *, unsigned short int, double); double arno_evap(layer_data_struct *, double, double, double, double, double, - double, double, double, double, double, double *); + double, double, double, double, double *); bool assert_close_double(double x, double y, double rtol, double abs_tol); bool assert_close_float(float x, float y, float rtol, float abs_tol); double calc_atmos_energy_bal(double, double, double, double, double, double, @@ -220,8 +200,7 @@ void polint(double xa[], double ya[], int n, double x, double *y, double *dy); void prepare_full_energy(cell_data_struct *, energy_bal_struct *, soil_con_struct *, double *, double *); double qromb( - double (*sub_with_height)(), double es, double Wind, double AirDens, double ZO, double EactAir, double F, double hsalt, double phi_r, double ushear, double Zrh, double a, - double b); + double (*sub_with_height )(), double es, double Wind, double AirDens, double ZO, double EactAir, double F, double hsalt, double phi_r, double ushear, double Zrh, double a, double b); void rescale_snow_energy_fluxes(double, double, snow_data_struct *, energy_bal_struct *); void rescale_snow_storage(double, double, snow_data_struct *); @@ -237,10 +216,10 @@ void set_node_parameters(double *, double *, double *, double *, double *, double *, int, int); void shear_stress(double U10, double ZO, double *ushear, double *Zo_salt, double utshear); -double snow_albedo(double, double, double, double, double, int, bool); +double snow_albedo(double, double, double, double, double, double, int, bool); double snow_density(snow_data_struct *, double, double, double, double); int snow_intercept(double, double, double, double, double, double, double, - double, double, double, double *, double *, double *, + double, double, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, bool *, unsigned int *, double *, double *, @@ -267,13 +246,13 @@ int solve_lake(double, double, double, double, double, double, double, double, double, double, lake_var_struct *, soil_con_struct, double, double, dmy_struct, double); double solve_snow(char, double, double, double, double, double, double, double, - double, double, double *, double *, double *, double *, + double, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, - int, size_t, unsigned short int, unsigned short int, double, - size_t, int, int *, double *, double *, dmy_struct *, + double *, int, size_t, unsigned short int, unsigned short int, + double, size_t, int, int *, double *, double *, dmy_struct *, force_data_struct *, energy_bal_struct *, layer_data_struct *, snow_data_struct *, soil_con_struct *, veg_var_struct *); double solve_surf_energy_bal(double Tsurf, ...); @@ -314,8 +293,7 @@ double transport_with_height(double z, double es, double Wind, double AirDens, double ZO, double EactAir, double F, double hsalt, double phi_r, double ushear, double Zrh); double trapzd( - double (*funcd)(), double es, double Wind, double AirDens, double ZO, double EactAir, double F, double hsalt, double phi_r, double ushear, double Zrh, double a, double b, - int n); + double (*funcd )(), double es, double Wind, double AirDens, double ZO, double EactAir, double F, double hsalt, double phi_r, double ushear, double Zrh, double a, double b, int n); void tridia(int, double *, double *, double *, double *, double *); void tridiag(double *, double *, double *, double *, unsigned int); int vic_run(force_data_struct *, all_vars_struct *, dmy_struct *, diff --git a/vic/vic_run/src/CalcAerodynamic.c b/vic/vic_run/src/CalcAerodynamic.c index 723ab229a..730bfec00 100644 --- a/vic/vic_run/src/CalcAerodynamic.c +++ b/vic/vic_run/src/CalcAerodynamic.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate the aerodynamic resistances. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/CalcBlowingSnow.c b/vic/vic_run/src/CalcBlowingSnow.c index 16cfa6f97..ad1411aff 100644 --- a/vic/vic_run/src/CalcBlowingSnow.c +++ b/vic/vic_run/src/CalcBlowingSnow.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate energy of sublimation from blowing snow. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/IceEnergyBalance.c b/vic/vic_run/src/IceEnergyBalance.c index c1b7f63b2..76e0a8f8d 100644 --- a/vic/vic_run/src/IceEnergyBalance.c +++ b/vic/vic_run/src/IceEnergyBalance.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate lake ice energy balance - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/SnowPackEnergyBalance.c b/vic/vic_run/src/SnowPackEnergyBalance.c index 77b700519..446f42661 100644 --- a/vic/vic_run/src/SnowPackEnergyBalance.c +++ b/vic/vic_run/src/SnowPackEnergyBalance.c @@ -6,26 +6,6 @@ * Based on the SnowPackEnergyBalance function in DHSVM * Reference: Bras, R.A., Hydrology, an introduction to hydrologic science, * Addison Wesley, Inc., Reading, etc., 1990. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/StabilityCorrection.c b/vic/vic_run/src/StabilityCorrection.c index 39e813abe..fac41c003 100644 --- a/vic/vic_run/src/StabilityCorrection.c +++ b/vic/vic_run/src/StabilityCorrection.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Stability correction - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/advected_sensible_heat.c b/vic/vic_run/src/advected_sensible_heat.c index c6be7ccb1..240e05796 100644 --- a/vic/vic_run/src/advected_sensible_heat.c +++ b/vic/vic_run/src/advected_sensible_heat.c @@ -7,26 +7,6 @@ * Based on the work of Marsh, P., J. W. Pomeroy, and N. Neumann, Sensible heat * flux and local advection over a heterogeneous landscape at an Arctic tundra * site during snowmelt, Annals of Glaciology, 25, 1997. pp 132-136. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/alloc_and_free.c b/vic/vic_run/src/alloc_and_free.c index 016380cae..cb2399852 100644 --- a/vic/vic_run/src/alloc_and_free.c +++ b/vic/vic_run/src/alloc_and_free.c @@ -3,26 +3,6 @@ * * This subroutine redistributes soil properties based on the thermal solutions * found for the current time step. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/arno_evap.c b/vic/vic_run/src/arno_evap.c index 3f4db87e9..3dc3cba96 100644 --- a/vic/vic_run/src/arno_evap.c +++ b/vic/vic_run/src/arno_evap.c @@ -8,26 +8,6 @@ * the potential for the area which is partial saturated. * * Evaporation from bare soil calculated only from uppermost layer. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -40,13 +20,12 @@ arno_evap(layer_data_struct *layer, double rad, double air_temp, double vpd, - double depth1, double max_moist, double elevation, double b_infilt, double ra, double delta_t, - double moist_resid, + double resid_moist, double *frost_fract) { extern parameters_struct param; @@ -169,10 +148,10 @@ arno_evap(layer_data_struct *layer, /* only consider positive evaporation; we won't put limits on condensation */ if (esoil > 0.0) { - if (moist > moist_resid * depth1 * MM_PER_M) { + if (moist > resid_moist) { /* there is liquid moisture available; cap esoil at available liquid moisture */ - if (esoil > moist - moist_resid * depth1 * MM_PER_M) { - esoil = moist - moist_resid * depth1 * MM_PER_M; + if (esoil > moist - resid_moist) { + esoil = moist - resid_moist; } } else { diff --git a/vic/vic_run/src/calc_Nscale_factors.c b/vic/vic_run/src/calc_Nscale_factors.c index 1a8a16845..8aa076f1d 100644 --- a/vic/vic_run/src/calc_Nscale_factors.c +++ b/vic/vic_run/src/calc_Nscale_factors.c @@ -6,26 +6,6 @@ * * Note: this should only be applied to veg types that have a canopy, e.g. * trees and shrubs, but not grass or tundra vegetation. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/calc_atmos_energy_bal.c b/vic/vic_run/src/calc_atmos_energy_bal.c index cd8802714..ffb429fcf 100644 --- a/vic/vic_run/src/calc_atmos_energy_bal.c +++ b/vic/vic_run/src/calc_atmos_energy_bal.c @@ -7,26 +7,6 @@ * Basic concept for this was taken from: * Sellers et al., J. Clim., v.9, April 1996, pp. 676-705. * Dickinsen, BATS manual, NCAR Tech. Note (NCAR/TN-387+STR), August 1993. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/calc_gridcell_avg_albedo.c b/vic/vic_run/src/calc_gridcell_avg_albedo.c index e2ff2f2cc..762d47856 100644 --- a/vic/vic_run/src/calc_gridcell_avg_albedo.c +++ b/vic/vic_run/src/calc_gridcell_avg_albedo.c @@ -5,26 +5,6 @@ * * Note: this routine is specifically designed for the CESM driver, for WRF, * but has been implemented in other drivers as well for the sake of consistency. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/calc_rainonly.c b/vic/vic_run/src/calc_rainonly.c index bb02b2eef..60f3ced68 100644 --- a/vic/vic_run/src/calc_rainonly.c +++ b/vic/vic_run/src/calc_rainonly.c @@ -3,26 +3,6 @@ * * Determines from the air temperature what fraction of incoming precipitation * is frozen and unfrozen (snow and rain). - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/calc_snow_coverage.c b/vic/vic_run/src/calc_snow_coverage.c index 716e9ac12..1f3f43b03 100644 --- a/vic/vic_run/src/calc_snow_coverage.c +++ b/vic/vic_run/src/calc_snow_coverage.c @@ -7,27 +7,6 @@ * original value was based on field observations from the University of Minnesota's * Rosemount Agricultural Experiment station (see dissertation by Keith * Cherkauer, 2001). - - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/calc_surf_energy_bal.c b/vic/vic_run/src/calc_surf_energy_bal.c index 01abda8fa..cc75b4d86 100644 --- a/vic/vic_run/src/calc_surf_energy_bal.c +++ b/vic/vic_run/src/calc_surf_energy_bal.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate the surface energy balance. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -125,7 +105,7 @@ calc_surf_energy_bal(double Le, double kappa1; double kappa2; double kappa_snow; - double max_moist; + double porosity; double refrozen_water; double Wdew; @@ -139,7 +119,7 @@ calc_surf_energy_bal(double Le, double *moist_node; double *bubble_node; double *expt_node; - double *max_moist_node; + double *porosity_node; double *ice_node; double *alpha; double *beta; @@ -163,7 +143,7 @@ calc_surf_energy_bal(double Le, } if (iveg != Nveg) { - if (veg_var->fcanopy > 0.0) { + if (veg_var->fcanopy > 0.0 && veg_var->LAI > 0.0) { VEG = true; } else { @@ -212,7 +192,7 @@ calc_surf_energy_bal(double Le, } emissivity = 1.; // longwave emissivity delta_t = dt; - max_moist = soil_con->max_moist[0] / (soil_con->depth[0] * MM_PER_M); + porosity = soil_con->porosity[0]; bubble = soil_con->bubble[0]; expt = soil_con->expt[0]; Tsnow_surf = snow->surf_temp; @@ -249,7 +229,7 @@ calc_surf_energy_bal(double Le, bubble_node = soil_con->bubble_node; expt_node = soil_con->expt_node; - max_moist_node = soil_con->max_moist_node; + porosity_node = soil_con->porosity_node; alpha = soil_con->alpha; beta = soil_con->beta; gamma = soil_con->gamma; @@ -301,7 +281,7 @@ calc_surf_energy_bal(double Le, Tsurf = root_brent(T_lower, T_upper, func_surf_energy_bal, VEG, veg_class, delta_t, Cs1, Cs2, D1, D2, T1_old, T2, Ts_old, energy->T, bubble, dp, expt, - ice0, kappa1, kappa2, max_moist, moist, root, + ice0, kappa1, kappa2, porosity, moist, root, CanopLayerBnd, UnderStory, overstory, NetShortBare, NetShortGrnd, TmpNetShortSnow, Tair, atmos_density, atmos_pressure, emissivity, LongBareIn, LongSnowIn, @@ -317,7 +297,7 @@ calc_surf_energy_bal(double Le, &snow->surface_flux, tmpNnodes, Cs_node, T_node, Tnew_node, Tnew_fbflag, Tnew_fbcount, alpha, beta, bubble_node, Zsum_node, expt_node, gamma, ice_node, - kappa_node, max_moist_node, moist_node, soil_con, + kappa_node, porosity_node, moist_node, soil_con, layer, veg_var, INCLUDE_SNOW, options.NOFLUX, options.EXP_TRANS, snow->snow, FIRST_SOLN, &NetLongBare, @@ -348,7 +328,7 @@ calc_surf_energy_bal(double Le, dp, expt, ice0, kappa1, kappa2, soil_con->max_infil, - max_moist, + porosity, moist, soil_con->Wcr, soil_con->Wpwp, soil_con->depth, @@ -388,7 +368,7 @@ calc_surf_energy_bal(double Le, bubble_node, Zsum_node, expt_node, gamma, ice_node, kappa_node, - max_moist_node, moist_node, + porosity_node, moist_node, soil_con->frost_fract, layer, veg_var, INCLUDE_SNOW, @@ -422,7 +402,7 @@ calc_surf_energy_bal(double Le, func_surf_energy_bal, VEG, veg_class, delta_t, Cs1, Cs2, D1, D2, T1_old, T2, Ts_old, energy->T, bubble, dp, expt, ice0, kappa1, - kappa2, max_moist, moist, root, CanopLayerBnd, + kappa2, porosity, moist, root, CanopLayerBnd, UnderStory, overstory, NetShortBare, NetShortGrnd, TmpNetShortSnow, Tair, atmos_density, @@ -440,7 +420,7 @@ calc_surf_energy_bal(double Le, &snow->surface_flux, tmpNnodes, Cs_node, T_node, Tnew_node, Tnew_fbflag, Tnew_fbcount, alpha, beta, bubble_node, Zsum_node, expt_node, gamma, - ice_node, kappa_node, max_moist_node, + ice_node, kappa_node, porosity_node, moist_node, soil_con, layer, veg_var, INCLUDE_SNOW, options.NOFLUX, options.EXP_TRANS, snow->snow, @@ -471,7 +451,7 @@ calc_surf_energy_bal(double Le, expt, ice0, kappa1, kappa2, soil_con->max_infil, - max_moist, + porosity, moist, soil_con->Wcr, soil_con->Wpwp, soil_con->depth, @@ -515,7 +495,7 @@ calc_surf_energy_bal(double Le, expt_node, gamma, ice_node, kappa_node, - max_moist_node, + porosity_node, moist_node, soil_con->frost_fract, layer, veg_var, @@ -552,7 +532,7 @@ calc_surf_energy_bal(double Le, error = solve_surf_energy_bal(Tsurf, VEG, veg_class, delta_t, Cs1, Cs2, D1, D2, T1_old, T2, Ts_old, energy->T, bubble, dp, expt, ice0, kappa1, kappa2, - max_moist, moist, root, CanopLayerBnd, + porosity, moist, root, CanopLayerBnd, UnderStory, overstory, NetShortBare, NetShortGrnd, TmpNetShortSnow, Tair, atmos_density, atmos_pressure, emissivity, @@ -571,7 +551,7 @@ calc_surf_energy_bal(double Le, T_node, Tnew_node, Tnew_fbflag, Tnew_fbcount, alpha, beta, bubble_node, Zsum_node, expt_node, gamma, ice_node, kappa_node, - max_moist_node, moist_node, soil_con, layer, + porosity_node, moist_node, soil_con, layer, veg_var, INCLUDE_SNOW, options.NOFLUX, options.EXP_TRANS, snow->snow, FIRST_SOLN, &NetLongBare, @@ -824,7 +804,7 @@ error_print_surf_energy_bal(double Ts, double kappa1; double kappa2; double max_infil; - double max_moist; + double porosity; double moist; double *Wcr; @@ -899,7 +879,7 @@ error_print_surf_energy_bal(double Ts, double *gamma; double *ice_node; double *kappa_node; - double *max_moist_node; + double *porosity_node; double *moist_node; /* spatial frost terms */ @@ -967,7 +947,7 @@ error_print_surf_energy_bal(double Ts, kappa1 = (double) va_arg(ap, double); kappa2 = (double) va_arg(ap, double); max_infil = (double) va_arg(ap, double); - max_moist = (double) va_arg(ap, double); + porosity = (double) va_arg(ap, double); moist = (double) va_arg(ap, double); Wcr = (double *) va_arg(ap, double *); @@ -1042,7 +1022,7 @@ error_print_surf_energy_bal(double Ts, gamma = (double *) va_arg(ap, double *); ice_node = (double *) va_arg(ap, double *); kappa_node = (double *) va_arg(ap, double *); - max_moist_node = (double *) va_arg(ap, double *); + porosity_node = (double *) va_arg(ap, double *); moist_node = (double *) va_arg(ap, double *); frost_fract = (double *) va_arg(ap, double *); @@ -1107,7 +1087,7 @@ error_print_surf_energy_bal(double Ts, fprintf(LOG_DEST, "kappa1 = %f\n", kappa1); fprintf(LOG_DEST, "kappa2 = %f\n", kappa2); fprintf(LOG_DEST, "max_infil = %f\n", max_infil); - fprintf(LOG_DEST, "max_moist = %f\n", max_moist); + fprintf(LOG_DEST, "porosity = %f\n", porosity); fprintf(LOG_DEST, "moist = %f\n", moist); fprintf(LOG_DEST, "*Wcr = %f\n", *Wcr); @@ -1203,14 +1183,14 @@ error_print_surf_energy_bal(double Ts, if (!options.QUICK_FLUX) { fprintf(LOG_DEST, "Node\tT\tTnew\tTold\talpha\tbeta\tZsum\tkappa\tCs\tmoist\t" - "bubble\texpt\tgamma\tmax_moist\tice\n"); + "bubble\texpt\tgamma\tporosity\tice\n"); for (i = 0; i < Nnodes; i++) { fprintf(LOG_DEST, "%i\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f" "\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\n", i, T_node[i], Told_node[i], alpha[i], beta[i], Tnew_node[i], Zsum_node[i], kappa_node[i], Cs_node[i], moist_node[i], - bubble_node[i], expt_node[i], gamma[i], max_moist_node[i], + bubble_node[i], expt_node[i], gamma[i], porosity_node[i], ice_node[i]); } } diff --git a/vic/vic_run/src/calc_veg_params.c b/vic/vic_run/src/calc_veg_params.c index 274570612..6dcbaad56 100644 --- a/vic/vic_run/src/calc_veg_params.c +++ b/vic/vic_run/src/calc_veg_params.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate vegetation parameters. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/canopy_assimilation.c b/vic/vic_run/src/canopy_assimilation.c index f516db972..a17621740 100644 --- a/vic/vic_run/src/canopy_assimilation.c +++ b/vic/vic_run/src/canopy_assimilation.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate GPP, Raut, and NPP for veg cover with multi-layer canopy. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/canopy_evap.c b/vic/vic_run/src/canopy_evap.c index ac4e0d568..c944b2bbf 100644 --- a/vic/vic_run/src/canopy_evap.c +++ b/vic/vic_run/src/canopy_evap.c @@ -6,26 +6,6 @@ * * The value of x, the fraction of precipitation that exceeds the canopy * storage capacity, is returned by the subroutine. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/comparisons.c b/vic/vic_run/src/comparisons.c index 15bd2d177..197298a3c 100644 --- a/vic/vic_run/src/comparisons.c +++ b/vic/vic_run/src/comparisons.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * floating point comparison utilities - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/compute_coszen.c b/vic/vic_run/src/compute_coszen.c index d82d43f12..fa127c1b9 100644 --- a/vic/vic_run/src/compute_coszen.c +++ b/vic/vic_run/src/compute_coszen.c @@ -3,26 +3,6 @@ * * This subroutine computes the cosine of the solar zenith angle, given the * current location and date. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/compute_derived_lake_dimensions.c b/vic/vic_run/src/compute_derived_lake_dimensions.c index 23a8c5918..89bf328b4 100644 --- a/vic/vic_run/src/compute_derived_lake_dimensions.c +++ b/vic/vic_run/src/compute_derived_lake_dimensions.c @@ -3,26 +3,6 @@ * * This routine computes those lake variables that are completely dependent * on lake depth and basin dimensions. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/compute_pot_evap.c b/vic/vic_run/src/compute_pot_evap.c index 6f5809a16..0a2124a62 100644 --- a/vic/vic_run/src/compute_pot_evap.c +++ b/vic/vic_run/src/compute_pot_evap.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Compute potential evaporation. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/compute_soil_resp.c b/vic/vic_run/src/compute_soil_resp.c index 1253bd145..dbe0a752e 100644 --- a/vic/vic_run/src/compute_soil_resp.c +++ b/vic/vic_run/src/compute_soil_resp.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate soil respiration (heterotrophic respiration, or Rh). - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/compute_zwt.c b/vic/vic_run/src/compute_zwt.c index 76ff22c01..65f2cde69 100644 --- a/vic/vic_run/src/compute_zwt.c +++ b/vic/vic_run/src/compute_zwt.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Compute spatial average water table position (zwt). - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/correct_precip.c b/vic/vic_run/src/correct_precip.c index ab8d8633a..1ffedc361 100644 --- a/vic/vic_run/src/correct_precip.c +++ b/vic/vic_run/src/correct_precip.c @@ -8,26 +8,6 @@ * * NOTE: Should locate better reference with fitted equations, or at least data * with which to fit an equation. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/estimate_T1.c b/vic/vic_run/src/estimate_T1.c index 59841a1e7..09b640f59 100644 --- a/vic/vic_run/src/estimate_T1.c +++ b/vic/vic_run/src/estimate_T1.c @@ -4,26 +4,6 @@ * This routine uses Xu Liangs 3-layer energy balance formulation to estimate * the temperature between the first and second layers. Formerly calculated * independently in each of the surface energy balance equation routines. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/faparl.c b/vic/vic_run/src/faparl.c index a825f9fa7..e2db4ae18 100644 --- a/vic/vic_run/src/faparl.c +++ b/vic/vic_run/src/faparl.c @@ -3,26 +3,6 @@ * * Compute each canopy layer's leaf area index (LAIlayer) and absorbed * photsynthetic active radiation (aPAR) from total LAI and direct irradiation. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/frozen_soil.c b/vic/vic_run/src/frozen_soil.c index 90d6c09dc..f35445289 100644 --- a/vic/vic_run/src/frozen_soil.c +++ b/vic/vic_run/src/frozen_soil.c @@ -3,26 +3,6 @@ * * This subroutine redistributes soil properties based on the thermal solutions * found for the current time step. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/func_atmos_energy_bal.c b/vic/vic_run/src/func_atmos_energy_bal.c index ec47593af..d08272e58 100644 --- a/vic/vic_run/src/func_atmos_energy_bal.c +++ b/vic/vic_run/src/func_atmos_energy_bal.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine solves the atmospheric exchange energy balance. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/func_atmos_moist_bal.c b/vic/vic_run/src/func_atmos_moist_bal.c index 651e3e9b1..86ff9936c 100644 --- a/vic/vic_run/src/func_atmos_moist_bal.c +++ b/vic/vic_run/src/func_atmos_moist_bal.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine solves the atmospheric exchange moisture balance. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/func_canopy_energy_bal.c b/vic/vic_run/src/func_canopy_energy_bal.c index 030e3c796..c1fa1c1d6 100644 --- a/vic/vic_run/src/func_canopy_energy_bal.c +++ b/vic/vic_run/src/func_canopy_energy_bal.c @@ -4,26 +4,6 @@ * This routine iterates to determine the temperature of the canopy, and solve * the resulting fluxes between the canopy and the atmosphere and the canopy * and the ground. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -245,6 +225,9 @@ func_canopy_energy_bal(double Tfoliage, elevation, prec, Wmax, Wcr, Wpwp, frost_fract, root, dryFrac, shortwave, Catm, CanopLayerBnd); *Wdew /= MM_PER_M; + // Account for fractional canopy cover + *Evap *= veg_var->fcanopy; + *Wdew *= veg_var->fcanopy; *LatentHeat = Le * (*Evap) * CONST_RHOFW; *LatentHeatSub = 0; diff --git a/vic/vic_run/src/func_surf_energy_bal.c b/vic/vic_run/src/func_surf_energy_bal.c index 9d51ef818..e08de3d2e 100644 --- a/vic/vic_run/src/func_surf_energy_bal.c +++ b/vic/vic_run/src/func_surf_energy_bal.c @@ -8,26 +8,6 @@ * * The Energy Balance Equation used comes from Xu Liang's Paper "Insights of * the Ground Heat Flux in Land Surface Parameterization Schemes." - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -68,10 +48,10 @@ func_surf_energy_bal(double Ts, double ice0; double kappa1; double kappa2; - double max_moist; + double porosity; double moist; - double *Wmax; + double *max_moist; double *Wcr; double *Wpwp; double *depth; @@ -153,7 +133,7 @@ func_surf_energy_bal(double Ts, double *gamma; double *ice_node; double *kappa_node; - double *max_moist_node; + double *porosity_node; double *moist_node; /* spatial frost terms */ @@ -238,7 +218,7 @@ func_surf_energy_bal(double Ts, ice0 = (double) va_arg(ap, double); kappa1 = (double) va_arg(ap, double); kappa2 = (double) va_arg(ap, double); - max_moist = (double) va_arg(ap, double); + porosity = (double) va_arg(ap, double); moist = (double) va_arg(ap, double); root = (double *) va_arg(ap, double *); @@ -310,7 +290,7 @@ func_surf_energy_bal(double Ts, gamma = (double *) va_arg(ap, double *); ice_node = (double *) va_arg(ap, double *); kappa_node = (double *) va_arg(ap, double *); - max_moist_node = (double *) va_arg(ap, double *); + porosity_node = (double *) va_arg(ap, double *); moist_node = (double *) va_arg(ap, double *); /* model structures */ @@ -341,7 +321,7 @@ func_surf_energy_bal(double Ts, /* take additional variables from soil_con structure */ b_infilt = soil_con->b_infilt; - Wmax = soil_con->max_moist; + max_moist = soil_con->max_moist; Wcr = soil_con->Wcr; Wpwp = soil_con->Wpwp; depth = soil_con->depth; @@ -434,7 +414,7 @@ func_surf_energy_bal(double Ts, Error = solve_T_profile_implicit(Tnew_node, T_node, Tnew_fbflag, Tnew_fbcount, Zsum_node, kappa_node, Cs_node, moist_node, - delta_t, max_moist_node, + delta_t, porosity_node, bubble_node, expt_node, ice_node, alpha, beta, gamma, dp, Nnodes, FIRST_SOLN, NOFLUX, EXP_TRANS, @@ -455,7 +435,7 @@ func_surf_energy_bal(double Ts, Error = solve_T_profile(Tnew_node, T_node, Tnew_fbflag, Tnew_fbcount, Zsum_node, kappa_node, Cs_node, moist_node, delta_t, - max_moist_node, bubble_node, + porosity_node, bubble_node, expt_node, ice_node, alpha, beta, gamma, dp, Nnodes, FIRST_SOLN, FS_ACTIVE, NOFLUX, EXP_TRANS); @@ -556,7 +536,7 @@ func_surf_energy_bal(double Ts, if (!options.EXP_TRANS) { if ((TMean + *T1) / 2. < 0.) { ice = moist - maximum_unfrozen_water((TMean + *T1) / 2., - max_moist, bubble, expt); + porosity, bubble, expt); if (ice < 0.) { ice = 0.; } @@ -575,7 +555,7 @@ func_surf_energy_bal(double Ts, ice0 = moist - maximum_unfrozen_water( (Told_node[i] + Told_node[i + 1]) / 2., - max_moist, bubble, + porosity, bubble, expt); if (ice0 < 0.) { ice0 = 0.; @@ -588,7 +568,7 @@ func_surf_energy_bal(double Ts, ice = moist - maximum_unfrozen_water( (Tnew_node[i] + Tnew_node[i + 1]) / 2., - max_moist, bubble, + porosity, bubble, expt); if (ice < 0.) { ice = 0.; @@ -609,7 +589,7 @@ func_surf_energy_bal(double Ts, if ((Told_node[i] + T1_old) / 2. < 0.) { ice0 = moist - maximum_unfrozen_water( (Told_node[i] + T1_old) / 2., - max_moist, bubble, expt); + porosity, bubble, expt); if (ice0 < 0.) { ice0 = 0.; } @@ -619,7 +599,7 @@ func_surf_energy_bal(double Ts, } if ((Tnew_node[i] + *T1) / 2. < 0.) { ice = moist - maximum_unfrozen_water((Tnew_node[i] + *T1) / 2., - max_moist, bubble, expt); + porosity, bubble, expt); if (ice < 0.) { ice = 0.; } @@ -750,11 +730,12 @@ func_surf_energy_bal(double Ts, } Evap = 0.; if (!SNOWING) { - if (VEG && veg_var->fcanopy > 0) { + // if VEG is true, then fcanopy > 0 and LAI > 0 + if (VEG) { Evap = canopy_evap(layer, veg_var, true, veg_class, Wdew, delta_t, NetBareRad, vpd, NetShortBare, Tair, Ra_veg[1], elevation, rainfall, - Wmax, Wcr, Wpwp, frost_fract, root, + max_moist, Wcr, Wpwp, frost_fract, root, dryFrac, shortwave, Catm, CanopLayerBnd); Evap *= veg_var->fcanopy; for (i = 0; i < options.Nlayer; i++) { @@ -766,8 +747,7 @@ func_surf_energy_bal(double Ts, SurfRad = NetBareRad; } Evap += (1 - veg_var->fcanopy) * - arno_evap(layer, SurfRad, Tair, vpd, - depth[0], max_moist * depth[0] * MM_PER_M, + arno_evap(layer, SurfRad, Tair, vpd, max_moist[0], elevation, b_infilt, Ra_used[0], delta_t, resid_moist[0], frost_fract); for (i = 0; i < options.Nlayer; i++) { diff --git a/vic/vic_run/src/ice_melt.c b/vic/vic_run/src/ice_melt.c index 52cf3abf5..4cf8ef4e1 100644 --- a/vic/vic_run/src/ice_melt.c +++ b/vic/vic_run/src/ice_melt.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate snow accumulation and melt for the lake model - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/initialize_lake.c b/vic/vic_run/src/initialize_lake.c index b2acf58f8..15c5aad6a 100644 --- a/vic/vic_run/src/initialize_lake.c +++ b/vic/vic_run/src/initialize_lake.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine initializes the lake variables for each new grid cell. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/interpoloation.c b/vic/vic_run/src/interpoloation.c index 6c7d67b83..5ca004951 100644 --- a/vic/vic_run/src/interpoloation.c +++ b/vic/vic_run/src/interpoloation.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This routine performs a interpolation - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/lake_utils.c b/vic/vic_run/src/lake_utils.c index 4871f962e..77c2f94e7 100644 --- a/vic/vic_run/src/lake_utils.c +++ b/vic/vic_run/src/lake_utils.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * These routines compute lake dimensions. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/lakes.eb.c b/vic/vic_run/src/lakes.eb.c index 2242c7ccf..0d295aa1a 100644 --- a/vic/vic_run/src/lakes.eb.c +++ b/vic/vic_run/src/lakes.eb.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * This set of routines handel the energy balance of lakes - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include @@ -689,7 +669,8 @@ alblake(double Tcutoff, // compute snow surface albedo if (swq > 0.0) { - *snowalbedo = snow_albedo(newsnow, swq, *snowalbedo, coldcontent, + *snowalbedo = snow_albedo(newsnow, param.SNOW_NEW_SNOW_ALB, + swq, *snowalbedo, coldcontent, dt, *last_snow, *MELTING); } else if (swq == 0.0 && newsnow > 0.0) { @@ -1838,7 +1819,7 @@ water_balance(lake_var_struct *lake, energy_bal_struct **energy; size_t lindex; double frac; - double Dsmax, resid_moist, liq, rel_moist; + double Dsmax, liq, rel_moist; double *frost_fract; double volume_save; double *delta_moist = NULL; @@ -2022,20 +2003,19 @@ water_balance(lake_var_struct *lake, cell[iveg][band].layer[lindex].ice[frost_area]) * frost_fract[frost_area]; } - resid_moist = soil_con.resid_moist[lindex] * soil_con.depth[lindex] * - MM_PER_M; /** Compute relative moisture **/ rel_moist = - (liq - resid_moist) / (soil_con.max_moist[lindex] - resid_moist); + (liq - soil_con.resid_moist[lindex]) / + (soil_con.max_moist[lindex] - soil_con.resid_moist[lindex]); /** Compute baseflow as function of relative moisture **/ frac = Dsmax * soil_con.Ds / soil_con.Ws; baseflow_out_mm = frac * rel_moist; if (rel_moist > soil_con.Ws) { frac = (rel_moist - soil_con.Ws) / (1 - soil_con.Ws); - baseflow_out_mm += Dsmax * (1 - soil_con.Ds / soil_con.Ws) * pow(frac, - soil_con.c); + baseflow_out_mm += Dsmax * (1 - soil_con.Ds / soil_con.Ws) * + pow(frac, soil_con.c); } if (baseflow_out_mm < 0) { baseflow_out_mm = 0; @@ -2200,7 +2180,7 @@ water_balance(lake_var_struct *lake, energy[iveg][band].Cs_node, soil_con.Zsum_node, energy[iveg][band].T, - soil_con.max_moist_node, + soil_con.porosity_node, soil_con.expt_node, soil_con.bubble_node, moist, soil_con.depth, diff --git a/vic/vic_run/src/latent_heat_from_snow.c b/vic/vic_run/src/latent_heat_from_snow.c index d0e2d9647..295230d61 100644 --- a/vic/vic_run/src/latent_heat_from_snow.c +++ b/vic/vic_run/src/latent_heat_from_snow.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Computes the latent heat from the snowpack. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/massrelease.c b/vic/vic_run/src/massrelease.c index c977da2de..1be7bff74 100644 --- a/vic/vic_run/src/massrelease.c +++ b/vic/vic_run/src/massrelease.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculates mass release of snow from canopy. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/newt_raph_func_fast.c b/vic/vic_run/src/newt_raph_func_fast.c index fc2ea039a..8f5e8abd4 100644 --- a/vic/vic_run/src/newt_raph_func_fast.c +++ b/vic/vic_run/src/newt_raph_func_fast.c @@ -7,26 +7,6 @@ * A relaxation factor "RELAX#" is added to help the Newton-Raphson trials to * converge during the initial formation of ice, where the shape of the * residual function becomes very difficult. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/penman.c b/vic/vic_run/src/penman.c index ed33dfe55..cea1e6dd9 100644 --- a/vic/vic_run/src/penman.c +++ b/vic/vic_run/src/penman.c @@ -3,26 +3,6 @@ * * This routine calculates evapotranspiration using the Penman-Monteith * approach. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/photosynth.c b/vic/vic_run/src/photosynth.c index 5251f3667..0ad8bcb3f 100644 --- a/vic/vic_run/src/photosynth.c +++ b/vic/vic_run/src/photosynth.c @@ -3,26 +3,6 @@ * * Calculate photosynthesis, based on Farquhar (C3) and Collatz (C4) * formulations. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/physics.c b/vic/vic_run/src/physics.c index e146977b5..357f48737 100644 --- a/vic/vic_run/src/physics.c +++ b/vic/vic_run/src/physics.c @@ -3,26 +3,6 @@ * * This set of functions calculate basic physical quantities that are * frequently calculated throughout the model - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/prepare_full_energy.c b/vic/vic_run/src/prepare_full_energy.c index 33f1c3f38..2f28acdb3 100644 --- a/vic/vic_run/src/prepare_full_energy.c +++ b/vic/vic_run/src/prepare_full_energy.c @@ -4,26 +4,6 @@ * This subroutine returns the soil thermal properties, moisture and ice * contents for the top two layers for use with the QUICK_FLUX ground heat flux * solution. - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/root_brent.c b/vic/vic_run/src/root_brent.c index 2adef4091..42dc41437 100644 --- a/vic/vic_run/src/root_brent.c +++ b/vic/vic_run/src/root_brent.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Brent (1973) root finding algorithm -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include diff --git a/vic/vic_run/src/runoff.c b/vic/vic_run/src/runoff.c index a72a988a0..8801adb29 100644 --- a/vic/vic_run/src/runoff.c +++ b/vic/vic_run/src/runoff.c @@ -3,26 +3,6 @@ * * Calculate infiltration and runoff from the surface, gravity driven drainage * between all soil layers, and generates baseflow from the bottom layer. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include @@ -81,10 +61,12 @@ runoff(cell_data_struct *cell, layer_data_struct tmp_layer; unsigned short runoff_steps_per_dt; - /** Set Residual Moisture **/ + /** Set Temporary Variables **/ for (lindex = 0; lindex < options.Nlayer; lindex++) { - resid_moist[lindex] = soil_con->resid_moist[lindex] * - soil_con->depth[lindex] * MM_PER_M; + resid_moist[lindex] = soil_con->resid_moist[lindex]; + max_moist[lindex] = soil_con->max_moist[lindex]; + Ksat[lindex] = soil_con->Ksat[lindex] / + global_param.runoff_steps_per_day; } /** Allocate and Set Values for Soil Sublayers **/ @@ -148,17 +130,11 @@ runoff(cell_data_struct *cell, Initialize Variables **************************************************/ for (lindex = 0; lindex < options.Nlayer; lindex++) { - Ksat[lindex] = soil_con->Ksat[lindex] / - global_param.runoff_steps_per_day; - /** Set Layer Liquid Moisture Content **/ liq[lindex] = org_moist[lindex] - layer[lindex].ice[fidx]; /** Set Layer Frozen Moisture Content **/ ice[lindex] = layer[lindex].ice[fidx]; - - /** Set Layer Maximum Moisture Content **/ - max_moist[lindex] = soil_con->max_moist[lindex]; } /****************************************************** @@ -202,7 +178,7 @@ runoff(cell_data_struct *cell, if (tmp_liq > resid_moist[lindex]) { Q12[lindex] = calc_Q12(Ksat[lindex], tmp_liq, resid_moist[lindex], - soil_con->max_moist[lindex], + max_moist[lindex], soil_con->expt[lindex]); } else { @@ -303,7 +279,7 @@ runoff(cell_data_struct *cell, rel_moist = (liq[lindex] - resid_moist[lindex]) / - (soil_con->max_moist[lindex] - resid_moist[lindex]); + (max_moist[lindex] - resid_moist[lindex]); /** Compute baseflow as function of relative moisture **/ frac = Dsmax * soil_con->Ds / soil_con->Ws; @@ -408,7 +384,7 @@ runoff(cell_data_struct *cell, energy->Cs_node, soil_con->Zsum_node, energy->T, - soil_con->max_moist_node, + soil_con->porosity_node, soil_con->expt_node, soil_con->bubble_node, moist, soil_con->depth, @@ -417,7 +393,8 @@ runoff(cell_data_struct *cell, soil_con->quartz, soil_con->soil_density, soil_con->bulk_density, - soil_con->organic, Nnodes, + soil_con->organic, + Nnodes, options.Nlayer, soil_con->FS_ACTIVE); if (ErrorFlag == ERROR) { diff --git a/vic/vic_run/src/snow_intercept.c b/vic/vic_run/src/snow_intercept.c index b541cb4ab..95a89cfff 100644 --- a/vic/vic_run/src/snow_intercept.c +++ b/vic/vic_run/src/snow_intercept.c @@ -3,26 +3,6 @@ * * Calculates the interception and subsequent release of by the forest canopy * using an energy balance approach. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include @@ -33,6 +13,7 @@ int snow_intercept(double Dt, double F, + double new_snow_albedo, double LAI, double Le, double LongOverIn, // incominf LW from sky @@ -295,7 +276,7 @@ snow_intercept(double Dt, if (*IntSnow > 0 || *SnowFall > 0) { /* Snow present or accumulating in the canopy */ - *AlbedoOver = param.SNOW_NEW_SNOW_ALB; // albedo of intercepted snow in canopy + *AlbedoOver = new_snow_albedo; // albedo of intercepted snow in canopy *NetShortOver = (1. - *AlbedoOver) * ShortOverIn; // net SW in canopy Qnet = solve_canopy_energy_bal(0., Dt, soil_con->elevation, diff --git a/vic/vic_run/src/snow_melt.c b/vic/vic_run/src/snow_melt.c index 94bf7cdb2..9b5a14e3e 100644 --- a/vic/vic_run/src/snow_melt.c +++ b/vic/vic_run/src/snow_melt.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate snow accumulation and melt - * - * @section LICENSE - * - * The Variable Infiltration Capacity (VIC) macroscale hydrological model - * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil - * and Environmental Engineering, University of Washington. - * - * The VIC model is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *****************************************************************************/ #include diff --git a/vic/vic_run/src/snow_utility.c b/vic/vic_run/src/snow_utility.c index 7bc91e39b..cbbce45d4 100644 --- a/vic/vic_run/src/snow_utility.c +++ b/vic/vic_run/src/snow_utility.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Collection of snow utilities. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include @@ -252,6 +232,7 @@ new_snow_density(double air_temp) ******************************************************************************/ double snow_albedo(double new_snow, + double new_snow_albedo, double swq, double albedo, double cold_content, @@ -263,23 +244,23 @@ snow_albedo(double new_snow, /** New Snow **/ if (new_snow > param.SNOW_TRACESNOW && cold_content < 0.0) { - albedo = param.SNOW_NEW_SNOW_ALB; + albedo = new_snow_albedo; } /** Aged Snow **/ else if (swq > 0.0) { /* Accumulation season */ if (cold_content < 0.0 && !MELTING) { - albedo = param.SNOW_NEW_SNOW_ALB * pow(param.SNOW_ALB_ACCUM_A, - pow((double) last_snow * dt / - SEC_PER_DAY, - param.SNOW_ALB_ACCUM_B)); + albedo = new_snow_albedo * pow(param.SNOW_ALB_ACCUM_A, + pow((double) last_snow * dt / + SEC_PER_DAY, + param.SNOW_ALB_ACCUM_B)); } /* Melt Season */ else { - albedo = param.SNOW_NEW_SNOW_ALB * pow(param.SNOW_ALB_THAW_A, - pow((double) last_snow * dt / - SEC_PER_DAY, - param.SNOW_ALB_THAW_B)); + albedo = new_snow_albedo * pow(param.SNOW_ALB_THAW_A, + pow((double) last_snow * dt / + SEC_PER_DAY, + param.SNOW_ALB_THAW_B)); } } else { diff --git a/vic/vic_run/src/soil_carbon_balance.c b/vic/vic_run/src/soil_carbon_balance.c index b0eaa1ece..0e0aa0b1f 100644 --- a/vic/vic_run/src/soil_carbon_balance.c +++ b/vic/vic_run/src/soil_carbon_balance.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate soil carbon balance -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include diff --git a/vic/vic_run/src/soil_conduction.c b/vic/vic_run/src/soil_conduction.c index c09dff904..eab4f023a 100644 --- a/vic/vic_run/src/soil_conduction.c +++ b/vic/vic_run/src/soil_conduction.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate soil thermal conduction. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include @@ -133,14 +113,14 @@ volumetric_heat_capacity(double soil_fract, ******************************************************************************/ void set_node_parameters(double *Zsum_node, - double *max_moist_node, + double *porosity_node, double *expt_node, double *bubble_node, double *alpha, double *beta, double *gamma, double *depth, - double *max_moist, + double *porosity, double *expt, double *bubble, int Nnodes, @@ -161,16 +141,13 @@ set_node_parameters(double *Zsum_node, if (Zsum_node[nidx] == Lsum + depth[lidx] && nidx != 0 && lidx != Nlayers - 1) { /* node on layer boundary */ - max_moist_node[nidx] = (max_moist[lidx] / depth[lidx] + - max_moist[lidx + - 1] / - depth[lidx + 1]) / MM_PER_M / 2.; + porosity_node[nidx] = (porosity[lidx] + porosity[lidx + 1]) / 2.; expt_node[nidx] = (expt[lidx] + expt[lidx + 1]) / 2.; bubble_node[nidx] = (bubble[lidx] + bubble[lidx + 1]) / 2.; } else { /* node completely in layer */ - max_moist_node[nidx] = max_moist[lidx] / depth[lidx] / MM_PER_M; + porosity_node[nidx] = porosity[lidx]; expt_node[nidx] = expt[lidx]; bubble_node[nidx] = bubble[lidx]; } @@ -213,7 +190,7 @@ distribute_node_moisture_properties(double *moist_node, double *Cs_node, double *Zsum_node, double *T_node, - double *max_moist_node, + double *porosity_node, double *expt_node, double *bubble_node, double *moist, @@ -257,20 +234,20 @@ distribute_node_moisture_properties(double *moist_node, else { // use constant soil moisture below bottom soil layer moist_node[nidx] = param.SOIL_SLAB_MOIST_FRACT * - max_moist_node[nidx]; + porosity_node[nidx]; } // Check that node moisture does not exceed maximum node moisture - if (moist_node[nidx] - max_moist_node[nidx] > 0) { + if (moist_node[nidx] - porosity_node[nidx] > 0) { // HACK!!!!!!!!!!! - moist_node[nidx] = max_moist_node[nidx]; + moist_node[nidx] = porosity_node[nidx]; } if (T_node[nidx] < 0 && (FS_ACTIVE && options.FROZEN_SOIL)) { /* compute moisture and ice contents */ ice_node[nidx] = moist_node[nidx] - maximum_unfrozen_water(T_node[nidx], - max_moist_node[nidx], + porosity_node[nidx], bubble_node[nidx], expt_node[nidx]); if (ice_node[nidx] < 0) { diff --git a/vic/vic_run/src/soil_thermal_eqn.c b/vic/vic_run/src/soil_thermal_eqn.c index 0bc6eede3..58865b365 100644 --- a/vic/vic_run/src/soil_thermal_eqn.c +++ b/vic/vic_run/src/soil_thermal_eqn.c @@ -1,33 +1,13 @@ /****************************************************************************** * @section DESCRIPTION * -* -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* Soil thermal equation ******************************************************************************/ #include /****************************************************************************** -* @brief +* @brief Soil thermal equation ******************************************************************************/ double soil_thermal_eqn(double T, diff --git a/vic/vic_run/src/solve_snow.c b/vic/vic_run/src/solve_snow.c index 2b9d9e52f..d18602a18 100644 --- a/vic/vic_run/src/solve_snow.c +++ b/vic/vic_run/src/solve_snow.c @@ -4,26 +4,6 @@ * This routine was written to handle the various calls and data * handling needed to solve the various components of the new VIC * snow code for both the full_energy and water_balance models. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include @@ -39,6 +19,7 @@ solve_snow(char overstory, double LongUnderOut, // LW from understory double MIN_RAIN_TEMP, double MAX_SNOW_TEMP, + double new_snow_albedo, double Tcanopy, // canopy air temperature double Tgrnd, // soil surface temperature double air_temp, // air temperature @@ -189,8 +170,10 @@ solve_snow(char overstory, (*ShortUnderIn) *= (*surf_atten); // SW transmitted through canopy ShortOverIn = (1. - (*surf_atten)) * shortwave; // canopy incident SW - ShortOverIn /= veg_var->fcanopy; - ErrorFlag = snow_intercept(dt, 1., + if (veg_var->fcanopy > 0) { + ShortOverIn /= veg_var->fcanopy; + } + ErrorFlag = snow_intercept(dt, 1., new_snow_albedo, veg_var->LAI, (*Le), longwave, LongUnderOut, veg_var->Wdmax, @@ -312,7 +295,9 @@ solve_snow(char overstory, // age snow albedo if no new snowfall // ignore effects of snow dropping from canopy; only consider fresh snow from sky snow->last_snow++; - snow->albedo = snow_albedo(*snowfall, snow->swq, snow->albedo, + snow->albedo = snow_albedo(*snowfall, new_snow_albedo, + snow->swq, + snow->albedo, snow->coldcontent, dt, snow->last_snow, snow->MELTING); (*AlbedoUnder) = @@ -321,7 +306,7 @@ solve_snow(char overstory, else { // set snow albedo to new snow albedo snow->last_snow = 0; - snow->albedo = param.SNOW_NEW_SNOW_ALB; + snow->albedo = new_snow_albedo; (*AlbedoUnder) = snow->albedo; } (*NetShortSnow) = (1.0 - *AlbedoUnder) * (*ShortUnderIn); diff --git a/vic/vic_run/src/surface_fluxes.c b/vic/vic_run/src/surface_fluxes.c index afa4018bc..44e11d2b0 100644 --- a/vic/vic_run/src/surface_fluxes.c +++ b/vic/vic_run/src/surface_fluxes.c @@ -4,26 +4,6 @@ * This routine computes all surface fluxes, and solves the snow accumulation * and ablation algorithm. Solutions are for the current snow band and * vegetation type. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include @@ -114,6 +94,7 @@ surface_fluxes(bool overstory, double snowfall; // snowfall double snow_flux; // heat flux through snowpack double snow_grnd_flux; // ground heat flux into snowpack + double new_snow_albedo; // new snow albedo double tol_under; double tol_over; double *aero_resist_used; @@ -539,10 +520,27 @@ surface_fluxes(bool overstory, LongUnderOut = iter_soil_energy.LongUnderOut; dryFrac = -1; + // set new snow albedo + if (options.MAX_SNOW_ALBEDO) { + // use maximum snow albedo from parameter file + if (iveg != Nveg) { + new_snow_albedo = + vic_run_veg_lib[veg_class].max_snow_albedo; + } + else { + new_snow_albedo = param.SNOW_NEW_SNOW_ALB; + } + } + else { + new_snow_albedo = param.SNOW_NEW_SNOW_ALB; + } + + /** Solve snow accumulation, ablation and interception **/ step_melt = solve_snow(overstory, BareAlbedo, LongUnderOut, param.SNOW_MIN_RAIN_TEMP, param.SNOW_MAX_SNOW_TEMP, + new_snow_albedo, Tcanopy, Tgrnd, Tair, step_prec, snow_grnd_flux, &energy->AlbedoUnder, Le, diff --git a/vic/vic_run/src/svp.c b/vic/vic_run/src/svp.c index 7357b9af9..778456350 100644 --- a/vic/vic_run/src/svp.c +++ b/vic/vic_run/src/svp.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate values related to the saturated vapor pressure. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include diff --git a/vic/vic_run/src/vic_run.c b/vic/vic_run/src/vic_run.c index 5aac937e2..66c29d538 100644 --- a/vic/vic_run/src/vic_run.c +++ b/vic/vic_run/src/vic_run.c @@ -3,26 +3,6 @@ * * This subroutine controls the model core, it solves both the energy and water * balance models, as well as frozen soils. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2016 The Computational Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include @@ -229,7 +209,6 @@ vic_run(force_data_struct *force, for (band = 0; band < Nbands; band++) { /** Solve band only if coverage greater than 0% **/ if (soil_con->AreaFract[band] > 0) { - /* Set local pointers */ cell = &(all_vars->cell[iveg][band]); veg_var = &(all_vars->veg_var[iveg][band]); @@ -237,10 +216,13 @@ vic_run(force_data_struct *force, energy = &(all_vars->energy[iveg][band]); // Convert LAI from global to local - veg_var->LAI /= veg_var->fcanopy; - veg_var->Wdew /= veg_var->fcanopy; - veg_var->Wdmax = veg_var->LAI * param.VEG_LAI_WATER_FACTOR; - snow->snow_canopy /= veg_var->fcanopy; + if (veg_var->fcanopy > 0) { + veg_var->LAI /= veg_var->fcanopy; + veg_var->Wdew /= veg_var->fcanopy; + veg_var->Wdmax = veg_var->LAI * + param.VEG_LAI_WATER_FACTOR; + snow->snow_canopy /= veg_var->fcanopy; + } /****************************************** Initialize Band-dependent Model Parameters diff --git a/vic/vic_run/src/water_energy_balance.c b/vic/vic_run/src/water_energy_balance.c index fa98002a2..23bab16bc 100644 --- a/vic/vic_run/src/water_energy_balance.c +++ b/vic/vic_run/src/water_energy_balance.c @@ -2,26 +2,6 @@ * @section DESCRIPTION * * Calculate snow accumulation and melt for the lake model. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include diff --git a/vic/vic_run/src/water_under_ice.c b/vic/vic_run/src/water_under_ice.c index 980dbb75e..7560e6bf0 100644 --- a/vic/vic_run/src/water_under_ice.c +++ b/vic/vic_run/src/water_under_ice.c @@ -2,26 +2,6 @@ * \section DESCRIPTION * * Calculates temperatures of water column under ice. -* -* \section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include diff --git a/vic/vic_run/src/write_layer.c b/vic/vic_run/src/write_layer.c index d25cfeae0..0b7c55953 100644 --- a/vic/vic_run/src/write_layer.c +++ b/vic/vic_run/src/write_layer.c @@ -6,26 +6,6 @@ * It creates a table of soil moisture values which shows how much liquid water * and ice are contained in the thawed, frozen and unfrozen sublayers of each * soil layer. It also gives the total soil moisture for each layer. -* -* @section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include diff --git a/vic/vic_run/src/write_vegvar.c b/vic/vic_run/src/write_vegvar.c index 6c2ddd7a9..8827c82b8 100644 --- a/vic/vic_run/src/write_vegvar.c +++ b/vic/vic_run/src/write_vegvar.c @@ -6,26 +6,6 @@ * * This routine writes vegetation variables to stdout. Used primarily * for debugging purposes. -* -* \section LICENSE -* -* The Variable Infiltration Capacity (VIC) macroscale hydrological model -* Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil -* and Environmental Engineering, University of Washington. -* -* The VIC model is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along with -* this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #include