|
From: Roy S. <roy...@od...> - 2020-12-09 16:51:05
|
On Wed, 9 Dec 2020, Laura Scarabosio wrote:
> Thank you for your explanations. I built libmesh by disabling mpi,
> so is the default solver still PETSc?
If you configured with PETSc (which can be configured with "mpiuni"
rather than a real MPI), it is. If you didn't, it isn't.
You can look for HAVE_PETSC in libmesh_config.h to check for sure, but
if you don't know whether you configured with a no-MPI PETSc build,
then you probably didn't.
> Also, for some reasons I am not able to pass command line arguments,
> they don't work.
No, they depend on PETSc.
> Therefore I tried to do the modifications that you suggested in the
> code itself, and assumed that the default solver was Eigen. I tried
> LinearImplicitSystem * ls = dynamic_cast<LinearImplicitSystem*>(& eq_sys.get_system("Diffusion"));
This cast isn't really useful unless you test the results - if you have a
LinearImplicitSystem then get_linear_solver() will give you what you want even
when called from the base class; if you don't then the dynamic_cast here will
just return nullptr.
> EigenSparseLinearSolver<double> * linearsolver = dynamic_cast< EigenSparseLinearSolver<double> *>(ls->get_linear_solver());
This cast shouldn't be necessary or helpful; set_solver_type() is a
method in the base class, not just the derived.
> linearsolver->set_solver_type(CG);
>
> and small variants, but I am not able to use the enum, CG gives me a
> compilation error.
The important thing is *which* compilation error, though, right? Did
you include enum_solver_type.h?
> >> something as specific as SuperLU_Dist you have to get at through the
> >> PETSc interface, either by extracting the internal PETSc object from
> >> one of our solver shims and using their APIs
> Can I still use PETSc since I have no mpi or should I use Eigen?
You can use either. I still like PETSc better even in serial but the
improvements for you might not be worth the hassle of downloading and
configuring it.
> Also, would you have an example to do what you said, since I cannot
> use the command line?
We have a few; see `grep set_solver_type examples/*/*/*`.
Look at miscellaneous_ex12.C, maybe?
---
Roy
|