ElmerCSC / elmer-elmag

Development repository for electromagnetics tutorial and verification cases
50 stars 20 forks source link

Update induction heating example #7

Closed arvedes closed 1 year ago

arvedes commented 1 year ago

I improved the documentation in the readme and added some screenshots of the results. I changed the convergence criteria and adjusted the reference norms. I still want to add a setup using the CircuitsAndDynamics solver (created by @jvela018).

arvedes commented 1 year ago

Just added the case with CircuitsAndDynamics solver.

jvela018 commented 1 year ago

@arvedes ,

This is great. Lots of good examples. A suggestion I have would be for you to solve the circuit_case.sif, go to the output file open_wire.dat and look for the value of the calculated source current (i_V1) in the model. Then, use this current as the input for the "Desired Coil Current" in any of the examples using the CoilSolver. That way we'd be able to compare apples to apples. In theory, the values should then match with each other. This would serve as a good validation example of using either solver and obtaining the same results.

To make your life easier, you can also try the circuit below. This is simply a current source of 100A. You can edit the value within under re_Is

`! ----------------------------------------------------------------------------- ! ElmerFEM Circuit Generated: October 12, 2022 ! -----------------------------------------------------------------------------

! ----------------------------------------------------------------------------- ! Number of Circuits in Model ! ----------------------------------------------------------------------------- $ Circuits = 1

! ----------------------------------------------------------------------------- ! Parameters ! -----------------------------------------------------------------------------

! General Parameters ! Is = re_Is+ j im_Is, phase_Is = 0.0(Deg) $ re_Is = 100 $ im_Is = 0.0 $ phase_Is = 0.0

! Parameters in Component 1: Wire1 $ Ns_Wire1 = 1 ! Sector/Symmetry Coefficient (e.g. 4 is 1/4 of the domain)

! ----------------------------------------------------------------------------- ! Matrix Size Declaration and Matrix Initialization ! ----------------------------------------------------------------------------- $ C.1.variables = 5 $ C.1.perm = zeros(C.1.variables) $ C.1.A = zeros(C.1.variables,C.1.variables) $ C.1.B = zeros(C.1.variables,C.1.variables)

! ----------------------------------------------------------------------------- ! Dof/Unknown Vector Definition ! ----------------------------------------------------------------------------- $ C.1.name.1 = "i_Is" $ C.1.name.2 = "i_component(1)" $ C.1.name.3 = "v_Is" $ C.1.name.4 = "v_component(1)" $ C.1.name.5 = "u_2_circuit_1"

! ----------------------------------------------------------------------------- ! Source Vector Definition ! ----------------------------------------------------------------------------- $ C.1.source.5 = "Is_Source"

! ----------------------------------------------------------------------------- ! KCL Equations ! ----------------------------------------------------------------------------- $ C.1.B(0,0) = -1 $ C.1.B(0,1) = 1

! ----------------------------------------------------------------------------- ! KVL Equations ! ----------------------------------------------------------------------------- $ C.1.B(1,2) = 1 $ C.1.B(1,4) = -1 $ C.1.B(2,3) = -1 $ C.1.B(2,4) = 1

! ----------------------------------------------------------------------------- ! Component Equations ! ----------------------------------------------------------------------------- $ C.1.B(4,0) = 1

! ----------------------------------------------------------------------------- ! Additions in SIF file ! ----------------------------------------------------------------------------- Component 1 Master Bodies(1) = 1 Coil Type = "Massive"

! Additions for 3D Coil Coil Use W Vector = Logical True W Vector Variable Name = String CoilCurrent e

End

! ----------------------------------------------------------------------------- ! Sources in SIF ! -----------------------------------------------------------------------------

Body Force 1 Is_Source re = Real $ re_Iscos(phase_Is) Is_Source im = Real $ im_Issin(phase_Is) End

! ----------------------------------------------------------------------------- ! End of Circuit ! -----------------------------------------------------------------------------`

BR,

Jon

ping @raback

ettaka commented 1 year ago

@arvedes just saw this. Nice work!

I think there is a way to take the skin effect into account without too much computational burden. Since you are using the time harmonic version, you could use the impedance boundary condition. That would be an interesting thing to do. Circuits would have to be solved in a boundary layer. Might need some small mods.

Anyway, good work!

arvedes commented 1 year ago

Hi @ettaka, thanks for you feedback!

The impedance boundary condition is already included, see https://github.com/ElmerCSC/elmer-elmag/tree/main/InductionHeating#layer-conductivity. I just named the case "layer conductivity" according to the parameter "layer electric conductivity" used in the BC. Maybe we should rename it to avoid confusion.

I also tried to use the impedance BC in the CircuitsAndDynamics setup but that did not work out of the box.

ettaka commented 1 year ago

@arvedes very nice! However, I think in section https://github.com/ElmerCSC/elmer-elmag/tree/main/InductionHeating#layer-conductivity you are linking to the scaled conductivity file, and not the layer conductivity.

Moreover, I was mainly thinking about using impedance BC with circuit components. But you are right, It probably wont work: we should add the boundary condition also to the component equation.

I think it is a feature that is quite low hanging fruit and should be implemented at some point in the near future. Especially if there is enough demand.

arvedes commented 1 year ago

Oh, yes, thank you, copy-paste error... I'll fix that tomorrow.

The circuit simulation with impedance bc would be very interesting for us, I can imagine a couple of applications in crystal growth simulation. And I don't think that there is any other software that does this. What do you think about that @kdadzis?

I will to set up some test cases to check if the results with impedance bc are realistic in a more complex geometry operated with MHz frequencies.

ettaka commented 1 year ago

@arvedes nice! One more thing: i noticed you wrote this: "I still want to add a setup using the CircuitsAndDynamics solver (created by @jvela018)."

Note that @jvela018 created the Circuit Builder that is a Python program (not part of elmer) to facilitate to write the circuit definitions for CircuitsAndDynamics Elmer module. That module implements circuits in Elmer.

If you want to know more about the Elmer Circuits (CircuitsAndDynamics), there is a presentation I gave some time ago https://youtu.be/AhKiZJa3RU8 that tells many things about the module and its history. I appreciate your interest in the Circuit module.

jvela018 commented 1 year ago

@ettaka nice seeing you here :D. I think this was just a matter of language choice. What @arvedes meant was that he wanted to use the model (.sif) that I setup for him using the CircuitsAndDynamics solver --instead of the CoilSolver model that he originally had. Thanks for clarifying this though and for sharing the CircuitsAndDynamics webinar link. It's also good to know that the Impedance BC works with the CircuitsAndDynamics solver. That's something that we had been wondering.

ettaka commented 1 year ago

@jvela018 I am very happy to see you active on Elmer stuff. I didn't know you set it up. This case is a very nice collab! Thanks for clarifying! I have seen people get confused about the Circuit Builder and CircuitsAndDynamics module. So I misunderstood what @arvedes meant, sorry!

arvedes commented 1 year ago

@ettaka @jvela018 Sorry for the confusion! I already watched the webinar, once live and a second time last week. I think this will be very helpful later in our project! Just to avoid confusion: CircuitsAndDynamics solver currently only works with resolved boundary layer, impedance BC is not working yet. The current setup with CircuitsAndDynamics is producing wrong results because the mesh is too coarse, it's more meant as a template for future projects in this direction.

ettaka commented 1 year ago

@arvedes the confusion is on me. Sorry! Now when I read again, it is clear. I was just primed to think like that because of the confusion I have seen before.

I am very happy to hear that you found the webinar useful.

Thanks again and keep doing the great work you do! We could try to make something happen on the impedance BC. I know someone who might also be interested.