VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
InitialConditionShearWave.cpp
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
32//=======================================================================================
34
37
38#define _USE_MATH_DEFINES
39#include <math.h>
40
41
42InitialConditionShearWave::InitialConditionShearWave(std::shared_ptr<ShearWaveParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
43{
44 this->l0 = simParaStruct->l0;
45 this->lx = gridInfoStruct->lx;
46 this->lz = gridInfoStruct->lz;
47 this->rho = simParaStruct->rho0;
48 this->u0 = simParaStruct->ux;
49 this->v0 = simParaStruct->uz;
50}
51
52std::shared_ptr<InitialConditionShearWave> InitialConditionShearWave::getNewInstance(std::shared_ptr<ShearWaveParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
53{
54 return std::shared_ptr<InitialConditionShearWave>(new InitialConditionShearWave(simParaStruct, gridInfoStruct));
55}
56
58{
59 real x = getXCoord(i, level);
60 real y = getYCoord(i, level);
61 real z = getZCoord(i, level);
62 if ((i != 0) && (x != XCoordStopNode) && (y != YCoordStopNode) && (z != ZCoordStopNode))
63 {
64 real vx = l0 * u0 / lx;
65 return vx;
66 }
67 else
68 return (real)0.0;
69
70}
71
73{
74 real x = getXCoord(i, level);
75 real y = getYCoord(i, level);
76 real z = getZCoord(i, level);
77 if ((i != 0) && (x != XCoordStopNode) && (y != YCoordStopNode) && (z != ZCoordStopNode))
78 {
79 real vy = v0 * l0 / lx * cos((real)2.0 * M_PI * z / lz) * sin((real)2.0 * M_PI * x / lx);
80 return vy;
81 }
82 else
83 return (real) 0.0;
84}
85
87{
88 return (real) 0.0;
89}
90
92{
93 real x = getXCoord(i, level);
94 real y = getYCoord(i, level);
95 real z = getZCoord(i, level);
96 if ((i != 0) && (x != XCoordStopNode) && (y != YCoordStopNode) && (z != ZCoordStopNode))
97 {
98 real press = (l0*l0 * v0 * rho * sin(((real)2.0 * M_PI * z) / lz) * ((real)-4.0 * lz * u0 * cos(((real)2.0 * M_PI * x) / lx) + lx * v0 * sin(((real)2.0 * M_PI * x) / lx)*sin(((real)2.0 * M_PI * x) / lx) * sin(((real)2.0 * M_PI * z) / lz))) / ((real)2.0 * lx*lx*lx);
99 real rho = (real)3.0 * press;
100 return 0.0;
101 }
102 else
103 return (real) 0.0;
104}
105
107{
108 //nicht ben�tigt, da Druck aus Dichte berechnet wird
109 return (real) 0.0;
110}
real getXCoord(int i, int level)
real getZCoord(int i, int level)
static std::shared_ptr< InitialConditionShearWave > getNewInstance(std::shared_ptr< ShearWaveParameterStruct > simParaStruct, std::shared_ptr< GridInformationStruct > gridInfoStruct)
real getYCoord(int i, int level)
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
@ z
Definition Axis.h:44
@ x
Definition Axis.h:42
@ y
Definition Axis.h:43