EM.Ferma Tutorial Lesson 1: Calculating the Electric Field and Potential Due to Charges

From Emagtech Wiki
Jump to: navigation, search
Tutorial Project: Calculating the Electric Field and Potential Due to Charges
STATTUT1 12.png

Objective: In this project, spherical charges are modeled and their electric field and potential is computed.

Concepts/Features:

  • CAD Objects
  • Charge Sources
  • Mesh Generation
  • Field Sensor Observable
  • Electric Field
  • Electric Scalar Potential
  • Field Visualization
  • Data Manager
  • EM.Grid

Minimum Version Required: All versions

'Download2x.png Download Link: [1]

What You Will Learn

This tutorial will guide you through all the necessary steps required to set up and perform a basic electrostatic simulation and visualize and graph the simulation results. Specifically, you will draw spherical charge objects and analyze their electric field and potential.

Attention icon.png We strongly recommend that you read through the first few tutorials and study them carefully before setting up your own projects.

Getting Started

Open the EM.Cube application by double-clicking on its icon on your desktop. By default, EM.Cube opens a blank project with the name “UntitledProj1” in its CubeCAD Module. You can start drawing objects and build up your physical structure right away. Or you can initiate a new project by selecting the New Fdtd newb.png button of the System Toolbar or using the keyboard shortcut Ctrl+N. This opens up the New Project Dialog, where you can enter a title for your new project and set its path on your hard drive. From the same dialog, you can also set the project’s Length Units, Frequency Units, Center Frequency and Bandwidth.

The project workspace.
The New Project dialog.

For this tutorial lesson, set the following parameters in the new project dialog:

Starting Parameters
Name STATICLesson1
Length Units Millimeters
Frequency Units GHz
Center Frequency 1GHz
Bandwidth 1GHz

Click the Create button of the dialog to accept the settings. A new project folder with your given name is immediately created at your specified path.

To navigate to EM.Ferma (EM.Cube's Static Module), simply select its icon from the Module Toolbar on the left side of the screen. Any module may be selected this way. Selecting the module icon changes the contents of the navigation tree to reflect the types of objects supported by the current module.

Attention icon.png EM.Ferma is a static simulator that solves electromagnetic problems at DC or under low-frequency quasi-static approximation. Therefore, always leave the project's center frequency and bandwidth at their default value of 1GHz, as they are not used by the static simulations.

Creating a Charge Source Group and a Sphere Object

The New Charge Source dialog.

Before you draw a spherical charge object, first you have to create a charge object category on the navigation tree. In EM.Ferma, objects are grouped together and organized by their static behavior under the “Physical Structure” node of the navigation tree. There are several categories to choose from: Fixed-Potential PEC Objects, Dielectric/Magnetic Materials, Volume Charges, etc. four categories: PEC (metal), Dielectric, Charge (Source) and Current (Source). All the objects belonging to the same charge group have the same color as well as the same charge density.

To create a new charge category, right-click on the Volume Charge item in the navigation tree and select Insert New Charge Source.... The New Charge Source dialog opens up with a default name CS_1 and a default purple color. In the section titled "Source Properties", you will see a default value of -1e-5C/m^3 for Charge Density. This means a default negative charge. The change this to a positive value of +1e-8 C/m3. Close the dialog and return to the project workspace (main window). The last object category created in the navigation tree remains as the "Active" group and highlighted in bold letters, meaning that all the objects you create and draw will belong to this group.

Select the Sphere Tool from the Object Toolbar (or use the keyboard shortcut F6, or the menu item Object > Solid > Sphere).

EM.Cube's Object Toolbar.

With the sphere tool selected, click the origin (0,0,0), and drag the mouse to start drawing a sphere. As you drag the mouse farther away from the center, the radius of the sphere grows. You can see the value of the radius in the object's property dialog, which pops up at the lower right corner of the screen. When the radius reaches a value of 5 units, left-click to lock-in the value. You may also left-click at any point and adjust the length by typing in a value of 5 in the object’s property dialog.

Sphere's property dialog.
The drawn Sphere object and the default domain box enclosing it.
EM.Ferma's navigation tree.

Once you draw your sphere object, its name, Sphere_1, is added to the navigation tree under CS_1 group, where it belongs. Note that a default blue box is automatically placed around the object. This is the domain box. You will explore the computational domain and boundary conditions in the next tutorial lesson. For this lesson, you will leave the default domain box intact.

Attention icon.png If you have a mouse with a scroll wheel, you can use the scroll wheel to zoom in or zoom out while you draw the line. You can also rotate the view using the right mouse button, or pan the view using the right mouse button while holding the keyboard’s Shift Key down.

Once your drawing is complete, you can zoom to fit your structure into the screen using the keyboard shortcut Ctrl+E or by clicking the Zoom Extents Fdtd zoomextents.png button of View Toolbar. After you have rotated or panned the view, you can always restore EM.Ferma’s standard perspective view using the keyboard’s Home key or by clicking the Perspective View Fdtd perspective.png button of View Toolbar.

Grid Settings & Mesh Generation

EM.Ferma solves Poisson's equation using the Finite Difference (FD) method. In this numerical method, the computational domain is discretized into a large number of elementary cells, whereby Poisson's differential equation is reduced to a finite difference equation. EM.Ferma uses a fixed-cell grid to discretize the computational domain. You can control the mesh cell size and therefore the total number of cells along the X-, Y- and Z-axes independently. The mesh properties can be accessed by clicking the Mesh Settings Fdtd meshsettings.png button of the Simulate Toolbar or using the keyboard shortcut Ctrl+G or selecting the menu item Simulate > Discretization > Mesh Settings. The default mesh cell size is 1 project unit along all three principal directions. For this tutorial, set the cell size along all the three directions X, Y and Z to 0.5mm to generate a finer mesh.

To view the mesh, click the Show/Generate Mesh Fdtd meshshow.png button of the Simulate Toolbar or alternatively use the keyboard shortcut Ctrl+M. In general, the mesh view shows how the simulation engine sees your physical structure. You can also display the three mesh grid planes by right-clicking on one of the three items XY Grid Plane, YZ Grid Plane, or ZX Grid Plane in the “Discretization” section of the navigation tree and selecting Show from the contextual menu. To remove the grid planes from the project workspace, open the same contextual menu and select Hide. You can move the grid planes across the computational domain using PageUp or PageDown buttons.

EM.Ferma's Mesh Settings dialog.
The generated fixed-cell mesh for the sphere and the XY grid plane.

Defining Project Observables

Project observables are output quantities that you would like to compute at the end of an electrostatic simulation. Field sensors are used to visualize the near fields of your structure and the electric potential on a plane parallel to one of the three principal planes. The field sensor planes extend across the entire computational domain. To define a field sensor, right click on the Field Sensors item in the “Observables” section of the navigation tree and select Insert New Observable… In the Field Sensor Dialog, enter the point (0, 0, 0) for Coordinates and select Z from the drop-down list labeled Direction. This means that your field sensor plane will be the XY plane, which passes through the center of the sphere. Accept the other default settings in the dialog box, and select OK to continue. A new entry Sensor_1 is added to the navigation tree, and the field sensor is now represented in the project workspace by a purple plane across the computational domain. Next, define a second field sensor observable, this time parallel to the YZ Plane. Repeat the same procedure, and in the Field Sensor Dialog, enter the point (0, 0, 0) for Coordinates and select X from the drop-down list labeled "Direction".

Field Sensor dialog.
The two defined field sensor planes in the XY and YZ planes.

Running the Electrostatic Simulation

At this time, your project is ready for electrostatic simulation. Click the Run Fdtd runb.png Button of the Simulate Toolbar to open up the Simulation Run Dialog. Or alternatively, use the keyboard shortcutCtrl+R, or select the menu item Simulate > Run… The simplest simulation mode in EM.Ferma is “Analysis”. In this mode, your physical structure is taken “As Is”, and its mesh is passed to the electrostatic simulation engine along with the necessary information regarding the sources and observables.

Before you run your first electrostatic simulation in EM.Ferma, let’s take a closer look at the static engine’s settings. Click the Settings button next to the “Select Engine” drop-down list to bring up the Static Engine Settings Dialog . Currently, there is only one numerical solvers and it is "Stabilized Bi-CG". The Convergence Error by default is set to 1e-3 and the maximum number of iterations is set to 10,000. These settings usually suffice for most simulations, and you will keep them for this tutorial lesson.

To run the simulation, click the Run button of the Simulation Run Dialog. A separate window pops up displaying messages from the simulation engine. Once the simulation has been completed, you can close the message window and return to the project workspace. The navigation tree is now populated with simulation results in its "Field Sensors"" section.

EM.Ferma's Run dialog.
EM.Ferma's Simulation Engine Settings dialog.

Visualizing the Simulation Data

The field sensor component plots shown in the "Observables" section of EM.Ferma's navigation tree.

EM.Cube’s computational modules usually generate two types of data: 2D and 3D. 2D data are graphed in EM.Grid. 3D data are visualized in EM.Cube’s project workspace, and the plots are usually overlaid on the physical structure. The field sensor section of the navigation tree has a list of twelve amplitude and phase plots for all the six field components: Ex, Ey, Ez, and Hx, Hy, Hz. There are also two additional plots for the magnitude of total electric field and total magnetic field as well as the electric scalar potential and the magnitude of the magnetic vector potential. In an electrostatic simulation, the magnetic field is assumed to be zero. Therefore, you will only have electric field and electric potential plots. Moreover, both the field and potential are real-valued. The electric potential is plotted on a color-coded intensity plots that may involve both negative and positive values. Click on any of these plots to display them in the project workspace. You can use the standard view operations such as dynamic zoom, rotate view, pan view, etc. to better examine these plots.

The X-component of electric field distribution in the XY plane.
The Y-component of electric field distribution in the XY plane.
Total electric field distribution in the XY plane.
Electric potential distribution in the XY plane.
The Y-component of electric field distribution in the YZ plane.
The Z-component of electric field distribution in the YZ plane.
Total electric field distribution in the YZ plane.
Electric potential distribution in the YZ plane.

Verifying Your Simulation Results

The contents of the data file Sensor_1_X_ETotal.DAT viewed in Data Manager.

Using Gauss' law one can derive the following relationships for the electric field of a uniform spherical charge distribution:

[math] E_r(r) = \frac{\rho}{3\epsilon_0}r, \ \ \ \ \ \ \ r\le a [/math]

[math] E_r(r) = \frac{a^3\rho}{3\epsilon_0} \frac{1}{r^2}, \ \ \ \ \ r\gta [/math]

where a is the radius of the sphere, ρ is the charge density, and ε0 = 8.8542×10-12 F/m is the permittivity of the free space. For the spherical charge object you built earlier, at r = 5mm, you will find:

[math] E_r(r = 0.005m) = \frac{(10^{-8})(5\times 10^{-3})}{3 \times 8.8542 \times 10^{-12}} = 1.882 V/m [/math]

Besides the color-coded electric field distribution maps, EM.Ferma also generates 2D Cartesian graphs of the total electric fields along the crosshairs of the field sensor plane. You can move the crosshairs around by changing the Coordinates values in the field sensor dialog. By default, the crosshairs of both Sensor_1 and Sensor_2 which you defined earlier are set at X = Y = 0.

A list of all the 2D output data files generated at the end of a simulation can be viewed in EM.Ferma’s Data Manager. To open this dialog, click the Data Manager Fdtd datamanagerb.png button of Simulate Toolbar, or use the keyboard shortcut Ctrl+D, or access the menu item Simulate > Data Manager, or right-click on the Data Manager item in the “Observables” section of the navigation tree and select Open Data Manager…

EM.Ferma's Data Manager showing a list of available 2D graphs and data files.

Select the data file “Sensor_1_X_ETotal.DAT” and double-click on it or click the View button of Data Manager to see its contents. You will find a spreadsheet with two columns, one for the X values in the project units and the other for the total electric field along the X-axis in V/m. While “Sensor_1_X_ETotal.DAT” is selected in the Data Manager, click the Plot button to open "EM.Grid". For multiple file selections, use the keyboard’s Ctrl key, or use the Shift key to select a range of rows in the list. The total E-field is plotted as a function of the coordinate X on a Cartesian graph in EM.Grid. Note that the field increases linearly from r = 0 to r = 5mm, where it reaches a value of 1.9V/m (very close to the value we calculated earlier) and it then drops down as 1/r2. Next, plot the data file "Sensor_1_X_EPotential.DAT" and see the variation of the electric potential as a function of distance.

A Cartesian graph of the total electric field along the X-axis.
A Cartesian graph of the electric potential along the X-axis.


Aboutcube over.png More Articles Related To: EM.Cube

Simulation Modules: EM.Tempo - EM.Picasso - EM.Terrano - EM.Libera - EM.Illumina

Modeling & Simulation Details: Parametric Modeling, Sweep & Optimization - Hybrid Modeling - Data Visualization and Processing



Back to EM.Cube Wiki Main Page