Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
00582835
Commit
00582835
authored
7 months ago
by
Mikhail Svechnikov
Committed by
Mikhail Svechnikov
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
optimized replication through mediation
parent
3397f803
No related branches found
No related tags found
1 merge request
!2717
Rework and optimize computation of roughness crosscorrelation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sim/Computation/RoughMultiLayerContribution.cpp
+34
-24
34 additions, 24 deletions
Sim/Computation/RoughMultiLayerContribution.cpp
with
34 additions
and
24 deletions
Sim/Computation/RoughMultiLayerContribution.cpp
+
34
−
24
View file @
00582835
...
...
@@ -100,34 +100,28 @@ complex_t get_sum8terms(const ReSample& re_sample, size_t i_layer, const Diffuse
return
term1
+
term2
+
term3
+
term4
+
term5
+
term6
+
term7
+
term8
;
}
// Fourier transform of the correlation function of roughnesses between the interfaces
double
crossCorrSpectralFun
(
const
R3
&
qvec
,
const
SliceStack
&
stack
,
size_t
j
,
size_t
k
)
double
underlyingInterfaceReplication
(
const
R3
&
qvec
,
const
SliceStack
&
stack
,
size_t
j
)
{
ASSERT
(
j
<
k
);
const
double
distance
=
std
::
abs
(
stack
[
j
].
hig
()
-
stack
[
k
].
hig
());
const
AutocorrelationModel
*
rough_j
=
stack
[
j
].
topRoughness
()
->
autocorrelationModel
();
const
AutocorrelationModel
*
rough_k
=
stack
[
k
].
topRoughness
()
->
autocorrelationModel
();
const
double
sigma_j
=
rough_j
->
sigma
();
const
double
sigma_k
=
rough_k
->
sigma
();
const
CrosscorrelationModel
*
crosscorr_j
=
stack
[
j
].
topRoughness
()
->
crosscorrelationModel
();
if
(
sigma_j
<=
0
||
sigma_k
<=
0
)
if
(
!
crosscorr_j
)
return
0.0
;
const
CrosscorrelationModel
*
crosscorr_j
=
stack
[
j
].
topRoughness
()
->
crosscorrelationModel
();
const
double
distance
=
std
::
abs
(
stack
[
j
].
hig
()
-
stack
[
j
+
1
].
hig
());
return
crosscorr_j
->
replicationFactor
(
qvec
,
distance
);
}
if
(
!
crosscorr_j
)
double
crossInterfaceSpectralFun
(
double
spectrum_j
,
double
spectrum_k
,
double
sigma_j
,
double
sigma_k
)
{
if
(
sigma_j
<=
0
||
sigma_k
<=
0
)
return
0.0
;
return
0.5
*
((
sigma_k
/
sigma_j
)
*
rough_j
->
spectralFunction
(
qvec
)
+
(
sigma_j
/
sigma_k
)
*
rough_k
->
spectralFunction
(
qvec
))
*
crosscorr_j
->
replicationFactor
(
qvec
,
distance
);
return
0.5
*
((
sigma_k
/
sigma_j
)
*
spectrum_j
+
(
sigma_j
/
sigma_k
)
*
spectrum_k
);
}
}
// namespace
double
Compute
::
roughMultiLayerContribution
(
const
ReSample
&
re_sample
,
const
DiffuseElement
&
ele
)
{
if
(
ele
.
alphaMean
()
<
0.0
)
...
...
@@ -155,19 +149,35 @@ double Compute::roughMultiLayerContribution(const ReSample& re_sample, const Dif
}
const
size_t
n_interfaces
=
roughStack
.
size
();
std
::
vector
<
double
>
spectrum
(
n_interfaces
,
0
);
// auto correlation in each layer (first term in final expression in Eq (3) of Schlomka et al)
for
(
size_t
i
=
0
;
i
<
n_interfaces
;
i
++
)
autocorr
+=
std
::
norm
(
rterm
[
i
]
*
sterm
[
i
])
*
roughStack
[
i
].
topRoughness
()
->
autocorrelationModel
()
->
spectralFunction
(
q
);
for
(
size_t
i
=
0
;
i
<
n_interfaces
;
i
++
)
{
spectrum
[
i
]
=
roughStack
[
i
].
topRoughness
()
->
autocorrelationModel
()
->
spectralFunction
(
q
);
autocorr
+=
std
::
norm
(
rterm
[
i
]
*
sterm
[
i
])
*
spectrum
[
i
];
}
// cross correlation between layers (second term in loc. cit.)
for
(
size_t
j
=
0
;
j
<
n_interfaces
;
j
++
)
{
if
(
!
roughStack
[
j
].
topRoughness
()
->
crosscorrelationModel
())
std
::
vector
<
double
>
underlying_interface_replication
(
n_interfaces
,
0
);
// the last is unused
std
::
vector
<
double
>
sigma
(
n_interfaces
);
for
(
size_t
j
=
0
;
j
<
n_interfaces
-
1
;
j
++
)
{
sigma
[
j
]
=
roughStack
[
j
].
topRoughness
()
->
sigma
();
underlying_interface_replication
[
j
]
=
underlyingInterfaceReplication
(
q
,
roughStack
,
j
);
}
for
(
size_t
j
=
0
;
j
<
n_interfaces
-
1
;
j
++
)
{
if
(
underlying_interface_replication
[
j
]
==
0
)
continue
;
for
(
size_t
k
=
j
+
1
;
k
<
n_interfaces
;
k
++
)
double
accumulated_replication
=
underlying_interface_replication
[
j
];
for
(
size_t
k
=
j
+
1
;
k
<
n_interfaces
;
k
++
)
{
crosscorr
+=
(
rterm
[
j
]
*
sterm
[
j
]
*
std
::
conj
(
rterm
[
k
]
*
sterm
[
k
])).
real
()
*
::
crossCorrSpectralFun
(
q
,
roughStack
,
j
,
k
);
*
crossInterfaceSpectralFun
(
spectrum
[
j
],
spectrum
[
k
],
sigma
[
j
],
sigma
[
k
])
*
accumulated_replication
;
if
(
underlying_interface_replication
[
k
]
==
0
)
break
;
accumulated_replication
*=
underlying_interface_replication
[
k
];
}
}
const
double
k0
=
(
2
*
pi
)
/
wavelength
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment