#yzTVmx.m
function Zqmx0=yzTVmx(baasi0,l,x,a,mx,GIt,EIw)
# 
#  computed a loading vector for uniformly distributed twisting moment for a beam warping
#  l - length of the element
#  mx - uniformly distributed twisting moment along the x-axis
#  GIt - torsional stiffness
#  EIw - warping stiffness
#  baasi0 - scaling multiplier for the displacements (i = GIt)
#
##=========================================================================
## This Program is written by Andres Lahe,    2015-02-20
##                    e-mail: andres.lahe@ttu.ee
## LAST MODIFIED: Andres Lahe,    2015-03-13
## Copyright (c)  2004  by Tallinn University of Technology 
##                Department of Mechanics
##                http://www.ttu.ee/
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
## http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
##========================================================================= 
#
#%%%%%%%%%%%%%%%%%
#if nargin != 7
if ~(nargin==7)
error(' function yzTVmx have wrong number of input arguments!') 
end
#%%%%%%%%%%%%%%%%% 
#
  i0=baasi0;
  x=x-a;
  nu=l*sqrt(GIt/EIw);
  
if x >= 0    
##  k=sqrt(GIt/EIw);
 nul=nu/l;
## nul=k;
 lnu=l/nu;
##lnu=1/k;
 nux=nul*x;
## nux=k*x;
 ch=cosh(nux);
 sh=sinh(nux);

Zq0 =zeros(8,1);
  Zq0(5,1)=i0*mx*lnu^2*(ch-1.0-(nux^2)/2)/GIt;
  Zq0(6,1)=  mx*lnu*(sh-nux);
  Zq0(7,1)=mx*lnu^2*(1.0-ch); 
  Zq0(8,1)=-mx*lnu*sh;  
else
  Fzx =zeros(8,1); 
  Zq0=Fzx;
endif

Zqmx0=Zq0;
#
endfunction
