Giter Site home page Giter Site logo

dssat-csm-os's Introduction

DSSAT

[DSSAT Homepage] | [About DSSAT] | [Contact us]


The Decision Support System for Agrotechnology Transfer (DSSAT) Version is a software application program that comprises crop simulation models for over 42 crops. The most recent version is v4.8.2 (Check latest RELEASE here).

For DSSAT to be functional it is supported by data base management programs for soil, weather, and crop management and experimental data, and by utilities and application programs. The crop simulation models simulate growth, development and yield as a function of the soil-plant-atmosphere dynamics.

Questions about usage of DSSAT ecosystem [contact us].

Do not know how to use DSSAT? Consider participating the [upcoming DSSAT training workshop]

Read more about DSSAT at [DSSAT Homepage]

The directory structure

DSSAT cropping system model (CSM) design is a modular structure in which components separate along scientific discipline lines and are structured to allow easy replacement or addition of modules. It has one Soil module, a Crop Template module which can simulate different crops by defining species input files, an interface to add individual crop models if they have the same design and interface, a weather module, and a module for dealing with competition for light and water among the soil, plants, and atmosphere. It is also designed for incorporation into various application packages, ranging from those that help researchers adapt and test the CSM to those that operate the DSSAT /CSM to simulate production over time and space for different purposes.

Structure of the code

.
├── build
│   └── ...
├── cmake
│   └── Modules
│       ├── SetCompileFlag.cmake
│       └── SetFortranFlags.cmake
├── Data
|   ├── Genotype
|   ├── Pest
|   └── StandardData 
├── <source files>
├── CMakeLists.txt
├── distclean.cmake
├── README.md
└── ...

Compiling the code

The code is compatible with the CMake utility for generating MakeFile and setting up projects for a variety of IDEs and compilers. To use this feature, first download and install CMake. Then set up a CMake project by pointing to the source code directory and the build directory.

Configuring the build

It is usually preferred that you do an out-of-source build. To do this, create a build/ directory at the top level of your project and build there. This folder is created to organize all working files inside it, avoiding messing up your source folder. During compilation and linking, working folders are created automatically inside this folder. Any libraries created end up in mod/, as well as compiled Fortran .mod files. The executable will end up in bin/.

$ mkdir build
$ cd build
$ cmake ..
$ make

When you do this, temporary CMake files will not be created in your src/ directory.

As written, this template will allow you to specify one of three different sets of compiler flags. The default is DEBUG. You can change this using to RELEASE or DEBUG using

$ cmake .. -DCMAKE_BUILD_TYPE=DEBUG

or

$ cmake .. -DCMAKE_BUILD_TYPE=RELEASE

You can provide all kind of information CMake. See more information at [CMake Tutorial].

One usable examples could be:

$ cmake -G "Unix Makefiles" -DCMAKE_Fortran_COMPILER=ifort ..

In this example we are specifying the fortran compiler and the kind of project we want as result (make file project).

CMakeLists.txt

This file contains all the configuration needed to set up the project.
Edit this file to make your own configuration and add new projects. Comment/Uncomment any lines pertaining to options you may need.

distclean.cmake

This is a CMake script that will remove all files and folder that are created after running make. You can run this code in one of two ways:

  • Execute cmake -P distclean.cmake. (The -P option to cmake will execute a CMake script)
  • Execute make distclean after your Makefile has been generated.

cmake/Modules/

This directory contains CMake scripts that aid in configuring the build system.

SetCompileFlag.cmake

This file defines a function that will test a set of compiler flags to see which one works and adds that flag to a list of compiler flags. This is used to set compile flags when you don't know which compiler will be used.

SetFortranFlags.cmake

This file uses the function from SetCompilerFlag.cmake to set the DEBUG, TESTING, and RELEASE compile flags for your build. You might want to inspect this file and edit the flags to your liking.

Data

This folder contains model-specific data for genotypes, pest, standard model data, code files, DSSATPRO files, etc.

.
├── Genotype
├── Pest
├── StandardData
├── Data.CDE
├── Detail.CDE
├── DSSATPRO.v48
├── ...
└── README.md

The files in this repository can be combined with the files in the Data repository (https://github.com/DSSAT/dssat-csm-data) to replicate the directory structure of the Windows installation of DSSAT v4.8.2 (e.g., with the Genotype directory at the same level as the Alfalfa and other crops directories and the CDE files in the root directory).

Best DSSAT coding practices

See: Non-threatening best practice DSSAT Fortran coding guidelines.

How to Cite DSSAT

If you are planning to use DSSAT in any reports or publications, please make sure to refer to the version number you used. The version and sub-version numbers can be found in the top section of your output files, e.g., 4.8.X (replace X with current version). In addition, please use the following two references for DSSAT and the Cropping System Model. Other related publications can be found in the Documentation section under DSSAT References and Model References.

Hoogenboom, G., C.H. Porter, K.J. Boote, V. Shelia, P.W. Wilkens, U. Singh, J.W. White, S. Asseng, J.I. Lizaso, L.P. Moreno, W. Pavan, R. Ogoshi, L.A. Hunt, G.Y. Tsuji, and J.W. Jones. 2019. The DSSAT crop modeling ecosystem. In: p.173-216 [K.J. Boote, editor] Advances in Crop Modeling for a Sustainable Agriculture. Burleigh Dodds Science Publishing, Cambridge, United Kingdom (https://dx.doi.org/10.19103/AS.2019.0061.10).

See also: The DSSAT crop modeling ecosystem

Hoogenboom, G., C.H. Porter, V. Shelia, K.J. Boote, U. Singh, W. Pavan, F.A.A. Oliveira, L.P. Moreno-Cadena, T.B. Ferreira, J.W. White, J.I. Lizaso, D.N.L. Pequeno, B.A. Kimball, P.D. Alderman, K.R. Thorp, S.V. Cuadra, M.S. Vianna, F.J. Villalobos, W.D. Batchelor, S. Asseng, M.R. Jones, A. Hopf, H.B. Dias, L.A. Hunt, and J.W. Jones. 2023. Decision Support System for Agrotechnology Transfer (DSSAT) Version 4.8.2 (www.DSSAT.net). DSSAT Foundation, Gainesville, Florida, USA.

Jones, J.W., G. Hoogenboom, C.H. Porter, K.J. Boote, W.D. Batchelor, L.A. Hunt, P.W. Wilkens, U. Singh, A.J. Gijsman, and J.T. Ritchie. 2003. The DSSAT cropping system model. European Journal of Agronomy 18:235-265 (https://doi.org/10.1016/S1161-0301(02)00107-7).

See also: The DSSAT cropping system model.

dssat-csm-os's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dssat-csm-os's Issues

summary.out - add column for crop status at end of season

Possible crop statuses:
1 - crop harvested at maturity
2 - crop harvested on reported date
11 - failure to plant (automatic planting)
12 - failure to germinate
21 - crop mature due to slow grain filling
31 - crop died due to heat stress
32 - crop died due to cold stress
33 - crop died due to deficit water stress
34 - crop died due to excess water stress
51 - crop died due to pest damage

DUL higher than SAT when adjusted for SOM

The existing code allows DUL to increase above SAT when DUL is adjusted for SOM. Although DUL and LL are adjusted, there is no concomitant adjustment for SAT:

! Equation to modify DUL depends on soil texture (Gupta & Larson, 1979)
IF (COARSE(L)) THEN
! Coarse soils -- use DUL10
dDUL_SOM = 0.004966 * dOC - 0.2423 * dBD_SOM
ELSE
! Other soils -- use DUL33
dDUL_SOM = 0.002208 * dOC - 0.1434 * dBD_SOM
ENDIF
DUL_SOM(L) = DUL_INIT(L) + dDUL_SOM
! Lower limit
dLL_SOM = 0.002228 * dOC + 0.02671 * dBD_SOM
LL_SOM(L) = LL_INIT(L) + dLL_SOM

As a result, DUL_SOM can be higher than SAT under some conditions. I think we have a couple of options:

  • Place a limit on DUL so that it must be less than SAT
  • Change SAT in an equivalent way that DUL is changed (possibly deriving it from BD_SOM?)

As it is, if DUL does become higher than SAT and SW happens to be equal to SAT then we can get floating point exceptions in OXLAYER (and possibly other places?):

IF (SW(1) .LT. DUL(1)) THEN
SWI = (SAT(1)-DUL(1))/(SAT(1)-SW(1))
ENDIF

PMFRAC is spammed for GET functions in WARNING.OUT

The GET functions in the CSM are trying to get a value for PMFRAC, but they cannot find this value and throw a WARNING message basically for everyday during the simulation creating a spam in the WARNING.OUT file. Also, there is a need to check why PMFRAC is being set to zero and if this is the correct behavior and it is not going to affect anything else in the model.

Below it is a image of an WARNING.OUT file with the warning message:
Screen Shot 2022-06-15 at 3 30 38 PM

4-digit weather file - strange behavior

We generated a slightly imperfect 4-digit weather file using the AgMIP DSSAT translator and got some unexpected results. The format of the file did not have the 2-spaces between the "@" and "DATE" on the header line (i.e., @DATE SRAD instead of @ DATE SRAD). The model ran, but values of SRAD were interpreted incorrectly and the model results were very bad. But there was no error message.

Actually, the more I think about it, the model is behaving correctly because it is trying to right-justify data under the headers. Let's review this at a mini-sprint, but maybe we do nothing.

ADAT and MDAT in FileA

Transferring this issue from the private repo. I'm not sure that it's been resolved yet. Have we differentiated between DOY and DAP in all FileAs?

from @palderman :
I'm going through some final (I hope) checking for the DSSAT R package I've put together and about to start writing up. Anyway, I've been noticing that a lot of the A files (files A?) that are in the DSSAT CSM repo have only 3-digit values in the columns for MDAT and ADAT. For example:

Barley/IEBR8201.BAA
Barley/MTBO7701.BAA
Canola/USON0801.CNA
Canola/USOT0801.CNA

I'm thinking that people have mislabeled those columns (should be ADAP or MDAP?), but I wanted to check to be sure I haven't missed something.

Some additional examples:

Chickpea/ITBW9205.CHA
Chickpea/ITBW9306.CHA

For these examples, it seems that the ADAT values might be simply day of year? In any case, there seems to be some problem.

from @GerritHoogenboom

Yes, that's correct. Currently FileA is read by the model only and there are smarts to associate the Year with the DOY value.

update help file

Help file still has old citations under "How to cite". There might be other issues, too.

Example dataset/invocation of DSSAT

Hi @chporter , @GerritHoogenboom and @frostbytten ,

We are trying to do a test run of DSSAT with some representative inputs in order to make sure that our program analysis pipeline produces outputs that are faithful to the original code.

Would it be possible to get an example dataset and invocation of the dscsm047 executable to see if we can generate the expected outputs? I managed to get the following output:






















RUN    TRT FLO MAT TOPWT HARWT  RAIN  TIRR   CET  PESW  TNUP  TNLF   TSON TSOC
           dap dap kg/ha kg/ha    mm    mm    mm    mm kg/ha kg/ha  kg/ha t/ha
  1 SB   1 -99 -99   -99   -99   -99   -99   -99   -99   -99   -99   -99      0
  2 SB   2 -99 -99   -99   -99   -99   -99   -99   -99   -99   -99   -99      0
  3 SB   3 -99 -99   -99   -99   -99   -99   -99   -99   -99   -99   -99      0
  4 SB   4 -99 -99   -99   -99   -99   -99   -99   -99   -99   -99   -99      0

By copying the following files (from the files sent by @chporter by email on 10/30/2018 from running the ASCE and PET options for a 1978 soybean experiment in Gainesville, FL) to the Data directory:

DSSBatch.v47
FERCH047.SDA
SBGRO047.CUL
SBGRO047.ECO
SBGRO047.SPE
SOIL.SOL
UFGA7801.SBX
dscsm047

and running the following command:

./dscsm047 B DSSBatch.v47

While the program runs to completion, the outputs seem funky, so I am fairly sure I am doing something wrong over here. We would be grateful for any help you could provide on this.

I'm tagging @skdebray , @cl4yton , and @pauldhein to keep them in the loop.

Thanks!

Rice initialization issue?

Run the attached batch file (DTSP8502.RIX, trt 1; UHIH1702.QUX, trt 8; then DTSP8502.RIX, trt 1 again).
Custom_v48.txt

The simulation gives different results for rice simulation the 2nd time.

I haven't had time to fully investigate, but some N variables (total inorganic N, N uptake, nitrification) are different near the end of the season. That's one clue, but more variables need to be investigated before we can draw conclusions. I'm guessing it's a plant module intitialization issue that only showed up after Quinoa genotype files were updated. (!).

XHLAI not reset when DYNAMIC .EQ. SEASINIT in plant.for

When running DSSAT-CSM-CROPSIM-CERES-Wheat in seasonal mode, the XHLAI value is not reset when DYNAMIC .EQ. SEASINIT:

! -------------------------------------------------
! Wheat and Barley CSCER
CASE('CSCER')
CALL CSCERES_Interface (CONTROL, ISWITCH, !Input
& EOP, YREND, NH4, NO3, SNOW, SOILPROP, !Input
& SRFTEMP, ST, SW, TRWUP, WEATHER, YRPLT, HARVFRAC,!Input
& CANHT, HARVRES, KCAN, KEP, MDATE, NSTRES,PORMIN,!Output
& RLV, RWUMX, SENESCE, STGDOY, UNH4, UNO3, XLAI) !Output
IF (DYNAMIC .EQ. SEASINIT) THEN
KTRANS = KEP
KSEVAP = KEP
ELSEIF (DYNAMIC .EQ. INTEGR) THEN
XHLAI = XLAI
ENDIF

When SEASINIT matches PDATE, then this is not a big problem because the DYNAMIC .EQ. INTEGR will reset XHLAI to XLAI soon after simulation starts. However, if final XHLAI from a previous run is not small and SEASINIT is substantially before PDATE (e.g. 3 month spinup), then ET will be simulated much higher than it should be. I believe that this will be a potential problem for any model that (unlike CROPGRO, N-wheat, etc) does not directly calculate XHLAI. One solution that should work would be to modify the code for those models a la:

       IF (DYNAMIC .EQ. SEASINIT) THEN
          KTRANS = KEP
          KSEVAP = KEP
          XHLAI = XLAI
        ELSEIF (DYNAMIC .EQ. INTEGR) THEN
          XHLAI = XLAI
        ENDIF

This way the XHLAI gets reset to whatever the pre-planting value for that crop should be. Presumably the value would usually (always?) be 0 and we could code it up with that assumption, but allowing each model to set this seems like a more flexible option. @chporter @GerritHoogenboom, any thoughts?

Add a nix shell environmment with a fortran compiler.

Please add a nix shell environmment with a fortran compiler.

# a native OSX environment with cmake but not a fortran compiler

⋊> ~/d/s/c/dssat-csm-os on develop ⨯ mkdir build
⋊> ~/d/s/c/dssat-csm-os on develop ⨯ cd build
⋊> ~/d/s/c/d/build on develop ⨯ cmake ..
-- The Fortran compiler identification is unknown
CMake Error at CMakeLists.txt:16 (PROJECT):
  No CMAKE_Fortran_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "FC" or the CMake cache entry CMAKE_Fortran_COMPILER to the full
  path to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/.../build/CMakeFiles/CMakeOutput.log".
See also "/.../build/CMakeFiles/CMakeError.log".
# a nix-shell environment with cmake and gfortran

⋊> ~/d/s/c/dssat-csm-os on develop ⨯ nix-shell
                                                                                                                          
[nix-shell:~/dev/src/crop-model/dssat-csm-os]$ mkdir build

[nix-shell:~/dev/src/crop-model/dssat-csm-os]$ cd build

[nix-shell:~/dev/src/crop-model/dssat-csm-os/build]$ cmake ..
-- The Fortran compiler identification is GNU 7.3.0
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
-- Check for working Fortran compiler: /nix/store/0xc8v7pvb2marnymliad8brbch522szz-gfortran-wrapper-7.3.0/bin/gfortran
-- Check for working Fortran compiler: /nix/store/0xc8v7pvb2marnymliad8brbch522szz-gfortran-wrapper-7.3.0/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /nix/store/0xc8v7pvb2marnymliad8brbch522szz-gfortran-wrapper-7.3.0/bin/gfortran supports Fortran 90
-- Checking whether /nix/store/0xc8v7pvb2marnymliad8brbch522szz-gfortran-wrapper-7.3.0/bin/gfortran supports Fortran 90 -- yes
-- MAJOR: 4 MINOR: 7 MODEL: 5 BUILD: 14 COMMIT: f515732
-- BRANCH: develop
-- COMMIT: f515732544fb8f8c54ce9f863fe4871044de8a2c
-- CMAKE_BUILD_TYPE not given, defaulting to DEBUG
-- Flags
   FFLAGS        -fd-lines-as-comments -fbounds-check -ffixed-line-length-none -ffree-line-length-none -finit-character=32 -cpp -ffpe-trap=invalid,zero,overflow -mmacosx-version-min=10.10.0
   RELEASE      -O3 -DNDEBUG -O3 -funroll-loops -finline-functions
   DEBUG        -g -Og -Wall -fbacktrace -fcheck=bounds
   LINKER
-- Build Info
   BUILD TYPE   DEBUG
   VERSION      4.7.5.14
   I. PREFIX    /var/empty/local
   Executable   dscsm047
-- Configuring done
-- Generating done
-- Build files have been written to: /.../build

Missing release tags?

@chporter

There are commits that look like they would correspond to release tags for 4.7.5.32-4.7.5.41, but no tags for those commits. Is that intentional? If not, could they be added?

Thanks!

about several parameters related to the methane model

Hi, I am trying to do some simulation about paddy field with methane model recently. I see several parameters that may need calibration in MERES model papers(Using a crop/soil simulation model and GIS techniques to assess methane emissions from rice fields in Asia. II. Model validation and sensitivity analysis), two of which I didn't find the location in the code annotations.(the root death constant (δr), the specific root exudation rate (εr),. Can you help me locate it?

Environmental modifications with sequence mode

Environmental modifications need to be set with each rotation. We should be able to set a CO2 value, for example, in the first rotation and have it stay for all rotations.

You can force it by setting the EM level for all rotations.

ch4 output of version 4.8 is 0

Recently, I used the default rice example to simulate that ch4 is not emitted, and n2o and co2 are normal. Is it necessary to set something or not support rice

MZCER048.ECO fails running for multiple treatments on SEAS project

This issues was opened because of an issue on the SEAS (*EXP.DETAILS: SEAS1214MZ 2012-2014 SERIDA EXPERIMENT ASTURIAS, SPAIN) from Dr. Jose and Dr. Boote.

*** Some details:**

Exe: dscsm048.exe (v4.8.0.27)
Install: DSSAT Installation 05 01 2022.zip

The error happens when:

MZCER048.ECO is not in the same folder as the FileX
Note we still have the MZCER048.ECO from the Genotype folder
No_eco

  • Remove Eco file from the Maize folder the model runs just the first treatment out of 38 that we have in the FileX.
  • Example PlantGro.OUT on GBUILD to see clearly how many runs we have:

First_trt

  • IF we had the MZCER048.ECO in the same folder, the problem does not happen:

withECO

  • Example PlantGro.OUT on GBUILD to see clearly how many runs we have:

all_runs

  • Notes

There is no WARNING.OUT or ERROR.OUT related to this problem.
The model simply does not run all the treatments.
Check if this happens for all crops/models.
Check if other Maize experiments show the same problem.
Something is linked with the ECOTYPE file and it is not showing ERROR when it should.
This is a system issue.

XBuild cultivar selection

Not a CSM issue, but since we don't have a repository for XBuild, I'll store this here.

Cultivar selection in XBuild is based on name of cultivar, not Crop-Cultivar ID combination. The cultivar name may be shared among different crops, e.g., "Manitou" which is the name of a drybean cultivar and a wheat cultivar. When "Manitou" is selected as a wheat cultivar, it comes with an ID of IB0012, which is the cultivar ID of the drybean "Manitou" cultivar instead of IB1500 which is the wheat "Manitou" cultivar. The simulation fails because there is no wheat cultivar with ID IB0012. (Worse yet, if there was a wheat cultivar with IB0012, the model would use that.)

In XBuild, the cultivar should be identified by crop and cultivar ID, not by cultivar name.

Issue on CentOS installation

I am getting the bellow error at "make" command.

image

Reproduced the issue on an Ubuntu machine and build performed without any issues

Forage model root CH2O and N mass balance problem

Currently the forage model has a problem with mass balance of root CH2O and N. One contributing issue is related to SRNDOT being calculated twice and SRDOT not being updated after the second calculation.

SRNDOT is first calculated in for_senmob.for:

SRNDOT = TRLNSEN / RFAC3 * 10000. !g/m2

and SRDOT is calculated immediately after:
SRDOT = SRMDOT + SRNDOT

However, SRNDOT is reinitialized to 0 at each integration step in for_roots.for:

but SRDOT is not reinitialized. This results an imbalance in for_grow.for where the code for root dry matter senescence uses SRDOT:
WRDOT = WRDOTN - CRUSRT - NRUSRT/0.16-
& SRDOT - WRIDOT

but the code for CH2O uses SRNDOT and SRMDOT directly:
CROFF = (SRMDOT + SRNDOT) *
& (SENCRV * (RHOR - PCHORTF) + PCHORTF)
& + (SRNDOT + WRIDOT) * RHOR
IF (CROFF. LT. 0.0) THEN
CROFF = 0.0
ENDIF
WRCRDT = WRDOTN * ALPHR - CRUSRT - CROFF
IF (RTWT .GT. 0.0) THEN
WRCRDT = WRCRDT + CADRT - RTCADDM
ENDIF

My reading of the code indicates that the SRNDOT, SRMDOT, and SRDOT calculations should be handled in for_senmob.for only.

Commenting out the line in for_roots.for does seem to resolve the CH2O balance issues, but another N mass imbalance is still present and needs to be tracked back. I'm getting more than 100% root N concentration under some circumstances.

Divide by zero in for_ch2oref.for

There are several lines in for_ch2oref.for where there are no checks to avoid divide by zero:

C-----------------------------------------------------------------------
C      C Status is current CH2O concentration as a proportion of Max CH2O capacity
C-----------------------------------------------------------------------
      CSTATUS = (WCRLF + WCRRT + WCRSR + WCRST  -
     &    (SLDOT * WCRLF/RTWT - LFSCMOB) - (SSDOT * WCRST/STMWT 
     &    - STSCMOB) -
     &    (SRDOT * WCRRT/RTWT - RTSCMOB) - (SSRDOT * WCRSR/STRWT 
     &    - SRSCMOB)) / (LFMCCAP + STMCCAP + RTMCCAP + SRMCCAP)

C-----------------------------------------------------------------------
C      CH2O REFILL capacity is the Max CH2O capacity described above minus 
C      today's CH2O content.
C-----------------------------------------------------------------------

      LFCCAP = LFMCCAP - WCRLF - (SLDOT * WCRLF/WTLF - LFSCMOB)
        IF (LFCCAP .LE. 0.0) LFCCAP = 0.0


      STCCAP = STMCCAP - WCRST - (SSDOT * WCRST/STMWT - STSCMOB)
        IF (STCCAP .LE. 0.0) STCCAP = 0.0


      RTCCAP = RTMCCAP - WCRRT - (SRDOT * WCRRT/RTWT - RTSCMOB)
        IF (RTCCAP .LE. 0.0) RTCCAP = 0.0


      SRCCAP = SRMCCAP - WCRSR - (SSRDOT * WCRSR/STRWT - SRSCMOB)
        IF (SRCCAP .LE. 0.0) SRCCAP = 0.0

"Utilities/run_dssat" is not created on WIN32 platforms, but is unconditionally used when installing.

The CMakeLists.txt specifies the creation of the file conditionally:

[...]
IF(WIN32)
    SET(OSDefinitions "Utilities/OSDefsWINDOWS.for")
    add_definitions(-DWIN32=1})
ELSE()
[...]
	configure_file(
		"${PROJECT_SOURCE_DIR}/Utilities/run_dssat.in"
		"${PROJECT_SOURCE_DIR}/Utilities/run_dssat"
	)
ENDIF(WIN32)
[...]

but mentions it unconditionally when specifying what to install:

[...]
install(FILES Utilities/run_dssat DESTINATION .
	PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
	)
[...]

This caused the Visual Studio 2019 build of the install-project to fail on the system of @GangaRamMaharjan.
The Visual Studio project files were generated with the CMake 3.18.1 GUI.

Also wrapping the install code with IF(WIN32) and ENDIF(WIN32) fixed the problem, IIRC.

Temperature modification link to TAV

Should temperature sensitivity analysis (environmental modification) for TMAX and TMIN include a change to the TAV used in soil temperature calculations? This would be important for soil organic matter, automatic planting, emergence, plant N and soil N processes. We should at least look at the impact.

Check Weather Method and RUNMODE for existing weather files (IPEXP subroutine)

This issue happened when Sequence mode run without .CLI file, the model tried to open the .WTH file. The IPEXP subroutine has a section that build the weather file name based on the weather station on the FileX. However, there is a conflict that is causing error when running WGEN subroutines.

Another subroutine could be created to split each run mode and type of weather file to avoid conflict between different types of runs for the CSM.

The code below indicates what need to be checked:

!     Generated weather data files
      IF (MEWTH .EQ. 'G') THEN
         IF (WSTA1(4:4) .EQ. BLANK) THEN
            IF (YEAR .LT. 2000) THEN
              YR = YEAR - 1900
            ELSE IF (YEAR .LT. 3000) THEN
              YR = YEAR - 2000
            ENDIF
            WRITE (FILEWG(1:12),75) WSTA,YR,'01.WTG'
         ELSE
            WRITE (FILEWG(1:12),76) WSTA,WSTA1,'.WTG'
         ENDIF
         PROCODG = 'WGD'
      ENDIF
!     Interactively generated weather 
      IF (MEWTH .EQ. 'S' .OR. MEWTH .EQ. 'W') THEN
         WRITE (FILEWC(1:12),77) WSTA,'.CLI    '
         PROCODC = 'CLD'
      ENDIF
!     Measured weather data
      IF (MEWTH .EQ. 'M' .OR. RNMODE .EQ. 'Y') THEN
         IF (WSTA1(4:4) .EQ. BLANK) THEN
           IF (YEAR .LT. 2000) THEN
             YR = YEAR - 1900
           ELSE IF (YEAR .LT. 3000) THEN
             YR = YEAR - 2000
           ENDIF
           WRITE (FILEW(1:12),75) WSTA,YR,'01.WTH'
         ELSE
            WRITE(FILEW(1:12),76) WSTA,WSTA1,'.WTH'
         ENDIF
         PROCODW = 'WED'
      ENDIF
      IF (INDEX('GSWM',RNMODE) .LT. 0) THEN
         CALL ERROR (ERRKEY,22,FILEX,LINEXP)
      ENDIF

!     Check for existing FILEW, FILEWC, and FILEWG
      DO I = 1, 3
        SELECT CASE (I)
          CASE (1)
            IF (MEWTH .EQ. 'M' .OR. RNMODE .EQ. 'Y') THEN
              FILE_CHECK = FILEW
              PROCOD = PROCODW
            ELSE
              CYCLE
            ENDIF
          CASE (2)
            IF (MEWTH .EQ. 'G') THEN
              FILE_CHECK = FILEWG
              PROCOD = PROCODG
            ELSE
              CYCLE
            ENDIF
          CASE (3)
            IF (MEWTH .EQ. 'S' .OR. MEWTH .EQ. 'W') THEN
              FILE_CHECK = FILEWC
              PROCOD = PROCODC
            ELSE
              CYCLE
            ENDIF
          CASE DEFAULT; CYCLE
        END SELECT

Forage MOW file needs path

When running a batch file from a directory other than the location of the FileX, the MOW file is not found. Need to add a path to data directory.

Example - I'm running CSM from the CropTest WorkA directory. Forage crops with a MOW file all fail.

Need N2O.csv output

Could simplify the output and only bring over the cumulative values. These are the most important. Do not bring over all the soil layer data. We will probably remove these from the standard output.

Divide by 0 in for_dormancy.for

Documenting another problem of divide by 0 in the forage model. The issue is in for_dormancy.for:

! FNPGD(4) = RDRMG * FNPGD(4)
PPGFAC=CURV(TYPPGD,FNPGD(1),FNPGD(2),FNPGD(3),FNPGD(4),DAYL)
PPGFAC= PPGFAC/RDRMG
PPGFAC=MIN (PPGFAC,1.0)
! FNPMD(4) = RDRMM * FNPMD(4)
PPMFAC=CURV(TYPPMD,FNPMD(1),FNPMD(2),FNPMD(3),FNPMD(4),DAYL)
PPMFAC=PPMFAC/RDRMM
PPMFAC=MIN (PPMFAC,1.0)

I will fix it and submit a pull request.

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Hi, @chporter I have looked at the solved issues. I found one similar solved issue [#7] @adarshp which is also happening to me when I try to simulate Filex. This error is happening to generated filex, not for the default filex. I am attaching the following error, could you please help me to solve it?

**Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0 0x90a70f in ???
#1 0x86692f in pgleaf_
at /tmp/dssat-csm-os/SPAM/ETPHR.for:621
#2 0x8675c4 in canopg_
at /tmp/dssat-csm-os/SPAM/ETPHR.for:374
#3 0x868340 in etphr_
at /tmp/dssat-csm-os/SPAM/ETPHR.for:218
#4 0x863064 in etphot_
at /tmp/dssat-csm-os/SPAM/ETPHOT.for:569
#5 0x86f581 in spam_
at /tmp/dssat-csm-os/SPAM/SPAM.for:435
#6 0x44cf8a in land_
at /tmp/dssat-csm-os/CSM_Main/LAND.for:338
#7 0x44b6c9 in csm
at /tmp/dssat-csm-os/CSM_Main/CSM.for:512
#8 0x44c6db in main
at /tmp/dssat-csm-os/CSM_Main/CSM.for:82**

SAMUCA syntax for portability

Related to issue #32

SC_rm_file.f90

and change lines 18 and 50 which currently have:

inquire(file=io, exist=file_exists)

to

inquire(unit=io, exist=file_exists)

as the "file" tag can only accept character input, but the unit tag can accept integer input, and io is declared to be an integer.

After making that change the compilation successfully completed and I was able to produce the dssat executable.

Problem with path for OilCrop-Sunflower in CMakelists.txt

The path for OilCrop-Sunflower in CMakelists.txt lacks a capital "C":

dssat-csm-os/CMakeLists.txt

Lines 507 to 516 in 37d00a5

"Plant/Oilcrop-Sunflower/SU_CERES.for"
"Plant/Oilcrop-Sunflower/SU_GROSUB.for"
"Plant/Oilcrop-Sunflower/SU_KUPTAK.for"
"Plant/Oilcrop-Sunflower/SU_NFACTO.for"
"Plant/Oilcrop-Sunflower/SU_NUPTAK.for"
"Plant/Oilcrop-Sunflower/SU_OPGROW.for"
"Plant/Oilcrop-Sunflower/SU_OPHARV.for"
"Plant/Oilcrop-Sunflower/SU_OPNIT.for"
"Plant/Oilcrop-Sunflower/SU_PHENOL.for"
"Plant/Oilcrop-Sunflower/SU_ROOTS.for"

This is a problem for compiling on Linux (and possibly on Mac?). I'll submit a pull request in just a sec.

MZCER planting failure

When something in the model fails prior to planting, the planting date is set to 9999999 (or something like that) in Summary.OUT. However the harvest date is set to the date of failure. This causes problems when we analyze massive outputs from pythia. We nee to change the planting AND harvest dates written to Summary.OUT

batch mode failure for SC

When running the ALL.v48 file, the simulations stop after SXPG6801.SCX.
When running just sugarcane, all is OK.
When going from SXPG6801.SCX to AUTA8101.SUX, all is OK, so it seems to be the UFBG files. However, these run OK by themselves.

Just noting this here so we don't forget.

Plant stages in MgmtEvent.OUT

If more than one stage occurs on a day, only the last one is printed in MgmtEvents.OUT.
OPVIEW.for line 251.

In OPVIEW:
!Store current Stage, STGDOY and STNAME
CALL PUT('PLANT','iSTAGE', I)
CALL PUT('PLANT','iSTGDOY', STGDOY(I))
CALL PUT('PLANT','iSTNAME', STNAME(I))

In MgmtOps.for:
! Retrieve current Stage, STGDOY and STNAME
CALL GET('PLANT','iSTAGE', iSTAGE)
CALL GET('PLANT','iSTGDOY', iSTGDOY)
CALL GET('PLANT','iSTNAME', iSTNAME)

The issue is that one value is sent at at time. Only the last value "PUT" will be retrieved with "GET". Need to send the entire array if we want to print more than one. Or send the whole array STNAME and STGDOY thru the argument lists. Or create a module?

Using CMAKE and gfortran to compile DSSAT in Windows

Hello, I was able to install CMAKE and gfortran on my Windows 10 system. I downloaded the latest dssat source code using the git url.

Using the Cmake GUI, I indicated the location of the DSSAT source code and a separate build directory as shown in the screenshot:
Untitled
I run the "Configure" followed by the "Generate" commands, but the DSSAT executable is not produced. I'm not sure what else to do to successfully compile DSSAT on my system.

The Documentation folder is missing.

In the Structure of the code section there's a tree showing, among other things, where to find the Documentation folder. The Data section mentions documentation too. Is this folder missing in the source repository or is it a build output?

.
└── Data
    ├── Documentation

Soil nitrogen is not balanced for CROPSIM models

The plant N uptake for the CROPSIM models (CSCER,CSCRP,CSCAS,CSYCA) is done when DYNAMIC == RATE while for the CROPGRO models is when DYNAMIC == INTEGR. The CROPGRO models have a soil N balance of 0 while it is not like that for the CROPSIM models.
image

image

cultivar version #

Implement cultivar (and eco and spe) version numbers with code checking for the correct version.
Priority: rice and NWheat

Negative RADSH

@chporter and @kthorp ,

I'm getting floating point errors with the forage model related to the fact that RADSH is negative due to ADDF being negative in CANABS() in ETPHOT.for. When I uncomment the check for ADDF < 0.0 (see below), the problem goes away. The issue seems to be limited to situations with very low LAI.

Is there a reason why the checks for negative numbers are commented out in CANABS() in ETPHOT.for? Is there any problem with allowing ADDF, ADDFSL, etc to be set to zero when the original calculation is negative? See here:

dssat-csm-os/SPAM/ETPHOT.for

Lines 1793 to 1800 in a20a2b5

C-KRT****************************
C-KRT ADDF = ADIR - ADDR
!-CHP ADDF = MAX(0.0,ADIR-ADDR)
ADDF = ADIR - ADDR
! IF (ADDF < 0.0) THEN
! ADDF = 0.0
! ENDIF
C-KRT****************************

dssat-csm-os/SPAM/ETPHOT.for

Lines 1814 to 1827 in a20a2b5

C-KRT************************************
C-KRT ADDFSL = ADIRSL - ADDRSL
C-KRT ADDFSH = ADDF - ADDFSL
!-CHP ADDFSL = MAX(0.0,ADIRSL - ADDRSL)
!-CHP ADDFSH = MAX(0.0,ADDF - ADDFSL)
ADDFSL = ADIRSL - ADDRSL
! IF (ADDFSL < 0.0) THEN
! ADDFSL = 0.0
! ENDIF
ADDFSH = ADDF - ADDFSL
! IF (ADDFSH < 0.0) THEN
! ADDFSH = 0.0
! ENDIF
C-KRT************************************

dssat-csm-os/SPAM/ETPHOT.for

Lines 1862 to 1869 in a20a2b5

C-KRT********************************
C-KRT ADIFSH = ADIF - ADIFSL
!-CHP ADIFSH = MAX(0.0,ADIF - ADIFSL)
ADIFSH = ADIF - ADIFSL
! IF (ADIFSH < 0.0) THEN
! ADIFSH = 0.0
! ENDIF
C-KRT********************************

dssat-csm-os/SPAM/ETPHOT.for

Lines 1883 to 1890 in a20a2b5

C-KRT********************************
C-KRT AREFSL = AREF - AREFSH
!-CHP AREFSL = MAX(0.0,AREF - AREFSH)
AREFSL = AREF - AREFSH
! IF (AREFSL < 0.0) THEN
! AREFSL = 0.0
! ENDIF
C-KRT********************************

Confusing calculation of CMINESR vs CMINERT in FOR_SENMOB()

The calculation of CMINESR is different from the calculation of CMINERT in FOR_SENMOB():

CMINERT = CMOBMX * (DTX + DXR57)* PPMFAC *
& (WCRRT - RTWT * PCHORTF)
RTCMINE = MAX(RTSCMOB, CMINERT)
CMINESR = CMOBSR * (DTX + DXR57)* (WCRSR - STRWT * PCHOSRF)
SRCMINE = MAX(SRSCMOB, CMINESR)

Note that the calculation for CMINERT contains PPMFAC while the calculation for CMINESR does not. PPMFAC is the factor that reduces mobilization of carbohydrate/nitrogen reserves due to dormancy. I wonder if it should be the other way around.

It seems to me that dormancy should affect remobilization from the storage organ but not the other tissues. Alternatively, I suppose it might be okay to have it affect root and storage. However, it makes no sense to me that it would affect only root.

Scratch that.

The calculation for CMOBSR already has PPMFAC in it:

CMOBSR = (CMOBSRN + LAIMOBR *
& (CMOBSRX - CMOBSRN)) * PPMFAC

I guess it's not wrong. Just confusing. I think we should consider moving PPMFAC down to the place where CMINESR is calculated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.