VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
FFTCalculator.h
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//=======================================================================================
33#ifndef FFTCALCULATOR_H
34#define FFTCALCULATOR_H
35
36#include <memory>
37#include <vector>
38#include <fftw3.h>
39
42class TestResults;
43class PhiAndNuTest;
44
46{
47public:
48 static std::shared_ptr<FFTCalculator> getInstance();
49
50 double calcNy(std::vector<std::vector<double> > data, bool transposeData, int lx, int lz, int timeStepLength);
51 double calcPhiDiff(std::vector<std::vector<double> > data, bool transposeData, int lx, int lz, int timeStepLength);
52
53 double calcAmplitudeForTimeStep(std::vector<double> data, bool transposeData, int lx, int lz);
54
55private:
57 void init();
58 double calcNy();
59 double calcPhiDiff();
60 std::vector<double> calcPhiForAllSteps();
61 std::vector<double> calcLinReg(std::vector<double> y);
62 std::vector<double> calcLogAmplitudeForAllSteps();
63 std::vector<double> calcAmplitudeForAllSteps();
64 void calcFFT2D(unsigned int step);
65 std::vector<std::vector<double> > transpose(std::vector<std::vector<double> >);
66 void initDataForFFT(fftw_complex* input, unsigned int step);
67 void setFFTResults(fftw_complex* result, unsigned int step);
68
69 std::vector<std::vector<double> > data;
70 std::vector<std::vector<double> > fftResultsIm;
71 std::vector<std::vector<double> > fftResultsRe;
72
73 bool fftCalculated;
74 bool transposeData;
75 double lx, lz;
76 double timeStepLength;
77};
78#endif
79
double calcAmplitudeForTimeStep(std::vector< double > data, bool transposeData, int lx, int lz)
double calcNy(std::vector< std::vector< double > > data, bool transposeData, int lx, int lz, int timeStepLength)
static std::shared_ptr< FFTCalculator > getInstance()
double calcPhiDiff(std::vector< std::vector< double > > data, bool transposeData, int lx, int lz, int timeStepLength)
std::shared_ptr< T > SPtr
@ y
Definition Axis.h:43