PredefinedField

The object is used to initialize static magnetic fields for tracking- or PIC-simulations.

Beside homogeneous h- and b-fields also rotational symmetric b-fields and imported fields can be defined.

Although the methods of this object can be used to import external electric or magnetic fields from files, it is recommended to use the dialog box "Simulation: Sources and Loads -> Source Field -> Import External Field" to this end  instead.

Methods

Reset

Resets all internal settings to their default values.

 

FieldType (enum fieldtype)

Type of the source field.

fieldtype (enum )

meaning

"Hconst"

A constant homogeneous magnetic field is defined.

"Bconst"

A constant homogeneous magnetic flux density is defined.

"Bz"

A rotational syymetric field is defined.

"External"

An external field from an ASCII file or a .m3d file is imported.

 

HFieldVector (double xcomp, double ycomp, double zcomp)

Constant h-field,. The orientation and strength is given by the three arguments. Only evaluated if fieldtype "Hconst" is chosen.

 

BFieldVector (double xcomp, double ycomp, double zcomp)

Constant b-field,. The orientation and strength is given by the three arguments. Only evaluated if fieldtype "Bconst" is chosen.

 

AddBzValue (double  position,  double bz-value)

B-field value at the given position along the z/w axis of the active coordinate system for the "1d description" definition type. Only evaluated if fieldtype "Bz" is chosen.

 

SetExternalField ( bool switch, filename filename, double factor, double  phase, int fieldID )

Defines a new external field source. It is defined by a flag which indicates if the source is active, a field path, a scaling factor and for frequency dependant fields a phase value. The fieldID is a unique label that should be used only for the particular field import and it can set to non-negative integer values.

 

UseLocalCopyOnly ( bool switch )

Defines if the local copy of the imported field data file should be used only for all future simulation runs.

 

UseRelativePath ( bool switch )

If switch is set to True, the relative path of an imported file (with respect to the location of the .cst project) is used to access the imported files. For example, if the .cst project absolute path is "C:\projects\gun.cst" and the absolute path of the import file is "C:\imports\field.txt", then the relative path of the import is "..\..\imports\field.txt". This command is useful for simulations with the System Assembly and Modeling (SAM).

 

UpdateLocalCopies ( bool switch )

If switch is set to True, the local copies of the imported fields are updated with the field data from the import location.

 

ExternalFieldMuer(double  muer)

If a magnetic field monitor has been defined, this value is considered for the calculation of the relevant magnetic flux density.

 

ExternalFieldPhase(double  phase)

For frequency dependant fields this command allows to specify a phase shift in degrees.

 

Create

Creates the defined source field.

 

Delete

Deletes the source field definition.

Default Settings

FieldType        ""

HFieldVector     "0", "0", "0"

BFieldVector     "0", "0", "0"

SetExternalField "True", "", "1", "0"

UseLocalCopyOnly "False"

ExternalFieldMuer "1.0"

ExternalFieldPhase "0.0"

Example:

With PredefinedField

     .Reset

     .Type          "Hconst"

     .HFieldVector "1", "0.0", "0.0"

     .Create

End With