#yzWGBy.m
function Fzx=yzWGBy(baasi0,l,x,a,By,GIt,EIw)
# 
#  computed a loading vector for  moment for a beam warping
#  l - length of the element
#  By - bimoment 
#  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 yzWGBy 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);
 
Fzx =zeros(4,1);
#  Fzx(1,1)=i0*By*ch/GIt; 
  Fzx(1,1)=i0*By*(ch-1)/GIt;   
  Fzx(2,1)=By*nul*sh;
  Fzx(3,1)=-By*ch;
  Fzx(4,1)=-By*nul*sh; 
 else
#  nu=l*sqrt(GIt/EIw); 
# nul=nu/l;
# lnu=l/nu;
# nux=0.0;
## ch=cosh(nux);
# ch=1.0;
## sh=sinh(nux); 
# sh=0.0; 
Fzx =zeros(4,1); 
#  Fzx(1,1)=i0*By*(ch-1)/GIt; 
#  Fzx(2,1)=By*nul*sh;
#  Fzx(3,1)=-By*ch;
#  Fzx(4,1)=-By*nul*sh;  
endif
#
 endfunction


