
% In this section you may modify the mesh in any way whatsoever.
    switch modelname
        case 'NOSUBDIVISION' 
            % do nothing
        case 'WITHSUBDIVISION' 
            % subdivide on the first step
            if realtime>0 && realtime<=0+dt
                m = leaf_subdivide( m, 'morphogen','id_subdivide',...
                    'min',0.5,'max',1,...
                    'mode','mid','levels','all');
            end
            if realtime>0 && realtime<=0+dt
                m = leaf_subdivide( m, 'morphogen','id_subdivide',...
                    'min',0.5,'max',1,...
                    'mode','mid','levels','all');
            end
        otherwise
            % If this happens, maybe you forgot a model.
    end

    % If needed force FE to subdivide (increase number FE's) here
    % if realtime==280+dt
         % m = leaf_subdivide( m, 'morphogen','id_vent',...
         %       'min',0.5,'max',1,...
         %       'mode','mid','levels','all');
    % end
% Cut the mesh along the seams (see above)
    % if m.userdata.CutOpen==1
    %    m=leaf_dissect(m);
    %    m.userdata.CutOpen=2;        
    %    Relax accumulated stresses slowly i.e. 0.95 to 0.999
    %    m = leaf_setproperty( m, 'freezing', 0.999 );
    % end