04 1 Maxwell Field Calculator
04 1 Maxwell Field Calculator
1
Field Calculator
The Field Calculator can also operate with geometry quantities for three
basic purposes:
- plot field quantities (or derived quantities) onto geometric entities;
- perform integration (line, surface, volume) of quantities over specified
geometric entities;
- export field results in a user specified box or at a user specified set of
locations (points).
Another important feature of the (field) calculator is that it can be fully script
driven. All operations that can be performed in the calculator have a
corresponding “image” in one or more lines of VBscript code. Scripts are
widely used for repetitive post-processing operations, for support purposes
and in cases where Optimetrics is used and post-processing scripts provide
some quantity required in the optimization / parameterization process.
This document describes the mechanics of the tools as well as the “softer”
side of it as well. So, apart from describing the structure of the interface this
document will show examples of how to use the calculator to perform many
of the post-processing operations encountered in practical, day to day
engineering activity using Maxwell. Examples are grouped according to the
type of solution. Keep in mind that most of the examples can be easily
transposed into similar operations performed with solutions of different
physical nature.
- Push repeats the contents of the top stack register so that after the
operation the two top lines contain identical information;
- Pop deletes the last entry from the stack (deletes the top of the stack);
- RlDn (roll down) is a “circular” move that makes the contents of the stacks
slide down one line with the bottom of the stack advancing to the top;
- RlUp (roll up) is a “circular” move that makes the contents of the stacks
slide up one line with the top of the stack dropping to the bottom;
- Exch (exchange) produces an exchange between the contents of the two
top stack registers;
- Clear clears the entire contents of all stack registers;
- Undo reverses the result of the most recent operation.
The user should note that Undo operations could be nested up to the level
where a basic quantity is obtained.
Named Solution
Expressions Context
Stack
commands
Calculator
Buttons
- Input contains calculator buttons that allow the user to enter data in the stack;
sub-categories contain solution vector fields (B, H, J, etc.), geometry(point, line,
surface, volume, coordinate system), scalar, vector or complex constants
(depending on application) or even entire f.e.m. solutions.
- General contains general calculator operations that can be performed with
“general” data (scalar, vector or complex), if the operation makes sense; for
example if the top two entries on the stack are two vectors, one can perform the
addition (+) but not multiplication (*);indeed, with vectors one can perform a dot
product or a cross product but not a multiplication as it is possible with scalars.
- Scalar contains operations that can be performed on scalars; example of scalars
are scalar constants, scalar fields, mathematical operations performed on vector
which result in a scalar, components of vector fields (such as the X component of
a vector field), etc.
- Vector contains operations that can be performed on vectors only; example of
such operations are cross product (of two vectors), div, curl, etc.
- Output contains operations resulting in plots (2D / 3D), graphs, data export, data
evaluation, etc.
As a rule, calculator operations are allowed if they make sense from a mathematical
point of view. There are situations however where the contents of the top stack
registers should be in a certain order for the operation to produce the expected result.
The examples that follow will indicate the steps to be followed in order to obtain the
desired result in a number of frequently encountered operations. The examples are
grouped according to the type of solution (solver) used. They are typical medium/higher
level post-processing task that can be encountered in current engineering practice.
Throughout this manual it is assumed that the user has the basic skills of using the
Field Calculator for basic operations as explained in the on-line technical
documentation and/or during Ansoft basic training.
Note: The f.e.m. solution is always performed in the global (fixed) coordinate system.
The plots of vector quantities are therefore related to the global coordinate system and
will not change if a local coordinate system is defined with a different orientation from
the global coordinate system.
Electrostatic Examples
Example ES1: Calculate the charge density distribution and total
electric charge on the surface of an object
Description: Assume an electrostatic (3D) application with separate metallic
objects having applied voltages or floating voltages. The task is to calculate the
total electric charge on any of the objects.
Calculate/plot the charge density distribution on the object; the sequence of
calculator operations is described below:
Vector > Unit Vec > Normal (creates the normal unit vector corresponding to the
surface of interest)
Vector > Dot (creates the dot product between D and the unit normal vector to
the surface of interest, equal to the surface charge density)
Add (input “charge_density” as the name) -> OK (creates a named expression
and adds it to the list)
Done (leaves calculator)
(select the surface of interest from the model)
Maxwell 3D > Fields > Fields > Named Expressions (a Selecting calculated
expression window appears)
(select “charge_density” from the list) -> OK (A Create Field Plot window
appears)
Done
1
TnE D n E nE 2
2
where the unit vector n is the normal vector to the surface of interest. The
sequence of calculator commands necessary to implement the above formula is
given below.
Add … (input “stress” as the name) > OK (creates a named expression and adds
it to the list)
Done (leaves calculator)
(select the surface of interest from the model)
Maxwell 3D > Fields > Fields > Named Expressions (a Selecting calculated
expression window appears)
(select “stress” from the list) > OK (A Create Field Plot window appears)
Done
Note: The surface in all the above calculator commands should lie in free space
or should coincide with the surface of an object surrounded by free space
(vacuum, air). It should also be noted that the above calculations hold true in
general for any instance where a volume distribution of force density is equivalent
to a surface
distribution
of stress (tension):
F fdv Tn dS
v
where Tn is the local tension force acting along the normal direction to the
surface and F is the total force acting on object(s) inside .
The above results for the electrostatic case hold for magnetostatic applications if
the electric field quantities are replaced with corresponding magnetic quantities.
There is another way to calculate the resistance which makes use of the well
known Ohm’s law.
U
RDC
I
Assuming that the conductor is bounded by two terminals, T1 and T2 (current
through T1 and T2 must be the same), the resistance of the conductor (between
T1 and T2) is given the ratio of the voltage differential U between T1 and T2 and
the respective current, I . So it is necessary to define two points on the
respective terminals and then calculate the voltage at the two locations (voltage
is called Phi in the field calculator). The rest is simple as described above.
To export the current density vector to a grid the field calculator steps are:
Input > Quantity > J
Output > Export (then fill in the data as appropriate, see Fig. CF2)
OK
Fig. CF2 Define the size of the export region (box) and spacing within
Select Calculate grid points and define minimum, maximum & spacing in all 3
directions X, Y, Z as the size of the rectangular export region (box) and the
spacing between locations. By default the location of the ASCII file containing
the export data is in the project directory. Clicking on the browse symbol one
can also choose another location for the exported file.
Note: One can export the quantity calculated with the field calculator at user
specified locations by selecting Input grid points from file. In that case the ASCII
file containing on each line the x, y and z coordinates of the locations must exist
prior to initiating the export-to-file command.
Description: There are situations where the current splits along the conduction
path. If the nature of the problem is such that symmetry considerations cannot
be applied, it may be necessary to evaluate total current in 2 or more parallel
branches after the split point. To be able to perform the calculation described
above, it is necessary to have each parallel branch (where the current is to be
calculated) modeled as a separate solid.
Before the calculation process is started, make sure that the (local) coordinate
system is placed somewhere along the branch where the current is calculated,
preferably in a median location along that branch. In more general terms, that
location is where the integration is performed and it is advisable to choose it far
from areas where the current splits or changes direction, if possible.
Here is the process to be followed to perform the calculation using the field
calculator.
Note: The integration surface (yz, in the example above) extends through the
whole region, however because of the “domain” command used previously, the
calculation is restricted only to the specified solid (that is the S surface is the
intersection between the specified solid and the integration plane).
Magnetostatic examples
Example MS1: Calculate (check) the current in a conductor using
Ampere’s theorem
The value should be reasonably close to the value of the corresponding current.
The match between the two can be used as a measure of the global accuracy of
the calculation in the general region where the closed line was placed.
The above example shows the process for calculating the X component of the
Lorentz force. Similar steps should be performed for all components of interest.
Note: The above sequence of commands makes use of one single field
component (X component). Please note that any spatial component can be used
for the purpose of calculating relative permeability in isotropic, non-linear soft
magnetic materials. The result would still be the same if we used the Y
component or the Z component. However, this does not apply for anisotropic
materials. The “smoothing” also used in the sequence is also recommended
particularly in cases where the mesh density is not very high.
1
Pav 1 * 1 *
Rr
2 2
Pav Re E H dS Re H H dS
j 0
2
I rms S S
where S is the outer surface of the region (preferably spherical), placed
conveniently far away from the source of radiation.
Assuming that a half symmetry model is used, no ½ is needed in the above
formula. The sequence of calculator commands necessary for the calculation of
the average power is as follows:
Note: The integration surface above must be an open surface (radiation surface)
if a symmetry model is used. Surfaces of existing objects cannot be used since
they are always closed. Therefore the necessary integration surface must be
created in the example above using Modeler > Surface > Create Object From
Face command.
To plot the real part of the Poynting vector the following commands
should be added to the above sequence:
Assume that the induced current through the surface marked with an arrow in
the quarter model is to be calculated. Please note that there is an expected net
current flow through the market surface, due to the symmetry of the problem. As
a general recommendation, the surface that is going to be used in the process
of integrating the current density should exist prior to solving the problem. In
some cases this also means that the geometry needs to be created in such a
way so that the particular post-processing task is made possible. Once the
object containing the integration surface exists, use the Modeler > Surface >
Create Object From Face command to create the integration surface necessary
for the calculation. Make sure that the object with expected induced currents
has non-zero conductivity and that the eddy-effect calculation was turned on.
Assuming now that all of the above was taken care of, the sequence of
calculator commands necessary to obtain separately the real part and the
imaginary part of the induced current is described on the next page:
If instead of getting the real and imaginary part of the current , one desires to do
an “at phase” calculation, the sequence of commands is:
To calculate the phase of the voltage manipulate the contents of the stack so
that the top register contains the real part of the voltage and the second register
of the stack contains the imaginary part. To calculate phase enter the following
command:
This Output Variable can be accessed two ways. First, it can be accessed
directly in the reports - make sure that the Reports Type is set to Fields (not
Transient). Second, it can be included in the Solve setup under the Output
Variables tab (which also makes it available in the reports with the Reports Type
set to Transient).
To get the value of the maximum magnetic flux density in a given volume:
The process is very similar when searching for the minimum. Just replace the
Max with Min in the above sequences.
Example TD3: Combine (by summation) the solutions from two time
steps
First, set the solution context to a certain time step, say t1 by selecting View >
Set Solution Context… and choosing an appropriate time from the list.
Note 1: For this operation to succeed it is necessary that the respective meshes
are identical. This condition is of course satisfied in transient applications
without motion since they do not have adaptive meshing. It should be noted that
this capability can be used in other solutions sequences –say static- if the
meshes in the two models are identical.
The whole operation is numeric entirely, therefore the nature of the quantities
being “combined” is not checked from a physical significance point of view. It is
possible to add for example an H vector solution to a B vector solution. This
doesn’t have of course any physical significance, so the user is responsible for
the physical significance of the operation.
For the particular case of time domain applications it is possible to study the
“displacement” of the (vector) solution from one time step to another, study the
spatial orthogonality of two solution, etc. It is a very powerful capability that can
be used in many interesting ways.
As example one can consider the case of a cylindrical conductor above the
ground plane with 1 Amp current, the voltage with respect to the ground being
1000 V. As well known, one can solve separately the magnetostatic problem (in
which case the voltage is of no consequence, and only magnetic fields are
calculated) and the electrostatic problem (in which case only the electric fields
are calculated). With Maxwell it is possible to “combine” the two results in the
post-processing phase if the assumption that the electric and magnetic fields
are totally separated and do not influence each other. One possible reason that
such an operation is meaningful from a physical point of view might be the need
for an analysis of power flow.
Assume that a magnetostatic and electrostatic problem are created with
identical geometries. Link the mesh from one simulation to the mesh of the
other, so that they will be identical – this can be accomplished in the Setup tab of
the Analysis Setup properties. Select the Import mesh box, and clicking on the
Setup Link … button. Then specify the target Design and Solution in the Setup
Link dialog. To assure that the mesh is identical in both the linked solution and
the target solution, make sure to set the Maximum Number of Passes to one (1)
in the linked solution.
Solve both these models and access the electrostatic results. Export the
electric field solution as follows:
Access now the solution of the magnetostatic problem and perform the following
operations with the calculator after placing the coordinate system in the median
plane of the conductor (yz plane if the conductor is oriented along x axis):
Input > Read (specify the name of the file containing electrostatic E field) OK
Input > Quantity > H
Vector > Cross
Input > Geometry > Volume > background > OK
General > Domain
Input > Geometry > Surface > yz
Vector > Normal
Scalar >
Output > Eval
Miscellaneous Examples
Example M1: Calculation of volumes and areas
Input > Number > Scalar (1) OK (enters the scalar value of 1)
Input > Geometry > Volume (enter the volume of interest) OK
Scalar >
Output > Eval
Input > Number > Scalar (1) OK (enters the scalar value of 1)
Input > Geometry > Surface (enter the surface of interest) OK
Scalar >
Output > Eval