Download XIOS User Guide - Forge
Transcript
CHAPTER 3. 17 FIELDS AND VARIABLES 3.4 How to use eld references It is quite common that dierent temporal operations must be applied to the same instant data provided by the model. In theory, the only solution to handle this scenario would be to dene a eld for each operation, give them dierent id and and call xios_send_field with the same array of data for each of those elds. The following example illustrates this solution for a eld for which we want to compute the average, minimal and maximal values: <? xml version=" 1 . 0 " ?> < s i m u l a t i o n> <c o n t e x t i d=" t e s t "> <c a l e n d a r t y p e=" G r e g o r i a n " t i m e s t e p=" 1 h " /> < g r i d _ d e f i n i t i o n> i d=" grid_A ">< ! −− <g r i d Ç Definition ommited −−></ g r i d > </ g r i d _ d e f i n i t i o n> < f i l e _ d e f i n i t i o n> <f i l e name=" o u t p u t " <f i e l d Ç <f i e l d Ç <f i e l d Ç o u t p u t _ f r e q=" 1 d "> i d=" f i e l d _ A _ a v g " g r i d _ r e f=" grid_A " o p e r a t i o n=" a v e r a g e " i d=" field_A_min " o p e r a t i o n=" min " /> i d=" field_A_max " o p e r a t i o n="max" /> g r i d _ r e f=" grid_A " g r i d _ r e f=" grid_A " /> </ f i l e > </ f i l e _ d e f i n i t i o n> </ c o n t e x t> </ s i m u l a t i o n> To simplify the handling of such scenarios, XIOS has a reference feature which allows one eld to inherit the attributes (except the id) and the instant data of another eld. The above example can then be rewritten: <? xml version=" 1 . 0 " ?> < s i m u l a t i o n> <c o n t e x t i d=" t e s t "> <c a l e n d a r t y p e=" G r e g o r i a n " t i m e s t e p=" 1 h " /> < g r i d _ d e f i n i t i o n> <g r i d Ç i d=" grid_A ">< ! −− Definition ommited > </ g r i d _ d e f i n i t i o n> < f i l e _ d e f i n i t i o n> <f i l e name=" o u t p u t " o u t p u t _ f r e q=" 1 d "> −−></ g r i d