Page 1 of 1

Shear stress in user subroutine.

Posted: Sun Sep 07, 2014 11:58 pm
by anderse4
I am trying to implement a model that requires that I have access to the shear rate in each cell in laminar low. I can see how this can be found if I were using turbulence modeling, but I cannot find it for the viscous case. Are the stresses stored in an array or will I have to calculate them manually?

I'm sure this question has been answered before, but many hours of searching have not given me a result. I am also still becoming familiar with the user subroutines, the naming scheme has a steep learning curve. Thank's for your help!

Re: Shear stress in user subroutine.

Posted: Tue Sep 09, 2014 9:52 am
by Jacques Fontaine
Hello,

You have to (re)compute it manually. You can use cs_user_extra_operation.f90 to do this.

You must use gradient function to compute velocity gradient (the gradient function name is dependant of ur Code_Saturne version).

Which version are you using ?

Regards,

Re: Shear stress in user subroutine.

Posted: Tue Sep 09, 2014 6:02 pm
by anderse4
I am using the most recent release 3.3. Thanks for your help!

Re: Shear stress in user subroutine.

Posted: Wed Sep 10, 2014 4:01 pm
by Jacques Fontaine
Ok.

So you can use something like this to compute velocity gradient:

Code: Select all

    !===========================================
    ! Decl    
    integer          inc   , iprev
    double precision, allocatable, dimension(:,:,:) :: gradv
    !============================================
    ! Code
    allocate(gradv(3,3,ncelet))

    inc = 1
    iprev = 1

    call field_gradient_vector(ivarfl(iu), iprev, imrgra, inc,    &
                               gradv)

Re: Shear stress in user subroutine.

Posted: Sun Oct 05, 2014 6:12 pm
by anderse4
Thanks for your help! This subroutine is very convenient, but I do have one question. Does it return the gradient in simulation units or in a normalized format? I ask because for two different velocity fields the magnitude of the gradient tensor is always quite close to one with a much different mean velocity.

Thanks!
Eric