PenaltyConstrain

PURPOSE ^

PENALTYCONSTRAIN - indicate if a penalty on a grid is stable

SYNOPSIS ^

function [pengrid unstable]=PenaltyConstrain(pengrid,grids,materials,inputs)

DESCRIPTION ^

PENALTYCONSTRAIN - indicate if a penalty on a grid is stable

   The penalty is stable if it doesn't change during to successive iterations.   

   Usage:
      [pengrid unstable]=PenaltyConstrain(pengrid,grids,materials,inputs)
 
   See also PENALTYCREATEKMATRIX, PENALTYCREATEKMATRIX

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [pengrid unstable]=PenaltyConstrain(pengrid,grids,materials,inputs)
0002 %PENALTYCONSTRAIN - indicate if a penalty on a grid is stable
0003 %
0004 %   The penalty is stable if it doesn't change during to successive iterations.
0005 %
0006 %   Usage:
0007 %      [pengrid unstable]=PenaltyConstrain(pengrid,grids,materials,inputs)
0008 %
0009 %   See also PENALTYCREATEKMATRIX, PENALTYCREATEKMATRIX
0010 
0011 %First recover beta, pressure and temperature vectors;
0012 [pressure_param pressure_is_present]=recover_input(inputs,'pressure');
0013 [temperature_param temperature_is_present]=recover_input(inputs,'temperature');
0014 
0015 if (~pressure_is_present  | ~temperature_is_present),
0016     error('PenaltyConstrain error message: missing input parameters');
0017 end
0018 
0019 %Recover pressure and temperature at the grid
0020 doflist=grids(pengrid.grid).grid.doflist; %list of dofs in the g-set
0021 dof=doflist(1);
0022 
0023 pressure=pressure_param(dof);
0024 temperature=temperature_param(dof);
0025 
0026 %Compute pressure melting point
0027 matpar=materials(end).constants;
0028 meltingpoint=matpar.meltingpoint;
0029 beta=matpar.beta;
0030 
0031 t_pmp=meltingpoint-beta*pressure;
0032 
0033 %Figure out if temperature is over melting_point, in which case, this penalty needs to be activated.
0034 if temperature>t_pmp,
0035     active=1;
0036 else
0037     active=0;
0038 end
0039 
0040 %Figure out stability of this penalty
0041 if pengrid.active==active,
0042     unstable=0;
0043 else
0044     unstable=1;
0045 end
0046     
0047 %Set penalty flag
0048 pengrid.active=active;

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003