Nektar++
UnsteadyAdvectionDiffusion.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: UnsteadyAdvectionDiffusion.cpp
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 solve routines
32//
33///////////////////////////////////////////////////////////////////////////////
34
37
38namespace Nektar
39{
40using namespace LibUtilities;
41
44 "UnsteadyAdvectionDiffusion", UnsteadyAdvectionDiffusion::create,
45 "Unsteady Advection-Diffusion equation");
46
50 : UnsteadySystem(pSession, pGraph), UnsteadyAdvection(pSession, pGraph)
51{
52}
53
54/**
55 * @brief Initialisation object for the unsteady linear advection
56 * diffusion equation.
57 */
59{
61
62 m_session->LoadParameter("epsilon", m_epsilon, 1.0);
63
64 m_session->MatchSolverInfo("SpectralVanishingViscosity", "True",
65 m_useSpecVanVisc, false);
67 {
68 m_session->LoadParameter("SVVCutoffRatio", m_sVVCutoffRatio, 0.75);
69 m_session->LoadParameter("SVVDiffCoeff", m_sVVDiffCoeff, 0.1);
70 }
71
72 // turn on substepping
73 m_session->MatchSolverInfo("Extrapolation", "SubStepping",
74 m_subSteppingScheme, false);
75
76 m_session->LoadParameter("MinSubSteps", m_minsubsteps, 1);
77
78 // Type of advection and diffusion classes to be used
79 switch (m_projectionType)
80 {
81 // Discontinuous field
83 {
84 // Diffusion term
86 {
87 std::string diffName;
88 m_session->LoadSolverInfo("DiffusionType", diffName, "LDG");
90 diffName, diffName);
91 m_diffusion->SetFluxVector(
93 m_diffusion->InitObject(m_session, m_fields);
94 }
95
97 "SubSteppingScheme is not set up for DG projection");
98 break;
99 }
100 // Continuous field
103 {
104 // Advection term
105 std::string advName;
106 m_session->LoadSolverInfo("AdvectionType", advName,
107 "NonConservative");
108 if (advName.compare("WeakDG") == 0)
109 {
110 // Define the normal velocity fields
111 if (m_fields[0]->GetTrace())
112 {
114 }
115
116 std::string riemName;
117 m_session->LoadSolverInfo("UpwindType", riemName, "Upwind");
120 riemName, m_session);
121 m_riemannSolver->SetScalar(
123 m_advObject->SetRiemannSolver(m_riemannSolver);
124 m_advObject->InitObject(m_session, m_fields);
125 }
126
127 // In case of Galerkin explicit diffusion gives an error
129 {
130 ASSERTL0(false, "Explicit Galerkin diffusion not set up.");
131 }
132 // In case of Galerkin implicit diffusion: do nothing
133 break;
134 }
135 default:
136 {
137 ASSERTL0(false, "Unsupported projection type.");
138 break;
139 }
140 }
141
143 this);
145
146 if (m_subSteppingScheme) // Substepping
147 {
149 "Projection must be set to Mixed_CG_Discontinuous for "
150 "substepping");
152 }
153}
154
155/**
156 * @brief Compute the right-hand side for the unsteady linear advection
157 * diffusion problem.
158 *
159 * @param inarray Given fields.
160 * @param outarray Calculated solution.
161 * @param time Time.
162 */
164 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
165 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
166{
167 // Number of fields (variables of the problem)
168 int nVariables = inarray.size();
169
170 // Number of solution points
171 int nSolutionPts = GetNpoints();
172
173 UnsteadyAdvection::DoOdeRhs(inarray, outarray, time);
174
176 {
177 Array<OneD, Array<OneD, NekDouble>> outarrayDiff(nVariables);
178 for (int i = 0; i < nVariables; ++i)
179 {
180 outarrayDiff[i] = Array<OneD, NekDouble>(nSolutionPts, 0.0);
181 }
182
183 m_diffusion->Diffuse(nVariables, m_fields, inarray, outarrayDiff);
184
185 for (int i = 0; i < nVariables; ++i)
186 {
187 Vmath::Vadd(nSolutionPts, &outarrayDiff[i][0], 1, &outarray[i][0],
188 1, &outarray[i][0], 1);
189 }
190 }
191}
192
193/* @brief Compute the diffusion term implicitly.
194 *
195 * @param inarray Given fields.
196 * @param outarray Calculated solution.
197 * @param time Time.
198 * @param lambda Diffusion coefficient.
199 */
201 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
202 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time,
203 const NekDouble lambda)
204{
205 int nvariables = inarray.size();
206 int nq = m_fields[0]->GetNpoints();
207
210
211 // Add factor is GJP turned on
213 {
215 }
216
218 {
221 }
222
224 {
226 }
227
229 for (int n = 0; n < nvariables; ++n)
230 {
231 F[n] = Array<OneD, NekDouble>(nq);
232 }
233
234 // We solve ( \nabla^2 - HHlambda ) Y[i] = rhs [i]
235 // inarray = input: \hat{rhs} -> output: \hat{Y}
236 // outarray = output: nabla^2 \hat{Y}
237 // where \hat = modal coeffs
238 for (int i = 0; i < nvariables; ++i)
239 {
240 // Multiply 1.0/timestep/lambda
241 Vmath::Smul(nq, -factors[StdRegions::eFactorLambda], inarray[i], 1,
242 F[i], 1);
243 }
244
245 // Setting boundary conditions
247
248 for (int i = 0; i < nvariables; ++i)
249 {
250 // Solve a system of equations with Helmholtz solver
251 m_fields[i]->HelmSolve(F[i], m_fields[i]->UpdateCoeffs(), factors);
252
253 m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(), outarray[i]);
254 }
255}
256
257/**
258 * @brief Return the flux vector for the diffusion part.
259 *
260 */
262 [[maybe_unused]] const Array<OneD, Array<OneD, NekDouble>> &inarray,
263 const Array<OneD, Array<OneD, Array<OneD, NekDouble>>> &qfield,
264 Array<OneD, Array<OneD, Array<OneD, NekDouble>>> &viscousTensor)
265{
266 unsigned int nDim = qfield.size();
267 unsigned int nConvectiveFields = qfield[0].size();
268 unsigned int nPts = qfield[0][0].size();
269 for (unsigned int j = 0; j < nDim; ++j)
270 {
271 for (unsigned int i = 0; i < nConvectiveFields; ++i)
272 {
273 Vmath::Smul(nPts, m_epsilon, qfield[j][i], 1, viscousTensor[j][i],
274 1);
275 }
276 }
277}
278
280{
283 {
284 std::stringstream ss;
285 ss << "SVV (cut off = " << m_sVVCutoffRatio
286 << ", coeff = " << m_sVVDiffCoeff << ")";
287 SolverUtils::AddSummaryItem(s, "Smoothing", ss.str());
288 }
289}
290
291/**
292 * Perform the extrapolation.
293 */
295{
297 {
298 SubStepAdvance(step, m_time);
299 }
300
301 return false;
302}
303
304/**
305 *
306 */
308{
309 int nsubsteps;
310
311 NekDouble dt;
312
313 Array<OneD, Array<OneD, NekDouble>> fields, velfields;
314
315 static int ncalls = 1;
316 int nint = std::min(ncalls++, m_intSteps);
317
319
320 LibUtilities::CommSharedPtr comm = m_session->GetComm();
321
322 // Get the proper time step with CFL control
323 dt = GetSubstepTimeStep();
324
325 nsubsteps = (m_timestep > dt) ? ((int)(m_timestep / dt) + 1) : 1;
326 nsubsteps = std::max(m_minsubsteps, nsubsteps);
327
328 dt = m_timestep / nsubsteps;
329
330 if (m_infosteps && !((nstep + 1) % m_infosteps) && comm->GetRank() == 0)
331 {
332 std::cout << "Sub-integrating using " << nsubsteps
333 << " steps over Dt = " << m_timestep
334 << " (SubStep CFL=" << m_cflSafetyFactor << ")" << std::endl;
335 }
336
337 const TripleArray &solutionVector = m_intScheme->GetSolutionVector();
338
339 for (int m = 0; m < nint; ++m)
340 {
341 // We need to update the fields held by the m_intScheme
342 fields = solutionVector[m];
343
344 // Initialise NS solver which is set up to use a GLM method
345 // with calls to EvaluateAdvection_SetPressureBCs and
346 // SolveUnsteadyStokesSystem
347 m_subStepIntegrationScheme->InitializeScheme(dt, fields, time,
349
350 for (int n = 0; n < nsubsteps; ++n)
351 {
352 fields = m_subStepIntegrationScheme->TimeIntegrate(n, dt);
353 }
354
355 // Reset time integrated solution in m_intScheme
356 m_intScheme->SetSolutionVector(m, fields);
357 }
358}
359
360/**
361 *
362 */
364{
365 int n_element = m_fields[0]->GetExpSize();
366
367 const Array<OneD, int> ExpOrder = m_fields[0]->EvalBasisNumModesMaxPerExp();
368 Array<OneD, int> ExpOrderList(n_element, ExpOrder);
369
370 const NekDouble cLambda = 0.2; // Spencer book pag. 317
371
372 Array<OneD, NekDouble> tstep(n_element, 0.0);
373 Array<OneD, NekDouble> stdVelocity(n_element, 0.0);
374
375 stdVelocity = GetMaxStdVelocity(m_velocity);
376
377 for (int el = 0; el < n_element; ++el)
378 {
379 tstep[el] =
380 m_cflSafetyFactor / (stdVelocity[el] * cLambda *
381 (ExpOrder[el] - 1) * (ExpOrder[el] - 1));
382 }
383
384 NekDouble TimeStep = Vmath::Vmin(n_element, tstep, 1);
385 m_session->GetComm()->AllReduce(TimeStep, LibUtilities::ReduceMin);
386
387 return TimeStep;
388}
389
391 const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
392{
393 // Set to 1 for first step and it will then be increased in
394 // time advance routines
395 unsigned int order = IntegrationScheme->GetOrder();
396
397 // Set to 1 for first step and it will then be increased in
398 // time advance routines
399 if ((IntegrationScheme->GetName() == "Euler" &&
400 IntegrationScheme->GetVariant() == "Backward") ||
401 (IntegrationScheme->GetName() == "BDFImplicit" &&
402 (order == 1 || order == 2)))
403 {
404 // Note RK first order SSP is just Forward Euler.
407 "RungeKutta", "SSP", order, std::vector<NekDouble>());
408 }
409 else
410 {
412 "Integration method not suitable: "
413 "Options include BackwardEuler or BDFImplicitOrder1");
414 }
415
416 m_intSteps = IntegrationScheme->GetNumIntegrationPhases();
417
418 // set explicit time-integration class operators
423}
424
425/**
426 * Explicit Advection terms used by SubStepAdvance time integration
427 */
429 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
430 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
431{
432 int i;
433 int nVariables = inarray.size();
434
435 /// Get the number of coefficients
436 int ncoeffs = m_fields[0]->GetNcoeffs();
437
438 /// Define an auxiliary variable to compute the RHS
439 Array<OneD, Array<OneD, NekDouble>> WeakAdv(nVariables);
440 WeakAdv[0] = Array<OneD, NekDouble>(ncoeffs * nVariables);
441 for (i = 1; i < nVariables; ++i)
442 {
443 WeakAdv[i] = WeakAdv[i - 1] + ncoeffs;
444 }
445
446 // Currently assume velocity field is time independent and does not
447 // therefore need extrapolating. RHS computation using the advection base
448 // class
449 m_advObject->Advect(nVariables, m_fields, m_velocity, inarray, outarray,
450 time);
451
452 for (i = 0; i < nVariables; ++i)
453 {
454 m_fields[i]->IProductWRTBase(outarray[i], WeakAdv[i]);
455 // negation requried due to sign of DoAdvection term to be consistent
456 Vmath::Neg(ncoeffs, WeakAdv[i], 1);
457 }
458
459 AddAdvectionPenaltyFlux(m_velocity, inarray, WeakAdv);
460
461 /// Operations to compute the RHS
462 for (i = 0; i < nVariables; ++i)
463 {
464 // Negate the RHS
465 Vmath::Neg(ncoeffs, WeakAdv[i], 1);
466
467 /// Multiply the flux by the inverse of the mass matrix
468 m_fields[i]->MultiplyByElmtInvMass(WeakAdv[i], WeakAdv[i]);
469
470 /// Store in outarray the physical values of the RHS
471 m_fields[i]->BwdTrans(WeakAdv[i], outarray[i]);
472 }
473}
474
475/**
476 * Projection used by SubStepAdvance time integration
477 */
479 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
481 [[maybe_unused]] const NekDouble time)
482{
483 ASSERTL1(inarray.size() == outarray.size(),
484 "Inarray and outarray of different sizes ");
485
486 for (int i = 0; i < inarray.size(); ++i)
487 {
488 Vmath::Vcopy(inarray[i].size(), inarray[i], 1, outarray[i], 1);
489 }
490}
491
493 const Array<OneD, const Array<OneD, NekDouble>> &velfield,
494 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
496{
497 ASSERTL1(physfield.size() == Outarray.size(),
498 "Physfield and outarray are of different dimensions");
499
500 int i;
501
502 /// Number of trace points
503 int nTracePts = m_fields[0]->GetTrace()->GetNpoints();
504
505 /// Forward state array
506 Array<OneD, NekDouble> Fwd(3 * nTracePts);
507
508 /// Backward state array
509 Array<OneD, NekDouble> Bwd = Fwd + nTracePts;
510
511 /// upwind numerical flux state array
512 Array<OneD, NekDouble> numflux = Bwd + nTracePts;
513
514 /// Normal velocity array
516
517 for (i = 0; i < physfield.size(); ++i)
518 {
519 /// Extract forwards/backwards trace spaces
520 /// Note: Needs to have correct i value to get boundary conditions
521 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd, Bwd);
522
523 /// Upwind between elements
524 m_fields[0]->GetTrace()->Upwind(Vn, Fwd, Bwd, numflux);
525
526 /// Construct difference between numflux and Fwd,Bwd
527 Vmath::Vsub(nTracePts, numflux, 1, Fwd, 1, Fwd, 1);
528 Vmath::Vsub(nTracePts, numflux, 1, Bwd, 1, Bwd, 1);
529
530 /// Calculate the numerical fluxes multipling Fwd, Bwd and
531 /// numflux by the normal advection velocity
532 Vmath::Vmul(nTracePts, Fwd, 1, Vn, 1, Fwd, 1);
533 Vmath::Vmul(nTracePts, Bwd, 1, Vn, 1, Bwd, 1);
534
535 m_fields[0]->AddFwdBwdTraceIntegral(Fwd, Bwd, Outarray[i]);
536 }
537}
538
540 const Array<OneD, Array<OneD, NekDouble>> inarray)
541{
542
543 int n_points_0 = m_fields[0]->GetExp(0)->GetTotPoints();
544 int n_element = m_fields[0]->GetExpSize();
545 int nvel = inarray.size();
546 int cnt;
547
548 ASSERTL0(nvel >= 2, "Method not implemented for 1D");
549
550 NekDouble pntVelocity;
551
552 // Getting the standard velocity vector on the 2D normal space
553 Array<OneD, Array<OneD, NekDouble>> stdVelocity(nvel);
554 Array<OneD, NekDouble> maxV(n_element, 0.0);
556
557 for (int i = 0; i < nvel; ++i)
558 {
559 stdVelocity[i] = Array<OneD, NekDouble>(n_points_0);
560 }
561
562 if (nvel == 2)
563 {
564 cnt = 0.0;
565 for (int el = 0; el < n_element; ++el)
566 {
567 int n_points = m_fields[0]->GetExp(el)->GetTotPoints();
568 ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
569
570 // reset local space if necessary
571 if (n_points != n_points_0)
572 {
573 for (int j = 0; j < nvel; ++j)
574 {
575 stdVelocity[j] = Array<OneD, NekDouble>(n_points);
576 }
577 n_points_0 = n_points;
578 }
579
581 ->GetExp(el)
582 ->GetGeom()
583 ->GetMetricInfo()
584 ->GetDerivFactors(ptsKeys);
585
586 if (m_fields[0]
587 ->GetExp(el)
588 ->GetGeom()
589 ->GetMetricInfo()
590 ->GetGtype() == SpatialDomains::eDeformed)
591 {
592 for (int i = 0; i < n_points; i++)
593 {
594 stdVelocity[0][i] = gmat[0][i] * inarray[0][i + cnt] +
595 gmat[2][i] * inarray[1][i + cnt];
596
597 stdVelocity[1][i] = gmat[1][i] * inarray[0][i + cnt] +
598 gmat[3][i] * inarray[1][i + cnt];
599 }
600 }
601 else
602 {
603 for (int i = 0; i < n_points; i++)
604 {
605 stdVelocity[0][i] = gmat[0][0] * inarray[0][i + cnt] +
606 gmat[2][0] * inarray[1][i + cnt];
607
608 stdVelocity[1][i] = gmat[1][0] * inarray[0][i + cnt] +
609 gmat[3][0] * inarray[1][i + cnt];
610 }
611 }
612
613 cnt += n_points;
614
615 for (int i = 0; i < n_points; i++)
616 {
617 pntVelocity = stdVelocity[0][i] * stdVelocity[0][i] +
618 stdVelocity[1][i] * stdVelocity[1][i];
619
620 if (pntVelocity > maxV[el])
621 {
622 maxV[el] = pntVelocity;
623 }
624 }
625 maxV[el] = sqrt(maxV[el]);
626 }
627 }
628 else
629 {
630 cnt = 0;
631 for (int el = 0; el < n_element; ++el)
632 {
633
634 int n_points = m_fields[0]->GetExp(el)->GetTotPoints();
635 ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
636
637 // reset local space if necessary
638 if (n_points != n_points_0)
639 {
640 for (int j = 0; j < nvel; ++j)
641 {
642 stdVelocity[j] = Array<OneD, NekDouble>(n_points);
643 }
644 n_points_0 = n_points;
645 }
646
648 ->GetExp(el)
649 ->GetGeom()
650 ->GetMetricInfo()
651 ->GetDerivFactors(ptsKeys);
652
653 if (m_fields[0]
654 ->GetExp(el)
655 ->GetGeom()
656 ->GetMetricInfo()
657 ->GetGtype() == SpatialDomains::eDeformed)
658 {
659 for (int i = 0; i < n_points; i++)
660 {
661 stdVelocity[0][i] = gmat[0][i] * inarray[0][i + cnt] +
662 gmat[3][i] * inarray[1][i + cnt] +
663 gmat[6][i] * inarray[2][i + cnt];
664
665 stdVelocity[1][i] = gmat[1][i] * inarray[0][i + cnt] +
666 gmat[4][i] * inarray[1][i + cnt] +
667 gmat[7][i] * inarray[2][i + cnt];
668
669 stdVelocity[2][i] = gmat[2][i] * inarray[0][i + cnt] +
670 gmat[5][i] * inarray[1][i + cnt] +
671 gmat[8][i] * inarray[2][i + cnt];
672 }
673 }
674 else
675 {
676 for (int i = 0; i < n_points; i++)
677 {
678 stdVelocity[0][i] = gmat[0][0] * inarray[0][i + cnt] +
679 gmat[3][0] * inarray[1][i + cnt] +
680 gmat[6][0] * inarray[2][i + cnt];
681
682 stdVelocity[1][i] = gmat[1][0] * inarray[0][i + cnt] +
683 gmat[4][0] * inarray[1][i + cnt] +
684 gmat[7][0] * inarray[2][i + cnt];
685
686 stdVelocity[2][i] = gmat[2][0] * inarray[0][i + cnt] +
687 gmat[5][0] * inarray[1][i + cnt] +
688 gmat[8][0] * inarray[2][i + cnt];
689 }
690 }
691
692 cnt += n_points;
693
694 for (int i = 0; i < n_points; i++)
695 {
696 pntVelocity = stdVelocity[0][i] * stdVelocity[0][i] +
697 stdVelocity[1][i] * stdVelocity[1][i] +
698 stdVelocity[2][i] * stdVelocity[2][i];
699
700 if (pntVelocity > maxV[el])
701 {
702 maxV[el] = pntVelocity;
703 }
704 }
705
706 maxV[el] = sqrt(maxV[el]);
707 }
708 }
709
710 return maxV;
711}
712} // namespace Nektar
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:197
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:143
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
SOLVER_UTILS_EXPORT int GetTraceNpoints()
NekDouble m_timestep
Time step size.
int m_infosteps
Number of time steps between outputting status information.
NekDouble m_time
Current time of simulation.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetExpSize()
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetNpoints()
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
Base class for unsteady solvers.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
NekDouble m_cflSafetyFactor
CFL safety factor (comprise between 0 to 1).
LibUtilities::TimeIntegrationSchemeSharedPtr m_intScheme
Wrapper to the time integration scheme.
bool m_explicitDiffusion
Indicates if explicit or implicit treatment of diffusion is used.
UnsteadyAdvectionDiffusion(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Session reader.
SolverUtils::DiffusionSharedPtr m_diffusion
bool v_PreIntegrate(int step) override
PreIntegration step for substepping.
void v_InitObject(bool DeclareFields=true) override
Initialise the object.
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the RHS.
void SetUpSubSteppingTimeIntegration(const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
void DoImplicitSolve(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, NekDouble time, NekDouble lambda)
Solve implicitly the diffusion term.
void AddAdvectionPenaltyFlux(const Array< OneD, const Array< OneD, NekDouble > > &velfield, const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &Outarray)
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
void SubStepAdvection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
void SubStepAdvance(int nstep, NekDouble time)
static std::string className
Name of class.
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > inarray)
void GetFluxVectorDiff(const Array< OneD, Array< OneD, NekDouble > > &inarray, const Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &viscousTensor)
Evaluate the flux at each solution point for the diffusion part.
void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print Summary.
void SubStepProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
LibUtilities::TimeIntegrationSchemeSharedPtr m_subStepIntegrationScheme
LibUtilities::TimeIntegrationSchemeOperators m_subStepIntegrationOps
Array< OneD, NekDouble > m_traceVn
Array< OneD, NekDouble > & GetNormalVel(const Array< OneD, const Array< OneD, NekDouble > > &velfield)
Get the normal velocity based on input velfield.
Array< OneD, NekDouble > & GetNormalVelocity()
Get the normal velocity.
void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print Summary.
Array< OneD, Array< OneD, NekDouble > > m_velocity
Advection velocity.
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the RHS.
void v_InitObject(bool DeclareFields=true) override
Initialise the object.
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
TimeIntegrationSchemeFactory & GetTimeIntegrationSchemeFactory()
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:231
std::shared_ptr< TimeIntegrationScheme > TimeIntegrationSchemeSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
DiffusionFactory & GetDiffusionFactory()
Definition: Diffusion.cpp:39
EquationSystemFactory & GetEquationSystemFactory()
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:47
RiemannSolverFactory & GetRiemannSolverFactory()
@ eDeformed
Geometry is curved or has non-constant factors.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:402
StdRegions::ConstFactorMap factors
double NekDouble
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.hpp:72
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.hpp:292
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
Definition: Vmath.hpp:725
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.hpp:180
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.hpp:100
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.hpp:220
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294