%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [q0,edof,emat,bc,F_ext,mat,ndim,nel,node,ndof,nip,nlod] = ex_frame
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tol  =  1e-8;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% material parameters for density growth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

emod = 500;
nue  = 0.3;
rho0 = 1.0;
psi0 = 0.05;
expm = 3.0;
expn = 2.0;
dt   = 2.0;

mat = [emod,nue,rho0,psi0,expm,expn,dt];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% material parameters for volume growth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
emod = 500;
nue  = 0.3;
kt   = 2.0;
kc   = 2.0;
mt   = 2.0;
mc   = 2.0;
tt   = 2.0;
tc   = 0.5;
dt   = 1.0;

% mat = [emod,nue,kt,kc,mt,mc,tt,tc,dt];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% generate node points q0 and connectivity edof
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
xbox(1) = 0.0;
xbox(2) = 2.0;
ybox(1) = 0.0;
ybox(2) = 1.0;

nx = 20;
ny = 10;

[q0,edof] = mesh_sqr(xbox,ybox,nx,ny);            

[nel, sizen] = size(edof);
[ndof,sizen] = size(q0);
 node        = ndof/2;
 for ie=1:nel emat(ie) = 1; end;
 
 nip  = 4;
 ndim = 2;
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dirichlet boundary conditions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    fdof1 = 2*(ny+1)*(0     ) +2;
    fdof2 = 2*(ny+1)*(1     ) +2;
    fdof3 = 2*(ny+1)*(nx-1  ) +2;
    fdof4 = 2*(ny+1)*(nx    ) +2;
	fdof5 = 2*(ny+1)*(nx/2+0) +1;

    fdof0 = 2*(ny+1)*(0     ) +1;
    fdof9 = 2*(ny+1)*(nx    ) +1;

	fdof6 = 2*(ny+1)*(nx/2  ); 
	fdof7 = 2*(ny+1)*(nx/2+1);
	fdof8 = 2*(ny+1)*(nx/2+2); 
	
    bc(1,1) = fdof1; bc(1,2) = 0;
    bc(2,1) = fdof4; bc(2,2) = 0;   
	bc(3,1) = fdof5; bc(3,2) = 0;
	bc(4,1) = fdof7; bc(4,2) = -ybox(2)/50;
 	bc(5,1) = fdof6; bc(5,2) = -ybox(2)/50;
 	bc(6,1) = fdof8; bc(6,2) = -ybox(2)/50;
%    bc(7,1) = fdof2; bc(7,2) = 0;   
%	 bc(8,1) = fdof3; bc(8,2) = 0;
%    bc(9,1) = fdof0; bc(9,2) = 0;
%    bc(10,1) =fdof9; bc(10,2)= 0;   

			
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% neumann boundary conditions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
F_ext =  zeros(ndof,1);
%F_ext(fdof6) = -100;
%F_ext(fdof7) = -100;
%F_ext(fdof8) = -100;

nlod = 10;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[nmat,ngrw] = size(mat);
if (ngrw==7); disp('*** density growth ***'); end;  % density
if (ngrw==9); disp('*** volume growth ***' ); end;  % volume
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%