FEM Example Capacitance Two Balls: Difference between revisions

From FreeCAD Documentation
mNo edit summary
mNo edit summary
 
(17 intermediate revisions by one other user not shown)
Line 20: Line 20:
[[File:Two_balls_result_2.png|1000px]]
[[File:Two_balls_result_2.png|1000px]]
<translate>
<translate>
<!--T:30-->
{{Caption|Result of the two ball example}}
{{Caption|The final result of this tutorial}}


== Requirements == <!--T:3-->
== Requirements == <!--T:3-->
Line 47: Line 48:
[[File:Two_balls_selection.png|300px]]
[[File:Two_balls_selection.png|300px]]
<translate>
<translate>
{{Caption|Selection of the Two balls example from FreeCAD examples}}


== Understanding the Simulation Case == <!--T:10-->
== Understanding the Simulation Case == <!--T:10-->
Line 65: Line 65:
[[File:Two_balls_model_full.png|1000px]]
[[File:Two_balls_model_full.png|1000px]]
<translate>
<translate>
<!--T:31-->
{{Caption|The model of the Two balls}}
{{Caption|The initial model}}


== Analysis container and its objects == <!--T:14-->
== Analysis container and its objects == <!--T:14-->


<!--T:15-->
<!--T:15-->
There are at least 8 object types needed to make this electrostatic analysis:
The objects used in this electrostatic analysis:
# [[Image:FEM_Analysis.svg|24px]] Analysis container
# [[Image:FEM_Analysis.svg|24px]] Analysis container
# [[Image:FEM_SolverElmer.svg|24px]] SolverElmer
# [[Image:FEM_SolverElmer.svg|24px]] SolverElmer
Line 76: Line 77:
# [[Image:FEM_MaterialFluid.svg|24px]] FemMaterial, a fluid material to represent the surrounding air
# [[Image:FEM_MaterialFluid.svg|24px]] FemMaterial, a fluid material to represent the surrounding air
# [[Image:FEM_ConstraintElectrostaticPotential.svg|24px]] ElectrostaticPotential, constraints (3 of them)
# [[Image:FEM_ConstraintElectrostaticPotential.svg|24px]] ElectrostaticPotential, constraints (3 of them)
# [[Image:Fem-thermomechanical-analysis.svg|24px]] ConstantVaccumPermittivity, optional
# [[Image:FEM_ConstantVacuumPermittivity.svg|24px]] ConstantVaccumPermittivity, optional
# [[Image:FEM_MeshGmshFromShape.svg|24px]] Mesh, a [[FEM_MeshGmshFromShape|Gmsh]] mesh
# [[Image:FEM_MeshGmshFromShape.svg|24px]] Mesh, a [[FEM_MeshGmshFromShape|Gmsh]] mesh
# [[Image:FEM_MeshRegion.svg|24px]] MeshRegion, a mesh region for the smaller spheres
# [[Image:FEM_MeshRegion.svg|24px]] MeshRegion, a mesh region for the smaller spheres
Line 83: Line 84:
[[File:Two_balls_analysis.png]]
[[File:Two_balls_analysis.png]]
<translate>
<translate>
<!--T:32-->
{{Caption|The 8 objects for Two balls analysis}}
{{Caption|The objects as they appear in the [[Tree_view|Tree view]]}}


== Running the FEA == <!--T:16-->
== Running the FEA == <!--T:16-->
Line 89: Line 91:
<!--T:17-->
<!--T:17-->
* In [[Tree_view|Tree view]] double click on the solver object [[Image:FEM_SolverElmer.svg|24px]].
* In [[Tree_view|Tree view]] double click on the solver object [[Image:FEM_SolverElmer.svg|24px]].
* Click on {{Button|Write}} file in the same task window. Watch the log window until it prints "write completed." You can ignore the warning about the vacuum permittivity that might appear.
* Click on {{Button|Write}} file in the same task panel. Watch the log window until it prints "write completed." You can ignore the warning about the vacuum permittivity that might appear.
* Click on {{Button|Run}}. Since this is a small analysis it should take a few seconds to run so wait till you see "ELMER SOLVER FINISHED AT" in the output.
* Click on {{Button|Run}}. Since this is a small analysis it should take a few seconds to run so wait till you see "ELMER SOLVER FINISHED AT" in the output.
* Click on {{Button|Close}} in the task window after the run is finished.
* Click on {{Button|Close}} in the task panel after the run is finished.
* Two new result objects should be created in the tree view, [[Image:FEM_PostPipelineFromResult.svg|24px]] SolverElmerResult and [[Image:TextDocument.svg|24px]] SolverElmerOutput.
* Two new result objects should be created in the tree view, [[Image:FEM_PostPipelineFromResult.svg|24px]] SolverElmerResult and [[Image:TextDocument.svg|24px]] SolverElmerOutput.


Line 102: Line 104:
* Make sure the mesh is invisible. If not, select the [[Image:FEM_MeshGmshFromShape.svg|24px]] Mesh object and press {{KEY|Space}} to toggle the visibility.
* Make sure the mesh is invisible. If not, select the [[Image:FEM_MeshGmshFromShape.svg|24px]] Mesh object and press {{KEY|Space}} to toggle the visibility.
* Also make sure the Cut object is invisible.
* Also make sure the Cut object is invisible.
* Double click on the [[Image:FEM_PostPipelineFromResult.svg|24px]] SolverElmerResult object to ope its task dialog.
* Double click on the [[Image:FEM_PostPipelineFromResult.svg|24px]] SolverElmerResult object to open its task dialog.
* Change the "Field" to "potential" and press {{Button|OK}}.
* Change the "Field" to "potential" and press {{Button|OK}}.
* You will notice that the color of the sphere has changed to blue and that the gradient on the right is showing values from 0 to 1. It should look something like this:
* You will notice that the color of the sphere has changed to blue and that the gradient on the right is showing values from 0 to 1. It should look something like this:
Line 109: Line 111:
[[File:Two_balls_potential.png|1000px]]
[[File:Two_balls_potential.png|1000px]]
<translate>
<translate>
{{Caption|Results menu dialog}}


== Post Processing the Result == <!--T:20-->
== Post Processing the Result == <!--T:20-->
Line 116: Line 117:
* While we have successfully visualised the potential result, currently we are only seeing the zero potential in the air surrounding the two balls. To view the potential on the balls we need to apply a [[FEM_PostFilterClipRegion|clip filter]].
* While we have successfully visualised the potential result, currently we are only seeing the zero potential in the air surrounding the two balls. To view the potential on the balls we need to apply a [[FEM_PostFilterClipRegion|clip filter]].
* In the tree view select the [[Image:FEM_PostPipelineFromResult.svg|24px]] SolverElmerResult object and then from the tool bar click on the button {{Button|[[Image:FEM_PostFilterClipRegion.svg|20px]] Region Clip Filter}}.
* In the tree view select the [[Image:FEM_PostPipelineFromResult.svg|24px]] SolverElmerResult object and then from the tool bar click on the button {{Button|[[Image:FEM_PostFilterClipRegion.svg|20px]] Region Clip Filter}}.
* This will open a dialog with the filter configurations. Click there on the button {{Button|[[Image:list-add.svg|16px]] Create}} and choose [[Image:Fem-post-geo-plane.svg|24px]] Plane. This adds a plane through the center of the sphere at which the result mesh is cut. To smooth the cut face, check the option '''Cut Cells'''. Eventually click {{Button|Apply}}.
* This will open a dialog with the filter configurations. Click there on the button {{Button|[[Image:list-add.svg|16px]] Create}} and choose [[Image:FEM_PostCreateFunctionPlane.svg|24px]] Plane. This adds a plane through the center of the sphere at which the result mesh is cut. To smooth the cut face, check the option '''Cut Cells'''. Eventually click {{Button|Apply}}.


</translate>
</translate>
[[File:Two_balls_postcreate.png|300px]]
[[File:Two_balls_postcreate.png|300px]]
<translate>
<translate>
{{Caption|Clip menu dialog}}


<!--T:22-->
<!--T:22-->
* In the tree view there is a new entry called Functions. It contains the created [[Image:Fem-post-geo-plane.svg|24px]] Plane. Make it invisible using {{KEY|Space}}.
* In the tree view there is a new entry called Functions. It contains the created [[Image:FEM_PostCreateFunctionPlane.svg|24px]] Plane. Make it invisible using {{KEY|Space}}.
* Double-click on the [[Image:FEM_PostFilterClipRegion.svg|24px]] Clip object in the tree view.
* Double-click on the [[Image:FEM_PostFilterClipRegion.svg|24px]] Clip object in the tree view.
* Change the "Field" to "potential" and press {{Button|OK}}.
* Change the "Field" to "potential" and press {{Button|OK}}.
Line 132: Line 132:
[[File:Two_balls_result.png|1000px]]
[[File:Two_balls_result.png|1000px]]
<translate>
<translate>
{{Caption|Result following the clip}}


<!--T:23-->
<!--T:23-->
Line 159: Line 158:


</translate>
</translate>
{{Tutorials navi{{#translation:}}}}
{{FEM Tools navi{{#translation:}}}}
{{FEM Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}

Latest revision as of 22:56, 14 December 2023

Tutorial
Topic
Finite Element Analysis
Level
Beginner
Time to complete
30 min
Authors
Sudhanshu Dubey
FreeCAD version
0.19 or above
Example files
Created programmatically
See also
None

Introduction

This example is meant to show how to simulate the 6th example of Elmer GUI Tutorials, Electrostatic equation – Capacitance of two balls, using the new FEM Examples. It illustrates how to setup the example, study it's various parts, solve it using the Elmer Solver and visualize the results using Clip Filter.

The final result of this tutorial

Requirements

  • A compatible version of FreeCAD designated in the tutorial overview.
    Use the Help → About FreeCAD to see the version of FreeCAD installed
  • No external software is needed for loading the example, viewing the mesh and geometry as well as for visualizing the results.
  • For solving the finite element analysis (FEA), the solver software Elmer must be installed on your computer. See this page for how to install Elmer.

Set up the example

Load FEM Workbench

  • Start FreeCAD, the Start Workbench should be loaded
  • Switch to FEM workbench.

Load the example

  • Go to Utilities → Open FEM examples.
  • When the GUI opens, find and open "Electrostatics Capacitance Two Balls". You can easily find the example in All or in Solvers → Elmer. For opening the example, either double click on it or select it and click Setup.

Understanding the Simulation Case

This case presents the solution of the capacitance of perfectly conducting balls in free space. A voltage difference between the balls results to electric charge being introduced to the system. The balls have also self-capacitance that comes from the voltage difference with the far field. Therefore a symmetric capacitance matrix with of size 2 × 2 needs to be solved. The capacitances may be computed from two different voltage configurations.

Understanding the Model

  • The model contains three spheres.
  1. The two smaller ones are the perfectly conducting balls.
  2. The bigger one is to simulate the surrounding air.
  • The two smaller spheres are fused together and then that fusion is is cut from the bigger sphere.

The initial model

Analysis container and its objects

The objects used in this electrostatic analysis:

  1. Analysis container
  2. SolverElmer
  3. Electrostatic, the electrostatics equation
  4. FemMaterial, a fluid material to represent the surrounding air
  5. ElectrostaticPotential, constraints (3 of them)
  6. ConstantVaccumPermittivity, optional
  7. Mesh, a Gmsh mesh
  8. MeshRegion, a mesh region for the smaller spheres

The objects as they appear in the Tree view

Running the FEA

  • In Tree view double click on the solver object .
  • Click on Write file in the same task panel. Watch the log window until it prints "write completed." You can ignore the warning about the vacuum permittivity that might appear.
  • Click on Run. Since this is a small analysis it should take a few seconds to run so wait till you see "ELMER SOLVER FINISHED AT" in the output.
  • Click on Close in the task panel after the run is finished.
  • Two new result objects should be created in the tree view, SolverElmerResult and SolverElmerOutput.

If you get an error message on solver binary or similar when triggering the analysis, check the installation of Elmer.

Visualizing Results

  • Make sure the mesh is invisible. If not, select the Mesh object and press Space to toggle the visibility.
  • Also make sure the Cut object is invisible.
  • Double click on the SolverElmerResult object to open its task dialog.
  • Change the "Field" to "potential" and press OK.
  • You will notice that the color of the sphere has changed to blue and that the gradient on the right is showing values from 0 to 1. It should look something like this:

Post Processing the Result

  • While we have successfully visualised the potential result, currently we are only seeing the zero potential in the air surrounding the two balls. To view the potential on the balls we need to apply a clip filter.
  • In the tree view select the SolverElmerResult object and then from the tool bar click on the button Region Clip Filter.
  • This will open a dialog with the filter configurations. Click there on the button Create and choose Plane. This adds a plane through the center of the sphere at which the result mesh is cut. To smooth the cut face, check the option Cut Cells. Eventually click Apply.

  • In the tree view there is a new entry called Functions. It contains the created Plane. Make it invisible using Space.
  • Double-click on the Clip object in the tree view.
  • Change the "Field" to "potential" and press OK.
  • Toggle the visibility of the SolverElmerResult object using Space and you should see something like this:

Now we can clearly see that potential distribution in and around the balls.

Note that when Apply Changes is on, you would have been able to select the "Field" in the clip dialog directly and not to reopen it after the plane was created.

Finding the Capacitance

  • Our actual focus is to find the capacitance which is contained in the SolverElmerOutput.
  • Double click on SolverElmerOutput to open it. Scroll down till you find:
StatElecSolve: Capacitance matrix computation performed (i,j,C_ij)
StatElecSolve:   1  1    5.07016E+00
StatElecSolve:   1  2    1.69328E+00
StatElecSolve:   2  2    5.07201E+00
  • Here, our desired result is C12 = 1.69328. This value is close to the 1.691 given in the Elmer GUI Tutorials. We can get an even closer value by making a finer Mesh Region but this activity is left for the user. Also, the user is advised to play with the Clip Filter to get a visual result similar to the first picture of this tutorial.