Code covered by the BSD License  

Highlights from
Co-Blade: Software for Analysis and Design of Composite Blades

image thumbnail

Co-Blade: Software for Analysis and Design of Composite Blades

by

 

18 Sep 2012 (Updated )

Analysis and design of composite blades for wind and hydrokinetic turbines

writeOupFileLamina(iSIM, SIM, BLADE, WEB, SECNODES, Panel, Buckle, LaminaSS, OUT)
function writeOupFileLamina(iSIM, SIM, BLADE, WEB, SECNODES, Panel, Buckle, LaminaSS, OUT)

date = datestr(now, 'mmmm dd, yyyy HH:MM AM');
 
fid = fopen([SIM.rootDir filesep SIM.case{iSIM} '_Lamina.out'], 'w');

fprintf(fid,'=====  Lamina Data Output File  ================================================\r\n');
fprintf(fid,'Generated on %s by Co-Blade v%s \r\n', date, SIM.version);
fprintf(fid,'This line is for user comments. \r\n');
fprintf(fid,'\r\n');
         
if OUT.TAB_DEL
    dlm = '\t';
    fmt_header1 = [ repmat( [ dlm, '%s' ], 1, 12 ), '\r\n' ];  
    fmt_header2 = [ repmat( [ dlm, '%s' ], 1, 6 ), '\r\n' ];
    fmt_header3 = [ repmat( [ dlm, '%s' ], 1, 12 ), '\r\n' ];
else
    dlm = '  ';
    fmt_header1 = [ repmat( [ dlm, '%5.5s' ], 1, 3 ), ...
                    repmat( [ dlm, '%8.8s' ], 1, 4 ), ...
                    repmat( [ dlm, '%12.12s' ], 1, 2 ), ...
                    repmat( [ dlm, '%10.10s' ], 1, 3 ), ...
                    '\r\n' ]; 
    fmt_header2 = [ repmat( [ dlm, '%8.8s' ], 1, 2 ), ...
                    repmat( [ dlm, '%10.10s' ], 1, 1 ), ...
                    repmat( [ dlm, '%10.10s' ], 1, 1 ), ...
                    repmat( [ dlm, '%8.8s' ], 1, 1 ), ...
                    repmat( [ dlm, '%s' ], 1, 1 ), ...
                    '\r\n' ];
    fmt_header3 = [ repmat( [ dlm, '%8.8s' ], 1, 1 ), ...
                    repmat( [ dlm, '%12.12s' ], 1, 6 ), ...
                    repmat( [ dlm, '%8.8s' ], 1, 5 ), ...
                    '\r\n' ];
end

header1 = {'panel',      '(-)'; ...
           'nNodes',     '(-)'; ...
           'nLam',       '(-)'; ...
           'xc_St',      '(-)'; ...  
           'xc_End',     '(-)'; ... 
           'b',          '(m)'; ... 
           't',          '(m)'; ... 
           'E_eff',      '(Pa)'; ... 
           'G_eff',      '(Pa)'; ... 
           'nu_eff',     '(-)'; ... 
           'density',    '(kg/m^3)'; ... 
           'buckleCrit', '(-)'};
fmt_number1 = [ repmat( [ dlm, '%5.0f' ], 1, 3 ), ...
                repmat( [ dlm, '%8.4f' ], 1, 4 ), ...
                repmat( [ dlm, '%12.4e' ], 1, 2 ), ...
                repmat( [ dlm, '%10.4f' ], 1, 3 ), ...
                '\r\n' ];
            
header2 = {'lam_num', '(-)'; ...
           'nPlies',  '(-)'; ...
           'tPly',    '(m)'; ...  
           'fibAng',  '(deg)'; ...
           'matID',   '(-)'; ...
           'matName', '(-)'};
fmt_number2 = [ repmat( [ dlm, '%8.0f' ], 1, 2 ), ...
                repmat( [ dlm, '%10.6f' ], 1, 1 ), ...
                repmat( [ dlm, '%10.4f' ], 1, 1 ), ...
                repmat( [ dlm, '%8.0f' ], 1, 1 ), ...
                repmat( [ dlm, '%s' ], 1, 1 ), ...
                '\r\n' ];
            
header3 = {'s',       '(m)'; ...
           'e11',     '(m/m)'; ...
           'e22',     '(m/m)'; ...  
           'e12',     '(rad)'; ...
           's11',     '(Pa)'; ...
           's22',     '(Pa)'; ...  
           's12',     '(Pa)'; ...
           's11_fcT', '(-)'; ...
           's11_fcC', '(-)'; ...  
           's22_fcT', '(-)'; ...
           's22_fcC', '(-)'; ...
           's12_fcS', '(-)'};
fmt_number3 = [ repmat( [ dlm, '%8.4f' ], 1, 1 ), ...
                repmat( [ dlm, '%12.4e' ], 1, 6 ), ...
                repmat( [ dlm, '%8.4f' ], 1, 5 ), ...
                '\r\n' ];   
            
for i = 1:BLADE.NUM_SEC
     
    nPanelsTop = Panel(i).Top.nPanels;
    nPanelsBot = Panel(i).Bot.nPanels;    
    
    fprintf(fid,'================================================================================\r\n');
    
    fprintf(fid,['sec        =' dlm '%-6.0f \r\n'], i);
    fprintf(fid,['zSec       =' dlm '%-6.4f' dlm '(m)\r\n'], BLADE.zSec(i));
    fprintf(fid,['nPanelsTop =' dlm '%-6.0f \r\n'], nPanelsTop);
    fprintf(fid,['nPanelsBot =' dlm '%-6.0f \r\n'], nPanelsBot);
    fprintf(fid,['nWebs      =' dlm '%-6.0f \r\n'], WEB.nWebs(i));
    
    fprintf(fid,'\r\n');
        %% print the top panel data
        fprintf(fid,'    Top:');
        fprintf(fid, fmt_header1, header1{:,1});
        fprintf(fid,'        ');
        fprintf(fid, fmt_header1, header1{:,2});
        for n = 1:nPanelsTop
            fprintf(fid,'        ');
            fprintf(fid, fmt_number1, n, ...
                                      numel(Panel(i).Top.s{n}), ...
                                      Panel(i).Top.nLam(n), ...
                                      SECNODES.embNdsTop{i}(n), ...
                                      SECNODES.embNdsTop{i}(n+1), ...
                                      Panel(i).Top.s{n}(end), ...
                                      Panel(i).Top.t(n), ...
                                      Panel(i).Top.E_eff(n), ...
                                      Panel(i).Top.G_eff(n), ...
                                      Panel(i).Top.nu_eff(n), ...
                                      Panel(i).Top.massByV(n), ...
                                      Buckle(i).Top(n));       
        end
       
        fprintf(fid,'\r\n');
          
        for n = 1:nPanelsTop
        	fprintf(fid,['            panel:' dlm '%-6.0f\r\n'], n);
            fprintf(fid,'        ');
            fprintf(fid, fmt_header2, header2{:,1});
            fprintf(fid,'        ');
            fprintf(fid, fmt_header2, header2{:,2});
            for m = 1:Panel(i).Top.nLam(n)
                fprintf(fid,'        ');
                fprintf(fid, fmt_number2, m, ...
                                          Panel(i).Top.nPlies{n}(m), ...
                                          Panel(i).Top.tPly{n}(m), ...
                                          Panel(i).Top.fibAng{n}(m), ...
                                          Panel(i).Top.matID{n}(m), ...
                                          cell2mat( Panel(i).Top.matName{n}(m) ));
            end
            
            fprintf(fid,'\r\n');
             
            for m = 1:Panel(i).Top.nLam(n)
                fprintf(fid,['               lamina:' dlm '%-6.0f\r\n'], m);
                fprintf(fid,['              matName:' dlm '%s\r\n'], cell2mat( Panel(i).Top.matName{n}(m) ));
                fprintf(fid,'            ');
                fprintf(fid, fmt_header3, header3{:,1});
                fprintf(fid,'            ');
                fprintf(fid, fmt_header3, header3{:,2});                      
                for k = 1:numel(Panel(i).Top.s{n})
                    fprintf(fid,'            ');
                    fprintf(fid, fmt_number3, Panel(i).Top.s{n}(k), ...
                                              LaminaSS(i).Top(n).e_11_maxabs{m}(k), ...
                                              LaminaSS(i).Top(n).e_22_maxabs{m}(k), ...
                                              LaminaSS(i).Top(n).e_12_maxabs{m}(k), ...
                                              LaminaSS(i).Top(n).s_11_maxabs{m}(k), ...
                                              LaminaSS(i).Top(n).s_22_maxabs{m}(k), ...
                                              LaminaSS(i).Top(n).s_12_maxabs{m}(k), ...
                                              LaminaSS(i).Top(n).s_11_fc_T{m}(k), ...
                                              LaminaSS(i).Top(n).s_11_fc_C{m}(k), ...
                                              LaminaSS(i).Top(n).s_22_fc_T{m}(k), ...
                                              LaminaSS(i).Top(n).s_22_fc_C{m}(k), ...
                                              LaminaSS(i).Top(n).s_12_fc_S{m}(k));

                end
                fprintf(fid,'\r\n');
            end
        end               
      
        %% print the bottom panel data
        fprintf(fid,'  Bottom:');
        fprintf(fid, fmt_header1, header1{:,1});
        fprintf(fid,'        ');
        fprintf(fid, fmt_header1, header1{:,2});
        for n = 1:nPanelsBot
            fprintf(fid,'        ');
            fprintf(fid, fmt_number1, n, ...
                                      numel(Panel(i).Bot.s{n}), ...
                                      Panel(i).Bot.nLam(n), ...
                                      SECNODES.embNdsBot{i}(n), ...
                                      SECNODES.embNdsBot{i}(n+1), ...
                                      Panel(i).Bot.s{n}(end), ...
                                      Panel(i).Bot.t(n), ...
                                      Panel(i).Bot.E_eff(n), ...
                                      Panel(i).Bot.G_eff(n), ...
                                      Panel(i).Bot.nu_eff(n), ...
                                      Panel(i).Bot.massByV(n), ...
                                      Buckle(i).Bot(n));       
        end
       
        fprintf(fid,'\r\n');
          
        for n = 1:nPanelsBot
        	fprintf(fid,['            panel:' dlm '%-6.0f\r\n'], n);
            fprintf(fid,'        ');
            fprintf(fid, fmt_header2, header2{:,1});
            fprintf(fid,'        ');
            fprintf(fid, fmt_header2, header2{:,2});
            for m = 1:Panel(i).Bot.nLam(n)
                fprintf(fid,'        ');
                fprintf(fid, fmt_number2, m, ...
                                          Panel(i).Bot.nPlies{n}(m), ...
                                          Panel(i).Bot.tPly{n}(m), ...
                                          Panel(i).Bot.fibAng{n}(m), ...
                                          Panel(i).Bot.matID{n}(m), ...
                                          cell2mat( Panel(i).Bot.matName{n}(m) ));
            end
            
            fprintf(fid,'\r\n');
             
            for m = 1:Panel(i).Bot.nLam(n)
                fprintf(fid,['               lamina:' dlm '%-6.0f\r\n'], m);
                fprintf(fid,['              matName:' dlm '%s\r\n'], cell2mat( Panel(i).Bot.matName{n}(m) ));
                fprintf(fid,'            ');
                fprintf(fid, fmt_header3, header3{:,1});
                fprintf(fid,'            ');
                fprintf(fid, fmt_header3, header3{:,2});                      
                for k = 1:numel(Panel(i).Bot.s{n})
                    fprintf(fid,'            ');
                    fprintf(fid, fmt_number3, Panel(i).Bot.s{n}(k), ...
                                              LaminaSS(i).Bot(n).e_11_maxabs{m}(k), ...
                                              LaminaSS(i).Bot(n).e_22_maxabs{m}(k), ...
                                              LaminaSS(i).Bot(n).e_12_maxabs{m}(k), ...
                                              LaminaSS(i).Bot(n).s_11_maxabs{m}(k), ...
                                              LaminaSS(i).Bot(n).s_22_maxabs{m}(k), ...
                                              LaminaSS(i).Bot(n).s_12_maxabs{m}(k), ...
                                              LaminaSS(i).Bot(n).s_11_fc_T{m}(k), ...
                                              LaminaSS(i).Bot(n).s_11_fc_C{m}(k), ...
                                              LaminaSS(i).Bot(n).s_22_fc_T{m}(k), ...
                                              LaminaSS(i).Bot(n).s_22_fc_C{m}(k), ...
                                              LaminaSS(i).Bot(n).s_12_fc_S{m}(k));

                end
                fprintf(fid,'\r\n');
            end
        end
        
        %% print the web panel data
        fprintf(fid,'     Web:');
        fprintf(fid, fmt_header1, header1{:,1});
        fprintf(fid,'        ');
        fprintf(fid, fmt_header1, header1{:,2});
        for n = 1:WEB.nWebs(i)
            fprintf(fid,'        ');
            fprintf(fid, fmt_number1, n, ...
                                      numel(Panel(i).Web.s{n}), ...
                                      Panel(i).Web.nLam(n), ...
                                      SECNODES.webLocs{i}(n), ...
                                      SECNODES.webLocs{i}(n), ...
                                      Panel(i).Web.s{n}(end), ...
                                      Panel(i).Web.t(n), ...
                                      Panel(i).Web.E_eff(n), ...
                                      Panel(i).Web.G_eff(n), ...
                                      Panel(i).Web.nu_eff(n), ...
                                      Panel(i).Web.massByV(n), ...
                                      Buckle(i).Web(n));       
        end
       
        fprintf(fid,'\r\n');
          
        for n = 1:WEB.nWebs(i)
        	fprintf(fid,['            panel:' dlm '%-6.0f\r\n'], n);
            fprintf(fid,'        ');
            fprintf(fid, fmt_header2, header2{:,1});
            fprintf(fid,'        ');
            fprintf(fid, fmt_header2, header2{:,2});
            for m = 1:Panel(i).Web.nLam(n)
                fprintf(fid,'        ');
                fprintf(fid, fmt_number2, m, ...
                                          Panel(i).Web.nPlies{n}(m), ...
                                          Panel(i).Web.tPly{n}(m), ...
                                          Panel(i).Web.fibAng{n}(m), ...
                                          Panel(i).Web.matID{n}(m), ...
                                          cell2mat( Panel(i).Web.matName{n}(m) ));
            end
            
            fprintf(fid,'\r\n');
             
            for m = 1:Panel(i).Web.nLam(n)
                fprintf(fid,['               lamina:' dlm '%-6.0f\r\n'], m);
                fprintf(fid,['              matName:' dlm '%s\r\n'], cell2mat( Panel(i).Web.matName{n}(m) ));
                fprintf(fid,'            ');
                fprintf(fid, fmt_header3, header3{:,1});
                fprintf(fid,'            ');
                fprintf(fid, fmt_header3, header3{:,2});                      
                for k = 1:numel(Panel(i).Web.s{n})
                    fprintf(fid,'            ');
                    fprintf(fid, fmt_number3, Panel(i).Web.s{n}(k), ...
                                              LaminaSS(i).Web(n).e_11_maxabs{m}(k), ...
                                              LaminaSS(i).Web(n).e_22_maxabs{m}(k), ...
                                              LaminaSS(i).Web(n).e_12_maxabs{m}(k), ...
                                              LaminaSS(i).Web(n).s_11_maxabs{m}(k), ...
                                              LaminaSS(i).Web(n).s_22_maxabs{m}(k), ...
                                              LaminaSS(i).Web(n).s_12_maxabs{m}(k), ...
                                              LaminaSS(i).Web(n).s_11_fc_T{m}(k), ...
                                              LaminaSS(i).Web(n).s_11_fc_C{m}(k), ...
                                              LaminaSS(i).Web(n).s_22_fc_T{m}(k), ...
                                              LaminaSS(i).Web(n).s_22_fc_C{m}(k), ...
                                              LaminaSS(i).Web(n).s_12_fc_S{m}(k));

                end
                fprintf(fid,'\r\n');
            end
        end
        
end

fclose(fid);
         
end % function writeOupFileLamina

Contact us