xref: /petsc/src/ts/tutorials/phasefield/heattest.m (revision c4762a1b19cd2af06abeed90e8f9d34fb975dd94)
1*c4762a1bSJed Brown
2*c4762a1bSJed Brown% Runs the heat equation solver for several mesh spacing and determines the order of accuracy of the method with respect to time
3*c4762a1bSJed Brown
4*c4762a1bSJed Brownu = cell(5,1);
5*c4762a1bSJed Brownfor i=1:5
6*c4762a1bSJed Brown system(['./heat -allen-cahn -kappa .001  -ts_monitor -snes_monitor  -pc_type lu   -snes_converged_reason   -ts_type cn  -da_refine ' int2str(i+4) ' -ts_max_time 10 -ts_dt 1.e-3 -snes_atol 1.e-25 -snes_rtol 1.e-25 -ts_max_steps 100'])
7*c4762a1bSJed Brown  ii = 2^(i-1);
8*c4762a1bSJed Brown         ut = PetscBinaryRead('binaryoutput');%,'precision','float128');
9*c4762a1bSJed Brown  u{i} = ut(1:ii:(288*ii));
10*c4762a1bSJed Brownend
11*c4762a1bSJed Brown
12*c4762a1bSJed Brownustar = (2*u{5} - u{4})/1;
13*c4762a1bSJed Brown
14*c4762a1bSJed Brownfor i=1:5
15*c4762a1bSJed Brown  norm(ustar - u{i})
16*c4762a1bSJed Brownend
17*c4762a1bSJed Brown
18*c4762a1bSJed Brown
19