mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-14 01:35:36 +00:00
stochastic QED: function to cache 1/sqrt(khat^2)
This commit is contained in:
parent
149a46b92c
commit
17b3a10d46
@ -44,7 +44,10 @@ namespace QCD{
|
|||||||
virtual ~Photon(void) = default;
|
virtual ~Photon(void) = default;
|
||||||
void FreePropagator(const GaugeField &in, GaugeField &out);
|
void FreePropagator(const GaugeField &in, GaugeField &out);
|
||||||
void MomentumSpacePropagator(const GaugeField &in, GaugeField &out);
|
void MomentumSpacePropagator(const GaugeField &in, GaugeField &out);
|
||||||
|
void StochasticWeight(GaugeLinkField &weight);
|
||||||
void StochasticField(GaugeField &out, GridParallelRNG &rng);
|
void StochasticField(GaugeField &out, GridParallelRNG &rng);
|
||||||
|
void StochasticField(GaugeField &out, GridParallelRNG &rng,
|
||||||
|
const GaugeLinkField &weight);
|
||||||
private:
|
private:
|
||||||
void invKHatSquared(GaugeLinkField &out);
|
void invKHatSquared(GaugeLinkField &out);
|
||||||
void zmSub(GaugeLinkField &out);
|
void zmSub(GaugeLinkField &out);
|
||||||
@ -148,28 +151,46 @@ namespace QCD{
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class Gimpl>
|
template<class Gimpl>
|
||||||
void Photon<Gimpl>::StochasticField(GaugeField &out, GridParallelRNG &rng)
|
void Photon<Gimpl>::StochasticWeight(GaugeLinkField &weight)
|
||||||
{
|
{
|
||||||
auto *grid = dynamic_cast<GridCartesian *>(out._grid);
|
auto *grid = dynamic_cast<GridCartesian *>(weight._grid);
|
||||||
const unsigned int nd = grid->_ndimension;
|
const unsigned int nd = grid->_ndimension;
|
||||||
std::vector<int> latt_size = grid->_fdimensions;
|
std::vector<int> latt_size = grid->_fdimensions;
|
||||||
GaugeLinkField sqrtK2Inv(grid), r(grid);
|
|
||||||
GaugeField aTilde(grid);
|
|
||||||
FFT fft(grid);
|
|
||||||
|
|
||||||
Integer vol = 1;
|
Integer vol = 1;
|
||||||
for(int d = 0; d < nd; d++)
|
for(int d = 0; d < nd; d++)
|
||||||
{
|
{
|
||||||
vol = vol * latt_size[d];
|
vol = vol * latt_size[d];
|
||||||
}
|
}
|
||||||
|
invKHatSquared(weight);
|
||||||
|
weight = sqrt(vol*real(weight));
|
||||||
|
zmSub(weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Gimpl>
|
||||||
|
void Photon<Gimpl>::StochasticField(GaugeField &out, GridParallelRNG &rng)
|
||||||
|
{
|
||||||
|
auto *grid = dynamic_cast<GridCartesian *>(out._grid);
|
||||||
|
GaugeLinkField weight(grid);
|
||||||
|
|
||||||
|
StochasticWeight(weight);
|
||||||
|
StochasticField(out, rng, weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Gimpl>
|
||||||
|
void Photon<Gimpl>::StochasticField(GaugeField &out, GridParallelRNG &rng,
|
||||||
|
const GaugeLinkField &weight)
|
||||||
|
{
|
||||||
|
auto *grid = dynamic_cast<GridCartesian *>(out._grid);
|
||||||
|
const unsigned int nd = grid->_ndimension;
|
||||||
|
GaugeLinkField r(grid);
|
||||||
|
GaugeField aTilde(grid);
|
||||||
|
FFT fft(grid);
|
||||||
|
|
||||||
invKHatSquared(sqrtK2Inv);
|
|
||||||
sqrtK2Inv = sqrt(vol*real(sqrtK2Inv));
|
|
||||||
zmSub(sqrtK2Inv);
|
|
||||||
for(int mu = 0; mu < nd; mu++)
|
for(int mu = 0; mu < nd; mu++)
|
||||||
{
|
{
|
||||||
gaussian(rng, r);
|
gaussian(rng, r);
|
||||||
r = sqrtK2Inv*r;
|
r = weight*r;
|
||||||
pokeLorentz(aTilde, r, mu);
|
pokeLorentz(aTilde, r, mu);
|
||||||
}
|
}
|
||||||
fft.FFT_all_dim(out, aTilde, FFT::backward);
|
fft.FFT_all_dim(out, aTilde, FFT::backward);
|
||||||
|
Loading…
Reference in New Issue
Block a user