The reason behind this type of declaration is that every computational equation is written for a computational cell which has four neighbors and each cell has four neighbors for itself. This way i do not need to define in each iteration step where to read values from or write results to. Either way I should have defined a 3rd rank array to store number of neighbors places, I thought this may speed up my code.
(suppose 10 cells in each row)
for instance cell number 28 has 18,29,38 and 27 as its neighbors.
in each iteration step before looping over all cells, the results of previous step should be stored in an array like ustcv and after solving equations the two arrays are compared to measure convergence. because both arrays are of the same type i just used
and it worked for me. but if i used a do loop for just main cell value updates i get error in my results.
where there should be no errors, because I'm just changing all actual parts of memory targeted by pointers. but i don't know why this happens
Due to the need for speeding up my computations and for further developments, I transformed my serial code into parallel using co-arrays. but I didn't get proper results. I checked all parts of my code and found that there is issue with the above mentioned code. because co-array variable are not allowed to have pointer attribute. I defined a target co-array for each, called uco and ustco and pointed ucv and ustcv to them which are not co-arrays and are local to their images. and I do calculations on ustcv and ucv. I tried using both (1) and (2) get erroneous results.
what i explained above is a brief form of what really is going on in my complicated CFD code.