VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
ShearWaveAnalyticalResults.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> ShearWaveAnalyticalResults::getNewInstance(double viscosity, std::shared_ptr<ShearWaveParameterStruct> simParaStruct)
41{
42 return std::shared_ptr<AnalyticalResults>(new ShearWaveAnalyticalResults(viscosity, simParaStruct));
43}
44
45void ShearWaveAnalyticalResults::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*u0) / xNodes;
52 vy.at(i).at(j) = (l0*v0*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)*u0) / xNodes)) / xNodes)) / (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)))*xNodes);
53 vz.at(i).at(j) = (real)0.0;
54 press.at(i).at(j) = (pow(l0, (real)2.0)*rho0*v0*sin(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes)*(-(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)))*u0*zNodes*cos(((real)2.0 * M_PI*(l0*time.at(i)*u0 + x.at(i).at(j)*xNodes)) / pow(xNodes, (real)2.0)) + v0*xNodes*pow(sin(((real)2.0 * M_PI*(l0*time.at(i)*u0 + x.at(i).at(j)*xNodes)) / pow(xNodes, (real)2.0)), (real)2.0)*sin(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes))) / ((real)2.0*exp(((real)8.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)))*pow(xNodes, (real)3.0));
55 rho.at(i).at(j) = (pow(l0, (real)2.0)*rho0*v0*sin(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes)*(-(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)))*u0*zNodes*cos(((real)2.0 * M_PI*(l0*time.at(i)*u0 + x.at(i).at(j)*xNodes)) / pow(xNodes, (real)2.0)) + v0*xNodes*pow(sin(((real)2.0 * M_PI*(l0*time.at(i)*u0 + x.at(i).at(j)*xNodes)) / pow(xNodes, (real)2.0)), (real)2.0)*sin(((real)2.0 * M_PI*z.at(i).at(j)) / zNodes))) / ((real)2.0*exp(((real)8.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)))*pow(xNodes, (real)3.0));
56 }
57 }
58 calculated = true;
59}
60
61ShearWaveAnalyticalResults::ShearWaveAnalyticalResults(double viscosity, std::shared_ptr<ShearWaveParameterStruct> simParaStruct)
63{
64 this->viscosity = viscosity;
65 this->u0 = simParaStruct->ux;
66 this->v0 = simParaStruct->uz;
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< ShearWaveParameterStruct > simParaStruct)
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42