FCT_Solver.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2020 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
* Development from 2019 by School of Earth and Environmental Sciences
**
*****************************************************************************/
#ifndef __PASO_FCTSOLVER_H__
#define __PASO_FCTSOLVER_H__
#include "Transport.h"
#include "FluxLimiter.h"
#include "Solver.h"
namespace paso {
PASO_DLL_API
struct FCT_Solver
{
FCT_Solver(const_TransportProblem_ptr tp, Options* options);
~FCT_Solver();
SolverResult update(double* u, double* u_old, Options* options, Performance* pp);
SolverResult updateNL(double* u, double* u_old, Options* options, Performance* pp);
SolverResult updateLCN(double* u, double* u_old, Options* options, Performance* pp);
void initialize(double dt, Options* options, Performance* pp);
static double getSafeTimeStepSize(const_TransportProblem_ptr tp);
static void setLowOrderOperator(TransportProblem_ptr tp);
void setAntiDiffusionFlux_linearCN(SystemMatrix_ptr flux_matrix);
void setAntiDiffusionFlux_BE(SystemMatrix_ptr flux_matrix);
void setAntiDiffusionFlux_CN(SystemMatrix_ptr flux_matrix);
void setMuPaLu(double* out, const_Coupler_ptr<real_t> coupler, double a);
inline double getTheta()
{
return method == PASO_BACKWARD_EULER ? 1. : 0.5;
}
const_TransportProblem_ptr transportproblem;
escript::JMPI mpi_info;
FCT_FluxLimiter* flux_limiter;
index_t method;
double omega;
double dt;
double* b;
double* z;
double* du;
Coupler_ptr<real_t> u_coupler;
Coupler_ptr<real_t> u_old_coupler; /* last time step */
};
} // namespace paso
#endif // __PASO_FCTSOLVER_H__
paso::EPSILON
static const real_t EPSILON
Definition: ReactiveSolver.cpp:55
paso::LARGE_POSITIVE_FLOAT
static const real_t LARGE_POSITIVE_FLOAT
Definition: FCT_Solver.cpp:44
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:79
paso::const_Coupler_ptr
boost::shared_ptr< const Coupler< T > > const_Coupler_ptr
Definition: Coupler.h:58
paso::FCT_Solver::omega
double omega
Definition: FCT_Solver.h:91
paso::FCT_Solver::setAntiDiffusionFlux_CN
void setAntiDiffusionFlux_CN(SystemMatrix_ptr flux_matrix)
Definition: FCT_Solver.cpp:386
paso::util::lsup
double lsup(dim_t n, const double *x, escript::JMPI mpiinfo)
returns the global Lsup of x
Definition: PasoUtil.cpp:495
paso::FCT_Solver::method
index_t method
Definition: FCT_Solver.h:90
paso::FCT_Solver::setAntiDiffusionFlux_BE
void setAntiDiffusionFlux_BE(SystemMatrix_ptr flux_matrix)
Definition: FCT_Solver.cpp:437
FluxLimiter.h
paso::Divergence
@ Divergence
Definition: Paso.h:78
paso::FCT_Solver::updateLCN
SolverResult updateLCN(double *u, double *u_old, Options *options, Performance *pp)
linear crank-nicolson update
Definition: FCT_Solver.cpp:144
paso::Performance_startMonitor
void Performance_startMonitor(Performance *pp, int monitor)
switches on a monitor
Definition: performance.cpp:178
paso::FCT_FluxLimiter::addLimitedFluxes_Complete
void addLimitedFluxes_Complete(double *b)
Definition: FluxLimiter.cpp:222
paso::FCT_Solver::dt
double dt
Definition: FCT_Solver.h:92
paso::SystemMatrix
this class holds a (distributed) stiffness matrix
Definition: SystemMatrix.h:62
paso::solve_free
void solve_free(SystemMatrix *in)
Definition: solve.cpp:143
paso::FCT_FluxLimiter::setU_tilde
void setU_tilde(const double *Mu_tilde)
Definition: FluxLimiter.cpp:77
paso::Coupler
Definition: Coupler.h:56
paso::FCT_FluxLimiter::u_tilde_coupler
Coupler_ptr< real_t > u_tilde_coupler
Definition: FluxLimiter.h:82
paso::SystemMatrix_ptr
boost::shared_ptr< SystemMatrix > SystemMatrix_ptr
Definition: SystemMatrix.h:55
paso::Options::tolerance
double tolerance
Definition: Options.h:113
paso::FCT_Solver::u_coupler
Coupler_ptr< real_t > u_coupler
Definition: FCT_Solver.h:96
paso::FCT_FluxLimiter
Definition: FluxLimiter.h:41
PASO_CRANK_NICOLSON
#define PASO_CRANK_NICOLSON
Definition: Options.h:71
paso::FCT_Solver::b
double * b
Definition: FCT_Solver.h:93
paso::FCT_Solver::mpi_info
escript::JMPI mpi_info
Definition: FCT_Solver.h:88
escript::DataTypes::real_t_max
real_t real_t_max()
Returns the maximum finite value for the real_t type.
Definition: DataTypes.h:117
paso::const_SystemMatrixPattern_ptr
boost::shared_ptr< const SystemMatrixPattern > const_SystemMatrixPattern_ptr
Definition: SystemMatrixPattern.h:56
PERFORMANCE_PRECONDITIONER_INIT
#define PERFORMANCE_PRECONDITIONER_INIT
Definition: performance.h:58
paso::InputError
@ InputError
Definition: Paso.h:74
paso::Options::verbose
bool verbose
Definition: Options.h:117
paso::FCT_FluxLimiter::mpi_info
escript::JMPI mpi_info
Definition: FluxLimiter.h:75
paso::FCT_Solver::updateNL
SolverResult updateNL(double *u, double *u_old, Options *options, Performance *pp)
Definition: FCT_Solver.cpp:212
paso::FCT_Solver::setLowOrderOperator
static void setLowOrderOperator(TransportProblem_ptr tp)
Definition: FCT_Solver.cpp:598
Solver.h
paso::util::copy
void copy(dim_t N, double *out, const double *in)
out = in
Definition: PasoUtil.h:116
paso::FCT_Solver::~FCT_Solver
~FCT_Solver()
Definition: FCT_Solver.cpp:75
paso::Solver_BiCGStab
SolverResult Solver_BiCGStab(SystemMatrix_ptr A, double *r, double *x, dim_t *iter, double *tolerance, Performance *pp)
Definition: BiCGStab.cpp:92
paso::FCT_Solver::du
double * du
Definition: FCT_Solver.h:95
paso::FCT_Solver::update
SolverResult update(double *u, double *u_old, Options *options, Performance *pp)
Definition: FCT_Solver.cpp:126
paso::Preconditioner_Smoother_solve
void Preconditioner_Smoother_solve(SystemMatrix_ptr A, Preconditioner_Smoother *gs, double *x, const double *b, dim_t sweeps, bool x_is_initial)
Definition: Smoother.cpp:115
paso::util::update
void update(dim_t n, double a, double *x, double b, const double *y)
Definition: PasoUtil.cpp:368
paso::TransportProblem_ptr
boost::shared_ptr< TransportProblem > TransportProblem_ptr
Definition: Transport.h:32
paso::util::l2
double l2(dim_t n, const double *x, escript::JMPI mpiinfo)
returns the global L2 norm of x
Definition: PasoUtil.cpp:530
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:72
paso::FCT_Solver::getTheta
double getTheta()
Definition: FCT_Solver.h:82
PASO_LINEAR_CRANK_NICOLSON
#define PASO_LINEAR_CRANK_NICOLSON
Definition: Options.h:70
paso::Coupler_ptr
boost::shared_ptr< Coupler< T > > Coupler_ptr
Definition: Coupler.h:57
paso::FCT_Solver::setMuPaLu
void setMuPaLu(double *out, const_Coupler_ptr< real_t > coupler, double a)
Definition: FCT_Solver.cpp:667
paso::FCT_Solver::setAntiDiffusionFlux_linearCN
void setAntiDiffusionFlux_linearCN(SystemMatrix_ptr flux_matrix)
Definition: FCT_Solver.cpp:493
paso::FCT_Solver::getSafeTimeStepSize
static double getSafeTimeStepSize(const_TransportProblem_ptr tp)
Definition: FCT_Solver.cpp:546
paso::FCT_Solver::u_old_coupler
Coupler_ptr< real_t > u_old_coupler
Definition: FCT_Solver.h:97
paso::FCT_FluxLimiter::u_tilde
double * u_tilde
Definition: FluxLimiter.h:77
paso::SolverResult
SolverResult
Definition: Paso.h:57
paso::Options::iter_max
dim_t iter_max
Definition: Options.h:120
paso::MaxIterReached
@ MaxIterReached
Definition: Paso.h:73
paso::FCT_FluxLimiter::antidiffusive_fluxes
SystemMatrix_ptr antidiffusive_fluxes
Definition: FluxLimiter.h:74
paso::Options::use_local_preconditioner
bool use_local_preconditioner
Definition: Options.h:129
paso::const_SystemMatrix_ptr
boost::shared_ptr< const SystemMatrix > const_SystemMatrix_ptr
Definition: SystemMatrix.h:57
PASO_GS
#define PASO_GS
Definition: Options.h:63
FCT_Solver.h
paso::const_TransportProblem_ptr
boost::shared_ptr< const TransportProblem > const_TransportProblem_ptr
Definition: Transport.h:34
Transport.h
paso::FCT_FluxLimiter::addLimitedFluxes_Start
void addLimitedFluxes_Start()
Definition: FluxLimiter.cpp:152
MPI_DOUBLE
#define MPI_DOUBLE
Definition: EsysMPI.h:47
MPI_MIN
#define MPI_MIN
Definition: EsysMPI.h:53
paso::Options::ode_solver
int ode_solver
Definition: Options.h:131
paso::Preconditioner
Definition: Preconditioner.h:50
paso::PasoException
PasoException exception class.
Definition: PasoException.h:47
paso::Options::preconditioner
int preconditioner
Definition: Options.h:119
paso::util::scale
void scale(dim_t N, double *x, double a)
x = a*x
Definition: PasoUtil.h:122
PASO_JACOBI
#define PASO_JACOBI
Definition: Options.h:47
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:88
paso::Performance_stopMonitor
void Performance_stopMonitor(Performance *pp, int monitor)
switches off a monitor
Definition: performance.cpp:197
paso::FCT_Solver::flux_limiter
FCT_FluxLimiter * flux_limiter
Definition: FCT_Solver.h:89
paso::Preconditioner_Smoother_solve_byTolerance
SolverResult Preconditioner_Smoother_solve_byTolerance(SystemMatrix_ptr A, Preconditioner_Smoother *gs, double *x, const double *b, double atol, dim_t *sweeps, bool x_is_initial)
Definition: Smoother.cpp:142
paso::Options::sweeps
int sweeps
Definition: Options.h:126
Preconditioner.h
PasoUtil.h
paso::util::zeroes
void zeroes(dim_t n, double *x)
fills array x with zeroes
Definition: PasoUtil.cpp:348
MIN3
#define MIN3(_arg1_, _arg2_, _arg3_)
Definition: FCT_Solver.cpp:40
PASO_DLL_API
#define PASO_DLL_API
Definition: Paso.h:60
paso::M
static dim_t M
Definition: SparseMatrix_saveHB.cpp:52
escript::DataTypes::real_t_eps
real_t real_t_eps()
Returns the machine epsilon for the real_t type.
Definition: DataTypes.h:126
paso::FCT_Solver::transportproblem
const_TransportProblem_ptr transportproblem
Definition: FCT_Solver.h:87
PASO_BACKWARD_EULER
#define PASO_BACKWARD_EULER
Definition: Options.h:72
paso::Options::absolute_tolerance
double absolute_tolerance
Definition: Options.h:114
paso
Definition: BiCGStab.cpp:26
paso::FCT_Solver::z
double * z
Definition: FCT_Solver.h:94
paso::NoError
@ NoError
Definition: Paso.h:72
paso::Options
Definition: Options.h:78
paso::FCT_Solver::initialize
void initialize(double dt, Options *options, Performance *pp)
Definition: FCT_Solver.cpp:84
paso::Performance
Definition: performance.h:69
paso::Options::num_iter
dim_t num_iter
Definition: Options.h:134
paso::FCT_Solver::FCT_Solver
FCT_Solver(const_TransportProblem_ptr tp, Options *options)
Definition: FCT_Solver.cpp:46