Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Phillip Lino Rall
UGBlocks_V3
Commits
7a024104
Commit
7a024104
authored
Aug 31, 2020
by
Phillip Lino Rall
Browse files
fresnel diffraction example in main.cc : slit diffraction for fresnel zone
parent
f166efd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
program2D/main.cc
View file @
7a024104
...
...
@@ -50,7 +50,10 @@ std::complex<double> loch(double x, double y) {
if
(
sqrt
(
x
*
x
+
y
*
y
)
<
radiusLoch
)
return
1.0
;
return
0.0
;
}
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
),
double
distance
,
double
wavenumber
,
...
...
@@ -62,9 +65,11 @@ void CalcFresnel(std::complex<double> (*loch) (double x, double y),
Y_coordinate2d
Y
(
*
blockGridRec
);
Function2d2
<
std
::
complex
<
double
>
,
double
>
Loch
(
loch
);
Function2d2
<
std
::
complex
<
double
>
,
double
>
Spalt
(
spalt
);
Function2d1
<
std
::
complex
<
double
>
,
double
>
Expi
(
expi
);
varFar
=
Loch
(
X
,
Y
)
*
Expi
(
wavenumber
*
(
X
*
X
+
Y
*
Y
)
/
(
2.0
*
distance
));
//varFar = Loch(X,Y) * Expi(wavenumber * (X*X+Y*Y) / (2.0 * distance));
varFar
=
Spalt
(
X
,
Y
)
*
Expi
(
wavenumber
*
(
X
*
X
)
/
(
2.0
*
distance
));
varIn
=
varFar
;
varFar
.
FFT
();
}
...
...
@@ -73,20 +78,37 @@ void CalcFresnel(std::complex<double> (*loch) (double x, double y),
int
main
(
int
argc
,
char
**
argv
)
{
std
::
ofstream
DATEI
;
int
n
=
9
;
int
n
=
10
;
double
distance
=
20
;
//[mm]
double
distance
=
1
;
//[mm]
double
lambda
=
1.0e-3
;
//[mm]
radiusLoch
=
1
;
//[mm]
double
geometrySize
=
2
;
//[mm]
radiusLoch
=
0.
1
;
//[mm]
double
geometrySize
=
0.8
;
//[mm]
double
wavenumber
=
2.0
*
M_PI
/
lambda
;
cout
<<
" Test CalcFresnel!!"
<<
endl
;
cout
<<
" Test CalcFresnel!!"
<<
endl
;
std
::
cout
<<
"distance = "
<<
distance
<<
std
::
endl
;
std
::
cout
<<
"lambda = "
<<
lambda
<<
std
::
endl
;
std
::
cout
<<
"aperture = "
<<
radiusLoch
<<
std
::
endl
;
std
::
cout
<<
"geometrySize = "
<<
geometrySize
<<
std
::
endl
;
std
::
cout
<<
"Fresnelnumber = "
<<
radiusLoch
*
radiusLoch
/
distance
/
lambda
<<
std
::
endl
;
std
::
cout
<<
"Fresnelnumber >> 1 : near field "
<<
std
::
endl
;
std
::
cout
<<
"Fresnelnumber ~ 1 : fresnel zone"
<<
std
::
endl
;
std
::
cout
<<
"Fresnelnumber << 1 : fraunhofer zone"
<<
std
::
endl
;
double
deltaX
=
geometrySize
/
pow
(
2
,
n
-
1
);
double
deltaXFourierPlane
=
lambda
*
distance
/
pow
(
2
,
n
-
1
)
/
deltaX
;
std
::
cout
<<
"deltaX initial plane (z = 0) = "
<<
deltaX
<<
std
::
endl
;
std
::
cout
<<
"deltaX fourier plane (z = "
<<
distance
<<
") = "
<<
deltaXFourierPlane
<<
std
::
endl
;
std
::
cout
<<
"dxInitial / dxFourier = "
<<
deltaX
/
deltaXFourierPlane
<<
std
::
endl
;
double
radiusGeo
=
0.5
*
geometrySize
;
Rec
tangle
geo
(
-
radiusGeo
,
-
radiusGeo
,
radiusGeo
,
radiusGeo
);
Rec
hteck
geo
(
-
radiusGeo
,
-
radiusGeo
,
radiusGeo
,
radiusGeo
);
VariableFFT
varE
(
n
,
n
,
geo
);
VariableFFT
varE
(
n
,
n
,
geo
);
VariableFFT
varIn
(
varE
);
// VariableFFT varB(varA);
/*
...
...
@@ -98,12 +120,17 @@ cout << " Test CalcFresnel!!" << endl;
CalcFresnel
(
loch
,
distance
,
wavenumber
,
varIn
,
varE
);
varE
=
varE
/
L_infty
(
varE
);
std
::
ofstream
DATEIA
;
...
...
@@ -115,13 +142,15 @@ cout << " Test CalcFresnel!!" << endl;
varE
.
Print_VTK
(
DATEIA
);
DATEIA
.
close
();
DATEIA
.
open
(
"varEimag.vtk"
);
varE
.
Print_VTK
(
DATEIA
,
imPart
);
DATEIA
.
close
();
//
DATEIA.open("varEimag.vtk");
//
varE.Print_VTK(DATEIA,imPart);
//
DATEIA.close();
DATEIA
.
open
(
"varEreal.vtk"
);
varE
.
Print_VTK
(
DATEIA
,
realPart
);
DATEIA
.
close
();
// DATEIA.open("varEreal.vtk");
// varE.Print_VTK(DATEIA,realPart);
// DATEIA.close();
cout
<<
" Test CalcFresnel finished!!"
<<
endl
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment