Shear stress in user subroutine.

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
anderse4

Shear stress in user subroutine.

Post 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!
Jacques Fontaine
Posts: 118
Joined: Mon Feb 20, 2012 2:07 pm

Re: Shear stress in user subroutine.

Post 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,
anderse4

Re: Shear stress in user subroutine.

Post by anderse4 »

I am using the most recent release 3.3. Thanks for your help!
Jacques Fontaine
Posts: 118
Joined: Mon Feb 20, 2012 2:07 pm

Re: Shear stress in user subroutine.

Post 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)
anderse4

Re: Shear stress in user subroutine.

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