Accessing Reynolds Stress Components

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
kunalck
Posts: 16
Joined: Fri Sep 21, 2018 2:06 pm

Accessing Reynolds Stress Components

Post 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.
Attachments
listing.txt
(30.68 KiB) Downloaded 151 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Accessing Reynolds Stress Components

Post 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
kunalck
Posts: 16
Joined: Fri Sep 21, 2018 2:06 pm

Re: Accessing Reynolds Stress Components

Post 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)
Attachments
compile.log
(578 Bytes) Downloaded 144 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Accessing Reynolds Stress Components

Post 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
kunalck
Posts: 16
Joined: Fri Sep 21, 2018 2:06 pm

Re: Accessing Reynolds Stress Components

Post 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
Post Reply