


ICEPENALTYCONSTRAINTS - test if the thermal solution has converged
This routine check if each element have converged in term of penalty activation
once all the penalties remain the same between 2 iterations, return converged=1
Usage:
[loads,converged]=IcePenaltyConstraints(loads,grids,materials,params,inputs)

0001 function [loads,converged]=IcePenaltyConstraints(loads,grids,materials,params,inputs) 0002 %ICEPENALTYCONSTRAINTS - test if the thermal solution has converged 0003 % 0004 % This routine check if each element have converged in term of penalty activation 0005 % once all the penalties remain the same between 2 iterations, return converged=1 0006 % 0007 % Usage: 0008 % [loads,converged]=IcePenaltyConstraints(loads,grids,materials,params,inputs) 0009 0010 min_thermal_constraints=params.min_thermal_constraints; 0011 unstable_count=0; 0012 0013 %Go through constraints and set active flags 0014 for n=1:length(loads), 0015 [loads(n).load unstable]=PenaltyConstrain(loads(n).load,grids,materials,inputs); 0016 unstable_count=unstable_count+unstable; 0017 end 0018 0019 disp(sprintf('%s %g',' number of unstable melting constraints: ',unstable_count)); 0020 0021 if unstable_count<=min_thermal_constraints, 0022 converged=1; 0023 else 0024 converged=0; 0025 end