Making MLD Accessible to FABM

25 views
Skip to first unread message

Benjamin

unread,
May 15, 2019, 3:30:16 PM5/15/19
to FABM-devel
Hello FABM gurus,

I am trying to adapt a biology model to FABM, in order to run it with GOTM. I need the mixed layer depth (MLD) to fully adapt it, but unfortunately, it is not part of the "standard_variables" that are easily accessible. Since it is already calculated by GOTM as a diagnostic variable, I don't want to re-implement the whole MLD calculation in FABM.
I have digged into both FABM groups, and found bits of solutions (here and here), but couldn't make it work for me.
Could anyone enlighten me on how to properly do that?

So far, I have changed several files:
  • file gotm.F90, l. 293: " call model_fabm%link_horizontal_data(standard_variables_fabm%mixed_layer_depth,mld_surf) "
  • file gotm_fabm.F90,
    •  l. 329: " mld_id       = model%get_horizontal_variable_id(standard_variables%mixed_layer_depth)"
    •  l. 85: "type (type_horizontal_variable_id),save :: lon_id,lat_id,windspeed_id,par_sf_id,cloud_id,taub_id,swr_sf_id,mld_id  "
  • In FABM/.../utils/standard_variables/variables.yaml, l. 56-57:  " - name: mixed_layer_depth \n units: m "
When compiling, I still get an error, saying that it is not part of the standard variables:

I can't find how to properly declare it as a standard variable for FABM.
Some help would be greatly appreciated!

Cheers,
Benjamin Richaud
PhD Student
Dalhousie University

Karsten Bolding

unread,
May 15, 2019, 3:38:15 PM5/15/19
to fabm-...@googlegroups.com
Hi Benjamin

Somehow MLD does not really fit within the normal use case of FABM. FABM is normally driven by the local environment and calculates the processes based on this environment. FABM does not know about grids etc - that is taken care of by the driver model - in your case GOTM.

It might be possible to make a solution - but what do you need the MLD for? And isn't there a way around it on the bio-geochemical side.

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/080fad7a-a825-47b7-b68b-5d4b940c53b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Jorn Bruggeman

unread,
May 15, 2019, 3:39:54 PM5/15/19
to fabm-...@googlegroups.com

Hi Benjamin,

 

You’re on the right track. The key is that you can also create your own standard variables without changing FABM, like this

 

call model_fabm%link_horizontal_data(type_horizontal_standard_variable(name=‘mixed_layer_depth’, units=’m’))

 

(in gotm.F90)

 

You can then retrieve it from FABM with the same syntax, e.g.,

 

call self%register_dependency(self%mld_id, type_horizontal_standard_variable(name=‘mixed_layer_depth’, units=’m’))

 

(in the FABM model that needs it – note that name and units must match exactly what you use in gotm.F90)

 

For reference, changing variables.yaml should work too, provided you run parse_standard_variables.py after. But the above approach is recommended as it does not require FABM customization.

 

Out of curiosity – why does your biogeochemical model need to know about mixed layer depth? In 1D water column models such as GOTM, anything related to the mixed layer (diffusivities, nutrient entrainment, etc) is already resolved explicitly.

 

Cheers,

 

Jorn

 

 

--

image001.png

Benjamin

unread,
May 15, 2019, 4:30:57 PM5/15/19
to FABM-devel
Wow, really impressed by your responsiveness, guys! Thanks for that!

I tried your solution, Jorn, but I still get an error:
So I assume that Karsten is right when saying it does not fit the normal use of FABM. Any other idea to still have access to it?

I am following procedure similar to PISCES, and encountered this issue when trying to write down the optical model, where I need to integrate the PAR over the MLD.
But I also need it for the production rate (limitation term when the mixed layer is deeper than the euphotic zone, shear rate for sinking speed depending on the MLD, etc.), the remineralization rate (coarse parametrization of the bacterial concentration), and other processes.
So I can't really ignore it.

I guess that if there is no way to retrieve it from GOTM, I still have the option to recalculate it in the FABM side using density, but I wanted to avoid that. (I actually wouldn't know how to do that properly, since I don't have access to density over the whole water column at once...)

Any suggestion?

Benjamin

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

Jorn Bruggeman

unread,
May 15, 2019, 5:09:08 PM5/15/19
to fabm-...@googlegroups.com

That error typically indicates that type_horizontal_standard_variable is unknown – try adding “use fabm_standard_variables” to the module your working in.

 

Cheers,

 

Jorn

 

Image removed by sender.

 

I can't find how to properly declare it as a standard variable for FABM.

Some help would be greatly appreciated!

 

Cheers,

Benjamin Richaud

PhD Student

Dalhousie University

--
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-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fabm-devel/080fad7a-a825-47b7-b68b-5d4b940c53b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/f38e98dd-ea04-45a6-9881-64b228792396%40googlegroups.com.

image001.png
image002.jpg

Benjamin

unread,
May 15, 2019, 7:03:10 PM5/15/19
to FABM-devel
Well, there is some improvement for sure, but I get a new error:
I do call use fabm_standard_variables
If I understand the error, should I declare this new MLD standard variable before, somewhere else?

Cheers,
Benjamin

Benjamin

unread,
May 15, 2019, 7:14:44 PM5/15/19
to FABM-devel
Nevermind, stupid mistake from me:
the right line in gotm.F90 was:
       call model_fabm%link_horizontal_data(type_horizontal_standard_variable(name='mixed_layer_depth', units='m'),mld_surf)
(forgot the mld_surf)

Now it compiles! And it runs.

So thanks a million, super efficient troubleshooting!

Cheers,
Benjamin

Karsten Bolding

unread,
May 16, 2019, 3:31:19 AM5/16/19
to fabm-...@googlegroups.com
this was more swift that normal - Jorns and my response was within 1 minute ....

the way you go now is not very portable as other driver models typically will not support providing MLD - I'll suggest you try and figure out an alternative using already available variables (including light).

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/3f49bb2c-65ab-48f8-a9a2-8da2107cd300%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Reply all
Reply to author
Forward
0 new messages