https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ExternalPetscSolverApp.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11#include "Moose.h"
12#include "AppFactory.h"
13#include "MooseSyntax.h"
14#include "PETScDiffusionFDM.h"
15#include "libmesh/petsc_vector.h"
17#include "Executioner.h"
18
19#include "libmesh/petsc_solver_exception.h"
20
23{
25
26 params.set<bool>("use_legacy_material_output") = false;
27 params.set<bool>("use_legacy_initial_residual_evaluation_behavior") = false;
28 return params;
29}
30
32 : MooseApp(parameters), _ts(nullptr), _is_petsc_app(false)
33{
35}
36
37TS &
39{
40 if (!_ts)
41 {
42 // Create an external PETSc solver
43 LibmeshPetscCall(PETScExternalSolverCreate(_comm->get(), &_ts));
44 _is_petsc_app = true;
45 }
46 return _ts;
47}
48
50{
51 // Destroy PETSc solver
53 libmesh_ignore(ierr);
54}
55
56void
58{
59 Registry::registerObjectsTo(f, {"ExternalPetscSolverApp"});
60 Registry::registerActionsTo(af, {"ExternalPetscSolverApp"});
61
62 /* register custom execute flags, action syntax, etc. here */
63}
64
65void
70
71/***************************************************************************************************
72 *********************** Dynamic Library Entry Points - DO NOT MODIFY ******************************
73 **************************************************************************************************/
74extern "C" void
79extern "C" void
Real f(Real x)
Test function for Brents method.
void ExternalPetscSolverApp__registerApps()
void ExternalPetscSolverApp__registerAll(Factory &f, ActionFactory &af, Syntax &s)
PETSC_EXTERN PetscErrorCode PETScExternalSolverDestroy(TS)
PETSC_EXTERN PetscErrorCode PETScExternalSolverCreate(MPI_Comm, TS *)
This is a demo used to demonstrate how to couple an external app through the MOOSE wrapper APP.
static InputParameters validParams()
ExternalPetscSolverApp(const InputParameters &parameters)
static void registerAll(Factory &f, ActionFactory &af, Syntax &s)
T & set(const std::string &name, bool quiet_mode=false)
const std::shared_ptr< libMesh::Parallel::Communicator > _comm
ActionFactory _action_factory
static InputParameters validParams()
Factory _factory
Syntax _syntax
static void registerActionsTo(ActionFactory &f, const std::set< std::string > &labels)
static void registerObjectsTo(Factory &f, const std::set< std::string > &labels)