Commit be1e8fcf by Christophe Geuzaine

little test showing how to compute areas/volumes with plugins

parent 83684cd5
Pipeline #947 passed with stage
in 59 minutes 16 seconds
SetFactory("OpenCASCADE");
r = 1;
Sphere(1) = {0,0,0, r};
Sphere(2) = {2,0,0, r};
Mesh.CharacteristicLengthMin = 0.1;
Mesh.CharacteristicLengthMax = 0.1;
// hide volume 2 (to test Plugin(Integrate)'s ability to only integrate on
// what's visible)
Recursive Hide { Volume{2}; }
// mesh
Mesh 3;
// compute post-processing data view with constant value 1 on the mesh
Plugin(NewView).Run;
Plugin(ModifyComponents).View = 0;
Plugin(ModifyComponents).Expression0 = "1";
Plugin(ModifyComponents).Run;
// compute surface of sphere 1
Plugin(Integrate).View = 0;
Plugin(Integrate).Visible = 1; // only integrate on what's visible
Plugin(Integrate).Dimension = 2; // only integrate on 2D elements (triangles)
Plugin(Integrate).Run;
Printf("Area = %g (exact = %g)", View[PostProcessing.NbViews-1].Max, 4*Pi*r^2);
// compute volume of sphere 1
Plugin(Integrate).View = 0;
Plugin(Integrate).Visible = 1; // only integrate on what's visible
Plugin(Integrate).Dimension = 3; // only integrate on 3D elements (tetrahedra)
Plugin(Integrate).Run;
Printf("Volume = %g (exact = %g)", View[PostProcessing.NbViews-1].Max, 4/3*Pi*r^3);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment