VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
AnalyticalResultsTaylorGreenVortexUx.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
36
37#define _USE_MATH_DEFINES
38#include <math.h>
39
40std::shared_ptr<AnalyticalResults> AnalyticalResultsTaylorGreenUx::getNewInstance(double viscosity, std::shared_ptr<TaylorGreenVortexUxParameterStruct> simParaStruct)
41{
42 return std::shared_ptr<AnalyticalResults>(new AnalyticalResultsTaylorGreenUx(viscosity, simParaStruct));
43}
44
45void AnalyticalResultsTaylorGreenUx::calc(std::shared_ptr<SimulationResults> simResults)
46{
48
49 for (int i = 0; i < numberOfTimeSteps; i++) {
50 for (int j = 0; j < numberOfNodes; j++) {
51 vx.at(i).at(j) = (l0*ux) / xNodes + (amplitude*exp(time.at(i)*viscosity*((-(real)4.0 * pow(M_PI, (real)2.0)) / pow(xNodes, (real)2.0) - ((real)4.0 * pow(M_PI, (real)2.0)) / pow(zNodes, (real)2.0)))*l0*cos(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes)*sin(((real)2.0 * M_PI*(x.at(i).at(j) + (l0*time.at(i)*ux) / xNodes)) / xNodes)) / xNodes;
52 vy.at(i).at(j) = (real)0.0;
53 vz.at(i).at(j) = -((amplitude*exp(time.at(i)*viscosity*((-(real)4.0 * pow(M_PI, (real)2.0)) / pow(xNodes, (real)2.0) - ((real)4.0 * pow(M_PI, (real)2.0)) / pow(zNodes, (real)2.0)))*l0*zNodes*cos(((real)2.0 * M_PI*(x.at(i).at(j) + (l0*time.at(i)*ux) / xNodes)) / xNodes)*sin(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes)) / pow(xNodes, (real)2.0));
54 press.at(i).at(j) = (amplitude*pow(l0, (real)2.0)*rho0*(amplitude*pow(zNodes, (real)2.0)*pow(cos(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes), (real)2.0) - (real)4.0 * exp(((real)4.0 * pow(M_PI, (real)2.0)*time.at(i)*viscosity*(pow(xNodes, (real)2.0) + pow(zNodes, (real)2.0))) / (pow(xNodes, (real)2.0)*pow(zNodes, (real)2.0)))*ux*(pow(xNodes, (real)2.0) - pow(zNodes, (real)2.0)) * cos(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes)*sin(((real)2.0 * M_PI*(l0*time.at(i)*ux + x.at(i).at(j)*xNodes)) / pow(xNodes, (real)2.0)) - amplitude*pow(xNodes, (real)2.0)*pow(sin(((real)2.0 * M_PI*(l0*time.at(i)*ux + x.at(i).at(j)*xNodes)) / pow(xNodes, (real)2.0)), (real)2.0))) / ((real)2.0*exp((8 * pow(M_PI, (real)2.0)*time.at(i)*viscosity*(pow(xNodes, (real)2.0) + pow(zNodes, (real)2.0))) / (pow(xNodes, (real)2.0)*pow(zNodes, (real)2.0)))*pow(xNodes, (real)4.0));
55 rho.at(i).at(j) = (amplitude*pow(l0, (real)2.0)*rho0*(amplitude*pow(zNodes, (real)2.0)*pow(cos(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes), (real)2.0) - (real)4.0 * exp(((real)4.0 * pow(M_PI, (real)2.0)*time.at(i)*viscosity*(pow(xNodes, (real)2.0) + pow(zNodes, (real)2.0))) / (pow(xNodes, (real)2.0)*pow(zNodes, (real)2.0)))*ux*(pow(xNodes, (real)2.0) - pow(zNodes, (real)2.0)) * cos(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes)*sin(((real)2.0 * M_PI*(l0*time.at(i)*ux + x.at(i).at(j)*xNodes)) / pow(xNodes, (real)2.0)) - amplitude*pow(xNodes, (real)2.0)*pow(sin(((real)2.0 * M_PI*(l0*time.at(i)*ux + x.at(i).at(j)*xNodes)) / pow(xNodes, (real)2.0)), (real)2.0))) / ((real)2.0*exp((8 * pow(M_PI, (real)2.0)*time.at(i)*viscosity*(pow(xNodes, (real)2.0) + pow(zNodes, (real)2.0))) / (pow(xNodes, (real)2.0)*pow(zNodes, (real)2.0)))*pow(xNodes, (real)4.0));
56 }
57 }
58 calculated = true;
59}
60
61AnalyticalResultsTaylorGreenUx::AnalyticalResultsTaylorGreenUx(double viscosity, std::shared_ptr<TaylorGreenVortexUxParameterStruct> simParaStruct)
63{
64 this->viscosity = viscosity;
65 this->ux = simParaStruct->ux;
66 this->amplitude = simParaStruct->amplitude;
67 this->l0 = simParaStruct->l0;
68 this->rho0 = simParaStruct->rho0;
69}
unsigned int numberOfTimeSteps
Definition ResultsImp.h:65
std::vector< std::vector< double > > z
Definition ResultsImp.h:72
std::vector< std::vector< double > > rho
Definition ResultsImp.h:75
std::vector< std::vector< double > > vy
Definition ResultsImp.h:73
unsigned int numberOfNodes
Definition ResultsImp.h:68
std::vector< int > time
Definition ResultsImp.h:71
std::vector< std::vector< double > > vz
Definition ResultsImp.h:73
std::vector< std::vector< double > > x
Definition ResultsImp.h:72
unsigned int xNodes
Definition ResultsImp.h:67
std::vector< std::vector< double > > vx
Definition ResultsImp.h:73
unsigned int zNodes
Definition ResultsImp.h:67
std::vector< std::vector< double > > press
Definition ResultsImp.h:74
void init(std::shared_ptr< SimulationResults > simResults)
void calc(std::shared_ptr< SimulationResults > simResults)
static std::shared_ptr< AnalyticalResults > getNewInstance(double viscosity, std::shared_ptr< TaylorGreenVortexUxParameterStruct > simParaStruct)
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42