Nektar++
Loading...
Searching...
No Matches
UnsteadyADR.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: UnsteadyADR.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Unsteady Advection Diffusion problem solve routines for new
32// operators
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#pragma once
37
39#include <SolverCore/EquationSystems/UnsteadySystem.h>
40#include <SolverCore/Forcing/Forcing.h>
41
42#include <map>
43
44namespace Nektar
45{
46template <typename TData> class LinearAdvVolumeFluxOp;
47
48namespace MultiRegions
49{
50template <typename TData> class AdvectionOp;
51template <typename TData> class BwdTransOp;
52template <typename TData> class IProductWRTBaseOp;
53template <typename TData> class MultiplyByElmtInvMassOp;
54} // namespace MultiRegions
55
56namespace SolverCore
57{
58template <typename TData> class AdvectionWeakDGOp;
59template <typename TData> class DiffusionIPOp;
60template <typename TData> class FwdTransOp;
61template <typename TData> class LinearSolverOp;
62template <typename TData> class LinearSystemOp;
63template <typename TData> class PreconOp;
64template <typename TData> class TraceFluxOp;
65} // namespace SolverCore
66
67using namespace SolverCore;
68using namespace MultiRegions;
69
71{
72public:
73 friend class MemoryManager<UnsteadyADR>;
74
75 /// Creates an instance of this class
79 {
82 equ->InitObject();
83 return equ;
84 }
85
86 /// Name of class
87 static std::string className0;
88 static std::string className1;
89 static std::string className2;
90
91protected:
92 // Diffusion coefficient
93 double m_epsilon;
94 std::vector<double> m_diffCoeff;
95 // Own the tensor for the lifetime of the operators which borrow it.
98 // Re-evaluate the tensor every implicit stage only when it uses t.
100
101 // Time stepping coefficient
102 double m_lambda;
103 bool m_advection = false;
104 bool m_diffusion = false;
109
110 // Setup workspaces
112 /// The advection velocity on the local trace, which the trace flux
113 /// operator reads through a pointer; kept here so that it outlives it.
115
116 // Initialise operators
117 std::shared_ptr<BwdTransOp<double>> m_bwdTransOp;
118 // CG only: projection of the solution to coefficients.
119 std::shared_ptr<FwdTransOp<double>> m_fwdTransOp;
120 // DG only: element-local projection of the solution to coefficients.
121 std::shared_ptr<IProductWRTBaseOp<double>> m_iProductWRTBaseOp;
122 std::shared_ptr<MultiplyByElmtInvMassOp<double>> m_multiplyByElmtInvMassOp;
123 std::shared_ptr<AdvectionOp<double>> m_advectionCGOp;
124 std::shared_ptr<AdvectionWeakDGOp<double>> m_advectionWeakDGOp;
125 std::shared_ptr<LinearAdvVolumeFluxOp<double>> m_volumeFluxOp;
126 std::shared_ptr<SolverCore::TraceFluxOp<double>> m_traceFluxOp;
127 std::shared_ptr<DiffusionIPOp<double>> m_diffusionIPOp;
128 std::shared_ptr<LinearSystemOp<double>> m_linearSystemOp;
129 std::shared_ptr<LinearSolverOp<double>> m_linearSolverOp;
130 std::map<double, std::shared_ptr<PreconOp<double>>> m_preconOp;
131 std::vector<ForcingSharedPtr> m_forcing;
132
135
136 ~UnsteadyADR() override = default;
137
140 const double &time);
141
144 const double &time, const double &lambda);
145
148 const double &time, const double &dt);
149
150 void v_InitObject(bool declareExpansionLists = true) override;
151
152 /// Offer the advection velocity to the Courant estimate.
153 CFLVelocity v_GetCFLVelocity() override;
154
155 void v_GenerateSummary(SummaryList &s) override;
156
158
159 void SetAdvectionVel();
160
161 void SetDiffusionCoeff();
162
163 void v_InitialiseOperators() override;
164
165 /// Project the solution to coefficients and return views of them.
166 CoefficientFieldViews v_GetOutputFieldViews() override;
167};
168
169} // namespace Nektar
A Field represents expansion data to be operated on.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
Whole-field interface of the advection element operator: writes scale * (V . grad u) at every quadrat...
Whole-field interface of the backward transform: evaluates a coefficient-space field at the quadratur...
Whole-field interface of the inner product with the basis: integrates a physical-space field against ...
Whole-field interface of the element-wise inverse mass operator: replaces every element's coefficient...
Base class for unsteady solvers.
void v_InitialiseOperators() override
void DoImplicit(LibUtilities::Field< double, FieldState::Phys > &inout, LibUtilities::Field< double, FieldState::Phys > &out, const double &time, const double &lambda)
std::vector< double > m_diffCoeff
Definition UnsteadyADR.h:94
LibUtilities::Field< double, FieldState::Phys > m_traceAdvVel
The advection velocity on the local trace, which the trace flux operator reads through a pointer; kep...
LibUtilities::Field< double, FieldState::Phys > m_advectionVel
std::shared_ptr< LinearSolverOp< double > > m_linearSolverOp
SessionFunctionSharedPtr m_varDiffCoeffFunction
Definition UnsteadyADR.h:97
std::shared_ptr< SolverCore::TraceFluxOp< double > > m_traceFluxOp
std::shared_ptr< DiffusionIPOp< double > > m_diffusionIPOp
std::shared_ptr< LinearSystemOp< double > > m_linearSystemOp
std::map< double, std::shared_ptr< PreconOp< double > > > m_preconOp
std::shared_ptr< AdvectionWeakDGOp< double > > m_advectionWeakDGOp
static EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
Definition UnsteadyADR.h:76
std::vector< ForcingSharedPtr > m_forcing
std::shared_ptr< AdvectionOp< double > > m_advectionCGOp
CFLVelocity v_GetCFLVelocity() override
Offer the advection velocity to the Courant estimate.
std::shared_ptr< MultiplyByElmtInvMassOp< double > > m_multiplyByElmtInvMassOp
static std::string className0
Name of class.
Definition UnsteadyADR.h:87
void SetDiffusionCoeff()
Set the diffusion Coeff. the diff. coeff., diffCoeff_{ij} := \epslion * D_{ij} where,...
void v_InitObject(bool declareExpansionLists=true) override
Initialisation object for the UnsteadyADR problem.
void v_GenerateSummary(SummaryList &s) override
Virtual function for generating summary information.
void DoExplicitRhs(LibUtilities::Field< double, FieldState::Phys > &in, LibUtilities::Field< double, FieldState::Phys > &out, const double &time, const double &dt)
std::shared_ptr< FwdTransOp< double > > m_fwdTransOp
void DoProjection(LibUtilities::Field< double, FieldState::Phys > &in, LibUtilities::Field< double, FieldState::Phys > &out, const double &time)
Project onto the solution space: a copy for DG, a forward and backward transform with the Dirichlet v...
static std::string className2
Definition UnsteadyADR.h:89
CoefficientFieldViews v_GetOutputFieldViews() override
Project the solution to coefficients and return views of them.
bool m_isTimeDependentDiffCoeff
Definition UnsteadyADR.h:99
static std::string className1
Definition UnsteadyADR.h:88
~UnsteadyADR() override=default
std::shared_ptr< LinearAdvVolumeFluxOp< double > > m_volumeFluxOp
std::shared_ptr< IProductWRTBaseOp< double > > m_iProductWRTBaseOp
std::shared_ptr< BwdTransOp< double > > m_bwdTransOp
LibUtilities::Field< double, FieldState::Phys > m_varDiffCoeff
Definition UnsteadyADR.h:96
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::vector< std::pair< std::string, std::string > > SummaryList
Definition Misc.h:46
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< SessionFunction > SessionFunctionSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition MeshGraph.h:287