Link to the source code for this example:

Open adjoints_ex5 in new tab.


The console output of the program:

***************************************************************
* Running Example adjoints_ex5:
*   example-opt  
***************************************************************
 
Started /Users/petejw/projects/libmesh_git/build/examples/adjoints/adjoints_ex5/.libs/example-opt
Building mesh
Building system
*** Warning, This code is untested, experimental, or likely to see future API changes: ../../../include/libmesh/memory_solution_history.h, line 43, compiled Apr 12 2016 at 12:24:52 ***
Initializing systems
Setting primal initial conditions
|U(0)|= 2.27632

 Mesh Information:
  elem_dimensions()={2}
  spatial_dimension()=2
  n_nodes()=4225
    n_local_nodes()=4225
  n_elem()=5456
    n_local_elem()=5456
    n_active_elem()=4096
  n_subdomains()=1
  n_partitions()=1
  n_processors()=1
  n_threads()=1
  processor_id()=0

 EquationSystems
  n_systems()=1
   System #0, "HeatSystem"
    Type "Implicit"
    Variables="T" 
    Finite Element Types="LAGRANGE", "JACOBI_20_00" 
    Infinite Element Mapping="CARTESIAN" 
    Approximation Orders="FIRST", "THIRD" 
    n_dofs()=4225
    n_local_dofs()=4225
    n_constrained_dofs()=256
    n_local_constrained_dofs()=256
    n_vectors()=3
    n_matrices()=1
    DofMap Sparsity
      Average  On-Processor Bandwidth <= 8.81633
      Average Off-Processor Bandwidth <= 0
      Maximum  On-Processor Bandwidth <= 9
      Maximum Off-Processor Bandwidth <= 0
    DofMap Constraints
      Number of DoF Constraints = 256
      Average DoF Constraint Length= 0

 Solving time step 0, time = 0
  Nonlinear solver converged, step 0, residual reduction 4.88798e-14 < 1e-09
|U(0.1)|= 2.27183
Advancing timestep

 Solving time step 1, time = 0.1
  Nonlinear solver converged, step 0, residual reduction 4.73169e-14 < 1e-09
|U(0.2)|= 2.26736
Advancing timestep

 Solving time step 2, time = 0.2
  Nonlinear solver converged, step 0, residual reduction 4.76985e-14 < 1e-09
|U(0.3)|= 2.26289
Advancing timestep

 Solving time step 3, time = 0.3
  Nonlinear solver converged, step 0, residual reduction 4.95153e-14 < 1e-09
|U(0.4)|= 2.25843
Advancing timestep

 Solving time step 4, time = 0.4
  Nonlinear solver converged, step 0, residual reduction 4.88466e-14 < 1e-09
|U(0.5)|= 2.25398
Advancing timestep

 Solving time step 5, time = 0.5
  Nonlinear solver converged, step 0, residual reduction 4.91815e-14 < 1e-09
|U(0.6)|= 2.24954
Advancing timestep

 Solving time step 6, time = 0.6
  Nonlinear solver converged, step 0, residual reduction 4.85315e-14 < 1e-09
|U(0.7)|= 2.24511
Advancing timestep

 Solving time step 7, time = 0.7
  Nonlinear solver converged, step 0, residual reduction 4.90403e-14 < 1e-09
|U(0.8)|= 2.24068
Advancing timestep

 Solving time step 8, time = 0.8
  Nonlinear solver converged, step 0, residual reduction 4.89052e-14 < 1e-09
|U(0.9)|= 2.23627
Advancing timestep

 Solving time step 9, time = 0.9
  Nonlinear solver converged, step 0, residual reduction 4.87662e-14 < 1e-09
|U(1)|= 2.23186
Advancing timestep


Solving the adjoint problem
Setting adjoint initial conditions Z(1)
Retrieving solutions at time t=1
|U(1.1)|= 2.23186
|U(1)|= 2.23186
|Z(1)|= 2.27632

 Solving adjoint time step 0, time = 1
Retrieving solutions at time t=1
|U(1)|= 2.23186
|U(0.9)|= 2.23627
|Z(0.9)|= 0.227183

 Solving adjoint time step 1, time = 0.9
Retrieving solutions at time t=0.9
|U(0.9)|= 2.23627
|U(0.8)|= 2.24068
|Z(0.8)|= 0.0226736

 Solving adjoint time step 2, time = 0.8
Retrieving solutions at time t=0.8
|U(0.8)|= 2.24068
|U(0.7)|= 2.24511
|Z(0.7)|= 0.00226289

 Solving adjoint time step 3, time = 0.7
Retrieving solutions at time t=0.7
|U(0.7)|= 2.24511
|U(0.6)|= 2.24954
|Z(0.6)|= 0.000225843

 Solving adjoint time step 4, time = 0.6
Retrieving solutions at time t=0.6
|U(0.6)|= 2.24954
|U(0.5)|= 2.25398
|Z(0.5)|= 2.25398e-05

 Solving adjoint time step 5, time = 0.5
Retrieving solutions at time t=0.5
|U(0.5)|= 2.25398
|U(0.4)|= 2.25843
|Z(0.4)|= 2.24954e-06

 Solving adjoint time step 6, time = 0.4
Retrieving solutions at time t=0.4
|U(0.4)|= 2.25843
|U(0.3)|= 2.26289
|Z(0.3)|= 2.24511e-07

 Solving adjoint time step 7, time = 0.3
Retrieving solutions at time t=0.3
|U(0.3)|= 2.26289
|U(0.2)|= 2.26736
|Z(0.2)|= 2.24068e-08

 Solving adjoint time step 8, time = 0.2
Retrieving solutions at time t=0.2
|U(0.2)|= 2.26736
|U(0.1)|= 2.27183
|Z(0.1)|= 2.23627e-09

 Solving adjoint time step 9, time = 0.1
Retrieving solutions at time t=0.1
|U(0.1)|= 2.27183
|U(2.77556e-17)|= 2.27632
|Z(2.77556e-17)|= 2.23186e-10

Retrieving 0, time = 2.77556e-17
|U(0.1)|= 2.27183
|U(2.77556e-17)|= 2.27632
|Z(2.77556e-17)|= 2.23186e-10

*** Warning, This code is deprecated, and likely to be removed in future library versions! ./include/libmesh/parameter_pointer.h, line 66, compiled Apr 12 2016 at 11:10:14 ***
Retrieving 1, time = 0.1
|U(0.2)|= 2.26736
|U(0.1)|= 2.27183
|Z(0.1)|= 2.23627e-09

Retrieving 2, time = 0.2
|U(0.3)|= 2.26289
|U(0.2)|= 2.26736
|Z(0.2)|= 2.24068e-08

Retrieving 3, time = 0.3
|U(0.4)|= 2.25843
|U(0.3)|= 2.26289
|Z(0.3)|= 2.24511e-07

Retrieving 4, time = 0.4
|U(0.5)|= 2.25398
|U(0.4)|= 2.25843
|Z(0.4)|= 2.24954e-06

Retrieving 5, time = 0.5
|U(0.6)|= 2.24954
|U(0.5)|= 2.25398
|Z(0.5)|= 2.25398e-05

Retrieving 6, time = 0.6
|U(0.7)|= 2.24511
|U(0.6)|= 2.24954
|Z(0.6)|= 0.000225843

Retrieving 7, time = 0.7
|U(0.8)|= 2.24068
|U(0.7)|= 2.24511
|Z(0.7)|= 0.00226289

Retrieving 8, time = 0.8
|U(0.9)|= 2.23627
|U(0.8)|= 2.24068
|Z(0.8)|= 0.0226736

Retrieving 9, time = 0.9
|U(1)|= 2.23186
|U(0.9)|= 2.23627
|Z(0.9)|= 0.227183

Retrieving final time = 1
|U(1.1)|= 2.23186
|U(1)|= 2.23186
|Z(1)|= 2.27632

Sensitivity of QoI 0 w.r.t parameter 0 is: -5.37173

 -------------------------------------------------------------------------------------------------------------------
| Time:           Wed Apr 13 10:22:56 2016                                                                          |
| OS:             Darwin                                                                                            |
| HostName:       peterson-laptop.local                                                                             |
| OS Release:     15.0.0                                                                                            |
| OS Version:     Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64  |
| Machine:        x86_64                                                                                            |
| Username:       petejw                                                                                            |
| Configuration:  ../configure  'INSTALL=/usr/bin/install -C'                                                       |
|  '--with-methods=opt dbg'                                                                                         |
|  '--prefix=/Users/petejw/projects/libmesh_git/installed'                                                          |
|  '--enable-perflog'                                                                                               |
|  '--enable-tracefiles'                                                                                            |
|  '--disable-blocked-storage'                                                                                      |
|  '--enable-default-comm-world'                                                                                    |
|  '--enable-tecio'                                                                                                 |
|  '--enable-unique-ptr'                                                                                            |
|  '--enable-ifem'                                                                                                  |
|  'PETSC_DIR=/opt/moose/petsc/mpich_petsc-3.6.1/clang-opt-superlu'                                                 |
|  'SLEPC_DIR=/opt/petejw/slepc/3.6.1'                                                                              |
|  'CPPFLAGS= '                                                                                                     |
|  'LIBS= '                                                                                                         |
|  'CPPFLAGS=  '                                                                                                    |
|  'LIBS=  '                                                                                                        |
|  '--disable-netcdf-4'                                                                                             |
|  '--disable-testsets'                                                                                             |
|  'CXX=mpicxx'                                                                                                     |
|  'CC=mpicc'                                                                                                       |
|  'F77=mpif77'                                                                                                     |
|  'FC=mpif90'                                                                                                      |
|  'CPPFLAGS=   '                                                                                                   |
|  'LIBS=   '                                                                                                       |
 -------------------------------------------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------------------------------------------
| libMesh Performance: Alive time=3.92805, Active time=3.57661                                                         |
 ----------------------------------------------------------------------------------------------------------------------
| Event                                   nCalls     Total Time  Avg Time    Total Time  Avg Time    % of Active Time  |
|                                                    w/o Sub     w/o Sub     With Sub    With Sub    w/o S    With S   |
|----------------------------------------------------------------------------------------------------------------------|
|                                                                                                                      |
|                                                                                                                      |
| DofMap                                                                                                               |
|   add_neighbors_to_send_list()          5          0.0008      0.000162    0.0008      0.000162    0.02     0.02     |
|   build_constraint_matrix()             294912     0.0642      0.000000    0.0642      0.000000    1.80     1.80     |
|   build_sparsity()                      5          0.0054      0.001090    0.0067      0.001335    0.15     0.19     |
|   cnstrn_elem_mat_vec()                 40960      0.0046      0.000000    0.0046      0.000000    0.13     0.13     |
|   constrain_elem_matrix()               40960      0.0070      0.000000    0.0070      0.000000    0.20     0.20     |
|   constrain_elem_vector()               172032     0.0268      0.000000    0.0268      0.000000    0.75     0.75     |
|   create_dof_constraints()              5          0.0296      0.005918    0.0308      0.006168    0.83     0.86     |
|   distribute_dofs()                     5          0.0009      0.000181    0.0050      0.001005    0.03     0.14     |
|   dof_indices()                         962464     0.1450      0.000000    0.1450      0.000000    4.06     4.06     |
|   enforce_adjoint_constraints_exactly() 10         0.0001      0.000011    0.0001      0.000011    0.00     0.00     |
|   enforce_constraints_exactly()         40         0.0016      0.000040    0.0016      0.000040    0.05     0.05     |
|   old_dof_indices()                     32640      0.0069      0.000000    0.0069      0.000000    0.19     0.19     |
|   prepare_send_list()                   6          0.0000      0.000000    0.0000      0.000000    0.00     0.00     |
|   reinit()                              5          0.0041      0.000824    0.0041      0.000824    0.12     0.12     |
|                                                                                                                      |
| EquationSystems                                                                                                      |
|   build_solution_vector()               22         0.0444      0.002020    0.0639      0.002907    1.24     1.79     |
|                                                                                                                      |
| FE                                                                                                                   |
|   compute_shape_functions()             1041280    0.5446      0.000001    0.5446      0.000001    15.23    15.23    |
|   init_shape_functions()                46091      0.1608      0.000003    0.1608      0.000003    4.50     4.50     |
|   inverse_map()                         81024      0.0309      0.000000    0.0309      0.000000    0.86     0.86     |
|                                                                                                                      |
| FEMSystem                                                                                                            |
|   assemble_qoi_derivative()             10         0.1384      0.013842    0.2363      0.023627    3.87     6.61     |
|   assembly()                            10         0.1787      0.017865    0.3660      0.036600    5.00     10.23    |
|   assembly(get_jacobian)                10         0.1760      0.017601    0.3556      0.035563    4.92     9.94     |
|   assembly(get_residual)                32         0.4887      0.015271    1.0588      0.033087    13.66    29.60    |
|                                                                                                                      |
| FEMap                                                                                                                |
|   compute_affine_map()                  1041280    0.3904      0.000000    0.3904      0.000000    10.92    10.92    |
|   compute_face_map()                    13312      0.0096      0.000001    0.0231      0.000002    0.27     0.65     |
|   init_face_shape_functions()           52         0.0001      0.000001    0.0001      0.000001    0.00     0.00     |
|   init_reference_to_physical_map()      46091      0.0703      0.000002    0.0703      0.000002    1.96     1.96     |
|                                                                                                                      |
| GMVIO                                                                                                                |
|   write_nodal_data()                    22         0.2659      0.012085    0.2659      0.012085    7.43     7.43     |
|                                                                                                                      |
| GenericProjector                                                                                                     |
|   operator()                            10         0.0311      0.003106    0.7111      0.071110    0.87     19.88    |
|   project_edges                         19072      0.0011      0.000000    0.0011      0.000000    0.03     0.03     |
|   project_interior                      19072      0.0013      0.000000    0.0013      0.000000    0.04     0.04     |
|   project_nodes                         19072      0.0193      0.000001    0.6616      0.000035    0.54     18.50    |
|   project_sides                         19072      0.0011      0.000000    0.0011      0.000000    0.03     0.03     |
|                                                                                                                      |
| ImplicitSystem                                                                                                       |
|   adjoint_solve()                       10         0.0001      0.000013    0.6031      0.060314    0.00     16.86    |
|                                                                                                                      |
| Mesh                                                                                                                 |
|   contract()                            4          0.0001      0.000034    0.0002      0.000060    0.00     0.01     |
|   find_neighbors()                      5          0.0126      0.002515    0.0126      0.002515    0.35     0.35     |
|   renumber_nodes_and_elem()             14         0.0004      0.000025    0.0004      0.000025    0.01     0.01     |
|                                                                                                                      |
| MeshOutput                                                                                                           |
|   write_equation_systems()              22         0.0002      0.000009    0.3300      0.015001    0.01     9.23     |
|                                                                                                                      |
| MeshRefinement                                                                                                       |
|   _coarsen_elements()                   4          0.0001      0.000025    0.0001      0.000025    0.00     0.00     |
|   _refine_elements()                    8          0.0061      0.000762    0.0126      0.001577    0.17     0.35     |
|   add_node()                            21760      0.0048      0.000000    0.0048      0.000000    0.14     0.14     |
|   make_coarsening_compatible()          4          0.0019      0.000479    0.0019      0.000479    0.05     0.05     |
|   make_flags_parallel_consistent()      8          0.0009      0.000115    0.0009      0.000115    0.03     0.03     |
|   make_refinement_compatible()          4          0.0001      0.000028    0.0001      0.000028    0.00     0.00     |
|                                                                                                                      |
| MeshTools::Generation                                                                                                |
|   build_cube()                          1          0.0000      0.000034    0.0000      0.000034    0.00     0.00     |
|                                                                                                                      |
| NewtonSolver                                                                                                         |
|   solve()                               10         0.0013      0.000132    0.7053      0.070535    0.04     19.72    |
|                                                                                                                      |
| OldSolutionValue                                                                                                     |
|   Number eval_at_node()                 43520      0.0028      0.000000    0.0028      0.000000    0.08     0.08     |
|   check_old_context(c,p)                32640      0.0179      0.000001    0.0341      0.000001    0.50     0.95     |
|   eval_at_point()                       32640      0.3142      0.000010    0.6335      0.000019    8.78     17.71    |
|                                                                                                                      |
| Parallel                                                                                                             |
|   allgather()                           5          0.0000      0.000000    0.0000      0.000000    0.00     0.00     |
|                                                                                                                      |
| Partitioner                                                                                                          |
|   single_partition()                    5          0.0002      0.000041    0.0002      0.000041    0.01     0.01     |
|                                                                                                                      |
| PetscLinearSolver                                                                                                    |
|   solve()                               20         0.0232      0.001159    0.0232      0.001159    0.65     0.65     |
|                                                                                                                      |
| System                                                                                                               |
|   calculate_norm()                      77         0.3270      0.004247    0.7343      0.009536    9.14     20.53    |
|   project_fem_vector()                  2          0.0003      0.000140    0.0226      0.011280    0.01     0.63     |
|   project_vector(FunctionBase)          2          0.0000      0.000005    0.0226      0.011284    0.00     0.63     |
|   project_vector(old,new)               8          0.0057      0.000717    0.6977      0.087209    0.16     19.51    |
|                                                                                                                      |
| TopologyMap                                                                                                          |
|   init()                                8          0.0070      0.000874    0.0070      0.000874    0.20     0.20     |
 ----------------------------------------------------------------------------------------------------------------------
| Totals:                                 4020364    3.5766                                          100.00            |
 ----------------------------------------------------------------------------------------------------------------------

 
***************************************************************
* Done Running Example adjoints_ex5:
*   example-opt  
***************************************************************