forked from IBAMR/IBAMR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSVCStaggeredHierarchyIntegrator.h
678 lines (594 loc) · 26.9 KB
/
INSVCStaggeredHierarchyIntegrator.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
// Filename: INSVCStaggeredHierarchyIntegrator.h
// Created on 25 Sep 2017 by Nishant Nangia and Amneet Bhalla
//
// Copyright (c) 2002-2018, Nishant Nangia and Amneet Bhalla
// 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_INSVCStaggeredHierarchyIntegrator
#define included_IBAMR_INSVCStaggeredHierarchyIntegrator
/////////////////////////////// INCLUDES /////////////////////////////////////
#include <string>
#include <vector>
#include "CellVariable.h"
#include "EdgeVariable.h"
#include "HierarchyCellDataOpsReal.h"
#include "HierarchyEdgeDataOpsReal.h"
#include "HierarchyFaceDataOpsReal.h"
#include "HierarchyNodeDataOpsReal.h"
#include "HierarchySideDataOpsReal.h"
#include "IntVector.h"
#include "MultiblockDataTranslator.h"
#include "NodeVariable.h"
#include "SAMRAIVectorReal.h"
#include "SideVariable.h"
#include "ibamr/INSHierarchyIntegrator.h"
#include "ibamr/StaggeredStokesPhysicalBoundaryHelper.h"
#include "ibamr/StaggeredStokesSolver.h"
#include "ibamr/StaggeredStokesSolverManager.h"
#include "ibamr/ibamr_enums.h"
#include "ibtk/SideDataSynchronization.h"
#include "ibtk/ibtk_enums.h"
#include "tbox/Database.h"
#include "tbox/Pointer.h"
namespace IBAMR
{
class ConvectiveOperator;
} // namespace IBAMR
namespace IBTK
{
class PoissonSolver;
} // namespace IBTK
namespace SAMRAI
{
namespace hier
{
template <int DIM>
class BasePatchLevel;
template <int DIM>
class Patch;
template <int DIM>
class PatchHierarchy;
template <int DIM>
class BasePatchHierarchy;
} // namespace hier
namespace mesh
{
template <int DIM>
class GriddingAlgorithm;
} // namespace mesh
namespace solv
{
template <int DIM>
class RobinBcCoefStrategy;
} // namespace solv
} // namespace SAMRAI
/////////////////////////////// CLASS DEFINITION /////////////////////////////
namespace IBAMR
{
/*!
* \brief Class INSVCStaggeredHierarchyIntegrator provides an abstract interface for time
* integrator for a staggered-grid, incompressible Navier-Stokes solver on an AMR grid hierarchy
* with variable coefficients.
*
* An optional re-scaling factor c can be specified to minimize the loss of floating point precision for poorly
* scaling linear systems. The scaling acts on the momentum part of the saddle-point system, yielding
* \f$ c A + G(c x_p) = c b_u\f$
* in which the viscous block, the pressure degrees of freedom, and the velocity RHS have been scaled.
*
* Scaling \f$ c \f$ is chosen such that
* \f$ c(\frac{\rho}{dt} - \frac{\mu}{dx^2}) \sim \frac{1}{dx} \f$.
* The above scaling is chosen from the incompressiblity operator which scales
* as \f$ (\nabla \cdot) \sim \frac{1}{dx} \f$.
* Assuming \f$ dt \sim dx \f$ and \f$ 1/dx = N \f$, we have
* \f$ c \sim \frac{1}{\rho - \mu N} \f$. Here \f$ N \f$ is the number of cells for
* a unit length of the physical domain.
*
* Different levels of patch hierarchy can have different scaling because
* of the difference in the grid spacing \f$ dx \f$. Therefore, an array of scale
* factors is read from the input file (corresponding to different levels).
* If the scale array does not contain values for all the levels in the hierarchy,
* it is filled by the most finest scaling factor provided by the user (for the missing
* finer levels).
*/
class INSVCStaggeredHierarchyIntegrator : public INSHierarchyIntegrator
{
public:
/*!
* The constructor for class INSVCStaggeredHierarchyIntegrator sets some
* default values, reads in configuration information from input and restart
* databases, and registers the integrator object with the restart manager
* when requested.
*/
INSVCStaggeredHierarchyIntegrator(std::string object_name,
SAMRAI::tbox::Pointer<SAMRAI::tbox::Database> input_db,
bool register_for_restart = true);
/*!
* The destructor for class INSVCStaggeredHierarchyIntegrator unregisters the
* integrator object with the restart manager when the object is so
* registered.
*/
~INSVCStaggeredHierarchyIntegrator();
/*!
* Get the convective operator being used by this solver class.
*
* If the time integrator is configured to solve the time-dependent
* (creeping) Stokes equations, then the returned pointer will be NULL.
*
* If the convective operator has not already been constructed, and if the
* time integrator is not configured to solve the time-dependent (creeping)
* Stokes equations, then this function will initialize the default type of
* convective operator, which may be set in the class input database.
*/
SAMRAI::tbox::Pointer<ConvectiveOperator> getConvectiveOperator() override;
/*!
* Get the subdomain solver for the velocity subsystem. Such solvers can be
* useful in constructing block preconditioners.
*/
SAMRAI::tbox::Pointer<IBTK::PoissonSolver> getVelocitySubdomainSolver() override;
/*!
* Get the subdomain solver for the pressure subsystem. Such solvers can be
* useful in constructing block preconditioners.
*/
SAMRAI::tbox::Pointer<IBTK::PoissonSolver> getPressureSubdomainSolver() override;
/*!
* Register a solver for the time-dependent incompressible Stokes equations.
*/
void setStokesSolver(SAMRAI::tbox::Pointer<StaggeredStokesSolver> stokes_solver);
/*!
* Get the solver for the time-dependent incompressible Stokes equations
* used by this solver class.
*/
SAMRAI::tbox::Pointer<StaggeredStokesSolver> getStokesSolver();
/*!
* Indicate that the Stokes solver should be (re-)initialized before the
* next time step.
*/
void setStokesSolverNeedsInit();
/*!
* Virtual method to initialize the variables, basic communications
* algorithms, solvers, and other data structures used by a concrete time
* integrator object.
*
* This method is called automatically by initializePatchHierarchy() prior
* to the construction of the patch hierarchy. It is also possible for
* users to make an explicit call to initializeHierarchyIntegrator() prior
* to calling initializePatchHierarchy().
*/
virtual void
initializeHierarchyIntegrator(SAMRAI::tbox::Pointer<SAMRAI::hier::PatchHierarchy<NDIM> > hierarchy,
SAMRAI::tbox::Pointer<SAMRAI::mesh::GriddingAlgorithm<NDIM> > gridding_alg) override;
/*!
* Virtual method to initialize the AMR patch hierarchy and data defined on the hierarchy at
* the start of a computation. If the computation is begun from a restart
* file, the patch hierarchy and patch data are read from the hierarchy
* database. Otherwise, the patch hierarchy and patch data are initialized
* by the gridding algorithm associated with the integrator object.
*
* The implementation of this function assumes that the hierarchy exists
* upon entry to the function, but that it contains no patch levels. On
* return from this function, the state of the integrator object will be
* such that it is possible to step through time via the advanceHierarchy()
* function.
*/
virtual void initializePatchHierarchy(SAMRAI::tbox::Pointer<SAMRAI::hier::PatchHierarchy<NDIM> > hierarchy,
SAMRAI::tbox::Pointer<SAMRAI::mesh::GriddingAlgorithm<NDIM> > gridding_alg) override;
/*!
* Virtual method to prepare to advance the data from current_time to new_time.
*/
virtual void preprocessIntegrateHierarchy(double current_time, double new_time, int num_cycles = 1) override;
/*!
* Virtual method to clean up data following call(s) to integrateHierarchy().
*/
virtual void postprocessIntegrateHierarchy(double current_time,
double new_time,
bool skip_synchronize_new_state_data,
int num_cycles = 1) override;
/*!
* Virtual method to regrid the patch hierarchy.
*/
virtual void regridHierarchy() override;
/*!
* Explicitly remove nullspace components from a solution vector.
*/
void removeNullSpace(const SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> >& sol_vec);
/*!
* Register a variable mass density variable with the hierarchy integrator.
*/
void registerMassDensityVariable(SAMRAI::tbox::Pointer<SAMRAI::hier::Variable<NDIM> > rho_var);
/*!
* Get the mass density variable registered with the hierarchy integrator.
*/
SAMRAI::tbox::Pointer<SAMRAI::hier::Variable<NDIM> > getMassDensityVariable() const;
/*!
* Register a variable viscosity variable with the hierarchy integrator.
*/
void registerViscosityVariable(SAMRAI::tbox::Pointer<SAMRAI::hier::Variable<NDIM> > mu_var);
/*!
* Get the viscosity variable registered with the hierarchy integrator.
*/
SAMRAI::tbox::Pointer<SAMRAI::hier::Variable<NDIM> > getViscosityVariable() const;
/*!
* Set the interpolation type used for material properties rho
*/
void setDensityVCInterpolationType(const IBTK::VCInterpType vc_interp_type);
/*!
* Set the interpolation type used for material properties mu
*/
void setViscosityVCInterpolationType(const IBTK::VCInterpType vc_interp_type);
/*!
* \brief Function to reset fluid density or viscosity if they are
* maintained by this integrator.
*/
using ResetFluidPropertiesFcnPtr = void (*)(int property_idx,
SAMRAI::tbox::Pointer<SAMRAI::hier::Variable<NDIM> > property_var,
SAMRAI::tbox::Pointer<IBTK::HierarchyMathOps> hier_math_ops,
int cycle_num,
double time,
double current_time,
double new_time,
void* ctx);
/*!
* \brief Register interface neighborhood locating functions.
*/
void registerResetFluidDensityFcn(ResetFluidPropertiesFcnPtr callback, void* ctx);
/*!
* \brief Register interface neighborhood locating functions.
*/
void registerResetFluidViscosityFcn(ResetFluidPropertiesFcnPtr callback, void* ctx);
/*!
* \brief Supply initial conditions for the density field, if maintained by the fluid integrator.
*/
void registerMassDensityInitialConditions(SAMRAI::tbox::Pointer<IBTK::CartGridFunction> rho_init_fcn);
/*!
* \brief Supply initial conditions for the viscosity field, if maintained by the fluid integrator.
*/
void registerViscosityInitialConditions(SAMRAI::tbox::Pointer<IBTK::CartGridFunction> mu_init_fcn);
/*
* \brief Pure virtual method to supply boundary conditions for the density field, if maintained by the fluid
* integrator.
*/
virtual void registerMassDensityBoundaryConditions(SAMRAI::solv::RobinBcCoefStrategy<NDIM>* rho_bc_coef) = 0;
/*
* \brief Supply boundary conditions for the density field, if maintained by the fluid integrator.
*
* \note The boundary conditions set here will be overwritten if viscosity if being advected.
*/
void registerViscosityBoundaryConditions(SAMRAI::solv::RobinBcCoefStrategy<NDIM>* mu_bc_coef);
/*
* \brief Set the transported viscosity variable if it is being maintained by the advection-diffusion integrator.
*
* \note The variable set here MUST be registered and maintained by the advection-diffusion integrator.
*/
void
setTransportedViscosityVariable(SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > mu_adv_diff_var);
/*!
* \brief Get the transported viscosity variable that is being manintained by an advection-diffusion integrator
*/
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > getTransportedViscosityVariable() const;
/*!
* \brief Get the side-centered density patch data index, which will always be the newest one used in the linear
* operator i.e. rho_sc in rho_sc*u^{n+1} term.
*
* \note These patch data will not be deallocated at the end of the time step, so they can be used for various
* applications
*/
inline int getLinearOperatorRhoPatchDataIndex() const
{
return d_rho_linear_op_idx;
}
/*!
* \brief Get whether or not density is constant
*/
inline bool rhoIsConstant() const
{
return d_rho_is_const;
}
/*!
* \brief Get whether or not viscosity is constant
*/
inline bool muIsConstant() const
{
return d_mu_is_const;
}
/*!
* \brief Get the cell-centered viscosity patch data index, which will always be the newest one used in the linear
* operator.
*
* \note These patch data will not be deallocated at the end of the time step, so they can be used for various
* applications
*/
inline int getLinearOperatorMuPatchDataIndex() const
{
return d_mu_linear_op_idx;
}
/*!
* \brief Get the interpolated viscosity patch data index, which will always be the newest one used in the linear
* operator.
*
* \note These patch data will not be deallocated at the end of the time step, so they can be used for various
* applications
*/
inline int getInterpolatedLinearOperatorMuPatchDataIndex() const
{
return d_mu_interp_linear_op_idx;
}
/*!
* \brief Get the scaling factor used for A, p and u_rhs.
*/
inline SAMRAI::tbox::Array<double> getScalingFactor() const
{
return d_A_scale;
}
/*!
* \brief Get the viscosity boundary conditions
*/
inline SAMRAI::solv::RobinBcCoefStrategy<NDIM>* getViscosityBoundaryConditions() const
{
return d_mu_bc_coef;
}
protected:
/*!
* Determine the largest stable timestep on an individual patch.
*/
double getStableTimestep(SAMRAI::tbox::Pointer<SAMRAI::hier::Patch<NDIM> > patch) const override;
/*!
* Virtual method to initialize data on a new level after it is inserted into an AMR patch
* hierarchy by the gridding algorithm.
*/
virtual void
initializeLevelDataSpecialized(SAMRAI::tbox::Pointer<SAMRAI::hier::BasePatchHierarchy<NDIM> > hierarchy,
int level_number,
double init_data_time,
bool can_be_refined,
bool initial_time,
SAMRAI::tbox::Pointer<SAMRAI::hier::BasePatchLevel<NDIM> > old_level,
bool allocate_data) override;
/*!
* Virtual method to reset cached hierarchy dependent data.
*/
virtual void
resetHierarchyConfigurationSpecialized(SAMRAI::tbox::Pointer<SAMRAI::hier::BasePatchHierarchy<NDIM> > hierarchy,
int coarsest_level,
int finest_level) override;
/*!
* Virtual method to set integer tags to "one" in cells where refinement of the given level
* should occur according to the magnitude of the fluid vorticity.
*/
virtual void
applyGradientDetectorSpecialized(SAMRAI::tbox::Pointer<SAMRAI::hier::BasePatchHierarchy<NDIM> > hierarchy,
int level_number,
double error_data_time,
int tag_index,
bool initial_time,
bool uses_richardson_extrapolation_too) override;
/*!
* Virtual method to prepare variables for plotting.
*/
virtual void setupPlotDataSpecialized() override;
/*!
* Pure virtual method to project the velocity field following a regridding operation.
*/
virtual void regridProjection() = 0;
/*!
* Copy data from a side-centered variable to a face-centered variable.
*/
void copySideToFace(const int U_fc_idx,
const int U_sc_idx,
SAMRAI::tbox::Pointer<SAMRAI::hier::PatchHierarchy<NDIM> > hierarchy);
/*!
* Hierarchy operations objects.
*/
SAMRAI::tbox::Pointer<SAMRAI::math::HierarchyCellDataOpsReal<NDIM, double> > d_hier_cc_data_ops;
SAMRAI::tbox::Pointer<SAMRAI::math::HierarchyFaceDataOpsReal<NDIM, double> > d_hier_fc_data_ops;
SAMRAI::tbox::Pointer<SAMRAI::math::HierarchySideDataOpsReal<NDIM, double> > d_hier_sc_data_ops;
SAMRAI::tbox::Pointer<SAMRAI::math::HierarchyNodeDataOpsReal<NDIM, double> > d_hier_nc_data_ops;
SAMRAI::tbox::Pointer<SAMRAI::math::HierarchyEdgeDataOpsReal<NDIM, double> > d_hier_ec_data_ops;
/*
* Boundary condition and data synchronization operators.
*/
SAMRAI::tbox::Pointer<StaggeredStokesPhysicalBoundaryHelper> d_bc_helper;
SAMRAI::tbox::Pointer<IBTK::SideDataSynchronization> d_side_synch_op;
SAMRAI::tbox::Pointer<IBTK::HierarchyGhostCellInterpolation> d_rho_bdry_bc_fill_op, d_mu_bdry_bc_fill_op;
/*!
* Double precision values are (optional) factors used to rescale the
* density and viscosity for plotting.
*
* Boolean values indicates whether to output various quantities for
* visualization.
*/
double d_rho_scale = 1.0, d_mu_scale = 1.0;
bool d_output_rho = false, d_output_mu = false;
/*
* Hierarchy operators and solvers.
*/
int d_coarsest_reset_ln, d_finest_reset_ln;
SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > d_U_scratch_vec;
SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > d_U_rhs_vec;
SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > d_U_adv_vec;
SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > d_N_vec;
SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > d_P_scratch_vec;
SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > d_P_rhs_vec;
SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > d_sol_vec;
SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > d_rhs_vec;
std::vector<SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > > d_nul_vecs;
std::vector<SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > > d_U_nul_vecs;
bool d_vectors_need_init, d_explicitly_remove_nullspace = false;
std::string d_stokes_solver_type = StaggeredStokesSolverManager::UNDEFINED,
d_stokes_precond_type = StaggeredStokesSolverManager::UNDEFINED;
SAMRAI::tbox::Pointer<SAMRAI::tbox::Database> d_stokes_solver_db, d_stokes_precond_db;
SAMRAI::tbox::Pointer<StaggeredStokesSolver> d_stokes_solver;
bool d_stokes_solver_needs_init;
/*!
* Fluid solver variables.
*/
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_U_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_U_cc_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_P_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_F_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_F_cc_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_Q_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_N_old_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_Omega_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_Div_U_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_Omega_Norm_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_U_regrid_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_U_src_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_indicator_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_F_div_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_EE_var;
SAMRAI::tbox::Pointer<SAMRAI::hier::Variable<NDIM> > d_rho_var, d_mu_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_pressure_D_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_pressure_rhs_D_var;
#if (NDIM == 2)
SAMRAI::tbox::Pointer<SAMRAI::pdat::NodeVariable<NDIM, double> > d_velocity_D_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::NodeVariable<NDIM, double> > d_velocity_rhs_D_var;
#elif (NDIM == 3)
SAMRAI::tbox::Pointer<SAMRAI::pdat::EdgeVariable<NDIM, double> > d_velocity_D_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::EdgeVariable<NDIM, double> > d_velocity_rhs_D_var;
#endif
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_velocity_D_cc_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_velocity_C_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_velocity_rhs_C_var;
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_N_full_var;
/*!
* Interpolated material property variables.
*/
#if (NDIM == 2)
SAMRAI::tbox::Pointer<SAMRAI::pdat::NodeVariable<NDIM, double> > d_mu_interp_var;
#elif (NDIM == 3)
SAMRAI::tbox::Pointer<SAMRAI::pdat::EdgeVariable<NDIM, double> > d_mu_interp_var;
#endif
/*!
* Functions resetting rho and mu if they are maintained by this integrator.
*/
std::vector<ResetFluidPropertiesFcnPtr> d_reset_rho_fcns, d_reset_mu_fcns;
std::vector<void*> d_reset_rho_fcns_ctx, d_reset_mu_fcns_ctx;
/*!
* Temporary storage variables that contain intermediate quantities
*/
SAMRAI::tbox::Pointer<SAMRAI::pdat::SideVariable<NDIM, double> > d_temp_sc_var;
int d_temp_sc_idx;
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_temp_cc_var;
int d_temp_cc_idx;
/*
* Patch data descriptor indices for all "state" variables managed by the
* integrator.
*
* State variables have three contexts: current, scratch, and new.
*/
int d_U_current_idx, d_U_new_idx, d_U_scratch_idx;
int d_P_current_idx, d_P_new_idx, d_P_scratch_idx;
int d_F_current_idx, d_F_new_idx, d_F_scratch_idx;
int d_Q_current_idx, d_Q_new_idx, d_Q_scratch_idx;
int d_N_old_current_idx, d_N_old_new_idx, d_N_old_scratch_idx;
int d_mu_current_idx, d_mu_new_idx, d_mu_scratch_idx;
/*
* Patch data descriptor indices for all "plot" variables managed by the
* integrator.
*
* Plot variables have one context: current.
*/
int d_U_cc_idx, d_F_cc_idx, d_Omega_idx, d_Div_U_idx, d_EE_idx;
/*
* Patch data descriptor indices for all "scratch" variables managed by the
* integrator.
*
* Scratch variables have only one context: scratch.
*/
int d_Omega_Norm_idx, d_U_regrid_idx, d_U_src_idx, d_indicator_idx, d_F_div_idx;
int d_velocity_C_idx, d_velocity_D_idx, d_velocity_D_cc_idx, d_pressure_D_idx;
int d_velocity_rhs_C_idx, d_velocity_rhs_D_idx, d_pressure_rhs_D_idx;
int d_mu_interp_idx;
int d_N_full_idx;
/*
* Persistent patch data indices for the density and viscosity used in the linear operators
*/
int d_mu_linear_op_idx, d_mu_interp_linear_op_idx, d_rho_linear_op_idx;
/*
* Variables to indicate if either rho or mu is constant.
*/
bool d_rho_is_const = false, d_mu_is_const = false;
/*
* Variable to indicate the type of interpolation to be done for rho and mu.
*/
IBTK::VCInterpType d_rho_vc_interp_type, d_mu_vc_interp_type;
/*
* Variable to indicate the scaling factor used for A, p and u_rhs.
*/
SAMRAI::tbox::Array<double> d_A_scale;
/*
* Variable to set how often the preconditioner is reinitialized.
*/
int d_precond_reinit_interval = 1;
/*
* Objects to set initial condition for density and viscosity when they are maintained by the fluid integrator.
*/
SAMRAI::tbox::Pointer<IBTK::CartGridFunction> d_rho_init_fcn, d_mu_init_fcn;
/*
* Boundary condition objects for viscosity, which is provided by an appropriate advection-diffusion
* integrator
* or set by the fluid integrator.
*/
SAMRAI::solv::RobinBcCoefStrategy<NDIM>* d_mu_bc_coef = nullptr;
/*
* Variable to keep track of a transported viscosity variable maintained by an advection-diffusion integrator
*/
SAMRAI::tbox::Pointer<SAMRAI::pdat::CellVariable<NDIM, double> > d_mu_adv_diff_var;
private:
/*!
* \brief Default constructor.
*
* \note This constructor is not implemented and should not be used.
*/
INSVCStaggeredHierarchyIntegrator() = delete;
/*!
* \brief Copy constructor.
*
* \note This constructor is not implemented and should not be used.
*
* \param from The value to copy to this object.
*/
INSVCStaggeredHierarchyIntegrator(const INSVCStaggeredHierarchyIntegrator& 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.
*/
INSVCStaggeredHierarchyIntegrator& operator=(const INSVCStaggeredHierarchyIntegrator& that) = delete;
/*!
* Preprocess the operators and solvers used by the hierarchy integrator.
*/
void preprocessOperatorsAndSolvers(double current_time, double new_time);
};
} // namespace IBAMR
//////////////////////////////////////////////////////////////////////////////
#endif //#ifndef included_IBAMR_INSVCStaggeredHierarchyIntegrator