Commit ff3efad4 authored by Phillip Lino Rall's avatar Phillip Lino Rall
Browse files

Spectrum of plane waves beispiel implementiert

parent 7a024104
[Dolphin]
Timestamp=2020,3,11,14,59,34
Timestamp=2020,8,31,16,38,27
Version=4
[Settings]
......
......@@ -9,4 +9,5 @@ latex
run
*.dx
config.pri
source/program.pro
\ No newline at end of file
source/program.pro
*.user
......@@ -12,24 +12,24 @@ unix:VTK_INCLUDEPATH = /usr/local/include/vtk-7.0
unix:VTK_LIBPATH = -L/usr/local/lib
# VTK 7
unix: VTK_LIBS = \
-lvtkCommonCore-7.0 \
-lvtkFiltersGeneral-7.0 \
-lvtkCommonExecutionModel-7.0 \
-lvtkCommonDataModel-7.0 \
-lvtkGUISupportQtOpenGL-7.0 \
-lvtkRenderingFreeType-7.0 \
-lvtkRenderingAnnotation-7.0 \
-lvtkFiltersModeling-7.0 \
-lvtkInteractionWidgets-7.0 \
-lvtkIOLegacy-7.0 \
-lvtkRenderingOpenGL2-7.0 \
-lvtkRenderingCore-7.0 \
-lvtkRenderingLOD-7.0
#unix: VTK_LIBS = \
# -lvtkCommonCore-7.0 \
# -lvtkFiltersGeneral-7.0 \
# -lvtkCommonExecutionModel-7.0 \
# -lvtkCommonDataModel-7.0 \
# -lvtkGUISupportQtOpenGL-7.0 \
# -lvtkRenderingFreeType-7.0 \
# -lvtkRenderingAnnotation-7.0 \
# -lvtkFiltersModeling-7.0 \
# -lvtkInteractionWidgets-7.0 \
# -lvtkIOLegacy-7.0 \
# -lvtkRenderingOpenGL2-7.0 \
# -lvtkRenderingCore-7.0 \
# -lvtkRenderingLOD-7.0
# Pathes
# -Home Directory
HOME_DIR = C:\Users\rall\Documents\UGBLOCKS\trunk
HOME_DIR = /home/rzlin/er96apow/git/
#HOME_DIR = ../../
# -UGBlocks Directory
......
......@@ -54,7 +54,7 @@ std::complex<double> spalt(double x, double y) {
if(abs(x) < radiusLoch) return 1.0;
return 0.0;
}
void CalcFresnel(std::complex<double> (*loch) (double x, double y),
void CalcFresnel(std::complex<double> (*aperture) (double x, double y),
double distance,
double wavenumber,
VariableFFT& varIn,
......@@ -64,16 +64,51 @@ void CalcFresnel(std::complex<double> (*loch) (double x, double y),
X_coordinate2d X(*blockGridRec);
Y_coordinate2d Y(*blockGridRec);
Function2d2<std::complex<double>,double> Loch(loch);
Function2d2<std::complex<double>,double> Spalt(spalt);
Function2d2<std::complex<double>,double> Aperture(aperture);
Function2d1<std::complex<double>,double> Expi(expi);
//varFar = Loch(X,Y) * Expi(wavenumber * (X*X+Y*Y) / (2.0 * distance));
varFar = Spalt(X,Y) * Expi(wavenumber * (X*X) / (2.0 * distance));
varFar = Aperture(X,Y) * Expi(wavenumber * (X*X+Y*Y) / (2.0 * distance));
varIn = varFar;
varFar.FFT();
}
double myRealSqrt(std::complex<double> z) {
return sqrt(z.real());
}
void spectrumPlaneWave(std::complex<double> (*aperture) (double x, double y),
double distance,
double wavenumber,
VariableFFT& varIn,
VariableFFT& varFar) {
Blockgrid2D* blockGridRec = varFar.Give_blockgrid();
X_coordinate2d X(*blockGridRec);
Y_coordinate2d Y(*blockGridRec);
VariableFFT Kx(varFar);
VariableFFT Ky(varFar);
double dx = varIn.getHx();
double dy = varIn.getHy();
double ukx = 2.0 * M_PI / varIn.getSizeX();
double uky = 2.0 * M_PI / varIn.getSizeY();
Kx = X / dx * ukx ;
Ky = Y / dy * uky ;
Function2d2<std::complex<double>,double> Aperture(aperture);
Function2d1<std::complex<double>,double> Expi(expi);
Function2d1<double, std::complex<double> > Sqrt(myRealSqrt);
varFar = Aperture(X,Y);
varIn = varFar;
varFar.FFT();
varFar = varFar * Expi( Sqrt(wavenumber*wavenumber - Kx*Kx - Ky*Ky) * (distance));
varFar.inversFFT();
}
int main(int argc, char** argv) {
std::ofstream DATEI;
......@@ -109,7 +144,13 @@ int main(int argc, char** argv) {
Rechteck geo(-radiusGeo, -radiusGeo, radiusGeo, radiusGeo);
VariableFFT varE(n,n,geo);
VariableFFT varIn(varE);
VariableFFT varIn(varE);
// VariableFFT varB(varA);
/*
Blockgrid2D* blockGridRec = varE.Give_blockgrid();
......@@ -123,7 +164,13 @@ int main(int argc, char** argv) {
CalcFresnel(loch,
// CalcFresnel(loch,
// distance,
// wavenumber,
// varIn,
// varE);
spectrumPlaneWave(loch,
distance,
wavenumber,
varIn,
......
......@@ -82,20 +82,31 @@ void VariableFFT::interpolate(Variable2D<std::complex<double> >& v,
VariableFFT::VariableFFT(int tx, int ty, Rechteck& ugRectangle) :
Variable2D<std::complex<double> >(
*(blockgrid = new Blockgrid2D(&ugRectangle,powerTwo(tx)-1,powerTwo(ty)-1))) {
ownBlockGrid = true;
init();
Hx = ugRectangle.getSizeX() / Nx;
Hy = ugRectangle.getSizeY() / Ny;
}
VariableFFT::VariableFFT(VariableFFT* other) :
Variable2D<std::complex<double> >(*(other->Give_blockgrid())) {
ownBlockGrid = false;
Hx = other->getHx();
Hy = other->getHy();
init();
}
VariableFFT::VariableFFT(const VariableFFT& other) :
Variable2D<std::complex<double> >(*(other.Give_blockgrid())) {
ownBlockGrid = false;
Hx = other.getHx();
Hy = other.getHy();
init();
}
......
......@@ -62,6 +62,13 @@ public:
void operator=(VariableFFT& v);
void interpolate(Variable2D<std::complex<double> >& v,
std::complex<double> defaultInterpolation);
double getHx() const { return Hx; }
double getHy() const { return Hy; }
double getNx() const { return Nx; }
double getNy() const { return Ny; }
double getSizeX() const { return Hx*Nx; }
double getSizeY() const { return Hy*Ny; }
//
private:
void init();
......@@ -70,7 +77,10 @@ private:
int Nx;
int Ny;
double Hx;
double Hy;
int powerTwo(int t);
Interpolate_on_structured_2Dgrid* assignmentInterpolator;
......
......@@ -51,6 +51,9 @@ public:
bool getCoordinate(const D2vector& point_coord, int& id, double& i, double& j, const Blockgrid2D& blockgrid) const;
void Test() const;
double getSizeX() { return rx-lx; }
double getSizeY() { return ry-ly; }
private:
double lx, ly, rx, ry;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment