forked from IBAMR/IBAMR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdvDiffPPMConvectiveOperator.h
225 lines (203 loc) · 8.31 KB
/
AdvDiffPPMConvectiveOperator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
// Filename: AdvDiffPPMConvectiveOperator.h
// Created on 24 Aug 2011 by Boyce Griffith
//
// Copyright (c) 2002-2017, Boyce Griffith
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of The University of North Carolina nor the names of
// its contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#ifndef included_IBAMR_AdvDiffPPMConvectiveOperator
#define included_IBAMR_AdvDiffPPMConvectiveOperator
/////////////////////////////// INCLUDES /////////////////////////////////////
#include <string>
#include <vector>
#include "CellVariable.h"
#include "CoarsenAlgorithm.h"
#include "FaceVariable.h"
#include "IntVector.h"
#include "PatchHierarchy.h"
#include "RefineAlgorithm.h"
#include "RefinePatchStrategy.h"
#include "ibamr/ConvectiveOperator.h"
#include "ibamr/ibamr_enums.h"
#include "ibtk/ibtk_utilities.h"
#include "tbox/Database.h"
#include "tbox/Pointer.h"
namespace SAMRAI
{
namespace solv
{
template <int DIM, class TYPE>
class SAMRAIVectorReal;
template <int DIM>
class RobinBcCoefStrategy;
} // namespace solv
namespace xfer
{
template <int DIM>
class CoarsenSchedule;
template <int DIM>
class RefineSchedule;
} // namespace xfer
} // namespace SAMRAI
/////////////////////////////// CLASS DEFINITION /////////////////////////////
namespace IBAMR
{
/*!
* \brief Class AdvDiffPPMConvectiveOperator is a concrete ConvectiveOperator
* that implements a upwind convective differencing operator based on the
* piecewise parabolic method (PPM).
*
* Class AdvDiffPPMConvectiveOperator computes the convective derivative of a
* cell-centered velocity field using the xsPPM7 method of Rider, Greenough, and
* Kamm.
*
* \see AdvDiffSemiImplicitHierarchyIntegrator
*/
class AdvDiffPPMConvectiveOperator : public ConvectiveOperator
{
public:
/*!
* \brief Class constructor.
*/
AdvDiffPPMConvectiveOperator(std::string object_name,
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > Q_var,
SAMRAI::tbox::Pointer<SAMRAI::tbox::Database> input_db,
ConvectiveDifferencingType difference_form,
std::vector<SAMRAI::solv::RobinBcCoefStrategy<NDIM>*> bc_coefs);
/*!
* \brief Destructor.
*/
~AdvDiffPPMConvectiveOperator();
/*!
* \brief Static function to construct an AdvDiffPPMConvectiveOperator.
*/
static SAMRAI::tbox::Pointer<ConvectiveOperator>
allocate_operator(const std::string& object_name,
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > Q_var,
SAMRAI::tbox::Pointer<SAMRAI::tbox::Database> input_db,
ConvectiveDifferencingType difference_form,
const std::vector<SAMRAI::solv::RobinBcCoefStrategy<NDIM>*>& bc_coefs)
{
return new AdvDiffPPMConvectiveOperator(object_name, Q_var, input_db, difference_form, bc_coefs);
} // allocate_operator
/*!
* \brief Compute the action of the convective operator.
*/
void applyConvectiveOperator(int Q_idx, int N_idx) override;
/*!
* \name General operator functionality.
*/
//\{
/*!
* \brief Compute hierarchy dependent data required for computing y=F[x] and
* z=F[x]+y.
*
* The vector arguments for apply(), applyAdjoint(), etc, need not match
* those for initializeOperatorState(). However, there must be a certain
* degree of similarity, including
* - hierarchy configuration (hierarchy pointer and level range)
* - number, type and alignment of vector component data
* - ghost cell widths of data in the input and output vectors
*
* \note It is generally necessary to reinitialize the operator state when
* the hierarchy configuration changes.
*
* It is safe to call initializeOperatorState() when the state is already
* initialized. In this case, the operator state is first deallocated and
* then reinitialized.
*
* Conditions on arguments:
* - input and output vectors must have same hierarchy
* - input and output vectors must have same structure, depth, etc.
*
* Call deallocateOperatorState() to remove any data allocated by this
* method.
*
* \see deallocateOperatorState
*
* \param in input vector
* \param out output vector
*/
void initializeOperatorState(const SAMRAI::solv::SAMRAIVectorReal<NDIM, double>& in,
const SAMRAI::solv::SAMRAIVectorReal<NDIM, double>& out) override;
/*!
* \brief Remove all hierarchy dependent data allocated by
* initializeOperatorState().
*
* \note It is safe to call deallocateOperatorState() when the operator
* state is already deallocated.
*
* \see initializeOperatorState
*/
void deallocateOperatorState() override;
//\}
private:
/*!
* \brief Default constructor.
*
* \note This constructor is not implemented and should not be used.
*/
AdvDiffPPMConvectiveOperator() = delete;
/*!
* \brief Copy constructor.
*
* \note This constructor is not implemented and should not be used.
*
* \param from The value to copy to this object.
*/
AdvDiffPPMConvectiveOperator(const AdvDiffPPMConvectiveOperator& from) = delete;
/*!
* \brief Assignment operator.
*
* \note This operator is not implemented and should not be used.
*
* \param that The value to assign to this object.
*
* \return A reference to this object.
*/
AdvDiffPPMConvectiveOperator& operator=(const AdvDiffPPMConvectiveOperator& that) = delete;
// Data communication algorithms, operators, and schedules.
SAMRAI::tbox::Pointer<SAMRAI::xfer::CoarsenAlgorithm<NDIM> > d_coarsen_alg;
std::vector<SAMRAI::tbox::Pointer<SAMRAI::xfer::CoarsenSchedule<NDIM> > > d_coarsen_scheds;
SAMRAI::tbox::Pointer<SAMRAI::xfer::RefineAlgorithm<NDIM> > d_ghostfill_alg;
SAMRAI::tbox::Pointer<SAMRAI::xfer::RefinePatchStrategy<NDIM> > d_ghostfill_strategy;
std::vector<SAMRAI::tbox::Pointer<SAMRAI::xfer::RefineSchedule<NDIM> > > d_ghostfill_scheds;
const std::vector<SAMRAI::solv::RobinBcCoefStrategy<NDIM>*> d_bc_coefs;
std::string d_outflow_bdry_extrap_type = "CONSTANT";
// Hierarchy configuration.
SAMRAI::tbox::Pointer<SAMRAI::hier::PatchHierarchy<NDIM> > d_hierarchy;
int d_coarsest_ln = IBTK::invalid_level_number, d_finest_ln = IBTK::invalid_level_number;
// Scratch data.
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_Q_var;
unsigned int d_Q_data_depth = 0;
int d_Q_scratch_idx = IBTK::invalid_index;
SAMRAI::tbox::Pointer<SAMRAI::pdat::FaceVariable<NDIM, double> > d_q_extrap_var, d_q_flux_var;
int d_q_extrap_idx = IBTK::invalid_index, d_q_flux_idx = IBTK::invalid_index;
};
} // namespace IBAMR
//////////////////////////////////////////////////////////////////////////////
#endif //#ifndef included_IBAMR_AdvDiffPPMConvectiveOperator