Nektar++
AcousticSystem.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File AcousticSystem.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2018 Kilian Lackhove
10 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
11 // Department of Aeronautics, Imperial College London (UK), and Scientific
12 // Computing and Imaging Institute, University of Utah (USA).
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: AcousticSystem
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #include <iostream>
37 
38 // Define variable to avoid deprecated warning in Boost 1.69.
39 #include <boost/version.hpp>
40 #if BOOST_VERSION >= 106900 && BOOST_VERSION < 107000
41 #define BOOST_ALLOW_DEPRECATED_HEADERS
42 #endif
43 
44 #include <boost/core/ignore_unused.hpp>
45 #include <boost/random/normal_distribution.hpp>
46 #include <boost/random/variate_generator.hpp>
47 
49 
51 
52 using namespace std;
53 
54 namespace Nektar
55 {
56 
57 AcousticSystem::AcousticSystem(
60  : UnsteadySystem(pSession, pGraph), AdvectionSystem(pSession, pGraph),
61  m_ip(-1), m_irho(-1), m_iu(1), m_conservative(false)
62 {
63 }
64 
65 /**
66  * @brief Initialization object for the AcousticSystem class.
67  */
69 {
71 
72  ASSERTL0(
74  "Only Projection=DisContinuous supported by the AcousticSystem class.");
75 
76  m_bfNames.push_back("c0sq");
77  m_bfNames.push_back("rho0");
78  m_bfNames.push_back("u0");
79  m_bfNames.push_back("v0");
80  m_bfNames.push_back("w0");
81 
82  // Resize the advection velocities vector to dimension of the problem
83  m_bfNames.resize(m_spacedim + 2);
84 
85  m_forcing = SolverUtils::Forcing::Load(m_session, shared_from_this(),
86  m_fields, m_fields.num_elements());
87 
88  // Do not forwards transform initial condition
89  m_homoInitialFwd = false;
90 
91  // Set up locations of velocity and base velocity vectors.
94  for (int i = 0; i < m_spacedim; ++i)
95  {
96  // u', v', w'
97  m_vecLocs[0][i] = m_iu + i;
98  }
99 
100  if (m_session->DefinesElement("Nektar/Coupling"))
101  {
102  TiXmlElement *vCoupling = m_session->GetElement("Nektar/Coupling");
103 
104  ASSERTL0(vCoupling->Attribute("TYPE"),
105  "Missing TYPE attribute in Coupling");
106  string vType = vCoupling->Attribute("TYPE");
107  ASSERTL0(!vType.empty(),
108  "TYPE attribute must be non-empty in Coupling");
109 
110  m_coupling = GetCouplingFactory().CreateInstance(vType, m_fields[0]);
111  }
112 
114  m_whiteNoiseBC_p = 0.0;
115 }
116 
117 /**
118  * @brief Destructor for AcousticSystem class.
119  */
121 {
122 }
123 
124 /**
125  * @brief v_PreIntegrate
126  */
128 {
129  GetFunction("Baseflow", m_fields[0], true)
130  ->Evaluate(m_bfNames, m_bf, m_time);
131 
132  if (m_coupling)
133  {
134  int numForceFields = 0;
135  for (auto &x : m_forcing)
136  {
137  numForceFields += x->GetForces().num_elements();
138  }
139  vector<string> varNames;
141  m_fields.num_elements() + m_bfNames.size() + numForceFields);
142  for (int i = 0; i < m_fields.num_elements(); ++i)
143  {
144  varNames.push_back(m_session->GetVariable(i));
145  phys[i] = m_fields[i]->UpdatePhys();
146  }
147  for (int i = 0; i < m_bfNames.size(); ++i)
148  {
149  varNames.push_back(m_bfNames[i]);
150  phys[m_fields.num_elements() + i] = m_bf[i];
151  }
152 
153  int f = 0;
154  for (auto &x : m_forcing)
155  {
156  for (int i = 0; i < x->GetForces().num_elements(); ++i)
157  {
158  phys[m_fields.num_elements() + m_bfNames.size() + f + i] =
159  x->GetForces()[i];
160  varNames.push_back("F_" + boost::lexical_cast<string>(f) + "_" +
161  m_session->GetVariable(i));
162  }
163  f++;
164  }
165 
166  m_coupling->Send(step, m_time, phys, varNames);
167  m_coupling->Receive(step, m_time, phys, varNames);
168  }
169 
170  return AdvectionSystem::v_PreIntegrate(step);
171 }
172 
174 {
175  if (m_coupling)
176  {
177  m_coupling->Finalize();
178  }
179 
181 }
182 
183 /**
184  * @brief Compute the right-hand side.
185  */
187  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
188  Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
189 {
190  int nVariables = inarray.num_elements();
191  int nq = GetTotPoints();
192 
193  // WeakDG does not use advVel, so we only provide a dummy array
195  m_advection->Advect(nVariables, m_fields, advVel, inarray, outarray, time);
196 
197  // Negate the LHS terms
198  for (int i = 0; i < nVariables; ++i)
199  {
200  Vmath::Neg(nq, outarray[i], 1);
201  }
202 
203  v_AddLinTerm(inarray, outarray);
204 
205  for (auto &x : m_forcing)
206  {
207  x->Apply(m_fields, inarray, outarray, m_time);
208  }
209 }
210 
211 /**
212  * @brief Compute the projection and call the method for imposing the
213  * boundary conditions in case of discontinuous projection.
214  */
216  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
217  Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time)
218 {
219  int nvariables = inarray.num_elements();
220  int nq = m_fields[0]->GetNpoints();
221 
222  // deep copy
223  for (int i = 0; i < nvariables; ++i)
224  {
225  Vmath::Vcopy(nq, inarray[i], 1, outarray[i], 1);
226  }
227 
229 
230  SetBoundaryConditions(outarray, time);
231 }
232 
233 /**
234  * @brief Apply the Boundary Conditions to the AcousticSystem equations.
235  */
237  Array<OneD, Array<OneD, NekDouble>> &inarray, NekDouble time)
238 {
239  std::string varName;
240  int nvariables = m_fields.num_elements();
241  int cnt = 0;
242  int nTracePts = GetTraceTotPoints();
243 
244  // Extract trace for boundaries. Needs to be done on all processors to avoid
245  // deadlock.
246  Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
247  for (int i = 0; i < nvariables; ++i)
248  {
249  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
250  m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
251  }
253 
254  // loop over Boundary Regions
255  for (int n = 0; n < m_fields[0]->GetBndConditions().num_elements(); ++n)
256  {
257  std::string userDefStr =
258  m_fields[0]->GetBndConditions()[n]->GetUserDefined();
259 
260  if (!userDefStr.empty())
261  {
262  // Wall Boundary Condition
263  if (boost::iequals(userDefStr, "Wall"))
264  {
265  v_WallBC(n, cnt, Fwd, inarray);
266  }
267  else if (boost::iequals(userDefStr, "WhiteNoise"))
268  {
269  v_WhiteNoiseBC(n, cnt, Fwd, bfFwd, inarray);
270  }
271  else if (boost::iequals(userDefStr, "RiemannInvariantBC"))
272  {
273  v_RiemannInvariantBC(n, cnt, Fwd, bfFwd, inarray);
274  }
275  else if (boost::iequals(userDefStr, "TimeDependent"))
276  {
277  for (int i = 0; i < nvariables; ++i)
278  {
279  varName = m_session->GetVariable(i);
280  m_fields[i]->EvaluateBoundaryConditions(time, varName);
281  }
282  }
283  else
284  {
285  string errmsg = "Unrecognised boundary condition: ";
286  errmsg += userDefStr;
287  ASSERTL0(false, errmsg.c_str());
288  }
289  }
290  else
291  {
292  for (int i = 0; i < nvariables; ++i)
293  {
294  varName = m_session->GetVariable(i);
295  m_fields[i]->EvaluateBoundaryConditions(time, varName);
296  }
297  }
298 
299  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
300  }
301 }
302 
303 /**
304  * @brief Wall boundary conditions for the AcousticSystem equations.
305  */
306 void AcousticSystem::v_WallBC(int bcRegion, int cnt,
308  Array<OneD, Array<OneD, NekDouble>> &physarray)
309 {
310  int nVariables = physarray.num_elements();
311 
312  const Array<OneD, const int> &traceBndMap = m_fields[0]->GetTraceBndMap();
313 
314  // Adjust the physical values of the trace to take
315  // user defined boundaries into account
316  int id1, id2, nBCEdgePts;
317  int eMax = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
318 
319  for (int e = 0; e < eMax; ++e)
320  {
321  nBCEdgePts = m_fields[0]
322  ->GetBndCondExpansions()[bcRegion]
323  ->GetExp(e)
324  ->GetTotPoints();
325  id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e);
326  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[cnt + e]);
327 
328  // For 2D/3D, define: v* = v - 2(v.n)n
329  Array<OneD, NekDouble> tmp(nBCEdgePts, 0.0);
330 
331  // Calculate (v.n)
332  for (int i = 0; i < m_spacedim; ++i)
333  {
334  Vmath::Vvtvp(nBCEdgePts, &Fwd[m_iu + i][id2], 1,
335  &m_traceNormals[i][id2], 1, &tmp[0], 1, &tmp[0], 1);
336  }
337 
338  // Calculate 2.0(v.n)
339  Vmath::Smul(nBCEdgePts, -2.0, &tmp[0], 1, &tmp[0], 1);
340 
341  // Calculate v* = v - 2.0(v.n)n
342  for (int i = 0; i < m_spacedim; ++i)
343  {
344  Vmath::Vvtvp(nBCEdgePts, &tmp[0], 1, &m_traceNormals[i][id2], 1,
345  &Fwd[m_iu + i][id2], 1, &Fwd[m_iu + i][id2], 1);
346  }
347 
348  // Copy boundary adjusted values into the boundary expansion
349  for (int i = 0; i < nVariables; ++i)
350  {
351  Vmath::Vcopy(nBCEdgePts, &Fwd[i][id2], 1,
352  &(m_fields[i]
353  ->GetBndCondExpansions()[bcRegion]
354  ->UpdatePhys())[id1],
355  1);
356  }
357  }
358 }
359 
360 /**
361  * @brief Wall boundary conditions for the AcousticSystem equations.
362  */
364  int bcRegion, int cnt, Array<OneD, Array<OneD, NekDouble>> &Fwd,
366  Array<OneD, Array<OneD, NekDouble>> &physarray)
367 {
368  boost::ignore_unused(Fwd);
369 
370  int id1, id2, nBCEdgePts;
371  int nVariables = physarray.num_elements();
372 
373  const Array<OneD, const int> &traceBndMap = m_fields[0]->GetTraceBndMap();
374 
375  if (m_rng.count(bcRegion) == 0)
376  {
377  m_rng[bcRegion] = boost::mt19937(bcRegion);
378  }
379 
380  ASSERTL0(
381  m_fields[0]->GetBndConditions()[bcRegion]->GetBoundaryConditionType() ==
383  "WhiteNoise BCs must be Dirichlet type BCs");
384 
386  std::static_pointer_cast<SpatialDomains::DirichletBoundaryCondition>(
387  m_fields[0]->GetBndConditions()[bcRegion])
388  ->m_dirichletCondition;
389  NekDouble sigma = cond.Evaluate();
390 
392  "sigma must be greater than zero");
393 
394  // random velocity perturbation
396  {
398 
399  boost::normal_distribution<> dist(0, sigma);
400  m_whiteNoiseBC_p = dist(m_rng[bcRegion]);
401  }
402 
403  int eMax = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
404  for (int e = 0; e < eMax; ++e)
405  {
406  nBCEdgePts = m_fields[0]
407  ->GetBndCondExpansions()[bcRegion]
408  ->GetExp(e)
409  ->GetTotPoints();
410  id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e);
411  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[cnt + e]);
412 
413  Array<OneD, Array<OneD, NekDouble>> tmp(nVariables);
414  for (int i = 0; i < nVariables; ++i)
415  {
416  tmp[i] = Array<OneD, NekDouble>(nBCEdgePts, 0.0);
417  }
418 
419  // pressure perturbation
420  Vmath::Fill(nBCEdgePts, m_whiteNoiseBC_p, &tmp[m_ip][0], 1);
421 
422  if (m_conservative)
423  {
424  for (int i = 0; i < nBCEdgePts; ++i)
425  {
426  // density perturbation
427  tmp[m_irho][i] = m_whiteNoiseBC_p *
428  BfFwd[m_spacedim + 2][id2 + i] /
429  BfFwd[0][id2 + i];
430 
431  // velocity perturbation
432  NekDouble ru = m_whiteNoiseBC_p / sqrt(BfFwd[0][id2 + i]);
433  for (int j = 0; j < m_spacedim; ++j)
434  {
435  tmp[m_iu + j][i] = -1.0 * ru * m_traceNormals[j][id2 + i];
436  }
437  }
438  }
439  else
440  {
441  for (int i = 0; i < nBCEdgePts; ++i)
442  {
443  // velocity perturbation
445  (sqrt(BfFwd[0][id2 + i]) * BfFwd[1][id2 + i]);
446 
447  for (int j = 0; j < m_spacedim; ++j)
448  {
449  tmp[m_iu + j][i] = -1.0 * u * m_traceNormals[j][id2 + i];
450  }
451  }
452  }
453 
454  // Copy boundary adjusted values into the boundary expansion
455  for (int i = 0; i < nVariables; ++i)
456  {
457  Vmath::Vcopy(nBCEdgePts, &tmp[i][0], 1,
458  &(m_fields[i]
459  ->GetBndCondExpansions()[bcRegion]
460  ->UpdatePhys())[id1],
461  1);
462  }
463  }
464 }
465 
466 /**
467  * @brief Compute the advection velocity in the standard space
468  * for each element of the expansion.
469  *
470  * @return Standard velocity field.
471  */
473 {
474  int nElm = m_fields[0]->GetExpSize();
475 
476  Array<OneD, NekDouble> stdV(nElm, 0.0);
477 
481 
482  int cnt = 0;
483 
484  for (int el = 0; el < nElm; ++el)
485  {
486  ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
487 
488  // Possible bug: not multiply by jacobian??
489  const SpatialDomains::GeomFactorsSharedPtr metricInfo =
490  m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo();
491  const Array<TwoD, const NekDouble> &gmat =
492  m_fields[0]
493  ->GetExp(el)
494  ->GetGeom()
495  ->GetMetricInfo()
496  ->GetDerivFactors(ptsKeys);
497 
498  int nq = m_fields[0]->GetExp(el)->GetTotPoints();
499 
500  for (int i = 0; i < m_spacedim; ++i)
501  {
502  stdVelocity[i] = Array<OneD, NekDouble>(nq, 0.0);
503 
504  velocity[i] = Array<OneD, NekDouble>(nq, 0.0);
505  for (int j = 0; j < nq; ++j)
506  {
507  // The total advection velocity is v+c, so we need to scale c by
508  // adding it before we do the transformation.
509  NekDouble c = sqrt(m_bf[0][cnt + j]);
510  velocity[i][j] = m_bf[i + 2][cnt + j] + c;
511  }
512  }
513 
514  // scale the velocity components
515  if (metricInfo->GetGtype() == SpatialDomains::eDeformed)
516  {
517  // d xi/ dx = gmat = 1/J * d x/d xi
518  for (int i = 0; i < m_spacedim; ++i)
519  {
520  Vmath::Vmul(nq, gmat[i], 1, velocity[0], 1, stdVelocity[i], 1);
521  for (int j = 1; j < m_spacedim; ++j)
522  {
523  Vmath::Vvtvp(nq, gmat[m_spacedim * j + i], 1, velocity[j],
524  1, stdVelocity[i], 1, stdVelocity[i], 1);
525  }
526  }
527  }
528  else
529  {
530  for (int i = 0; i < m_spacedim; ++i)
531  {
532  Vmath::Smul(nq, gmat[i][0], velocity[0], 1, stdVelocity[i], 1);
533  for (int j = 1; j < m_spacedim; ++j)
534  {
535  Vmath::Svtvp(nq, gmat[m_spacedim * j + i][0], velocity[j],
536  1, stdVelocity[i], 1, stdVelocity[i], 1);
537  }
538  }
539  }
540 
541  // compute the max absolute velocity of the element
542  for (int i = 0; i < nq; ++i)
543  {
544  NekDouble pntVelocity = 0.0;
545  for (int j = 0; j < m_spacedim; ++j)
546  {
547  pntVelocity += stdVelocity[j][i] * stdVelocity[j][i];
548  }
549  pntVelocity = sqrt(pntVelocity);
550 
551  if (pntVelocity > stdV[el])
552  {
553  stdV[el] = pntVelocity;
554  }
555  }
556 
557  cnt += nq;
558  }
559 
560  return stdV;
561 }
562 
564  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
565  std::vector<std::string> &variables)
566 {
567  for (int i = 0; i < m_bfNames.size(); i++)
568  {
569  variables.push_back(m_bfNames[i]);
571  m_fields[0]->FwdTrans(m_bf[i], tmpC);
572  fieldcoeffs.push_back(tmpC);
573  }
574 
575  int f = 0;
576  for (auto &x : m_forcing)
577  {
578  for (int i = 0; i < x->GetForces().num_elements(); ++i)
579  {
580  variables.push_back("F_" + boost::lexical_cast<string>(f) + "_" +
581  m_session->GetVariable(i));
583  m_fields[0]->FwdTrans(x->GetForces()[i], tmpC);
584  fieldcoeffs.push_back(tmpC);
585  }
586  f++;
587  }
588 }
589 
590 /**
591  * @brief Get the normal vectors.
592  */
594 {
595  return m_traceNormals;
596 }
597 
598 /**
599  * @brief Get the locations of the components of the directed fields within the
600  * fields array.
601  */
603 {
604  return m_vecLocs;
605 }
606 
607 /**
608  * @brief Get the baseflow field.
609  */
612 {
613  return m_bfFwdBwd;
614 }
615 
617 {
618  for (int i = 0; i < m_bfNames.size(); i++)
619  {
620  int j = m_bfNames.size() + i;
621  m_fields[0]->GetFwdBwdTracePhys(m_bf[i], m_bfFwdBwd[i], m_bfFwdBwd[j]);
623  }
624 }
625 
628 {
629  int cnt = 0;
630  // loop over Boundary Regions
631  for (int bcRegion = 0;
632  bcRegion < m_fields[0]->GetBndConditions().num_elements(); ++bcRegion)
633  {
634 
635  // Copy the forward trace of the field to the backward trace
636  int e, id2, npts;
637 
638  for (e = 0;
639  e < m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
640  ++e)
641  {
642  npts = m_fields[0]
643  ->GetBndCondExpansions()[bcRegion]
644  ->GetExp(e)
645  ->GetTotPoints();
646  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
647  m_fields[0]->GetTraceMap()->GetBndCondCoeffsToGlobalCoeffsMap(
648  cnt + e));
649 
650  Vmath::Vcopy(npts, &Fwd[id2], 1, &Bwd[id2], 1);
651  }
652 
653  cnt += m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
654  }
655 }
656 
657 } // namespace Nektar
Array< OneD, Array< OneD, NekDouble > > m_bf
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate(int step)
std::vector< std::string > m_bfNames
virtual void v_WhiteNoiseBC(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble >> &Fwd, Array< OneD, Array< OneD, NekDouble >> &BfFwd, Array< OneD, Array< OneD, NekDouble >> &physarray)
Wall boundary conditions for the AcousticSystem equations.
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:246
bool m_homoInitialFwd
Flag to determine if simulation should start in homogeneous forward transformed state.
NekDouble m_time
Current time of simulation.
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45
void CopyBoundaryTrace(const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Definition: Vmath.cpp:488
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:445
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
bool m_conservative
we are dealing with a conservative formualtion
STL namespace.
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
Get the locations of the components of the directed fields within the fields array.
SOLVER_UTILS_EXPORT int GetTotPoints()
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
Compute the projection and call the method for imposing the boundary conditions in case of discontinu...
const Array< OneD, const Array< OneD, NekDouble > > & GetBasefieldFwdBwd()
Get the baseflow field.
static const NekDouble kNekZeroTol
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:216
virtual bool v_PreIntegrate(int step)
v_PreIntegrate
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
Definition: Forcing.cpp:85
Base class for unsteady solvers.
virtual SOLVER_UTILS_EXPORT void v_Output(void)
int m_spacedim
Spatial dimension (>= expansion dim).
virtual ~AcousticSystem()
Destructor.
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
NekDouble Evaluate() const
Definition: Equation.cpp:95
virtual void v_InitObject()
Initialization object for the AcousticSystem class.
double NekDouble
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble >> &physarray, NekDouble time)
Apply the Boundary Conditions to the AcousticSystem equations.
virtual void v_WallBC(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble >> &Fwd, Array< OneD, Array< OneD, NekDouble >> &physarray)
Wall boundary conditions for the AcousticSystem equations.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
Get a SessionFunction by name.
int m_ip
indices of the fields
Array< OneD, Array< OneD, NekDouble > > m_bfFwdBwd
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
Get the normal vectors.
SolverUtils::CouplingSharedPtr m_coupling
std::map< int, boost::mt19937 > m_rng
SOLVER_UTILS_EXPORT int GetNcoeffs()
virtual void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble >> &fieldcoeffs, std::vector< std::string > &variables)
CouplingFactory & GetCouplingFactory()
Declaration of the Coupling factory singleton.
Definition: Coupling.cpp:44
virtual void v_AddLinTerm(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray)
virtual Array< OneD, NekDouble > v_GetMaxStdVelocity()
Compute the advection velocity in the standard space for each element of the expansion.
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Init object for UnsteadySystem class.
NekDouble m_whiteNoiseBC_lastUpdate
A base class for PDEs which include an advection component.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
Geometry is curved or has non-constant factors.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
Compute the right-hand side.
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:186
virtual void v_RiemannInvariantBC(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble >> &Fwd, Array< OneD, Array< OneD, NekDouble >> &BfFwd, Array< OneD, Array< OneD, NekDouble >> &physarray)=0
SolverUtils::AdvectionSharedPtr m_advection