pyleecan.Classes.MagElmer module

Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Simulation/MagElmer

class MagElmer(Kmesh_fineness=1, Kgeo_fineness=1, file_name='', FEA_dict=- 1, is_get_mesh=False, is_save_FEA=False, transform_list=- 1, rotor_dxf=None, stator_dxf=None, import_file='', nb_worker=1, is_remove_slotS=False, is_remove_slotR=False, is_remove_ventS=False, is_remove_ventR=False, is_mmfs=True, is_mmfr=True, type_BH_stator=0, type_BH_rotor=0, is_periodicity_t=False, is_periodicity_a=False, angle_stator_shift=0, angle_rotor_shift=0, logger_name='Pyleecan.Magnetics', Slice_enforced=None, Nslices_enforced=None, type_distribution_enforced=None, is_current_harm=True, T_mag=20, is_periodicity_rotor=False, init_dict=None, init_str=None)[source]

Bases: Magnetics

Magnetic module: Finite Element model with Elmer

VERSION = 1
comp_flux_airgap(output, axes_dict, Is_val=None, Ir_val=None)

Build and solve Elmer model to calculate and store magnetic quantities

Parameters:
  • self (MagElmer) – a MagElmer object

  • output (Output) – an Output object

  • axes_dict ({Data}) – Dict of axes used for magnetic calculation

solve_FEA(output, sym, angle, time, angle_rotor, Is, Ir)

Solve Elmer model to calculate airgap flux density, torque instantaneous/average/ripple values, flux induced in stator windings and flux density, field and permeability maps

Parameters:
  • self (MagElmer) – A MagElmer object

  • output (Output) – An Output object

  • sym (int) – Spatial symmetry factor

  • time (ndarray) – Time vector for calculation

  • angle (ndarray) – Angle vector for calculation

  • Is (ndarray) – Stator current matrix (qs,Nt) [A]

  • Ir (ndarray) – Stator current matrix (qs,Nt) [A]

  • angle_rotor (ndarray) – Rotor angular position vector (Nt,)

get_meshsolution(output)

Build the MeshSolution objects from the FEA outputs.

Parameters:
  • self (MagElmer) – a MagElmer object

  • output (Output) – An Output object

Returns:

meshsol – a MeshSolution object with Elmer outputs at every time step

Return type:

MeshSolution

get_path_save_fea(output)

Return the path to save the Elmer simulation

Parameters:
  • self (MagElmer) – a MagElmer object

  • output (Output) –

    an Output object

    Returns

  • -------

  • save_path (str) – Path to save the .fem file

get_path_save(output)

Return the path to save the Elmer simulation

Parameters:
  • self (MagElmer) – a MagElmer object

  • output (Output) –

    an Output object

    Returns

  • -------

  • save_path (str) – Path to save the Elmer simulation

gen_elmer_mesh(output)

Call ElmerGrid process to convert mesh from Gmsh format to Elmer’s compatible

Parameters:
  • self (Magnetic) – a Magnetic object

  • output (Output) – an Output object (to update)

Returns:

success – Status flag

Return type:

{Boolean}

save(save_path='', is_folder=False, type_handle_old=2, type_compression=0)

Save the object to the save_path

Parameters:
  • self – A pyleecan object

  • save_path (str) – path to the folder to save the object

  • is_folder (bool) – to split the object in different files: separate simulation machine and materials (json only)

  • type_handle_old (int) – How to handle old file in folder mode (0:Nothing, 1:Delete, 2:Move to “Backup” folder)

  • type_compression (int) – Available only for json, 0: no compression, 1: gzip

get_logger()

Get the object logger or its parent’s one

Parameters:

obj – A pyleecan object

Returns:

logger – Pyleecan object dedicated logger

Return type:

logging.Logger

compare(other, name='self', ignore_list=None, is_add_value=False)[source]

Compare two objects and return list of differences

as_dict(type_handle_ndarray=0, keep_function=False, **kwargs)[source]

Convert this object in a json serializable dict (can be use in __init__). type_handle_ndarray: int

How to handle ndarray (0: tolist, 1: copy, 2: nothing)

keep_functionbool

True to keep the function object, else return str

Optional keyword input parameter is for internal use only and may prevent json serializability.

copy()[source]

Creates a deepcopy of the object

property Kmesh_fineness

finner , < 1 : less fine)

Type:

float

Type:

global coefficient to adjust mesh fineness (1

Type:

default , > 1

property Kgeo_fineness

finner , < 1 : less fine)

Type:

float

Type:

global coefficient to adjust geometry fineness (1

Type:

default , > 1

property file_name

Name of the file to save the Elmer model

Type:

str

property FEA_dict

To enforce user-defined values for Elmer main parameters

Type:

dict

property is_get_mesh

To save FEA mesh for latter post-procesing

Type:

bool

property is_save_FEA

To save FEA mesh and solution in a file

Type:

bool

property transform_list

label (to select the surface), type (rotate or translate), value (alpha or delta)

Type:

list

Type:

List of dictionary to apply transformation on the machine surfaces. Key

property rotor_dxf

To use a dxf version of the rotor instead of build_geometry

Type:

DXFImport

property stator_dxf

To use a dxf version of the rotor instead of build_geometry

Type:

DXFImport

property import_file

To import an existing simulation file

Type:

str

property nb_worker

To run Elmer in parallel (the parallelization is on the time loop)

Type:

int