Commit b97b524a authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

python driver: preserve couplings when reconfiguring

parent 45bb61f8
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
real(8),dimension(:),pointer :: state real(8),dimension(:),pointer :: state
character(len=1024),dimension(:),allocatable :: environment_names,environment_units character(len=1024),dimension(:),allocatable :: environment_names,environment_units
type (type_property_dictionary),save,private :: forced_parameters type (type_property_dictionary),save,private :: forced_parameters,forced_couplings
type,extends(type_base_driver) :: type_python_driver type,extends(type_base_driver) :: type_python_driver
contains contains
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
allocate(model) allocate(model)
call fabm_create_model_from_yaml_file(model,path=ppath(:index(ppath,C_NULL_CHAR)-1),parameters=forced_parameters) call fabm_create_model_from_yaml_file(model,path=ppath(:index(ppath,C_NULL_CHAR)-1),parameters=forced_parameters)
! Get a list of all parameter that had an explicit value specified. ! Get a list of all parameters that had an explicit value specified.
property => model%root%parameters%first property => model%root%parameters%first
do while (associated(property)) do while (associated(property))
if (.not.model%root%parameters%missing%contains(property%name)) & if (.not.model%root%parameters%missing%contains(property%name)) &
...@@ -89,6 +89,14 @@ ...@@ -89,6 +89,14 @@
property => property%next property => property%next
end do end do
! Get a list of all active couplings.
property => model%root%couplings%first
do while (associated(property))
if (.not.model%root%couplings%missing%contains(property%name)) &
call forced_couplings%set_property(property)
property => property%next
end do
! Send information on spatial domain to FABM (this also allocates memory for diagnostics) ! Send information on spatial domain to FABM (this also allocates memory for diagnostics)
call fabm_set_domain(model) call fabm_set_domain(model)
...@@ -108,6 +116,7 @@ ...@@ -108,6 +116,7 @@
! Transfer forced parameters to root of the model. ! Transfer forced parameters to root of the model.
call newmodel%root%parameters%update(forced_parameters) call newmodel%root%parameters%update(forced_parameters)
call newmodel%root%couplings%update(forced_couplings)
! Re-create original models ! Re-create original models
node => model%root%children%first node => model%root%children%first
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment