From 7accaf8a25e5c0236b62f15427869ce27d713c24 Mon Sep 17 00:00:00 2001
From: George Faykin <pofnutsy@gmail.com>
Date: Fri, 27 Jun 2025 13:12:00 +0300
Subject: [PATCH] Draft for future features

---
 carbon_pools_config.nml                       |   4 +-
 .../carbon_models/carbon_model_ROTHC.f90      |  22 +---
 .../carbon_models/carbon_model_ROTHC_aux.f90  |  15 ++-
 source/carbon/carbon_postprocessing.f90       | 124 +++++++++---------
 source/carbon_pools.f90                       |   4 +-
 source/config.f90                             |  80 +++++------
 source/environment/environment.f90            |  46 +++----
 source/grid.f90                               |  84 ++++++------
 station_config.nml                            |   2 +-
 ui1_config.nml                                |  15 ++-
 10 files changed, 197 insertions(+), 199 deletions(-)

diff --git a/carbon_pools_config.nml b/carbon_pools_config.nml
index 4265448..4919afa 100644
--- a/carbon_pools_config.nml
+++ b/carbon_pools_config.nml
@@ -1,4 +1,4 @@
-!"    Настройки данных для carbon_pools
+!"    Настройки данных для carbon_pools_config
 !"
 !"    (технически представляет собой fortran-namelist)
 
@@ -20,6 +20,6 @@
       ! SOCS
         C_s1_in = 0.
         C_s2_in = 0.
- 
+
 ! -----------------------------------------------------------------
 /
diff --git a/source/carbon/carbon_models/carbon_model_ROTHC.f90 b/source/carbon/carbon_models/carbon_model_ROTHC.f90
index 27506c2..2c50437 100644
--- a/source/carbon/carbon_models/carbon_model_ROTHC.f90
+++ b/source/carbon/carbon_models/carbon_model_ROTHC.f90
@@ -27,33 +27,17 @@ module carbon_model_rothc
             call set_pool(pid = n_CHUM, name = 'CHUM', initial_value = CHUM_iv, alias = CHUM)
             call set_pool(pid = n_CIOM, name = 'CIOM', initial_value = CIOM_iv, alias = CIOM)
 
-!        station: opt: CDPM:     CRPM:   CBIO:    CHUM:    CIOM:
-!        DAO4     1    0.01944  1.73544  0.06188  1.0416   0.245
-!                 2    0.02037  1.75515  0.06464  1.14567  0.257
-!                 3    0.02037  1.75515  0.06464  1.14567  0.257
-!                 4    0.0192   1.73087  0.0612   1.01558  0.24
-
-!        DAO3     1    0.01792  1.10183  0.05705  1.45947  0.221
-!                 2    0.01792  1.10183  0.05705  1.45947  0.224
-!                 3    0.01804  1.10426  0.05741  1.47248  0.225
-!                 4    0.01792  1.10183  0.05705  1.45947  0.223
-
-!        TRGK     1    0.02132  1.12986  0.05946  1.64844  0.238
-!                 2    0.0196   1.08615  0.05455  1.46279  0.224
-!                 3    0.02132  1.12986  0.05946  1.64844  0.238
-!        VLDR     1    0.00777  1.38303  0.03275  0.14961  0.119
-!        ROST     1    0.04936  0.799    0.11873  7.07025  0.814
 
             ! litterfall ---------------------
             call set_flux(fid = n_F, pid_out = n_Cveg, pid_in = n_CDPM, name = 'fdpm*organic')
             call set_mult(n_F, 'lin', x_ij = organic, k = fdpm)
-            
+
             call set_flux(fid = n_F, pid_out = n_Cveg, pid_in = n_CRPM, name = '(1-fdpm)*organic')
             call set_mult(n_F, 'lin', x_ij = organic, k = (1. - fdpm))
-            
+
             call set_flux(fid = n_F, pid_out = n_Cveg, pid_in = n_CRPM, name = '0.49*FYM')
             call set_mult(n_F, 'lin', x_ij = FYM, k = fdpm2)
-      
+
             call set_flux(fid = n_F, pid_out = n_Cveg, pid_in = n_CDPM, name = '0.49*FYM')
             call set_mult(n_F, 'lin', x_ij = FYM, k = fdpm2)
 
diff --git a/source/carbon/carbon_models/carbon_model_ROTHC_aux.f90 b/source/carbon/carbon_models/carbon_model_ROTHC_aux.f90
index 9788224..49fc6ea 100644
--- a/source/carbon/carbon_models/carbon_model_ROTHC_aux.f90
+++ b/source/carbon/carbon_models/carbon_model_ROTHC_aux.f90
@@ -2,8 +2,8 @@ module carbon_model_rothc_aux
 
     ! интерфейс
 ! ----------------------------------------------- Use pack ------------------------------------------------------------
- 	use environment_core, only: Tsoil, Wsoil, organic, FYM, veg, sw, bettar, Evpar, pr
-	use config, only: station_name, station_opt, carbon_model_type
+    use environment_core, only: Tsoil, Wsoil, organic, FYM, veg, sw, bettar, Evpar, pr
+    use config, only: station_name, station_opt, carbon_model_type
     use const,  only: yrs, pi, nmonth
     use grid,   only: date_c, i0, i1, j0, j1, ml, dt
 ! ---------------------------------------------- Variables ------------------------------------------------------------
@@ -45,12 +45,12 @@ module carbon_model_rothc_aux
     !< Скорость дыхания единицы массы каждого пула в стандартных условиях, [1-s]
     real, parameter :: alphadr = 1.44       !< Определяет соотношение поступления опада между DPM и RPM, [dim],
     ! Для деревьев, для кустарников, для натуральной травы, для СХ (/ 0.25, 0.33, 0.67, 1.44 /)
-    
+
     real, allocatable :: SA(:,:)       !< Определяет распределение выдыхаемой части пула по остальным пулам
     real, allocatable :: CO2_prop(:,:) !< Определяет распределение выдыхаемой части пула в CO2
     real, allocatable :: BIO_prop(:,:) !< Определяет распределение выдыхаемой части пула в CBIO
     real, allocatable :: HUM_prop(:,:) !< Определяет распределение выдыхаемой части пула в CHUM
-    
+
     ! ------ Climate variables --------
     ! ------ Determined within
     real, allocatable :: s0(:,:,:)          !< Оптимальная влажность почвы, [dim]
@@ -181,9 +181,10 @@ contains
 
         use grid, only : date_c
 
-        open(unit=500, file='results/'//trim(carbon_model_type)//'/'//trim(station_name)//'_'//trim(station_opt)//'.txt', status='unknown')
-        write(500,*) date_c%timestamp,';',CDPM(:,:,1),';',CRPM(:,:,1),';',CBIO(:,:,1),';',CHUM(:,:,1),';', CIOM(:,:,1)
-    
+        !open(1, file='results/'//trim(carbon_model_type)//'/'//trim(station_name)//'_'//trim(station_opt)//'.txt', status='unknown')
+        !write(1,*) date_c%timestamp,';',CDPM(:,:,1),';',CRPM(:,:,1),';',CBIO(:,:,1),';',CHUM(:,:,1),';', CIOM(:,:,1)
+        !close(1)
+
         ! ---- Initialization ------
         !print*, 'finish thing 1, ', CDPM(:,:,1)/cs*100,'%'
         !print*, 'finish thing 2, ', CRPM(:,:,1)/cs*100,'%'
diff --git a/source/carbon/carbon_postprocessing.f90 b/source/carbon/carbon_postprocessing.f90
index 6e4ab9c..79fcb70 100644
--- a/source/carbon/carbon_postprocessing.f90
+++ b/source/carbon/carbon_postprocessing.f90
@@ -7,16 +7,16 @@ module carbon_postprocessing
     use carbon_core, only : pool_type, flux_type, pool, flux, npool_default, nflux_default, npool, nflux
 
     implicit none
-    
+
     private
     public :: carbon_standard_print
     public :: carbon_standard_output
     public :: carbon_testing_write_log
     public :: carbon_testing_read_log
-    
+
     ! переменные
     ! ---------------------------------------------------------------------------------
-    
+
     integer :: ncid, t_id_v
     integer, allocatable :: pool_id(:), flux_id(:)
     
@@ -26,16 +26,16 @@ module carbon_postprocessing
     type(pool_type), target :: pool_sum_year(npool_default)
     type(flux_type), target :: flux_sum_year(nflux_default)
     integer :: n_sum_year
-    
-    
-    
-    
+
+
+
+
 contains
 
 
     ! внешние процедуры
     ! ---------------------------------------------------------------------------------
-    
+
     subroutine carbon_testing_write_log()
         ! ---------------------------------------
         use const, only : miss_v, len_default
@@ -43,12 +43,12 @@ contains
         use grid, only : i0, i1, j0, j1, tt, ni, nj
         use carbon_core, only : ntile
         use config, only : carbon_model_type
-        
+
         integer :: i, j, n, k
         integer :: rec_len
         character(len_default) :: logname
         logical, save :: firstcall = .true.
-        
+
         if (npool + nflux > 0) then
             if (firstcall) then
                 do n = 1, npool
@@ -67,26 +67,26 @@ contains
             write(100,rec=tt) ((((pool(k)%val(i,j,n),i=i0,i1),j=j0,j1),n=1,ntile),k=1,npool), &
                             & ((((flux(k)%val(i,j,n),i=i0,i1),j=j0,j1),n=1,ntile),k=1,nflux)
         endif
-        
+
     end subroutine
 
 
     subroutine carbon_testing_read_log()
         ! ---------------------------------------
         !< @brief отслеживание технических ошибок
-        
+
         use const, only : miss_v, len_default
         use paths, only : path_logs
         use config, only : carbon_model_type
         use carbon_core, only : ntile
         use grid, only : i0, i1, j0, j1, tt, ni, nj
-        
+
         integer :: i, j, n, k
         integer :: rec_len, ios
         character(len_default) :: logname
         logical, save :: firstcall = .true.
         logical, save :: ex
-        
+
         if (firstcall) then
             do n = 1, npool
                 allocate(pool_ref(n)%val, source = pool(n)%val)
@@ -106,7 +106,7 @@ contains
             endif
             firstcall = .false.
         endif
-        
+
         if (ex) then
             read(100,rec=tt,iostat=ios) ((((pool_ref(k)%val(i,j,n),i=i0,i1),j=j0,j1),n=1,ntile),k=1,npool), &
                                       & ((((flux_ref(k)%val(i,j,n),i=i0,i1),j=j0,j1),n=1,ntile),k=1,nflux)
@@ -126,21 +126,21 @@ contains
                 enddo
             endif
         endif
-        
+
     end subroutine
-    
+
 
     subroutine carbon_standard_print()
         ! ---------------------------------------
         !< @brief стандартный вывод данных в консоль
 
         use config, only : nv_singlecolumn, testing_log_mode
-        use const, only : umol2kg, miss_v
-        use grid, only : i0, j0, date_c, tt
+        use const,  only : umol2kg, miss_v
+        use grid,   only : i0, j0, date_c, tt
         use carbon_core, only : ntile
 
         integer :: n, n0, n1
-        
+
         if (nv_singlecolumn /= miss_v) then
             n0 = nv_singlecolumn
             n1 = nv_singlecolumn
@@ -148,9 +148,9 @@ contains
             n0 = 1
             n1 = ntile
         endif
-        
+
         print'(1x,a,1x,i10)', date_c%timestamp, tt
-        
+
         print*, 'пулы (кг/м2):'
         select case(testing_log_mode)
             case('none')
@@ -168,7 +168,7 @@ contains
                     enddo
                 endif
         end select
-        
+
         print*, 'потоки (мкмоль/м2/с):'
         select case(testing_log_mode)
             case('none')
@@ -186,35 +186,36 @@ contains
                     enddo
                 endif
         end select
-        
+
         print*
-        
+
     end subroutine
-    
-    
+
+
     subroutine carbon_standard_output()
         ! ---------------------------------------
         !< @brief стандартный вывод данных в файлы
 
-        use config, only : if_out_yearly
-        use const, only : umol2kg, miss_v
-        use grid, only : i0, j0, date_c
         use datetime, only : date_type
-        use paths, only : path_out
+        use config,   only : if_out_yearly, station_name, station_opt, carbon_model_type
+        use const,    only : umol2kg, miss_v
+        use grid,     only : i0, j0, date_c
+        use paths,    only : path_out
+
         logical, save :: firstcall = .true.
         integer :: n
-        
+
         type(date_type), save :: date_mem
         data date_mem%h /miss_v/
         data date_mem%d /miss_v/
         data date_mem%m /miss_v/
         data date_mem%d /miss_v/
-        
+
         logical :: if_hourly_output
         logical :: if_daily_output
         logical :: if_monthly_output
         logical :: if_yearly_output
-        
+
         if (date_c%h /= date_mem%h) then
             if_hourly_output = .true.
             date_mem%h = date_c%h
@@ -245,10 +246,10 @@ contains
         else
             if_yearly_output = .false.
         end if
-        
-        
+
+
         if (if_yearly_output) then
-            
+
             if (firstcall) then
                 call nc_create(path_out//'out_year.nc', ncid)
                 firstcall = .false.
@@ -262,7 +263,7 @@ contains
                 enddo
                 n_sum_year = 0
             endif
-            
+
             do n = 1, npool
                 pool_sum_year(n)%val(:,:,:) = pool_sum_year(n)%val(:,:,:) + pool(n)%val(:,:,:)
             enddo
@@ -270,25 +271,30 @@ contains
                 flux_sum_year(n)%val(:,:,:) = flux_sum_year(n)%val(:,:,:) + flux(n)%val(:,:,:)
             enddo
             n_sum_year = n_sum_year + 1
-            
+
         endif
-            
+
+        !open(1, file='results/'//trim(carbon_model_type)//'/'//trim(station_name)//'_'//trim(station_opt)//'.txt', status='unknown')
+        !write(1,*) date_c%timestamp,' ',pool(:)%val(:,:,:)
+        ! Как выводить данные через переменную pool(n)?
+        !close(1)
+
     end subroutine
-    
+
     ! внутренние процедуры
     ! ---------------------------------------------------------------------------------
-    
+
     subroutine nc_create(filename, ncid)
         ! ---------------------------------------
         use netcdf
         use netcdf_kit, only : nc_errhand
-        use grid, only : i0, i1, j0, j1, lon, lat, ni, nj
-        use const, only : deg2rad
-    
+        use grid,       only : i0, i1, j0, j1, lon, lat, ni, nj
+        use const,      only : deg2rad
+
         character(*), intent(in) :: filename
         integer, intent(out) :: ncid
         integer :: n, i_id, j_id, t_id, lon_id, lat_id
-        
+
         call nc_errhand( nf90_create(filename, nf90_netcdf4, ncid) )
         call nc_errhand( nf90_def_dim(ncid, 'lon', i1-i0+1, i_id) )
         call nc_errhand( nf90_def_dim(ncid, 'lat', j1-j0+1, j_id) )
@@ -305,37 +311,37 @@ contains
             call nc_errhand( nf90_def_var(ncid, trim(flux(n)%name), nf90_float, (/i_id, j_id, t_id/), flux_id(n)) )
         enddo
         call nc_errhand( nf90_enddef(ncid) )
-        
+
         call nc_errhand( nf90_put_var(ncid, lon_id, 0.01*nint(lon(:)*100), (/1/), (/ni/)) )
         call nc_errhand( nf90_put_var(ncid, lat_id, 0.01*nint(lat(:)*100), (/1/), (/nj/)) )
-        
+
         do n = 1, npool
             allocate(pool_sum_year(n)%val, source = pool(n)%val)
         enddo
         do n = 1, nflux
             allocate(flux_sum_year(n)%val, source = flux(n)%val)
         enddo
-        
+
     end subroutine
-    
-    
+
+
     subroutine nc_write(ncid)
         ! ---------------------------------------
         use netcdf
-        use netcdf_kit, only : nc_errhand
-        use grid, only : i0, i1, j0, j1, ni, nj
         use carbon_core, only : ntile, tile_weight
-        use const, only : umol2kg
-    
+        use netcdf_kit,  only : nc_errhand
+        use grid,        only : i0, i1, j0, j1, ni, nj
+        use const,       only : umol2kg
+
         integer, intent(in) :: ncid
         real, allocatable :: work(:,:)
         integer :: i, j, n, nn
         integer, save :: t = 0
-        
+
         t = t + 1
 
         call nc_errhand( nf90_put_var(ncid, t_id_v, (/t/), (/t/), (/1/)) )
-        
+
         allocate(work(i0:i1,j0:j1))
         do n = 1, npool
             work(:,:) = 0.
@@ -351,7 +357,7 @@ contains
             enddo
             call nc_errhand( nf90_put_var(ncid, pool_id(n), work(:,:), (/1,1,t/), (/ni,nj,1/)) )
         enddo
-        
+
         do n = 1, nflux
             work(:,:) = 0.
             do i = i0, i1
@@ -364,7 +370,7 @@ contains
             enddo
             call nc_errhand( nf90_put_var(ncid, flux_id(n), work(:,:), (/1,1,t/), (/ni,nj,1/)) )
         enddo
-        
+
     end subroutine
 
 
diff --git a/source/carbon_pools.f90 b/source/carbon_pools.f90
index 17f9240..929f4d3 100644
--- a/source/carbon_pools.f90
+++ b/source/carbon_pools.f90
@@ -31,7 +31,7 @@ contains
 
     ! внешние процедуры
     ! ---------------------------------------------------------------------------------
-    
+
     subroutine carbon_pools_init()
         ! ---------------------------------------
         call pools_init()
@@ -186,7 +186,7 @@ contains
                     Csoil_iv = Csoil_st_in  (2,4)
                     Csoilb_iv = Csoilb_st_in (2,4)
                 end select
-                  
+
               case('TRGK')
                 select case(station_opt)
                   case('1')
diff --git a/source/config.f90 b/source/config.f90
index 36a9539..ef6188d 100644
--- a/source/config.f90
+++ b/source/config.f90
@@ -7,14 +7,14 @@ module config
     public
     private :: config_check
 
- ! конфигурация   
+ ! конфигурация
     character(len_default) :: carbon_model_type
-	
- ! входные данные	
+
+ ! входные данные
     character(len_default) :: environment_data_type
     character(len_default) :: lsm_datafile
     character(len_default) :: lsm_dataformat
-	character(len_default) :: station_name
+    character(len_default) :: station_name
     character(len_default) :: station_opt
 
  ! пространственная сетка
@@ -44,7 +44,7 @@ module config
     character(len_default) :: testing_log_mode
     integer :: nv_singlecolumn
     character(len_default) :: environment_model_type
-	
+
  ! Данные для станций наблюдения за климатом
     character(len_default) :: datetime_init_1
     character(len_default) :: datetime_last_1
@@ -76,7 +76,7 @@ module config
     real :: Csoilb_st_in(5,4)
     real :: C_s1_st_in(5,4)
     real :: C_s2_st_in(5,4)
-    
+
     namelist /carbon_pools_config_namelist/  &
     & CDPM_in, &
     & CRPM_in, &
@@ -174,13 +174,13 @@ module config
 
             call config_check()
 
-            open(10, file = 'station_config.nml', status = 'old', action = 'read')
-            read(10, nml = station_config_namelist)
-            close(10)
+            open(1, file = 'station_config.nml', status = 'old', action = 'read')
+            read(1, nml = station_config_namelist)
+            close(1)
 
-            open(10, file = 'carbon_pools_config.nml', status = 'old', action = 'read')
-            read(10, nml = carbon_pools_config_namelist)
-            close(10)
+            open(1, file = 'carbon_pools_config.nml', status = 'old', action = 'read')
+            read(1, nml = carbon_pools_config_namelist)
+            close(1)
 
             select case (lsm_dataformat)
                 case('inmcm')
@@ -206,21 +206,21 @@ module config
                     nc_namespace%mask  = 'mask'
                     ! см также перевод единиц в environment_data_lsm_offline.f90
             end select
-            
+
         end subroutine
-        
-        
+
+
         subroutine config_check()
-        
+
             ! тест на доступные значения
             ! -----------------------------------------------------------------------------
-        
+
             select case(carbon_model_type)
                 case('inmcm', 'socs', 'other', 'rothc')
                 case default
                     stop "check failed : unknown carbon_model_type"
             end select
-            
+
             select case(environment_data_type)
                 case('none', 'generator', 'lsm_offline', 'station')
                 case('lsm_online')
@@ -228,15 +228,15 @@ module config
                 case default
                     stop "check failed : unknown environment_data_type"
             end select
-			
-			select case(station_name)
-			    case('Rostov', 'DAO3','DAO4', 'VLDMR', 'TRGK')
+
+            select case(station_name)
+                case('Rostov', 'DAO3','DAO4', 'VLDMR', 'TRGK')
                 case default
                     stop "check failed : unknown station name"
             end select
-			
-			select case(station_opt)
-			    case('1', '2','3', '4')
+
+            select case(station_opt)
+                case('1', '2','3', '4')
                 case default
                     stop "check failed : unknown station_opt"
             end select
@@ -248,46 +248,46 @@ module config
                 case default
                     stop "check failed : unknown lsm_dataformat"
              end select
-            
+
             select case(spatial_grid_mode)
                 case('none', 'auto', 'manual')
                 case default
                     stop "check failed : unknown spatial_grid_mode"
             end select
-            
+
             select case(spatial_sample_mode)
                 case('id', 'ich', 'point', 'polygon', 'all')
                 case default
                     stop "check failed : unknown spatial_sample_mode"
             end select
-            
+
             select case(dt_mode)
                 case('auto', 'manual')
                 case default
                     stop "check failed : unknown dt_mode"
             end select
-            
+
             select case(datetime_init_mode)
                 case('auto', 'manual')
                 case default
                     stop "check failed : unknown datetime_init_mode"
             end select
-            
+
             select case(ntime_mode)
                 case('auto', 'ntime', 'datetime_last')
                 case default
                     stop "check failed : unknown ntime_mode"
             end select
-            
+
             select case(testing_log_mode)
                 case('none', 'write', 'read')
                 case default
                     stop "check failed : unknown testing_log_mode"
             end select
-            
+
             ! тест на сочетания настроек
             ! -----------------------------------------------------------------------------
-            
+
             if ((station_name == 'Rostov' .or. station_name == 'VLDMR' .or. station_name == 'TRGK' ) .and. station_opt == '4') then 
                 stop "check failed : this station name can't work with this station_opt"
             endif
@@ -295,31 +295,31 @@ module config
             if (carbon_model_type == 'inmcm' .and. environment_data_type == 'none') then
                 stop "check failed : carbon_model_type == 'inmcm' requires environment_data_type /= 'none'"
             endif
-            
+
             if (carbon_model_type == 'inmcm' .and. spatial_grid_mode == 'none') then
                 stop "check failed : carbon_model_type == 'inmcm' requires spatial_grid_mode /= 'none'"
             endif
-            
+
             if (environment_data_type == 'lsm_offline' .and. spatial_grid_mode == 'none') then
                 stop "check failed : environment_data_type == 'lsm_offline' requires spatial_grid_mode /= 'none'"
             endif
-            
+
             if (spatial_sample_mode == 'auto' .and. environment_data_type /= 'lsm_offline') then
                 stop "check failed : spatial_sample_mode == all' requires environment_data_type == 'lsm_offline'"
             endif
-            
+
             if (dt_mode == 'auto' .and. environment_data_type /= 'lsm_offline') then
                 stop "check failed : dt_mode == 'auto' requires environment_data_type == 'lsm_offline'"
             endif
-            
+
            ! if (datetime_init_mode == 'auto' .and. environment_data_type /= 'lsm_offline') then
            !     stop "check failed : datetime_init_mode == 'auto' requires environment_data_type == 'lsm_offline'"
            ! endif
-            
+
            ! if (ntime_mode == 'auto' .and. environment_data_type /= 'lsm_offline') then
            !     stop "check failed : ntime_mode == 'auto' requires environment_data_type == 'lsm_offline'"
            ! endif
-        
+
         end subroutine
-        
+
 end module
diff --git a/source/environment/environment.f90 b/source/environment/environment.f90
index 0acf866..1114714 100644
--- a/source/environment/environment.f90
+++ b/source/environment/environment.f90
@@ -19,11 +19,11 @@ module environment
     use environment_data_station, only : environment_data_init_station => environment_data_init, &
                                          & environment_data_calc_at_timestep_station => environment_data_calc_at_timestep, &
                                          & environment_data_calc_at_cell_station => environment_data_calc_at_cell, &
-                                         & environment_data_calc_at_tile_station => environment_data_calc_at_tile									  
+                                         & environment_data_calc_at_tile_station => environment_data_calc_at_tile
 
     use config, only : environment_data_type, &
                      & environment_model_type
-            
+
     implicit none
 
     private
@@ -44,12 +44,12 @@ module environment
             integer, intent(in) :: ii, jj, nn
         end subroutine
     end interface
-    
+
     procedure(interface_init), pointer :: environment_data_init
     procedure(interface_calc_at_timestep), pointer :: environment_data_calc_at_timestep
     procedure(interface_calc_at_cell), pointer :: environment_data_calc_at_cell
     procedure(interface_calc_at_tile), pointer :: environment_data_calc_at_tile
-    
+
     procedure(interface_init), pointer :: environment_model_init
     procedure(interface_calc_at_timestep), pointer :: environment_model_calc_at_timestep
     procedure(interface_calc_at_cell), pointer :: environment_model_calc_at_cell
@@ -59,7 +59,7 @@ contains
 
 
     subroutine environment_init()
-    
+
         select case(environment_data_type)
             case('none')
                 environment_data_init => dummy_init
@@ -76,8 +76,8 @@ contains
                 environment_data_calc_at_timestep => environment_data_calc_at_timestep_lsm_offline
                 environment_data_calc_at_cell => environment_data_calc_at_cell_lsm_offline
                 environment_data_calc_at_tile => environment_data_calc_at_tile_lsm_offline
-       
-			case('station')
+
+            case('station')
                 environment_data_init => environment_data_init_station
                 environment_data_calc_at_timestep => environment_data_calc_at_timestep_station
                 environment_data_calc_at_cell => environment_data_calc_at_cell_station
@@ -87,18 +87,18 @@ contains
 
         select case(environment_model_type)
             case('inmcm')
-				select case(environment_data_type)
-					case('none', 'station')
-						environment_model_init => dummy_init
-						environment_model_calc_at_timestep => dummy_calc_at_timestep
-						environment_model_calc_at_cell => dummy_calc_at_cell
-						environment_model_calc_at_tile => dummy_calc_at_tile
-					case default
-						environment_model_init => environment_model_init_inmcm
-						environment_model_calc_at_timestep => environment_model_calc_at_timestep_inmcm
-						environment_model_calc_at_cell => environment_model_calc_at_cell_inmcm
-						environment_model_calc_at_tile => environment_model_calc_at_tile_inmcm
-					end select
+                select case(environment_data_type)
+                    case('none', 'station')
+                        environment_model_init => dummy_init
+                        environment_model_calc_at_timestep => dummy_calc_at_timestep
+                        environment_model_calc_at_cell => dummy_calc_at_cell
+                        environment_model_calc_at_tile => dummy_calc_at_tile
+                    case default
+                        environment_model_init => environment_model_init_inmcm
+                        environment_model_calc_at_timestep => environment_model_calc_at_timestep_inmcm
+                        environment_model_calc_at_cell => environment_model_calc_at_cell_inmcm
+                        environment_model_calc_at_tile => environment_model_calc_at_tile_inmcm
+                    end select
             case default
                 environment_model_init => dummy_init
                 environment_model_calc_at_timestep => dummy_calc_at_timestep
@@ -144,11 +144,11 @@ contains
         call environment_model_calc_at_tile(ii,jj,nn)
 
     end subroutine
-    
-    
-    
+
+
+
     ! пустышки для указателей
-    
+
     subroutine dummy_init()
     end subroutine
 
diff --git a/source/grid.f90 b/source/grid.f90
index c36b137..c893639 100644
--- a/source/grid.f90
+++ b/source/grid.f90
@@ -15,10 +15,10 @@ module grid
     private :: spatial_grid_init
     private :: temporal_grid_init
     private :: vertical_grid_init
-    
+
     ! переменные
     ! ---------------------------------------------------------------------------------
-    
+
     ! широтно-долготная сетка:
     integer :: nlon, nlat
     real :: dlon, dlat, lon_ref, lat_ref
@@ -56,7 +56,7 @@ module grid
     character(len_default) :: DI
     type(date_type) :: date_c, date_fst, date_lst
     integer :: year_min, year_max
-	
+
     ! текущие индексы в циклах:
     integer :: tt
     integer :: ii
@@ -69,7 +69,7 @@ contains
 
     ! внешние процедуры
     ! ---------------------------------------------------------------------------------
-    
+
     subroutine grid_init()
         ! ---------------------------------------
         call spatial_grid_init()
@@ -80,14 +80,14 @@ contains
         
     end subroutine
 
-    
+
     ! внутренние процедуры
     ! ---------------------------------------------------------------------------------
 
     subroutine spatial_grid_init()
         ! ---------------------------------------
         !< @brief широтно-долготная сетка
-    
+
         use config, only : environment_data_type, &
                             & lsm_datafile, &
                             & nc_namespace, &
@@ -99,7 +99,7 @@ contains
                             & point, &
                             & polygon
         use paths, only : path_inmcm_data
-        
+
         integer :: i, j, n
         integer :: ncid, dimid, varid, ios
         real, allocatable :: work1r(:), work2r(:,:)
@@ -107,9 +107,9 @@ contains
         real :: fill_v
 
         if (environment_data_type == 'lsm_offline') then
-                
+
             call nc_errhand( nf90_open(trim(lsm_datafile), nf90_nowrite, ncid) )
-            
+
             call nc_errhand( nf90_inq_dimid(ncid, 'lon', dimid) )
             call nc_errhand( nf90_inquire_dimension(ncid, dimid, len = ni_nc) )
             call nc_errhand( nf90_inq_varid(ncid, 'lon', varid) )
@@ -124,7 +124,7 @@ contains
             lon0_nc = work1r(1)
             lon1_nc = work1r(ni_nc)
             deallocate(work1r)
-        
+
             call nc_errhand( nf90_inq_dimid(ncid, 'lat', dimid) )
             call nc_errhand( nf90_inquire_dimension(ncid, dimid, len = nj_nc) )
             call nc_errhand( nf90_inq_varid(ncid, 'lat', varid) )
@@ -139,17 +139,17 @@ contains
             lat0_nc = work1r(1)
             lat1_nc = work1r(nj_nc)
             deallocate(work1r)
-            
+
             nlon_nc = 360/dlon_nc
             nlat_nc = 180/dlat_nc
             lon_ref_nc = -180. + 0.5*dlon_nc
             lat_ref_nc = -90. + 0.5*dlat_nc
-            
+
             i0_nc = nint((lon0_nc - lon_ref_nc)/dlon_nc) + 1
             i1_nc = nint((lon1_nc - lon_ref_nc)/dlon_nc) + 1
             j0_nc = nint((lat0_nc - lat_ref_nc)/dlat_nc) + 1
             j1_nc = nint((lat1_nc - lat_ref_nc)/dlat_nc) + 1
-            
+
             allocate(mask_nc(i0_nc:i1_nc,j0_nc:j1_nc))
             ios = nf90_inq_varid(ncid, nc_namespace%mask, varid)
             if (ios == 0) then
@@ -169,11 +169,11 @@ contains
                     enddo
                 enddo
             endif
-            
+
             call nc_errhand( nf90_close(ncid) )
-            
+
         else
-        
+
             ni_nc = miss_v
             nj_nc = miss_v
             dlon_nc = miss_v
@@ -190,10 +190,10 @@ contains
             i1_nc = miss_v
             j0_nc = miss_v
             j1_nc = miss_v
-            
+
         endif
-        
-        
+
+
         select case(spatial_grid_mode)
             case('none')
                 dlon = miss_v
@@ -212,11 +212,11 @@ contains
                     endif
                 endif
         end select
-        
+
         if (spatial_grid_mode /= 'none' .and. (dlon /= 0.5 .or. dlat /= 0.5)) then
             stop "check failed : now only 05x05 grid is supported (because of INMCM external data)"
         endif
-        
+
         select case(spatial_grid_mode)
             case('none')
                 nlon = 1
@@ -229,7 +229,7 @@ contains
                 lon_ref = -180. + 0.5*dlon
                 lat_ref = -90. + 0.5*dlat
         end select
-                
+
         allocate(id(nlon,nlat))
         nid = nlon*nlat
         allocate(id_to_i(nid))
@@ -243,7 +243,7 @@ contains
                 id_to_j(n) = j
             enddo
         enddo
-        
+
         if (dlon == 0.5 .and. dlat == 0.5) then
             allocate(work2i(nlon+2,nlat+1))
             open(1, file=path_inmcm_data//'OLIJAN', status='old')
@@ -278,11 +278,11 @@ contains
                 stop "check failed : can not realize spatial_sample_mode = 'cell_ich'"
             endif
         endif
-        
-        
+
+
         select case(spatial_grid_mode)
             case('none')
-            
+
                 i0 = 1
                 i1 = 1
                 j0 = 1
@@ -293,9 +293,9 @@ contains
                 lon = miss_v
                 lat = miss_v
                 area = miss_v
-                
+
             case default
-            
+
                 select case(spatial_sample_mode)
                     case('id')
                         i0 = id_to_i(id_user)
@@ -323,26 +323,26 @@ contains
                         j0 = j0_nc
                         j1 = j1_nc
                 end select
-                
+
                 allocate(lon(nlon))
                 do i = 1, nlon
                     lon(i) = lon_ref + (i-1)*dlon
                 enddo
-                
+
                 allocate(lat(nlat))
                 do j = 1, nlat
                     lat(j) = lat_ref + (j-1)*dlat
                 enddo
-                
+
                 allocate(area(nlon,nlat))
                 do j = 1, nlat
                     do i = 1, nlon
                         area(i,j) = r_earth*abs(dlat)*deg2rad * r_earth*cos(lat(j)*deg2rad)*abs(dlon)*deg2rad
                     enddo
                 enddo
-                
+
         end select
-        
+
         allocate(mask(i0:i1,j0:j1))
         select case(environment_data_type)
             case('lsm_offline')
@@ -350,14 +350,14 @@ contains
             case default
                 mask(:,:) = 1.
         end select
-        
+
         ni = i1-i0+1
         nj = j1-j0+1
         ncell_tot = ni*nj
         ncell_mask = count(mask == 1)
-        
+
     end subroutine
-    
+
 
 
     subroutine temporal_grid_init()
@@ -374,7 +374,7 @@ contains
                          & ntime_user => ntime, &
                          & timestamp_lst => datetime_last, &
                          & UTC_user => UTC, &
-                         & datetime_init_1, &     
+                         & datetime_init_1, &
                          & datetime_last_1, &
                          & datetime_init_2, &
                          & datetime_last_2, &
@@ -391,9 +391,9 @@ contains
         
         select case(environment_data_type)
             case('lsm_offline')
-            
+
                 call nc_errhand( nf90_open(trim(lsm_datafile), nf90_nowrite, ncid) )
-                
+
                 call nc_errhand( nf90_inq_dimid(ncid, 'time', dimid) )
                 call nc_errhand( nf90_inquire_dimension(ncid, dimid, len = nt_nc) )
                 call nc_errhand( nf90_inq_varid(ncid, 'time', varid) )
@@ -402,7 +402,7 @@ contains
                 dt_nc = nint((work1r8(2) - work1r8(1)) * day2sec)
                 jday0_nc = work1r8(1)
                 deallocate(work1r8)
-                
+
                 call nc_errhand( nf90_close(ncid) )
 
             case('station')
@@ -481,8 +481,8 @@ contains
 
         date_c = date_fst
 
-		year_min = date_fst%y
-		year_max = date_lst%y
+        year_min = date_fst%y
+        year_max = date_lst%y
 
     end subroutine
 
diff --git a/station_config.nml b/station_config.nml
index 241e0e2..15807d6 100644
--- a/station_config.nml
+++ b/station_config.nml
@@ -9,7 +9,7 @@
 ! -----------------------------------------------------------------
 
     !> station_name = 'DAO4':
-        
+
        !> Date
        datetime_init_1 = '1935-01-01 00:00:00'
        datetime_last_1 = '2012-01-01 00:00:00'
diff --git a/ui1_config.nml b/ui1_config.nml
index 90fa9f8..d3d822b 100644
--- a/ui1_config.nml
+++ b/ui1_config.nml
@@ -10,6 +10,13 @@
 
 ! конфигурация
 ! -----------------------------------------------------------------
+    !> Тип действия:
+    !action_type = 'init'
+    !
+    ! 'init' - инициализация начальных значений для пулов углерода
+    ! срок расчёта должен быть автоматически расширен до (мин) 150 лет, 
+    ! а запись результатов расчёта должна быть записана в файл carbon_pools_config
+    ! 'calc' - расчёт согласно настройкам всё как обычно
 
     !> Углеродная модель:
     carbon_model_type = 'rothc'
@@ -27,13 +34,13 @@
     !
     ! 'none'        - не требуются
     ! 'generator'   - генерация суточных синусоид
-	! 'station'     - выбор готовых данных, со станций наблюдения
+    ! 'station'     - выбор готовых данных, со станций наблюдения
     ! 'lsm_offline' - netcdf-файл с выходными данными модели деятельного слоя
     ! 'lsm_online'  - онлайн-каплинг с моделью деятельного слоя (@todo пока не поддерживается)
 
         ! дополнительно для environment_data_type = 'station':
             !> Имя станции:
-            station_name = 'DAO3'
+            station_name = 'Rostov'
             ! 'DAO4'   - Долгопрудная опытная станция ДАОС 4
             ! 'DAO3'   - Долгопрудная опытная станция ДАОС 3
             ! 'TRGK'   - Федеральный научный центр любяных культур "Торжок"
@@ -41,12 +48,12 @@
             ! 'Rostov' - Донской Федеральный аграрный научный центр (ФАНЦ) "Ростов"
             !    
             !> Тип подачи удобрения:
-            station_opt = '2'
+            station_opt = '1'
             ! '1' - контрольный случай, без дополнительных удобрений
             ! '2' - 2 способ подачи удобрений
             ! '3' - 3 способ подачи удобрений
             ! '4' - 4 способ подачи удобрений
-			
+
         ! дополнительно для environment_data_type = 'lsm_offline':
             !> Путь к файлу:
             lsm_datafile = 'data/inmcm_ru-fyo_fluxnet_1998-2015_0.5h.nc', UTC = +3
-- 
GitLab