Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

derived type variables with pointer attribute issue in intel visual fortran

yjala
Beginner
575 Views

Hello to all. I've been writing a computational fluid dynamics code in the past two years. In my serial code I defined a derived type as follows:

 

  type ptr_SCL

    real(8), pointer :: Q

  end type ptr_SCL

 

  type arr_nod 

    real(8) :: Q

    type(ptr_SCL)::p0(5)

    type(ptr_SCL)::pj(5,5)

  end type arr_nod 

 

  type(arr_nod ),target,allocatable :: Ucv(:)  , Ustcv(:)

 

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

(1)

ustcv=ust

and it worked for me. but if i used a do loop for just main cell value updates i get error in my results.

(2)

      DO K=1,kmx

        ustcv(k)%q=ucv(k)%q

      END DO

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.

thanks for your time.

simply... help me plz?

0 Kudos
0 Replies
Reply