Background info

I want to run brain simulations with models from the PHM repository (not relevant to the problem but suits the narrative) which are shipped in STL format. The meshes of the STL have been fixed using MeshFix and the following .geo file has been used to generate the 3D mesh.

Merge "skin_fixed.stl";
Merge "skull_fixed.stl";
Merge "csf_fixed.stl";
Merge "gm_fixed.stl";
Merge "wm_fixed.stl";
Merge "ventricles_fixed.stl";
Merge "cerebellum_fixed.stl";

Surface Loop(1) = {1};
Surface Loop(2) = {2};
Surface Loop(3) = {3};
Surface Loop(4) = {4};
Surface Loop(5) = {5};
Surface Loop(6) = {6};
Surface Loop(7) = {7};

// Generate the volumes
Volume(1) = {1};
Volume(2) = {2};
Volume(3) = {3};
Volume(4) = {4};
Volume(5) = {5};
Volume(6) = {6};
Volume(7) = {7};

// Create physical surfaces
Physical Surface("S_Skin", 1) = {1};
Physical Surface("S_Skull", 2) = {2};
Physical Surface("S_CSF", 3) = {3, 6};
Physical Surface("S_Grey_Matter", 4) = {4};
Physical Surface("S_White_Matter", 5) = {5};
Physical Surface("S_Cerebellum", 6) = {7};

// Create physical volumes
Physical Volume("V_Skin", 1) = {1};
Physical Volume("V_Skull", 2) = {2};
Physical Volume("V_CSF", 3) = {3, 6};
Physical Volume("V_Grey_Matter", 4) = {4};
Physical Volume("V_White_Matter", 5) = {5};
Physical Volume("V_Cerebellum", 6) = {7};

Mesh 3; // Create the 3D mesh

The script successfully meshes the model and the generated mesh is correct. The problem is how can I add electrodes on the head (cylindrical volumes) so that later I use those as the boundary surfaces to add the boundary conditions in the FEM solver.


I have tried creating a cylinder and applying boolean operation with the STL, but obviously this did not work. How can I create such a thing on the STL surface? There is no CAD available just the STL files. For copyright reasons I am not able to share the STL, but I will try to illustrate below the problem using a sphere in paint.

enter image description here

I want the electrode (red volume) to be tangent with the surface of the skin (black sphere). The black sphere is only in STL format.

Triangle position problem

Finally the next problem that will arise is how can I get the individual triangle positions on the STL surface through the file in order to be able and add the electrode perpendicular to the surface and to the right spot, without doing trial and error work to find the location.

Thanks in advance!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.