close all
clear variables
%for i =1:5
%Domain
Data.inix = 0;
Data.endx = 1;
Data.nelem = 100;
%Physical 
Data.kappa = 1; 
Data.source = 100; 
%Boundary conditions 
%Dirichlet
Data.FixLeft = 1;          %0, do not fix it, 1: fix it
Data.LeftValue = 0; 
Data.FixRight =1; 
Data.RightValue = 0;
%Neumann
Data.FixFluxesLeft = 0; 
Data.LeftFluxes = 0; 
Data.FixFluxesRight = 0; 
Data.RightFluxes = 25; 

%INITIALIZE PROBLEM - FIRST PART
% %Initialize
% HeatProblem = HP_Initialize(Data);
% %Build problem
% HeatProblem = HP_Build(HeatProblem);
% %System solution
% HeatProblem = HP_Solve(HeatProblem);
% %Plot solution
% hold on
% HP_Plot(HeatProblem,1);
% hold off
% %end

% %soln1000=HeatProblem.Solution.U;  
% actualSol=HeatProblem.Solution.U;  
% error=abs(max(soln1000)-max(actualSol));

%MONOLITIC APPROACH SOLUTION - PART 2
%for i =1:5
Data.inix = 0;
Data.endx = 0.25;
Data.FixLeft = 1; 
Data.FixRight = 0;
Data.kappa = 1;
%Problem 1
HeatProblem = HP_Initialize(Data); HeatProblem = HP_Build(HeatProblem);

Data.inix = 0.25;
Data.endx = 1;
Data.FixLeft = 0; 
Data.FixRight = 1;  
Data.kappa = 1;
%Problem 2
HeatProblem2 = HP_Initialize(Data); HeatProblem2 = HP_Build(HeatProblem2);
%Solve and plot
[HeatProblem,HeatProblem2] = HP_SolveMonolithic(HeatProblem,HeatProblem2);
%hold on 
HP_Plot(HeatProblem,1);
HP_Plot(HeatProblem2,1);
%hold off
%end
