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
38
39namespace Nektar
40{
41using namespace LibUtilities;
42
45 "UnsteadyAdvectionDiffusion", UnsteadyAdvectionDiffusion::create,
46 "Unsteady Advection-Diffusion equation");
47
51 : UnsteadySystem(pSession, pGraph), UnsteadyAdvection(pSession, pGraph)
52{
53}
54
55/**
56 * @brief Initialisation object for the unsteady linear advection
57 * diffusion equation.
58 */
60{
62
63 m_session->LoadParameter("epsilon", m_epsilon, 1.0);
64
65 m_session->MatchSolverInfo("SpectralVanishingViscosity", "True",
66 m_useSpecVanVisc, false);
68 {
69 m_session->LoadParameter("SVVCutoffRatio", m_sVVCutoffRatio, 0.75);
70 m_session->LoadParameter("SVVDiffCoeff", m_sVVDiffCoeff, 0.1);
71 }
72
73 // turn on substepping
74 m_session->MatchSolverInfo("Extrapolation", "SubStepping",
75 m_subSteppingScheme, false);
76
77 m_session->LoadParameter("MinSubSteps", m_minsubsteps, 1);
78
79 // Type of advection and diffusion classes to be used
80 switch (m_projectionType)
81 {
82 // Discontinuous field
84 {
85 // Diffusion term
87 {
88 std::string diffName;
89 m_session->LoadSolverInfo("DiffusionType", diffName, "LDG");
91 diffName, diffName);
92 m_diffusion->SetFluxVector(
94 m_diffusion->InitObject(m_session, m_fields);
95 }
96
98 "SubSteppingScheme is not set up for DG projection");
99 break;
100 }
101 // Continuous field
104 {
105 // Advection term
106 std::string advName;
107 m_session->LoadSolverInfo("AdvectionType", advName,
108 "NonConservative");
109 if (advName.compare("WeakDG") == 0)
110 {
111 // Define the normal velocity fields
112 if (m_fields[0]->GetTrace())
113 {
115 }
116
117 std::string riemName;
118 m_session->LoadSolverInfo("UpwindType", riemName, "Upwind");
121 riemName, m_session);
122 m_riemannSolver->SetScalar(
124 m_advObject->SetRiemannSolver(m_riemannSolver);
125 m_advObject->InitObject(m_session, m_fields);
126 }
127
128 // In case of Galerkin explicit diffusion gives an error
130 {
131 ASSERTL0(false, "Explicit Galerkin diffusion not set up.");
132 }
133 // In case of Galerkin implicit diffusion: do nothing
134 break;
135 }
136 default:
137 {
138 ASSERTL0(false, "Unsupported projection type.");
139 break;
140 }
141 }
142
144 this);
146
147 if (m_subSteppingScheme) // Substepping
148 {
150 "Projection must be set to Mixed_CG_Discontinuous for "
151 "substepping");
153 }
154}
155
156/**
157 * @brief Compute the right-hand side for the unsteady linear advection
158 * diffusion problem.
159 *
160 * @param inarray Given fields.
161 * @param outarray Calculated solution.
162 * @param time Time.
163 */
165 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
166 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
167{
168 // Number of fields (variables of the problem)
169 int nVariables = inarray.size();
170
171 UnsteadyAdvection::DoOdeRhs(inarray, outarray, time);
172
174 {
175 Array<OneD, Array<OneD, NekDouble>> outarrayDiff(nVariables);
176 for (int i = 0; i < nVariables; ++i)
177 {
178 outarrayDiff[i] = Array<OneD, NekDouble>(outarray[i].size(), 0.0);
179 }
180
181 if (m_ALESolver)
182 {
183 Array<OneD, Array<OneD, NekDouble>> tmpIn(nVariables);
184 // If ALE we must take Mu coefficient space to u physical space
186 m_diffusion->DiffuseCoeffs(nVariables, m_fields, tmpIn,
187 outarrayDiff); // Using tmpIn from above
188 }
189 else
190 {
191 m_diffusion->Diffuse(nVariables, m_fields, inarray, outarrayDiff);
192 }
193
194 for (int i = 0; i < nVariables; ++i)
195 {
196 Vmath::Vadd(outarray[i].size(), &outarrayDiff[i][0], 1,
197 &outarray[i][0], 1, &outarray[i][0], 1);
198 }
199 }
200}
201
202/* @brief Compute the diffusion term implicitly.
203 *
204 * @param inarray Given fields.
205 * @param outarray Calculated solution.
206 * @param time Time.
207 * @param lambda Diffusion coefficient.
208 */
210 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
211 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time,
212 const NekDouble lambda)
213{
214 int nvariables = inarray.size();
215 int nq = m_fields[0]->GetNpoints();
216
219
220 // Add factor is GJP turned on
222 {
224 }
225
227 {
230 }
231
233 {
235 }
236
238 for (int n = 0; n < nvariables; ++n)
239 {
240 F[n] = Array<OneD, NekDouble>(nq);
241 }
242
243 // We solve ( \nabla^2 - HHlambda ) Y[i] = rhs [i]
244 // inarray = input: \hat{rhs} -> output: \hat{Y}
245 // outarray = output: nabla^2 \hat{Y}
246 // where \hat = modal coeffs
247 for (int i = 0; i < nvariables; ++i)
248 {
249 // Multiply 1.0/timestep/lambda
250 Vmath::Smul(nq, -factors[StdRegions::eFactorLambda], inarray[i], 1,
251 F[i], 1);
252 }
253
254 // Setting boundary conditions
256
257 for (int i = 0; i < nvariables; ++i)
258 {
259 // Solve a system of equations with Helmholtz solver
260 m_fields[i]->HelmSolve(F[i], m_fields[i]->UpdateCoeffs(), factors);
261
262 m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(), outarray[i]);
263 }
264}
265
266/**
267 * @brief Return the flux vector for the diffusion part.
268 *
269 */
271 [[maybe_unused]] const Array<OneD, Array<OneD, NekDouble>> &inarray,
272 const Array<OneD, Array<OneD, Array<OneD, NekDouble>>> &qfield,
273 Array<OneD, Array<OneD, Array<OneD, NekDouble>>> &viscousTensor)
274{
275 unsigned int nDim = qfield.size();
276 unsigned int nConvectiveFields = qfield[0].size();
277 unsigned int nPts = qfield[0][0].size();
278 for (unsigned int j = 0; j < nDim; ++j)
279 {
280 for (unsigned int i = 0; i < nConvectiveFields; ++i)
281 {
282 Vmath::Smul(nPts, m_epsilon, qfield[j][i], 1, viscousTensor[j][i],
283 1);
284 }
285 }
286}
287
289{
292 {
293 std::stringstream ss;
294 ss << "SVV (cut off = " << m_sVVCutoffRatio
295 << ", coeff = " << m_sVVDiffCoeff << ")";
296 SolverUtils::AddSummaryItem(s, "Smoothing", ss.str());
297 }
298}
299
301 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
302 std::vector<std::string> &variables)
303{
304 bool extraFields;
305 m_session->MatchSolverInfo("OutputExtraFields", "True", extraFields, true);
306
307 if (extraFields && m_ALESolver)
308 {
309 ExtraFldOutputGridVelocity(fieldcoeffs, variables);
310 }
311}
312
313/**
314 * Perform the extrapolation.
315 */
317{
319 {
320 SubStepAdvance(step, m_time);
321 }
322
323 return false;
324}
325
326/**
327 *
328 */
330{
331 int nsubsteps;
332
333 NekDouble dt;
334
335 Array<OneD, Array<OneD, NekDouble>> fields, velfields;
336
337 static int ncalls = 1;
338 int nint = std::min(ncalls++, m_intSteps);
339
341
342 LibUtilities::CommSharedPtr comm = m_session->GetComm();
343
344 // Get the proper time step with CFL control
345 dt = GetSubstepTimeStep();
346
347 nsubsteps = (m_timestep > dt) ? ((int)(m_timestep / dt) + 1) : 1;
348 nsubsteps = std::max(m_minsubsteps, nsubsteps);
349
350 dt = m_timestep / nsubsteps;
351
352 if (m_infosteps && !((nstep + 1) % m_infosteps) && comm->GetRank() == 0)
353 {
354 std::cout << "Sub-integrating using " << nsubsteps
355 << " steps over Dt = " << m_timestep
356 << " (SubStep CFL=" << m_cflSafetyFactor << ")" << std::endl;
357 }
358
359 const TripleArray &solutionVector = m_intScheme->GetSolutionVector();
360
361 for (int m = 0; m < nint; ++m)
362 {
363 // We need to update the fields held by the m_intScheme
364 fields = solutionVector[m];
365
366 // Initialise NS solver which is set up to use a GLM method
367 // with calls to EvaluateAdvection_SetPressureBCs and
368 // SolveUnsteadyStokesSystem
369 m_subStepIntegrationScheme->InitializeScheme(dt, fields, time,
371
372 for (int n = 0; n < nsubsteps; ++n)
373 {
374 fields = m_subStepIntegrationScheme->TimeIntegrate(n, dt);
375 }
376
377 // Reset time integrated solution in m_intScheme
378 m_intScheme->SetSolutionVector(m, fields);
379 }
380}
381
382/**
383 *
384 */
386{
387 int n_element = m_fields[0]->GetExpSize();
388
389 const Array<OneD, int> ExpOrder = m_fields[0]->EvalBasisNumModesMaxPerExp();
390 Array<OneD, int> ExpOrderList(n_element, ExpOrder);
391
392 const NekDouble cLambda = 0.2; // Spencer book pag. 317
393
394 Array<OneD, NekDouble> tstep(n_element, 0.0);
395 Array<OneD, NekDouble> stdVelocity(n_element, 0.0);
396
397 stdVelocity = GetMaxStdVelocity(m_velocity);
398
399 for (int el = 0; el < n_element; ++el)
400 {
401 tstep[el] =
402 m_cflSafetyFactor / (stdVelocity[el] * cLambda *
403 (ExpOrder[el] - 1) * (ExpOrder[el] - 1));
404 }
405
406 NekDouble TimeStep = Vmath::Vmin(n_element, tstep, 1);
407 m_session->GetComm()->AllReduce(TimeStep, LibUtilities::ReduceMin);
408
409 return TimeStep;
410}
411
413 const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
414{
415 // Set to 1 for first step and it will then be increased in
416 // time advance routines
417 unsigned int order = IntegrationScheme->GetOrder();
418
419 // Set to 1 for first step and it will then be increased in
420 // time advance routines
421 if ((IntegrationScheme->GetName() == "Euler" &&
422 IntegrationScheme->GetVariant() == "Backward") ||
423 (IntegrationScheme->GetName() == "BDFImplicit" &&
424 (order == 1 || order == 2)))
425 {
426 // Note RK first order SSP is just Forward Euler.
429 "RungeKutta", "SSP", order, std::vector<NekDouble>());
430 }
431 else
432 {
434 "Integration method not suitable: "
435 "Options include BackwardEuler or BDFImplicitOrder1");
436 }
437
438 m_intSteps = IntegrationScheme->GetNumIntegrationPhases();
439
440 // set explicit time-integration class operators
445}
446
447/**
448 * Explicit Advection terms used by SubStepAdvance time integration
449 */
451 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
452 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
453{
454 int i;
455 int nVariables = inarray.size();
456
457 /// Get the number of coefficients
458 int ncoeffs = m_fields[0]->GetNcoeffs();
459
460 /// Define an auxiliary variable to compute the RHS
461 Array<OneD, Array<OneD, NekDouble>> WeakAdv(nVariables);
462 WeakAdv[0] = Array<OneD, NekDouble>(ncoeffs * nVariables);
463 for (i = 1; i < nVariables; ++i)
464 {
465 WeakAdv[i] = WeakAdv[i - 1] + ncoeffs;
466 }
467
468 // Currently assume velocity field is time independent and does not
469 // therefore need extrapolating. RHS computation using the advection base
470 // class
471 m_advObject->Advect(nVariables, m_fields, m_velocity, inarray, outarray,
472 time);
473
474 for (i = 0; i < nVariables; ++i)
475 {
476 m_fields[i]->IProductWRTBase(outarray[i], WeakAdv[i]);
477 // negation requried due to sign of DoAdvection term to be consistent
478 Vmath::Neg(ncoeffs, WeakAdv[i], 1);
479 }
480
481 AddAdvectionPenaltyFlux(m_velocity, inarray, WeakAdv);
482
483 /// Operations to compute the RHS
484 for (i = 0; i < nVariables; ++i)
485 {
486 // Negate the RHS
487 Vmath::Neg(ncoeffs, WeakAdv[i], 1);
488
489 /// Multiply the flux by the inverse of the mass matrix
490 m_fields[i]->MultiplyByElmtInvMass(WeakAdv[i], WeakAdv[i]);
491
492 /// Store in outarray the physical values of the RHS
493 m_fields[i]->BwdTrans(WeakAdv[i], outarray[i]);
494 }
495}
496
497/**
498 * Projection used by SubStepAdvance time integration
499 */
501 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
503 [[maybe_unused]] const NekDouble time)
504{
505 ASSERTL1(inarray.size() == outarray.size(),
506 "Inarray and outarray of different sizes ");
507
508 for (int i = 0; i < inarray.size(); ++i)
509 {
510 Vmath::Vcopy(inarray[i].size(), inarray[i], 1, outarray[i], 1);
511 }
512}
513
515 const Array<OneD, const Array<OneD, NekDouble>> &velfield,
516 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
518{
519 ASSERTL1(physfield.size() == Outarray.size(),
520 "Physfield and outarray are of different dimensions");
521
522 int i;
523
524 /// Number of trace points
525 int nTracePts = m_fields[0]->GetTrace()->GetNpoints();
526
527 /// Forward state array
528 Array<OneD, NekDouble> Fwd(3 * nTracePts);
529
530 /// Backward state array
531 Array<OneD, NekDouble> Bwd = Fwd + nTracePts;
532
533 /// upwind numerical flux state array
534 Array<OneD, NekDouble> numflux = Bwd + nTracePts;
535
536 /// Normal velocity array
538
539 for (i = 0; i < physfield.size(); ++i)
540 {
541 /// Extract forwards/backwards trace spaces
542 /// Note: Needs to have correct i value to get boundary conditions
543 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd, Bwd);
544
545 /// Upwind between elements
546 m_fields[0]->GetTrace()->Upwind(Vn, Fwd, Bwd, numflux);
547
548 /// Construct difference between numflux and Fwd,Bwd
549 Vmath::Vsub(nTracePts, numflux, 1, Fwd, 1, Fwd, 1);
550 Vmath::Vsub(nTracePts, numflux, 1, Bwd, 1, Bwd, 1);
551
552 /// Calculate the numerical fluxes multipling Fwd, Bwd and
553 /// numflux by the normal advection velocity
554 Vmath::Vmul(nTracePts, Fwd, 1, Vn, 1, Fwd, 1);
555 Vmath::Vmul(nTracePts, Bwd, 1, Vn, 1, Bwd, 1);
556
557 m_fields[0]->AddFwdBwdTraceIntegral(Fwd, Bwd, Outarray[i]);
558 }
559}
560
562 const Array<OneD, Array<OneD, NekDouble>> inarray)
563{
564
565 int n_points_0 = m_fields[0]->GetExp(0)->GetTotPoints();
566 int n_element = m_fields[0]->GetExpSize();
567 int nvel = inarray.size();
568 int cnt;
569
570 ASSERTL0(nvel >= 2, "Method not implemented for 1D");
571
572 NekDouble pntVelocity;
573
574 // Getting the standard velocity vector on the 2D normal space
575 Array<OneD, Array<OneD, NekDouble>> stdVelocity(nvel);
576 Array<OneD, NekDouble> maxV(n_element, 0.0);
578
579 for (int i = 0; i < nvel; ++i)
580 {
581 stdVelocity[i] = Array<OneD, NekDouble>(n_points_0);
582 }
583
584 if (nvel == 2)
585 {
586 cnt = 0.0;
587 for (int el = 0; el < n_element; ++el)
588 {
589 int n_points = m_fields[0]->GetExp(el)->GetTotPoints();
590 ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
591
592 // reset local space if necessary
593 if (n_points != n_points_0)
594 {
595 for (int j = 0; j < nvel; ++j)
596 {
597 stdVelocity[j] = Array<OneD, NekDouble>(n_points);
598 }
599 n_points_0 = n_points;
600 }
601
603 ->GetExp(el)
604 ->GetGeom()
605 ->GetMetricInfo()
606 ->GetDerivFactors(ptsKeys);
607
608 if (m_fields[0]
609 ->GetExp(el)
610 ->GetGeom()
611 ->GetMetricInfo()
612 ->GetGtype() == SpatialDomains::eDeformed)
613 {
614 for (int i = 0; i < n_points; i++)
615 {
616 stdVelocity[0][i] = gmat[0][i] * inarray[0][i + cnt] +
617 gmat[2][i] * inarray[1][i + cnt];
618
619 stdVelocity[1][i] = gmat[1][i] * inarray[0][i + cnt] +
620 gmat[3][i] * inarray[1][i + cnt];
621 }
622 }
623 else
624 {
625 for (int i = 0; i < n_points; i++)
626 {
627 stdVelocity[0][i] = gmat[0][0] * inarray[0][i + cnt] +
628 gmat[2][0] * inarray[1][i + cnt];
629
630 stdVelocity[1][i] = gmat[1][0] * inarray[0][i + cnt] +
631 gmat[3][0] * inarray[1][i + cnt];
632 }
633 }
634
635 cnt += n_points;
636
637 for (int i = 0; i < n_points; i++)
638 {
639 pntVelocity = stdVelocity[0][i] * stdVelocity[0][i] +
640 stdVelocity[1][i] * stdVelocity[1][i];
641
642 if (pntVelocity > maxV[el])
643 {
644 maxV[el] = pntVelocity;
645 }
646 }
647 maxV[el] = sqrt(maxV[el]);
648 }
649 }
650 else
651 {
652 cnt = 0;
653 for (int el = 0; el < n_element; ++el)
654 {
655
656 int n_points = m_fields[0]->GetExp(el)->GetTotPoints();
657 ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
658
659 // reset local space if necessary
660 if (n_points != n_points_0)
661 {
662 for (int j = 0; j < nvel; ++j)
663 {
664 stdVelocity[j] = Array<OneD, NekDouble>(n_points);
665 }
666 n_points_0 = n_points;
667 }
668
670 ->GetExp(el)
671 ->GetGeom()
672 ->GetMetricInfo()
673 ->GetDerivFactors(ptsKeys);
674
675 if (m_fields[0]
676 ->GetExp(el)
677 ->GetGeom()
678 ->GetMetricInfo()
679 ->GetGtype() == SpatialDomains::eDeformed)
680 {
681 for (int i = 0; i < n_points; i++)
682 {
683 stdVelocity[0][i] = gmat[0][i] * inarray[0][i + cnt] +
684 gmat[3][i] * inarray[1][i + cnt] +
685 gmat[6][i] * inarray[2][i + cnt];
686
687 stdVelocity[1][i] = gmat[1][i] * inarray[0][i + cnt] +
688 gmat[4][i] * inarray[1][i + cnt] +
689 gmat[7][i] * inarray[2][i + cnt];
690
691 stdVelocity[2][i] = gmat[2][i] * inarray[0][i + cnt] +
692 gmat[5][i] * inarray[1][i + cnt] +
693 gmat[8][i] * inarray[2][i + cnt];
694 }
695 }
696 else
697 {
698 for (int i = 0; i < n_points; i++)
699 {
700 stdVelocity[0][i] = gmat[0][0] * inarray[0][i + cnt] +
701 gmat[3][0] * inarray[1][i + cnt] +
702 gmat[6][0] * inarray[2][i + cnt];
703
704 stdVelocity[1][i] = gmat[1][0] * inarray[0][i + cnt] +
705 gmat[4][0] * inarray[1][i + cnt] +
706 gmat[7][0] * inarray[2][i + cnt];
707
708 stdVelocity[2][i] = gmat[2][0] * inarray[0][i + cnt] +
709 gmat[5][0] * inarray[1][i + cnt] +
710 gmat[8][0] * inarray[2][i + cnt];
711 }
712 }
713
714 cnt += n_points;
715
716 for (int i = 0; i < n_points; i++)
717 {
718 pntVelocity = stdVelocity[0][i] * stdVelocity[0][i] +
719 stdVelocity[1][i] * stdVelocity[1][i] +
720 stdVelocity[2][i] * stdVelocity[2][i];
721
722 if (pntVelocity > maxV[el])
723 {
724 maxV[el] = pntVelocity;
725 }
726 }
727
728 maxV[el] = sqrt(maxV[el]);
729 }
730 }
731
732 return maxV;
733}
734
737{
739 {
740 m_spaceDim = spaceDim;
741 m_fieldsALE = fields;
742
743 // Initialise grid velocities as 0s
746 for (int i = 0; i < spaceDim; ++i)
747 {
748 m_gridVelocity[i] =
749 Array<OneD, NekDouble>(fields[0]->GetTotPoints(), 0.0);
751 fields[0]->GetTrace()->GetTotPoints(), 0.0);
752 }
753 }
754 ALEHelper::InitObject(spaceDim, fields);
755}
756
757} // 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.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsALE
Definition: ALEHelper.h:89
SOLVER_UTILS_EXPORT void InitObject(int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
Definition: ALEHelper.cpp:48
Array< OneD, Array< OneD, NekDouble > > m_gridVelocityTrace
Definition: ALEHelper.h:91
SOLVER_UTILS_EXPORT void ALEDoElmtInvMassBwdTrans(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: ALEHelper.cpp:149
SOLVER_UTILS_EXPORT void ExtraFldOutputGridVelocity(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
Definition: ALEHelper.cpp:392
Array< OneD, Array< OneD, NekDouble > > m_gridVelocity
Definition: ALEHelper.h:90
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.
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.
SOLVER_UTILS_EXPORT int GetTotPoints()
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
void v_ALEInitObject(int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields) override
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
void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables) override
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:430
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