FEATool  v1.8
Finite Element Analysis Toolbox
 All Files Functions Pages
ex_swirl_flow2.m File Reference

Description

EX_SWIRL_FLOW2 2D Axisymmetric swirl flow in step domain.

[ FEA, OUT ] = EX_SWIRL_FLOW2( VARARGIN ) Axisymmetric swirl for in tubular step region where the inner cylindrical wall is rotating.

Accepts the following property/value pairs.

Input       Value/{Default}        Description
-----------------------------------------------------------------------------------
omega       scalar {100}           Angular rotational velocity (of inner wall)
sf_u        string {sflag2}        Shape function for velocity
sf_p        string {sflag1}        Shape function for pressure
iplot       scalar 0/{1}           Plot solution (=1)
                                                                                  .
Output      Value/(Size)           Description
-----------------------------------------------------------------------------------
fea         struct                 Problem definition struct
out         struct                 Output struct

Code listing

 cOptDef = { 'omega',    100;
             'sf_u',     'sflag2';
             'sf_p',     'sflag1';
             'iplot',    1;
             'tol',      0.05;
             'fid',      1 };
 [got,opt] = parseopt(cOptDef,varargin{:});
 fid       = opt.fid;


% Geometry and grid generation.
 fea.sdim = {'r' 'z'};

 fea.geom.objects = { gobj_rectangle(0.5,1.5,0,3) gobj_rectangle(1.0,1.5,1.5,3,'R2') };
 fea = geom_apply_formula( fea, 'R1-R2' );

 fea.grid = gridgen( fea, 'hmax', 0.1, 'fid', fid );


% Equation definition.
 fea.dvar = { 'u', 'v', 'w', 'p' };
 fea.sfun = [ repmat( {opt.sf_u}, 1, 3 ) {opt.sf_p} ];
 c_eqn    = { 'r*rho*u'' - r*miu*(2*ur_r + uz_z  +   wr_z) + r*rho*(u*ur_t + w*uz_t) + r*p_r     = r*Fr - 2*miu/r*u_t + p_t + rho*v*v_t';
              'r*rho*v'' - r*miu*(  vr_r + vz_z) + miu*v_r + r*rho*(u*vr_t + w*vz_t) + rho*u*v_t = r*Ft + miu*(v_r - 1/r*v_t)';
              'r*rho*w'' - r*miu*(  wr_r + uz_r  + 2*wz_z) + r*rho*(u*wr_t + w*wz_t) + r*p_z     = r*Fz';
              'r*ur_t + r*wz_t + u_t = 0' };
 fea.eqn = parseeqn( c_eqn, fea.dvar, fea.sdim );

 fea.coef = { 'rho', 1 ;
              'miu', 1 ;
              'Fr',  0 ;
              'Ft',  0 ;
              'Fz',  0 };


% Boundary conditions.
 fea.bdr.d = { 0  0  [] 0  0  0 ;
               0  0  [] opt.omega 0 0 ;
               0  0  0  0  0  0 ;
               [] [] [] [] [] [] };
 fea.bdr.n = cell(size(fea.bdr.d));


% Fix pressure at p([r,z]=[ro,h/2]) = 0.
 [~,ix_p] = min( sqrt( (fea.grid.p(1,:)-1.5).^2 + (fea.grid.p(2,:)-1.5).^2) );
 fea.pnt = struct( 'type',  'constr', ...
                   'index', ix_p, ...
                   'dvar',  'p', ...
                   'expr',  '0' );


% Define analytical Newton Jacobian bilinear form.
 jac.coef  = { 'r*rho*ur'       'rho*v' 'r*rho*uz' [] ;
               'r*rho*vr+rho*v' []      'r*rho*vz' [] ;
               'r*rho*wr'       []      'r*rho*wz' [] ;
               []               []      []         [] };
 jac.form = cell(size(jac.coef));
 [jac.form{~cellfun(@isempty,jac.coef)}] = deal([1;1]);


% Parse and solve problem.
 fea = parseprob( fea );
 fea.sol.u = solvestat( fea, 'maxnit', 50, 'nlrlx', 1.0, 'nsolve', 2, 'jac', jac, 'fid', fid );


% Postprocessing.
 if( opt.iplot )
   postplot( fea, 'surfexpr', 'sqrt(u^2+v^2+w^2)', 'isoexpr', 'v' )
 end


% Error checking.
 out.ref  = [ -6.1 10.5 73 1.25 ];
 [u_min,u_max] = minmaxsubd( 'u', fea );
 out.err  = [ u_min u_max intsubd('v',fea) intsubd('w',fea) ];
 out.pass = mean(abs(out.err-out.ref)./abs(out.ref)) < opt.tol;

 if( nargout==0 )
   clear fea out
 end