|
YAC 3.13.0
Yet Another Coupler
|
YAC is currently most commonly used in cases where a source component provides a field, which is redistributed and interpolated by YAC to be received by a target component.
Some applications may require only the redistribution of the source field to the processes of the target component without application of the interpolation. These applications can access the interpolation information and apply it themselves.
If a couple is configured to use raw data exchange, target processes can query YAC for information on how to interpolate their local points of the respective target field after the End of Definition Phase.
During the Data Exchange nothing changes for source processes. However, target processes will not receive an interpolated target field, but instead a set of source points (and associated fractional mask values, in case the source field is configured for Dynamic fractional masking). This set of source points is configured such that each target process can compute their local target points based on the interpolation information mentioned above without requiring additonal communicaiton.
When coupling fluxes, usage of an exchange grid (Balaji 2006) can improve results compared to applying a conservative interpolation to the source flux in order to get the target flux. This approach was successfully used among others by Bauer 2021 and Karsten 2024.
YAC is not designed to be able to provide an exchange grid to the user. However with the introduction of raw data exchange, similar results can be achieved. If raw data exchange is used for a couple together with an Interpolation stack that consists of 1st order conservative (partial_converage: false; normalisation: destarea) followed by Fixed value interpolation, then the weights generated by this interpolation stack represent the overlap between the source and target cells. The sum of the weights for a target cell, which is completely covered by valid source cells is 1.0 in this configuration. The processes of the target component can then compute the flux of the target field based on the fractional contribution of the received source flux. In addition, all target points that are supposed to receive a fixed value, based on the interpolation information provided by YAC, do not overlap with any unmasked source cell and can be handled accordingly.
Rackow 2020 proposes to use a stochastic-based coupling approach, when coupling atmospheric and oceanic surface fields. This approach can produce improved coupling results in case grid resolutions of both components differ significantly.
Stochastic coupling is not supported by YAC. However, a target component should easily be able to implement it, if raw data exchange is used.
The raw exchange is enabled by setting the appropriate parameter during the definition of the couple.
If the couple is defined via a configuration file, use the use_raw_exchange parameter.
In the case the respective interface routines are used see the following example:
After the end of the definitions, the target processes can query the interpolation information for their local target points. Per target field this routine can only be called once.
raw_data is a data class object, see RawInterpWeightsAlternatively, the exchange data can also be obtained in a format that is compatible with the CSR sparse matrix format. See for example yac_cget_raw_interp_weights_data_csr.
The interpolation information contains the size of the buffers required to receive the source points. These buffers have to be allocated by the target processes.
Fortran
Alternatively:
In case the source processes provides a fractional mask along with the source field data, the target processes will have to allocate a buffer for it in the same way as for the source field buffer.
The put-operation is not effected by the use of raw data exchange. However, in the get-operation the target processes have to provide the previously allocated source field buffers and fractional mask buffers (if required).
Fortran
Alternatively:
With Dynamic fractional masking :
Fortran
Alternatively:
The following routines demonstrate how the interpolation information could be applied to the source field buffer in order to compute the target field.
Fortran
Alternatively:
Python
In the case you have the raw_exchange data in CSR format (see yac::Field::get_raw_interp_weights_data_csr), you can pass the data directly to scipy's csr_matrix.
The user is responsible for freeing the memory associated with the interpolation information.
Balaji, V., Anderson, J., Held, I., Winton, M., Durachta, J., Malyshev, S., and Stouffer, R. J.: The Exchange Grid: a mechanism for data exchange between Earth System components on independent grids, in: Parallel computational fluid dynamics 2005, 179–186, Elsevier, https://doi.org/10.1016/B978-044452206-1/50021-5, 2006.
Bauer, T. P., Holtermann, P., Heinold, B., Radtke, H., Knoth, O., and Klingbeil, K.: ICONGETM v1.0 – flexible NUOPC-driven two-way coupling via ESMF exchange grids between the unstructured-grid atmosphere model ICON and the structured-grid coastal ocean model GETM, Geosci. Model Dev., 14, 4843–4863, https://doi.org/10.5194/gmd-14-4843-2021, 2021.
Karsten, S., Radtke, H., Gröger, M., Ho-Hagemann, H. T. M., Mashayekh, H., Neumann, T., and Meier, H. E. M.: Flux coupling approach on an exchange grid for the IOW Earth System Model (version 1.04.00) of the Baltic Sea region, Geosci. Model Dev., 17, 1689–1708, https://doi.org/10.5194/gmd-17-1689-2024, 2024.
Rackow T, Juricke S. Flow-dependent stochastic coupling for climate models with high ocean-to-atmosphere resolution ratio. Q J R Meteorol Soc. 2020; 146: 284–300. https://doi.org/10.1002/qj.3674