Git Product home page Git Product logo

soiltemperaturemodels's People

Contributors

bergm avatar cyrillemidingoyi avatar fabiooliveira72 avatar plecharpent avatar pradal avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

soiltemperaturemodels's Issues

SIRIUS-Quality Double definition of variable at Fortran functions

File calculatesoiltemperature.f90 at function UpdateTemperature has a double definition of variable 'Temperature'.

It needs to be checked if this is right or wrong. Because there is a compilation error where one is output and input at same time.

The code was changed manually. Input function variable Temperature was modified to Temp.

STICS Temp_profile array in layers_temp.f90 access wrong indexes during runtime.

STICS Stand alone model at subroutine layers_temp.f90 has the following source code generated for Fortran:

layer_temp(z - 1+1) = sum(temp_profile((up_depth(z - 1+1) + 1 -  &
                    1):up_depth((z + 1 - 1)+1))) / layer_thick((z - 1)+1)

However, this generates an issue when accessing the indexes of tem_profile, were up_depth points to a wrong indexes.
The code should be changed to match the original source code which is:

layer_temp(z) = sum(temp_profile((up_depth(z) + 1 &
                    ):up_depth(z+1))) / layer_thick((z - 1)+1)

Informations for BioMA-Parton variables

  • SoilTemperatureByLayers is not initialized, what value should I use ?
  • SurfaceSoilTemperature / SurfaceTemperatureMaximum / SurfaceTemperatureMinimul are not initialized, what values should I use ?

Informations about Simplace variable

  • cAVT (Constant Temperature of deepest soil layer) : how do I get or calculate this value ?
  • iSoilSurfaceTemperature (Temperature at soil surface) : this value is not initialized, but is needed to calculate the soil temperature. So what value should I use for the initialization ?
  • iSoilWaterContent (Content of water in Soil) : the value is in mm in the model, but in cm³/cm³ in the input data, how do I do the conversion knowing the value is between 1.5 and 20.0, according to the description of the model ?
  • iTempMax/iTempMin (Max/Min temperature) : is it the air temperature ?

SIRIUS-Quality Commented subroutine to calculate hourly soil temperature

WARNING: Commented subroutine to calculate hourly soil temperature. There was a floating point error when running with AMEI_DSSAT-Driver using the Crop2ML generated subroutine.
Teiki mentioned that was better to commented out because it is not being used and the subroutine call in the module was commented and it worked.

Commented subroutine in SoilTemperaturecomponent.f90

!        call model_calculatehourlysoiltemperature(c, dayLength, maxTSoil, b,  &
!                a, minTSoil,hourlySoilT)

STICS C2ML generated Fortran source code with invalid access to array indexes

The code translated by Crop2ML in file layer_temp.f90 at layer_thickness2depth subroutine, produced an invalid statement for the layer_depth indexes. The index in Fortran should start in 1 and the math done creates always an index of 0.

Note that the Loop always starts count at 1 for z. See the code below.

layer_depth(z - 1+1) = sum(layer_thick(1 - 1:z))
New code:
layer_depth(z - 1+1) = sum(layer_thick(1:z))

SIMPLACE C2ML generated Fortran source code for log function has division by zero

File snowcovercalcutor.f90 at subroutine init_snowcovercalculator has a problem with C2ML generated Fortran source code for log function. The function in SIMPLACE init_snowcovercalculator is doing the following math:

Albedo = 0.0226 * LOG(cCarbonContent) / LOG(REAL(10)) + 0.1502

This math generates a division by zero in Fortran. The expression LOG(0.0) is considered invalid by gfortran (not ifort, I think) when delta is 0 constant. It is invalid.
The code was changed manually. A condition to check if cCarbonContent is greater than 0 was provided. See code below:

IF(cCarbonContent .GT. 0.0)THEN
   Albedo = 0.0226 * LOG10(cCarbonContent) / LOG(REAL(10)) + 0.1502
ENDIF

BIOMA Parton and SWAT issue for Fortran generated code for variable naming declared with underscore at the beginning

Invalid character in the syntax for Fortran when declared the variable names. Fortran does not accept '' in the beginning to declare variables. All occurrences of '' where changed to ''. See example below:

REAL:: _SoilProfileDepthmm
REAL:: _TotalWaterContentmm
REAL:: _MaximumDumpingDepth
REAL:: _DumpingDepth
REAL:: _ScalingFactor
REAL:: _DepthBottom
REAL:: _RatioCenter
REAL:: _DepthFactor
REAL:: _DepthCenterLayer

As example, the name of variables should be changed to something like:

REAL:: SoilProfileDepthmm
REAL:: TotalWaterContentmm
REAL:: MaximumDumpingDepth
REAL:: DumpingDepth
REAL:: ScalingFactor
REAL:: DepthBottom
REAL:: RatioCenter
REAL:: DepthFactor
REAL:: DepthCenterLayer

Several subroutines contain this issue for BIOMA Parton and BIOMA SWAT only.

DSSAT_EPICST component

@fabiooliveira72
@chporter
You have made changes (assign TDL at 0.0) in the "rate calculation" part and I would like to know if it should be so.

rate calculation

    TDL = 0.0

Is it not the value calculated by the initialization that should be used and updated day by day (like in your original code?

SIRIUS-Quality Fortran FUNCTION generated by Crop2ML does not have a type in the declaration

Fortran FUNCTION generated by Crop2ML does not have a type in the declaration to match with the RESULT. If there is no type in the function it is needed to declare the variable inside the scope of the function. If not, the compiler generates an error and cannot compile it.

			    FUNCTION SoilTempB(weatherMinTemp, &
			        deepTemperature) RESULT(res_cyml)
			        IMPLICIT NONE
			        REAL, INTENT(IN) :: weatherMinTemp
			        REAL, INTENT(IN) :: deepTemperature
			        INTEGER:: i_cyml_r
			        res_cyml = (weatherMinTemp + deepTemperature) / 2.0
			    END FUNCTION SoilTempB

The FUNCTION generated by CROP2ML for Fortran is missing the type.
Example, FUNCTION SoilTempB(Args) RESULT(res_cyml) must have the type explicit in the function.

REAL FUNCTION SoilTempB(Args) RESULT(res_cyml). If not there is a compilation error.

The code was changed manually added REAL type in the beginning of the function declaration.

Unclear meaning and treatment of variables

SoilTemperatureMax/Min, SoilSurfaceTemperatureMax/Min
Temp_profile prev_temp_profile
Temp_profile prev_canopy_temp
CalculateSoilTemperature heatFlux

... are not clear - what does this exactly mean in the different models

STICS Fortran source code generated for Dynamic memory allocation statement

Dynamically allocated memory for some variables in STICS need to be declared as allocatable. CROP2ML is not generating it as allocatable, this produces a compilation issue to access the arrays. See below which are the files and variables change manually input variables in

Layers_temp.f90, line ~10-13

> REAL ,  DIMENSION(: ), INTENT(IN) :: temp_profile
> REAL ,  DIMENSION(: ), INTENT(OUT) :: layer_temp
New code:
> REAL ,  ALLOCATABLE,  DIMENSION(: ), INTENT(IN) :: temp_profile
> REAL ,  ALLOCATABLE, DIMENSION(: ), INTENT(OUT) :: layer_temp

Temp_profile.f90, line ~17:

> REAL , DIMENSION(: ), INTENT(OUT) :: prev_temp_profile
New code:
> REAL , ALLOCATABLE, DIMENSION(: ), INTENT(OUT) :: prev_temp_profile
And line ~127:
> REAL , DIMENSION(: ), INTENT(OUT) :: temp_profile
New code:
> REAL , ALLOCATABLE, DIMENSION(: ), INTENT(OUT) :: temp_profile
					
Update.f90 needs allocatable and dimension is wrong too needs to be changed (1) to (:). in line 14:
> REAL , ALLOCATABLE, DIMENSION(: ), INTENT(OUT) :: prev_temp_profile
New code:
> REAL , ALLOCATABLE, DIMENSION(: ), INTENT(OUT) :: prev_temp_profile
				
Soil_tempComponent.f90 needs allocatable the following variables, line ~27:
> REAL , ALLOCATABLE, DIMENSION(: ), INTENT(INOUT) :: prev_temp_profile
> REAL , ALLOCATABLE, DIMENSION(: ), INTENT(OUT) :: temp_profile
> REAL , ALLOCATABLE, DIMENSION(: ), INTENT(OUT) :: layer_temp

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.