Some problems on wall shear stress calculation

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
MartianDuan
Posts: 74
Joined: Fri Aug 02, 2013 4:26 pm

Some problems on wall shear stress calculation

Post by MartianDuan »

Dear developer and users,

I am now doing the large eddy simulation by using code_saturne 3.0.1 and 3.0.3.

I was trying to develop some subroutines to calculated the wall shear stress and friction velocity. I followed some reply in the post-post 'wall shear stress calculation':
http://code-saturne.org/forum/viewtopic ... ress#p6055
But I came across some compiling issues. I will point out what I did in the following secteces.

In order to define two new user-defined arrays 'usertau' and 'userutau', the following lines was added in the subroutine 'usipph' in 'cs_user_parameters.f90'

double precision, allocatable, dimension(:) :: usertau, userutau
.......
allocate(usertau(nfac))
allocate(userutau(nfac))


Instead find the instantaneous value I need the averaged value. The following lined were added in 'clptur.f90' to calculate the sum of wall shear stress and friction velocity after the time steps more than 3600.

if(iturb.eq.42.and.idries.eq.0) then
tau = romc*uet**2
tau0 = 0.0d0
uet0 = 0.0d0
if (ntcabs .gt. 3600) then
tau0 = tau0+tau
uet0 = uet0+uet
endif
usertau(ifac) = tau0
  userutau(ifac) = uet0
endif


To show the results in the post-procession part. The following lines had been added in the 'cs_user_postprocess_var.f90' following the 'output of the density at boundary'

call post_write_var(ipart, 'Wall_Shear_Stress', idimt, ientla, ivarpr, &
ntcabs, ttcabs, rvoid, rvoid, usertau)
call post_write_var(ipart, 'Friction_Velcoity', idimt, ientla, ivarpr, &
ntcabs, ttcabs, rvoid, rvoid, userutau).


I came across following compiling errors:
in 'cs_user_parameters.f90':
allocate(usertau(nfac))
1
Error: Symbol 'nfac' at (1) has no IMPLICIT type


in 'clpturb':
usertau(ifac) = tau0
1
Error: Unexpected STATEMENT FUNCTION statement at (1)


\xC2\xA0 userutau(ifac) = uet0
1
Error: Invalid character in name at (1)


in 'cs_user_postprocess_var.f90'

Error: Symbol 'usertau' at (1) has no IMPLICIT type
Error: Symbol 'userutau' at (1) has no IMPLICIT type

Can you please give me some suggestions on these issues? These subroutine and compile log can be found in the attachment.

Thanks in advance,

Yu
Attachments
cs_user_postprocess_var.f90
(21.3 KiB) Downloaded 211 times
clptur.f90
(76.47 KiB) Downloaded 233 times
cs_user_parameters.f90
(100.82 KiB) Downloaded 239 times
Last edited by MartianDuan on Mon Nov 10, 2014 4:39 pm, edited 1 time in total.
Brian Angel

Re: Some problems on wall shear stress calculation

Post by Brian Angel »

Hello,

1) I think that you will need to define "nfac" as an integer in the routine cs_user_parameters.

2) In clptur, I searched for "usertau" and can only see the line "usertau(ifac)=0" at line 714 in this routine. I cannot see a declaration for usertau as "double precision", "real" or something else. As above, can you define usertau as double precision or real or whatever you want it to be in this routine.

3) I couldn't see the file cs_user_postprocess attached to your posting but it would appear from the error message that usertau and userutau also need to be declared as double precision or something else in this routine.

Can you try the above modifications and let me know what happens.

Also, as you seem to be passing usertau and possibly userutau from one routine to another, you might be better off declaring these variables in the routine "cs_user_modules.f90" and adding the line "use user_module" in cs_user_parameters, clptur and cs_user_postprocess in the module files list. This way, you only need to declare these variables once in cs_user_modules and not in every routine that you use them in.

Regards,

Brian Angel.
MartianDuan
Posts: 74
Joined: Fri Aug 02, 2013 4:26 pm

Re: Some problems on wall shear stress calculation

Post by MartianDuan »

Thanks for your suggestions. It solved the compilation issue.

I will run a simulation to see whether the subroutine works or not.

Best Regards,

Yu
Brian Angel wrote:Hello,

1) I think that you will need to define "nfac" as an integer in the routine cs_user_parameters.

2) In clptur, I searched for "usertau" and can only see the line "usertau(ifac)=0" at line 714 in this routine. I cannot see a declaration for usertau as "double precision", "real" or something else. As above, can you define usertau as double precision or real or whatever you want it to be in this routine.

3) I couldn't see the file cs_user_postprocess attached to your posting but it would appear from the error message that usertau and userutau also need to be declared as double precision or something else in this routine.

Can you try the above modifications and let me know what happens.

Also, as you seem to be passing usertau and possibly userutau from one routine to another, you might be better off declaring these variables in the routine "cs_user_modules.f90" and adding the line "use user_module" in cs_user_parameters, clptur and cs_user_postprocess in the module files list. This way, you only need to declare these variables once in cs_user_modules and not in every routine that you use them in.

Regards,

Brian Angel.
MartianDuan
Posts: 74
Joined: Fri Aug 02, 2013 4:26 pm

Re: Some problems on wall shear stress calculation

Post by MartianDuan »

Hi Brian and other developers/users,

I generated a cs_user_module file to allocated the the user-defined array 'usertau' and 'userutau'. The following fatal error shown up in the calculation stage. I am using the parallel calculation. Do I need to parapllelize the code? The 'cs_user_module. f90' and 'listing' were attached.

'SIGSEGV signal (forbidden memory area access) intercepted!

Call stack:
1: 0x40749b <clptur_+0x1efb> (cs_solver)
2: 0x2b144b56b973 <condli_+0x2f09> (libsaturne.so.0)
3: 0x2b144b670961 <tridim_+0x33f1> (libsaturne.so.0)
4: 0x2b144b5553fd <caltri_+0x27e9> (libsaturne.so.0)
5: 0x2b144b536925 <cs_run+0xa55> (libsaturne.so.0)
6: 0x2b144b536a85 <main+0x155> (libsaturne.so.0)
7: 0x328b61ed5d <__libc_start_main+0xfd> (libc.so.6)
8: 0x4054d9 <> (cs_solver)
End of stack
'

Thanks very much,

Yu.
Brian Angel wrote:Hello,

1) I think that you will need to define "nfac" as an integer in the routine cs_user_parameters.

2) In clptur, I searched for "usertau" and can only see the line "usertau(ifac)=0" at line 714 in this routine. I cannot see a declaration for usertau as "double precision", "real" or something else. As above, can you define usertau as double precision or real or whatever you want it to be in this routine.

3) I couldn't see the file cs_user_postprocess attached to your posting but it would appear from the error message that usertau and userutau also need to be declared as double precision or something else in this routine.

Can you try the above modifications and let me know what happens.

Also, as you seem to be passing usertau and possibly userutau from one routine to another, you might be better off declaring these variables in the routine "cs_user_modules.f90" and adding the line "use user_module" in cs_user_parameters, clptur and cs_user_postprocess in the module files list. This way, you only need to declare these variables once in cs_user_modules and not in every routine that you use them in.

Regards,

Brian Angel.
Attachments
listing.log
(42.02 KiB) Downloaded 206 times
cs_user_modules.f90
(2.66 KiB) Downloaded 211 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Some problems on wall shear stress calculation

Post by Yvan Fournier »

Hello,

See my answer in what appears somewhat of a duplicate:

http://code-saturne.org/forum/viewtopic ... t=10#p8369.

Regards,

Yvan
Post Reply