Skip to main content
FluidEarth Portal Header version 3

FluidEarth Portal

Go Search
FluidEarth Portal > FluidEarth Discussions > passed arguments setting issues > passed arguments setting issues.  

FluidEarth Discussions: passed arguments setting issues.


it looks as though you are almost there - i've gone through your code and can make two suggesstions as to why this isn't working as you expect.
1.  when you setup your exchange_item array, you have made it too small for the 3D variables. at present, it is (xsize*ysize) but it really needs to be (xsize*ysize*3) to cope with the 3D variables. i don't really know what happens when the array you are reading into is too small, but it doesn't look as though it's working properly.
2. this second part is only for completeness, but i would reset the exchange_item array to 0.0 every time a new input variable is read-in (i.e. in 'Get'). not sure if this is strictly necessary, but is certainly something i would try to do.
i made both of these changes and i seemed to get the right results (attached), but you will know better than me - have a look and see if t6his is now behaving properly.
hope this helps, but if not let me know and i can go through things a little more thoroughly.

From: ZZhang
Posted: 23 June 2010 11:37
Subject: passed arguments setting issues.

Hi Gordon,


I have changed the models as youradvice. I got a new issue. If I just pass the Parameter, OneD and TwoD, it can get right result. If I add the ThreeD on, the others (Parameter, OneD and TwoD) can’t pass the right result. I have checked the Engine.f90 and .XML file, but I couldn’t find out the reason. 

So what do you think cause this issue?

Thanks very much.

From: GGlasgow
Posted: 15 June 2010 22:35
Subject: passed arguments setting issues.

if you want to pass parameters (single values) you will need to use the same technique as the reservoir/spill/boundary models and specify 'coords' on which to exchange data. attached a jpg showing your xml file with a domain defined in coords. note addition of 'indices' to these element sets. i made this change to both of your xml files, and your composition ran successfully.
i think you will have problems with the 1d arrays, which you will need to treat like 2d or 3d arrays - use N=1 and M=size of array to get going.  i'll try to get 1D and 3D element set put together as soon as possible.
hope this helps,

From: ZZhang
Posted: 15 June 2010 18:56
Subject: passed arguments setting issues.

Hi Gordon,
I have modified my engine and .xml file, so it can pass the 2D and 3D strings very well.
However, it can't pass parameters and 1D strings. The message shows 'Index was outside the bounds of the array'.I set the parameters and 1D strings in engine according to the examples(boundary,spill,reservoir). I think I made mistakes, but I could't find out them.  
I attach the two models and logfile. Can you check it for me? Thanks very much.

From: GGlasgow
Posted: 11 June 2010 10:53
Subject: passed arguments setting issues.

sorry, i missed a part of the answer before.
to decide how to set 'M' and 'N', you need to remember how the SDK is using these two values; basically, all that happens is it creates a single one-dimensional array of size M.N, which is why i use a one-dimensional echange_item array in my code to handle the data that comes in and out.
so if you wish to use this method to pass i tile of 3D data, you need to work out 'M' and 'N' so that their product equals I.J.K.
...for example, i like to use
M = I.J and N = K (because i am creating K number of tiles, each one with I.J elements, as my last post suggests)
but you might prefer
M = I and N = J.K
M = 1 and N = I.J.K
M = I.J.K and I = 1
so it's really up to you to choose the best approach that suits the way you write your code - as i say, i like to create tiles each one I.J in size, and i have K of them.
when i get a little time, i will create a better element set for you:


that allows you to specify an I, J and K rather than an N and M.
this won't make any difference to your model code at all - all that will happen is you will change your XML files to use this new element set rather than the old Grid version. in both cases, the SDK will create a 1D array which is equal to I.J.K as above.
will try to do this this weekend,

From: ZZhang
Posted: 10 June 2010 15:56
Subject: passed arguments setting issues.

Hi, Gordon,
I have several questions about how to set passed arguments in attached pdf file.
The rar file contains the two example model.
Look forward to your reply. Thank you.
Content Type: Message
Created at 23/06/2010 13:20  by GGlasgow 
Last modified at 23/06/2010 13:20  by GGlasgow