Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mcray
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Horns, Prof. Dr. Dieter
mcray
Commits
ed10ce5f
Commit
ed10ce5f
authored
2 years ago
by
Oleg Kalashev
Browse files
Options
Downloads
Patches
Plain Diff
correlation length test added, deflection accuracy param added
parent
1fdb3ccd
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/app/crbeam/CRbeam.cpp
+14
-6
14 additions, 6 deletions
src/app/crbeam/CRbeam.cpp
src/app/crbeam/CRbeam.h
+1
-0
1 addition, 0 deletions
src/app/crbeam/CRbeam.h
src/lib/Deflection3D.cpp
+39
-1
39 additions, 1 deletion
src/lib/Deflection3D.cpp
src/lib/Deflection3D.h
+6
-0
6 additions, 0 deletions
src/lib/Deflection3D.h
with
60 additions
and
7 deletions
src/app/crbeam/CRbeam.cpp
+
14
−
6
View file @
ed10ce5f
...
@@ -78,7 +78,7 @@ enum ClineParams
...
@@ -78,7 +78,7 @@ enum ClineParams
PNparticles
,
PBatchSize
,
PNparticles
,
PBatchSize
,
PRedshift
,
PFilamentZ
,
PEnergy
,
PMinEnergy
,
PPowerLaw
,
PMinSourceEnergy
,
PPrimary
,
PNoEMcascade
,
PSourceEvolM
,
PRedshift
,
PFilamentZ
,
PEnergy
,
PMinEnergy
,
PPowerLaw
,
PMinSourceEnergy
,
PPrimary
,
PNoEMcascade
,
PSourceEvolM
,
PBackground
,
PBackgroundMult
,
PExtraBackground
,
PExtraBackgroundPhysical
,
PEBLCut
,
PMonoCmb
,
PFixedCmbT
,
PExtDeltaZconst
,
PExtPowerLow
,
PExtDeltaZexp
,
PBackground
,
PBackgroundMult
,
PExtraBackground
,
PExtraBackgroundPhysical
,
PEBLCut
,
PMonoCmb
,
PFixedCmbT
,
PExtDeltaZconst
,
PExtPowerLow
,
PExtDeltaZexp
,
POutput
,
POverwriteOutput
,
PThinning
,
PRescalePPP
,
PEGMF
,
PEGMFLmin
,
PEGMFLmax
,
PEGMFNmodes
,
PRandomEGMF
,
PTurbulentEGMF
,
PTauPrint
,
POutputSuffix
POutput
,
POverwriteOutput
,
PThinning
,
PRescalePPP
,
PEGMF
,
PEGMFLmin
,
PEGMFLmax
,
PEGMFNmodes
,
PRandomEGMF
,
PTurbulentEGMF
,
PDeflectionAccuracy
,
PTauPrint
,
POutputSuffix
};
};
#define xstr(s) str(s)
#define xstr(s) str(s)
#define str(s) #s
#define str(s) #s
...
@@ -150,6 +150,7 @@ static CmdInfo commands[] = {
...
@@ -150,6 +150,7 @@ static CmdInfo commands[] = {
{
PEGMFNmodes
,
CmdInfo
::
FLAG_ARGUMENT
,
"-mfnm"
,
"--nmodesEGMF"
,
"300"
,
"Number of modes in magnetic field spectrum"
},
{
PEGMFNmodes
,
CmdInfo
::
FLAG_ARGUMENT
,
"-mfnm"
,
"--nmodesEGMF"
,
"300"
,
"Number of modes in magnetic field spectrum"
},
{
PRandomEGMF
,
CmdInfo
::
FLAG_NULL
,
"-mfr"
,
"--randomEGMF"
,
NULL
,
"randomize EGMF (use different EGMF configurations for different initial particles)"
},
{
PRandomEGMF
,
CmdInfo
::
FLAG_NULL
,
"-mfr"
,
"--randomEGMF"
,
NULL
,
"randomize EGMF (use different EGMF configurations for different initial particles)"
},
{
PTurbulentEGMF
,
CmdInfo
::
FLAG_NULL
,
"-mft"
,
"--turbulentEGMF"
,
NULL
,
"use turbulent EGMF with Kolmogorov spectrum"
},
{
PTurbulentEGMF
,
CmdInfo
::
FLAG_NULL
,
"-mft"
,
"--turbulentEGMF"
,
NULL
,
"use turbulent EGMF with Kolmogorov spectrum"
},
{
PDeflectionAccuracy
,
CmdInfo
::
FLAG_ARGUMENT
,
"-mfac"
,
"--accEGMF"
,
"10"
,
"Deflection simulation accuracy factor"
},
{
PTauPrint
,
CmdInfo
::
FLAG_NULL
,
"-ptau"
,
"--print-tau"
,
NULL
,
"print tau"
},
{
PTauPrint
,
CmdInfo
::
FLAG_NULL
,
"-ptau"
,
"--print-tau"
,
NULL
,
"print tau"
},
{
POutputSuffix
,
CmdInfo
::
FLAG_ARGUMENT
,
"-os"
,
"--output-suffix"
,
""
,
"Output dir name suffix (appended to autogenerated names)"
},
{
POutputSuffix
,
CmdInfo
::
FLAG_ARGUMENT
,
"-os"
,
"--output-suffix"
,
""
,
"Output dir name suffix (appended to autogenerated names)"
},
{
0
},
{
0
},
...
@@ -224,7 +225,7 @@ CRbeam::CRbeam(int argc, char** argv):
...
@@ -224,7 +225,7 @@ CRbeam::CRbeam(int argc, char** argv):
fNmodesEGMF
(
0
),
fNmodesEGMF
(
0
),
fRandomizeEGMF
(
false
),
fRandomizeEGMF
(
false
),
fTurbulentEGMF
(
false
),
fTurbulentEGMF
(
false
),
//fMax
Deflection
(0.5/180.*M_PI
),
f
Deflection
Accuracy
(
10
),
fLogging
(
false
),
fLogging
(
false
),
fTrajectoryLogging
(
false
),
fTrajectoryLogging
(
false
),
fLogThread
(
-
1
),
fLogThread
(
-
1
),
...
@@ -258,6 +259,7 @@ CRbeam::CRbeam(int argc, char** argv):
...
@@ -258,6 +259,7 @@ CRbeam::CRbeam(int argc, char** argv):
fNmodesEGMF
=
cmd
(
PEGMFNmodes
);
fNmodesEGMF
=
cmd
(
PEGMFNmodes
);
fRandomizeEGMF
=
cmd
(
PRandomEGMF
);
fRandomizeEGMF
=
cmd
(
PRandomEGMF
);
fTurbulentEGMF
=
cmd
(
PTurbulentEGMF
);
fTurbulentEGMF
=
cmd
(
PTurbulentEGMF
);
fDeflectionAccuracy
=
(
int
)
cmd
(
PDeflectionAccuracy
);
//fMaxDeflection = cmd(PMaxDeflection);
//fMaxDeflection = cmd(PMaxDeflection);
//fMaxDeflection *= (M_PI/180.);
//fMaxDeflection *= (M_PI/180.);
...
@@ -497,15 +499,21 @@ int CRbeam::run()
...
@@ -497,15 +499,21 @@ int CRbeam::run()
int
Bslot
=
-
1
;
int
Bslot
=
-
1
;
SmartPtr
<
MagneticField
>
mf
;
SmartPtr
<
MagneticField
>
mf
;
if
(
fEGMF
>
0.
)
{
if
(
fEGMF
>
0.
)
{
std
::
cerr
<<
"fDeflectionAccuracy "
<<
fDeflectionAccuracy
<<
std
::
endl
;
if
(
fTurbulentEGMF
){
CosmoTime
t0
;
auto
l_cor
=
TurbulentMF
::
MeanCorLength
(
rand
,
fLminEGMF
,
fLmaxEGMF
,
fEGMF
,
fNmodesEGMF
,
t0
);
std
::
cerr
<<
"l_cor estimate: "
<<
l_cor
<<
" Mpc"
<<
std
::
endl
;
}
if
(
fRandomizeEGMF
)
{
if
(
fRandomizeEGMF
)
{
Deflection3D
*
defl
=
new
Deflection3D
();
Deflection3D
*
defl
=
new
Deflection3D
(
fDeflectionAccuracy
);
Bslot
=
defl
->
MFSlot
();
Bslot
=
defl
->
MFSlot
();
pe
.
AddInteraction
(
defl
);
pe
.
AddInteraction
(
defl
);
}
}
else
{
else
{
mf
=
fTurbulentEGMF
?
((
MagneticField
*
)
new
TurbulentMF
(
rand
,
fLminEGMF
,
fLmaxEGMF
,
fEGMF
,
fNmodesEGMF
))
:
mf
=
fTurbulentEGMF
?
((
MagneticField
*
)
new
TurbulentMF
(
rand
,
fLminEGMF
,
fLmaxEGMF
,
fEGMF
,
fNmodesEGMF
))
:
((
MagneticField
*
)
new
MonochromaticMF
(
fLmaxEGMF
,
fEGMF
,
Beta
,
Alpha
,
Theta
,
Phi
));
((
MagneticField
*
)
new
MonochromaticMF
(
fLmaxEGMF
,
fEGMF
,
Beta
,
Alpha
,
Theta
,
Phi
));
pe
.
AddInteraction
(
new
Deflection3D
(
mf
));
pe
.
AddInteraction
(
new
Deflection3D
(
mf
,
fDeflectionAccuracy
));
}
}
}
}
//// generating initial state
//// generating initial state
...
...
This diff is collapsed.
Click to expand it.
src/app/crbeam/CRbeam.h
+
1
−
0
View file @
ed10ce5f
...
@@ -95,6 +95,7 @@ private:
...
@@ -95,6 +95,7 @@ private:
double
fNmodesEGMF
;
double
fNmodesEGMF
;
bool
fRandomizeEGMF
;
bool
fRandomizeEGMF
;
bool
fTurbulentEGMF
;
bool
fTurbulentEGMF
;
uint
fDeflectionAccuracy
;
bool
fLogging
;
bool
fLogging
;
bool
fTrajectoryLogging
;
bool
fTrajectoryLogging
;
int
fLogThread
;
int
fLogThread
;
...
...
This diff is collapsed.
Click to expand it.
src/lib/Deflection3D.cpp
+
39
−
1
View file @
ed10ce5f
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#include
"Deflection3D.h"
#include
"Deflection3D.h"
#include
"Test.h"
#include
"Test.h"
namespace
Interactions
{
namespace
Interactions
{
using
namespace
mcray
;
using
namespace
mcray
;
using
namespace
Utils
;
using
namespace
Utils
;
...
@@ -213,6 +212,33 @@ namespace Interactions {
...
@@ -213,6 +212,33 @@ namespace Interactions {
return
0
;
return
0
;
}
}
double
MagneticField
::
CorrelationLength
(
std
::
vector
<
double
>
x
,
std
::
vector
<
double
>
aDirection
,
const
CosmoTime
&
aTime
,
double
aMaxValMpc
)
{
double
step
=
0.1
*
MinVariabilityScale
(
aTime
);
int
max_steps
=
(
int
)(
aMaxValMpc
*
units
.
Mpc
/
step
+
0.5
);
if
(
max_steps
==
0
)
return
step
/
units
.
Mpc
;
auto
norm
=
sqrt
(
aDirection
[
0
]
*
aDirection
[
0
]
+
aDirection
[
1
]
*
aDirection
[
1
]
+
aDirection
[
2
]
*
aDirection
[
2
]);
for
(
int
dim_i
=
0
;
dim_i
<
3
;
dim_i
++
)
aDirection
[
dim_i
]
*=
(
step
/
norm
);
auto
iniB
=
std
::
vector
<
double
>
(
3
);
auto
curB
=
std
::
vector
<
double
>
(
3
);
GetValueGauss
(
x
.
data
(),
aTime
,
iniB
);
for
(
int
step_i
=
0
;
step_i
<
max_steps
;
step_i
++
){
for
(
int
dim_i
=
0
;
dim_i
<
3
;
dim_i
++
)
x
[
dim_i
]
+=
aDirection
[
dim_i
];
GetValueGauss
(
x
.
data
(),
aTime
,
curB
);
double
sc_product
=
0.
;
for
(
int
dim_i
=
0
;
dim_i
<
3
;
dim_i
++
)
sc_product
+=
curB
[
dim_i
]
*
iniB
[
dim_i
];
if
(
sc_product
<
0
)
return
step
*
(
step_i
+
1
)
/
units
.
Mpc
;
}
return
aMaxValMpc
;
}
int
MonochromaticMF
::
UnitTest
()
{
int
MonochromaticMF
::
UnitTest
()
{
std
::
vector
<
double
>
B
(
3
);
std
::
vector
<
double
>
B
(
3
);
CosmoTime
t
(
0
);
CosmoTime
t
(
0
);
...
@@ -294,6 +320,18 @@ namespace Interactions {
...
@@ -294,6 +320,18 @@ namespace Interactions {
}
}
}
}
double
TurbulentMF
::
MeanCorLength
(
Randomizer
&
aRandomizer
,
double
aLmin_Mpc
,
double
aLmax_Mpc
,
double
aVariance_Gauss
,
int
aNmodes
,
const
CosmoTime
&
aTime
,
int
aNsamples
,
double
aMaxValMpc
){
double
l_cor_sum
=
0.
;
auto
x
=
std
::
vector
<
double
>
({
0.
,
0.
,
0.
});
auto
dx
=
std
::
vector
<
double
>
({
0.
,
0.
,
1.
});
for
(
int
i
=
0
;
i
<
aNsamples
;
i
++
){
TurbulentMF
B
(
aRandomizer
,
aLmin_Mpc
,
aLmax_Mpc
,
aVariance_Gauss
,
aNmodes
);
l_cor_sum
+=
B
.
CorrelationLength
(
x
,
dx
,
aTime
,
aMaxValMpc
);
}
return
l_cor_sum
/
aNsamples
;
}
int
TurbulentMF
::
UnitTest
()
{
int
TurbulentMF
::
UnitTest
()
{
if
(
!
cosmology
.
IsInitialized
())
if
(
!
cosmology
.
IsInitialized
())
cosmology
.
Init
();
cosmology
.
Init
();
...
...
This diff is collapsed.
Click to expand it.
src/lib/Deflection3D.h
+
6
−
0
View file @
ed10ce5f
...
@@ -44,6 +44,10 @@ namespace Interactions {
...
@@ -44,6 +44,10 @@ namespace Interactions {
virtual
double
MinVariabilityScale
(
const
CosmoTime
&
aTime
)
const
=
0
;
virtual
double
MinVariabilityScale
(
const
CosmoTime
&
aTime
)
const
=
0
;
int
Print
(
double
lambdaMpc
,
std
::
ostream
&
aOutput
=
std
::
cout
);
int
Print
(
double
lambdaMpc
,
std
::
ostream
&
aOutput
=
std
::
cout
);
double
CorrelationLength
(
std
::
vector
<
double
>
x
,
std
::
vector
<
double
>
aDirection
,
const
CosmoTime
&
aTime
,
double
aMaxValMpc
=
10000
);
};
};
class
Deflection3D
:
public
DeflectionInteraction
{
class
Deflection3D
:
public
DeflectionInteraction
{
...
@@ -110,6 +114,8 @@ namespace Interactions {
...
@@ -110,6 +114,8 @@ namespace Interactions {
virtual
void
GetValueGauss
(
const
double
*
x
,
const
CosmoTime
&
aTime
,
std
::
vector
<
double
>
&
outValue
)
const
;
virtual
void
GetValueGauss
(
const
double
*
x
,
const
CosmoTime
&
aTime
,
std
::
vector
<
double
>
&
outValue
)
const
;
virtual
double
MinVariabilityScale
(
const
CosmoTime
&
aTime
)
const
;
virtual
double
MinVariabilityScale
(
const
CosmoTime
&
aTime
)
const
;
static
int
UnitTest
();
static
int
UnitTest
();
static
double
MeanCorLength
(
Randomizer
&
aRandomizer
,
double
aLmin_Mpc
,
double
aLmax_Mpc
,
double
aVariance_Gauss
,
int
aNmodes
,
const
CosmoTime
&
aTime
,
int
aNsamples
=
1000
,
double
aMaxValMpc
=
10000
);
private:
private:
double
fLmin
;
double
fLmin
;
double
fLmax
;
double
fLmax
;
...
...
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