4 The post-processing stage

**CONSERV**:`CONSERV`performs a global modification of the coupling field such that the area integrated fields are conserved.This analysis requires the source and target grid mesh areas be defined in file

*areas.nc*file and the source and target grid mask be defined in file*masks.nc*.**The areas must be expressed in matching units on the source and destination sides. Futhermore, these must be square radians if the TR correction is activated**(see paragraph The “True Area” (TR) correction in section 4.3).A grid cell mask must be defined for that operation in the

*masks.nc*file. If grid cell fractions are also defined in that file, the mask and fractions are considered and must be consistent; OASIS3-MCT will abort if they are not or if both are missing. Note that by OASIS3-MCT conventions for the mask, a gridcell with mask=0 (active) should have fractions greater than 0 and a gridcell with mask=1 (inactive) should have fractions equal to 0.**Best practice for fraction definition in ocean-atmosphere coupling**In principle, the fractions can be defined for both the source and target grids. But for ocean-atmosphere coupling, we strongly encourage the following best practice for a consistent ocean-atmosphere coupled system. Indeed, to have a well-posed coupled problem, the ocean and the atmospheric total surfaces must be the same allowing global conservation of integrated quantities. To do so, the original ocean mask should be taken as it is from the ocean model. For the atmosphere, cell fractions should be defined by the conservative remapping of [1 - ocean mask] on the atmospheric grid, retaining fractions above a certain threshold, to be fixed by the user. These atmospheric cell fractions should be used in the atmospheric model to define the % of ocean (water) subsurface to be considered. Then the atmospheric coupling mask should be adapted associating a non-masked index (i.e. 0) to all cells with a water fraction above the chosen threshold. The global water surface as seen by the atmosphere model is then the sum of its cell areas multiplied by its respective cell fractions. Note that invalid masked atmospheric cells should have null ocean fractions. If we follow this best practice, the atmospheric cell fractions and mask will be specific to the coupling with each particular ocean grid. A specific attribute named

`coherent_with_grid`indicating the grid prefix of the`companion`grid may be defined for mask and fractions. If the OASIS API is used to define the mask and fractions, this can be done via the optional argument`companion`indicating the grid prefix of the companion grid (see section 2.2.4).In the

*namcouple*,`CONSERV`requires one input line with one argument and one optional argument:# CONSERV operation $CMETH $CONSOPT

where:`$CMETH`is the method desired with the following choices; a detailed analysis of these choices can be found in (Craig 2019) :- with
`$CMETH = GLOBAL`, the field is integrated on both source and target grids, without considering values of masked points, and the residual (target - source) is uniformly distributed on the target grid as an additive term; this option ensures global conservation of the field; - with
`$CMETH = GLBPOS`, the same operation as`GLOBAL`is performed except that the residual is distributed proportionally to the value of the original field as a multiplicative term; this option ensures the global conservation of the field, and it does not change the sign of the field if the field is well behaved; if the field is well behaved, multiplication factors close to 1 are expected. - with
`$CMETH = GSSPOS`, the same operation as`GLBPOS`is performed except that the multiplicative term is computed separately for positive and negative values of the field; this option ensures the global conservation of the field and, as`$GLBPOS`, does not change the sign of the field, but it is more expensive because many extra global sums are required; this should be used in cases where the area averaged field value tends to 0 as these cases can generate poor corrections, even leading to changes of sign, when carried out with the`GLBPOS`option. - with
`$CMETH = BASBAL`, the operation is analogous to`GLOBAL`as an additive term except the non masked active surface of the source and the target grids are taken into account in the calculation of the residual; this option does not ensure global conservation of the field but ensures that the energy received is proportional to the non masked active surface of the target grid; - with
`$CMETH = BASPOS`, the operation is analgous to`GLBPOS`as a multiplicative term except the non masked surface of the source and the target grids are taken into account and the residual is distributed proportionally to the value of the original field; this option does not ensure global conservation of the field but ensures that the energy received is proportional to the non masked surface of the target grid and it does not change the sign of the field if the field is well behaved. - with
`$CMETH = BSSPOS`, the same operation as`BASPOS`is performed except that the multiplicative term is computed separately for positive and negative values of the field; this option has the same characteristics as`BASPOS`except it does not change the sign of the field, but is more expensive because many extra global sums are required; this should be used in cases where the area averaged field value tends to 0 as these cases can generate poor corrections, even leading to changes of sign, when carried out with the`BASPOS`option.

- with
`$CONSOPT`is an optional argument specifying the algorithm.`$CONSOPT`can be`bfb`,`gather`,`lsum16`,`lsum8`,`ddpdd`,`reprosum`or`opt`. Details on the perfromance of these different options can also be found in (Craig et al 2017) and references there in.- The
`bfb`option is the default for`CONSOPT`and uses the`reprosum`option (see below). - The
`gather`option computes global sums by gathering a decomposed array onto the root process before doing an index ordered sum. This is guaranteed to produce identical results for different numbers of processors and decompositions but is expensive both with respect to performance and memory use. This is equivalent to the`bfb`option in previous OASIS3-MCT versions. - The
`lsum16`option computes a local sum at quadruple precision before doing an MPI reduction on the local sums at quadruple precision. This is likely to be bit-for-bit for different numbers of processors and decompostions but that's not guaranteed. This is just like`lsum8`but at quadruple precision and a little slower. - The
`lsum8`option computes a local sum at double precision before doing an MPI reduction on the local sums at double precision. This is NOT likely to be bit-for-bit for different numbers of processors and decompostions. This is just like`lsum16`but at double precision and faster. - The
`ddpdd`option is a parallel double-double algorithm using a single scalar reduction. It should behave between`lsum8`and`lsum16`with respect to performance and reproducibility. See (He and Ding 2001). - The
`reprosum`option is a fixed point method based on ordered double integer sums that requires two scalar reductions per global sum. The cost of reprosum will be higher than some of the other methods but it will be bit-for-bit for different processor counts or different decompostions except in extremely rare cases and the cost is significantly less than the`gather`option. See (Mirin and Worley 2012). - The
`opt`option carries out the global sum using the fastest algorithm generally available. Currently, this is set to`lsum8`.

- The

**SUBGRID**: UNUSED**BLASNEW**:`BLASNEW`performs a scalar multiply or scalar add to any destination field. This is the equivalent of`BLASOLD`on the destination side. In addition, unlike`BLASOLD`, other fields on the destination side can be added with a multiplier and addition weight.This transformation requires at least one configuring line with two parameters:

# BLASNEW operation $XMULT $NBFIELDS

where`$XMULT`is the multiplicative coefficient of the destination field.`$NBFIELDS`will be 0 if no additional fields or scalars are needed, 1 if a single scalar needs to be added, and greater than 1 if additional fields are to be added. The number of`$NBFIELDS`indicates the number of additional lines. If`$NBFIELDS`is greater than 0, the first additional input line must be the string`CONSTANT`and then a real value,`$AVALUE`, which will be added to the field. Even if`$AVALUE`is zero, this line must still be included if`$NBFIELDS`is greater than 0. If`$NBFIELDS`is greater than 1, then additional input lines have the format`$FNAME $XMULT $AVALUE`where`$FNAME`is the name of a field received in OASIS3-MCT in the same model and`$XMULT`and`$AVALUE`are the multipliers and additive terms to be applied to`$FNAME`:CONSTANT $AVALUE $FNAME1 $XMULT1 $AVALUE1 $FNAME2 $XMULT2 $AVALUE2

For example :2.0 3 CONSTANT 0.0 FLD001 1.0 0.0 FLD002 5.0 -100.

will multiply the destination field by 2.0 and then add (FLD001 + FLD002*5.0 - 100) to that destination field. All combined fields must be received by the same model component in OASIS3-MCT (either via coupling or input), and the field size and decomposition must be consistent across all fields being combined. The value of the field being combined is associated with the last valid coupled value. This allows fields to be combined that are not coupled at the same frequency by using valid lagged values. The order of the receive calls is also important. If a field to be combined is received after the destination field, then the values used are from an earlier timestep. Note that while this feature is supported in OASIS3-MCT, a more transparent implementation might be to combine fields in the model (not in OASIS3-MCT) after they are received independently.**MASKP**: UNUSED**REVERSE**: UNUSED**CHECKOUT**:`CHECKOUT`calculates the global minimum, maximum, mean, and sum of the destination field values taking the mask into consideration. If a grid area or fraction field is also available, (respectively in the file*areas.nc*or*masks.nc*), then the area and/or fraction weighted mean and sum are also diagnosed and written. Information about masking and weighting is written to the output file. All diagnotics are written to the master process OASIS3-MCT debug file (under the attribute “CHECK* diags”). This operation does not transform the field. CHECKOUT operations can slow down the simulation and should not be used in production mode. For backward compatibility, CHECKOUT has one generic input line that is no longer used but is still required and can contain anything. See also`CHECKIN`.The generic input line is as follows:

# CHECKOUT operation INT = 1

**GLORED**: UNUSED