I've quickly put together a simple model that increments the values held in a 2D array; I have attached this model to my reply. This model can pass the values it has calculated (from its initialised variables) to another model, or accept a compatible 2D array of data from a second model (note: this model assumes that the data is already in the correct format for it to use - if this isn't the case, the data would need to be interpolated before being passed-in). I have provided a composition in the .\Test2D\bin\data\ folder that uses two of these models, exchanging data between them. It is probably worth running this composition first, and checking the output files each model produces to see what is happening with the composition.
In terms of how to exchange a 2D array of data, I would suggest you first look at the .omi file; you will see I am setting up the X- and Y-size of the array the model will use. If you then look in the .xml file, you will see that I am setting up an input (or output) exchange item on a regular grid that creates an array of data to transfer that is exactly the same size.
The imoprtant part of the code is in 'Get' and 'Set'; here, I map the 2D array of data into a 1D exchange array, and back again. This is because the data is exchanged between fluidearth models as a 1D array. You will need to do something similar for your model, so it is worth understanding what is happening here.
If you wish to exchange data with models on a different grid/mesh, you may also need to export the coordinates for which you require data. This way, you can set-up an interpolator (i can upload one for you, if you need) to extract data at those points where your model requires it.
hope this helps,
Posted: 24 August 2011 13:15
Subject: How to pass array using FluidEarth
Dear Gordon, I am starting to wrap models using FluidEarth. Now I understand how to pass single values between models, but not sure how to pass array (such as 2D spatial distributed groundwater levels) between models using FluidEarth. Is there any examples for this? Thanks. Best regards, Lei