Hello Guys, I've been working on a rather complicated code for quite some time. Recently I noticed some rather strange behaviour in my results, however, and have been running tests to see if I can identify where the problem is.
I can't post the code here, which sadly means I can't really talk about the exact details of what the code is doing. I think I can explain the problem, however, without going into specifics - i'd really appreciate it if someone could help me work out where I'm going wrong.
Basically the code calculates a large array of numbers, the case I'm dealing with should result in a perfectly symmetrical array; the algorithm requires two steps, the first step is an initial approximation (which should be symmetrical) and the second step is a refinement of the first. The problem is that I am noticing asymmetry within the results - this seems to grow with time and is very worrying. I've specifically designed the code to produce exactly symmetric results in each step and I am getting very small errors which eventually get rather large.
The problems always seem to occur in the same region of my array, near the top and bottom edges. To test for symmetry I subtract the top value in a column from the bottom element in that column. If the values cancel then my results are good - if not then something is going wrong. In fortran my code looks like
Step 1 - phi1 -> phi2
Test Symmetry Via
DO I=1,imax
IF (abs(phi2(I,jmax)-phi2(I,1))>0) THEN
write(*,*) 'problem found, timestep ', step, ' in column I=', I,'
ENDIF
ENDDO
Step 2 phi2 -> phi3
where phi1 is the initial array (the old value), phi2 the intermediate and phi3 is the final array. The code uses a timestepping procedure and the equations are constructed so that the array should be exactly symmetrical (essentially it does the same set of calculations twice for each column and assigns the values symmetrically down each column of the array).
The problem is that if I test the symmetry between step 1 and 2 then the act of testing seems to change my output. if I run the code, letting it do step 1, then step 2 without the testing procedure then I get a different output than if I include the procedure. Commenting out the IF statement seems to change the output data.
The test is an exact quote from my code - it's just an IF statement that checks if two values are equal or not and doesn't change any variables. I don't know why this should have an effect on the output.
If someone could please help me I'd greatly appreciate it. This problem is a bit weird and is driving me a tad crazy 😮)
Many thanks, B[/code]