The OASIS Coupler Forum

  HOME

Intercept and replace coupling fields in a multi-model setup

Up to Specific issues in real coupled models

Posted by Anonymous at September 25 2015

Hi Laure,

I'm writing with a query about Oasis functionality, particularly the INPUT capability in the namcouple file. I have a coupled model setup with ice, ocean and atmosphere and what I'd like to do is to effectively intercept and particular coupling field and change it to a time varying value read from a file. I'd like to do this without changing the code. Does this reasonable/possible?

For example, say I have a field SST that gets passed ocean -> ice, can I change this field to use an INPUT file in which case the target (in this case ice) will read from the file under the oasis_get() call. If so, what would be the functionality of the oasis_put() call being run on the ocean?

Thanks, Nic

Posted by Anonymous at September 26 2015

Hi Nicholas,

Imagine you have the initial line for your field in the namcouple :

Fsent Frecv 1 86400 5 sstoc.nc EXPORTED

You will modify it as 

Frecv Frecv 1 86400 0 frecv.nc INPUT

Fsent will not exist anymore in the namcouple. The var_id for this field returned by oasis_def_var in your model will be equal to -1. So you have to put a condition before the corresponding oasis_put : you only call oasis_put if the var_id of the field is different from -1

See the User Guide https://oasis.cerfacs.fr/wp-content/uploads/sites/114/2021/02/GLOBC-TR-oasis3mct_UserGuide3.0_052015.pdf, section 2.2.5 : 
" Note that if the field does not appear in the namcouple, var id will be equal to -1 and it is not permitted to call the corresponding oasis put and oasis get (it would lead to an abort). You must create a condition on var_id before calling oasis_put. Conversely, all coupling fields appearing in the namcouple must be defined with a call to oasis def var; this constraint is
imposed to avoid that a typo in the namcouple would lead to coupling exchanges not corresponding to what the user intends to activate."

Best regards, Laure
Reply to this