Hi,
I could figure out how to give Identity Matrix instead of the mass matrix to solve the Standard Eigen value problem. However, on running, I am getting the folllowing error.
Timestep 1 @ 0.1s
_______________________________________________________________________________________
SOLVER STEP | LIN_IT LIN_RES RES_NORM RES_U NU_NORM NU_U
_______________________________________________________________________________________
0 CST ASM SLV CMakeFiles/run.dir/build.make:57: recipe for target 'CMakeFiles/run' failed
make[3]: *** [CMakeFiles/run] Segmentation fault (core dumped)
CMakeFiles/Makefile2:131: recipe for target 'CMakeFiles/run.dir/all' failed
make[2]: *** [CMakeFiles/run.dir/all] Error 2
CMakeFiles/Makefile2:138: recipe for target 'CMakeFiles/run.dir/rule' failed
make[1]: *** [CMakeFiles/run.dir/rule] Error 2
Makefile:144: recipe for target 'run' failed
make: *** [run] Error 2
I am copying here the solve_linear_system function and the part that I updated is blue in color. Also, I wish to calculate the eigenvalues after the newton method has converged. I am a bit confused of where actually to solve the standard eigenvalue problem in the code for my purpose. Could someone please help me with these questions?
------------------------------------------------
template <int dim,typename NumberType>
std::pair<unsigned int, double>
Solid<dim,NumberType>::solve_linear_system(BlockVector<double> &newton_update)
{
BlockVector<double> A(dofs_per_block);
BlockVector<double> B(dofs_per_block);
unsigned int lin_it = 0;
double lin_res = 0.0;
{
timer.enter_subsection("Linear solver");
std::cout << " SLV " << std::flush;
if (parameters.type_lin == "CG")
{
const int solver_its = static_cast<unsigned int>(
tangent_matrix.block(u_dof, u_dof).m()
* parameters.max_iterations_lin);
const double tol_sol = parameters.tol_lin
* system_rhs.block(u_dof).l2_norm();
SolverControl solver_control(solver_its, tol_sol);
GrowingVectorMemory<Vector<double> > GVM;
SolverCG<Vector<double> > solver_CG(solver_control, GVM);
PreconditionSelector<SparseMatrix<double>, Vector<double> >
preconditioner (parameters.preconditioner_type,
parameters.preconditioner_relaxation);
preconditioner.use_matrix(tangent_matrix.block(u_dof, u_dof));
solver_CG.solve(tangent_matrix.block(u_dof, u_dof),
newton_update.block(u_dof),
system_rhs.block(u_dof),
preconditioner);
lin_it = solver_control.last_step();
lin_res = solver_control.last_value();
}
else if (parameters.type_lin == "Direct")
{
SparseDirectUMFPACK A_direct;
A_direct.initialize(tangent_matrix.block(u_dof, u_dof));
A_direct.vmult(newton_update.block(u_dof), system_rhs.block(u_dof));
lin_it = 1;
lin_res = 0.0;
}
else
Assert (false, ExcMessage("Linear solver type not implemented"));
std::vector<std::complex<double>> eigenvalues;
std::vector<Vector<double> > eigenvectors;
SparseDirectUMFPACK inverse;
inverse.initialize (tangent_matrix.block(u_dof,u_dof));
SolverControl solver_control(1000, 1e-9);
ArpackSolver eigensolver(solver_control, ArpackSolver::AdditionalData(ArpackSolver::WhichEigenvalues::algebraically_smallest));
eigensolver.solve(tangent_matrix.block(u_dof,u_dof), IdentityMatrix(), inverse, eigenvalues, eigenvectors,eigenvalues.size()); timer.leave_subsection();
}
---------------------------------------------