Nektar++
NonlinearPeregrine.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File NonlinearPeregrine.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: Nonlinear Boussinesq equations of Peregrine in
32 // conservative variables (constant depth case)
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #include <iostream>
37 #include <iomanip>
38 
39 #include <boost/core/ignore_unused.hpp>
40 #include <boost/algorithm/string.hpp>
41 
44 
45 using namespace std;
46 
47 namespace Nektar
48 {
49 
50 string NonlinearPeregrine::className =
52  "NonlinearPeregrine", NonlinearPeregrine::create,
53  "Nonlinear Peregrine equations in conservative variables.");
54 
55 NonlinearPeregrine::NonlinearPeregrine(
58  : ShallowWaterSystem(pSession, pGraph), m_factors()
59 {
61  m_factors[StdRegions::eFactorTau] = 1000000.0;
62  // note: eFactorTau = 1.0 becomes unstable...
63  // we need to investigate the behaviuor w.r.t. tau
64 }
65 
67 {
69 
70  if (m_session->DefinesSolverInfo("PROBLEMTYPE"))
71  {
72  int i;
73  std::string ProblemTypeStr = m_session->GetSolverInfo("PROBLEMTYPE");
74  for (i = 0; i < (int) SIZE_ProblemType; ++i)
75  {
76  if (boost::iequals(ProblemTypeMap[i], ProblemTypeStr))
77  {
79  break;
80  }
81  }
82  }
83  else
84  {
86  }
87 
89  {
92  }
93  else
94  {
95  ASSERTL0(false, "Implicit Peregrine not set up.");
96  }
97 
98  // NB! At the moment only the constant depth case is
99  // supported for the Peregrine eq.
100  if (m_session->DefinesParameter("ConstDepth"))
101  {
102  m_const_depth = m_session->GetParameter("ConstDepth");
103  }
104  else
105  {
106  ASSERTL0(false, "Constant Depth not specified");
107  }
108 
109  // Type of advection class to be used
110  switch (m_projectionType)
111  {
112  // Continuous field
114  {
115  ASSERTL0(false,
116  "Continuous projection type not supported for Peregrine.");
117  break;
118  }
119  // Discontinuous field
121  {
122  string advName;
123  string diffName;
124  string riemName;
125 
126  //---------------------------------------------------------------
127  // Setting up advection and diffusion operators
128  // NB: diffusion not set up for SWE at the moment
129  // but kept here for future use ...
130  m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
131  // m_session->LoadSolverInfo("DiffusionType", diffName, "LDG");
133  advName, advName);
134 
136  this);
137 
138  // Setting up Riemann solver for advection operator
139  m_session->LoadSolverInfo("UpwindType", riemName, "NoSolver");
140 
143  riemName, m_session);
144 
145  // Setting up parameters for advection operator Riemann solver
146  m_riemannSolver->SetParam("gravity",
148  m_riemannSolver->SetAuxVec("vecLocs",
151  this);
152  m_riemannSolver->SetScalar("depth", &NonlinearPeregrine::GetDepth,
153  this);
154 
155  // Concluding initialisation of advection / diffusion operators
156  m_advection->SetRiemannSolver(m_riemannSolver);
157  m_advection->InitObject(m_session, m_fields);
158  break;
159  }
160  default:
161  {
162  ASSERTL0(false, "Unsupported projection type.");
163  break;
164  }
165  }
166 
167 }
168 
170 {
171 
172 }
173 
174 // physarray contains the conservative variables
176  const Array<OneD, const Array<OneD, NekDouble> > &physarray,
177  Array<OneD, Array<OneD, NekDouble> > &outarray)
178 {
179 
180  int ncoeffs = GetNcoeffs();
181  int nq = GetTotPoints();
182 
183  Array<OneD, NekDouble> tmp(nq);
184  Array<OneD, NekDouble> mod(ncoeffs);
185 
186  switch (m_projectionType)
187  {
189  {
190  // add to hu equation
191  Vmath::Vmul(nq, m_coriolis, 1, physarray[2], 1, tmp, 1);
192  m_fields[0]->IProductWRTBase(tmp, mod);
193  m_fields[0]->MultiplyByElmtInvMass(mod, mod);
194  m_fields[0]->BwdTrans(mod, tmp);
195  Vmath::Vadd(nq, tmp, 1, outarray[1], 1, outarray[1], 1);
196 
197  // add to hv equation
198  Vmath::Vmul(nq, m_coriolis, 1, physarray[1], 1, tmp, 1);
199  Vmath::Neg(nq, tmp, 1);
200  m_fields[0]->IProductWRTBase(tmp, mod);
201  m_fields[0]->MultiplyByElmtInvMass(mod, mod);
202  m_fields[0]->BwdTrans(mod, tmp);
203  Vmath::Vadd(nq, tmp, 1, outarray[2], 1, outarray[2], 1);
204  break;
205  }
208  {
209  // add to hu equation
210  Vmath::Vmul(nq, m_coriolis, 1, physarray[2], 1, tmp, 1);
211  Vmath::Vadd(nq, tmp, 1, outarray[1], 1, outarray[1], 1);
212 
213  // add to hv equation
214  Vmath::Vmul(nq, m_coriolis, 1, physarray[1], 1, tmp, 1);
215  Vmath::Neg(nq, tmp, 1);
216  Vmath::Vadd(nq, tmp, 1, outarray[2], 1, outarray[2], 1);
217  break;
218  }
219  default:
220  ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
221  break;
222  }
223 
224 }
225 
226 // physarray contains the conservative variables
228  const Array<OneD, const Array<OneD, NekDouble> > &physarray,
229  Array<OneD, Array<OneD, NekDouble> > &outarray)
230 {
231 
232  int ncoeffs = GetNcoeffs();
233  int nq = GetTotPoints();
234 
235  Array<OneD, NekDouble> tmp(nq);
236  Array<OneD, NekDouble> mod(ncoeffs);
237 
238  switch (m_projectionType)
239  {
241  {
242  for (int i = 0; i < m_spacedim; ++i)
243  {
244  Vmath::Vmul(nq, m_bottomSlope[i], 1, physarray[0], 1, tmp, 1);
245  Vmath::Smul(nq, m_g, tmp, 1, tmp, 1);
246  m_fields[0]->IProductWRTBase(tmp, mod);
247  m_fields[0]->MultiplyByElmtInvMass(mod, mod);
248  m_fields[0]->BwdTrans(mod, tmp);
249  Vmath::Vadd(nq, tmp, 1, outarray[i + 1], 1, outarray[i + 1], 1);
250  }
251  break;
252  }
255  {
256  for (int i = 0; i < m_spacedim; ++i)
257  {
258  Vmath::Vmul(nq, m_bottomSlope[i], 1, physarray[0], 1, tmp, 1);
259  Vmath::Smul(nq, m_g, tmp, 1, tmp, 1);
260  Vmath::Vadd(nq, tmp, 1, outarray[i + 1], 1, outarray[i + 1], 1);
261  }
262  break;
263  }
264  default:
265  ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
266  break;
267  }
268 
269 }
270 
272  const Array<OneD, const Array<OneD, NekDouble> >&inarray,
273  Array<OneD, Array<OneD, NekDouble> >&outarray, const NekDouble time)
274 {
275  int i;
276  int nvariables = inarray.size();
277  int ncoeffs = GetNcoeffs();
278  int nq = GetTotPoints();
279 
280  switch (m_projectionType)
281  {
283  {
284 
285  //-------------------------------------------------------
286  //inarray in physical space
287 
288  Array<OneD, Array<OneD, NekDouble> > modarray(nvariables);
289  for (i = 0; i < nvariables; ++i)
290  {
291  modarray[i] = Array<OneD, NekDouble>(ncoeffs, 0.0);
292  }
293  //-------------------------------------------------------
294 
295  //-------------------------------------------------------
296  // Compute the DG advection including the numerical flux
297  // by using SolverUtils/Advection
298  // Input and output in physical space
300 
301  m_advection->Advect(nvariables - 1, m_fields, advVel, inarray,
302  outarray, time);
303  //-------------------------------------------------------
304 
305  //-------------------------------------------------------
306  // negate the outarray since moving terms to the rhs
307  for (i = 0; i < nvariables - 1; ++i)
308  {
309  Vmath::Neg(nq, outarray[i], 1);
310  }
311  //-------------------------------------------------------
312 
313  //-------------------------------------------------
314  // Add "source terms"
315  // Input and output in physical space
316 
317  // Coriolis forcing
318  if (m_coriolis.size() != 0)
319  {
320  AddCoriolis(inarray, outarray);
321  }
322 
323  // Variable Depth
324  if (m_constantDepth != true)
325  {
326  ASSERTL0(false,
327  "Variable depth not supported for the Peregrine "
328  "equations");
329  }
330 
331  //-------------------------------------------------
332 
333  //---------------------------------------
334  // As no more terms is required for the
335  // continuity equation and we have aleady evaluated
336  // the values for h_t we are done for h
337  //---------------------------------------
338 
339  //-------------------------------------------------
340  // go to modal space
341  m_fields[0]->IProductWRTBase(outarray[1], modarray[1]);
342  m_fields[0]->IProductWRTBase(outarray[2], modarray[2]);
343 
344  // store f1 and f2 for later use (modal space)
345  Array<OneD, NekDouble> f1(ncoeffs);
346  Array<OneD, NekDouble> f2(ncoeffs);
347 
348  Vmath::Vcopy(ncoeffs, modarray[1], 1, f1, 1); // f1
349  Vmath::Vcopy(ncoeffs, modarray[2], 1, f2, 1); // f2
350 
351  // Solve the remaining block-diagonal systems
352  m_fields[0]->MultiplyByElmtInvMass(modarray[1], modarray[1]);
353  m_fields[0]->MultiplyByElmtInvMass(modarray[2], modarray[2]);
354  //---------------------------------------------
355 
356  //---------------------------------------------
357 
358  //-------------------------------------------------
359  // create tmp fields to be used during
360  // the dispersive section
361 
362  Array<OneD, Array<OneD, NekDouble> > coeffsfield(2);
363  Array<OneD, Array<OneD, NekDouble> > physfield(2);
364 
365  for (i = 0; i < 2; ++i)
366  {
367  coeffsfield[i] = Array<OneD, NekDouble>(ncoeffs);
368  physfield[i] = Array<OneD, NekDouble>(nq);
369  }
370  //---------------------------------------------
371 
372  //---------------------------------------------
373  // Go from modal to physical space
374  Vmath::Vcopy(nq, outarray[1], 1, physfield[0], 1);
375  Vmath::Vcopy(nq, outarray[2], 1, physfield[1], 1);
376  //---------------------------------------
377 
378  //---------------------------------------
379  // Start for solve of mixed dispersive terms
380  // using the 'WCE method'
381  // (Eskilsson & Sherwin, JCP 2006)
382 
383  // constant depth case
384  // \nabla \cdot (\nabla z) - invgamma z
385  // = - invgamma (\nabla \cdot {\bf f}_(2,3)
386 
387  NekDouble gamma = (m_const_depth * m_const_depth) * (1.0 / 3.0);
388  NekDouble invgamma = 1.0 / gamma;
389 
390  int nTraceNumPoints = GetTraceTotPoints();
393  upwindX[0] = Array<OneD, NekDouble>(nTraceNumPoints);
394  upwindY[0] = Array<OneD, NekDouble>(nTraceNumPoints);
395  //--------------------------------------------
396 
397  //--------------------------------------------
398  // Compute the forcing function for the
399  // wave continuity equation
400 
401  // Set boundary condidtions for z
402  SetBoundaryConditionsForcing(physfield, time);
403 
404  // \nabla \phi \cdot f_{2,3}
405  m_fields[0]->IProductWRTDerivBase(0, physfield[0], coeffsfield[0]);
406  m_fields[0]->IProductWRTDerivBase(1, physfield[1], coeffsfield[1]);
407  Vmath::Vadd(ncoeffs, coeffsfield[0], 1, coeffsfield[1], 1,
408  coeffsfield[0], 1);
409  Vmath::Neg(ncoeffs, coeffsfield[0], 1);
410 
411  // Evaluate upwind numerical flux (physical space)
412  NumericalFluxForcing(physfield, upwindX[0], upwindY[0]);
413 
414  m_fields[0]->AddTraceIntegral(upwindX[0], upwindY[0],
415  coeffsfield[0]);
416  m_fields[0]->MultiplyByElmtInvMass(coeffsfield[0], coeffsfield[0]);
417  m_fields[0]->BwdTrans(coeffsfield[0], physfield[0]);
418 
419  Vmath::Smul(nq, -invgamma, physfield[0], 1, physfield[0], 1);
420 
421  // ok: forcing function for HelmSolve... done!
422  //--------------------------------------
423 
424  //--------------------------------------
425  // Solve the Helmhotz-type equation
426  // for the wave continuity equation
427  // (missing slope terms...)
428 
429  // note: this is just valid for the constant depth case:
430 
431  // as of now we need not to specify any
432  // BC routine for the WCE: periodic
433  // and zero Neumann (for walls)
434 
435  WCESolve(physfield[0], invgamma);
436 
437  Vmath::Vcopy(nq, physfield[0], 1, outarray[3], 1); // store z
438 
439  // ok: Wave Continuity Equation... done!
440  //------------------------------------
441 
442  //------------------------------------
443  // Return to the primary variables
444 
445  // (h {\bf u})_t = gamma \nabla z + {\bf f}_{2,3}
446 
447  Vmath::Smul(nq, gamma, physfield[0], 1, physfield[0], 1);
448 
449  // Set boundary conditions
450  SetBoundaryConditionsContVariables(physfield[0], time);
451 
452  m_fields[0]->IProductWRTDerivBase(0, physfield[0], coeffsfield[0]);
453  m_fields[1]->IProductWRTDerivBase(1, physfield[0], coeffsfield[1]);
454 
455  Vmath::Neg(ncoeffs, coeffsfield[0], 1);
456  Vmath::Neg(ncoeffs, coeffsfield[1], 1);
457 
458  // Evaluate upwind numerical flux (physical space)
459  NumericalFluxConsVariables(physfield[0], upwindX[0], upwindY[0]);
460 
461  {
462  Array<OneD, NekDouble> uptemp(nTraceNumPoints, 0.0);
463 
464  m_fields[0]->AddTraceIntegral(upwindX[0], uptemp,
465  coeffsfield[0]);
466  m_fields[0]->AddTraceIntegral(uptemp, upwindY[0],
467  coeffsfield[1]);
468  }
469 
470  Vmath::Vadd(ncoeffs, f1, 1, coeffsfield[0], 1, modarray[1], 1);
471  Vmath::Vadd(ncoeffs, f2, 1, coeffsfield[1], 1, modarray[2], 1);
472 
473  m_fields[1]->MultiplyByElmtInvMass(modarray[1], modarray[1]);
474  m_fields[2]->MultiplyByElmtInvMass(modarray[2], modarray[2]);
475 
476  m_fields[1]->BwdTrans(modarray[1], outarray[1]);
477  m_fields[2]->BwdTrans(modarray[2], outarray[2]);
478 
479  // ok: returned to conservative variables... done!
480  //---------------------
481 
482  break;
483  }
486  ASSERTL0(false, "Unknown projection scheme for the Peregrine");
487  break;
488  default:
489  ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
490  break;
491  }
492 }
493 
495  const Array<OneD, const Array<OneD, NekDouble> >&inarray,
496  Array<OneD, Array<OneD, NekDouble> >&outarray,
497  const NekDouble time)
498 {
499  int i;
500  int nvariables = inarray.size();
501 
502  switch (m_projectionType)
503  {
505  {
506 
507  // Just copy over array
508  int npoints = GetNpoints();
509 
510  for (i = 0; i < nvariables; ++i)
511  {
512  Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
513  }
514 
515  SetBoundaryConditions(outarray, time);
516  break;
517  }
520  {
521 
523  Array<OneD, NekDouble> coeffs(m_fields[0]->GetNcoeffs(),0.0);
524 
525  for (i = 0; i < nvariables; ++i)
526  {
527  m_fields[i]->FwdTrans(inarray[i], coeffs);
528  m_fields[i]->BwdTrans_IterPerExp(coeffs, outarray[i]);
529  }
530  break;
531  }
532  default:
533  ASSERTL0(false, "Unknown projection scheme");
534  break;
535  }
536 }
537 
538 //----------------------------------------------------
540  Array<OneD, Array<OneD, NekDouble> > &inarray,
541  NekDouble time)
542 {
543 
544  int nvariables = m_fields.size();
545  int cnt = 0;
546  int nTracePts = GetTraceTotPoints();
547 
548  // Extract trace for boundaries. Needs to be done on all processors to avoid
549  // deadlock.
550  Array<OneD, Array<OneD, NekDouble> > Fwd(nvariables);
551  for (int i = 0; i < nvariables; ++i)
552  {
553  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
554  m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
555  }
556 
557  // loop over Boundary Regions
558  for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
559  {
560 
561  // Wall Boundary Condition
562  if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),"Wall"))
563  {
564  WallBoundary2D(n, cnt, Fwd, inarray);
565  }
566 
567  // Time Dependent Boundary Condition (specified in meshfile)
568  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
569  {
570  for (int i = 0; i < nvariables; ++i)
571  {
572  m_fields[i]->EvaluateBoundaryConditions(time);
573  }
574  }
575  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
576  }
577 }
578 
579 //----------------------------------------------------
580 /**
581  * @brief Wall boundary condition.
582  */
583 void NonlinearPeregrine::WallBoundary(int bcRegion, int cnt,
585  Array<OneD, Array<OneD, NekDouble> > &physarray)
586 {
587  int i;
588  int nvariables = physarray.size();
589 
590  // Adjust the physical values of the trace to take
591  // user defined boundaries into account
592  int e, id1, id2, npts;
594  m_fields[0]->GetBndCondExpansions()[bcRegion];
595  for (e = 0; e < bcexp->GetExpSize(); ++e)
596  {
597  npts = bcexp->GetExp(e)->GetTotPoints();
598  id1 = bcexp->GetPhys_Offset(e);
599  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
600  m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
601 
602  // For 2D/3D, define: v* = v - 2(v.n)n
603  Array<OneD, NekDouble> tmp(npts, 0.0);
604 
605  // Calculate (v.n)
606  for (i = 0; i < m_spacedim; ++i)
607  {
608  Vmath::Vvtvp(npts, &Fwd[1 + i][id2], 1, &m_traceNormals[i][id2], 1,
609  &tmp[0], 1, &tmp[0], 1);
610  }
611 
612  // Calculate 2.0(v.n)
613  Vmath::Smul(npts, -2.0, &tmp[0], 1, &tmp[0], 1);
614 
615  // Calculate v* = v - 2.0(v.n)n
616  for (i = 0; i < m_spacedim; ++i)
617  {
618  Vmath::Vvtvp(npts, &tmp[0], 1, &m_traceNormals[i][id2], 1,
619  &Fwd[1 + i][id2], 1, &Fwd[1 + i][id2], 1);
620  }
621 
622  // copy boundary adjusted values into the boundary expansion
623  for (i = 0; i < nvariables; ++i)
624  {
625  bcexp = m_fields[i]->GetBndCondExpansions()[bcRegion];
626  Vmath::Vcopy(npts, &Fwd[i][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
627  }
628  }
629 }
630 
632  int bcRegion,
633  int cnt,
635  Array<OneD, Array<OneD, NekDouble> > &physarray)
636 {
637  boost::ignore_unused(physarray);
638 
639  int i;
640  int nvariables = 3;
641 
642  // Adjust the physical values of the trace to take
643  // user defined boundaries into account
644  int e, id1, id2, npts;
646  m_fields[0]->GetBndCondExpansions()[bcRegion];
647 
648  for (e = 0; e < bcexp->GetExpSize();
649  ++e)
650  {
651  npts = bcexp->GetExp(e)->GetNumPoints(0);
652  id1 = bcexp->GetPhys_Offset(e);
653  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
654  m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
655 
656  switch (m_expdim)
657  {
658  case 1:
659  {
660  // negate the forward flux
661  Vmath::Neg(npts, &Fwd[1][id2], 1);
662  break;
663  }
664  case 2:
665  {
666  Array<OneD, NekDouble> tmp_n(npts);
667  Array<OneD, NekDouble> tmp_t(npts);
668 
669  Vmath::Vmul (npts, &Fwd[1][id2], 1, &m_traceNormals[0][id2], 1,
670  &tmp_n[0], 1);
671  Vmath::Vvtvp(npts, &Fwd[2][id2], 1, &m_traceNormals[1][id2], 1,
672  &tmp_n[0], 1, &tmp_n[0], 1);
673 
674  Vmath::Vmul (npts, &Fwd[1][id2], 1, &m_traceNormals[1][id2], 1,
675  &tmp_t[0], 1);
676  Vmath::Vvtvm(npts, &Fwd[2][id2], 1, &m_traceNormals[0][id2], 1,
677  &tmp_t[0], 1, &tmp_t[0], 1);
678 
679  // negate the normal flux
680  Vmath::Neg(npts, tmp_n, 1);
681 
682  // rotate back to Cartesian
683  Vmath::Vmul (npts, &tmp_t[0], 1, &m_traceNormals[1][id2], 1,
684  &Fwd[1][id2], 1);
685  Vmath::Vvtvm(npts, &tmp_n[0], 1, &m_traceNormals[0][id2], 1,
686  &Fwd[1][id2], 1, &Fwd[1][id2], 1);
687 
688  Vmath::Vmul(npts, &tmp_t[0], 1, &m_traceNormals[0][id2], 1,
689  &Fwd[2][id2], 1);
690  Vmath::Vvtvp(npts, &tmp_n[0], 1, &m_traceNormals[1][id2], 1,
691  &Fwd[2][id2], 1, &Fwd[2][id2], 1);
692  break;
693  }
694  case 3:
695  ASSERTL0(false,
696  "3D not implemented for Shallow Water Equations");
697  break;
698  default:
699  ASSERTL0(false, "Illegal expansion dimension");
700  }
701 
702  // copy boundary adjusted values into the boundary expansion
703  for (i = 0; i < nvariables; ++i)
704  {
705  bcexp = m_fields[i]->GetBndCondExpansions()[bcRegion];
706  Vmath::Vcopy(npts, &Fwd[i][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
707  }
708  }
709 }
710 
711 // Physfield in conservative Form
713  const Array<OneD, const Array<OneD, NekDouble> > &physfield,
715 {
716  int i, j;
717  int nq = m_fields[0]->GetTotPoints();
718 
719  NekDouble g = m_g;
721 
722  // Flux vector for the mass equation
723  for (i = 0; i < m_spacedim; ++i)
724  {
725  velocity[i] = Array<OneD, NekDouble>(nq);
726  Vmath::Vcopy(nq, physfield[i + 1], 1, flux[0][i], 1);
727  }
728 
729  GetVelocityVector(physfield, velocity);
730 
731  // Put (0.5 g h h) in tmp
732  Array<OneD, NekDouble> tmp(nq);
733  Vmath::Vmul(nq, physfield[0], 1, physfield[0], 1, tmp, 1);
734  Vmath::Smul(nq, 0.5 * g, tmp, 1, tmp, 1);
735 
736  // Flux vector for the momentum equations
737  for (i = 0; i < m_spacedim; ++i)
738  {
739  for (j = 0; j < m_spacedim; ++j)
740  {
741  Vmath::Vmul(nq, velocity[j], 1, physfield[i + 1], 1,
742  flux[i + 1][j], 1);
743  }
744 
745  // Add (0.5 g h h) to appropriate field
746  Vmath::Vadd(nq, flux[i + 1][i], 1, tmp, 1, flux[i + 1][i], 1);
747  }
748 
749 }
750 
752  const Array<OneD, const Array<OneD, NekDouble> >&physin,
753  Array<OneD, Array<OneD, NekDouble> >&physout)
754 {
755  int nq = GetTotPoints();
756 
757  if (physin.get() == physout.get())
758  {
759  // copy indata and work with tmp array
761  for (int i = 0; i < 3; ++i)
762  {
763  // deep copy
764  tmp[i] = Array<OneD, NekDouble>(nq);
765  Vmath::Vcopy(nq, physin[i], 1, tmp[i], 1);
766  }
767 
768  // \eta = h - d
769  Vmath::Vsub(nq, tmp[0], 1, m_depth, 1, physout[0], 1);
770 
771  // u = hu/h
772  Vmath::Vdiv(nq, tmp[1], 1, tmp[0], 1, physout[1], 1);
773 
774  // v = hv/ v
775  Vmath::Vdiv(nq, tmp[2], 1, tmp[0], 1, physout[2], 1);
776  }
777  else
778  {
779  // \eta = h - d
780  Vmath::Vsub(nq, physin[0], 1, m_depth, 1, physout[0], 1);
781 
782  // u = hu/h
783  Vmath::Vdiv(nq, physin[1], 1, physin[0], 1, physout[1], 1);
784 
785  // v = hv/ v
786  Vmath::Vdiv(nq, physin[2], 1, physin[0], 1, physout[2], 1);
787  }
788 }
789 
791 {
792  int nq = GetTotPoints();
793 
794  // u = hu/h
795  Vmath::Vdiv(nq, m_fields[1]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
796  m_fields[1]->UpdatePhys(), 1);
797 
798  // v = hv/ v
799  Vmath::Vdiv(nq, m_fields[2]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
800  m_fields[2]->UpdatePhys(), 1);
801 
802  // \eta = h - d
803  Vmath::Vsub(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
804  m_fields[0]->UpdatePhys(), 1);
805 }
806 
808  const Array<OneD, const Array<OneD, NekDouble> >&physin,
809  Array<OneD, Array<OneD, NekDouble> >&physout)
810 {
811 
812  int nq = GetTotPoints();
813 
814  if (physin.get() == physout.get())
815  {
816  // copy indata and work with tmp array
818  for (int i = 0; i < 3; ++i)
819  {
820  // deep copy
821  tmp[i] = Array<OneD, NekDouble>(nq);
822  Vmath::Vcopy(nq, physin[i], 1, tmp[i], 1);
823  }
824 
825  // h = \eta + d
826  Vmath::Vadd(nq, tmp[0], 1, m_depth, 1, physout[0], 1);
827 
828  // hu = h * u
829  Vmath::Vmul(nq, physout[0], 1, tmp[1], 1, physout[1], 1);
830 
831  // hv = h * v
832  Vmath::Vmul(nq, physout[0], 1, tmp[2], 1, physout[2], 1);
833 
834  }
835  else
836  {
837  // h = \eta + d
838  Vmath::Vadd(nq, physin[0], 1, m_depth, 1, physout[0], 1);
839 
840  // hu = h * u
841  Vmath::Vmul(nq, physout[0], 1, physin[1], 1, physout[1], 1);
842 
843  // hv = h * v
844  Vmath::Vmul(nq, physout[0], 1, physin[2], 1, physout[2], 1);
845 
846  }
847 
848 }
849 
851 {
852  int nq = GetTotPoints();
853 
854  // h = \eta + d
855  Vmath::Vadd(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
856  m_fields[0]->UpdatePhys(), 1);
857 
858  // hu = h * u
859  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[1]->GetPhys(), 1,
860  m_fields[1]->UpdatePhys(), 1);
861 
862  // hv = h * v
863  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[2]->GetPhys(), 1,
864  m_fields[2]->UpdatePhys(), 1);
865 }
866 
867 /**
868  * @brief Compute the velocity field \f$ \mathbf{v} \f$ given the momentum
869  * \f$ h\mathbf{v} \f$.
870  *
871  * @param physfield Momentum field.
872  * @param velocity Velocity field.
873  */
875  const Array<OneD, Array<OneD, NekDouble> > &physfield,
876  Array<OneD, Array<OneD, NekDouble> > &velocity)
877 {
878  const int npts = physfield[0].size();
879 
880  for (int i = 0; i < m_spacedim; ++i)
881  {
882  Vmath::Vdiv(npts, physfield[1 + i], 1, physfield[0], 1, velocity[i], 1);
883  }
884 }
885 
887 {
889  SolverUtils::AddSummaryItem(s, "Variables", "h should be in field[0]");
890  SolverUtils::AddSummaryItem(s, "", "hu should be in field[1]");
891  SolverUtils::AddSummaryItem(s, "", "hv should be in field[2]");
892  SolverUtils::AddSummaryItem(s, "", "z should be in field[3]");
893 }
894 
897  NekDouble lambda)
898 {
899  int nq = GetTotPoints();
900 
902 
903  for (int j = 0; j < nq; j++)
904  {
905  (m_fields[3]->UpdatePhys())[j] = fce[j];
906  }
907 
908  m_fields[3]->SetPhysState(true);
909 
910  m_fields[3]->HelmSolve(m_fields[3]->GetPhys(),
911  m_fields[3]->UpdateCoeffs(),
912  m_factors);
913 
914  m_fields[3]->BwdTrans(m_fields[3]->GetCoeffs(), m_fields[3]->UpdatePhys());
915 
916  m_fields[3]->SetPhysState(true);
917 
918  Vmath::Vcopy(nq, m_fields[3]->GetPhys(), 1, fce, 1);
919 }
920 
922  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
923  Array<OneD, NekDouble> &numfluxX,
924  Array<OneD, NekDouble> &numfluxY)
925 {
926  int i;
927  int nTraceNumPoints = GetTraceTotPoints();
928 
929  //-----------------------------------------------------
930  // get temporary arrays
933 
934  for (i = 0; i < 2; ++i)
935  {
936  Fwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
937  Bwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
938  }
939  //-----------------------------------------------------
940 
941  //-----------------------------------------------------
942  // get the physical values at the trace
943  // (any time-dependent BC previuosly put in fields[1] and [2]
944 
945  m_fields[1]->GetFwdBwdTracePhys(inarray[0], Fwd[0], Bwd[0]);
946  m_fields[2]->GetFwdBwdTracePhys(inarray[1], Fwd[1], Bwd[1]);
947  //-----------------------------------------------------
948 
949  //-----------------------------------------------------
950  // use centred fluxes for the numerical flux
951  for (i = 0; i < nTraceNumPoints; ++i)
952  {
953  numfluxX[i] = 0.5 * (Fwd[0][i] + Bwd[0][i]);
954  numfluxY[i] = 0.5 * (Fwd[1][i] + Bwd[1][i]);
955  }
956  //-----------------------------------------------------
957 }
958 
960  Array<OneD, Array<OneD, NekDouble> > &inarray,
961  NekDouble time)
962 {
963  boost::ignore_unused(time);
964 
965  int cnt = 0;
966 
967  // loop over Boundary Regions
968  for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
969  {
970  // Use wall for all BC...
971  // Wall Boundary Condition
972  if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),"Wall"))
973  {
974  WallBoundaryForcing(n, cnt, inarray);
975  }
976 
977  //Timedependent Boundary Condition
978  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
979  {
980  ASSERTL0(false, "time-dependent BC not implemented for Boussinesq");
981  }
982  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
983  }
984 }
985 
986 // fills up boundary expansion for field[1] and [2]
988  int bcRegion,
989  int cnt,
990  Array<OneD, Array<OneD, NekDouble> >&inarray)
991 {
992 
993  //std::cout << " WallBoundaryForcing" << std::endl;
994 
995  int nTraceNumPoints = GetTraceTotPoints();
996  int nvariables = 2;
997 
998  // get physical values of f1 and f2 for the forward trace
999  Array<OneD, Array<OneD, NekDouble> > Fwd(nvariables);
1000  for (int i = 0; i < nvariables; ++i)
1001  {
1002  Fwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
1003  m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
1004  }
1005 
1006  // Adjust the physical values of the trace to take
1007  // user defined boundaries into account
1008  int e, id1, id2, npts;
1010  m_fields[0]->GetBndCondExpansions()[bcRegion];
1011  for (e = 0; e < bcexp->GetExpSize(); ++e)
1012  {
1013  npts = bcexp->GetExp(e)->GetTotPoints();
1014  id1 = bcexp->GetPhys_Offset(e);
1015  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
1016  m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
1017 
1018  switch (m_expdim)
1019  {
1020  case 1:
1021  {
1022  ASSERTL0(false, "1D not yet implemented for Boussinesq");
1023  break;
1024  }
1025  case 2:
1026  {
1027  Array<OneD, NekDouble> tmp_n(npts);
1028  Array<OneD, NekDouble> tmp_t(npts);
1029 
1030  Vmath::Vmul (npts, &Fwd[0][id2], 1, &m_traceNormals[0][id2], 1,
1031  &tmp_n[0], 1);
1032  Vmath::Vvtvp(npts, &Fwd[1][id2], 1, &m_traceNormals[1][id2], 1,
1033  &tmp_n[0], 1, &tmp_n[0], 1);
1034 
1035  Vmath::Vmul (npts, &Fwd[0][id2], 1, &m_traceNormals[1][id2], 1,
1036  &tmp_t[0], 1);
1037  Vmath::Vvtvm(npts, &Fwd[1][id2], 1, &m_traceNormals[0][id2], 1,
1038  &tmp_t[0], 1, &tmp_t[0], 1);
1039 
1040  // negate the normal flux
1041  Vmath::Neg(npts, tmp_n, 1);
1042 
1043  // rotate back to Cartesian
1044  Vmath::Vmul (npts, &tmp_t[0], 1, &m_traceNormals[1][id2], 1,
1045  &Fwd[0][id2], 1);
1046  Vmath::Vvtvm(npts, &tmp_n[0], 1, &m_traceNormals[0][id2], 1,
1047  &Fwd[0][id2], 1, &Fwd[0][id2], 1);
1048 
1049  Vmath::Vmul (npts, &tmp_t[0], 1, &m_traceNormals[0][id2], 1,
1050  &Fwd[1][id2], 1);
1051  Vmath::Vvtvp(npts, &tmp_n[0], 1, &m_traceNormals[1][id2], 1,
1052  &Fwd[1][id2], 1, &Fwd[1][id2], 1);
1053  break;
1054  }
1055  case 3:
1056  ASSERTL0(false, "3D not implemented for Boussinesq equations");
1057  break;
1058  default:
1059  ASSERTL0(false, "Illegal expansion dimension");
1060  }
1061 
1062  // copy boundary adjusted values into the boundary expansion
1063  bcexp = m_fields[1]->GetBndCondExpansions()[bcRegion];
1064  Vmath::Vcopy(npts, &Fwd[0][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1065 
1066  bcexp = m_fields[2]->GetBndCondExpansions()[bcRegion];
1067  Vmath::Vcopy(npts, &Fwd[1][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1068  }
1069 }
1070 
1072  Array<OneD, NekDouble> &inarray,
1073  NekDouble time)
1074 {
1075  boost::ignore_unused(time);
1076 
1077  int cnt = 0;
1078 
1079  // loop over Boundary Regions
1080  for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
1081  {
1082  // Use wall for all
1083  // Wall Boundary Condition
1084  if(boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),"Wall"))
1085  {
1086  WallBoundaryContVariables(n, cnt, inarray);
1087  }
1088 
1089  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
1090  {
1091  WallBoundaryContVariables(n, cnt, inarray);
1092  }
1093 
1094  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize() - 1;
1095  }
1096 }
1097 
1099  int bcRegion,
1100  int cnt,
1101  Array<OneD, NekDouble>&inarray)
1102 {
1103  int nTraceNumPoints = GetTraceTotPoints();
1104 
1105  // get physical values of z for the forward trace
1106  Array<OneD, NekDouble> z(nTraceNumPoints);
1107  m_fields[0]->ExtractTracePhys(inarray, z);
1108 
1109  // Adjust the physical values of the trace to take
1110  // user defined boundaries into account
1111  int e, id1, id2, npts;
1113  m_fields[0]->GetBndCondExpansions()[bcRegion];
1114 
1115  for (e = 0; e < bcexp->GetExpSize(); ++e)
1116  {
1117  npts = bcexp->GetExp(e)->GetTotPoints();
1118  id1 = bcexp->GetPhys_Offset(e);
1119  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
1120  m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
1121 
1122  // copy boundary adjusted values into the boundary expansion
1123  // field[1] and field[2]
1124  bcexp = m_fields[1]->GetBndCondExpansions()[bcRegion];
1125  Vmath::Vcopy(npts, &z[id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1126 
1127  }
1128 }
1129 
1132  Array<OneD, NekDouble> &outY)
1133 {
1134  int i;
1135  int nTraceNumPoints = GetTraceTotPoints();
1136 
1137  //-----------------------------------------------------
1138  // get temporary arrays
1141 
1142  Fwd[0] = Array<OneD, NekDouble>(nTraceNumPoints);
1143  Bwd[0] = Array<OneD, NekDouble>(nTraceNumPoints);
1144  //-----------------------------------------------------
1145 
1146  //-----------------------------------------------------
1147  // get the physical values at the trace
1148  // (we have put any time-dependent BC in field[1])
1149 
1150  m_fields[1]->GetFwdBwdTracePhys(physfield, Fwd[0], Bwd[0]);
1151  //-----------------------------------------------------
1152 
1153  //-----------------------------------------------------
1154  // use centred fluxes for the numerical flux
1155  for (i = 0; i < nTraceNumPoints; ++i)
1156  {
1157  outX[i] = 0.5 * (Fwd[0][i] + Bwd[0][i]);
1158  outY[i] = 0.5 * (Fwd[0][i] + Bwd[0][i]);
1159  }
1160  //-----------------------------------------------------
1161 }
1162 
1163 // initial condition Laitone's first order solitary wave
1165  NekDouble amp,
1166  NekDouble d,
1167  NekDouble time,
1168  NekDouble x_offset)
1169 {
1170  int nq = GetTotPoints();
1171 
1172  NekDouble A = 1.0;
1173  NekDouble C = sqrt(m_g * d) * (1.0 + 0.5 * (amp / d));
1174 
1175  Array<OneD, NekDouble> x0(nq);
1176  Array<OneD, NekDouble> x1(nq);
1177  Array<OneD, NekDouble> zeros(nq, 0.0);
1178 
1179  // get the coordinates (assuming all fields have the same
1180  // discretisation)
1181  m_fields[0]->GetCoords(x0, x1);
1182 
1183  for (int i = 0; i < nq; i++)
1184  {
1185  (m_fields[0]->UpdatePhys())[i] = amp * pow((1.0 / cosh(
1186  sqrt(0.75 * (amp / (d * d * d))) *
1187  (A * (x0[i] + x_offset) - C * time))), 2.0);
1188  (m_fields[1]->UpdatePhys())[i] = (amp / d) * pow((1.0 / cosh(
1189  sqrt(0.75 * (amp / (d * d * d))) *
1190  (A * (x0[i] + x_offset) - C * time)
1191  )), 2.0) * sqrt(m_g * d);
1192  }
1193 
1194  Vmath::Sadd(nq, d, m_fields[0]->GetPhys(), 1, m_fields[0]->UpdatePhys(), 1);
1195  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[1]->GetPhys(), 1,
1196  m_fields[1]->UpdatePhys(), 1);
1197  Vmath::Vcopy(nq, zeros, 1, m_fields[2]->UpdatePhys(), 1);
1198  Vmath::Vcopy(nq, zeros, 1, m_fields[3]->UpdatePhys(), 1);
1199 
1200  // Forward transform to fill the coefficient space
1201  for (int i = 0; i < 4; ++i)
1202  {
1203  m_fields[i]->SetPhysState(true);
1204  m_fields[i]->FwdTrans(m_fields[i]->GetPhys(),
1205  m_fields[i]->UpdateCoeffs());
1206  }
1207 
1208 }
1209 
1210 /**
1211  * @brief Set the initial conditions.
1212  */
1214  NekDouble initialtime,
1215  bool dumpInitialConditions,
1216  const int domain)
1217 {
1218  boost::ignore_unused(domain);
1219 
1220  switch (m_problemType)
1221  {
1222  case eSolitaryWave:
1223  {
1224  LaitoneSolitaryWave(0.1, m_const_depth, 0.0, 0.0);
1225  break;
1226  }
1227  default:
1228  {
1229  EquationSystem::v_SetInitialConditions(initialtime, false);
1230  break;
1231  }
1232  }
1233 
1234  if (dumpInitialConditions)
1235  {
1236  // Dump initial conditions to file
1237  Checkpoint_Output(0);
1238  }
1239 }
1240 
1241 } //end of namespace
1242 
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:200
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:145
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
void SetBoundaryConditionsForcing(Array< OneD, Array< OneD, NekDouble > > &inarray, NekDouble time)
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
void WallBoundaryForcing(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &inarray)
void LaitoneSolitaryWave(NekDouble amp, NekDouble d, NekDouble time, NekDouble x_offset)
void AddVariableDepth(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
virtual void v_InitObject()
Init object for UnsteadySystem class.
void WallBoundary(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
Wall boundary condition.
void NumericalFluxForcing(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &numfluxX, Array< OneD, NekDouble > &numfluxY)
void SetBoundaryConditionsContVariables(Array< OneD, NekDouble > &inarray, NekDouble time)
void AddCoriolis(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
Compute the velocity field given the momentum .
void WallBoundaryContVariables(int bcRegion, int cnt, Array< OneD, NekDouble > &inarray)
void NumericalFluxConsVariables(Array< OneD, NekDouble > &physfield, Array< OneD, NekDouble > &outX, Array< OneD, NekDouble > &outY)
StdRegions::ConstFactorMap m_factors
virtual void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
Set the initial conditions.
void WallBoundary2D(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
virtual ~NonlinearPeregrine()
problem type selector
void WCESolve(Array< OneD, NekDouble > &fce, NekDouble lambda)
Base class for unsteady solvers.
virtual void v_InitObject()
Init object for UnsteadySystem class.
NekDouble m_g
Acceleration of gravity.
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
Array< OneD, Array< OneD, NekDouble > > m_bottomSlope
const Array< OneD, NekDouble > & GetDepth()
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
SolverUtils::AdvectionSharedPtr m_advection
bool m_constantDepth
Indicates if constant depth case.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
Array< OneD, NekDouble > m_coriolis
Coriolis force
Array< OneD, NekDouble > m_depth
Still water depth.
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
int m_spacedim
Spatial dimension (>= expansion dim).
int m_expdim
Expansion dimension.
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
SOLVER_UTILS_EXPORT int GetNpoints()
SOLVER_UTILS_EXPORT int GetNcoeffs()
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()
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
bool m_explicitAdvection
Indicates if explicit or implicit treatment of advection is used.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:47
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
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()
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
const char *const ProblemTypeMap[]
@ SIZE_ProblemType
Length of enum list.
@ eSolitaryWave
First order Laitone solitary wave.
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.cpp:192
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:461
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:513
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.cpp:322
void Vvtvm(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvm (vector times vector plus vector): z = w*x - y
Definition: Vmath.cpp:541
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.cpp:225
void Vdiv(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.cpp:257
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha - x.
Definition: Vmath.cpp:341
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1199
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.cpp:372
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:267