% COMSOL Multiphysics Model M-file
% Generated by COMSOL 3.2a (COMSOL 3.2.0.301, $Date: 2006/02/02 08:34:25 $)

flclear fem

% COMSOL version
clear vrsn
vrsn.name = 'COMSOL 3.2';
vrsn.ext = 'a';
vrsn.major = 0;
vrsn.build = 301;
vrsn.rcs = '$Name:  $';
vrsn.date = '$Date: 2006/02/02 08:34:25 $';
fem.version = vrsn;

% Geometry
g1=solid1([-0.0,1.0]);
clear s
s.objs={g1};
s.name={'I1'};
s.tags={'g1'};

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

% COMSOL Multiphysics Model M-file
% Generated by COMSOL 3.2a (COMSOL 3.2.0.301, $Date: 2006/02/02 08:34:25 $)

% Replacing geometry
xfem=fem;
flclear fem
% Keep global fields
fields={'functions','xmesh','globalexpr','const','version'};
for ii=1:length(fields)
  if isfield(xfem,fields{ii})
    fem.(fields{ii})=xfem.(fields{ii});
  end
end
flclear xfem

% Geometry
g2=rect2(1.2,0.6,'base','corner','pos',[0,0]);
clear s
s.objs={g2};
s.name={'R1'};
s.tags={'g2'};

fem.draw=struct('s',s);
fem.geom=geomcsg(fem);
g3=rect2('1','0.5','base','corner','pos',{'0','0'},'rot','0');
clear s
s.objs={g3};
s.name={'R1'};
s.tags={'g3'};

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

% Initialize mesh
fem.mesh=meshinit(fem);

% (Default values are not included)

% Application mode 1
clear appl
appl.mode.class = 'HeatTransfer';
appl.assignsuffix = '_ht';
clear prop
prop.analysis='static';
appl.prop = prop;
clear bnd
bnd.type = {'T','q0','q0','T'};
bnd.T0 = {273,2,3,293};
bnd.ind = [1,2,3,4];
appl.bnd = bnd;
clear equ
equ.k = 40;
equ.Q = 1000;
equ.ind = [1];
appl.equ = equ;
fem.appl{1} = appl;
fem.frame = {'ref'};
fem.border = 1;
fem.outform = 'general';
fem.units = 'SI';

% Multiphysics
fem=multiphysics(fem);

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

% Solve problem
fem.sol=femnlin(fem, ...
                'solcomp',{'T'}, ...
                'outcomp',{'T'});

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

% Plot solution
postplot(fem, ...
         'tridata',{'flux_ht','cont','internal'}, ...
         'triz','flux_ht', ...
         'trimap','jet(1024)', ...
         'title','Surface: Heat flux [W/m^2]   Height: Heat flux [W/m^2]', ...
         'geom','off', ...
         'grid','on');

% Plot solution
postplot(fem, ...
         'tridata',{'flux_ht','cont','internal'}, ...
         'triz','flux_ht', ...
         'trimap','jet(1024)', ...
         'title','Surface: Heat flux [W/m^2]   Height: Heat flux [W/m^2]', ...
         'geom','off', ...
         'grid','on');
