User sub routines (Groovy): How using paramIOCurrent[k,v]?

Example

In the directory “…\Flux_12.0\Resources\UserFunction\Examples”, open the Flux project “MaterialLaw.FLU”. Save the project under another name in your working directory.

Using a “paramIOCurrent [k, v]”

In this project, follow the instructions above:

Step Action
0 Delete all project results Solving > Delete results > Delete all project results
1
  • Create a I/O parameter controlled via a scenario
  • Name it “ MU_VAR
  • Add reference value 5000 for example…
2
  • Modify the material “ MAT_1”:
3
  • In the tab “ User Coefficient ”, select a “ non linear property
  • Delete the value 5000 in the list of USER COEFF /
4
  • In the tab “ User Coefficient ”, select a “ non linear property
  • Delete the value 5000 in the list of USER COEFF /
5

Create a new scenario “MUR_VARIABLE” where ìr would be a physical parameter. In this example, “MU_VAR” take a list of values from 1 to 5000 (See the python script in (6))

(list of values: 1.0, 30.0, 50.0, 100.0, 150.0, 200.0, 300.0, 400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1000.0, 2000.0, 3000.0, 4000.0, 5000.0)

6
7

Back to the “ MAT_1” definition and click on the “ Edit user function ” to see and modify into the python editor the groovy sub routine.

These files are in the directory : “....YOUR_FLUX_PROJECT.FLU\persistent\groovy

8

Type the following groovy code in the sub routine “ compute ”( public void compute()).

The parameter user is paramIOCurrent“Mu_var”.

Note: In the key “Mu_var” the first letter is writing with an upper case and the following, in lower case.
9
10

Plot the Flux through the coil versus ìr by ploting the curve of flux through the coil (2D Curve (I/O parameter) > Circuit > COILCONDUCTOR > Flux [Wb] > Add)