0001 function [pengrid unstable]=PenaltyConstrain(pengrid,grids,materials,inputs)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
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
0020 doflist=grids(pengrid.grid).grid.doflist;
0021 dof=doflist(1);
0022
0023 pressure=pressure_param(dof);
0024 temperature=temperature_param(dof);
0025
0026
0027 matpar=materials(end).constants;
0028 meltingpoint=matpar.meltingpoint;
0029 beta=matpar.beta;
0030
0031 t_pmp=meltingpoint-beta*pressure;
0032
0033
0034 if temperature>t_pmp,
0035 active=1;
0036 else
0037 active=0;
0038 end
0039
0040
0041 if pengrid.active==active,
0042 unstable=0;
0043 else
0044 unstable=1;
0045 end
0046
0047
0048 pengrid.active=active;