% COMSOL Multiphysics Model M-file
% Generated by COMSOL 3.5a (COMSOL 3.5.0.603, $Date: 2008/12/03 17:02:19 $)

flclear fem

% COMSOL version
clear vrsn
vrsn.name = 'COMSOL 3.5';
vrsn.ext = 'a';
vrsn.major = 0;
vrsn.build = 603;
vrsn.rcs = '$Name:  $';
vrsn.date = '$Date: 2008/12/03 17:02:19 $';
fem.version = vrsn;

% Geometry
g2=block3('1.5','1','0.8','base','corner','pos',{'0','0','0'},'axis',{'0','0','1'},'rot','0');

% Analyzed geometry
clear s
s.objs={g2};
s.name={'BLK1'};
s.tags={'g2'};

fem.draw=struct('s',s);
fem.geom=geomcsg(fem);

% Initialize mesh
fem.mesh=meshinit(fem, ...
                  'hauto',5);

% Refine mesh
fem.mesh=meshrefine(fem, ...
                    'mcase',0, ...
                    'rmethod','longest');

% Refine mesh
fem.mesh=meshrefine(fem, ...
                    'mcase',0, ...
                    'rmethod','longest');

% Refine mesh
fem.mesh=meshrefine(fem, ...
                    'mcase',0, ...
                    'rmethod','longest');

% Initialize mesh
fem.mesh=meshinit(fem, ...
                  'hauto',5);

% (Default values are not included)

% Application mode 1
clear appl
appl.mode.class = 'AcoPressure';
appl.module = 'ACO';
appl.sshape = 2;
appl.assignsuffix = '_acpr';
clear bnd
bnd.type = {'IMP','NA'};
bnd.Z = '1.25*343*10';
bnd.nacc = {0,0.01};
bnd.ind = [2,1,1,1,1,1];
appl.bnd = bnd;
clear equ
equ.rho = 1.2;
equ.cs = 340;
equ.ind = [1];
appl.equ = equ;
fem.appl{1} = appl;
fem.frame = {'ref'};
fem.border = 1;
clear units;
units.basesystem = 'SI';
fem.units = units;

% Library materials
clear lib
lib.mat{1}.name='Water';
lib.mat{1}.varname='mat1';
lib.mat{1}.variables.nu0='nu0(T[1/K])[m^2/s]';
lib.mat{1}.variables.eta='eta(T[1/K])[Pa*s]';
lib.mat{1}.variables.gamma='1.0';
lib.mat{1}.variables.sigma='5.5e-6[S/m]';
lib.mat{1}.variables.C='Cp(T[1/K])[J/(kg*K)]';
lib.mat{1}.variables.rho='rho(T[1/K])[kg/m^3]';
lib.mat{1}.variables.k='k(T[1/K])[W/(m*K)]';
lib.mat{1}.variables.cs='cs(T[1/K])[m/s]';
clear fcns
fcns{1}.type='interp';
fcns{1}.name='cs';
fcns{1}.method='piecewisecubic';
fcns{1}.extmethod='const';
fcns{1}.x={'273','278','283','293','303','313','323','333','343','353', ...
  '363','373'};
fcns{1}.data={'1403','1427','1447','1481','1507','1526','1541','1552', ...
  '1555','1555','1550','1543'};
fcns{2}.type='piecewise';
fcns{2}.name='rho(T)';
fcns{2}.extmethod='const';
fcns{2}.subtype='poly';
fcns{2}.expr={{'0','8.38466135E+02','1','1.40050603E+00','2', ...
  '-3.01123760E-03','3','3.71822313E-07'}};
fcns{2}.intervals={'273.15','553.75'};
fcns{3}.type='piecewise';
fcns{3}.name='Cp(T)';
fcns{3}.extmethod='const';
fcns{3}.subtype='poly';
fcns{3}.expr={{'0','1.20101471E+04','1','-8.04072879E+01','2', ...
  '3.09866854E-01','3','-5.38186884E-04','4','3.62536437E-07'}};
fcns{3}.intervals={'273.15','553.75'};
fcns{4}.type='piecewise';
fcns{4}.name='eta(T)';
fcns{4}.extmethod='const';
fcns{4}.subtype='poly';
fcns{4}.expr={{'0','1.3799566804E+00','1','-2.1224019151E-02','2', ...
  '1.3604562827E-04','3','-4.6454090319E-07','4','8.9042735735E-10','5', ...
  '-9.0790692686E-13','6','3.8457331488E-16'},{'0','4.01235783E-03','1', ...
  '-2.10746715E-05','2','3.85772275E-08','3','-2.39730284E-11'}};
fcns{4}.intervals={'273.15','413.15','553.75'};
fcns{5}.type='piecewise';
fcns{5}.name='nu0(T)';
fcns{5}.extmethod='const';
fcns{5}.subtype='poly';
fcns{5}.expr={{'0','1.3903230155E-03','1','-2.1392545737E-05','2', ...
  '1.3717187260E-07','3','-4.6851166702E-10','4','8.9823339887E-13','5', ...
  '-9.1602964729E-16','6','3.8807189536E-19'},{'0','1.36222834E-06','1', ...
  '-4.45388688E-09','2','4.04364450E-12'}};
fcns{5}.intervals={'273.15','413.15','553.75'};
fcns{6}.type='piecewise';
fcns{6}.name='k(T)';
fcns{6}.extmethod='const';
fcns{6}.subtype='poly';
fcns{6}.expr={{'0','-8.69083936E-01','1','8.94880345E-03','2', ...
  '-1.58366345E-05','3','7.97543259E-09'}};
fcns{6}.intervals={'273.15','553.75'};
lib.mat{1}.functions = fcns;


fem.lib = lib;

% ODE Settings
clear ode
clear units;
units.basesystem = 'SI';
ode.units = units;
fem.ode=ode;

% Multiphysics
fem=multiphysics(fem);

% Extend mesh
fem.xmesh=meshextend(fem);

% Solve problem
fem.sol=femstatic(fem, ...
                  'solcomp',{'p'}, ...
                  'outcomp',{'p'}, ...
                  'blocksize','auto', ...
                  'pname','f', ...
                  'plist',[ colon(10,10,2000)], ...
                  'oldcomp',{}, ...
                  'nonlin','off', ...
                  'linsolver','spooles');

% Save current fem structure for restart purposes
fem0=fem;

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',5, ...
         'sliceyspacing',0, ...
         'slicezspacing',0, ...
         'slicemap','Rainbow', ...
         'solnum','end', ...
         'title','f(200)=2000    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094177);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',5, ...
         'sliceyspacing',0, ...
         'slicezspacing',0, ...
         'slicemap','Rainbow', ...
         'solnum',1, ...
         'title','f(1)=10    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094152);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',5, ...
         'sliceyspacing',0, ...
         'slicezspacing',0, ...
         'slicemap','Rainbow', ...
         'solnum',1, ...
         'title','f(1)=10    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094152);

% Plot in cross-section or along domain
postcrossplot(fem,0,[4], ...
              'pointdata',{'p','unit','Pa'}, ...
              'title','Pressure [Pa]', ...
              'axislabel',{'f','Pressure [Pa]'}, ...
              'refine','auto');

% Plot in cross-section or along domain
postcrossplot(fem,0,[4], ...
              'pointdata',{'p','unit','Pa'}, ...
              'title','Pressure [Pa]', ...
              'axislabel',{'f','Pressure [Pa]'}, ...
              'refine','auto');

% (Default values are not included)

% Application mode 1
clear appl
appl.mode.class = 'AcoPressure';
appl.module = 'ACO';
appl.sshape = 2;
appl.assignsuffix = '_acpr';
clear bnd
bnd.p0 = {0,0.1};
bnd.type = {'IMP','NA'};
bnd.Z = '1.25*343*10';
bnd.nacc = {0,0.01};
bnd.ind = [2,1,1,1,1,1];
appl.bnd = bnd;
clear equ
equ.rho = 1.2;
equ.cs = 340;
equ.ind = [1];
appl.equ = equ;
fem.appl{1} = appl;
fem.frame = {'ref'};
fem.border = 1;
clear units;
units.basesystem = 'SI';
fem.units = units;

% Library materials
clear lib
lib.mat{1}.name='Water';
lib.mat{1}.varname='mat1';
lib.mat{1}.variables.nu0='nu0(T[1/K])[m^2/s]';
lib.mat{1}.variables.eta='eta(T[1/K])[Pa*s]';
lib.mat{1}.variables.gamma='1.0';
lib.mat{1}.variables.sigma='5.5e-6[S/m]';
lib.mat{1}.variables.C='Cp(T[1/K])[J/(kg*K)]';
lib.mat{1}.variables.rho='rho(T[1/K])[kg/m^3]';
lib.mat{1}.variables.k='k(T[1/K])[W/(m*K)]';
lib.mat{1}.variables.cs='cs(T[1/K])[m/s]';
clear fcns
fcns{1}.type='interp';
fcns{1}.name='cs';
fcns{1}.method='piecewisecubic';
fcns{1}.extmethod='const';
fcns{1}.x={'273','278','283','293','303','313','323','333','343','353', ...
  '363','373'};
fcns{1}.data={'1403','1427','1447','1481','1507','1526','1541','1552', ...
  '1555','1555','1550','1543'};
fcns{2}.type='piecewise';
fcns{2}.name='rho(T)';
fcns{2}.extmethod='const';
fcns{2}.subtype='poly';
fcns{2}.expr={{'0','8.38466135E+02','1','1.40050603E+00','2', ...
  '-3.01123760E-03','3','3.71822313E-07'}};
fcns{2}.intervals={'273.15','553.75'};
fcns{3}.type='piecewise';
fcns{3}.name='Cp(T)';
fcns{3}.extmethod='const';
fcns{3}.subtype='poly';
fcns{3}.expr={{'0','1.20101471E+04','1','-8.04072879E+01','2', ...
  '3.09866854E-01','3','-5.38186884E-04','4','3.62536437E-07'}};
fcns{3}.intervals={'273.15','553.75'};
fcns{4}.type='piecewise';
fcns{4}.name='eta(T)';
fcns{4}.extmethod='const';
fcns{4}.subtype='poly';
fcns{4}.expr={{'0','1.3799566804E+00','1','-2.1224019151E-02','2', ...
  '1.3604562827E-04','3','-4.6454090319E-07','4','8.9042735735E-10','5', ...
  '-9.0790692686E-13','6','3.8457331488E-16'},{'0','4.01235783E-03','1', ...
  '-2.10746715E-05','2','3.85772275E-08','3','-2.39730284E-11'}};
fcns{4}.intervals={'273.15','413.15','553.75'};
fcns{5}.type='piecewise';
fcns{5}.name='nu0(T)';
fcns{5}.extmethod='const';
fcns{5}.subtype='poly';
fcns{5}.expr={{'0','1.3903230155E-03','1','-2.1392545737E-05','2', ...
  '1.3717187260E-07','3','-4.6851166702E-10','4','8.9823339887E-13','5', ...
  '-9.1602964729E-16','6','3.8807189536E-19'},{'0','1.36222834E-06','1', ...
  '-4.45388688E-09','2','4.04364450E-12'}};
fcns{5}.intervals={'273.15','413.15','553.75'};
fcns{6}.type='piecewise';
fcns{6}.name='k(T)';
fcns{6}.extmethod='const';
fcns{6}.subtype='poly';
fcns{6}.expr={{'0','-8.69083936E-01','1','8.94880345E-03','2', ...
  '-1.58366345E-05','3','7.97543259E-09'}};
fcns{6}.intervals={'273.15','553.75'};
lib.mat{1}.functions = fcns;


fem.lib = lib;

% ODE Settings
clear ode
clear units;
units.basesystem = 'SI';
ode.units = units;
fem.ode=ode;

% Multiphysics
fem=multiphysics(fem);

% Extend mesh
fem.xmesh=meshextend(fem);

% Solve problem
fem.sol=femstatic(fem, ...
                  'solcomp',{'p'}, ...
                  'outcomp',{'p'}, ...
                  'blocksize','auto', ...
                  'pname','freq_acpr', ...
                  'plist',[ colon(10,10,2000)], ...
                  'oldcomp',{}, ...
                  'nonlin','off', ...
                  'linsolver','spooles');

% Save current fem structure for restart purposes
fem0=fem;

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',5, ...
         'sliceyspacing',0, ...
         'slicezspacing',0, ...
         'slicemap','Rainbow', ...
         'solnum','end', ...
         'title','freq_acpr(200)=2000    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094177);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',5, ...
         'sliceyspacing',0, ...
         'slicezspacing',0, ...
         'slicemap','Rainbow', ...
         'solnum',42, ...
         'title','freq_acpr(42)=420    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094152);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',5, ...
         'sliceyspacing',0, ...
         'slicezspacing',0, ...
         'slicemap','Rainbow', ...
         'solnum',42, ...
         'title','freq_acpr(42)=420    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094152);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',42, ...
         'title','freq_acpr(42)=420    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094152);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',42, ...
         'title','freq_acpr(42)=420    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094152);

% Animate solution
postmovie(fem, ...
          'slicedata',{'p','cont','internal','unit','Pa'}, ...
          'slicexspacing',0, ...
          'sliceyspacing',0, ...
          'slicezspacing',3, ...
          'slicemap','Rainbow', ...
          'grid','on', ...
          'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
          'camtarget',[0.75,0.5,0.4000000059604645], ...
          'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
          'camva',10.011046191094152, ...
          'fps',10);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',42, ...
         'title','freq_acpr(42)=420    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094152);

% Integrate
I1=postint(fem,'p', ...
           'unit','Pa', ...
           'recover','off', ...
           'dl',4, ...
           'edim',0, ...
           'solnum','end');

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',20, ...
         'title','freq_acpr(20)=200    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094177);

% Integrate
I2=postint(fem,'p', ...
           'unit','Pa', ...
           'recover','off', ...
           'dl',7, ...
           'edim',0, ...
           'solnum','end');

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',13, ...
         'title','freq_acpr(13)=130    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094177);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',13, ...
         'title','freq_acpr(13)=130    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094152);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',13, ...
         'title','freq_acpr(13)=130    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094152);

% Animate solution
postmovie(fem, ...
          'slicedata',{'p','cont','internal','unit','Pa'}, ...
          'slicexspacing',0, ...
          'sliceyspacing',0, ...
          'slicezspacing',3, ...
          'slicemap','Rainbow', ...
          'grid','on', ...
          'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
          'camtarget',[0.75,0.5,0.4000000059604645], ...
          'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
          'camva',10.011046191094152, ...
          'solnum',[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200], ...
          'fps',10);

% Plot in cross-section or along domain
postcrossplot(fem,0,[0;0;0], ...
              'pointdata',{'p','unit','Pa'}, ...
              'title','Pressure [Pa]', ...
              'axislabel',{'freq_acpr','Pressure [Pa]'});

% Integrate
I3=postint(fem,'p', ...
           'unit','Pa', ...
           'recover','off', ...
           'dl',6, ...
           'edim',0, ...
           'solnum','end');

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.5;0.5;0.5], ...
              'pointdata',{'p','unit','Pa'}, ...
              'title','Pressure [Pa]', ...
              'axislabel',{'freq_acpr','Pressure [Pa]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.5;0.7;0.5], ...
              'pointdata',{'p','unit','Pa'}, ...
              'title','Pressure [Pa]', ...
              'axislabel',{'freq_acpr','Pressure [Pa]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.5;0.7;0.2], ...
              'pointdata',{'p','unit','Pa'}, ...
              'title','Pressure [Pa]', ...
              'axislabel',{'freq_acpr','Pressure [Pa]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata',{'p','unit','Pa'}, ...
              'title','Pressure [Pa]', ...
              'axislabel',{'freq_acpr','Pressure [Pa]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata',{'p_t_acpr','unit','Pa'}, ...
              'title','Total acoustic pressure [Pa]', ...
              'axislabel',{'freq_acpr','Total acoustic pressure [Pa]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata',{'vx_acpr','unit','m/s'}, ...
              'title','Local velocity, x component [m/s]', ...
              'axislabel',{'freq_acpr','Local velocity',' x component [m/s]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata',{'ax_acpr','unit','m/s^2'}, ...
              'title','Local acceleration, x component [m/s^2]', ...
              'axislabel',{'freq_acpr','Local acceleration',' x component [m/s^2]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata','Lp_acpr', ...
              'title','Sound pressure level', ...
              'axislabel',{'freq_acpr','Sound pressure level'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata','Lp_s_acpr', ...
              'title','Scattered sound pressure level', ...
              'axislabel',{'freq_acpr','Scattered sound pressure level'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata','Lp_acpr', ...
              'title','Sound pressure level', ...
              'axislabel',{'freq_acpr','Sound pressure level'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata',{'cs_acpr','unit','m/s'}, ...
              'title','Speed of sound [m/s]', ...
              'axislabel',{'freq_acpr','Speed of sound [m/s]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata',{'norma_acpr','unit','m/s^2'}, ...
              'title','Local acceleration, norm [m/s^2]', ...
              'axislabel',{'freq_acpr','Local acceleration',' norm [m/s^2]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata',{'normv_acpr','unit','m/s'}, ...
              'title','Local velocity, norm [m/s]', ...
              'axislabel',{'freq_acpr','Local velocity',' norm [m/s]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata',{'normI_acpr','unit','W/m^2'}, ...
              'title','Intensity, norm [W/m^2]', ...
              'axislabel',{'freq_acpr','Intensity',' norm [W/m^2]'});

% Geometry
g4=cone3('0.2','0.05','26.565051177078','pos',{'0','0.3','0.4'},'axis',{'-1','0','0'},'rot','0');
g5=cone3('0.2','0.05','10','pos',{'0','0.3','0.4'},'axis',{'-1','0','0'},'rot','0');
g6=cone3('0.2','0.05','70','pos',{'0','0.3','0.4'},'axis',{'-1','0','0'},'rot','0');
g7=geomcomp({g2,g6},'ns',{'g2','g6'},'sf','g2+g6','face','none','edge','all');

% Analyzed geometry
clear s
s.objs={g7};
s.name={'CO1'};
s.tags={'g7'};

fem.draw=struct('s',s);
fem.geom=geomcsg(fem);

% Initialize mesh
fem.mesh=meshinit(fem, ...
                  'hauto',5);

% (Default values are not included)

% Application mode 1
clear appl
appl.mode.class = 'AcoPressure';
appl.module = 'ACO';
appl.sshape = 2;
appl.assignsuffix = '_acpr';
clear bnd
bnd.p0 = {0,0.1,0,0.1};
bnd.type = {'NA','IMP','IMP','cont'};
bnd.Z = {'1.25*343','1.25*343*10','1.25*343*10','1.25*343*10'};
bnd.nacc = {'0.01*freq_acpr',0.01,0,0.01};
bnd.ind = [1,1,1,1,1,2,3,3,3,4,3,3];
appl.bnd = bnd;
clear equ
equ.rho = 1.2;
equ.cs = 340;
equ.ind = [1,1];
appl.equ = equ;
fem.appl{1} = appl;
fem.frame = {'ref'};
fem.border = 1;
clear units;
units.basesystem = 'SI';
fem.units = units;

% Library materials
clear lib
lib.mat{1}.name='Water';
lib.mat{1}.varname='mat1';
lib.mat{1}.variables.nu0='nu0(T[1/K])[m^2/s]';
lib.mat{1}.variables.eta='eta(T[1/K])[Pa*s]';
lib.mat{1}.variables.gamma='1.0';
lib.mat{1}.variables.sigma='5.5e-6[S/m]';
lib.mat{1}.variables.C='Cp(T[1/K])[J/(kg*K)]';
lib.mat{1}.variables.rho='rho(T[1/K])[kg/m^3]';
lib.mat{1}.variables.k='k(T[1/K])[W/(m*K)]';
lib.mat{1}.variables.cs='cs(T[1/K])[m/s]';
clear fcns
fcns{1}.type='interp';
fcns{1}.name='cs';
fcns{1}.method='piecewisecubic';
fcns{1}.extmethod='const';
fcns{1}.x={'273','278','283','293','303','313','323','333','343','353', ...
  '363','373'};
fcns{1}.data={'1403','1427','1447','1481','1507','1526','1541','1552', ...
  '1555','1555','1550','1543'};
fcns{2}.type='piecewise';
fcns{2}.name='rho(T)';
fcns{2}.extmethod='const';
fcns{2}.subtype='poly';
fcns{2}.expr={{'0','8.38466135E+02','1','1.40050603E+00','2', ...
  '-3.01123760E-03','3','3.71822313E-07'}};
fcns{2}.intervals={'273.15','553.75'};
fcns{3}.type='piecewise';
fcns{3}.name='Cp(T)';
fcns{3}.extmethod='const';
fcns{3}.subtype='poly';
fcns{3}.expr={{'0','1.20101471E+04','1','-8.04072879E+01','2', ...
  '3.09866854E-01','3','-5.38186884E-04','4','3.62536437E-07'}};
fcns{3}.intervals={'273.15','553.75'};
fcns{4}.type='piecewise';
fcns{4}.name='eta(T)';
fcns{4}.extmethod='const';
fcns{4}.subtype='poly';
fcns{4}.expr={{'0','1.3799566804E+00','1','-2.1224019151E-02','2', ...
  '1.3604562827E-04','3','-4.6454090319E-07','4','8.9042735735E-10','5', ...
  '-9.0790692686E-13','6','3.8457331488E-16'},{'0','4.01235783E-03','1', ...
  '-2.10746715E-05','2','3.85772275E-08','3','-2.39730284E-11'}};
fcns{4}.intervals={'273.15','413.15','553.75'};
fcns{5}.type='piecewise';
fcns{5}.name='nu0(T)';
fcns{5}.extmethod='const';
fcns{5}.subtype='poly';
fcns{5}.expr={{'0','1.3903230155E-03','1','-2.1392545737E-05','2', ...
  '1.3717187260E-07','3','-4.6851166702E-10','4','8.9823339887E-13','5', ...
  '-9.1602964729E-16','6','3.8807189536E-19'},{'0','1.36222834E-06','1', ...
  '-4.45388688E-09','2','4.04364450E-12'}};
fcns{5}.intervals={'273.15','413.15','553.75'};
fcns{6}.type='piecewise';
fcns{6}.name='k(T)';
fcns{6}.extmethod='const';
fcns{6}.subtype='poly';
fcns{6}.expr={{'0','-8.69083936E-01','1','8.94880345E-03','2', ...
  '-1.58366345E-05','3','7.97543259E-09'}};
fcns{6}.intervals={'273.15','553.75'};
lib.mat{1}.functions = fcns;


fem.lib = lib;

% ODE Settings
clear ode
clear units;
units.basesystem = 'SI';
ode.units = units;
fem.ode=ode;

% Multiphysics
fem=multiphysics(fem);

% Extend mesh
fem.xmesh=meshextend(fem);

% Solve problem
fem.sol=femstatic(fem, ...
                  'solcomp',{'p'}, ...
                  'outcomp',{'p'}, ...
                  'blocksize','auto', ...
                  'plotinterp','p', ...
                  'plotinterppar',{'recover','off','phase',0,'geomnum',1,'probecoord',[0.5 0.5 0.5]}, ...
                  'pname','freq_acpr', ...
                  'plist',[ colon(10,10,2000)], ...
                  'oldcomp',{}, ...
                  'nonlin','off', ...
                  'linsolver','spooles');

% Save current fem structure for restart purposes
fem0=fem;

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum','end', ...
         'title','freq_acpr(200)=2000    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094177);

% Integrate
I4=postint(fem,'p', ...
           'unit','Pa', ...
           'recover','off', ...
           'dl',11, ...
           'edim',0, ...
           'solnum','end');

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum','end', ...
         'title','freq_acpr(200)=2000    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094177);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',1, ...
         'title','freq_acpr(1)=10    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094136);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',5, ...
         'title','freq_acpr(5)=50    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094222);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',10, ...
         'title','freq_acpr(10)=100    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094131);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',16, ...
         'title','freq_acpr(16)=160    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094136);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',23, ...
         'title','freq_acpr(23)=230    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094136);

% Plot solution
postplot(fem, ...
         'slicedata',{'p','cont','internal','unit','Pa'}, ...
         'slicexspacing',0, ...
         'sliceyspacing',0, ...
         'slicezspacing',3, ...
         'slicemap','Rainbow', ...
         'solnum',52, ...
         'title','freq_acpr(52)=520    Slice: Pressure [Pa]', ...
         'grid','on', ...
         'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
         'camtarget',[0.75,0.5,0.4000000059604645], ...
         'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
         'camva',10.011046191094136);

% Animate solution
postmovie(fem, ...
          'slicedata',{'p','cont','internal','unit','Pa'}, ...
          'slicexspacing',0, ...
          'sliceyspacing',0, ...
          'slicezspacing',3, ...
          'slicemap','Rainbow', ...
          'grid','on', ...
          'campos',[-2.52594787424644,2.0490440147224813,9.571620835590846], ...
          'camtarget',[0.75,0.5,0.4000000059604645], ...
          'camup',[0.0518964544738685,0.9875855009970439,-0.1482620525740136], ...
          'camva',10.011046191094136, ...
          'fps',10);

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata',{'normI_acpr','unit','W/m^2'}, ...
              'title','Intensity, norm [W/m^2]', ...
              'axislabel',{'freq_acpr','Intensity',' norm [W/m^2]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata','Lp_acpr', ...
              'title','Sound pressure level', ...
              'axislabel',{'freq_acpr','Sound pressure level'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.2;0.2;0.2], ...
              'pointdata','Lp_acpr', ...
              'title','Sound pressure level', ...
              'axislabel',{'freq_acpr','Sound pressure level'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.8;0.2;0.2], ...
              'pointdata','Lp_acpr', ...
              'title','Sound pressure level', ...
              'axislabel',{'freq_acpr','Sound pressure level'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.8;0.5;0.2], ...
              'pointdata','Lp_acpr', ...
              'title','Sound pressure level', ...
              'axislabel',{'freq_acpr','Sound pressure level'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.8;0.2;0.4], ...
              'pointdata','Lp_acpr', ...
              'title','Sound pressure level', ...
              'axislabel',{'freq_acpr','Sound pressure level'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.8;0.2;0.4], ...
              'pointdata',{'p','unit','Pa'}, ...
              'title','Pressure [Pa]', ...
              'axislabel',{'freq_acpr','Pressure [Pa]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.8;0.2;0.4], ...
              'pointdata',{'abs(p)','unit','Pa'}, ...
              'title','abs(p) [Pa]', ...
              'axislabel',{'freq_acpr','abs(p) [Pa]'});

% Plot in cross-section or along domain
postcrossplot(fem,0,[0.8;0.2;0.4], ...
              'pointdata','Lp_acpr', ...
              'title','Sound pressure level', ...
              'axislabel',{'freq_acpr','Sound pressure level'});

return; %%%%%%%%%%% END OF HISTORY %%%%%%%%%%%%%%%%%%%%%%%
%                                                        %
% M-file below is used when resetting the model.         %
%                                                        %
%%%%%%%%%%%%%% START OF RESET HISTORY %%%%%%%%%%%%%%%%%%%%

% COMSOL Multiphysics Model M-file
% Generated by COMSOL 3.5a (COMSOL 3.5.0.603, $Date: 2008/12/03 17:02:19 $)

flclear fem

% COMSOL version
clear vrsn
vrsn.name = 'COMSOL 3.5';
vrsn.ext = 'a';
vrsn.major = 0;
vrsn.build = 603;
vrsn.rcs = '$Name:  $';
vrsn.date = '$Date: 2008/12/03 17:02:19 $';
fem.version = vrsn;

% Geometry
g2=block3('1.5','1','0.8','base','corner','pos',{'0','0','0'},'axis',{'0','0','1'},'rot','0');

% Analyzed geometry
clear s
s.objs={g2};
s.name={'BLK1'};
s.tags={'g2'};

fem.draw=struct('s',s);
fem.geom=geomcsg(fem);
g4=cone3('0.2','0.05','26.565051177078','pos',{'0','0.3','0.4'},'axis',{'-1','0','0'},'rot','0');
g5=cone3('0.2','0.05','10','pos',{'0','0.3','0.4'},'axis',{'-1','0','0'},'rot','0');
g6=cone3('0.2','0.05','70','pos',{'0','0.3','0.4'},'axis',{'-1','0','0'},'rot','0');
g7=geomcomp({g2,g6},'ns',{'g2','g6'},'sf','g2+g6','face','none','edge','all');

% Analyzed geometry
clear s
s.objs={g7};
s.name={'CO1'};
s.tags={'g7'};

fem.draw=struct('s',s);
fem.geom=geomcsg(fem);
