Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
Electronics

Electronics

Topics related to HFSS, Maxwell, SIwave, Icepak, Electronics Enterprise and more.

Maxwell 2D Field Calculator Scripting

    • joseph.filbert1
      Subscriber

      I am new to Ansys Maxwell and I am trying to develop a script to post process results for a transformer based on the methods in [1]. As an example, my transformer has a primary and a secondary winding. Using parametric analysis I have two simulation cases: case one) primary excited with 1 amp of current secondary current set to 0, and case two) secondary excited with 1 amp of current and primary current set to 0. I am also sweeping frequency from fmin to fmax. The two simulation cases have different adaptive meshes because they have different excitations. For all frequencies, I would like to compute an integral over a defined surface using the results of both cases something like, \int{H_{1}\cdot\H_{2}^{*}\ddV}, very similar to an inductance matrix calculation. However, the integration domain should be restricted to everywhere except the transformer core. 

      It seems like I can use the field calculator "Write" function to save the case one field, then use the field calculator "Read" function to load the field and perform my integration with the case two fields. When I evaluate the integral, how does the field calculator handle the difference in mesh between case one and case two? Is the case one field interpolated at the mesh nodes of case two? Is there a better way to do this? Please see an example code snippet below,

      My code snippet

      #loop over frequency, full code would loop over coils as well L11, L21, L22

      for ii in range(len(freqs))

      #save case one field data to file

      solution_name = "Setup1 : LastAdaptive"

      variable_values = [

      "Freq:=", freqs[ii],

      "I_PRI:=" , "1A",

      "I_SEC:=", "0A",

      ]

      oModule.CalcStack("Clear")

      oModule.EnterQty("H")

      oModule.CalcOp("Smooth")

      oModule.CalculatorqWrite("...HK.fld",

        [

          "Solution:=", solution_name

        ],

        variable_values)

      #load case one field data HK

      oModule.CalculatorRead("...HK.fld", solution_name, "Fields",

        variable_values)

      #switch context to case two by changing variables

      variable_values = [

      "Freq:=", freqs[ii],

      "I_PRI:=" , "0A",

      "I_SEC:=", "1A",

      ]

      oModule.EnterQty("H")

      oModule.CalcOp("Smooth")

      oModule.CalcOp("Conj")

      oModule.CalcOp("Dot")

      oModule.CalcOp("Real")

      oModule.EnterSurf("Rectangle1")

      oModule.CalcOp("Integrate")

      results.values = oModule.GetTopEntryValue(solution_name, variable_values)

      #write result to text file

      ...

      [1] R. Prieto, R. Asensi, J.A. Cobos, J. Uceda, "A full procedure to model integrated magnetics based on FEA," IEEE, 2004.

    • MirandaH
      Ansys Employee
      Hi, the meshes should be comparable from two cases, if the geometry is the same and adaptive requirements are the same. You can check mesh statistics to compare both designs.
Viewing 1 reply thread
  • You must be logged in to reply to this topic.
[bingo_chatbox]