Define a meniscus solid

Yes, I think that it is a problem with the orbs position and radius. With Boolean solids the positioning sometimes is not obvious.

In you case the reference system of the Boolean solids is the reference system of the cylinder. In other words the cylinder is placed in the origin. To have a correct shape of the meniscus you should calculate the position and radius of the orbs.

I would suggest that you first try implement the intersection of the cylinder and the orb number one. After it will look OK, then add the subtraction.

BTW, you can try to draw all three solids separately, just for better understanding the relative positions of the solids.

Yes. You can “/vis/drawLogicalVolume <log-vol-name>” to see components.

thank you the both @evc and @allison I think that I can set these parameters

running the app I get this

Unfortunately, i can’t see in a good way because (As you cas see by the print screen) Geant4 open the visualization by using OpenGL and it is a very small picture and I can’t rotate it.
I have Qt Creator, but how can I open the visualization by Qt to see it better?

This is my vis.mac
vis.txt (4.0 KB)

When you compile Geant4 specify that it should be compiled together with Qt, for example:
-DCMAKE_PREFIX_PATH=/usr/local/Qt/5.5/clang_64

Relative to the parameters of the cylinder and orbs, the picture below gives an idea on their values.

Thank you @evc regarding of the meniscus parameters, tomorrow I will try to set them according to your paint.

Regarding of QT I tried to build Geant4 again so I wrote

cmake -DCMAKE_INSTALL_PREFIX="C:\Program Files\geant4_10_06-install" "C:\Program Files\geant4_10_06" -DCMAKE_PREFIX_PATH="C:\Qt\5.15.0\winrt_x64_msvc2019"

and it said

GEANT4_USE_QT: Build Geant4 with Qt support

but when I run the simulation it still open it by OpenGl (indeed, when I run it …Geant 4 just write it found opengl

I don’t know if it could depend on some warning (or erro that I see during the Geant4 building after I do the commands
cmake --build . --config Release
and
cmake --build . --config Release --target install
)

here the log

log.txt (643.4 KB)

but even if see these errors Geant4 looks like working but it still use opengl instead of Qt…
Should I write any command to open by QT?
Thank you

I am not an expert in MS Windows and it is difficult for me to figure out what went wrong when compiling Geant4 with Qt. Try to ask for assistance at the Getting Started category or at the Recording, Visualizing and Persisting Data category. There was already topics on that subject:

Thank you @evc I read the topic that you linked but it doesn’t look like my same problem…So I will try to open a new topic in Getting Start!
Thank you for your help !

Sorry @allison how should I use this command?

This is my Boolean solid definition

 G4double pi = 3.14159265358979323846;
  G4double pRMin = 0., pRMax = 0.75*cm, pDz = 1.5*mm, pSPhi = 0., pDPhi = 2*pi;
G4double pMenRmax1 = 0.75*cm, pMenRmax2 = 0.74*cm;
    G4Orb* MenOrb1 =    new G4Orb("MenOrb1", pMenRmax1);
    G4Orb* MenOrb2 =    new G4Orb("MenOrb2", pMenRmax2);
    G4Tubs* MenTub =    
    new G4Tubs("MenTube",                    //its name
        pRMin, pRMax, pDz, pSPhi, pDPhi);    //its size*/
    G4RotationMatrix identity;
	G4ThreeVector positionMenOrb1(0,0,0.65*cm);
	G4ThreeVector positionMenOrb2(0,0,0.8*cm);
	G4VSolid* MenTmp = new G4IntersectionSolid("MenTmp", MenTub, MenOrb1, &identity, positionMenOrb1);
	G4VSolid* Meniscus = new G4SubtractionSolid("Meniscus", MenTmp, MenOrb2, &identity, positionMenOrb2);
G4LogicalVolume* logicEnv =                         
    new G4LogicalVolume(Meniscus,            //its solid    //solidEnv
                        env_mat,             //its material
                        "Meniscus");         //its name
                        
    G4LogicalVolume* logicEnv2 =                         
    new G4LogicalVolume(Meniscus,            //its solid   //solidEvn2
                        env_mat,             //its material
                        "Meniscus2");         //its name
                   
  new G4PVPlacement(0,                       //no rotation
                    G4ThreeVector(),         //at (0,0,0)
                    logicEnv,                //its logical volume
                    "Meniscus",              //its name                               //Envelope
                    logicWorld,              //its mother  volume
                    false,                   //no boolean operation
                    0,                       //copy number
                    checkOverlaps);          //overlaps checking
                    
 new G4PVPlacement(0,                       //no rotation
                    G4ThreeVector(0,0,2.3*cm),         //at (0,0,2.15) 2.15= 0.15*cm+2*cm
                    logicEnv2,                //its logical volume
                    "Meniscus",              //its name                      //Envelope2
                    logicWorld,              //its mother  volume
                    false,                   //no boolean operation
                    0,                       //copy number
                    checkOverlaps);          //overlaps checking

but if I write in the vis.mac the command
/vis/drawLogicalVolume logicEnv
/vis/drawLogicalVolume logicEnv2

I get this error


and a similiar one for the loginEnv2

Your logical volume name is “Meniscus”.

Thank you @allison it worked

Sorry @evc I tried to follow your layout. Then I setted

 G4double pMenRmax1 = 1.85*cm, pMenRmax2 = 1.2*cm;
G4Orb* MenOrb1 =    new G4Orb("MenOrb1", pMenRmax1);
G4Orb* MenOrb2 =    new G4Orb("MenOrb2", pMenRmax2);
G4Tubs* MenTub =    
new G4Tubs("MenTube",                    //its name
    pRMin, pRMax, pDz, pSPhi, pDPhi);    //its size*/
G4RotationMatrix identity;
G4ThreeVector positionMenOrb1(0,0,1.7*cm);
G4ThreeVector positionMenOrb2(0,0,1.1*cm);
G4VSolid* MenTmp = new G4IntersectionSolid("MenTmp", MenTub, MenOrb1, &identity, positionMenOrb1);
	G4VSolid* Meniscus = new G4SubtractionSolid("Meniscus", MenTmp, MenOrb2, &identity, positionMenOrb2);

Here the visualization of the three solids by using the command tha @allison wrote me

And here the targets


Do you think that it is a good choise of the parameters, or should I change them?

Moreover, is there a way to write the dimension of the thickness?
I would like to get in the center a thickness 3mm …but I think it is lower
Thank you

G4double z1 = positionMenOrb1.z() - pMenRmax1;
G4double z2 = positionMenOrb2.z() - pMenRmax2;
G4double thickness = z2 - z1;

In your case thickness = (11 - 12) - (17 - 18.5) = 0.5 mm

Hi @evc , thank you !!!

Sorry @evc I define the meniscus

G4double pRMin = 0., pRMax = 0.75*cm, pDz = 0.35*cm, pSPhi = 0., pDPhi = 2*pi;  
 G4double pMenRmax1 = 1.90*cm, pMenRmax2 = 1.2*cm;
    G4Orb* MenOrb1 =    new G4Orb("MenOrb1", pMenRmax1);
    G4Orb* MenOrb2 =    new G4Orb("MenOrb2", pMenRmax2);
    G4Tubs* MenTub =    
    new G4Tubs("MenTube",                    //its name
        pRMin, pRMax, pDz, pSPhi, pDPhi);    //its size*/
    G4RotationMatrix identity;
	G4ThreeVector positionMenOrb1(0,0,1.55*cm);
	G4ThreeVector positionMenOrb2(0,0,1.15*cm);
	G4VSolid* MenTmp = new G4IntersectionSolid("MenTmp", MenTub, MenOrb1, &identity, positionMenOrb1);
	G4VSolid* Meniscus = new G4SubtractionSolid("Meniscus", MenTmp, MenOrb2, &identity, positionMenOrb2);

in order to have a thickness 3mm at (x,y)=(0,0) . Now I’ve to get the scoring mesh to my targets (i.e. to study the deposited energy in the targets). The scoring mesh just allows to use cylindrical or box scoring volume, then I’ve to put my targets in 2 cylindrical scoring volumes, but I would like to build the scoing volume having thickness value equivalent to maximum thickness of the meniscus (i.e. it must contain all the meniscus, but it must not be higher than the meniscus…for example I can build a scoing volume having thickness 0.7cm as the G4Tube that I used to build the meniscus, but in that way I will have a piece of the scoring volume in which there isn’t the meniscus). Is there a way to measure that ?
Thank you

To calculate what part of the of the tube does not contain the meniscus just calculate the volume of the tube and the meniscus. Volume of any solid can be calculated by CubicVolume() method.

Thank you @evc …can you check if I understood, please?

  1. I build the meniscus starting from a G4tube having radius 7.5mm and thickness 7mm then it’s volume is Vtube=pir^2h=pi7.5^27=1236,38mm^3

  2. In the stepping action I wrote
    G4LogicalVolume* volume = step->GetPreStepPoint()->GetTouchableHandle() ->GetVolume()->GetLogicalVolume();
    if (volume == fScoringVolume) {
    G4double MeniscusVolume = volume->GetSolid()->GetCubicVolume();
    G4cout << "MeniscusVolume = " << MeniscusVolume << G4endl;

  3. Running the simulation, I read on the terminal
    MeniscusVolume = 618.437
    i.e. the meniscus volume is 618.437mm^3

  4. Now I’ve to draw the scoring volume to get the scoring mesh…did you mean that I’ve to build a cylinder having a volume equivalent to the meniscus volume? I.e. my meniscus volume is Vmeniscus =618.437, then I need a scoring volume 618.437mm^3, so I’ve to build a cyilinder having Vscore=618.437=pi7.5^2h, then h=618.437/(pi*7.5^2)=3.5mm ?
    Is it ok in order to contain all the meniscus and to not contain a lot of vacuum?

Isn’t there a way to get the maximum and minimum z values of the meniscus?
Thank you

I am not a right person to ask question on scoring volume. I just answered the question on how to measure what part of the tube is not occupied by the meniscus.

Z coordinate of the intersection of a cylinder with a sphere can be calculated by applying the Pythagoras’s theorem: Z = sqrt(R^2 - r^2), where R and r are the radii of the sphere and the cylinder, provided that the sphere is located at the origin.

Hello @evc thank you. It isn’t a scoring mesh problem…it was just a problem to build a cylinder having dimensions in order to contain all the meniscus, but not so big to contain a lot of vacuum. Anyway, thanks to your help, calculating the meniscus volume I thought to build a fake cyinder solid and to check by visualization if dimension could be fine…

image

by the visualization, I think that this volume is good.
Thank you for your precious help!

Sorry @evc, I forgot to wish you happy new year in my previous message!

Thank you! Stay safe and All the best for coming new year!