xref: /petsc/src/ts/tutorials/phasefield/heattest.m (revision 2a1887a77e7b2c6e00dd0ba96d1387c839460237)
1c4762a1bSJed Brown
2c4762a1bSJed Brown% Runs the heat equation solver for several mesh spacing and determines the order of accuracy of the method with respect to time
3c4762a1bSJed Brown
4c4762a1bSJed Brownu = cell(5,1);
5c4762a1bSJed Brownfor i=1:5
6*188af4bfSBarry Smith 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_time_step 1.e-3 -snes_atol 1.e-25 -snes_rtol 1.e-25 -ts_max_steps 100'])
7c4762a1bSJed Brown  ii = 2^(i-1);
8c4762a1bSJed Brown         ut = PetscBinaryRead('binaryoutput');%,'precision','float128');
9c4762a1bSJed Brown  u{i} = ut(1:ii:(288*ii));
10c4762a1bSJed Brownend
11c4762a1bSJed Brown
12c4762a1bSJed Brownustar = (2*u{5} - u{4})/1;
13c4762a1bSJed Brown
14c4762a1bSJed Brownfor i=1:5
15c4762a1bSJed Brown  norm(ustar - u{i})
16c4762a1bSJed Brownend
17c4762a1bSJed Brown
18c4762a1bSJed Brown
19