Prescribing FABM horizontal variable from fabm_input.nml

68 views
Skip to first unread message

Benjamin

unread,
Aug 7, 2019, 10:31:36 AM8/7/19
to FABM-devel
Hi FABM gurus,

I am having some issues reading a prescribed external variable using GOTM-FABM. I'll try to give all relevant information about that:
  1. What do I try to do and how?
  • I would like to look at the impact of ice on some biogeochemical processes, without writing an ice model. So I'd like to be able to read some satellite/external time series of ice concentration and thickness, stored in a .dat file ('StatC_IceConc_20142015_tmp.dat' for ice concentration) and associate them to dedicated variables in my model.
  • To do so, following the wiki, I have a fabm_input.nml file containing the following:
&observations
   variable='memg_trcini/fri'
   file = 'StatC_IceConc_20142015_tmp.dat'
/

  • 'memg_trcini' is the name of my model (to be exact, a module of my model where I declare/register variables), fri is the horizontal variable in which I would like to store the ice concentration. Since there is no predefined standard variable for that, I couldn't define it as a simple dependency, so I created a state variable in memg_trcini.F90:
        ! Register horizontal state variables
        call self%register_surface_state_variable(self%id_fr_i,'fri','%','Sea Ice concentration', initial_value=fri_initial, minimum=0.0_rk, &
          &        standard_variable=type_horizontal_standard_variable(name='fri',units='%'))
  • So far so good, I can compile and run, it even says in my log file:
    init_gotm_fabm_input
        Reading observed values for variable memg_trcini/fri from StatC_IceConc_20142015_tmp.dat
    done
  • But when actually plotting the variable memg_trcini_fri, it only gives a constant value corresponding to fri_initial. So apparently, even though FABM reads the file and knows to which variable to associate it, it doesn't overwrite the variable with it.
        2. What else did I try?
  • I tried to give a constant value rather than a file to read, but nothing more happens. I also tried to not give an initial_value for 'fri', but then I just have a constant 0.0. I also tried to directly print the values from within the model (to check that it wasn't a saving issue), but the values I get are the initial value.
  • I tried to declared 'fri' as a dependency instead of a state variable, linking it to one of the standard variables: "call self%register_dependency(self%id_blop, standard_variables%mole_fraction_of_carbon_dioxide_in_air)" (in memg_trcini.F90), and this does work fine! So it is not an issue with the file format or the the fabm_input.nml, I guess. But it is not a very convenient solution (I might want to use these standard variables later on).
  • This test led me to think it has something to do with the state variables that wouldn't be linked to external observations. So I tried to remove the "standard_variable=type_horizontal_standard_variable" (no success); then I tried define another variable 'fri_blop' as a dependency of the first 'fri': "call self%register_dependency(self%id_fri_blop,type_horizontal_standard_variable(name='fri',units='%'))", either directly in memg_trcini or in other modules of my model, but I have the same behavior.
I don't know what else to do, apart from creating a new standard variable directly within GOTM, which I would rather avoid, obviously.
Is there something I am missing in the implementation of this functionality? Or is it only made for the standard variables? Is there a workaround then?
Some help would be greatly appreciated!

Cheers,
Benjamin Richaud
PhD Student
Dalhousie University

Karsten Bolding

unread,
Aug 7, 2019, 11:01:20 AM8/7/19
to fabm-...@googlegroups.com
Hi Benjamin

Two things ...

1) You should really re-write your model to use the YAML based configuration instead of namelists. They will be phased out in the future anyway. If you have a look at other models you'll soon realize it is much easier.

2) Can you provide a snippet of the ice data file.

On a side note - just about an hour ago I wrote to the GOTM-devel mainling list about the pre-view of ice models in GOTM in the stable release candidate.

Karsten

--
You received this message because you are subscribed to the Google Groups "FABM-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabm-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fabm-devel/abdd7323-b7fb-4931-95d3-55f8aa2442c4%40googlegroups.com.


--

Benjamin

unread,
Aug 7, 2019, 1:28:07 PM8/7/19
to FABM-devel
Hi Karsten

Thank you for answering so quickly:
  1. I do use fabm.yaml for calling FABM models, but I use fabm_input.nml for reading files, since that's how it is described in the wiki. I still have an older version of GOTM, but I'll try to update it to v5.4 to use yaml.
  2. Here is a quick screenshot of the beginning of my file ( the whole file is also attached):

I saw your post on the ice, and I have already looked a bit at the code of the different models in the past few weeks: I'm super excited about those, though I didn't dare to try them yet. I'm mostly focusing on oceanic processes, so I am not sure how relevant it will be to my research, but I am eager to see them officially released!

Cheers,
Benjamin

On Wednesday, August 7, 2019 at 12:01:20 PM UTC-3, karsten wrote:
Hi Benjamin

Two things ...

1) You should really re-write your model to use the YAML based configuration instead of namelists. They will be phased out in the future anyway. If you have a look at other models you'll soon realize it is much easier.

2) Can you provide a snippet of the ice data file.

On a side note - just about an hour ago I wrote to the GOTM-devel mainling list about the pre-view of ice models in GOTM in the stable release candidate.

Karsten

To unsubscribe from this group and stop receiving emails from it, send an email to fabm-...@googlegroups.com.
StatC_IceConc_20142015_tmp.dat

Benjamin

unread,
Aug 12, 2019, 5:27:48 PM8/12/19
to FABM-devel
Hi Karsten,

Just wanted to know, did you have time to give a look at my issue, by any chance?
I have spent some more time on it, tried to understand to source code related to this part, and did some more tests but can't figure out what is wrong with my way of doing it...

Cheers,
Benjamin
Reply all
Reply to author
Forward
0 new messages