Well, I thought I had finished the model, ran it for the maximum time I could think of and it keeps crashing. Through a series of error checking processes (each test taking several hours to complete) I have identified the following:
- Certain variables are being set to
- The offence seems to be occurring within my
- The issue seems to be with a variable I have that is shared across the model through a module
So, I have gone back to the very first code (for a variety of reasons) and return to a problem I asked about some time ago; an equivalence within this function.
Originally, this function was a subroutine and all variables were implied. The top section of the original code looked like this:
subroutine henyey(mode) include 'parm.h' include 'xvar.h' logical lconv dimension d(mh,mh+1),ca(mh),dx(mh) equivalence (ha(1,mh+1),d(1,1)) , (d(1,mh+1),ca(1)) save
ha (within the equivalence) was defined as
HA(MH,2*MH+1) within the included file
Originally, I replaced
ca(1) in the code by accepting that
d(i, 5) (since
mh was defined as 4 in
I did the same with
d(1, 1) and
ha(1, mh + 1); making
d(i, j) into
ha(i, j + 4)
However, I had a problem in that another subroutine needed
d to be passed in (and taken out). I obviously hadn’t explored how I might transfer in the relevant section of
ha (nor how to assign the results of this subroutine to that section - in the aim of making the subroutine a function). I simply did a loop to assign…
for i = 1 to mh for j = 1 to mh d(i, j) = ha(i, j + 4) end if end if call girl(d, m, n) for i = 1 to mh for j = 1 to mh ha(i, j + 4) = d(i, j) end if end if
I believe this assignment is wrong but also concerned that my other assumptions might be flawed.
I am also curious if there is a way of changing the subroutine girl such that I pass in only the part of
ha of interest, and girl returns the results, assigned to the relevant part of
ha, such that girl becomes a function instead?
call girl(ha, m, n) and
call girl(d, m, n) become
ha = girl(ha, m, n) and either ````d = girl(d, m, n)
or something along the lines of ha(1:i, 1:j) = girl(ha(1:i, 1:j), m, n)```
I’ve been trying to test the old code in my model, but since I removed the use of includes, moving to
use instead, then I cannot test using the
equivalence statement; getting the error
EQUIVALENCE attribute conflicts with USE ASSOCIATED attribute in 'ha' at...
Any help gratefully received as always. I think I have included sufficient detail but happy to provide more if needed.