The source file miscellaneous_ex3.C with comments:
#include <iostream>
#include <algorithm>
#include <cmath>
Various include files needed for the mesh & solver functionality.
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/mesh_refinement.h"
#include "libmesh/exodusII_io.h"
#include "libmesh/equation_systems.h"
#include "libmesh/fe.h"
#include "libmesh/quadrature_gauss.h"
#include "libmesh/dof_map.h"
#include "libmesh/sparse_matrix.h"
#include "libmesh/numeric_vector.h"
#include "libmesh/dense_matrix.h"
#include "libmesh/dense_vector.h"
#include "libmesh/elem.h"
#include "libmesh/string_to_enum.h"
#include "libmesh/getpot.h"
The nonlinear solver and system we will be using
#include "libmesh/nonlinear_solver.h"
#include "libmesh/nonlinear_implicit_system.h"
Necessary for programmatically setting petsc options
#ifdef LIBMESH_HAVE_PETSC
#include <petsc.h>
#endif
Bring in everything from the libMesh namespace
using namespace libMesh;
A reference to our equation system
EquationSystems *_equation_system = NULL;
Let-s define the physical parameters of the equation
const Real kappa = 1.;
const Real sigma = 0.2;
This function computes the Jacobian K(x)
void compute_jacobian (const NumericVector<Number>& soln,
SparseMatrix<Number>& jacobian,
NonlinearImplicitSystem& /*sys*/)
{
Get a reference to the equation system.
EquationSystems &es = *_equation_system;
Get a constant reference to the mesh object.
const MeshBase& mesh = es.get_mesh();
The dimension that we are running
const unsigned int dim = mesh.mesh_dimension();
Get a reference to the NonlinearImplicitSystem we are solving
NonlinearImplicitSystem& system =
es.get_system<NonlinearImplicitSystem>("Laplace-Young");
A reference to the \p DofMap object for this system. The \p DofMap
object handles the index translation from node and element numbers
to degree of freedom numbers. We will talk more about the \p DofMap
in future examples.
const DofMap& dof_map = system.get_dof_map();
Get a constant reference to the Finite Element type
for the first (and only) variable in the system.
FEType fe_type = dof_map.variable_type(0);
Build a Finite Element object of the specified type. Since the
\p FEBase::build() member dynamically creates memory we will
store the object as an \p AutoPtr. This can be thought
of as a pointer that will clean up after itself.
AutoPtr<FEBase> fe (FEBase::build(dim, fe_type));
A 5th order Gauss quadrature rule for numerical integration.
QGauss qrule (dim, FIFTH);
Tell the finite element object to use our quadrature rule.
fe->attach_quadrature_rule (&qrule);
Here we define some references to cell-specific data that
will be used to assemble the linear system.
We begin with the element Jacobian * quadrature weight at each
integration point.
const std::vector<Real>& JxW = fe->get_JxW();
The element shape functions evaluated at the quadrature points.
const std::vector<std::vector<Real> >& phi = fe->get_phi();
The element shape function gradients evaluated at the quadrature
points.
const std::vector<std::vector<RealGradient> >& dphi = fe->get_dphi();
Define data structures to contain the Jacobian element matrix.
Following basic finite element terminology we will denote these
"Ke". More detail is in example 3.
DenseMatrix<Number> Ke;
This vector will hold the degree of freedom indices for
the element. These define where in the global system
the element degrees of freedom get mapped.
std::vector<dof_id_type> dof_indices;
Now we will loop over all the active elements in the mesh which
are local to this processor.
We will compute the element Jacobian contribution.
MeshBase::const_element_iterator el = mesh.active_local_elements_begin();
const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end();
for ( ; el != end_el; ++el)
{
Store a pointer to the element we are currently
working on. This allows for nicer syntax later.
const Elem* elem = *el;
Get the degree of freedom indices for the
current element. These define where in the global
matrix and right-hand-side this element will
contribute to.
dof_map.dof_indices (elem, dof_indices);
Compute the element-specific data for the current
element. This involves computing the location of the
quadrature points (q_point) and the shape functions
(phi, dphi) for the current element.
fe->reinit (elem);
Zero the element Jacobian before
summing them. We use the resize member here because
the number of degrees of freedom might have changed from
the last element. Note that this will be the case if the
element type is different (i.e. the last element was a
triangle, now we are on a quadrilateral).
Ke.resize (dof_indices.size(),
dof_indices.size());
Now we will build the element Jacobian. This involves
a double loop to integrate the test funcions (i) against
the trial functions (j). Note that the Jacobian depends
on the current solution x, which we access using the soln
vector.
for (unsigned int qp=0; qp<qrule.n_points(); qp++)
{
Gradient grad_u;
for (unsigned int i=0; i<phi.size(); i++)
grad_u += dphi[i][qp]*soln(dof_indices[i]);
const Number K = 1./std::sqrt(1. + grad_u*grad_u);
for (unsigned int i=0; i<phi.size(); i++)
for (unsigned int j=0; j<phi.size(); j++)
Ke(i,j) += JxW[qp]*(
K*(dphi[i][qp]*dphi[j][qp]) +
kappa*phi[i][qp]*phi[j][qp]
);
}
dof_map.constrain_element_matrix (Ke, dof_indices);
Add the element matrix to the system Jacobian.
jacobian.add_matrix (Ke, dof_indices);
}
That's it.
}
Here we compute the residual R(x) = K(x)*x - f. The current solution
x is passed in the soln vector
void compute_residual (const NumericVector<Number>& soln,
NumericVector<Number>& residual,
NonlinearImplicitSystem& /*sys*/)
{
EquationSystems &es = *_equation_system;
Get a constant reference to the mesh object.
const MeshBase& mesh = es.get_mesh();
The dimension that we are running
const unsigned int dim = mesh.mesh_dimension();
libmesh_assert_equal_to (dim, 2);
Get a reference to the NonlinearImplicitSystem we are solving
NonlinearImplicitSystem& system =
es.get_system<NonlinearImplicitSystem>("Laplace-Young");
A reference to the \p DofMap object for this system. The \p DofMap
object handles the index translation from node and element numbers
to degree of freedom numbers. We will talk more about the \p DofMap
in future examples.
const DofMap& dof_map = system.get_dof_map();
Get a constant reference to the Finite Element type
for the first (and only) variable in the system.
FEType fe_type = dof_map.variable_type(0);
Build a Finite Element object of the specified type. Since the
\p FEBase::build() member dynamically creates memory we will
store the object as an \p AutoPtr. This can be thought
of as a pointer that will clean up after itself.
AutoPtr<FEBase> fe (FEBase::build(dim, fe_type));
A 5th order Gauss quadrature rule for numerical integration.
QGauss qrule (dim, FIFTH);
Tell the finite element object to use our quadrature rule.
fe->attach_quadrature_rule (&qrule);
Declare a special finite element object for
boundary integration.
AutoPtr<FEBase> fe_face (FEBase::build(dim, fe_type));
Boundary integration requires one quadraure rule,
with dimensionality one less than the dimensionality
of the element.
QGauss qface(dim-1, FIFTH);
Tell the finte element object to use our
quadrature rule.
fe_face->attach_quadrature_rule (&qface);
Here we define some references to cell-specific data that
will be used to assemble the linear system.
We begin with the element Jacobian * quadrature weight at each
integration point.
const std::vector<Real>& JxW = fe->get_JxW();
The element shape functions evaluated at the quadrature points.
const std::vector<std::vector<Real> >& phi = fe->get_phi();
The element shape function gradients evaluated at the quadrature
points.
const std::vector<std::vector<RealGradient> >& dphi = fe->get_dphi();
Define data structures to contain the resdual contributions
DenseVector<Number> Re;
This vector will hold the degree of freedom indices for
the element. These define where in the global system
the element degrees of freedom get mapped.
std::vector<dof_id_type> dof_indices;
Now we will loop over all the active elements in the mesh which
are local to this processor.
We will compute the element residual.
residual.zero();
MeshBase::const_element_iterator el = mesh.active_local_elements_begin();
const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end();
for ( ; el != end_el; ++el)
{
Store a pointer to the element we are currently
working on. This allows for nicer syntax later.
const Elem* elem = *el;
Get the degree of freedom indices for the
current element. These define where in the global
matrix and right-hand-side this element will
contribute to.
dof_map.dof_indices (elem, dof_indices);
Compute the element-specific data for the current
element. This involves computing the location of the
quadrature points (q_point) and the shape functions
(phi, dphi) for the current element.
fe->reinit (elem);
We use the resize member here because
the number of degrees of freedom might have changed from
the last element. Note that this will be the case if the
element type is different (i.e. the last element was a
triangle, now we are on a quadrilateral).
Re.resize (dof_indices.size());
Now we will build the residual. This involves
the construction of the matrix K and multiplication of it
with the current solution x. We rearrange this into two loops:
In the first, we calculate only the contribution of
K_ij*x_j which is independent of the row i. In the second loops,
we multiply with the row-dependent part and add it to the element
residual.
for (unsigned int qp=0; qp<qrule.n_points(); qp++)
{
Number u = 0;
Gradient grad_u;
for (unsigned int j=0; j<phi.size(); j++)
{
u += phi[j][qp]*soln(dof_indices[j]);
grad_u += dphi[j][qp]*soln(dof_indices[j]);
}
const Number K = 1./std::sqrt(1. + grad_u*grad_u);
for (unsigned int i=0; i<phi.size(); i++)
Re(i) += JxW[qp]*(
K*(dphi[i][qp]*grad_u) +
kappa*phi[i][qp]*u
);
}
At this point the interior element integration has
been completed. However, we have not yet addressed
boundary conditions.
The following loops over the sides of the element. If the element has no neighbor on a side then that side MUST live on a boundary of the domain.
The following loops over the sides of the element. If the element has no neighbor on a side then that side MUST live on a boundary of the domain.
for (unsigned int side=0; side<elem->n_sides(); side++)
if (elem->neighbor(side) == NULL)
{
The value of the shape functions at the quadrature
points.
const std::vector<std::vector<Real> >& phi_face = fe_face->get_phi();
The Jacobian * Quadrature Weight at the quadrature
points on the face.
const std::vector<Real>& JxW_face = fe_face->get_JxW();
Compute the shape function values on the element face.
fe_face->reinit(elem, side);
Loop over the face quadrature points for integration.
for (unsigned int qp=0; qp<qface.n_points(); qp++)
{
This is the right-hand-side contribution (f),
which has to be subtracted from the current residual
for (unsigned int i=0; i<phi_face.size(); i++)
Re(i) -= JxW_face[qp]*sigma*phi_face[i][qp];
}
}
dof_map.constrain_element_vector (Re, dof_indices);
residual.add_vector (Re, dof_indices);
}
That's it.
}
Begin the main program.
int main (int argc, char** argv)
{
Initialize libMesh and any dependent libaries, like in example 2.
LibMeshInit init (argc, argv);
#if !defined(LIBMESH_HAVE_PETSC) && !defined(LIBMESH_HAVE_TRILINOS)
if (libMesh::processor_id() == 0)
std::cerr << "ERROR: This example requires libMesh to be\n"
<< "compiled with nonlinear solver support from\n"
<< "PETSc or Trilinos!"
<< std::endl;
return 0;
#endif
#ifndef LIBMESH_ENABLE_AMR
if (libMesh::processor_id() == 0)
std::cerr << "ERROR: This example requires libMesh to be\n"
<< "compiled with AMR support!"
<< std::endl;
return 0;
#else
Create a GetPot object to parse the command line
GetPot command_line (argc, argv);
Check for proper calling arguments.
if (argc < 3)
{
if (libMesh::processor_id() == 0)
std::cerr << "Usage:\n"
<<"\t " << argv[0] << " -r 2"
<< std::endl;
This handy function will print the file name, line number,
and then abort.
libmesh_error();
}
Brief message to the user regarding the program name
and command line arguments.
else
{
std::cout << "Running " << argv[0];
for (int i=1; i<argc; i++)
std::cout << " " << argv[i];
std::cout << std::endl << std::endl;
}
Read number of refinements
int nr = 2;
if ( command_line.search(1, "-r") )
nr = command_line.next(nr);
Read FE order from command line
std::string order = "FIRST";
if ( command_line.search(2, "-Order", "-o") )
order = command_line.next(order);
Read FE Family from command line
std::string family = "LAGRANGE";
if ( command_line.search(2, "-FEFamily", "-f") )
family = command_line.next(family);
Cannot use dicontinuous basis.
if ((family == "MONOMIAL") || (family == "XYZ"))
{
std::cout << "ex19 currently requires a C^0 (or higher) FE basis." << std::endl;
libmesh_error();
}
if ( command_line.search(1, "-pre") )
{
#ifdef LIBMESH_HAVE_PETSC
Use the jacobian for preconditioning.
PetscOptionsSetValue("-snes_mf_operator",PETSC_NULL);
#else
std::cerr<<"Must be using PetsC to use jacobian based preconditioning"<<std::endl;
returning zero so that "make run" won't fail if we ever enable this capability there.
return 0;
#endif //LIBMESH_HAVE_PETSC
}
Skip this 2D example if libMesh was compiled as 1D-only.
libmesh_example_assert(2 <= LIBMESH_DIM, "2D support");
Create a mesh from file.
Mesh mesh;
mesh.read ("lshaped.xda");
if (order != "FIRST")
mesh.all_second_order();
MeshRefinement(mesh).uniformly_refine(nr);
Print information about the mesh to the screen.
mesh.print_info();
Create an equation systems object.
EquationSystems equation_systems (mesh);
_equation_system = &equation_systems;
Declare the system and its variables.
Creates a system named "Laplace-Young"
Creates a system named "Laplace-Young"
NonlinearImplicitSystem& system =
equation_systems.add_system<NonlinearImplicitSystem> ("Laplace-Young");
Here we specify the tolerance for the nonlinear solver and
the maximum of nonlinear iterations.
equation_systems.parameters.set<Real> ("nonlinear solver tolerance") = 1.e-12;
equation_systems.parameters.set<unsigned int> ("nonlinear solver maximum iterations") = 50;
Adds the variable "u" to "Laplace-Young". "u"
will be approximated using second-order approximation.
system.add_variable("u",
Utility::string_to_enum<Order> (order),
Utility::string_to_enum<FEFamily>(family));
Give the system a pointer to the functions that update
the residual and Jacobian.
system.nonlinear_solver->residual = compute_residual;
system.nonlinear_solver->jacobian = compute_jacobian;
Initialize the data structures for the equation system.
equation_systems.init();
Prints information about the system to the screen.
equation_systems.print_info();
Solve the system "Laplace-Young", print the number of iterations
and final residual
equation_systems.get_system("Laplace-Young").solve();
Print out final convergence information. This duplicates some
output from during the solve itself, but demonstrates another way
to get this information after the solve is complete.
std::cout << "Laplace-Young system solved at nonlinear iteration "
<< system.n_nonlinear_iterations()
<< " , final nonlinear residual norm: "
<< system.final_nonlinear_residual()
<< std::endl;
#ifdef LIBMESH_HAVE_EXODUS_API
After solving the system write the solution
ExodusII_IO (mesh).write_equation_systems ("out.e",
equation_systems);
#endif // #ifdef LIBMESH_HAVE_EXODUS_API
#endif // #ifndef LIBMESH_ENABLE_AMR
All done.
return 0;
}
The source file miscellaneous_ex3.C without comments:
#include <iostream>
#include <algorithm>
#include <cmath>
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/mesh_refinement.h"
#include "libmesh/exodusII_io.h"
#include "libmesh/equation_systems.h"
#include "libmesh/fe.h"
#include "libmesh/quadrature_gauss.h"
#include "libmesh/dof_map.h"
#include "libmesh/sparse_matrix.h"
#include "libmesh/numeric_vector.h"
#include "libmesh/dense_matrix.h"
#include "libmesh/dense_vector.h"
#include "libmesh/elem.h"
#include "libmesh/string_to_enum.h"
#include "libmesh/getpot.h"
#include "libmesh/nonlinear_solver.h"
#include "libmesh/nonlinear_implicit_system.h"
#ifdef LIBMESH_HAVE_PETSC
#include <petsc.h>
#endif
using namespace libMesh;
EquationSystems *_equation_system = NULL;
const Real kappa = 1.;
const Real sigma = 0.2;
void compute_jacobian (const NumericVector<Number>& soln,
SparseMatrix<Number>& jacobian,
NonlinearImplicitSystem& /*sys*/)
{
EquationSystems &es = *_equation_system;
const MeshBase& mesh = es.get_mesh();
const unsigned int dim = mesh.mesh_dimension();
NonlinearImplicitSystem& system =
es.get_system<NonlinearImplicitSystem>("Laplace-Young");
const DofMap& dof_map = system.get_dof_map();
FEType fe_type = dof_map.variable_type(0);
AutoPtr<FEBase> fe (FEBase::build(dim, fe_type));
QGauss qrule (dim, FIFTH);
fe->attach_quadrature_rule (&qrule);
const std::vector<Real>& JxW = fe->get_JxW();
const std::vector<std::vector<Real> >& phi = fe->get_phi();
const std::vector<std::vector<RealGradient> >& dphi = fe->get_dphi();
DenseMatrix<Number> Ke;
std::vector<dof_id_type> dof_indices;
MeshBase::const_element_iterator el = mesh.active_local_elements_begin();
const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end();
for ( ; el != end_el; ++el)
{
const Elem* elem = *el;
dof_map.dof_indices (elem, dof_indices);
fe->reinit (elem);
Ke.resize (dof_indices.size(),
dof_indices.size());
for (unsigned int qp=0; qp<qrule.n_points(); qp++)
{
Gradient grad_u;
for (unsigned int i=0; i<phi.size(); i++)
grad_u += dphi[i][qp]*soln(dof_indices[i]);
const Number K = 1./std::sqrt(1. + grad_u*grad_u);
for (unsigned int i=0; i<phi.size(); i++)
for (unsigned int j=0; j<phi.size(); j++)
Ke(i,j) += JxW[qp]*(
K*(dphi[i][qp]*dphi[j][qp]) +
kappa*phi[i][qp]*phi[j][qp]
);
}
dof_map.constrain_element_matrix (Ke, dof_indices);
jacobian.add_matrix (Ke, dof_indices);
}
}
void compute_residual (const NumericVector<Number>& soln,
NumericVector<Number>& residual,
NonlinearImplicitSystem& /*sys*/)
{
EquationSystems &es = *_equation_system;
const MeshBase& mesh = es.get_mesh();
const unsigned int dim = mesh.mesh_dimension();
libmesh_assert_equal_to (dim, 2);
NonlinearImplicitSystem& system =
es.get_system<NonlinearImplicitSystem>("Laplace-Young");
const DofMap& dof_map = system.get_dof_map();
FEType fe_type = dof_map.variable_type(0);
AutoPtr<FEBase> fe (FEBase::build(dim, fe_type));
QGauss qrule (dim, FIFTH);
fe->attach_quadrature_rule (&qrule);
AutoPtr<FEBase> fe_face (FEBase::build(dim, fe_type));
QGauss qface(dim-1, FIFTH);
fe_face->attach_quadrature_rule (&qface);
const std::vector<Real>& JxW = fe->get_JxW();
const std::vector<std::vector<Real> >& phi = fe->get_phi();
const std::vector<std::vector<RealGradient> >& dphi = fe->get_dphi();
DenseVector<Number> Re;
std::vector<dof_id_type> dof_indices;
residual.zero();
MeshBase::const_element_iterator el = mesh.active_local_elements_begin();
const MeshBase::const_element_iterator end_el = mesh.active_local_elements_end();
for ( ; el != end_el; ++el)
{
const Elem* elem = *el;
dof_map.dof_indices (elem, dof_indices);
fe->reinit (elem);
Re.resize (dof_indices.size());
for (unsigned int qp=0; qp<qrule.n_points(); qp++)
{
Number u = 0;
Gradient grad_u;
for (unsigned int j=0; j<phi.size(); j++)
{
u += phi[j][qp]*soln(dof_indices[j]);
grad_u += dphi[j][qp]*soln(dof_indices[j]);
}
const Number K = 1./std::sqrt(1. + grad_u*grad_u);
for (unsigned int i=0; i<phi.size(); i++)
Re(i) += JxW[qp]*(
K*(dphi[i][qp]*grad_u) +
kappa*phi[i][qp]*u
);
}
for (unsigned int side=0; side<elem->n_sides(); side++)
if (elem->neighbor(side) == NULL)
{
const std::vector<std::vector<Real> >& phi_face = fe_face->get_phi();
const std::vector<Real>& JxW_face = fe_face->get_JxW();
fe_face->reinit(elem, side);
for (unsigned int qp=0; qp<qface.n_points(); qp++)
{
for (unsigned int i=0; i<phi_face.size(); i++)
Re(i) -= JxW_face[qp]*sigma*phi_face[i][qp];
}
}
dof_map.constrain_element_vector (Re, dof_indices);
residual.add_vector (Re, dof_indices);
}
}
int main (int argc, char** argv)
{
LibMeshInit init (argc, argv);
#if !defined(LIBMESH_HAVE_PETSC) && !defined(LIBMESH_HAVE_TRILINOS)
if (libMesh::processor_id() == 0)
std::cerr << "ERROR: This example requires libMesh to be\n"
<< "compiled with nonlinear solver support from\n"
<< "PETSc or Trilinos!"
<< std::endl;
return 0;
#endif
#ifndef LIBMESH_ENABLE_AMR
if (libMesh::processor_id() == 0)
std::cerr << "ERROR: This example requires libMesh to be\n"
<< "compiled with AMR support!"
<< std::endl;
return 0;
#else
GetPot command_line (argc, argv);
if (argc < 3)
{
if (libMesh::processor_id() == 0)
std::cerr << "Usage:\n"
<<"\t " << argv[0] << " -r 2"
<< std::endl;
libmesh_error();
}
else
{
std::cout << "Running " << argv[0];
for (int i=1; i<argc; i++)
std::cout << " " << argv[i];
std::cout << std::endl << std::endl;
}
int nr = 2;
if ( command_line.search(1, "-r") )
nr = command_line.next(nr);
std::string order = "FIRST";
if ( command_line.search(2, "-Order", "-o") )
order = command_line.next(order);
std::string family = "LAGRANGE";
if ( command_line.search(2, "-FEFamily", "-f") )
family = command_line.next(family);
if ((family == "MONOMIAL") || (family == "XYZ"))
{
std::cout << "ex19 currently requires a C^0 (or higher) FE basis." << std::endl;
libmesh_error();
}
if ( command_line.search(1, "-pre") )
{
#ifdef LIBMESH_HAVE_PETSC
PetscOptionsSetValue("-snes_mf_operator",PETSC_NULL);
#else
std::cerr<<"Must be using PetsC to use jacobian based preconditioning"<<std::endl;
return 0;
#endif //LIBMESH_HAVE_PETSC
}
libmesh_example_assert(2 <= LIBMESH_DIM, "2D support");
Mesh mesh;
mesh.read ("lshaped.xda");
if (order != "FIRST")
mesh.all_second_order();
MeshRefinement(mesh).uniformly_refine(nr);
mesh.print_info();
EquationSystems equation_systems (mesh);
_equation_system = &equation_systems;
NonlinearImplicitSystem& system =
equation_systems.add_system<NonlinearImplicitSystem> ("Laplace-Young");
equation_systems.parameters.set<Real> ("nonlinear solver tolerance") = 1.e-12;
equation_systems.parameters.set<unsigned int> ("nonlinear solver maximum iterations") = 50;
system.add_variable("u",
Utility::string_to_enum<Order> (order),
Utility::string_to_enum<FEFamily>(family));
system.nonlinear_solver->residual = compute_residual;
system.nonlinear_solver->jacobian = compute_jacobian;
equation_systems.init();
equation_systems.print_info();
equation_systems.get_system("Laplace-Young").solve();
std::cout << "Laplace-Young system solved at nonlinear iteration "
<< system.n_nonlinear_iterations()
<< " , final nonlinear residual norm: "
<< system.final_nonlinear_residual()
<< std::endl;
#ifdef LIBMESH_HAVE_EXODUS_API
ExodusII_IO (mesh).write_equation_systems ("out.e",
equation_systems);
#endif // #ifdef LIBMESH_HAVE_EXODUS_API
#endif // #ifndef LIBMESH_ENABLE_AMR
return 0;
}
The console output of the program:
***************************************************************
* Running Example miscellaneous_ex3:
* mpirun -np 2 example-devel -r 3 -o FIRST -pc_type bjacobi -sub_pc_type ilu -sub_pc_factor_levels 4 -sub_pc_factor_zeropivot 0 -ksp_right_pc -log_summary
***************************************************************
Running /workspace/libmesh/examples/miscellaneous/miscellaneous_ex3/.libs/lt-example-devel -r 3 -o FIRST -pc_type bjacobi -sub_pc_type ilu -sub_pc_factor_levels 4 -sub_pc_factor_zeropivot 0 -ksp_right_pc -log_summary
Mesh Information:
mesh_dimension()=2
spatial_dimension()=3
n_nodes()=225
n_local_nodes()=121
n_elem()=255
n_local_elem()=131
n_active_elem()=192
n_subdomains()=1
n_partitions()=2
n_processors()=2
n_threads()=1
processor_id()=0
EquationSystems
n_systems()=1
System #0, "Laplace-Young"
Type "NonlinearImplicit"
Variables="u"
Finite Element Types="LAGRANGE", "JACOBI_20_00"
Infinite Element Mapping="CARTESIAN"
Approximation Orders="FIRST", "THIRD"
n_dofs()=225
n_local_dofs()=121
n_constrained_dofs()=0
n_local_constrained_dofs()=0
n_vectors()=1
n_matrices()=1
DofMap Sparsity
Average On-Processor Bandwidth <= 7.96889
Average Off-Processor Bandwidth <= 0.32
Maximum On-Processor Bandwidth <= 11
Maximum Off-Processor Bandwidth <= 5
DofMap Constraints
Number of DoF Constraints = 0
Number of Node Constraints = 0
NL step 0, |residual|_2 = 2.000000e-01
NL step 1, |residual|_2 = 4.434989e-03
NL step 2, |residual|_2 = 2.164208e-04
NL step 3, |residual|_2 = 1.157882e-05
NL step 4, |residual|_2 = 6.568494e-07
NL step 5, |residual|_2 = 3.850057e-08
NL step 6, |residual|_2 = 2.293925e-09
Laplace-Young system solved at nonlinear iteration 6 , final nonlinear residual norm: 2.293925e-09
************************************************************************************************************************
*** WIDEN YOUR WINDOW TO 120 CHARACTERS. Use 'enscript -r -fCourier9' to print this document ***
************************************************************************************************************************
---------------------------------------------- PETSc Performance Summary: ----------------------------------------------
/workspace/libmesh/examples/miscellaneous/miscellaneous_ex3/.libs/lt-example-devel on a intel-12. named hbar.ices.utexas.edu with 2 processors, by benkirk Tue Feb 5 13:41:15 2013
Using Petsc Release Version 3.3.0, Patch 2, Fri Jul 13 15:42:00 CDT 2012
Max Max/Min Avg Total
Time (sec): 1.580e-01 1.00000 1.580e-01
Objects: 6.700e+01 1.00000 6.700e+01
Flops: 8.933e+05 1.07036 8.640e+05 1.728e+06
Flops/sec: 5.655e+06 1.07036 5.469e+06 1.094e+07
MPI Messages: 1.140e+02 1.00000 1.140e+02 2.280e+02
MPI Message Lengths: 1.767e+04 1.00000 1.550e+02 3.534e+04
MPI Reductions: 3.970e+02 1.00000
Flop counting convention: 1 flop = 1 real number operation of type (multiply/divide/add/subtract)
e.g., VecAXPY() for real vectors of length N --> 2N flops
and VecAXPY() for complex vectors of length N --> 8N flops
Summary of Stages: ----- Time ------ ----- Flops ----- --- Messages --- -- Message Lengths -- -- Reductions --
Avg %Total Avg %Total counts %Total Avg %Total counts %Total
0: Main Stage: 1.5794e-01 100.0% 1.7279e+06 100.0% 2.280e+02 100.0% 1.550e+02 100.0% 3.960e+02 99.7%
------------------------------------------------------------------------------------------------------------------------
See the 'Profiling' chapter of the users' manual for details on interpreting output.
Phase summary info:
Count: number of times phase was executed
Time and Flops: Max - maximum over all processors
Ratio - ratio of maximum to minimum over all processors
Mess: number of messages sent
Avg. len: average message length
Reduct: number of global reductions
Global: entire computation
Stage: stages of a computation. Set stages with PetscLogStagePush() and PetscLogStagePop().
%T - percent time in this phase %f - percent flops in this phase
%M - percent messages in this phase %L - percent message lengths in this phase
%R - percent reductions in this phase
Total Mflop/s: 10e-6 * (sum of flops over all processors)/(max time over all processors)
------------------------------------------------------------------------------------------------------------------------
Event Count Time (sec) Flops --- Global --- --- Stage --- Total
Max Ratio Max Ratio Max Ratio Mess Avg len Reduct %T %f %M %L %R %T %f %M %L %R Mflop/s
------------------------------------------------------------------------------------------------------------------------
--- Event Stage 0: Main Stage
VecDot 6 1.0 1.4782e-05 1.1 1.45e+03 1.2 0.0e+00 0.0e+00 6.0e+00 0 0 0 0 2 0 0 0 0 2 182
VecMDot 74 1.0 2.2244e-04 1.2 1.19e+05 1.2 0.0e+00 0.0e+00 7.4e+01 0 13 0 0 19 0 13 0 0 19 995
VecNorm 92 1.0 1.7476e-04 1.0 2.23e+04 1.2 0.0e+00 0.0e+00 9.2e+01 0 2 0 0 23 0 2 0 0 23 237
VecScale 80 1.0 3.4332e-05 1.2 9.68e+03 1.2 0.0e+00 0.0e+00 0.0e+00 0 1 0 0 0 0 1 0 0 0 524
VecCopy 32 1.0 1.3828e-05 1.6 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0
VecSet 110 1.0 3.7909e-05 1.6 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0
VecAXPY 6 1.0 1.4782e-05 1.1 1.45e+03 1.2 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 183
VecWAXPY 6 1.0 7.8678e-06 1.1 7.26e+02 1.2 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 172
VecMAXPY 80 1.0 5.1022e-05 1.2 1.37e+05 1.2 0.0e+00 0.0e+00 0.0e+00 0 15 0 0 0 0 15 0 0 0 5010
VecAssemblyBegin 54 1.0 3.2625e-03 8.3 0.00e+00 0.0 1.4e+01 1.6e+02 1.6e+02 1 0 6 6 41 1 0 6 6 41 0
VecAssemblyEnd 54 1.0 4.7684e-05 1.2 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0
VecScatterBegin 94 1.0 1.1349e-04 1.0 0.00e+00 0.0 1.9e+02 1.2e+02 0.0e+00 0 0 82 65 0 0 0 82 65 0 0
VecScatterEnd 94 1.0 7.8440e-05 1.1 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0
VecReduceArith 13 1.0 6.1338e-03 1.0 3.13e+03 1.2 0.0e+00 0.0e+00 0.0e+00 4 0 0 0 0 4 0 0 0 0 1
VecReduceComm 7 1.0 2.4796e-05 1.2 0.00e+00 0.0 0.0e+00 0.0e+00 7.0e+00 0 0 0 0 2 0 0 0 0 2 0
VecNormalize 80 1.0 2.2602e-04 1.0 2.90e+04 1.2 0.0e+00 0.0e+00 8.0e+01 0 3 0 0 20 0 3 0 0 20 239
MatMult 80 1.0 2.6631e-04 1.0 1.47e+05 1.2 1.6e+02 1.1e+02 0.0e+00 0 16 70 51 0 0 16 70 51 0 1029
MatSolve 80 1.0 1.8740e-04 1.1 3.32e+05 1.0 0.0e+00 0.0e+00 0.0e+00 0 38 0 0 0 0 38 0 0 0 3492
MatLUFactorNum 6 1.0 2.1243e-04 1.0 1.31e+05 1.1 0.0e+00 0.0e+00 0.0e+00 0 15 0 0 0 0 15 0 0 0 1180
MatILUFactorSym 1 1.0 1.5283e-04 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 3.0e+00 0 0 0 0 1 0 0 0 0 1 0
MatAssemblyBegin 12 1.0 3.3617e-04 1.1 0.00e+00 0.0 1.8e+01 5.6e+02 2.4e+01 0 0 8 28 6 0 0 8 28 6 0
MatAssemblyEnd 12 1.0 3.4595e-04 1.2 0.00e+00 0.0 4.0e+00 3.0e+01 8.0e+00 0 0 2 0 2 0 0 2 0 2 0
MatGetRowIJ 1 1.0 1.9073e-06 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0
MatGetOrdering 1 1.0 4.4107e-05 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 2.0e+00 0 0 0 0 1 0 0 0 0 1 0
MatZeroEntries 8 1.0 1.1683e-05 1.5 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0
SNESSolve 1 1.0 1.0932e-01 1.0 8.93e+05 1.1 2.2e+02 1.6e+02 3.8e+02 69100 97 98 95 69100 97 98 95 16
SNESFunctionEval 7 1.0 5.9907e-02 1.0 0.00e+00 0.0 2.8e+01 1.7e+02 1.0e+02 38 0 12 13 26 38 0 12 13 27 0
SNESJacobianEval 6 1.0 4.0239e-02 1.0 0.00e+00 0.0 3.4e+01 3.6e+02 8.6e+01 25 0 15 35 22 25 0 15 35 22 0
SNESLineSearch 6 1.0 5.1048e-02 1.0 1.90e+04 1.2 3.6e+01 1.5e+02 1.1e+02 32 2 16 15 29 32 2 16 15 29 1
KSPGMRESOrthog 74 1.0 3.1686e-04 1.1 2.39e+05 1.2 0.0e+00 0.0e+00 7.4e+01 0 26 0 0 19 0 26 0 0 19 1400
KSPSetUp 12 1.0 5.6505e-05 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0
KSPSolve 6 1.0 2.4970e-03 1.0 8.74e+05 1.1 1.5e+02 1.1e+02 1.6e+02 2 98 65 47 41 2 98 65 47 41 678
PCSetUp 12 1.0 7.5936e-04 1.0 1.31e+05 1.1 0.0e+00 0.0e+00 7.0e+00 0 15 0 0 2 0 15 0 0 2 330
PCSetUpOnBlocks 6 1.0 5.2571e-04 1.0 1.31e+05 1.1 0.0e+00 0.0e+00 5.0e+00 0 15 0 0 1 0 15 0 0 1 477
PCApply 80 1.0 6.0582e-04 1.1 3.32e+05 1.0 0.0e+00 0.0e+00 0.0e+00 0 38 0 0 0 0 38 0 0 0 1080
------------------------------------------------------------------------------------------------------------------------
Memory usage is given in bytes:
Object Type Creations Destructions Memory Descendants' Mem.
Reports information only for process 0.
--- Event Stage 0: Main Stage
Container 2 2 1096 0
Vector 38 38 88760 0
Vector Scatter 2 2 2072 0
Index Set 7 7 5788 0
IS L to G Mapping 1 1 564 0
Matrix 4 4 51908 0
SNES 1 1 1268 0
SNESLineSearch 1 1 840 0
Distributed Mesh 2 2 8552 0
Bipartite Graph 4 4 2736 0
Krylov Solver 2 2 19360 0
Preconditioner 2 2 1784 0
Viewer 1 0 0 0
========================================================================================================================
Average time to get PetscTime(): 0
Average time for MPI_Barrier(): 2.38419e-06
Average time for zero size MPI_Send(): 1.50204e-05
#PETSc Option Table entries:
-ksp_right_pc
-log_summary
-o FIRST
-pc_type bjacobi
-r 3
-sub_pc_factor_levels 4
-sub_pc_factor_zeropivot 0
-sub_pc_type ilu
#End of PETSc Option Table entries
Compiled without FORTRAN kernels
Compiled with full precision matrices (default)
sizeof(short) 2 sizeof(int) 4 sizeof(long) 8 sizeof(void*) 8 sizeof(PetscScalar) 8 sizeof(PetscInt) 4
Configure run at: Thu Nov 8 11:21:02 2012
Configure options: --with-debugging=false --COPTFLAGS=-O3 --CXXOPTFLAGS=-O3 --FOPTFLAGS=-O3 --with-clanguage=C++ --with-shared-libraries=1 --with-mpi-dir=/opt/apps/ossw/libraries/mpich2/mpich2-1.4.1p1/sl6/intel-12.1 --with-mumps=true --download-mumps=1 --with-metis=true --download-metis=1 --with-parmetis=true --download-parmetis=1 --with-superlu=true --download-superlu=1 --with-superludir=true --download-superlu_dist=1 --with-blacs=true --download-blacs=1 --with-scalapack=true --download-scalapack=1 --with-hypre=true --download-hypre=1 --with-blas-lib="[/opt/apps/sysnet/intel/12.1/mkl/10.3.12.361/lib/intel64/libmkl_intel_lp64.so,/opt/apps/sysnet/intel/12.1/mkl/10.3.12.361/lib/intel64/libmkl_sequential.so,/opt/apps/sysnet/intel/12.1/mkl/10.3.12.361/lib/intel64/libmkl_core.so]" --with-lapack-lib="[/opt/apps/sysnet/intel/12.1/mkl/10.3.12.361/lib/intel64/libmkl_lapack95_lp64.a]"
-----------------------------------------
Libraries compiled on Thu Nov 8 11:21:02 2012 on daedalus.ices.utexas.edu
Machine characteristics: Linux-2.6.32-279.1.1.el6.x86_64-x86_64-with-redhat-6.3-Carbon
Using PETSc directory: /opt/apps/ossw/libraries/petsc/petsc-3.3-p2
Using PETSc arch: intel-12.1-mkl-intel-10.3.12.361-mpich2-1.4.1p1-cxx-opt
-----------------------------------------
Using C compiler: /opt/apps/ossw/libraries/mpich2/mpich2-1.4.1p1/sl6/intel-12.1/bin/mpicxx -wd1572 -O3 -fPIC ${COPTFLAGS} ${CFLAGS}
Using Fortran compiler: /opt/apps/ossw/libraries/mpich2/mpich2-1.4.1p1/sl6/intel-12.1/bin/mpif90 -fPIC -O3 ${FOPTFLAGS} ${FFLAGS}
-----------------------------------------
Using include paths: -I/opt/apps/ossw/libraries/petsc/petsc-3.3-p2/intel-12.1-mkl-intel-10.3.12.361-mpich2-1.4.1p1-cxx-opt/include -I/opt/apps/ossw/libraries/petsc/petsc-3.3-p2/include -I/opt/apps/ossw/libraries/petsc/petsc-3.3-p2/include -I/opt/apps/ossw/libraries/petsc/petsc-3.3-p2/intel-12.1-mkl-intel-10.3.12.361-mpich2-1.4.1p1-cxx-opt/include -I/opt/apps/ossw/libraries/mpich2/mpich2-1.4.1p1/sl6/intel-12.1/include
-----------------------------------------
Using C linker: /opt/apps/ossw/libraries/mpich2/mpich2-1.4.1p1/sl6/intel-12.1/bin/mpicxx
Using Fortran linker: /opt/apps/ossw/libraries/mpich2/mpich2-1.4.1p1/sl6/intel-12.1/bin/mpif90
Using libraries: -Wl,-rpath,/opt/apps/ossw/libraries/petsc/petsc-3.3-p2/intel-12.1-mkl-intel-10.3.12.361-mpich2-1.4.1p1-cxx-opt/lib -L/opt/apps/ossw/libraries/petsc/petsc-3.3-p2/intel-12.1-mkl-intel-10.3.12.361-mpich2-1.4.1p1-cxx-opt/lib -lpetsc -lX11 -Wl,-rpath,/opt/apps/ossw/libraries/petsc/petsc-3.3-p2/intel-12.1-mkl-intel-10.3.12.361-mpich2-1.4.1p1-cxx-opt/lib -L/opt/apps/ossw/libraries/petsc/petsc-3.3-p2/intel-12.1-mkl-intel-10.3.12.361-mpich2-1.4.1p1-cxx-opt/lib -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord -lHYPRE -lpthread -lsuperlu_dist_3.0 -lparmetis -lmetis -lscalapack -lblacs -lsuperlu_4.3 -Wl,-rpath,/opt/apps/sysnet/intel/12.1/mkl/10.3.12.361/lib/intel64 -L/opt/apps/sysnet/intel/12.1/mkl/10.3.12.361/lib/intel64 -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -Wl,-rpath,/opt/apps/ossw/libraries/mpich2/mpich2-1.4.1p1/sl6/intel-12.1/lib -L/opt/apps/ossw/libraries/mpich2/mpich2-1.4.1p1/sl6/intel-12.1/lib -Wl,-rpath,/opt/apps/sysnet/intel/12.1/composer_xe_2011_sp1.7.256/compiler/lib/intel64 -L/opt/apps/sysnet/intel/12.1/composer_xe_2011_sp1.7.256/compiler/lib/intel64 -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.4.6 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.6 -lmpichf90 -lifport -lifcore -lm -lm -lmpichcxx -ldl -lmpich -lopa -lmpl -lrt -lpthread -limf -lsvml -lipgo -ldecimal -lcilkrts -lstdc++ -lgcc_s -lirc -lirc_s -ldl
-----------------------------------------
----------------------------------------------------------------------------------------------------------------------
| Processor id: 0 |
| Num Processors: 2 |
| Time: Tue Feb 5 13:41:15 2013 |
| OS: Linux |
| HostName: hbar.ices.utexas.edu |
| OS Release: 2.6.32-279.1.1.el6.x86_64 |
| OS Version: #1 SMP Tue Jul 10 11:24:23 CDT 2012 |
| Machine: x86_64 |
| Username: benkirk |
| Configuration: ./configure '--enable-everything' |
| '--prefix=/workspace/libmesh/install' |
| 'CXX=mpicxx' |
| 'CC=mpicc' |
| 'F77=mpif77' |
| 'FC=mpif90' |
| 'PETSC_DIR=/opt/apps/ossw/libraries/petsc/petsc-3.3-p2' |
| 'PETSC_ARCH=intel-12.1-mkl-intel-10.3.12.361-mpich2-1.4.1p1-cxx-opt' |
| 'SLEPC_DIR=/opt/apps/ossw/libraries/slepc/slepc-3.3-p2-petsc-3.3-p2-cxx-opt' |
| 'TRILINOS_DIR=/opt/apps/ossw/libraries/trilinos/trilinos-10.12.2/sl6/intel-12.1/mpich2-1.4.1p1/mkl-intel-10.3.12.361'|
| 'VTK_DIR=/opt/apps/ossw/libraries/vtk/vtk-5.10.0/sl6/intel-12.1' |
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
| libMesh Performance: Alive time=0.168662, Active time=0.148111 |
----------------------------------------------------------------------------------------------------------------
| 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() 1 0.0023 0.002251 0.0030 0.002961 1.52 2.00 |
| build_sparsity() 1 0.0018 0.001813 0.0049 0.004887 1.22 3.30 |
| create_dof_constraints() 1 0.0005 0.000459 0.0005 0.000459 0.31 0.31 |
| distribute_dofs() 1 0.0024 0.002353 0.0060 0.006038 1.59 4.08 |
| dof_indices() 1466 0.0406 0.000028 0.0406 0.000028 27.41 27.41 |
| prepare_send_list() 1 0.0000 0.000022 0.0000 0.000022 0.01 0.01 |
| reinit() 1 0.0035 0.003478 0.0035 0.003478 2.35 2.35 |
| |
| EquationSystems |
| build_solution_vector() 1 0.0005 0.000496 0.0032 0.003236 0.33 2.18 |
| |
| ExodusII_IO |
| write_nodal_data() 1 0.0017 0.001687 0.0017 0.001687 1.14 1.14 |
| |
| FE |
| compute_shape_functions() 1493 0.0158 0.000011 0.0158 0.000011 10.67 10.67 |
| init_shape_functions() 258 0.0010 0.000004 0.0010 0.000004 0.70 0.70 |
| inverse_map() 735 0.0036 0.000005 0.0036 0.000005 2.41 2.41 |
| |
| FEMap |
| compute_affine_map() 1493 0.0100 0.000007 0.0100 0.000007 6.73 6.73 |
| compute_face_map() 245 0.0030 0.000012 0.0066 0.000027 2.00 4.47 |
| init_face_shape_functions() 7 0.0001 0.000008 0.0001 0.000008 0.04 0.04 |
| init_reference_to_physical_map() 258 0.0027 0.000010 0.0027 0.000010 1.83 1.83 |
| |
| LocationMap |
| find() 756 0.0018 0.000002 0.0018 0.000002 1.19 1.19 |
| init() 3 0.0001 0.000049 0.0001 0.000049 0.10 0.10 |
| |
| Mesh |
| find_neighbors() 2 0.0032 0.001609 0.0035 0.001771 2.17 2.39 |
| |
| MeshCommunication |
| broadcast() 1 0.0007 0.000694 0.0010 0.000973 0.47 0.66 |
| compute_hilbert_indices() 3 0.0009 0.000295 0.0009 0.000295 0.60 0.60 |
| find_global_indices() 3 0.0006 0.000200 0.0025 0.000839 0.41 1.70 |
| parallel_sort() 3 0.0006 0.000203 0.0007 0.000233 0.41 0.47 |
| |
| MeshOutput |
| write_equation_systems() 1 0.0001 0.000072 0.0050 0.005045 0.05 3.41 |
| |
| MeshRefinement |
| _refine_elements() 3 0.0028 0.000930 0.0067 0.002229 1.88 4.51 |
| add_point() 756 0.0018 0.000002 0.0037 0.000005 1.24 2.51 |
| |
| MetisPartitioner |
| partition() 2 0.0026 0.001276 0.0043 0.002138 1.72 2.89 |
| |
| Parallel |
| allgather() 11 0.0002 0.000019 0.0002 0.000021 0.14 0.15 |
| broadcast() 9 0.0002 0.000025 0.0002 0.000021 0.15 0.12 |
| max(bool) 4 0.0001 0.000023 0.0001 0.000023 0.06 0.06 |
| max(scalar) 261 0.0006 0.000002 0.0006 0.000002 0.43 0.43 |
| max(vector) 62 0.0004 0.000006 0.0008 0.000013 0.25 0.54 |
| min(bool) 312 0.0007 0.000002 0.0007 0.000002 0.47 0.47 |
| min(scalar) 253 0.0016 0.000006 0.0016 0.000006 1.05 1.05 |
| min(vector) 62 0.0004 0.000007 0.0009 0.000015 0.29 0.62 |
| probe() 16 0.0002 0.000010 0.0002 0.000010 0.11 0.11 |
| receive() 16 0.0001 0.000007 0.0003 0.000017 0.07 0.18 |
| send() 16 0.0001 0.000004 0.0001 0.000004 0.04 0.04 |
| send_receive() 22 0.0002 0.000009 0.0006 0.000026 0.13 0.38 |
| sum() 36 0.0002 0.000005 0.0003 0.000007 0.11 0.17 |
| |
| Parallel::Request |
| wait() 16 0.0000 0.000003 0.0000 0.000003 0.03 0.03 |
| |
| Partitioner |
| set_node_processor_ids() 2 0.0004 0.000213 0.0006 0.000291 0.29 0.39 |
| set_parent_processor_ids() 2 0.0003 0.000136 0.0003 0.000136 0.18 0.18 |
| |
| PetscNonlinearSolver |
| jacobian() 6 0.0122 0.002040 0.0401 0.006691 8.26 27.10 |
| residual() 7 0.0149 0.002132 0.0599 0.008550 10.08 40.41 |
| solve() 1 0.0108 0.010831 0.1108 0.110831 7.31 74.83 |
| |
| System |
| solve() 1 0.0000 0.000035 0.1109 0.110866 0.02 74.85 |
----------------------------------------------------------------------------------------------------------------
| Totals: 8611 0.1481 100.00 |
----------------------------------------------------------------------------------------------------------------
***************************************************************
* Done Running Example miscellaneous_ex3:
* mpirun -np 2 example-devel -r 3 -o FIRST -pc_type bjacobi -sub_pc_type ilu -sub_pc_factor_levels 4 -sub_pc_factor_zeropivot 0 -ksp_right_pc -log_summary
***************************************************************
Miscellaneous Example 3 - 2D Laplace-Young Problem Using Nonlinear Solvers
This example shows how to use the NonlinearImplicitSystem class to efficiently solve nonlinear problems in parallel.
In nonlinear systems, we aim at finding x that satisfy R(x) = 0. In nonlinear finite element analysis, the residual is typically of the form R(x) = K(x)*x - f, with K(x) the system matrix and f the "right-hand-side". The NonlinearImplicitSystem class expects two callback functions to compute the residual R and its Jacobian for the Newton iterations. Here, we just approximate the true Jacobian by K(x).
You can turn on preconditining of the matrix free system using the jacobian by passing "-pre" on the command line. Currently this only work with Petsc so this isn't used by using "make run"
This example also runs with the experimental Trilinos NOX solvers by specifying the --use-trilinos command line argument.
C++ include files that we need