Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • foresee/4C
  • gutsch/4C
2 results
Show changes
// Generated by ResEdit 1.5.9
// Copyright (C) 2006-2011
// http://www.resedit.net
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "4C_dialogs.h"
//
// Bitmap resources
//
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDB_BITMAP1 BITMAP "4c_logo_klein.bmp"
//
// Dialog resources
//
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_coh_daily DIALOG 100, 0, 540, 213
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "4C"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "OK", ID_DAILYCOH_BUTTON_OK, 380, 190, 50, 14
PUSHBUTTON "Cancel", ID_CANCEL_OUTF, 439, 190, 50, 14
GROUPBOX "", IDC_STATIC_year, 10, 10, 510, 170
AUTOCHECKBOX "", IDC_CHECK_y1, 26, 30, 271, 8
AUTOCHECKBOX "", IDC_CHECK_y2, 26, 45, 271, 8
AUTOCHECKBOX "", IDC_CHECK_y3, 26, 60, 271, 8
AUTOCHECKBOX "", IDC_CHECK_y4, 26, 75, 271, 8
AUTOCHECKBOX "", IDC_CHECK_y5, 25, 90, 271, 8
AUTOCHECKBOX "", IDC_CHECK_y6, 26, 105, 271, 8
AUTOCHECKBOX "", IDC_CHECK_y7, 26, 120, 271, 8
AUTOCHECKBOX "", IDC_CHECK_y8, 26, 135, 271, 8
AUTOCHECKBOX "", IDC_CHECK_y9, 26, 150, 271, 8
AUTOCHECKBOX "", IDC_CHECK_y10, 26, 165, 217, 8
AUTOCHECKBOX "", IDC_CHECK_y11, 295, 30, 217, 8
AUTOCHECKBOX "", IDC_CHECK_y12, 295, 45, 217, 8
AUTOCHECKBOX "", IDC_CHECK_y13, 295, 60, 217, 8
AUTOCHECKBOX "", IDC_CHECK_y14, 295, 75, 217, 8
AUTOCHECKBOX "", IDC_CHECK_y15, 295, 90, 217, 8
AUTOCHECKBOX "", IDC_CHECK_y16, 295, 105, 217, 8
LTEXT " Choose daily cohort output files ", IDC_STATIC_yfile, 25, 10, 107, 8, SS_LEFT
AUTOCHECKBOX "", IDC_CHECK_y17, 295, 120, 217, 8
AUTOCHECKBOX "", IDC_CHECK_y18, 295, 135, 217, 8
PUSHBUTTON "Select all", ID_DAILYCOH_BUTTON_SELECT, 321, 190, 50, 14
PUSHBUTTON "Deselect all", ID_DAILYCOH_BUTTON_DESELECT, 262, 190, 50, 14
AUTOCHECKBOX "", IDC_CHECK_y19, 295, 150, 217, 8
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_coh_yearly DIALOG 0, 0, 718, 318
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "4C"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "OK", ID_YEARLYCOH_BUTTON_OK, 559, 290, 50, 14
PUSHBUTTON "Cancel", ID_CANCEL_OUTF, 625, 290, 50, 14
GROUPBOX "", IDC_STATIC_year, 15, 10, 683, 275
AUTOCHECKBOX "", IDC_CHECK_y1, 21, 30, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y2, 20, 45, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y3, 21, 60, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y4, 21, 75, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y5, 21, 90, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y6, 21, 105, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y7, 21, 120, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y8, 21, 135, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y9, 21, 150, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y10, 21, 165, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y11, 21, 180, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y12, 21, 195, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y13, 21, 210, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y14, 21, 225, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y15, 21, 240, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y16, 21, 255, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y17, 21, 270, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y18, 244, 30, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y19, 244, 45, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y20, 244, 60, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y21, 244, 75, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y22, 244, 90, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y23, 244, 105, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y24, 244, 120, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y25, 244, 135, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y26, 244, 150, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y27, 244, 165, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y28, 244, 180, 222, 8
LTEXT " Choose yearly cohort output files ", IDC_STATIC_yfile, 30, 10, 111, 8, SS_LEFT
AUTOCHECKBOX "", IDC_CHECK_y29, 244, 195, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y30, 244, 210, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y31, 244, 225, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y32, 244, 240, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y33, 244, 255, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y34, 244, 270, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y35, 465, 30, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y36, 465, 45, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y37, 465, 60, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y38, 465, 75, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y39, 465, 90, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y40, 465, 105, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y41, 465, 120, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y42, 465, 135, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y43, 465, 150, 222, 8
PUSHBUTTON "Select all", ID_YEARLYCOH_BUTTON_SELECT, 493, 290, 50, 14
PUSHBUTTON "Deselect all", ID_YEARLYCOH_BUTTON_DESELECT, 427, 290, 50, 14
AUTOCHECKBOX "", IDC_CHECK_y44, 465, 165, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y45, 465, 178, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y46, 465, 193, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y47, 465, 210, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y48, 465, 225, 222, 8
AUTOCHECKBOX "", IDC_CHECK_y49, 465, 240, 222, 13
AUTOCHECKBOX "", IDC_CHECK_y50, 465, 255, 222, 13
AUTOCHECKBOX "", IDC_CHECK_y51, 465, 270, 222, 13
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_ctr DIALOG 100, 0, 280, 349
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "4C"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "OK", ID_CTR_BUTTON_OK, 147, 319, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 207, 319, 50, 14
LTEXT "Edit simulation control file", IDC_STATIC_simul, 15, 14, 91, 11, SS_LEFT
GROUPBOX "Run option control", IDC_STATIC_runo, 15, 30, 241, 173
LTEXT "Run option", IDC_STATIC_runv, 23, 47, 36, 8, SS_LEFT
LTEXT "Number of runs", IDC_STATIC_runnr, 23, 68, 49, 8, SS_LEFT
COMBOBOX IDC_COMBO_runv, 69, 47, 175, 98, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
EDITTEXT IDC_EDIT_runnr, 162, 67, 40, 12, ES_AUTOHSCROLL
LTEXT "Number of simulation years", IDC_STATIC_yearn, 23, 89, 85, 8, SS_LEFT
LTEXT "Start year", IDC_STATIC_start, 23, 111, 31, 8, SS_LEFT
EDITTEXT IDC_EDIT_yearn, 162, 89, 40, 14, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_start, 162, 111, 40, 14, ES_AUTOHSCROLL
LTEXT "Patch size [m]", IDC_STATIC_patch, 23, 134, 47, 8, SS_LEFT
EDITTEXT IDC_EDIT_patch, 162, 134, 40, 14, ES_AUTOHSCROLL
LTEXT "Thickness of foliage layers [cm]", IDC_STATIC_thickf, 23, 158, 100, 8, SS_LEFT
LTEXT "Time step photosynthesis calculations [d]", IDC_STATIC_timeph, 23, 184, 130, 8, SS_LEFT
EDITTEXT IDC_EDIT_thickf, 162, 157, 40, 14, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_timeph, 162, 180, 40, 14, ES_AUTOHSCROLL
GROUPBOX "Run flags control", IDC_STATIC_runo3, 15, 214, 240, 93
COMBOBOX IDC_COMBO_runv3, 65, 235, 101, 98, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
LTEXT "Run number", IDC_STATIC_runv3, 23, 238, 40, 8, SS_LEFT
DEFPUSHBUTTON "Set Flags", ID_CTR_BUTTON_FLAGS, 177, 281, 65, 14
DEFPUSHBUTTON "Set Files", ID_CTR_BUTTON_FILES, 177, 258, 65, 14
DEFPUSHBUTTON "Apply", ID_CTR_BUTTON_RUNNR, 213, 66, 30, 14
DEFPUSHBUTTON "Change Output Id", ID_CTR_BUTTON_IDS, 178, 235, 64, 14
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_daily DIALOG 0, 0, 568, 221
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "4C"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "OK", ID_DAILY_BUTTON_OK, 408, 195, 50, 14
PUSHBUTTON "Cancel", ID_CANCEL_OUTF, 471, 195, 50, 14
GROUPBOX "", IDC_STATIC_day, 11, 14, 534, 171
AUTOCHECKBOX "", IDC_CHECK_y1, 37, 30, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y2, 37, 45, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y3, 37, 60, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y4, 37, 75, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y5, 37, 90, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y6, 37, 105, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y7, 37, 120, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y8, 37, 135, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y9, 37, 150, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y10, 37, 165, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y11, 284, 30, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y12, 284, 45, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y13, 284, 60, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y14, 284, 75, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y15, 284, 90, 240, 8
LTEXT " Choose daily output files ", IDC_STATIC_yfile, 22, 15, 85, 8, SS_LEFT
AUTOCHECKBOX "", IDC_CHECK_y16, 284, 105, 240, 8
PUSHBUTTON "Select all", ID_DAILY_BUTTON_SELECT, 345, 195, 50, 14
PUSHBUTTON "Deselect all", ID_DAILY_BUTTON_DESELECT, 282, 195, 50, 14
AUTOCHECKBOX "", IDC_CHECK_y17, 284, 120, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y18, 284, 135, 240, 8
AUTOCHECKBOX "", IDC_CHECK_y19, 284, 150, 240, 8
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_default_dir DIALOG 10, 100, 320, 99
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "OK", ID_DEFAULT_DIR_BUTTON_OK, 138, 79, 50, 14
LTEXT "Default input and output directories", IDC_STATIC_4C, 15, 4, 216, 9, SS_LEFT
LTEXT "Input directory", IDC_STATIC_dirin, 16, 31, 51, 8, SS_LEFT
EDITTEXT IDC_EDIT_DIR_IN, 81, 27, 210, 12, ES_AUTOHSCROLL | ES_MULTILINE
LTEXT "Output directory", IDC_STATIC_dirout, 16, 56, 51, 8, SS_LEFT
EDITTEXT IDC_EDIT_DIR_OUT, 81, 52, 210, 12, ES_AUTOHSCROLL | ES_MULTILINE
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_files DIALOG 100, 0, 310, 330
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "4C"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "OK", ID_FILES_BUTTON_OK, 189, 307, 50, 14
PUSHBUTTON "Cancel", ID_CANCEL_FILES, 251, 307, 50, 14
GROUPBOX "Model input files", IDC_STATIC_files, 7, 10, 295, 209
LTEXT "Species parameter file", IDC_STATIC_specpar, 16, 51, 70, 8, SS_LEFT
EDITTEXT IDC_EDIT_specpar, 109, 53, 146, 12, ES_AUTOHSCROLL | ES_MULTILINE
PUSHBUTTON "Browse", IDC_BUTTON_specpar, 259, 54, 35, 12, WS_GROUP
LTEXT "Soil parameter file", IDC_STATIC_sop, 16, 69, 56, 8, SS_LEFT
LTEXT "Soil initialisation file", IDC_STATIC_soi, 16, 87, 60, 8, SS_LEFT
EDITTEXT IDC_EDIT_sop, 109, 70, 146, 12, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_soi, 109, 87, 146, 12, ES_AUTOHSCROLL
LTEXT "Stand initialisation file", IDC_STATIC_ini, 13, 238, 68, 8, SS_LEFT
EDITTEXT IDC_EDIT_ini, 107, 235, 145, 14, ES_AUTOHSCROLL
GROUPBOX "", IDC_STATIC_ini1, 7, 222, 295, 73
LTEXT "Stand identifier", IDC_STATIC_standid, 15, 256, 48, 8, SS_LEFT
PUSHBUTTON "Browse", IDC_BUTTON_ini, 259, 235, 35, 12, WS_GROUP
LTEXT "Management file", IDC_STATIC_man, 16, 107, 53, 8, SS_LEFT
EDITTEXT IDC_EDIT_man, 109, 104, 146, 12, ES_AUTOHSCROLL
LTEXT "Deposition data file", IDC_STATIC_dep, 16, 123, 61, 8, SS_LEFT
EDITTEXT IDC_EDIT_dep, 109, 121, 146, 12, ES_AUTOHSCROLL
LTEXT " N-reduction ( RedN) file", IDC_STATIC_red, 16, 141, 77, 8, SS_LEFT
LTEXT "Litter intilisation file", IDC_STATIC_lit, 16, 158, 59, 8, SS_LEFT
EDITTEXT IDC_EDIT_red, 109, 139, 146, 12, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_lit, 109, 155, 146, 12, ES_AUTOHSCROLL
PUSHBUTTON "Browse", IDC_BUTTON_sop, 259, 71, 35, 12, WS_GROUP
PUSHBUTTON "Browse", IDC_BUTTON_soi, 259, 88, 35, 12, WS_GROUP
PUSHBUTTON "Browse", IDC_BUTTON_man, 259, 105, 35, 12, WS_GROUP
PUSHBUTTON "Browse", IDC_BUTTON_dep, 259, 123, 35, 12, WS_GROUP
PUSHBUTTON "Browse", IDC_BUTTON_red, 259, 139, 35, 12, WS_GROUP
PUSHBUTTON "Browse", IDC_BUTTON_lit, 259, 156, 35, 12, WS_GROUP
LTEXT "Climate data file", IDC_STATIC_cli, 17, 32, 70, 8, SS_LEFT
EDITTEXT IDC_EDIT_cli, 110, 34, 146, 12, ES_AUTOHSCROLL | ES_MULTILINE
PUSHBUTTON "Browse", IDC_BUTTON_cli, 260, 35, 35, 12, WS_GROUP
COMBOBOX IDC_COMBO_standid, 106, 254, 85, 77, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
LTEXT "WPM spinup intilisation file", IDC_STATIC_spinup, 15, 177, 84, 8, SS_LEFT
EDITTEXT IDC_EDIT_wpm, 109, 174, 146, 12, ES_AUTOHSCROLL
PUSHBUTTON "Browse", IDC_BUTTON_wpm, 259, 175, 35, 12, WS_GROUP
EDITTEXT IDC_EDIT_standid, 106, 273, 76, 14, ES_AUTOHSCROLL
LTEXT "Measurement file", IDC_STATIC_mes, 16, 194, 54, 8, SS_LEFT
EDITTEXT IDC_EDIT_mes, 110, 191, 146, 12, ES_AUTOHSCROLL
PUSHBUTTON "Browse", IDC_BUTTON_mes, 260, 191, 35, 12, WS_GROUP
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_flags DIALOGEX 100, 0, 580, 297
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW
CAPTION "4C"
FONT 8, "MS Sans Serif", 0, 0, 1
{
DEFPUSHBUTTON "OK", ID_FLAGS_BUTTON_OK, 443, 263, 50, 14
PUSHBUTTON "Cancel", ID_CANCEL_FLAGS, 509, 262, 50, 14
LTEXT "Mortality flag (flag_mort) ", IDC_STATIC_mort, 18, 33, 77, 8, SS_LEFT
LTEXT "Regeneration flag (flag_reg) ", IDC_STATIC_reg, 18, 50, 90, 8, SS_LEFT
LTEXT "Use FORSKA factors (flag_forska)", IDC_STATIC_forska, 18, 67, 113, 13, WS_TABSTOP | NOT WS_GROUP | SS_LEFT
LTEXT "Stand initialization flag (flag_stand)", IDC_STATIC_stand, 18, 84, 109, 8, WS_TABSTOP | NOT WS_GROUP | SS_LEFT
LTEXT "Soil vegetation flag (flag_sveg)", IDC_STATIC_sveg, 18, 101, 98, 8, SS_LEFT
LTEXT "Management flag (flag_mg)", IDC_STATIC_mg, 18, 118, 86, 8, SS_LEFT
LTEXT "Disturbance flag (flag_dis)", IDC_STATIC_dis, 18, 135, 82, 8, SS_LEFT
LTEXT "Ligth algorithm number (flag_light)", IDC_STATIC_light, 18, 152, 106, 8, SS_LEFT
LTEXT "Foliage-height relationship (flag_folhei)", IDC_STATIC_folhei, 18, 169, 120, 8, SS_LEFT
COMBOBOX IDC_COMBO_mort, 143, 33, 133, 42, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_reg, 143, 50, 133, 116, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL
COMBOBOX IDC_COMBO_forska, 143, 67, 133, 25, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
LTEXT "Volume function (flag_volfunc)", IDC_STATIC_volfunc, 18, 186, 96, 8, SS_LEFT
LTEXT "Respiration flag (flag_resp)", IDC_STATIC_resp, 18, 203, 84, 8, SS_LEFT
LTEXT "Limitation flag (flag_limi)", IDC_STATIC_limi, 18, 220, 74, 8, SS_LEFT
COMBOBOX IDC_COMBO_stand, 143, 84, 133, 54, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_sveg, 143, 101, 133, 48, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_mg, 143, 118, 133, 78, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_dis, 143, 135, 133, 32, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_light, 143, 152, 133, 55, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_folhei, 143, 169, 133, 53, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_volfunc, 143, 186, 133, 63, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
LTEXT "Decomposition model (flag_decomp) ", IDC_STATIC_decomp, 308, 33, 117, 8, SS_LEFT
LTEXT "Root activity function flag (flag_sign)", IDC_STATIC_sign, 308, 50, 115, 8, SS_LEFT
LTEXT "Soil water uptake flag (flag_wred)", IDC_STATIC_wred, 308, 67, 106, 8, SS_LEFT
LTEXT "Root distribution flag (flag_wurz)", IDC_STATIC_wurz, 308, 84, 101, 8, SS_LEFT
LTEXT "Heat conductance flag (flag_cond)", IDC_STATIC_cond, 308, 101, 111, 8, SS_LEFT
COMBOBOX IDC_COMBO_resp, 143, 203, 133, 64, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_limi, 143, 220, 133, 65, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_decomp, 431, 33, 133, 54, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_sign, 431, 50, 133, 67, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_wred, 431, 67, 133, 61, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_wurz, 431, 84, 133, 64, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_cond, 431, 101, 133, 78, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_int, 431, 118, 133, 75, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_eva, 431, 135, 133, 78, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
LTEXT "Interception flag (flag_int)", IDC_STATIC_int, 308, 118, 80, 8, SS_LEFT
LTEXT "Evapotranspiration flag (flag_eva)", IDC_STATIC_eva, 308, 135, 106, 8, SS_LEFT
LTEXT "Assortment flag (flag_sort)", IDC_STATIC_sort, 308, 169, 82, 8, SS_LEFT
COMBOBOX IDC_COMBO_CO2, 431, 152, 133, 51, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_sort, 431, 169, 133, 48, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
GROUPBOX "Model specification", IDC_STATIC_model, 0, 15, 564, 239
LTEXT "wpm flag (flag_wpm)", IDC_STATIC_wpm, 307, 186, 65, 8, SS_LEFT
COMBOBOX IDC_COMBO_wpm, 431, 186, 133, 64, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
LTEXT "Statistical analysis flag (flag_stat)", IDC_STATIC_stat, 307, 203, 104, 8, SS_LEFT
COMBOBOX IDC_COMBO_stat, 431, 203, 133, 48, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
LTEXT "CO2 flag (flag_CO2)", IDC_STATIC_CO2, 308, 152, 64, 8, SS_LEFT
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_ids DIALOG 100, 0, 130, 78
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "4C"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "OK", ID_IDS_BUTTON_OK, 10, 55, 50, 14
GROUPBOX "Output File Identifiers", IDC_STATIC_model, 6, 14, 111, 35
EDITTEXT IDC_EDIT_ID, 14, 29, 95, 14, ES_AUTOHSCROLL
PUSHBUTTON "Cancel", ID_CANCEL_IDS, 67, 55, 50, 14
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_main DIALOGEX 300, 50, 245, 268
STYLE DS_3DLOOK | DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
EXSTYLE WS_EX_CLIENTEDGE | WS_EX_STATICEDGE
CAPTION "4C"
FONT 8, "MS Sans Serif", 0, 0, 1
{
GROUPBOX "", IDC_STATIC_year, 5, 6, 233, 258, 0, WS_EX_STATICEDGE
CTEXT "Forest Growth Model 4C PIK 2016", IDC_STATIC_4C, 25, 53, 82, 23, SS_CENTER
DEFPUSHBUTTON "Start 4C", ID_START_4C, 103, 233, 56, 14
PUSHBUTTON "Exit 4C", IDSTOP, 174, 233, 50, 14
GROUPBOX "Simulation Control", IDC_STATIC_Control, 20, 126, 207, 68
AUTORADIOBUTTON "Start simulation", IDC_RADIO_start, 35, 148, 121, 10
AUTORADIOBUTTON "Edit control file", IDC_RADIO_edit, 35, 166, 62, 10
CONTROL "", IDC_REBAR1, REBARCLASSNAME, WS_TABSTOP | 0x00000401, 4294967294, 4294967295, 249, 4, WS_EX_DLGMODALFRAME | WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
CONTROL IDB_BITMAP1, IDC_STATIC_pic, WC_STATIC, SS_BITMAP, 123, 14, 100, 104
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_out DIALOG 100, 0, 293, 212
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "4C"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "Start simulation", ID_START, 89, 182, 56, 14
PUSHBUTTON "Exit 4C", IDCANCEL, 226, 182, 50, 14
LTEXT "Choice of output files", IDC_STATIC, 15, 18, 67, 8, SS_LEFT
PUSHBUTTON "Yearly output", IDC_BUTTON_yearly, 207, 37, 50, 14
PUSHBUTTON "Daily output", IDC_BUTTON_daily, 207, 60, 50, 14
PUSHBUTTON "Cohorts yearly", IDC_BUTTON_coh_yearly, 207, 84, 50, 14
PUSHBUTTON "Cohorts daily", IDC_BUTTON_coh_daily, 207, 108, 50, 14
GROUPBOX "", IDC_STATIC_choice_out, 8, 7, 268, 164
LTEXT "Summation output", IDC_STATIC_SUM, 19, 145, 58, 8, SS_LEFT
COMBOBOX IDC_COMBO_sum, 88, 142, 165, 74, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_SORT
DEFPUSHBUTTON "Back", ID_OUT_BUTTON_BACK, 161, 182, 50, 14
DEFPUSHBUTTON "Save changes", ID_SAVE, 17, 182, 56, 14
COMBOBOX IDC_COMBO_yearly, 14, 37, 181, 77, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_daily, 13, 60, 181, 77, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_coh_yearly, 13, 85, 181, 77, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
COMBOBOX IDC_COMBO_coh_daily, 13, 109, 181, 77, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_4C_yearly DIALOG 100, 0, 606, 352
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "4C"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "OK", ID_YEARLY_BUTTON_OK, 455, 327, 50, 14
PUSHBUTTON "Cancel", ID_CANCEL_OUTF, 519, 327, 50, 14
GROUPBOX "", IDC_STATIC_year, 7, 15, 573, 302
AUTOCHECKBOX "", IDC_CHECK_y1, 21, 30, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y2, 21, 45, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y3, 21, 60, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y4, 21, 75, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y5, 21, 90, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y6, 21, 105, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y7, 21, 120, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y8, 21, 135, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y9, 21, 150, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y10, 21, 165, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y11, 21, 180, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y12, 21, 195, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y13, 21, 210, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y14, 21, 225, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y15, 21, 240, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y16, 21, 255, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y17, 21, 270, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y18, 21, 285, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y19, 21, 300, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y20, 294, 30, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y21, 294, 45, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y22, 294, 60, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y23, 294, 75, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y24, 294, 90, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y25, 294, 105, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y26, 294, 120, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y27, 294, 135, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y28, 294, 150, 270, 8
LTEXT " Choose yearly output files ", IDC_STATIC_yfile, 21, 14, 89, 8, SS_LEFT
AUTOCHECKBOX "", IDC_CHECK_y29, 294, 165, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y30, 294, 180, 270, 8
PUSHBUTTON "Select all", ID_YEARLY_BUTTON_SELECT, 391, 327, 50, 14
PUSHBUTTON "Deselect all", ID_YEARLY_BUTTON_DESELECT, 327, 327, 50, 14
AUTOCHECKBOX "", IDC_CHECK_y31, 294, 195, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y32, 294, 210, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y33, 294, 225, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y34, 294, 240, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y35, 294, 255, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y36, 294, 270, 270, 8
AUTOCHECKBOX "", IDC_CHECK_y37, 294, 285, 270, 8
}
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
IDD_DIALOG1 DIALOG 0, 0, 186, 95
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "Microsoft Sans Serif"
{
DEFPUSHBUTTON "OK", IDOK, 129, 7, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 129, 24, 50, 14
}
//
// Version Information resources
//
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 0,0,0,0
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
FILEFLAGSMASK 0x0000003F
FILEFLAGS 0x00000000
{
BLOCK "StringFileInfo"
{
BLOCK "080904B0"
{
VALUE "Comments", "\0"
VALUE "CompanyName", "Potsdam-Institut fr Klimafolgenforschung\0"
VALUE "FileDescription", "FORESEE - Forest Ecosystems in a changing Environment\0"
VALUE "FileVersion", "0.99e\0"
VALUE "InternalName", "4C\0"
VALUE "LegalCopyright", "Copyright 2004\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "4C.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "4C - PIK\0"
VALUE "ProductVersion", "0.99e\0"
VALUE "SpecialBuild", "\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0809, 0x04B0
}
}
!*****************************************************************!
!* *!
!* 4C (FORESEE) Simulation Model *!
!* *!
!* *!
!* SR SEED_multi *!
!* *!
!* including SR/Function *!
!* function rtflsp (regula falsi solving equation) *!
!* function weight *!
!* function weight1 *!
!* *!
!* generation of a variety of seedling cohorts for *!
!* one seed number according to seedmass distribution *!
!* (for given mean value and standard deviation) *!
!* *!
!* Copyright (C) 1996-2018 *!
!* Potsdam Institute for Climate Impact Reserach (PIK) *!
!* Authors and contributors see AUTHOR file *!
!* This file is part of 4C and is licensed under BSD-2-Clause *!
!* See LICENSE file or under: *!
!* http://www.https://opensource.org/licenses/BSD-2-Clause *!
!* Contact: *!
!* https://gitlab.pik-potsdam.de/foresee/4C *!
!* *!
!*****************************************************************!
SUBROUTINE seed_multi(nseed,nsp)
USE data_species
use data_stand
use data_help
use data_par
use data_soil
use data_simul
IMPLICIT NONE
integer :: nseed, nseedha, nsclass , k, j, nr
integer,dimension(:),allocatable :: nsc
real, dimension(:), allocatable :: msc, &
shooth, &
nschelp
integer :: nsp
REAL :: shoot
REAL :: ms, msclass, x1,x2,xacc,shelp, nshelp,ntot,help
REAL :: troot2
real :: standdev
real :: rtflsp, weight
TYPE(cohort) ::tree_ini
external weight
external rtflsp
if(nseed.eq.0) return
standdev = spar(nsp)%seedsd*1000.
hnspec = nsp
ms = spar(nsp)%seedmass *1000. ! g ---> mg
nseedha = nseed
nshelp = nseedha/10000.
! calculation of seed class number
if(flag_reg.eq.3) then
nsclass = int(100.*nshelp**0.6)
else if(flag_reg.eq.30) then
nsclass = int(10.*nshelp**0.6)+1
end if
allocate(nsc(nsclass))
allocate(nschelp(nsclass))
allocate(msc(nsclass))
allocate(shooth(nsclass))
! seed weight and number of seeds per class
msclass = 6.*standdev/nsclass
ntot = 0
help = (1/(sqrt(2*pi)*standdev))
do k=1, nsclass
msc(k) = (ms - 3.*standdev) + msclass*(k-1)
nschelp(k) = help*exp(-((msc(k)-ms)**2)/(2*(standdev)**2))
ntot = ntot + nschelp(k)
end do
do k= 1,nsclass
nsc(k) = nint((nschelp(k)*nseedha/ntot) + 0.5)
end do
! calculation of shoot weight per seed class and initilization
do k = 1,nsclass
mschelp = msc(k)/1000000. ! mg ---> kg
x1 = 0.
x2 = 0.1
xacc=(1.0e-10)*(x1+x2)/2
! solve mass equation; determine root
shelp=rtflsp(weight,x1,x2,xacc)
shooth(k)= shelp
max_coh = max_coh + 1
call coh_initial (tree_ini)
tree_ini%ident = max_coh
tree_ini%species = nsp
tree_ini%ntreea = nsc(k)
tree_ini%nta = nsc(k)
shoot = shooth(k)
tree_ini%x_sap = shoot ! [kg]
shoot = shoot * 1000. ! [g]
tree_ini%x_fol= (spar(nsp)%seeda*(tree_ini%x_sap** spar(nsp)%seedb)) ![kg]
tree_ini%x_frt = tree_ini%x_fol ! [kg]
! Leder
tree_ini%x_hrt = 0.
tree_ini%med_sla = spar(nsp)%psla_min + spar(nsp)%psla_a*0.5
tree_ini%t_leaf = tree_ini%med_sla* tree_ini%x_fol ! [m-2]
tree_ini%ca_ini = tree_ini%t_leaf
tree_ini%crown_area = tree_ini%ca_ini
tree_ini%underst = 1
! tranformation of shoot biomass kg --> mg
if(nsp.ne.2)tree_ini%height = spar(nsp)%pheight1*(shoot*1000.)**spar(nsp)%pheight2 ! [cm] berechnet aus shoot biomass (mg)
! Leder
if(nsp.eq.2) tree_ini%height = 10**(spar(nsp)%pheight1+ spar(nsp)%pheight2*LOG10(shoot*1000.)+ &
spar(nsp)%pheight3*(LOG10(shoot*1000.))**2)
IF(nsc(k).ne.0.) then
IF (.not. associated(pt%first)) THEN
ALLOCATE (pt%first)
pt%first%coh = tree_ini
NULLIFY(pt%first%next)
! root distribution
call root_depth (1, pt%first%coh%species, pt%first%coh%x_age, pt%first%coh%height, pt%first%coh%x_frt, pt%first%coh%x_crt, nr, troot2, pt%first%coh%x_rdpt, pt%first%coh%nroot)
pt%first%coh%nroot = nr
do j=1,nr
pt%first%coh%rooteff = 1. ! assumption for the first use
enddo
do j=nr+1, nlay
pt%first%coh%rooteff = 0. ! layers with no roots
enddo
ELSE
ALLOCATE(zeig)
zeig%coh = tree_ini
zeig%next => pt%first
pt%first => zeig
call root_depth (1, zeig%coh%species, zeig%coh%x_age, zeig%coh%height, zeig%coh%x_frt, zeig%coh%x_crt, nr, troot2, zeig%coh%x_rdpt, zeig%coh%nroot)
zeig%coh%nroot = nr
do j=1,nr
zeig%coh%rooteff = 1. ! assumption for the first use
enddo
do j=nr+1, nlay
zeig%coh%rooteff = 0. ! layers with no roots
enddo
END IF
anz_coh=anz_coh+1
END IF
end do
deallocate(nsc)
deallocate(nschelp)
deallocate(msc)
deallocate(shooth)
END SUBROUTINE seed_multi
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! weight: seed mass function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function weight (x)
use data_help
use data_species
implicit none
real :: x
real :: p1,p2, weight
p1 = spar(hnspec)%seeda
p2 = spar(hnspec)%seedb
weight = p1*2*(x**p2) + x - 0.7*mschelp
end function weight
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! weight1: coarse root mass function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function weight1 (x)
use data_help
use data_species
real :: x
real :: p1,p2
p1 = spar(hnspec)%seeda
p2 = spar(hnspec)%seedb
weight1 = p1*(x**p2) + x - mschelp
end function weight1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! rtflsp: regula falsi solving euation
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FUNCTION rtflsp(func,x1,x2,xacc)
INTEGER MAXIT
REAL rtflsp,x1,x2,xacc,func
EXTERNAL func
PARAMETER (MAXIT=30)
INTEGER j
REAL del,dx,f,fh,fl,swap,xh,xl
fl=func(x1)
fh=func(x2)
if(fl.lt.0.)then
xl=x1
xh=x2
else
xl=x2
xh=x1
swap=fl
fl=fh
fh=swap
endif
dx=xh-xl
do j=1,MAXIT
rtflsp=xl+dx*fl/(fl-fh)
f=func(rtflsp)
if(f.lt.0.) then
del=xl-rtflsp
xl=rtflsp
fl=f
else
del=xh-rtflsp
xh=rtflsp
fh=f
endif
dx=xh-xl
if(abs(del).lt.xacc.or.f.eq.0.)return
end do
END function rtflsp
\ No newline at end of file
!*****************************************************************!
!* *!
!* 4C (FORESEE) Simulation Model *!
!* *!
!* *!
!* Subroutines for: *!
!* - Simulation initialisation (SIM_INI) *!
!* *!
!* Copyright (C) 1996-2018 *!
!* Potsdam Institute for Climate Impact Reserach (PIK) *!
!* Authors and contributors see AUTHOR file *!
!* This file is part of 4C and is licensed under BSD-2-Clause *!
!* See LICENSE file or under: *!
!* http://www.https://opensource.org/licenses/BSD-2-Clause *!
!* Contact: *!
!* https://gitlab.pik-potsdam.de/foresee/4C *!
!* *!
!*****************************************************************!
SUBROUTINE sim_ini
use data_biodiv
use data_climate
use data_depo
use data_evapo
use data_inter
use data_manag
use data_simul
use data_site
use data_stand
use data_soil
use data_soil_cn
use data_species
use data_par
use data_frost
implicit none
type(Coh_Obj), pointer :: p ! pointer to cohort list
anz_sim = anz_sim + 1
time = 0
time_cur = time_b - 1 ! before Sim.-Start in year_ini time_cur=time_cur+1
iday = 0
act_thin_year = 1
flag_cum = 0
flag_lit = 0
flag_sens = 0
flag_redn = .FALSE.
lai=0.
gp_can = 0.
sumbio = 0.
totfrt = 0.
sumNPP = 0.
nppsum = 0.
gppsum = 0.
cum_sumNPP= 0.
NEE_mon = 0.
NPP_mon = 0.
autresp = 0.
autresp_m = 0.
anrspec = 0
anz_coh = 0
anz_spec = 0
anz_tree = 0
med_diam = 0.
hdom = 0.
mean_drIndAl = 0.
med_air = 0.
med_rad = 0.
med_air_cm = 0.
med_air_wm = 0.
med_air_ms = 0.
med_air_mj = 0.
med_wind = 0.
temp_mon = 0.
prec_mon = 0.
sum_prec = 0.
sum_prec_ms= 0.;
sum_prec_mj= 0.
gdday = 0.
days_summer = 0
days_hot = 0
days_ice = 0
days_dry = 0
days_hrain = 0
days_rain = 0
days_rain_mj= 0
days_snow = 0
days_wof = 0
gdday_all = 0.
med_air_all = 0.
sum_prec_all = 0.
med_rad_all = 0.
int_cum_can = 0.
int_cum_sveg = 0.
interc_m_can = 0.
interc_m_sveg= 0.
perc_cum = 0.
perc_mon = 0.
wupt_cum = 0.
wupt_r_c = 0.
wupt_e_c = 0.
tra_tr_cum = 0.
tra_sv_cum = 0.
dew_m = 0.
aet_cum = 0.
pet_cum = 0.
pet_m = 0.
AET_m = 0.
wupt_r_m = 0.
perc_m = 0.
wat_tot = 0.
gp_can_mean = 0.
gp_can_max = 0.
snow = 0.
snow_day = 0
totFPARcan = 0.
Rnet_cum = 0.
! fire index
fire(1)%mean_m = 0
fire(2)%mean_m = 0
fire(3)%mean_m = 0
fire_indb_m = 0
ind_arid_an = 0.
ind_lang_an = 0.
ind_cout_an = 0.
ind_wiss_an = 0.
ind_mart_an = 0.
ind_mart_vp = 0.
ind_emb = 0.
ind_weck = 0.
ind_reich = 0.
con_gor = 0.
con_cur = 0.
con_con = 0.
cwb_an = 0.
cwb_an_m = 0.
ind_bud = 0.
ind_shc = 0.
ind_arid_an_m = 0.
ind_lang_an_m = 0.
ind_cout_an_m = 0.
ind_wiss_an_m = 0.
ind_mart_an_m = 0.
ind_mart_vp_m = 0.
ind_emb_m = 0.
ind_weck_m = 0.
ind_reich_m = 0.
con_gor_m = 0.
con_cur_m = 0.
con_con_m = 0.
ind_bud_m = 0.
ind_shc_m = 0.
ntindex = 0.
tempmean_mo = 0
aet_dec = 0.
temp_dec = 0.
prec_dec = 0.
rad_dec = 0.
hum_dec = 0.
! frost index
if(flag_climtyp .ge. 3) then
! calculation for airtemp_min > -90.
tminmay=0
lfind=0
dlfabs=0.
tminmay_sp=0
dlfabs_sp=0.
flag_tveg=0
else
tminmay=-99
lfind=-99
dlfabs=-99.
tminmay_sp=-99
dlfabs_sp=-99.
flag_tveg=-99
endif
!! initialisation of root distribution
RedN_mean = 0.
anz_RedN = 0
N_min = 0.
N_min_m = 0.
resps_c = 0.
resps_c_m = 0.
resps_mon = 0.
N_tot = 0.
N_an_tot = 0.
N_hum_tot = 0.
C_tot = 0.
C_hum_tot = 0.
N_lit = 0.
C_lit = 0.
Nupt_c = 0.
Nupt_m = 0.
C_accu = 0.
Nleach_c = 0.
Nleach_m = 0.
N_lit_m = 0.
C_lit_m = 0.
totfol_lit = 0.
totfol_lit_tree = 0.
totfrt_lit = 0.
totfrt_lit_tree = 0.
tottb_lit = 0.
totcrt_lit = 0.
totstem_lit = 0.
C_opm_fol = 0.
C_opm_frt = 0.
C_opm_crt = 0.
C_opm_tb = 0.
C_opm_stem = 0.
N_opm_stem = 0.
N_opm_fol = 0.
N_opm_frt = 0.
N_opm_crt = 0.
N_opm_tb = 0.
Ndep_cum = 0.
Ndep_cum_all= 0.
if (flag_multi .ne. 8) then
if ((flag_multi .ne. 2) .or. (ip .le. 1)) then
NOdep(ip) = 0.
NHdep(ip) = 0.
endif
endif
flag_bc = 0
totsteminc = 0.
cumsteminc = 0.
cumsumvsdead = 0.
cumsumvsab = 0.
sumvsdead = 0.
sumvsab = 0.
p => pt%first
do while (associated(p))
p%coh%N_pool = 0.
p => p%next
enddo ! p (cohorts)
allocate(dayfract(ns_pro))
! fields for frost index
allocate(dnlf(year))
allocate(tminmay_ann(year))
allocate(date_lf(year))
allocate(date_lftot(year))
allocate(dnlf_sp(year))
allocate (anzdlf(year))
allocate (sumtlf(year))
dnlf_sp=0
dnlf = 0
tminmay_ann = 0.
date_lf = 0
date_lftot = 0
anzdlf = 0.
sumtlf = 0.
end subroutine sim_ini
\ No newline at end of file
!*****************************************************************!
!* *!
!* 4C (FORESEE) Simulation Model *!
!* *!
!* *!
!* Subroutines for: *!
!* - Simulation control: SIM_CONTROL *!
!* SIMULATION_4C *!
!* *!
!* Copyright (C) 1996-2018 *!
!* Potsdam Institute for Climate Impact Reserach (PIK) *!
!* Authors and contributors see AUTHOR file *!
!* This file is part of 4C and is licensed under BSD-2-Clause *!
!* See LICENSE file or under: *!
!* http://www.https://opensource.org/licenses/BSD-2-Clause *!
!* Contact: *!
!* https://gitlab.pik-potsdam.de/foresee/4C *!
!* *!
!*****************************************************************!
SUBROUTINE sim_control
use data_climate
use data_simul
use data_site
use data_out
implicit none
integer run_nr, ipp, irl, icl, i
character a
character(8) actdate
character(10) acttime, helpsim, text1, text2
real time1, time2, time3
unit_err=getunit()
if(flag_multi.eq.5) dirout = './'
open(unit_err,file=trim(dirout)//trim(site_name(1))//'_error.log',status='replace', position='append')
unit_trace=getunit()
open(unit_trace,file=trim(dirout)//trim(site_name(1))//'_trace.log',status='replace', position='append')
write (unit_trace, *) ' Trace of calls - subroutines of 4C '
write (unit_trace, *)
write (unit_trace, *) 'iday time_cur subroutine '
write (unit_trace, '(I4,I10,A)') iday, time_cur, ' sim_control'
! check daily output
if (year > 5 .and. flag_dayout .ge. 1) then
write(*,*) ' Warning: Your choice of daily output is ON with a simulation time of'
write(*,'(I6,A,I8,A)') year,' years. This option will create ',365*year,' data records per file!'
write(*,'(A)',advance='no') ' Do you really want do use daily output (y/n)? '
read *,a
IF (a .eq. 'n' .or. a .eq. 'N') then
flag_dayout = 0
ENDIF
ENDIF
! open file ycomp (yearly compressed output (multi run))
IF (time_out .ne. -2) call prep_out_comp
!call epsilon
IF(flag_multi.eq.1) THEN
run_nr = site_nr
ELSE IF (flag_multi.eq.5) THEN
run_nr = 1
ELSE
run_nr = repeat_number
ENDIF
call date_and_time(actdate, acttime)
write (unit_err, *)
time3 = 0.
if (.not.flag_mult910) then
nrreal = 1
nrclim = 1
endif
do icl = 1, nrclim ! climate scenarios
iclim = icl
DO ipp = 1, run_nr ! sites
ip = ipp
if (flag_trace) write (unit_trace, '(I4,I10,A,I3)') iday, time_cur, ' sim_control ip=',ip
do irl = 1, nrreal ! realization f climate scenarios
if (flag_mult910) then
climfile(ip) = climszenfile(ip, icl, irl)
site_name (ip) = trim(site_name1)//'_'//trim(sitenum(ip))
write (helpsim,'(I10)') icl
read (helpsim,*) text1
write (helpsim,'(I10)') irl
read (helpsim,*) text2
site_name (ip) = trim(site_name (ip))//'_'//trim(text1)//'_'//trim(text2)
write (unit_err, *)
write (unit_err, '(A,3I5,2X, A50)')'* ip, cli-scenario, real., site: ', ip, icl, irl, site_name(ip)
write (unit_err, '(A,A)') 'Climate file: ', trim(climfile(ip))
else
write (unit_err, *)
write (unit_err, '(A10,I5,2X, A50)') ' ip/site ', ip, trim(site_name(ip))
site_name1 = trim(site_name(ip))
endif
call CPU_time (time1)
if(ip.ne.0) then
CALL sim_ini
CALL prepare_site
if (flag_multi.eq.5) then
! call m4c_simenv_in
unit_comp2 = 6 ! standard output
end if
if(flag_end.gt.0) then
select case (flag_end)
case (1)
print*,ip, ' stop in prepare_stand (see error.log)'
case (2)
print*, ip, 'stop in prepare_stand, stand ', &
'identificator not found in prepare_stand'
case (3)
print*,ip, 'stop in canopy'
case (4)
print*,ip, 'stop in readsim, climate ID not found'
case (5)
print*,ip, ' stop in readsoil, soil ID not found ', adjustl(soilid(ip))
case (6)
write(*,'(A,I5)') ' >>>foresee message: stop in read_cli, no climate data for year ',time_b
call finish_simul
stop
case (7)
print*,ip, ' stop in readsoil, error during reading soil data ', adjustl(soilid(ip))
call finish_simul
stop
case default
print*,ip, 'flag_end = ', flag_end
end select
call finish_simul
flag_end = 0
else
IF(flag_multi==2) CALL fixclimscen
if (.not.flag_mult910) then
write (*,*)
write (*,*) '>>> Start FORESEE-Simulation site ', ipp
write (*,*)
endif
CALL simulation_4c
CALL finish_simul
endif
if (flag_mult910) then
call out_var_stat(1, irl)
else
if ((flag_multi .ne. 8) .and. (nvar .gt. 1)) call out_var_stat(3, 1)
endif
endif ! flag_end
call CPU_time (time2)
if (.not.flag_mult910) then
print *, ' run time for simulation ',ip, time2-time1, ' sec'
endif
write (unit_err, *) ' run time for simulation ',ip, time2-time1, ' sec'
time3 = time3 + (time2-time1)
enddo ! irl
if (flag_mult910) call out_var_stat(2, -99)
write (unit_err, *)
write (unit_err, *)
write (unit_err, *) '* * * * * New ip/site * * * * *'
ENDDO ! ip until site_nr (page number)
write (unit_err, *)
write (unit_err, *) '************ New climate scenario **********'
enddo ! icl
if (nvar .gt. 1) then
select case (flag_multi)
case (5, 9, 10)
continue
case (1)
continue
case default
call out_var_file
end select
endif
! comparison with measurements
if (flag_stat .gt. 0) CALL mess
call CPU_time (time1)
time3 = time3 + (time1-time2)
write (unit_err, *)
write (unit_err, *) ' total run time ', time3, ' sec'
CALL finish_all
PRINT *,'All simulations finished!'
END SUBROUTINE sim_control
!**************************************************************
SUBROUTINE simulation_4C
!*** Declaration part ***!
USE data_simul
USE data_species ! species specific parameters
USE data_site ! site specific data
USE data_climate ! climate data
USE data_soil
USE data_soil_cn
USE data_stand ! state variables of stand, cohort and cohort element
USE data_out
USE data_manag
USE data_plant
USE data_par
IMPLICIT NONE
if (flag_trace) write (unit_trace, '(I4,I10,A)') iday, time_cur, ' simulation_4C'
! allocation of environmental variable fields
if(flag_wpm.ne.4 .and. flag_wpm.ne.5.and.flag_wpm.ne.6) then
! time loop
DO time = 1, year
iday = 1
! Update population variable for new year if population is changed through interventions
if (flag_standup .gt. 0 .or. flag_dis==1 .or. flag_dis==1) then
call stand_balance
call standup
flag_standup = 0
endif
CALL year_ini
! Calculate RedN from soil C/N
! read or create Redn for areal application
IF (time.EQ.1 .and. flag_redn) CALL RedN_ini
IF (flag_dis .eq. 1 .or. flag_dis .eq. 2) then
CALL dis_manag
endif
! simulation of processes with subannual resolution (fluxes and soil)
CALL stand_daily
if(flag_end.ge.1) exit ! exit do loop time
! compressed output of start values
IF (lcomp1) THEN
CALL out_comp(unit_comp1)
lcomp1 = .FALSE.
ENDIF
! cohort litter production
CALL senescence
! calculation of stand variables over all patches
CALL stand_balance
! calculation of soil variables for yearly output
CALL s_year
! calculation of fire variables for yearly output
CALL fire_year
! calculation of indices for yearly output
CALL t_indices(temp_mon)
! summation output
IF(flag_sum.eq.4) THEN
write(unit_sum,'(I5,9F11.3)') time_cur,photsum,npppotsum,nppsum,resosum,lightsum,nee,abslightsum,precsum, tempmean
photsum=0.;npppotsum=0.;nppsum=0.;resosum=0.;lightsum=0.;nee=0.;abslightsum=0.;precsum=0.
ENDIF
totsteminc = 0.
totsteminc_m3 = 0.
! cohort loop for change in crown dimensions, allocation and tree dimension calculations
zeig=>pt%first
DO
IF (.not.ASSOCIATED(zeig)) exit
IF (zeig%coh%height.ge.thr_height .and. zeig%coh%species.le.nspec_tree) then
! determine crown movement
CALL CROWN( zeig )
! allocate NPP to the various tree compartments
CALL PARTITION( zeig )
if(flag_end.ge.1) exit ! do loop
ENDIF
IF (zeig%coh%species.EQ.nspec_tree+1) then ! Ground vegetation
! allocate NPP to the various ground vegetation compartments
CALL PARTITION_SV( zeig )
ENDIF
IF (zeig%coh%species.eq.nspec_tree+2) then ! Mistletoe
CALL PARTITION_MI( zeig )
if(flag_end.ge.1) exit ! do loop
ENDIF
zeig=>zeig%next
END DO
if(flag_end.ge.1) exit ! exit do loop time
! calculation of annual mortality
IF(flag_mort.ge.1) CALL stand_mort
! annual growth of trees below thr_height, which are initialized by planting (not seeded!)
! at the beginning of the simulation or during management (shelter-wood)
if(flag_reg.ne.2.and.flag_sprout.eq.0) CALL growth_seed
CALL mort_seed
if(flag_sprout.eq.1) flag_sprout=0
IF(flag_mg==1) then
if(thin_year(act_thin_year)==time_cur) then
CALL management
act_thin_year = act_thin_year+1
end if
ELSE IF((flag_mg.ge.2 .or. flag_mg.eq.3 .or. flag_mg.eq.33.or. flag_mg.eq.9 .or. flag_mg.eq.10 .or. flag_mg.eq. 333).and.anz_spec.ne.0) THEN
CALL management
if(flag_wpm.ne.0) CALL timsort
ENDIF
! no assortment if wpm is not called
if(flag_mg.eq.0.and.anz_spec.ne.0) then
if(flag_wpm.ne.0) call timsort
end if
CALL litter
! input of dead biomass into soil compartments
CALL cn_inp
! if(flag_multi.eq.5) call m4c_simenv_out
! annual establishment for all species
IF (flag_reg.eq.1.or.flag_reg.eq.2.or.flag_reg.eq.3.or.flag_reg.eq.30) CALL stand_regen
! cumsteminc = cumsteminc + totsteminc
! planting of seedlings/saplings at the beginning of simulation
if(flag_reg.ge.9..and. flag_reg.lt.100. .and. time.eq.1) call planting
if(flag_reg.ge.9..and. flag_reg.lt.100. .and. flag_mg .eq.44) call planting
! Update stand variables if stand changed
if (flag_standup.gt.0 .or. anz_spec.eq.0) then
call stand_balance
! if (flag_standup .gt. 1) call root_distr ! wird generell in year_ini berechnet
endif
cumsteminc = cumsteminc + totsteminc
! yearly output
IF (time_out .gt. 0) THEN
IF (mod(time,time_out) .eq. 0) then
CALL outyear (1)
CALL outyear (2)
endif
ENDIF
! store of output variables (multi run 4, 8, 9)
IF (nvar .gt. 1) CALL outstore
! RedN calculation
if ((flag_limi .eq. 10) .or. (flag_limi .eq. 15)) call RedN_calc
! CALL list_cohort
CALL del_cohort
if (.not.flag_mult910) PRINT *, ' * Year ', time, time_cur,' finished... '
END DO ! time
! calculation of stand variables over all patches at the end!
CALL stand_balance
!***** wpm ******
! check if management
if(flag_mg == 0) then
flag_wpm = 0
endif
if (flag_wpm == 1 .or. flag_wpm == 21 .or. flag_wpm == 11) call wpm
if (flag_wpm == 2) call sea
if (flag_wpm == 3) then
call wpm
call sea
end if
!*** * * * * * * * ****
else
call wpm
end if
if (flag_wpm .gt. 0) call out_wpm(1)
CALL out_comp(unit_comp2)
if(flag_end.eq.1) print*,ip, 'stop in partitio'
if(flag_end.eq.3) print*,ip, 'stop in calc_la in canopy: toplayer = 125 m'
flag_end = 0
if (.not.flag_mult910) PRINT *, ' * Simulation ',ip,' finished.'
END SUBROUTINE simulation_4C
!**************************************************************
!*****************************************************************!
!* *!
!* 4C (FORESEE) Simulation Model *!
!* *!
!* *!
!* Subroutines for: *!
!* Soil and Water - Programs *!
!* *!
!* contains: *!
!* SOIL *!
!* SOIL_INI *!
!* SOIL_WAT *!
!* UPT_WAT *!
!* FRED1 - ...11 *!
!* TAKE_WAT *!
!* BUCKET *!
!* SNOWPACK *!
!* HUM_ADD *!
!* BC_APPL: application of biochar *!
!* *!
!* Copyright (C) 1996-2018 *!
!* Potsdam Institute for Climate Impact Reserach (PIK) *!
!* Authors and contributors see AUTHOR file *!
!* This file is part of 4C and is licensed under BSD-2-Clause *!
!* See LICENSE file or under: *!
!* http://www.https://opensource.org/licenses/BSD-2-Clause *!
!* Contact: *!
!* https://gitlab.pik-potsdam.de/foresee/4C *!
!* *!
!*****************************************************************!
SUBROUTINE soil
! Soil processes (frame)
use data_climate
use data_depo
use data_out
use data_simul
use data_soil
use data_soil_cn
implicit none
call evapo
call intercep
call soil_wat
call soil_temp
if (flag_wurz .eq. 4 .or. flag_wurz .eq. 6) then
call soil_stress !calculate ground stress factors
call cr_depth !define root depth
endif
call soil_cn
call root_eff
END subroutine soil
!**************************************************************
SUBROUTINE soil_ini
! Initialisation of soil data and parameters
use data_inter
use data_evapo
use data_out
use data_par
use data_simul
use data_soil
use data_soil_cn
use data_species
use data_stand
implicit none
integer i,j,k
real d_0, t_0
! Table of quarz and clay content (mass%) versus wlam
real, dimension(17) :: xwlam = (/1.5, 1.15, 0.9, 0.67, 0.6, 0.5, 0.38, 0.37, 0.3, 0.29, 0.27, 0.26, 0.25, 0.24, 0.23, 0.22, 0.15/), &
yquarz = (/93.0,85.0,80.0, 82.0,76.0, 64.0, 65.0, 51.0,60.0, 30.0, 14.0, 10.0, 12.0, 20.0, 30.0, 43.0, 23.0/), &
yclay = (/3.0, 3.0, 3.0, 12.0, 6.0, 6.0, 10.0, 4.0,21.0, 12.0, 10.0, 37.0, 15.0, 40.0, 30.0, 35.0, 55.0/)
real value
real, dimension(nlay):: humush(nlay)
real, dimension(nlay):: xfcap, xwiltp, xpv ! output of addition for water capacities
! estimation of soil layer values
d_0 = 0.
do j = 1, nlay
t_0 = thick(j)
mid(j) = d_0 + 0.5*t_0
d_0 = d_0 + t_0
depth(j) = d_0
enddo
perc = 0.
wupt_r = 0.
wupt_ev = 0.
thick_1 = thick(1)
select case (flag_soilin)
case (0,2)
do i=1,nlay
if (i .gt. 1) then
call tab_int(xwlam, yquarz, 17, wlam(i), value)
sandv(i) = value / 100. ! Mass% of mineral fraction
call tab_int(xwlam, yclay, 17, wlam(i), value)
clayv(i) = value / 100.
siltv(i) = 1. - clayv(i) - sandv(i)
else
sandv(1) = 0.0
clayv(1) = 0.0
siltv(1) = 0.0
endif
enddo
case (1,3,4)
clayv = clayv / 100.
sandv = sandv / 100.
siltv = 1. - clayv - sandv
if ((sandv(1) .le. zero) .and. (clayv(1) .le. zero)) siltv(1) = 0.
skelv = skelv / 100.
humusv = humusv / 100.
end select
! Settings for subroutine take_wat
skelfact = 1.
pv = skelfact * pv_v * thick * 0.1 ! mm
wilt_p = skelfact * wilt_p_v * thick * 0.1 ! mm
field_cap = skelfact * f_cap_v * thick * 0.1 ! mm
wats = field_cap ! mm
watvol = f_cap_v ! vol%
n_ev_d = nlay
nlgrw = nlay+1
do i=1,nlay
if (w_ev_d .gt. depth(i)) n_ev_d = i
if (grwlev .gt. depth(i)) nlgrw = i+1
vol(i) = thick(i) * 10000.
enddo
! dry mass of first layer
dmass = vol * dens
rmass1 = dmass(1) - (C_hum(1) + C_opm(1)) / cpart ! corection term of first layer
humush = humusv
if (2.*C_hum(1) .lt. humusv(1)*dmass(1)) then
humusv(1) = C_hum(1) / (dmass(1) * cpart)
endif
do i=2, nlay
humusv(i) = C_hum(i) / (dmass(i) * cpart)
enddo
if (flag_bc .gt. 0) y_bc_n = 1 ! actual number of biochar application
! calculation of additions for water capacities
call hum_add(xfcap, xwiltp, xpv)
fcaph = f_cap_v - xfcap
wiltph = wilt_p_v - xwiltp
pvh = pv_v - xpv
! ground water
do i = nlgrw, nlay
wats(i) = pv(i)
enddo
interc_can = 0.
int_st_can = 0.
interc_sveg = 0.
int_st_sveg = 0.
aev_i = 0.
wat_tot = SUM(wats)
END subroutine soil_ini
!**************************************************************
SUBROUTINE soil_wat
use data_out
! soil water balance
use data_climate
use data_evapo
use data_inter
use data_out
use data_par
use data_simul
use data_soil
use data_species
use data_stand
implicit none
real :: eva_dem ! evaporation demand of soil
real :: p_inf = 0. ! infiltrated water
real :: pev ! local: soil evaporation
real :: watot, wetot ! total water content at start and end
real :: wutot ! total water uptake from the soil
real :: wutot_ev ! total water uptake by soil evaporation
real :: wutot_r ! total water uptake by roots
real, allocatable, dimension(:) :: upt ! local array for uptake
real, external :: wat_new
real enr, wa, we, percolnl, snow_sm, buckdepth
integer j
allocate (upt(nlay))
wupt_ev = 0.
aev_s = 0.
prec_stand = MAX(0., prec - interc_can - interc_sveg) ! stand precipitation
if (flag_int .gt. 1000) then
prec_stand = prec_stand * prec_stand_red / 100.
endif
call snowpack(snow_sm, p_inf, pev)
if (anz_coh .le. 0) pev = pet
eva_dem = MAX(0., p_inf) - pev ! evaporation demand of soil
! if all stand precipitation is evaporated and there is still a demand
! there is an uptake from soil layers (up to an certain depth)
if (eva_dem .lt. 0.) then
if (snow .le. 0) call take_wat(eva_dem, cover)
aev_s = aev_s + p_inf + SUM(wupt_ev)
else
aev_s = aev_s + pev
endif ! eva_dem
aet = aev_s + aev_i
p_inf = MAX(eva_dem, 0.)
upt = wupt_ev
watot = SUM(wats) ! total initial water content
do j = 1, nlgrw-1
enr = p_inf - upt(j)
wa = wats(j) - field_cap(j)
we = wat_new(wa, enr, j)
p_inf = enr + wa - we
perc(j) = MAX(p_inf, 0.)
wats(j) = MAX(we+field_cap(j), wilt_p(j))
enddo
do j = nlgrw, nlay
enr = p_inf - upt(j)
wa = wats(j) - field_cap(j)
we = pv(j) - field_cap(j) ! ground water level is constant!
p_inf = enr + wa - we
perc(j) = MAX(p_inf, 0.)
wats(j) = MAX(we+field_cap(j), wilt_p(j))
enddo
if (flag_wred .le. 10) then
call upt_wat
else
call upt_wat1
endif
! root uptake balanced imediate after calculation
upt = upt + wupt_r
wats = wats - wupt_r
watvol = 10.*wats/(thick * skelfact) ! estimation for complete layer in Vol% without skeleton (only soil substrate)
! total water quantities
wetot = SUM(wats) ! total final water content
wutot_ev = SUM(wupt_ev) ! total water uptake by soil evaporation
wutot_r = SUM(wupt_r) ! total water uptake by roots
wutot = wutot_ev + wutot_r ! total water uptake
aet = aet + wutot_r ! daily total aet
percolnl = perc(nlay)
trans_tree = 0.
trans_sveg = 0.
zeig => pt%first
do while (associated(zeig))
if (zeig%coh%species .le. nspec_tree) then
trans_tree = trans_tree + zeig%coh%supply
else
trans_sveg = trans_sveg + zeig%coh%supply
endif
zeig => zeig%next
enddo ! zeig (cohorts)
! cumulative water quantities
perc_cum = perc_cum + perc(nlay)
wupt_r_c = wupt_r_c + wutot_r
wupt_e_c = wupt_e_c + wutot_ev
wupt_cum = wupt_cum + wutot
aet_cum = aet_cum + aet
dew_cum = dew_cum + dew_rime
tra_tr_cum = tra_tr_cum + trans_tree
tra_sv_cum = tra_sv_cum + trans_sveg
call bucket(bucks_100, bucks_root, buckdepth)
! number of drought days per layer
where ((wats-0.2) .le. wilt_p) s_drought = s_drought+1
if (flag_dayout .ge. 2) then
write (unit_wat, '(2I5, 7F7.2, 24F8.2)') time_cur, iday, airtemp, prec, interc_can, int_st_can, &
interc_sveg, int_st_sveg, snow, snow_sm, pet, trans_dem, &
pev, aev_s, aev_i, perc(nlay), watot, wetot, wutot, wutot_ev, wutot_r,&
trans_tree,trans_sveg, eva_dem, gp_can, aet, ceppot_can, ceppot_sveg
endif
deallocate (upt)
END subroutine soil_wat
!**************************************************************
SUBROUTINE upt_wat
! Water uptake by roots
use data_simul
use data_evapo
use data_soil
use data_stand
use data_par
use data_species
use data_climate
implicit none
real, dimension(1:anz_coh) :: tr_dem ! auxiliary arrays for cohorts
real wat_ava, hdem, frtrel, frtrel_1, hupt, hupt_c, totfrt_2, hv, demand_mistletoe_canopy
real wat_at ! total available water per layer
real wat_ar ! total available water per layer with uptake resistance
real hred ! resistance coefficient
real, external :: fred1, fred2, fred3, fred4, fred5, fred6, fred7, fred11
integer i, ianz, j, nroot3
! Calculation of Water Demand
ianz = anz_coh
tr_dem = 0
hdem = 0
hv = pet-aev_i-pev_s
if (hv .lt. 0.) hv = 0.
select case (flag_eva)
case (0,1,3)
if((pet .gt. 0.) .and. (hv .gt. 0.)) then
trans_dem = hv * alfm * (1. - exp(-gp_tot/gpmax)) ! pet (potential evapotranspiration) is reduced by intereption evaporation and potential ground evaporation
else
trans_dem = 0.0
endif
if (gp_tot .gt. zero) then
hdem = trans_dem / gp_tot
else
hdem= 0.
endif
case (8)
! potential transpiration demand of each cohort
if ((gp_tot .gt. zero) .and. (hv .gt. 0.)) then
hdem = (pet-aev_i-aev_s) / gp_tot
else
hdem= 0.
endif
case (2,4)
trans_dem = 0.
case (6,16,36)
! Eucalyptus
hv = pet
if((pet .gt. 0.) .and. (hv .gt. 0.)) then
trans_dem = hv * alfm * (1. - exp(-gp_tot/gpmax))
else
trans_dem = 0.
endif
! preparation: potential transpiration demand of each cohort
if (gp_tot .gt. zero) then
hdem = trans_dem / gp_tot
else
hdem= 0.
endif
case (7,17,37)
trans_dem = hv
! potential transpiration demand of each cohort
if (gp_tot .gt. zero) then
hdem = trans_dem / gp_tot
else
hdem= 0.
endif
end select
hdem = max(0., hdem)
! Distribution of total Demand into Demands of Cohorts
!extraction of demand of mistletoe cohort (for case flag eva = 1,3,6,7...)
zeig => pt%first
do while (associated(zeig))
if (zeig%coh%species.eq.nspec_tree+2) then
demand_mistletoe_canopy=zeig%coh%gp * zeig%coh%ntreea * hdem
end if
zeig => zeig%next
enddo
zeig => pt%first
i = 1
do while (associated(zeig))
select case (flag_eva)
case (0, 1, 3, 6, 7, 16, 17, 36, 37)
!uppermost tree cohort (with flag mistletoe) gets additinal demand of mistletoe
if (zeig%coh%mistletoe.eq.1) then
zeig%coh%demand = zeig%coh%gp * zeig%coh%ntreea * hdem + demand_mistletoe_canopy
elseif (zeig%coh%species.eq.nspec_tree+2) then ! set demand of mistletoe to zero as it will be fullfilled by the tree
zeig%coh%demand=0. ! set to zero because demand has been added to the infested tree cohort
else
zeig%coh%demand = zeig%coh%gp * zeig%coh%ntreea * hdem ! all other cohorts get their demand
end if
case (2,4)
!uppermost tree cohort (with flag mistletoe) gets additinal demand, that of mistletoe
if (zeig%coh%mistletoe.eq.1) then
zeig%coh%demand = (max(0., zeig%coh%demand - zeig%coh%aev_i) + demand_mistletoe_cohort)
endif
if (zeig%coh%species.eq.nspec_tree+2) then ! set demand of mistletoe to zero as it will be fullfilled by the tree
zeig%coh%demand=0.
endif
if (zeig%coh%mistletoe.ne.1 .AND. zeig%coh%species.ne.nspec_tree+2) then
zeig%coh%demand = max(0., zeig%coh%demand - zeig%coh%aev_i)
end if
trans_dem = trans_dem + zeig%coh%demand
end select
tr_dem(i) = zeig%coh%demand ! demand of transpiration per cohort
i = i + 1
zeig => zeig%next
enddo ! zeig (cohorts)
! Calculation of Water Supply
frtrel_1 = 1.
select case (flag_wurz)
case (0)
if (nroot_max .gt. 5) then
nroot3 = 5
else
nroot3 = nroot_max
endif
case default
nroot3=nroot_max
end select
! layers with seedlings
do j = 1,nroot3
! determination of resisctance coefficient
select case (flag_wred)
case(1)
hred = fred1(j)
case(2)
hred = fred2(j)
case(3)
hred = fred3(j)
case(4)
hred = fred4(j)
case(5)
hred = 1.
case(6)
hred = 0.5
case(7)
hred = 0.25
case(8)
hred = fred6(j)
case(10)
hred = fred7(j)
case(11)
hred = fred11(j)
end select
wat_res(j) = hred
if (temps(j) .gt. -0.3) then
wat_at = max(wats(j) - wilt_p(j), 0.) ! total available water per layer
wat_ar = hred * wat_at ! total available water per layer with uptake resistance
hupt = 0.
else
wat_ar = 0. ! frost
wat_at = 0.
hupt = 0.
endif
! Distribution of Water Supply into the Cohorts
! Distribution of Fine Roots
zeig => pt%first
i = 1 ! cohort index
do while (associated(zeig))
if (zeig%coh%species .ne. nspec_tree+2) then ! not for mistletoe
frtrel = zeig%coh%frtrelc(j)
wat_ava = frtrel * wat_ar ! available water per tree cohort and layer
if (wat_ava .ge. tr_dem(i)) then
hupt_c = tr_dem(i)
tr_dem(i) = 0.
else
hupt_c = wat_ava
tr_dem(i) = tr_dem(i) - wat_ava
endif
select case (flag_dis) !xylem clogger disturbance
case (1,2)
hupt_c = hupt_c * xylem_dis
end select
xwatupt(i,j) = hupt_c ! water uptake per cohorte and layer
zeig%coh%supply = zeig%coh%supply + hupt_c
if (zeig%coh%supply .lt.0.) then
continue
endif
hupt = hupt + hupt_c
i = i + 1
end if ! exclusion of mistletoe
zeig => zeig%next
enddo ! zeig (cohorts)
wupt_r(j) = hupt
enddo ! j
! layers without seedlings
if (totfrt_p.gt.(seedlfrt+zero)) then
totfrt_2 = 1./(totfrt_p-seedlfrt)
do j = nroot3+1, nroot_max
! determination of resisctance coefficient
select case (flag_wred)
case(1)
hred = fred1(j)
case(2)
hred = fred2(j)
case(3)
hred = fred3(j)
case(4)
hred = fred4(j)
case(5)
hred = 1.
case(6)
hred = 0.5
case(7)
hred = 0.25
end select
wat_res(j) = hred
if (temps(j) .gt. -0.3) then
wat_at = max(wats(j) - wilt_p(j), 0.) ! total available water per layer
wat_ar = hred * wat_at ! total available water per layer with uptake resistance
hupt = 0.
else
wat_ar = 0.
endif
zeig => pt%first
i = 1 ! cohort index
do while (associated(zeig))
frtrel = zeig%coh%frtrelc(j)
wat_ava = frtrel * wat_ar ! available water per tree cohort and layer
if (wat_ava .ge. tr_dem(i)) then
hupt_c = tr_dem(i)
tr_dem(i) = 0.
else
hupt_c = wat_ava
tr_dem(i) = tr_dem(i) - wat_ava
endif
select case (flag_dis) !xylem clogger disturbance
case (1,2)
hupt_c = hupt_c * xylem_dis
end select
xwatupt(i,j) = hupt_c
zeig%coh%supply = zeig%coh%supply + hupt_c
hupt = hupt + hupt_c
i = i + 1
zeig => zeig%next
enddo ! zeig (cohorts)
wupt_r(j) = hupt
enddo ! j
endif
END subroutine upt_wat
!**************************************************************
SUBROUTINE upt_wat1
! Water uptake by roots
! 2. Version
use data_simul
use data_evapo
use data_soil
use data_stand
use data_par
implicit none
real, dimension(1:anz_coh) :: tr_dem,frt_rel ! help arrays for cohorts
real wat_ava, hdem, frtrel, frtrel_1, hupt, hupt_c, totfrt_2
real wat_at ! total available water per layer
real wat_ar ! total available water per layer with uptake resistance
real hred ! resistance coefficient
real, external :: fred1, fred2, fred3, fred4, fred5, fred6, fred7, fred11
integer i, ianz, j, nroot3
ianz = anz_coh
tr_dem=0
trans_dem = (pet-aev_i) * alfm * (1. - exp(-gp_can/gpmax)) ! pet NOT reduced by ground evaporation
if (trans_dem .lt. 0.) trans_dem = 0.
! potential transpiration demand of each cohort
if (gp_can .gt. zero) then
hdem = trans_dem / gp_can
else
hdem= 0.
endif
! Estimation of transpiration demand of tree cohorts and total fine root mass
! in layers with and without seedlings
zeig => pt%first
i = 1
do while (associated(zeig))
select case (flag_eva)
case (0, 1, 3)
zeig%coh%demand = zeig%coh%gp * zeig%coh%ntreea * hdem
case (2)
zeig%coh%demand = zeig%coh%demand - zeig%coh%aev_i
end select
tr_dem(i) = zeig%coh%demand
i = i + 1
zeig => zeig%next
enddo ! zeig (cohorts)
! uptake controlled by share of roots
frtrel_1 = 1.
! layers with seedlings
do j = 1,nroot_max
! determination of resisctance coefficient
select case (flag_wred)
case(1)
hred = fred1(j)
case(2)
hred = fred2(j)
case(3)
hred = fred3(j)
case(4)
hred = fred4(j)
case(5)
hred = 1.
case(6)
hred = 0.5
case(7)
hred = 0.25
case(8) ! BKL, ArcEGMO
hred = fred6(j)
case(10)
hred = fred7(j)
end select
wat_at = max(wats(j) - wilt_p(j), 0.) ! total available water per layer
wat_ar = hred * wat_at ! total available water per layer with uptake resistance
hupt = 0.
zeig => pt%first
i = 1 ! cohort index
do while (associated(zeig))
frtrel = zeig%coh%frtrel(j) * zeig%coh%x_frt * zeig%coh%ntreea * totfrt_1
wat_ava = frtrel * wat_ar ! available water per tree cohort and layer
if (wat_ava .ge. tr_dem(i)) then
hupt_c = tr_dem(i)
tr_dem(i) = 0.
else
hupt_c = wat_ava
tr_dem(i) = tr_dem(i) - wat_ava
endif
select case (flag_dis) !xylem clogger disturbance
case (1,2)
hupt_c = hupt_c * xylem_dis
end select
xwatupt(i,j) = hupt_c
zeig%coh%supply = zeig%coh%supply + hupt_c
hupt = hupt + hupt_c
i = i + 1
zeig => zeig%next
enddo ! zeig (cohorts)
wupt_r(j) = hupt
enddo ! j
END subroutine upt_wat1
!**************************************************************
real FUNCTION fred1(j)
! Function for calculating uptake resistance
! from CHEN (1993)
! empirical relation between soil water content and resistance
! fred1=1 if (field_cap - 10%*field_cap) <= wats <= (field_cap + 10%*field_cap)
use data_par
use data_soil
implicit none
real hf, f09, f11, wc, diff
integer j
f09 = 0.9 * field_cap(j)
f11 = 1.1 * field_cap(j)
wc = wats(j)
if (wc .lt. wilt_p(j)) then
hf = 0.
else if (wc .lt. f09) then
diff = f09-wilt_p(j)
if (diff .lt. zero) diff = 0.001
hf = 1. - (f09-wc) / diff
else if (wc .gt. f11) then
diff = pv(j)-f11
if (diff .lt. zero) diff = 0.001
hf = 0.3 + 0.7 * (pv(j)-wc) / diff
if (hf .lt. zero) hf = 0.001
else
hf = 1.
endif
fred1 = hf
END function fred1
!**************************************************************
real FUNCTION fred2(j)
! Function for calculating uptake resistance
! from Aber and Federer (f=0.04 fuer Wasser in cm)
! only 40% of total available water are plant available per day
implicit none
integer j
fred2 = 0.05
END function fred2
!**************************************************************
real FUNCTION fred3(j)
! Function for calculating uptake resistance
! from CHEN (1993)
! modified to a profile defined in fred
! fred3 may be described by a function (old version):
! fred3 = 0.0004*j*j - 0.0107*j + 0.0735
! this case: set from a root profile, defined by input of root_fr
use data_par
use data_soil
implicit none
real hf, f09, f11, wc, diff
! hf is a reduction factor in dependence on water content
real fred(15)
integer j
! uptake reduction depending on water content
f09 = 0.9 * field_cap(j)
f11 = 1.1 * field_cap(j)
wc = wats(j)
if (wc .lt. wilt_p(j)) then
hf = 0.
else if (wc .lt. f09) then
diff = f09-wilt_p(j)
if (diff .lt. zero) diff = 0.001
hf = 1. - (f09-wc) / diff
else if (wc .gt. f11) then
diff = pv(j)-f11
if (diff .lt. zero) diff = 0.001
hf = 0.3 + 0.7 * (pv(j)-wc) / diff
if (hf .lt. zero) hf = 0.001
else
hf = 1.
endif
fred3 = root_fr(j) * hf
END function fred3
!**************************************************************
real FUNCTION fred4(j)
! Function for calculating uptake resistance
! modified to a profile defined in fred
! profile at Beerenbusch
use data_soil
implicit none
real fred(15)
integer j
fred = (/ 0.0, 0.03, 0.03, 0.02, 0.02, 0.02, 0.02, 0.01, 0.01, 0.01, &
0.01, 0.01, 0.01, 0.01, 0.01 /) ! fred fuer Beerenbusch
fred4 = fred(j)
END function fred4
!**************************************************************
real FUNCTION fred6(j)
! Function for calculating uptake resistance
! from Kloecking (2006) simular to fred1
! empirical relation between soil water content and resistance
! fred6=1 if field_cap <= wats <= (field_cap + 10%*field_cap)
use data_soil
implicit none
real hf, f09, f11, wc
integer j
f09 = field_cap(j)
f11 = 1.1 * field_cap(j)
wc = wats(j)
if (wc .le. wilt_p(j)) then
hf = 0.
else if (wc .lt. f09) then
hf = 0.1 + (0.9 *(wc-wilt_p(j)) / (f09-wilt_p(j)))
else if (wc .gt. f11) then
hf = 0.3 + 0.7 * (pv(j)-wc) / (pv(j)-f11)
if (hf .lt. 0.) hf = 0.001
else
hf = 1.
endif
fred6 = hf
END function fred6
!**************************************************************
real FUNCTION fred7(j)
! Function for calculating uptake resistance
! from CHEN (1993)
! empirical relation between soil water content and resistance
! fred1=1 if (field_cap - 10%*field_cap) <= wats <= (field_cap + 10%*field_cap)
use data_par
use data_soil
implicit none
real hf, f09, f11, wc, diff
integer j
f09 = 0.9 * field_cap(j)
f11 = 1.1 * field_cap(j)
wc = wats(j)
if (wc .lt. wilt_p(j)) then
hf = 0.
else if (wc .lt. f09) then
diff = f09-wilt_p(j)
if (diff .lt. zero) diff = 0.001
hf = exp(-5.*(f09-wc) / diff)
else if (wc .gt. f11) then
diff = pv(j)-f11
if (diff .lt. zero) diff = 0.001
hf = 0.3 + 0.7 * (pv(j)-wc) / diff
if (hf .lt. zero) hf = 0.001
else
hf = 1.
endif
fred7 = hf
END function fred7
!**************************************************************
real FUNCTION fred11(j)
! Function for calculating uptake resistance, especially adapted for Mistletoe disturbance
! function after van Wijk, 2000
use data_par
use data_soil
implicit none
real hf, S, f11, wc, diff
integer j
f11 = 1.1 * field_cap(j)
wc = wats(j)
if (wc .lt. wilt_p(j)) then
hf = 0.
else if (wc .lt. field_cap(j)) then
S=(field_cap(j)-wc)/(field_cap(j)-wilt_p(j))
hf = exp(-30*S) !30 = strong reduction in water avail.
else if (wc .gt. f11) then
diff = pv(j)-f11
if (diff .lt. zero) diff = 0.001
hf = 0.3 + 0.7 * (pv(j)-wc) / diff
if (hf .lt. zero) hf = 0.001
else
hf = 1.
endif
fred11 = hf
END function fred11
!**************************************************************
SUBROUTINE take_wat(eva_dem, psi)
! Estimation of water taking out for uncovered soil
use data_soil
use data_simul
implicit none
!input:
real :: eva_dem ! evaporation demand
real :: psi ! covering
integer i, ii, j, ntag ! max. layer of taking out
real, allocatable, dimension(:) :: gj
real, external :: b_r, funcov
real diff, gj_j, depth_j, depth_n, rij, rmax, rr, rs, sr
allocate (gj(nlay))
do i=1,nlay
wupt_ev(i)=0.0
gj(i)=0.0
enddo
ntag = 0
rmax = 0.0
depth_n = depth(n_ev_d)
do i=1,n_ev_d
rij = 0.0
rr = depth_n/depth(i)
sr = 0.0
rs = 0.0
do j=1,i
! depth for uncovered take out
depth_j = depth(j)
gj(j) = FUNCOV(w_ev_d, rs*rr, rr*depth_j)
rs = depth_j
sr = sr + gj(j)
enddo ! i
if (sr.gt.1.E-7) then
sr = 1.0/sr
do j=1,i
! water take out
! (psi = 1.-psi) no soil evaporation in case of total covering
! and maximal evaporation for uncovered soil
gj_j = -B_R(wats(j), field_cap(j), wilt_p(j)) &
* eva_dem * (1.-psi) * gj(j) * sr
gj_j = max(gj_j,0.0)
gj(j)= gj_j
rij = rij + gj_j
enddo ! i
if (rij .gt. rmax) then
rmax = rij
ntag = i
do ii=1,ntag
wupt_ev(ii) = gj(ii)
enddo
endif ! rij
endif ! sr
enddo ! n_ev_d
! balance
do i=1,nlay
diff = wats(i) - wilt_p(i)
if (wupt_ev(i) .gt. diff) then
wupt_ev(i) = diff
endif
enddo ! nlay
deallocate (gj)
END subroutine take_wat
!*******************************************************************************
real FUNCTION B_R(water, f_cap, wilting)
! Reduction function for water taking out (uncovered soil)
implicit none
!input:
real :: water ! water storage
real :: f_cap ! field capacity
real :: wilting ! wilting point
b_r = 1.0
if (water .lt. f_cap) B_R = max((water-wilting)/(f_cap-wilting), 0.0)
END function B_R
!******************************************************************************
real FUNCTION funcov(wt_d, a, bb)
! take out density function for uncovered soil
implicit none
!input:
real :: wt_d ! depth of water taking out by evaporation (cm)
real :: a, bb ! relative upper and lower depth of actual layer
real fk, wt_5, b
fk = .455218234
wt_5 = 0.05 * wt_d
b = min(bb,wt_d)
funcov = (- b + a + 1.05*wt_d*log((b+wt_5)/(a+wt_5)))*fk/wt_d
END function funcov
!******************************************************************************
real FUNCTION wat_new(wat_us, wat_in, ilayer)
! FUNCTION WIEN(WIA,NIST,ALAM,DTI,TT,DICK)
! Estimation of additional water after infiltration and percolation
use data_par
use data_soil
implicit none
! input:
real :: wat_us ! water content in relation to field capacity
real :: wat_in ! water infiltration into actual layer
integer :: ilayer ! number of actual layer
real dti !time step
real awi, b1, b2, la, hsqr, exphelp
dti = 1.
fakt = 0.4
if (fakt .ge. 0.0) then ! percolation?
la = 100.0 * fakt * dti * wlam(ilayer)/thick(ilayer)**2
if (wat_us .le. zero) then ! water near zero?
if (wat_in .le. zero) then ! infiltrated water near zero?
wat_new = wat_us + wat_in
else
if (wat_us+wat_in .gt. zero) then
exphelp = sqrt(la*wat_in) * (1 + wat_us/wat_in)*1
if (exphelp .le.10.) then ! avoid underflow
b1 = -exp(-2. * exphelp)
else
b1 = 0.
endif
wat_new = sqrt(wat_in/la) * (1+b1)/(1-b1)
else
wat_new = wat_us + wat_in
endif
endif ! wat_in
else
if (wat_in .lt. 0.) then
awi = abs(wat_in)
b1 = atan(wat_us/sqrt(awi/la)) / sqrt(la * awi)
if (b1 .gt. 1) then
b2 = sqrt (awi * la)
b1 = sin(b2) / cos(b2)
b2 = sqrt(awi / la)
wat_new = b2 * (wat_us - b2*b1) / (b2 + wat_us*b1)
else
wat_new = wat_in * (1-b1)
endif ! b1
else
if (wat_in .gt. 0.) then
b1 = sqrt(wat_in / la)
hsqr = sqrt(la*wat_in)
if (hsqr .lt. 10.) then
b2 = (wat_us - b1) * exp(-2.* hsqr) / (wat_us + b1)
if (b2 .ge. 1.0) then
b2 = 0.99999
endif
else
b2 = 0.
endif
wat_new = b1 * (1.+b2) / (1.-b2)
else
wat_new = wat_us / (1. + la*wat_us)
endif
endif ! wat_in
endif ! wat_us
else
wat_new = wat_us
endif ! fakt
END function wat_new
!******************************************************************************
SUBROUTINE bucket(bucksize1, bucksize2, buckdepth)
! calculation of bucket size (1m; without humus layer)
use data_soil
implicit none
real bucksize1, & ! bucket size of 1 m depth (nFK)
bucksize2, & ! bucket size of rooting zone
buckdepth, diff
integer j
bucksize1 = 0.
bucksize2 = 0.
buckdepth = 0.
do j=2,nlay
if ((depth(j)-depth(1)) .lt. 100.) then
bucksize1 = bucksize1 + wats(j) - wilt_p(j)
buckdepth = depth(j) - depth(1)
else
diff = 100. - buckdepth
bucksize1 = bucksize1 + (wats(j) - wilt_p(j))*diff/thick(j)
buckdepth = 100.
exit
endif
enddo
do j=2,nroot_max
bucksize2 = bucksize2 + wats(j) - wilt_p(j)
enddo
END subroutine bucket
!******************************************************************************
SUBROUTINE snowpack(snow_sm, p_inf, pev)
! properties of snow
! calculation of soil surface temperature under snow pack
use data_climate
use data_evapo
use data_inter
use data_par
use data_simul
use data_soil
use data_soil_t
implicit none
real p_inf ! infiltrated water
real snow_sm
real pev
real airtemp_sm ! melting temperature
real snow_old ! old snow pack
real tc_snow ! thermal conductivity of snow J/cm/s/K
real thick_snow ! thickness of snow
real dens_snow ! density of snow
real:: dens_sn_new = 0.1 ! density of fresh snow
real fakta
snow_old = snow
!substract evaporation of snowcover from snow in both cases
if (airtemp .lt. temp_snow) then ! frost conditions
snow = snow + prec_stand ! precipitation as snow
snow_sm = 0.0 ! no snow melting
p_inf = 0.0 ! no infiltrated precipitation
pev = max((pev_s - aev_i), 0.) ! interc. evapor. reduces soil evapor.
else
airtemp_sm = max(airtemp, 0.)
snow_sm = airtemp*(0.45+0.2*airtemp) ! snow melting
snow_sm = MIN(snow_sm, snow)
snow = snow - snow_sm
p_inf = prec_stand + snow_sm ! infiltrated precipitation
pev = max((pev_s - aev_i), 0.) ! interc. evapor. reduces soil evapor.
end if ! airtemp
if (snow .ge. zero) then
snow_day = snow_day + 1
days_snow = days_snow + 1
if (pev .le. zero) then
pev = 0.
else
! snow sublimation
aev_s = max(min(snow, pev), 0.)
snow = snow - aev_s
pev = pev - aev_s
endif
! soil surface temperature under snow pack
! snow hight = 0.2598 * water equivalent + 8.6851; adjustment from measurement values (see Bodentemperatur.xls)
if (snow .ge. 0.05) then
dens_snow = dens_sn_new + snow_day*0.025
dens_snow = MIN(dens_snow, 1.)
dens_snow = 0.5*(dens_sn_new*prec_stand + dens_snow*snow_old)/snow
dens_snow = MIN(dens_snow, 1.)
tc_snow = 0.7938*EXP(3.808*dens_snow)*0.001 ! thermal conductivity of snow J/cm/s/K
thick_snow = snow / dens_snow
fakta = tc_snow * 86400. * (thick(1)/2.) / (t_cond(1) * thick_snow) ! s --> day
temps_surf = (0.5*temps(1) + fakta*airtemp) / (1. + fakta) ! CoupModel (Jansson, 2001)
endif
else
snow_day = 0
endif
END subroutine snowpack
!******************************************************************************
SUBROUTINE soil_stress
! Calculation of the stress factors
use data_soil
use data_species
use data_stand
use data_par
implicit none
integer :: i, k
real :: m_1, m_2, n_1, n_2
real :: wratio, wafpo
real, dimension (1:4) :: allstress, xvar, yvar
!temperature stress
do i=1,nlay
do k=1,nspecies
if (temps(i) .ge. spar(k)%tbase) then
svar(k)%tstress(i) = sin((pi/2)*(temps(i)-spar(k)%tbase)/(spar(k)%topt-spar(k)%tbase))
else
svar(k)%tstress(i) = 0.
endif
!soil strength
wratio=0.
if (dens(i) .le. BDopt(i)) then
svar(k)%BDstr(i) = 1
svar(k)%BDstr(i) = 1
elseif (dens(i) .ge. svar(k)%BDmax(i)) then
svar(k)%BDstr(i) = 0
else
svar(k)%BDstr(i) = (svar(k)%BDmax(i)-dens(i))/(svar(k)%BDmax(i)-BDopt(i))
endif
if (watvol(i) .lt. wilt_p_v(i)) then
wratio = 0.
elseif (watvol(i) .gt. f_cap_v(i)) then
wratio = 1.
else
wratio = (watvol(i)-wilt_p_v(i))/(f_cap_v(i)-wilt_p_v(i))
endif
svar(k)%sstr(i)=svar(k)%BDstr(i)*sin(1.57*wratio)
!aeration
wafpo=watvol(i)/pv_v(i)
if (wafpo .ge. svar(k)%porcrit(i)) then
svar(k)%airstr(i) = (1.-wafpo)/(1.-svar(k)%porcrit(i))
else
svar(k)%airstr(i) = 1.
endif
if (svar(k)%airstr(i) .lt. 0.) svar(k)%airstr(i) = 0.
!soil acidity
xvar=(/spar(k)%ph_min, spar(k)%ph_opt_min, spar(k)%ph_opt_max, spar(k)%ph_max/)
yvar=(/0,1,1,0/)
m_1=(yvar(1)-yvar(2))/(xvar(1)-xvar(2))
n_1=yvar(2)-m_1*xvar(2)
m_2=(yvar(3)-yvar(4))/(xvar(3)-xvar(4))
n_2=yvar(4)-m_2*xvar(4)
if (phv(i) .gt. spar(k)%ph_opt_max .and. phv(i) .le. spar(k)%ph_max ) then
svar(k)%phstr(i)=m_2*phv(i)+n_2
elseif (phv(i) .lt. spar(k)%ph_opt_min .and. phv(i) .ge. spar(k)%ph_min ) then
svar(k)%phstr(i)=m_1*phv(i)+n_1
elseif (phv(i) .gt. spar(k)%ph_max .or. phv(i) .lt. spar(k)%ph_min) then
svar(k)%phstr(i)=0.
else
svar(k)%phstr(i)=1.
endif
! total stress (Rstress) is taken as the largest of the four
allstress(1)=svar(k)%tstress(i)
allstress(2)=svar(k)%sstr(i)
allstress(3)=svar(k)%airstr(i)
allstress(4)=svar(k)%phstr(i)
svar(k)%Rstress(i)= minval(allstress)
svar(k)%Smean(i)=svar(k)%Rstress(i)+svar(k)%Smean(i)
enddo
enddo
END subroutine soil_stress
!*******************************************************************************
SUBROUTINE hum_add(xfcap, xwiltp, xpv)
! Soil parameter according to [Kuntze et al., Bodenkunde, 1994], S. 172
use data_simul
use data_soil
use data_soil_cn
implicit none
integer :: i, k
real :: fcapi, clayvi, siltvi, humvi, humvi2, wiltpi, pvi, nfki, hcbc
real, dimension(nlay):: xfcap, xwiltp, xpv ! output of addition mm/dm
xfcap(1) = 0.0
xwiltp(1) = 0.0
xpv(1) = 0.0
do i = 1, nlay
fcapi = 0.
wiltpi = 0.
pvi = 0.
clayvi = clayv(i)
humvi = humusv(i)*100.
humvi2 = humusv(i)*humusv(i)
if (humvi .lt. 15.) then
if (clayvi .le. 0.05) then
wiltpi = 0.0609 * humvi2 + 0.33 * humvi
pvi = 0.0436 * humvi2 + 0.631 * humvi
nfki = -0.0009 * humvi2 + 1.171 * humvi
fcapi = nfki + wiltpi
else if (clayvi .le. 0.12) then
wiltpi = 0.0357 * humvi2 + 0.0762 * humvi
pvi = 0.0441 * humvi2 + 0.5455 * humvi
nfki = 0.0252 * humvi2 + 0.7462 * humvi
fcapi = nfki + wiltpi
else if (clayvi .le. 0.17) then
wiltpi = 0.0374 * humvi2 - 0.1777 * humvi
pvi = 0.0552 * humvi2 + 0.2936 * humvi
nfki = 0.0324 * humvi2 + 0.6243 * humvi
fcapi = nfki + wiltpi
else if (clayvi .le. 0.35) then
wiltpi = 0.0179 * humvi2 - 0.0385 * humvi
pvi = 0.0681 * humvi2 + 0.0768 * humvi
nfki = 0.0373 * humvi2 + 0.3617 * humvi
fcapi = nfki + wiltpi
else if (clayvi .le. 0.65) then
wiltpi = 0.0039 * humvi2 + 0.0254 * humvi
pvi = 0.0613 * humvi2 + 0.0947 * humvi
nfki = 0.0338 * humvi2 + 0.0904 * humvi
fcapi = nfki + wiltpi
else
wiltpi = 0.0
pvi = 0.0613 * humvi2 + 0.0947 * humvi
nfki = 0.0104 * humvi2 + 0.2853 * humvi
fcapi = nfki + wiltpi
endif
else ! humvi > 15
! organic soils
continue
endif ! humvi
xfcap(i) = fcapi
xwiltp(i) = wiltpi
xpv(i) = pvi
enddo
if (flag_bc .gt. 0) then
do i = 1, nlay
if (C_bc(i) .gt. 0.) then
fcapi = f_cap_v(i)
clayvi = clayv(i)
siltvi = siltv(i)
humvi = humusv(i)*100.
hcbc = C_bc(i)*100.*100. / (cpart_bc(y_bc_n) * dmass(i))
if ((clayvi .le. 0.17) .and. (siltvi .le. 0.5)) then ! sand
fcapi = 0.0619 * hcbc
wiltpi = 0.0375 * hcbc
nfki = 7.0
elseif ((clayvi .le. 0.45) .and. (siltvi .gt. 0.17)) then ! loam
fcapi = 0.015 * hcbc
wiltpi = 0.0157 * hcbc
nfki = 10.
else ! clay
fcapi = -0.0109 * hcbc
wiltpi = -0.0318 * hcbc
nfki = 16.
endif
xfcap(i) = xfcap(i) + fcapi
xwiltp(i) = xwiltp(i) + wiltpi
endif
enddo
endif
END subroutine hum_add
!*******************************************************************************
SUBROUTINE bc_appl
! application of biochar
use data_out
use data_simul
use data_soil
use data_soil_cn
implicit none
character :: text
integer :: ios, inunit, j
logical :: ex
real :: hcbc
call testfile(valfile(ip),ex)
IF (ex .eqv. .true.) then
inunit = getunit()
ios=0
open(inunit,file=valfile(ip),iostat=ios,status='old',action='read')
if (.not.flag_mult8910) then
print *,'***** Reading application values of biochar from file ',valfile(ip),'...'
write (unit_err, *) 'Application values of biochar from file ',trim(valfile(ip))
endif
do
read(inunit,*) text
IF(text .ne. '!')then
backspace(inunit)
exit
endif
enddo
read (inunit,*,iostat=ios) n_appl_bc
allocate (C_bc_appl(n_appl_bc))
allocate (N_bc_appl(n_appl_bc))
allocate (bc_appl_lay(n_appl_bc))
allocate (cnv_bc(n_appl_bc))
allocate (dens_bc(n_appl_bc))
allocate (cpart_bc(n_appl_bc))
allocate (y_bc(0 : n_appl_bc + 1))
y_bc = 0
C_bc_appl = 0.
N_bc_appl = 0.
do j = 1, n_appl_bc
read (inunit,*,iostat=ios) y_bc(j), cpart_bc(j), cnv_bc(j), dens_bc(j)
read (inunit,*,iostat=ios) bc_appl_lay(j), C_bc_appl(j)
enddo
endif ! ex
END subroutine bc_appl
!*******************************************************************************