/*==================================================================================== ! Purpose(s): ! ! Contain(s): CSetFricVel ! ! Author(s): Javier Lopez Lara (jav.lopez@unican.es) ! Gabriel Barajas (barajasg@unican.es) !====================================================================================*/ #include "CSetFricVel.h" #include "CVars.h" void CSetFricVel(double &AUx, double &AUy, double &AVx, double &AVy, double AFricVel, double ADist, TVector const &AObsSrfce) /*!======================================================================= ! Purpose(s): This function modifies the velocity gradient tensor in the vicinity of a surface. ! It rotates the tensor to a coordinate system where surface is horizontal and the surface vector is (0,1). ! Then it substitutes the du'/dy' tensor component by the value predicted by the logarithmic law profile ! (FricVel/(Kappa*y)) and rotates the tensor back to the original coordinate system. ! ! Author(s): Javier Lopez Lara (jav.lopez@unican.es) ! Gabriel Barajas (barajasg@unican.es) !=======================================================================*/ { // Components of the unitary tangent vector. double tx= AObsSrfce.y; double ty=-AObsSrfce.x; double tx2 = tx*tx; double ty2 = ty*ty; double txty = tx*ty; double tx2ty2 = tx2*ty2; double tx3ty = tx2*txty; double txty3 = ty2*txty; double Uyp = AFricVel/(Kappa*ADist); double newUx=-txty3*(AUy+AVx)+tx2ty2*(AVy-AVx)+txty*(AUy-Uyp)+AUx; double newUy=tx2ty2*(AUy+AVx)+AUy*ty2+tx3ty*(AVx-AVy)+Uyp*tx2; double newVx=tx2ty2*(AUy+AVx)-Uyp*ty2+tx3ty*(AVx-AVy)+txty*(AVy-AVx)+AVx*tx2; double newVy=-tx3ty*(AUy+AVx)+txty*(Uyp+AVx)+tx2*tx2*(AVy-AVx)+tx2*(AVx-AVy)+AVy; AUx=newUx; AUy=newUy; AVx=newVx; AVy=newVy; }