Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THIN option #36

Open
The-Ludwig opened this issue Aug 3, 2023 · 3 comments
Open

THIN option #36

The-Ludwig opened this issue Aug 3, 2023 · 3 comments

Comments

@The-Ludwig
Copy link

Is the support for CORSIKA's THIN option implemented here?

It greatly reduces the computation time for extreme high energies by only propagating only one particle below some relative energy-threshold and assigning a large weight to that particle. The side effect: All block-sizes are changed and the particle block does not contain groups of 7 floats, but groups of 8 floats, as described in subsection 10.2.3 in the CORSIKA userguide on page 135.

Not that I need it right now, but maybe a good thing to keep in mind and track through an issue.

@maxnoe
Copy link
Member

maxnoe commented Aug 4, 2023

If THIN output requires different parsing, then as of now, it is not implemented.

I can have a look later when I'm back from vacation or you can open a pull request.

Depending on how large the differences are and whether it can be detected from the run header or has to be known, I'd either add support for it to CorsikaParticleFile (if easy and detectable from the run header), an option thin to the CorsikaParticleFile (if not detectable but simple to support) or add a new CorsikaThinParticleFile (if it has to be known before opening the file and the differences are larger).

@The-Ludwig
Copy link
Author

No need for hurry, I don't really need it, as I said.

Well, it can be detected from the run header, but not as a flag saved in the run header. The best way I think is to check the distance between the RUNH and the first EVTHword in the file. If it is 273, then its a normal file, if it is 312, it is a thinned file.

In the internal software of a large directed energy weapon at the south-pole , it has to be passed to the corsika file reader as a flag beforehand.

@cxwx
Copy link

cxwx commented May 23, 2024

I thought using the buffersize read from Corsikafile as a flag of thinning.
Though It's not describe in CORSIKA manual, but I've using this method for several years

int CorsikaInterface::v_nouse_read() {
  int v_nouse = 0;
  fIn.read((char*)&v_nouse, sizeof(int));  // flawfinder:ignore NOLINT
  switch (v_nouse) {
    case kNoThin:
      fSizeSecParticle = NSecParticleNoThin;
      fSizeSubBlock = NSubBlockNoThin;
      fSizeBlock = NBlockNoThin;
      break;
    case kThin:
      fSizeSecParticle = NSecParticleThin;
      fSizeSubBlock = NSubBlockThin;
      fSizeBlock = NBlockThin;
      break;
    default:
      cerr << "@CorsikaInterface::v_nouse_read, unknown thin or not\n";
      exit(1);
  }

  flag_thin_t newThin = flag_thin_t(v_nouse);  // NOLINT
  if (fThin == newThin)
    return 1;
  else {  // NOLINT
    fThin = newThin;
    return 0;
  }
}

first read a int var
check this var in enum flag_thin_t { kThin = 26208, kNoThin = 22932 };
26208 means thinning,22932 means no thinning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants