Nektar++
LinearSWE.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File LinearSWE.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: Linear Shallow water equations in primitive variables
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #include <iostream>
36 #include <iomanip>
37 #include <boost/algorithm/string.hpp>
38 
41 
42 using namespace std;
43 
44 namespace Nektar
45 {
46  string LinearSWE::className =
48  "LinearSWE", LinearSWE::create,
49  "Linear shallow water equation in primitive variables.");
50 
51  LinearSWE::LinearSWE(
54  : ShallowWaterSystem(pSession, pGraph)
55  {
56  }
57 
59  {
61 
63  {
66  }
67  else
68  {
69  ASSERTL0(false, "Implicit SWE not set up.");
70  }
71 
72  // Type of advection class to be used
73  switch(m_projectionType)
74  {
75  // Continuous field
77  {
78  // Do nothing
79  break;
80  }
81  // Discontinuous field
83  {
84  string advName;
85  string diffName;
86  string riemName;
87 
88  //---------------------------------------------------------------
89  // Setting up advection and diffusion operators
90  // NB: diffusion not set up for SWE at the moment
91  // but kept here for future use ...
92  m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
93  // m_session->LoadSolverInfo("DiffusionType", diffName, "LDGEddy");
95  .CreateInstance(advName, advName);
96  // m_diffusion = SolverUtils::GetDiffusionFactory()
97  // .CreateInstance(diffName, diffName);
98 
99  m_advection->SetFluxVector(&LinearSWE::GetFluxVector, this);
100  // m_diffusion->SetFluxVectorNS(&ShallowWaterSystem::
101  // GetEddyViscosityFluxVector, this);
102 
103  // Setting up Riemann solver for advection operator
104  m_session->LoadSolverInfo("UpwindType", riemName, "NoSolver");
105  if ((riemName == "LinearHLL") && (m_constantDepth != true))
106  {
107  ASSERTL0(false,"LinearHLL only valid for constant depth");
108  }
110  .CreateInstance(riemName, m_session);
111 
112  // Setting up upwind solver for diffusion operator
113  // m_riemannSolverLDG = SolverUtils::GetRiemannSolverFactory()
114  // .CreateInstance("UpwindLDG");
115 
116  // Setting up parameters for advection operator Riemann solver
117  m_riemannSolver->SetParam (
118  "gravity",
119  &LinearSWE::GetGravity, this);
120  m_riemannSolver->SetAuxVec(
121  "vecLocs",
122  &LinearSWE::GetVecLocs, this);
123  m_riemannSolver->SetVector(
124  "N",
125  &LinearSWE::GetNormals, this);
126 
127  // The numerical flux for linear SWE requires depth information
128  int nTracePointsTot = m_fields[0]->GetTrace()->GetTotPoints();
129  m_dFwd = Array<OneD, NekDouble>(nTracePointsTot);
130  m_dBwd = Array<OneD, NekDouble>(nTracePointsTot);
131  m_fields[0]->GetFwdBwdTracePhys(m_depth, m_dFwd, m_dBwd);
133  m_riemannSolver->SetScalar(
134  "depthFwd",
135  &LinearSWE::GetDepthFwd, this);
136  m_riemannSolver->SetScalar(
137  "depthBwd",
138  &LinearSWE::GetDepthBwd, this);
139 
140  // Setting up parameters for diffusion operator Riemann solver
141  // m_riemannSolverLDG->AddParam (
142  // "gravity",
143  // &NonlinearSWE::GetGravity, this);
144  // m_riemannSolverLDG->SetAuxVec(
145  // "vecLocs",
146  // &NonlinearSWE::GetVecLocs, this);
147  // m_riemannSolverLDG->AddVector(
148  // "N",
149  // &NonlinearSWE::GetNormals, this);
150 
151  // Concluding initialisation of advection / diffusion operators
152  m_advection->SetRiemannSolver (m_riemannSolver);
153  //m_diffusion->SetRiemannSolver (m_riemannSolverLDG);
154  m_advection->InitObject (m_session, m_fields);
155  //m_diffusion->InitObject (m_session, m_fields);
156  break;
157  }
158  default:
159  {
160  ASSERTL0(false, "Unsupported projection type.");
161  break;
162  }
163  }
164 
165 
166  }
167 
169  {
170 
171  }
172 
173  // physarray contains the conservative variables
174  void LinearSWE::AddCoriolis(const Array<OneD, const Array<OneD, NekDouble> > &physarray,
175  Array<OneD, Array<OneD, NekDouble> > &outarray)
176  {
177 
178  int ncoeffs = GetNcoeffs();
179  int nq = GetTotPoints();
180 
181  Array<OneD, NekDouble> tmp(nq);
182  Array<OneD, NekDouble> mod(ncoeffs);
183 
184  switch(m_projectionType)
185  {
187  {
188  // add to u equation
189  Vmath::Vmul(nq,m_coriolis,1,physarray[2],1,tmp,1);
190  m_fields[0]->IProductWRTBase(tmp,mod);
191  m_fields[0]->MultiplyByElmtInvMass(mod,mod);
192  m_fields[0]->BwdTrans(mod,tmp);
193  Vmath::Vadd(nq,tmp,1,outarray[1],1,outarray[1],1);
194 
195  // add to v equation
196  Vmath::Vmul(nq,m_coriolis,1,physarray[1],1,tmp,1);
197  Vmath::Neg(nq,tmp,1);
198  m_fields[0]->IProductWRTBase(tmp,mod);
199  m_fields[0]->MultiplyByElmtInvMass(mod,mod);
200  m_fields[0]->BwdTrans(mod,tmp);
201  Vmath::Vadd(nq,tmp,1,outarray[2],1,outarray[2],1);
202  }
203  break;
206  {
207  // add to u equation
208  Vmath::Vmul(nq,m_coriolis,1,physarray[2],1,tmp,1);
209  Vmath::Vadd(nq,tmp,1,outarray[1],1,outarray[1],1);
210 
211  // add to v equation
212  Vmath::Vmul(nq,m_coriolis,1,physarray[1],1,tmp,1);
213  Vmath::Neg(nq,tmp,1);
214  Vmath::Vadd(nq,tmp,1,outarray[2],1,outarray[2],1);
215  }
216  break;
217  default:
218  ASSERTL0(false,"Unknown projection scheme for the NonlinearSWE");
219  break;
220  }
221 
222 
223  }
224 
226  Array<OneD, Array<OneD, NekDouble> >&outarray,
227  const NekDouble time)
228  {
229  int i, j;
230  int ndim = m_spacedim;
231  int nvariables = inarray.size();
232  int nq = GetTotPoints();
233 
234 
235  switch(m_projectionType)
236  {
238  {
239 
240  //-------------------------------------------------------
241  // Compute the DG advection including the numerical flux
242  // by using SolverUtils/Advection
243  // Input and output in physical space
245 
246  m_advection->Advect(nvariables, m_fields, advVel, inarray,
247  outarray, time);
248  //-------------------------------------------------------
249 
250 
251  //-------------------------------------------------------
252  // negate the outarray since moving terms to the rhs
253  for(i = 0; i < nvariables; ++i)
254  {
255  Vmath::Neg(nq,outarray[i],1);
256  }
257  //-------------------------------------------------------
258 
259 
260  //-------------------------------------------------
261  // Add "source terms"
262  // Input and output in physical space
263 
264  // Coriolis forcing
265  if (m_coriolis.size() != 0)
266  {
267  AddCoriolis(inarray,outarray);
268  }
269  //-------------------------------------------------
270 
271  }
272  break;
275  {
276 
277  //-------------------------------------------------------
278  // Compute the fluxvector in physical space
280  fluxvector(nvariables);
281 
282  for (i = 0; i < nvariables; ++i)
283  {
284  fluxvector[i] = Array<OneD, Array<OneD, NekDouble> >(ndim);
285  for(j = 0; j < ndim; ++j)
286  {
287  fluxvector[i][j] = Array<OneD, NekDouble>(nq);
288  }
289  }
290 
291  LinearSWE::GetFluxVector(inarray, fluxvector);
292  //-------------------------------------------------------
293 
294 
295  //-------------------------------------------------------
296  // Take the derivative of the flux terms
297  // and negate the outarray since moving terms to the rhs
298  Array<OneD,NekDouble> tmp(nq);
299  Array<OneD, NekDouble>tmp1(nq);
300 
301  for(i = 0; i < nvariables; ++i)
302  {
303  m_fields[i]->PhysDeriv(MultiRegions::DirCartesianMap[0],fluxvector[i][0],tmp);
304  m_fields[i]->PhysDeriv(MultiRegions::DirCartesianMap[1],fluxvector[i][1],tmp1);
305  Vmath::Vadd(nq,tmp,1,tmp1,1,outarray[i],1);
306  Vmath::Neg(nq,outarray[i],1);
307  }
308 
309  //-------------------------------------------------
310  // Add "source terms"
311  // Input and output in physical space
312 
313  // Coriolis forcing
314  if (m_coriolis.size() != 0)
315  {
316  AddCoriolis(inarray,outarray);
317  }
318  //-------------------------------------------------
319  }
320  break;
321  default:
322  ASSERTL0(false,"Unknown projection scheme for the NonlinearSWE");
323  break;
324  }
325  }
326 
327 
329  Array<OneD, Array<OneD, NekDouble> >&outarray,
330  const NekDouble time)
331  {
332  int i;
333  int nvariables = inarray.size();
334 
335 
336  switch(m_projectionType)
337  {
339  {
340 
341  // Just copy over array
342  int npoints = GetNpoints();
343 
344  for(i = 0; i < nvariables; ++i)
345  {
346  Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
347  }
348  SetBoundaryConditions(outarray, time);
349  break;
350  }
353  {
354 
356  Array<OneD, NekDouble> coeffs(m_fields[0]->GetNcoeffs(),0.0);
357 
358  for(i = 0; i < nvariables; ++i)
359  {
360  m_fields[i]->FwdTrans(inarray[i],coeffs);
361  m_fields[i]->BwdTrans_IterPerExp(coeffs,outarray[i]);
362  }
363  break;
364  }
365  default:
366  ASSERTL0(false,"Unknown projection scheme");
367  break;
368  }
369  }
370 
371 
372  //----------------------------------------------------
374  Array<OneD, Array<OneD, NekDouble> > &inarray,
375  NekDouble time)
376  {
377  std::string varName;
378  int nvariables = m_fields.size();
379  int cnt = 0;
380  int nTracePts = GetTraceTotPoints();
381 
382  // Extract trace for boundaries. Needs to be done on all processors to avoid
383  // deadlock.
384  Array<OneD, Array<OneD, NekDouble> > Fwd(nvariables);
385  for (int i = 0; i < nvariables; ++i)
386  {
387  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
388  m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
389  }
390 
391  // loop over Boundary Regions
392  for(int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
393  {
394  if (m_fields[0]->GetBndConditions()[n]->GetBoundaryConditionType()
396  {
397  continue;
398  }
399 
400  // Wall Boundary Condition
401  if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),"Wall"))
402  {
403  WallBoundary2D(n, cnt, Fwd, inarray);
404  }
405 
406  // Time Dependent Boundary Condition (specified in meshfile)
407  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
408  {
409  for (int i = 0; i < nvariables; ++i)
410  {
411  varName = m_session->GetVariable(i);
412  m_fields[i]->EvaluateBoundaryConditions(time, varName);
413  }
414  }
415  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
416  }
417  }
418 
419  //----------------------------------------------------
420  /**
421  * @brief Wall boundary condition.
422  */
424  int bcRegion,
425  int cnt,
427  Array<OneD, Array<OneD, NekDouble> > &physarray)
428  {
429  int i;
430  int nvariables = physarray.size();
431 
432  // Adjust the physical values of the trace to take
433  // user defined boundaries into account
434  int e, id1, id2, npts;
435 
436  for (e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion]
437  ->GetExpSize(); ++e)
438  {
439  npts = m_fields[0]->GetBndCondExpansions()[bcRegion]->
440  GetExp(e)->GetTotPoints();
441  id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]->
442  GetPhys_Offset(e);
443  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
444  m_fields[0]->GetTraceMap()->
445  GetBndCondIDToGlobalTraceID(cnt+e));
446 
447  // For 2D/3D, define: v* = v - 2(v.n)n
448  Array<OneD, NekDouble> tmp(npts, 0.0);
449 
450  // Calculate (v.n)
451  for (i = 0; i < m_spacedim; ++i)
452  {
453  Vmath::Vvtvp(npts,
454  &Fwd[1+i][id2], 1,
455  &m_traceNormals[i][id2], 1,
456  &tmp[0], 1,
457  &tmp[0], 1);
458  }
459 
460  // Calculate 2.0(v.n)
461  Vmath::Smul(npts, -2.0, &tmp[0], 1, &tmp[0], 1);
462 
463  // Calculate v* = v - 2.0(v.n)n
464  for (i = 0; i < m_spacedim; ++i)
465  {
466  Vmath::Vvtvp(npts,
467  &tmp[0], 1,
468  &m_traceNormals[i][id2], 1,
469  &Fwd[1+i][id2], 1,
470  &Fwd[1+i][id2], 1);
471  }
472 
473  // copy boundary adjusted values into the boundary expansion
474  for (i = 0; i < nvariables; ++i)
475  {
476  Vmath::Vcopy(npts, &Fwd[i][id2], 1,
477  &(m_fields[i]->GetBndCondExpansions()[bcRegion]->
478  UpdatePhys())[id1], 1);
479  }
480  }
481  }
482 
483 
484  void LinearSWE::WallBoundary2D(int bcRegion, int cnt, Array<OneD, Array<OneD, NekDouble> > &Fwd, Array<OneD, Array<OneD, NekDouble> > &physarray)
485  {
486 
487  int i;
488  int nvariables = physarray.size();
489 
490  // Adjust the physical values of the trace to take
491  // user defined boundaries into account
492  int e, id1, id2, npts;
493 
494  for(e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); ++e)
495  {
496  npts = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExp(e)->
497  GetNumPoints(0);
498  id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e) ;
499  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(m_fields[0]->GetTraceMap()->
500  GetBndCondIDToGlobalTraceID(cnt+e));
501 
502  switch(m_expdim)
503  {
504  case 1:
505  {
506  // negate the forward flux
507  Vmath::Neg(npts,&Fwd[1][id2],1);
508  }
509  break;
510  case 2:
511  {
512  Array<OneD, NekDouble> tmp_n(npts);
513  Array<OneD, NekDouble> tmp_t(npts);
514 
515  Vmath::Vmul(npts,&Fwd[1][id2],1,&m_traceNormals[0][id2],1,&tmp_n[0],1);
516  Vmath::Vvtvp(npts,&Fwd[2][id2],1,&m_traceNormals[1][id2],1,&tmp_n[0],1,&tmp_n[0],1);
517 
518  Vmath::Vmul(npts,&Fwd[1][id2],1,&m_traceNormals[1][id2],1,&tmp_t[0],1);
519  Vmath::Vvtvm(npts,&Fwd[2][id2],1,&m_traceNormals[0][id2],1,&tmp_t[0],1,&tmp_t[0],1);
520 
521  // negate the normal flux
522  Vmath::Neg(npts,tmp_n,1);
523 
524  // rotate back to Cartesian
525  Vmath::Vmul(npts,&tmp_t[0],1,&m_traceNormals[1][id2],1,&Fwd[1][id2],1);
526  Vmath::Vvtvm(npts,&tmp_n[0],1,&m_traceNormals[0][id2],1,&Fwd[1][id2],1,&Fwd[1][id2],1);
527 
528  Vmath::Vmul(npts,&tmp_t[0],1,&m_traceNormals[0][id2],1,&Fwd[2][id2],1);
529  Vmath::Vvtvp(npts,&tmp_n[0],1,&m_traceNormals[1][id2],1,&Fwd[2][id2],1,&Fwd[2][id2],1);
530  }
531  break;
532  case 3:
533  ASSERTL0(false,"3D not implemented for Shallow Water Equations");
534  break;
535  default:
536  ASSERTL0(false,"Illegal expansion dimension");
537  }
538 
539 
540 
541  // copy boundary adjusted values into the boundary expansion
542  for (i = 0; i < nvariables; ++i)
543  {
544  Vmath::Vcopy(npts,&Fwd[i][id2], 1,&(m_fields[i]->GetBndCondExpansions()[bcRegion]->UpdatePhys())[id1],1);
545  }
546  }
547  }
548 
549 
550  // Physfield in primitive Form
552  const Array<OneD, const Array<OneD, NekDouble> > &physfield,
554  {
555  int i, j;
556  int nq = m_fields[0]->GetTotPoints();
557 
558  NekDouble g = m_g;
559 
560  // Flux vector for the mass equation
561  for (i = 0; i < m_spacedim; ++i)
562  {
563  Vmath::Vmul(nq, m_depth, 1, physfield[i+1], 1, flux[0][i], 1);
564  }
565 
566  // Put (g eta) in tmp
567  Array<OneD, NekDouble> tmp(nq);
568  Vmath::Smul(nq, g, physfield[0], 1, tmp, 1);
569 
570  // Flux vector for the momentum equations
571  for (i = 0; i < m_spacedim; ++i)
572  {
573  for (j = 0; j < m_spacedim; ++j)
574  {
575  // must zero fluxes as not initialised to zero in AdvectionWeakDG ...
576  Vmath::Zero(nq, flux[i+1][j], 1);
577  }
578 
579  // Add (g eta) to appropriate field
580  Vmath::Vadd(nq, flux[i+1][i], 1, tmp, 1, flux[i+1][i], 1);
581  }
582 
583  }
584 
586  Array<OneD, Array<OneD, NekDouble> >&physout)
587  {
588  int nq = GetTotPoints();
589 
590  if(physin.get() == physout.get())
591  {
592  // copy indata and work with tmp array
594  for (int i = 0; i < 3; ++i)
595  {
596  // deep copy
597  tmp[i] = Array<OneD, NekDouble>(nq);
598  Vmath::Vcopy(nq,physin[i],1,tmp[i],1);
599  }
600 
601  // \eta = h - d
602  Vmath::Vsub(nq,tmp[0],1,m_depth,1,physout[0],1);
603 
604  // u = hu/h
605  Vmath::Vdiv(nq,tmp[1],1,tmp[0],1,physout[1],1);
606 
607  // v = hv/ v
608  Vmath::Vdiv(nq,tmp[2],1,tmp[0],1,physout[2],1);
609  }
610  else
611  {
612  // \eta = h - d
613  Vmath::Vsub(nq,physin[0],1,m_depth,1,physout[0],1);
614 
615  // u = hu/h
616  Vmath::Vdiv(nq,physin[1],1,physin[0],1,physout[1],1);
617 
618  // v = hv/ v
619  Vmath::Vdiv(nq,physin[2],1,physin[0],1,physout[2],1);
620  }
621  }
622 
623 
625  {
626  int nq = GetTotPoints();
627 
628  // u = hu/h
629  Vmath::Vdiv(nq,m_fields[1]->GetPhys(),1,m_fields[0]->GetPhys(),1,m_fields[1]->UpdatePhys(),1);
630 
631  // v = hv/ v
632  Vmath::Vdiv(nq,m_fields[2]->GetPhys(),1,m_fields[0]->GetPhys(),1,m_fields[2]->UpdatePhys(),1);
633 
634  // \eta = h - d
635  Vmath::Vsub(nq,m_fields[0]->GetPhys(),1,m_depth,1,m_fields[0]->UpdatePhys(),1);
636  }
637 
639  Array<OneD, Array<OneD, NekDouble> >&physout)
640  {
641 
642  int nq = GetTotPoints();
643 
644  if(physin.get() == physout.get())
645  {
646  // copy indata and work with tmp array
648  for (int i = 0; i < 3; ++i)
649  {
650  // deep copy
651  tmp[i] = Array<OneD, NekDouble>(nq);
652  Vmath::Vcopy(nq,physin[i],1,tmp[i],1);
653  }
654 
655  // h = \eta + d
656  Vmath::Vadd(nq,tmp[0],1,m_depth,1,physout[0],1);
657 
658  // hu = h * u
659  Vmath::Vmul(nq,physout[0],1,tmp[1],1,physout[1],1);
660 
661  // hv = h * v
662  Vmath::Vmul(nq,physout[0],1,tmp[2],1,physout[2],1);
663 
664  }
665  else
666  {
667  // h = \eta + d
668  Vmath::Vadd(nq,physin[0],1,m_depth,1,physout[0],1);
669 
670  // hu = h * u
671  Vmath::Vmul(nq,physout[0],1,physin[1],1,physout[1],1);
672 
673  // hv = h * v
674  Vmath::Vmul(nq,physout[0],1,physin[2],1,physout[2],1);
675 
676  }
677 
678  }
679 
681  {
682  int nq = GetTotPoints();
683 
684  // h = \eta + d
685  Vmath::Vadd(nq,m_fields[0]->GetPhys(),1,m_depth,1,m_fields[0]->UpdatePhys(),1);
686 
687  // hu = h * u
688  Vmath::Vmul(nq,m_fields[0]->GetPhys(),1,m_fields[1]->GetPhys(),1,m_fields[1]->UpdatePhys(),1);
689 
690  // hv = h * v
691  Vmath::Vmul(nq,m_fields[0]->GetPhys(),1,m_fields[2]->GetPhys(),1,m_fields[2]->UpdatePhys(),1);
692  }
693 
694 
695  /**
696  * @brief Compute the velocity field \f$ \mathbf{v} \f$ given the momentum
697  * \f$ h\mathbf{v} \f$.
698  *
699  * @param physfield Velocity field.
700  * @param velocity Velocity field.
701  */
703  const Array<OneD, Array<OneD, NekDouble> > &physfield,
704  Array<OneD, Array<OneD, NekDouble> > &velocity)
705  {
706  const int npts = physfield[0].size();
707 
708  for (int i = 0; i < m_spacedim; ++i)
709  {
710  Vmath::Vcopy(npts, physfield[1+i], 1, velocity[i], 1);
711  }
712  }
713 
714 
716  {
718  if (m_session->DefinesSolverInfo("UpwindType"))
719  {
720  std::string UpwindType;
721  UpwindType = m_session->GetSolverInfo("UpwindType");
722  if (UpwindType == "LinearAverage")
723  {
724  SolverUtils::AddSummaryItem(s, "Riemann Solver", "Linear Average");
725  }
726  if (UpwindType == "LinearHLL")
727  {
728  SolverUtils::AddSummaryItem(s, "Riemann Solver", "Linear HLL");
729  }
730  }
731  SolverUtils::AddSummaryItem(s, "Variables", "eta should be in field[0]");
732  SolverUtils::AddSummaryItem(s, "", "u should be in field[1]");
733  SolverUtils::AddSummaryItem(s, "", "v should be in field[2]");
734  }
735 
736 } //end of namespace
737 
#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)
virtual ~LinearSWE()
Definition: LinearSWE.cpp:168
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
Definition: LinearSWE.cpp:715
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
Compute the velocity field given the momentum .
Definition: LinearSWE.cpp:702
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Definition: LinearSWE.cpp:225
virtual void v_ConservativeToPrimitive()
Definition: LinearSWE.cpp:624
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Definition: LinearSWE.cpp:328
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
Definition: LinearSWE.cpp:373
const Array< OneD, NekDouble > & GetDepthFwd()
Definition: LinearSWE.h:98
void WallBoundary2D(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
Definition: LinearSWE.cpp:484
virtual void v_InitObject()
Init object for UnsteadySystem class.
Definition: LinearSWE.cpp:58
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
Definition: LinearSWE.cpp:551
virtual void v_PrimitiveToConservative()
Definition: LinearSWE.cpp:680
Array< OneD, NekDouble > m_dFwd
Still water depth traces.
Definition: LinearSWE.h:77
Array< OneD, NekDouble > m_dBwd
Definition: LinearSWE.h:78
const Array< OneD, NekDouble > & GetDepthBwd()
Definition: LinearSWE.h:102
void WallBoundary(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
Wall boundary condition.
Definition: LinearSWE.cpp:423
void AddCoriolis(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: LinearSWE.cpp:174
Base class for unsteady solvers.
virtual void v_InitObject()
Init object for UnsteadySystem class.
NekDouble m_g
Acceleration of gravity.
void CopyBoundaryTrace(const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
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.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetExpSize()
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 int GetPhys_Offset(int n)
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
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:90
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
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 Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:436
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