Sorry, been a tad busy.
@RonShepard, I’m not sure I referenced accuracy, I hope not. It’s more about the variance and why there might be one (however, read on ). Also, I defined real(DP) as, I believe you suggested I did, which is
integer, parameter :: DP = kind(0d0); which should be as double precision (if I understood your suggestion). I applied this across the whole model.
@FortranFan, might I suggest you need to get over the fact that I am doing my PhD; it seems to be causing you far too much angst. This is not something I need to solve, or spend considerable time on. The solution is simple; if the difference is significant, then I don’t square the values but leave as-is. The difference isn’t significant, but I have no need to have any difference; so, left as-is (except, note forthcoming statement). I posted out of curiousity. If that upsets you, stop reading my posts.
@msz59, sorry for the long delay in replying. Each model run takes between 40 and 60 minutes and, as just stated, this was not a problem preventing me from moving on. I needed to get other aspects of the model resolved, as well as other factors in my life at the moment. The problem with providing the difference is that the data generated equates to 30000 lines of data, none of which is directly related to this calculation. I did plan on running the model and show you the graphical output, which showed the variance. However, I ran the model as-is, then went into the code and ran the code with all the relevant parts being squared, expecting the variance to re-appear in the graph - it didn’t!
If this is all confusing, sorry. Basically, I am now no longer getting variance. In improving the model, I believe I have corrected a hidden problem elsewhere that, maybe, showed up only when I squared the variables. I have a similar issue, where using the power of a variable generates an unexpected outcome but this time it causes the whole model to crash. I am about to test this out and, if this truly does result in a crash only when I make the change to using a power, I will share more details.
Sorry if my curiousity appears to have wasted anyone’s time. I do appreciate the replies and have found most of them fascinating.
Yes, @sblionel, I could not see why real * real would be any different to real**2 - hence my question. There is a distinct possibility that there is no difference and that an error elsewhere was just being brought out by the use of squaring. That doesn’t even make sense, so I continue on…