Page 1 of 1

Accessing Reynolds Stress Components

Posted: Tue Jan 29, 2019 5:09 pm
by kunalck
Hello Everyone,

I am trying to access Reynolds stress components to calculate the buoyancy source term for EB-RSM.
Version : CS_5.1.3

Code: Select all

     call field_get_val_prev_s(ivarfl(ir11), cvara_r11)
     call field_get_val_prev_s(ivarfl(ir22), cvara_r22)
     call field_get_val_prev_s(ivarfl(ir33), cvara_r33)
     call field_get_val_prev_s(ivarfl(ir12), cvara_r12)
     call field_get_val_prev_s(ivarfl(ir13), cvara_r13)
     call field_get_val_prev_s(ivarfl(ir23), cvara_r23)
Above lines of code resulted in error " Fortran pointer of rank 1 requested for values of field "rij",which have rank 2."
Please suggest some changes to fix the error. listing and error files are attached.

Re: Accessing Reynolds Stress Components

Posted: Tue Jan 29, 2019 6:52 pm
by Yvan Fournier
Hello,

Starting with version 5.1, Rij is handled by default as an interleaved tensor, so you would use something like:

Code: Select all

double precision, dimension(:,:), pointer :: cvara_rij

call field_get_val_prev_s(ivarfl(irij), cvara_rij)
And then cvara_rij(i,j) is the i-th component (r11, r22, r33, r12, r23, r13) of the j-th cell.

Regards,

Yvan

Re: Accessing Reynolds Stress Components

Posted: Wed Jan 30, 2019 1:57 pm
by kunalck
Hello Yvan,
I used following piece of code as suggested by you and encountered this error : "Rank mismatch in argument 'p' at (1) (rank-1 and rank-2)" . Compile log attached below. Does this mean there's a dimensional mismatch with Rij and defined pointer ? Could you please suggest any alternate approach if there's any to access Rij components or alternate subroutine/function as I am very much new to code in fortan.

Code: Select all

double precision, dimension(:,:), pointer :: cvara_rij
call field_get_val_prev_s(ivarfl(irij), cvara_rij)
     cvara_r11 = cvara_rij(1,1)
     cvara_r22 = cvara_rij(2,2)
     cvara_r33 = cvara_rij(3,3)
     cvara_r12 = cvara_rij(1,2)
     cvara_r13 = cvara_rij(1,3)
     cvara_r23 = cvara_rij(2,3)

Re: Accessing Reynolds Stress Components

Posted: Thu Jan 31, 2019 1:04 am
by Yvan Fournier
Hello,

Sorry, I had a typo: for a vector or tensor field, you need to use field_get_val_prev_v instead of field_get_val_prev_s.

That should solve the issue.

Best regards,

Yvan

Re: Accessing Reynolds Stress Components

Posted: Thu Jan 31, 2019 1:48 pm
by kunalck
Hello Yvan,

Thank you so much.
Following worked fine.

Code: Select all

double precision, dimension(:,:), pointer :: cvara_rij
call field_get_val_prev_v(ivarfl(irij), cvara_rij)
Regards
Kunal