MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
dgcartesianbcacousticperturbsolidwall.h
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#ifndef DGBOUNDARYCONDITIONSOLIDWALL_H_
8#define DGBOUNDARYCONDITIONSOLIDWALL_H_
9
11
16template <MInt nDim, class SysEqn, MBool slipWall = false>
17class DgBcAcousticPerturbSolidWall final : public DgBoundaryCondition<nDim, SysEqn> {
18 // Typedefs
19 public:
21 using Base::begin;
22 using Base::end;
23 using Base::flux;
24 using Base::surfaces;
25 using Base::sysEqn;
26 using typename Base::SolverType;
27
28 // Methods
29 DgBcAcousticPerturbSolidWall(SolverType& solver_, MInt bcId) : Base(solver_, bcId) {}
30 MString name() const override {
31 return slipWall ? "solid wall (mean flow slip wall)" : "solid wall (mean flow no-slip wall)";
32 }
33
34 void apply(const MFloat time) override {
36 }
37
38 void applyAtSurface(const MInt surfaceId, const MFloat NotUsed(time));
39};
40
41
42template <MInt nDim, class SysEqn, MBool slipWall>
44 const MFloat NotUsed(time)) {
45 // Storing the surface-information and define the inner state
46 MFloat* stateL = &surfaces().variables(surfaceId, 0);
47 MFloat* stateR = &surfaces().variables(surfaceId, 1);
48 MFloat* innerState = (surfaces().internalSideId(surfaceId) == 0) ? stateL : stateR;
49 MFloat* nodeVarsL = &surfaces().nodeVars(surfaceId, 0);
50 MFloat* nodeVarsR = &surfaces().nodeVars(surfaceId, 1);
51 MFloat* innerNodeVars = (surfaces().nghbrElementIds(surfaceId, 0) == -1) ? nodeVarsR : nodeVarsL;
52
53 // Collect data for flux-computation
54 const MInt noNodes1D = surfaces().noNodes1D(surfaceId);
55 const MInt noNodes1D3 = (nDim == 3) ? noNodes1D : 1;
56 const MInt dirId = surfaces().orientation(surfaceId);
57
58 MFloatTensor variables(innerState, noNodes1D, noNodes1D3, SysEqn::noVars());
59 MFloatTensor nodeVars(innerNodeVars, noNodes1D, noNodes1D3, SysEqn::noNodeVars());
60 MFloatTensor f(flux(surfaceId), noNodes1D, noNodes1D3, SysEqn::noVars());
61
62 // Computing the flux at all nodes considering zero-velocities at the wall
63 //
64 // Flux-components for boundary-surfaces (no-slip wall version):
65 // u' v' w' p'
66 // Fx = (p', 0, 0, 0)
67 // Fy = (0, p', 0, 0)
68 // Fz = (0, 0, p', 0)
69 //
70 // Reference: M. Bauer, Airframe noise prediction using a discontinuous
71 // Galerkin method, PhD thesis, p. 18, 2011
72 //
73 // Additionally, if slipWall == true, additional velocity terms are added to
74 // account for non-zero mean flow in the wall-parallel direction.
75 //
76 // Flux-components for boundary-surfaces (slip-wall version):
77 // u' v' w' p'
78 // Fx = (p' + v'v0 + w'w0, 0, 0, 0)
79 // Fy = (0, p' + u'u0 + w'w0, 0, 0)
80 // Fz = (0, 0, p' + u'u0 + v'v0, 0)
81
82 // Set the flux to zero
83 f.set(0.0);
84
85 // Set the x- or y- or z-component of the velocity to p', depending on the
86 // surface orientation
87 if(slipWall) {
88 // If it is a slip wall, add pressure and additional velocity terms
89 for(MInt i = 0; i < noNodes1D; i++) {
90 for(MInt j = 0; j < noNodes1D3; j++) {
91 // This following line is just so that std::inner_product can be used
92 variables(i, j, dirId) = 0.0;
93
94 // Set flux normal to wall (see above for equation)
95 f(i, j, dirId) =
96 std::inner_product(&variables(i, j, 0), &variables(i, j, nDim), &nodeVars(i, j, 0), variables(i, j, nDim));
97 }
98 }
99 } else {
100 // If it is a no-slip wall, just add the pressure term and implicity assume
101 // that all velocity compontents are zero at the wall
102 for(MInt i = 0; i < noNodes1D; i++) {
103 for(MInt j = 0; j < noNodes1D3; j++) {
104 // Set flux normal to wall (see above for equation)
105 f(i, j, dirId) = variables(i, j, nDim);
106 }
107 }
108 }
109}
110
111#endif // DGBOUNDARYCONDITIONSOLIDWALL_H_
Solid (slip) wall boundary condition.
void apply(const MFloat time) override
Apply method to apply boundary condition.
void applyAtSurface(const MInt surfaceId, const MFloat NotUsed(time))
MString name() const override
Returns name of boundary condition.
DgBcAcousticPerturbSolidWall(SolverType &solver_, MInt bcId)
SurfaceCollector & surfaces()
Return reference to surfaces.
DgCartesianSolver< nDim, SysEqn > SolverType
SysEqn & sysEqn()
Return reference to SysEqn object.
MInt begin() const
Return index of first surface.
MInt end() const
Return index of one-past-last surface.
MFloat * flux(const MInt i)
Return pointer to surface flux.
void set(const T &value)
Initializes tensor to constant value.
Definition: tensor.h:271
int32_t MInt
Definition: maiatypes.h:62
std::basic_string< char > MString
Definition: maiatypes.h:55
double MFloat
Definition: maiatypes.h:52
void loop(Functor &&fun, Class *object, const IdType begin, const IdType end, Args... args)