Commits

Jed Brown  committed 2758e58

TS examples: compile-fix and minor output cleanup

  • Participants
  • Parent commits c907b75

Comments (0)

Files changed (5)

File src/ts/examples/tutorials/advection-diffusion-reaction/ex3.c

 */
 
 #include <petscts.h>
+#include <petscdmda.h>
 
 /*
    User-defined application context - contains data needed by the

File src/ts/examples/tutorials/ex17.c

   Vec            u;                    /* solution, residual vectors */
   Mat            J;                    /* Jacobian matrix */
   PetscInt       maxsteps = 1000;     /* iterations for convergence */
+  PetscInt       nsteps;
+  PetscReal      vmin,vmax,norm;
   PetscErrorCode ierr;
   DM             da;
   PetscReal      ftime,dt;
   ierr = TSSolve(ts,u);CHKERRQ(ierr);
 
   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+   Compute diagnostics of the solution
+   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+  ierr = VecNorm(u,NORM_1,&norm);CHKERRQ(ierr);
+  ierr = VecMax(u,NULL,&vmax);CHKERRQ(ierr);
+  ierr = VecMin(u,NULL,&vmin);CHKERRQ(ierr);
+  ierr = TSGetTimeStepNumber(ts,&nsteps);CHKERRQ(ierr);
+  ierr = TSGetTime(ts,&ftime);CHKERRQ(ierr);
+  ierr = PetscPrintf(PETSC_COMM_WORLD,"timestep %D: time %G, solution norm %G, max %G, min %G\n",nsteps,ftime,norm,vmax,vmin);CHKERRQ(ierr);
+
+  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Free work space.
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
   ierr = MatDestroy(&J);CHKERRQ(ierr);

File src/ts/examples/tutorials/makefile

 	   ${RM} -f ex16_1.tmp
 
 runex17:
-	-@${MPIEXEC} -n 1 ./ex17 -da_grid_x 40 -ts_max_steps 2 -snes_monitor_short -ksp_monitor_short > ex17_1.tmp 2>&1; \
+	-@${MPIEXEC} -n 1 ./ex17 -da_grid_x 40 -ts_max_steps 2 -snes_monitor_short -ksp_monitor_short -ts_monitor > ex17_1.tmp 2>&1; \
 	   ${DIFF} output/ex17_1.out ex17_1.tmp || echo  ${PWD} "\nPossible problem with ex17_1, diffs above \n========================================="; \
 	   ${RM} -f ex17_1.tmp
 

File src/ts/examples/tutorials/output/ex17_1.out

-timestep 0: time 0, solution norm 9.84774, max 0.999937, min 0
+0 TS dt 0.01 time 0
     0 SNES Function norm 2869.48 
       0 KSP Residual norm 1.42606 
       1 KSP Residual norm < 1.e-11
     1 SNES Function norm < 1.e-11
-timestep 1: time 0.01, solution norm 9.67453, max 0.714133, min 0
+1 TS dt 0.01 time 0.01
     0 SNES Function norm 142.606 
       0 KSP Residual norm 0.517415 
       1 KSP Residual norm < 1.e-11
     1 SNES Function norm < 1.e-11
+2 TS dt 0.01 time 0.02
+-1 TS dt 0.01 time 0.02
 timestep 2: time 0.02, solution norm 9.28659, max 0.536609, min 0

File src/ts/examples/tutorials/output/ex17_2.out

-timestep 0: time 0, solution norm 23.6853, max 0.999996, min 0
-timestep 1: time 0.01, solution norm 23.5593, max 0.882245, min 0
-timestep 2: time 0.02, solution norm 23.0085, max 0.777702, min -0.0272512
-timestep 3: time 0.03, solution norm 21.6425, max 0.71264, min -0.0448901
-timestep 4: time 0.04, solution norm 19.9589, max 0.663065, min -0.0773792
-timestep 5: time 0.05, solution norm 18.2365, max 0.623411, min -0.0845737
-timestep 6: time 0.06, solution norm 16.6944, max 0.582883, min -0.109941
-timestep 7: time 0.07, solution norm 15.1826, max 0.554764, min -0.112078
-timestep 8: time 0.08, solution norm 13.8932, max 0.519877, min -0.133839
-timestep 9: time 0.09, solution norm 12.637, max 0.497851, min -0.133952
-timestep 10: time 0.1, solution norm 11.5727, max 0.468206, min -0.151915
-timestep 11: time 0.11, solution norm 10.5384, max 0.450006, min -0.151153
-timestep 12: time 0.12, solution norm 9.66152, max 0.42498, min -0.165509
-timestep 13: time 0.13, solution norm 8.81048, max 0.40957, min -0.164227
-timestep 14: time 0.14, solution norm 8.08826, max 0.388386, min -0.175488
-timestep 15: time 0.15, solution norm 7.38717, max 0.375216, min -0.173774
-timestep 16: time 0.16, solution norm 6.79241, max 0.357143, min -0.182512
-timestep 17: time 0.17, solution norm 6.21402, max 0.345858, min -0.18039
-timestep 18: time 0.18, solution norm 5.72422, max 0.330283, min -0.187117
-timestep 19: time 0.19, solution norm 5.24634, max 0.320608, min -0.184614
-timestep 20: time 0.2, solution norm 4.8429, max 0.307048, min -0.18975
-timestep 21: time 0.21, solution norm 4.44745, max 0.298748, min -0.186909
-timestep 22: time 0.22, solution norm 4.11504, max 0.286827, min -0.190788
-timestep 23: time 0.23, solution norm 3.78727, max 0.279696, min -0.187664
-timestep 24: time 0.24, solution norm 3.51325, max 0.269124, min -0.190544
-timestep 25: time 0.25, solution norm 3.24109, max 0.26298, min -0.187198
-timestep 26: time 0.26, solution norm 3.01527, max 0.25353, min -0.189282
-timestep 27: time 0.27, solution norm 2.78865, max 0.248217, min -0.185774
-timestep 28: time 0.28, solution norm 2.60209, max 0.239711, min -0.18722
-timestep 29: time 0.29, solution norm 2.41331, max 0.235091, min -0.183604
-timestep 30: time 0.3, solution norm 2.25917, max 0.227387, min -0.184537
-timestep 31: time 0.31, solution norm 2.12561, max 0.223346, min -0.180862
-timestep 32: time 0.32, solution norm 1.99491, max 0.21633, min -0.181382
-timestep 33: time 0.33, solution norm 1.89099, max 0.21277, min -0.177686
-timestep 34: time 0.34, solution norm 1.78161, max 0.206348, min -0.177873
-timestep 35: time 0.35, solution norm 1.69329, max 0.203189, min -0.174191
-timestep 36: time 0.36, solution norm 1.60154, max 0.197283, min -0.174109
-timestep 37: time 0.37, solution norm 1.52613, max 0.194457, min -0.170466
-timestep 38: time 0.38, solution norm 1.44894, max 0.189003, min -0.170168
-timestep 39: time 0.39, solution norm 1.38422, max 0.186456, min -0.166586
-timestep 40: time 0.4, solution norm 1.31907, max 0.181399, min -0.166115
-timestep 41: time 0.41, solution norm 1.26324, max 0.179084, min -0.162607
-timestep 42: time 0.42, solution norm 1.20805, max 0.174379, min -0.161999
-timestep 43: time 0.43, solution norm 1.1596, max 0.17226, min -0.158576
-timestep 44: time 0.44, solution norm 1.11266, max 0.167866, min -0.15786
-timestep 45: time 0.45, solution norm 1.07036, max 0.165912, min -0.154531
-timestep 46: time 0.46, solution norm 1.03026, max 0.161797, min -0.153731
-timestep 47: time 0.47, solution norm 1.00106, max 0.159983, min -0.150499
-timestep 48: time 0.48, solution norm 0.968007, max 0.156117, min -0.149635
-timestep 49: time 0.49, solution norm 0.944156, max 0.154423, min -0.146504
-timestep 50: time 0.5, solution norm 0.915354, max 0.150781, min -0.145592
-timestep 51: time 0.51, solution norm 0.8943, max 0.14919, min -0.142563
-timestep 52: time 0.52, solution norm 0.870712, max 0.14575, min -0.141617
-timestep 53: time 0.53, solution norm 0.851296, max 0.14425, min -0.138689
-timestep 54: time 0.54, solution norm 0.832402, max 0.140993, min -0.137719
-timestep 55: time 0.55, solution norm 0.814064, max 0.139571, min -0.134891
-timestep 56: time 0.56, solution norm 0.797807, max 0.136482, min -0.133907
-timestep 57: time 0.57, solution norm 0.781225, max 0.135129, min -0.131178
-timestep 58: time 0.58, solution norm 0.76631, max 0.132192, min -0.130187
-timestep 59: time 0.59, solution norm 0.751209, max 0.130901, min -0.127553
-timestep 60: time 0.6, solution norm 0.739021, max 0.128105, min -0.126561
-timestep 61: time 0.61, solution norm 0.725099, max 0.126869, min -0.124021
-timestep 62: time 0.62, solution norm 0.714117, max 0.124202, min -0.123033
-timestep 63: time 0.63, solution norm 0.70122, max 0.123015, min -0.120582
-timestep 64: time 0.64, solution norm 0.690833, max 0.120468, min -0.119602
-timestep 65: time 0.65, solution norm 0.678815, max 0.119327, min -0.117239
-timestep 66: time 0.66, solution norm 0.668946, max 0.11689, min -0.116269
-timestep 67: time 0.67, solution norm 0.657688, max 0.115791, min -0.113989
-timestep 68: time 0.68, solution norm 0.648272, max 0.113457, min -0.113033
-timestep 69: time 0.69, solution norm 0.637675, max 0.112396, min -0.110834
-timestep 70: time 0.7, solution norm 0.62866, max 0.110159, min -0.109892
-timestep 71: time 0.71, solution norm 0.618699, max 0.109134, min -0.107772
-timestep 72: time 0.72, solution norm 0.609987, max 0.106986, min -0.106846
-timestep 73: time 0.73, solution norm 0.600804, max 0.105994, min -0.1048
-timestep 74: time 0.74, solution norm 0.592229, max 0.103932, min -0.103892
-timestep 75: time 0.75, solution norm 0.583723, max 0.102971, min -0.101917
-timestep 76: time 0.76, solution norm 0.575372, max 0.100988, min -0.101027
-timestep 77: time 0.77, solution norm 0.56729, max 0.100057, min -0.0991212
-timestep 78: time 0.78, solution norm 0.559141, max 0.0981488, min -0.0982495
-timestep 79: time 0.79, solution norm 0.551674, max 0.097245, min -0.0964099
-timestep 80: time 0.8, solution norm 0.543763, max 0.0954084, min -0.095557
-timestep 81: time 0.81, solution norm 0.536543, max 0.0945309, min -0.0937808
-timestep 82: time 0.82, solution norm 0.528929, max 0.0927616, min -0.0929469
-timestep 83: time 0.83, solution norm 0.521871, max 0.0919091, min -0.0912315
-timestep 84: time 0.84, solution norm 0.514531, max 0.0902037, min -0.0904165
-timestep 85: time 0.85, solution norm 0.507853, max 0.0893751, min -0.0887595
-timestep 86: time 0.86, solution norm 0.500941, max 0.0877304, min -0.0879633
-timestep 87: time 0.87, solution norm 0.495141, max 0.0869247, min -0.0863624
-timestep 88: time 0.88, solution norm 0.489297, max 0.0853378, min -0.0855848
-timestep 89: time 0.89, solution norm 0.483624, max 0.084554, min -0.0840377
-timestep 90: time 0.9, solution norm 0.477872, max 0.0830222, min -0.0832786
-timestep 91: time 0.91, solution norm 0.472392, max 0.0822595, min -0.0817832
-timestep 92: time 0.92, solution norm 0.466837, max 0.0807802, min -0.0810422
-timestep 93: time 0.93, solution norm 0.461459, max 0.0800378, min -0.0795964
-timestep 94: time 0.94, solution norm 0.456031, max 0.0786088, min -0.0788733
-timestep 95: time 0.95, solution norm 0.450823, max 0.0778859, min -0.0774751
-timestep 96: time 0.96, solution norm 0.445552, max 0.0765049, min -0.0767695
-timestep 97: time 0.97, solution norm 0.440488, max 0.0758008, min -0.0754171
-timestep 98: time 0.98, solution norm 0.435333, max 0.0744658, min -0.0747286
-timestep 99: time 0.99, solution norm 0.430324, max 0.07378, min -0.0734202
 timestep 100: time 1, solution norm 0.425275, max 0.0724889, min -0.0727486