Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
sequential solving in Comsol 4
Posted Jun 10, 2010, 9:02 a.m. EDT 13 Replies
Please login with a confirmed email address before reporting spam
I would like to make with Comsol 4 a sequential solving of magnetic fields (MF) in Domain frequency and, after having stored this solution, of heat transfer (HT) (which uses the former stored MF resistive losses as thermal source term) in time dependant.
How can this be done in Comsol 4 by managing the solver_sequences, the steps, the variables, etc.... in the model builder?
Is there anywhere an example or a tutorial of such a 2 physics coupling which explains how to do for a strong coupling and a sequential weak coupling of the 2 physics? Note that this was easily done with the solver_manager in the 3.5 version but seems not obvious in Comsol 4 since there is no explanation of how to manage all these tools like the solver_sequences, the steps, the variables in the model builder.
Thanks for your help !
Please login with a confirmed email address before reporting spam
I have also had some difficlties to fully understand the solver sequences in V4, that is why I have started by playing with several sequences by adding the by hand, and then looping them with parametric sweeps etc.
What I have noticed is that when you mount multiple solving on a same model you often end up doing it by hand, that is deleting everything under the study (or start a new one and later delete the old when you are happy).
If you have several sequences, only one is "active" that is you must "attach" it to the sequence, its the one with the green square around, and there is a right click option (if required) to "attach" a sequence. And when you have several studies, or have modified a default one you have the options to SOLVE the attached sequence or just SOLVE which might produce a new sequence.
I have come to that I add my solver sequences as I would call them (also starting with a parametric sweep if required (not the same as a parametric solving within some of the physics), then I fill them in, ie. add a local parameter solving or select the physics, then I generate a default sequence, and thereafter I edit the sequence, if required.
I have still issues not clear such as how to handle multiple "store solution" in a sequence, exactly how to link the initial values from a previous run, if the parametric scan is done internally how are really initial values linked ...
But one must build very simple axamples to get this right, with a true case, I have noticed I get confused and cannot really find out how it hooks up.
Have fun Comsoling
Ivar
Please login with a confirmed email address before reporting spam
Thank you for your answer!
But all this study, sequential solve, steps, variables, etc..... managing remains not clear for me since there is no detailed explanation in the Comsol documentation.
That's why I have joined to this reply a simple 2D axisymmetric induction heating example which couples the "magnetic fields" (say mf) and the "heat transfer" (say ht) physics. It is a copper cylinder which is heated by the eddy currents produced by a surrounding imposed (Js0) inductor current density layer. The mf is in frequency_domain (at 50 Hz) and the ht is in time_dependant (from 0s to 10s). As you will see in the study node there are 2 steps which I would like to solve sequentially , meaning one after the other: the 1rst step solves only for the mf A vector potential variable (see variables 1) and the 2nd step solves only for the ht T temperature variable (see variables 2). In the variables 2 node settings window I specify that the "variable not solved for" is the solution of the solver sequence 3, wanting to say that for the 2nd step the mf A vector potential variable is not solved but comes from the former step 1.
Unfortunately all this does not work as you will see the resulting temperature solution which remains very low, which shows clearly that the sequential coupling between mf (step 1) and ht (step2) is not working.
Please Ivar, could you take a look at this basic example and help me to solves this properly thanks to your experience?
Thank you very much for your help!
Best regards
Roland ERNST
Attachments:
Please login with a confirmed email address before reporting spam
will try tonight, but I'm rather overbooked these days ;) I'm fighting myself with double nested parametric sweeps too. But if you can loop one "internally to one physics" it msotly works OK
One thing: to get a "Stationary solver" to do a "parametric sweep", edit the TOP ()highest in the study tree) "Study 1 -Stationary 1" settings for "Continuation", in your case "freq" and value "50[Hz]" (or range(start,step,stop), just as you can replace the frequencies: in Freq Domain 1 by a range (,,)
What is also confusing, is that a "frequency domain" generates to a sequence called "Stationary" with a continuation, this could be reported to Support, they could be more explicit in the names, even if its the same operation ;)
Check carefully the Physics Interface Selection of your Study cases, its very easy to select two or more when you only want one, COMSOL should highlight or (shadow) the unselected in a better way
If you solve only the MF part you see that the energy is really only a skin effect so you should use boundary mesh elements on your central core being heated up for a more realistic simulations
And what about using 400 W//m/K for the heat conduction in Copper or is really "1" your case ?
I'm using mf.Qh and not mf.Qrh which seems to stay at "0" (?) but after resetting the model both gives the same results, but these are imaginary ? so I try abs(mf.Qh) same results.
The funny thing is that something is taking out the heat and the temperature is very low its cooling (?) down ot 1-4 K, while the stationary ht is OK at room temperature
by the way the units are not correctly updated when selecting surface integration AND computing Volume integration (axial symmetry)
I havent found the thing, but it's linked to the initial condition set-up, from the moment you link in the Frequency domain, the initial temperature of T is set to "0", while it should be left at T0 =273 or 293 or whatever. This could be an issue inside COSOL V4, I propose that you ask support and keep us updated.
The settings of the initial conditions is still not fully clear for me. One way would be to store the frequency domain calculation and not solve for A in the time and just use this as the starting point, but probably then the Freq domain has already reset "T" somehow ? puzzling puzzling ;)
Have fun Comsoling
Ivar
Please login with a confirmed email address before reporting spam
Thanks for your answer!
Here are some precisions which will perhaps make the things a bit more clear for you and in relation with your comments:
- I don't want to make a parametric sweep in the 1rst step, but just solve the mf for a given unique 50 Hz frequency
- To me it seems normal that the frequency_domain generates a stationary since this step needs a stationary solver because in frequency_domain, the frequency is removed from the physical equation and this only needs stationary and not time_dependant
- concerning the Physics Interface selection, as I want to solve the 1rst step only for mf I unchecked the ht. And as I want to solve the 2nd step only for ht I unchecked the mf (you can check this in the file) . Don't forget that I want to solve sequentially (one after the other ) at 1rst the 1rst step for getting the mf and then secondly the 2nd step for getting the ht. For this 2nd step I stated (in the variables 2 node) that the here not solved A solution comes from the former 1rst step (but I am not sure that I did this correctly!). In the former 3.5 version this was easy to do in the solver manager by running these steps:
1/ solve for mf in time_harmonic
2/ store the former mf solution
3/ solve for ht in time_dependant (by clicking on "stored solution" for the "variable not solved for")
- Even with such a corse mesh (I don't want a big precision at this state of set up!), this works perfectly with comsol 3.5a and gives a few hundreds degrees heating in the cylinder. So at this state of set up there is no problem if the skin depth is small compared with this rough mesh, and putting 400 W/m/K does not change the problem. Really the problem is that this sequential solving is probably not properly described and entered for the moment in Comsol 4!
- Concerning the heat source what is strange is that either mf.Qrh (the source term which I entered as the heat source in the ht physics) or the mf.Qh give a zero value when you make a volume integration (a surface integration and check "compute volume integral" in the settings window) of these values in the copper cylinder (subdomain 2)!!!
I hope this will help you to go a bit further and still many thanks for your help!
Best regards
Please login with a confirmed email address before reporting spam
indeed there are a few funny things, among other it really seems that the freq domain takes the T and reset it to 0K, so its a settign issue of initial values not solved for (or an internal bug, but lets assum note first of all). I'm trying to set an intermediate store solution between the two, its normally easier to debug, but ine cannot move any mode up/down yet in V4 so I have to rebuild the full second sequence by hand, interesting I'm learing something here ;)
So long
Ivar
PS do not mis the plasma physics presentation it's on the 22 of June, a NASA webinar I belive
Please login with a confirmed email address before reporting spam
And as you say it in the last part of your last mail, all this sequential solving is exactly what I want to do and, as you say it , is not at all obvious to set up! Comsol which I contacted about that thing said that they are thinking about and that they will try in a next future to write a kind of "tutorial" of how to implement such a sequential solving. But I am a bit astonished that it seems so difficult to do (by intuition...) in Comsol 4 , whereas it was so easy to do (by intuition...) in Comsol 3.5a with the solver manager !!
Your further help will be welcome if you have some more ideas about that!
Best regards!
Roland
Please login with a confirmed email address before reporting spam
Well I'm not sure it's so difficult ... it's just that we have not had enough training with V4 yet ;)
Nevertheless, for your case of MF+TH coupling, I have rebuild it a couple of times by now, but it's each time the same: once going through the frequency-domain =stationary+freq=50Hz, then the temperature T is reset from its initial "ambient" value to that of "0[K]", and this whatever combination I try on the "variable node", so I come to the conclusion that something is wrong in the COMSOL treatment of "variables not solved for", or that simply I havent understood anything about it at all ;)
Furthermore, when I rebuild your model, I got options for the coupling variables MF to HT, mentioning two names both referring to "mf/al1" (?) but the equations behind are both "mf.Qh", and then finally I'm slightly suspicious that the 2*pi*r is getting lost as the resulting power seems too big.
I would suggest that you send your case to support, and get it probed to check that there is no internal bug here, we can spend quite some time if it this is the case
Good luck
Ivar
Please login with a confirmed email address before reporting spam
I'm discovering a few new items, first it's clear (once you understand) that the FD simulation of the TM only gives you only deposit of energy on the conductive surface, as the magnetic field does not have time to penetrate due to the Eddy currents. If you add a time series with the FD by default it takes the DC field and you see how the field penerates the central copper as the eddy currents dies out from the equivalent pulse you apply, so the combination FD+TS is not correctly representing what you want.
We must first calculate the FD, then store it as a solution and use this for the time series of the heat transfer, this is was you said, by I notice that COMSOL by defaults chooses to mix everything, and that is quickly overlooked.
Well tis does still not tell me why the temperature T is reset to 0[K] once passed through the FD analysis, as its not supposed to be touched (not solved for, and its supposed to be kept the way I understand it, but this is not the case.
And what I have not yet understood is how to add in a "store solution in the middle of a Solver Sequence, without typing in everything by hand.
So far I have understood that you should perform 1) the MF with FD alone and "Store the solution", then make a new Solver sequence, and "attach it" and run the HT with stationary using the unsolved variables from the stored solution, but it still does not work out.
What I still do not catch is why the mf.QH becomes imaginary when I use it in the time sequence, perhaps one should use the abs()
I'm using 4.0.0.937 currently
Have fun Comsoling ;)
Ivar
Please login with a confirmed email address before reporting spam
I have also tried all the steps you mention (as I did it in the 3.5 solver manager without problem!) but, as you, I didn't suceed! And as you noticed it the mf.Qh (or mf.Qrh) volume integration gives a complex number (which is crazy!) and also the unit is false meaning that the integral must be in W and not in W/m !!
So I think we are at the same state! But I guess that other people must wonder about the same problem. I say that when you have to solve a "complex" coupled problem, the set up must always be done at first step by step and not immediately by coupling everything which is the best way to fail with the solving! What I always make is, for instance in this heating problem case (where I want to solve MF in FD and then use the source term to solve HT in TD in order to see how the cylinder heats with time due to the eddy currents and associated induced power density), at first to solve only a MF problem and check if everything is normal about the results: skin depth, magnetic field streamlines, integral of the power density location etc... And only when all this is checked and seems Ok, then I add the 2nd physics (here the HT) and try to see how it heats with time. This step by step way is the best method for setting up such a problem. So if you have ideas to do that with Comsol 4 in this sequential way....
Just another question: are you from Comsol and in which country are you?
Best regards
Roland
Please login with a confirmed email address before reporting spam
no I'm a user as I suppose you are too, originally from scandinavia (not the same country that Comsol though ;) but living and working in CH for sevral decades, physics and system engineering as background. I have become a fan of Comsol as I finally now can "see" my physics in a way never before, and I'm really having fun.
For the set up of sequneces, it's rather easy in CM 4, you add the phsics at will (in the same or differnt study(ies)) and then you enble or disable the physics and/or the study cases and you create new Solver sequences for each case (do not forget to ATTACH=activate the new sequence before you generate the new solution). The file ends up quite big see below. This one has TS instead of HT but it should be the same, anyhow It tends also to set T=0[K] for my time series and I cannot understand why , it's certainly a simple stupid thing ;)
unfortunately the set-up (enable/disable status) is not saved in the Solver Sequence so you must quess from the order and the name the operations I have done
for me most om my cases are working OK in V4, with the announced limitations, I waiting impatiently for new patches ;)
Good luck on your side
Ivar
Attachments:
Please login with a confirmed email address before reporting spam
Thank you very much for the attached example! I shall take a look at it and keep you informed.
Best regards
Please login with a confirmed email address before reporting spam
I just gave a quick overlook to your example. Could you please give me some more precisions like:
- what are the mod1_ts_pw and mod1_Vtot_1 variables?
- I see about 7 solver sequences under the study node. But when you want to make a solve trial does the compute command then run the 7 solver sequences one after the other? Or is each of these solver sequences each tim a new test which you wanted to make? And why, just under the study node, are the "Frequency_domain", "time_dependant", etc... apparent in brackets (which means that they are desabled?)? what is the consequence with all the 7 sequences which follow?
- Among all these solver sequences, where is the sequential coupling (what I would like to do!) between the MF (in FD) and then the HT (in TD)? Meaning where have you build following sequence among all these sequences?
-step 1:solve for MF in FD --> MF solution
-step2:store the MF solution
- step 3: solve for the HT in TD (with heat source = power density from the former MF solution)
--> HT solution (and at this state it should be also possible to plot the MF former stored solution)
- Could you please try to modify your problem with only these steps apparent so that I could see the things a bit more clear, since it is difficult to see the matter with all these 7 seqeunces.
You see Ivar, the problem is that I am not yet clear about this solver sequences building matter and how they are stored under the study node (which is the hierarchy of all this, especially in case of wanting to make successive steps for sequential solving, etc...)
Thank you very much for your help!
Roland
Please login with a confirmed email address before reporting spam
these are standard for V4, the pw is the pressure anlong z, its there and activated depending on what you select in the physics (looked after by COMSOL) the Vtot is the voltage solving for the BC single turn coil.
Read carefully the doc, there are quite some differences in current normal source, single and multiple turn coils BC's, these are subtile, but very useful, the result are basically identical to your standard set-up, I was checking the new features of V4. these are looked after by COMSOL
Yes I made systematical new solver sequences: use the ATTACH sequence to run different sequences, unfortunately, the "sequence" does not remeber the settings of the solver.
Basically under the Study tree, I selected the first in the list, disables the others, attached the first sequence and run it, the I enabled the second solution and disabled the others, active sequence 2 etc. I renamed the sequences to try to help me identify later which wone correspond to which.
But you can look at the data without recalculating (as I saved it fully).
try it out on a copy:
delete all Solver sequences, my plots will dissapear too not important, to avoid that define the plots as "Probe" plots higher up in the model tree under "model definitions", then tey are regenerated when you run (mostly)
select and enable the first study (disable all the others), compute/solve, see the results (Data Set Soluton 1)
select Solver sequence + right click "add an empty Sequence" and rightlck on new Solver sequence and "Attach to study, then select second study and enable it, disable the others + Compute solve ...
When youadd new plots manually in the results, start to check t which solution they point (by default all new to the first one), the same, with multiple studies, the default numebr shown corresponds to the first in the list, enabled or not. Its a good exercice to learn how it works.
basic rules the higher up in the three, the more COMSOL will fill it out for you by default. if something is defined far out in the branches or lower in the tree, it is attached to a higher item and will dissapear if you delete the higher item
Hope this helps
Ivar
Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.