From 20fc5c1c0bd2cb7ae14fe1b65a111ef4642f59ec Mon Sep 17 00:00:00 2001
From: Maren Kaluza <maren.kaluza@ufz.de>
Date: Wed, 8 Jan 2025 09:49:16 +0100
Subject: [PATCH] replaced name(256) with name allocatable

---
 src/mo_opt_functions.f90      | 2 --
 src/mo_optimization_types.f90 | 5 +++--
 src/mo_optimization_utils.f90 | 1 -
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/mo_opt_functions.f90 b/src/mo_opt_functions.f90
index 19965fb..10d1239 100644
--- a/src/mo_opt_functions.f90
+++ b/src/mo_opt_functions.f90
@@ -5747,8 +5747,6 @@ CONTAINS
       end if
     end do
 
-    ! ToDo: runoff and all other variables were handled differently: Created wether
-    ! optional or not. Why? Should it be changed?
     do iDomain = 1 , nDomains
       if (opti_sim(iDomain)%has('runoff')) then
         call opti_sim(iDomain)%allocate(name="runoff", ndim=(/1, 1/))
diff --git a/src/mo_optimization_types.f90 b/src/mo_optimization_types.f90
index e326d6f..7dc1376 100644
--- a/src/mo_optimization_types.f90
+++ b/src/mo_optimization_types.f90
@@ -62,7 +62,7 @@ MODULE mo_optimization_types
     real(dp), dimension(:, :, :),       allocatable :: data_3d
     real(dp), dimension(:, :, :, :),    allocatable :: data_4d
     real(dp), dimension(:, :, :, :, :), allocatable :: data_5d
-    character(256)                                  :: name
+    character(:),                       allocatable :: name
     integer(i4)                                     :: ndim
     integer(i4)                                     :: time_avg_selector = 1_i4 !< time averaging: -3 yearly, -2 monthly, -1 daily,
                                                                                 !< 0 total, n every n timestep
@@ -126,7 +126,7 @@ MODULE mo_optimization_types
     type(sim_var_t) :: add_data
 
     ! ToDo: Why name in type 256 and in input var *?
-    add_data%name = name
+    add_data%name = trim(name)
     add_data%ndim = dim
     if (present(time_avg_selector)) add_data%time_avg_selector = time_avg_selector
     ! ToDo: is the if case needed?
@@ -161,6 +161,7 @@ MODULE mo_optimization_types
         case(5)
           allocate(this%variables(i)%data_5d(ndim(1), ndim(2), ndim(3), ndim(4), ndim(5)))
         case default
+          ! ToDo: replace stop by error message
           stop ('sim_data_allocate: Allocating simulated data with other dimensions than 1 to 5 is not impemented.') 
         end select
       end if
diff --git a/src/mo_optimization_utils.f90 b/src/mo_optimization_utils.f90
index 1de2dd4..c6b7db5 100644
--- a/src/mo_optimization_utils.f90
+++ b/src/mo_optimization_utils.f90
@@ -32,7 +32,6 @@ module mo_optimization_utils
 
   !> \brief Interface for objective function.
   !> \details The optional arguments are motivated by likelihood objective functions.
-  ! ToDo: eval optional
   interface
     function objective_interface(parameterset, eval, arg1, arg2, arg3)
       use mo_kind, only : dp
-- 
GitLab