Problem 1114 - reflectivity is calculated twice when using groundbackpainted or polishedbackpainted
Summary: reflectivity is calculated twice when using groundbackpainted or polishedback...
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/optical (show other problems)
Version: 9.3
Hardware: All All
: P5 normal
Assignee: gum
URL:
Depends on:
Blocks:
 
Reported: 2010-04-17 14:30 CEST by Akira Okumura
Modified: 2010-04-20 02:58 CEST (History)
0 users

See Also:


Attachments
test code for groundbackpainted and reflectivity (10.72 KB, application/octet-stream)
2010-04-17 14:31 CEST, Akira Okumura
Details

Note You need to log in before you can comment on or make changes to this problem.
Description Akira Okumura 2010-04-17 14:30:29 CEST
When I set the finish of a surface to groundbackpainted or polishedbackpainted, its reflectivity is calculated twice, in other words, effective reflectivity is square of the given parameter.

In the attached source code which is modified from ExN06, I set the reflectivity to 20%. But 9613 of 10000 photons are absorbed at a boundary (effective reflectivity is 20% x 20% = 4%!). Please try

$ tar zxvf N06.tgz
$ cd N06
$ make
$ exampleN06
Idle> /control/execute optPhoton.mac
Idle> /run/beamOn 10000
Comment 1 Akira Okumura 2010-04-17 14:31:43 CEST
Created attachment 72 [details]
test code for groundbackpainted and reflectivity
Comment 2 gum 2010-04-20 02:10:33 CEST
Thanks Akira,

for pointing this out. You are absolutely right. The bug was introduced when I allowed:

5th  Nov 2009 Peter Gumplinger (op-V09-02-03)
              G4OpBoundary::PostStepDoIt - all dielectric_dielectric
              surfaces may now have a reflectivity <1; not only
              'frontpainted' as was the case in the past.

most certainly upon a user's request to have a simple dielecric interface which was nevertheless not 'perfect'.

As you point out, not only 'frontpainted' surfaces have had historically a reflectivity attached to them but also 'backpainted' and the latter decision was/is implemented in the code of DielectricDielectric, while the calling code in G4OpBoundaryProcess.cc was changed to read:

        else if (type == dielectric_dielectric) {

.....

          else {
                  if( !G4BooleanRand(theReflectivity) ) {
                    DoAbsorption();
                  }
                  else {
                    DielectricDielectric();
                  }

when it simply read in the past:

          else {
               DielectricDielectric();
          }

I don't want to change the code in DielectricDielectric(), instead (more spaghetti) I'll change to:

          else if ( theFinish == polishedbackpainted ||
                    theFinish == groundbackpainted ) {
                    DielectricDielectric();
          }
          else {
                  if( !G4BooleanRand(theReflectivity) ) {
                    DoAbsorption();
                  }
                  else {
                    DielectricDielectric();
                  }
          }

or a permutation which requires fewer else ifs.

Please, try it out.

Peter
Comment 3 gum 2010-04-20 02:58:33 CEST
There is a new tag op-V09-03-01 which will be included in an upcoming patch to 9.3. In the meantime, the new code for (type == dielectric_dielectric) reads:

        else if (type == dielectric_dielectric) {

          if ( theFinish == polishedbackpainted ||
               theFinish == groundbackpainted ) {
             DielectricDielectric();
          }
          else {
             if ( !G4BooleanRand(theReflectivity) ) {
                DoAbsorption();
             }
             else {
                if ( theFinish == polishedfrontpainted ) {
                   DoReflection();
                }
                else if ( theFinish == groundfrontpainted ) {
                   theStatus = LambertianReflection;
                   DoReflection();
                }
                else {
                   DielectricDielectric();
                }
             }
        }