Modify external fluxes

25 views
Skip to first unread message

Ulf Graewe

unread,
Feb 14, 2023, 3:01:00 AM2/14/23
to FABM-devel
Dear all,
I am currently developing a simple oxygen model (one equation).

I provide an 2d file of spatially varying oxygen bottom consumption (in GETM):
instances:
  sOxy:
    model: iow/soxy
    parameters:
      bgflux: 0.0 ! background value in water column
    initialization:
      o2: 100.0
  o2respiration:
    model: external_bottom_flux
    coupling :
      target : sOxy/o2

Thus, I do not have a do_bottom routine in the fabm routine.
However, now I would like to modify the external bottom flux inside my oxygen routine.Something like,
if o2conc < 0
    external_bottom_flux = external_bottom_flux/2
end

How can I implement that.

Cheers,
ulf

--
Ulf Gräwe, Dr.

fon: +49-381-5197-358
fax: +49-381-5197-480
e-mail: ulf.g...@io-warnemuende.de
website: https://www.io-warnemuende.de/ulf-graewe-en.html
ORCID iD: https://orcid.org/0000-0003-4007-9764

Leibniz Institute for Baltic Sea Research Warnemünde
Physical Oceanography and Instrumentation
Seestrasse 15
18119 Rostock
Germany

Jorn Bruggeman

unread,
Feb 22, 2023, 2:39:45 AM2/22/23
to fabm-...@googlegroups.com

Hi Ulf,

 

For that I’d put together a very compact FABM module (e.g. <FABM>/src/models/iow/sediment_respiration.F90), as there is no way to specify this by modifying yaml alone. The model type would have one state dependency for oxygen and one dependency for the externally specified flux, e.g., in the type itself:

 

type (type_state_variable_id) :: id_o2conc

type (type_bottom_dependency_id) :: id_flux

 

In initialize:

 

call self%register_state_dependency(self%id_o2conc,'o2conc','UNITS','oxygen')

call self%register_dependency(self%id_flux,'flux','UNITS m-2 s-1','bottom flux')

 

And then do_bottom would contain something like this:

 

_BOTTOM_LOOP_BEGIN_

    _GET_ (self%id_o2conc, o2conc)

    _GET_BOTTOM_(self%id_flux,flux)

    if (o2conc<0) flux = flux/2

    _ADD_BOTTOM_FLUX_(self%id_o2conc, flux)

_BOTTOM_LOOP_END_

 

That model would then replace your current o2respiration instance. That’s quite a few lines, but by having this in place you can later customize the oxygen flux further in any way you like.

 

Cheers,

 

Jorn

--
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/2f7d7c10-22a5-38c8-4480-60598ad9a301%40io-warnemuende.de.

Ulf Graewe

unread,
Feb 22, 2023, 3:10:33 AM2/22/23
to Jorn Bruggeman, FABM-devel
Hi Jorn
thanks!

Is there a convenient way to read in the dependency?
If I remove:
o2respiration:
    model: external_bottom_flux

I have pull the external rate through GETM and build inside GETM the read in and the linking, right?

Anyhow, is it possible to still have
  o2respiration:
    model: external_bottom_flux
    coupling :
      target : sOxy/o2

but do not specify the target. Thus, o2respiration is known inside fabm. Likely, the tricky part will be to have access to the field inside of my oxygen model.

Cheers,
ulf

Jorn Bruggeman

unread,
Feb 22, 2023, 3:21:25 AM2/22/23
to ulf.g...@io-warnemuende.de, FABM-devel

Hi Ulf,

 

If you’d go with the example code I sent, you can use the new respiration module as a drop-in replacement for external_bottom_flux, like this:

 

  o2respiration:
    model: iow/sediment_respiration
    coupling :
      o2conc : sOxy/o2

 

That leaves an unresolved “o2respiration/flux” dependency as in your original example. Presumably, you already had that linked to an external data file? That should still work.

 

Cheers,

 

Jorn

Reply all
Reply to author
Forward
0 new messages