# KR384: How to calculate the gradient of a boundary only variable (eg wall shear stress) in CFX 12?

 This KR applies to both pre defined boundary variables such as wall shear stress or user defined boundary only variables (AVs created with the boundary only field option selected). The method is also restricted to planar (or near planar) cases where there is a clear normal direction which can be aligned with one of the XYZ axis. In this case the boundary is assumed to lie in the XY plane.The overall method is to create an AV which will hold the boundary value at all locations within the domain. You can then use this AV to later calculate the X and Y gradients. Create an AV for wall shear as a diffusive transport equation and define the three components of Kinematic diffusivity (X,Y,Z) which will control how the AV is transported. Set very high diffusion in the Z direction to give an equal value at all heights, in the x and y direction set values close to (but not equal to ) 0. The AV will be updated by a boundary source that will adjust its value to reflect the original boundary values. For the boundary source the flux will represent rate of change of AV *local height of domain. This can be calculated by finding the difference between the wall shear AV and the shear stress at the wall where the boundary source is located. AVs are updated once per iteration /loop so to avoid recursion issues the source term should be setup as an AV so wall shear is not directly calling itself.Setting a directional kinematic diffusivity is not available in the gui so you will need to modify the ccl before running the case.1) set up the case with kinematic diffusivity as a constant.2) extract the ccl from the .def file. This can be done from the command line (cfx launcher -tools -command line) by typingcfx5cmds -def defname.def -txt newtext.ccl -read3) modify the ccl in newtext.ccl. In the DOMAIN MODELS section of the ccl you will need to alter the AV section to the form shown below (will appropriate expressions for the components).ADDITIONAL VARIABLE: AV1 KINEMATIC DIFFUSIVITY: Option = Orthotropic Cartesian Components Kinematic Diffusivity X Component = 0.0001 [m^2 s^-1] Kinematic Diffusivity Y Component = 0.0001 [m^2 s^-1] Kinematic Diffusivity Z Component = 1000 [m^2 s^-1] ENDOption = Diffusive Transport EquationEND4) reload the ccl usingcfx5cmds -def defname.def -txt newtext.ccl -write5) when running the .def file you will need to modify the rules to allow the directional kinematic diffusivity to be used. This can be done by adding -ccl avani_rules.ccl to the command line or if you use the launcher select "show advanced controls"- move to the solver tab and enter "-ccl avani_rules.cll" in the solver arguments box. You need to save the attached file KR384_avani_rules.ccl.txt as avani_rules.ccl in the working directory.