VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
InitialConditionTaylorGreenVortexUx.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
41InitialConditionTaylorGreenUx::InitialConditionTaylorGreenUx(std::shared_ptr<TaylorGreenVortexUxParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
42{
43 this->amp = simParaStruct->amplitude;
44 this->l0 = simParaStruct->l0;
45 this->lx = gridInfoStruct->lx;
46 this->lz = gridInfoStruct->lz;
47 this->rho = simParaStruct->rho0;
48 this->ux = simParaStruct->ux;
49}
50
51std::shared_ptr<InitialConditionTaylorGreenUx> InitialConditionTaylorGreenUx::getNewInstance(std::shared_ptr<TaylorGreenVortexUxParameterStruct> simParaStruct, std::shared_ptr<GridInformationStruct> gridInfoStruct)
52{
53 return std::shared_ptr<InitialConditionTaylorGreenUx>(new InitialConditionTaylorGreenUx(simParaStruct, gridInfoStruct));
54}
55
57{
58 real x = getXCoord(i, level);
59 real y = getYCoord(i, level);
60 real z = getZCoord(i, level);
61 if ((i != 0) && (x != XCoordStopNode) && (y != YCoordStopNode) && (z != ZCoordStopNode))
62 {
63 real vx = (ux* l0 / lx + (amp * l0 * cos((real)2.0 * M_PI * z / lz) * sin((real)2.0 * M_PI * x / lx) / lx));
64 return vx;
65 }
66 else
67 return (real)0.0;
68
69}
70
72{
73 return (real) 0.0;
74}
75
77{
78 real x = getXCoord(i, level);
79 real y = getYCoord(i, level);
80 real z = getZCoord(i, level);
81 if ((i != 0) && (x != XCoordStopNode) && (y != YCoordStopNode) && (z != ZCoordStopNode))
82 {
83 real vz = (-amp * l0 * lz * cos((real)2.0 * M_PI * x / lx) * sin((real)2.0 * M_PI * z / lz) / (lx*lx));
84 return vz;
85 }
86 else
87 return (real) 0.0;
88}
89
91{
92 real x = getXCoord(i, level);
93 real y = getYCoord(i, level);
94 real z = getZCoord(i, level);
95 if ((i != 0) && (x != XCoordStopNode) && (y != YCoordStopNode) && (z != ZCoordStopNode))
96 {
97 real press = (amp*pow(l0, (real)2.0)*rho*(amp*pow(lz, (real)2.0)*pow(cos(((real)2.0 * M_PI*z) / lz), (real)2.0) - (real)4.0 * (pow(lx, (real)2.0) - pow(lz, (real)2.0))*ux*cos(((real)2.0 * M_PI*z) / lz)*sin(((real)2.0 * M_PI*x) / lx) - amp*pow(lx, (real)2.0)*pow(sin(((real)2.0 * M_PI*x) / lx), (real)2.0))) / ((real)2.0*pow(lx, (real)4.0));
98 real rho = (real)3.0 * press;
99 return rho;
100 }
101 else
102 return (real) 0.0;
103}
104
106{
107 //nicht ben�tigt, da Druck aus Dichte berechnet wird
108 return (real) 0.0;
109}
real getXCoord(int i, int level)
real getZCoord(int i, int level)
static std::shared_ptr< InitialConditionTaylorGreenUx > getNewInstance(std::shared_ptr< TaylorGreenVortexUxParameterStruct > 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