Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.
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.
dependent variables: sweep over "initial values" and "variables not solved for"?
Posted 12 lug 2013, 17:12 GMT-4 RF & Microwave Engineering, Interfacing, Studies & Solvers Version 4.3a 9 Replies
Please login with a confirmed email address before reporting spam
I have 2 Studies in my 2D model:
Study 1 solves for various fields within my geometry. These fields are different for each wavelength (lam0).
Study 2 takes the lam0-dependent fields from Study 1 and solves other fields, which are my solution.
Right now, I am manually choosing fields from Study 1 (ie. I am choosing fields whose solutions depend on a specific lam0 value) for input as 'initial values' and 'values not solved for', under the Values of Dependent Variables menu.
But, there are a whole heck of a lot of lam0, so I'm wondering if its possible to automate this.
In summary, I sure wish there was an 'All' option under Study 2> Values of Dependent Variables>Method (Solution)>Study 1>Selection.. (options now are Auto,First, Last, Manual.. all of which input only 1 lam0 at a time)
Thanks for your suggestions!
Devin
Please login with a confirmed email address before reporting spam
Interesting because usually there is an option available called "All" that will use all the solutions from the previous study.
Would you be able to upload your model using "Attach File"? You can clear solutions and meshes before saving and uploading to save space. Use Edit>Clear Meshes and Edit>Clear Solutions to do this.
Regards,
Josh Thomas
AltaSim Technologies
Please login with a confirmed email address before reporting spam
thanks for your time!
Attachments:
Please login with a confirmed email address before reporting spam
I may have a solution for you.
Under your Study 2 the "Values of variables not solved for" does have an "All" option under Selection.
To handle, the "Initial values of variables solved for" you can set the Selection to Automatic and then use the Study Extensions section to define the wavelength (lam0) as 2nd continuation parameter (besides the V_appl which you already have). Move the lam0 parameter first in the list and then specify "Sweep type" as All Combinations.
I think this will work for you for Study 2.
See attached mph file.
Best regards,
Josh Thomas
AltaSim Technologies
Attachments:
Please login with a confirmed email address before reporting spam
You rock! This is exactly what I needed. You just saved me many, many hours of manual entry :)
Thanks very much!
Devin
Please login with a confirmed email address before reporting spam
All the best,
Josh
Please login with a confirmed email address before reporting spam
A follow-up question for you: I've done a few runs, using this technique, and it is working as expected, except for a few small bugs, which may be related to one another:
-if I do a large sweep of wavelength (say, range(500[nm],2[nm],1100[nm]), and let it run overnight, the convergence plot indicates that somewhere in the middle of the sweep (say, at 800nm), the maximum number of iterations (which I had set to 500) was reached, and the solution isn't converged. I regret not having saved the convergence plot for analysis.
-if I then clear all solutions and restart the simulation at 780nm, for instance, the solver finds a solution (in this case, current, calculated via a boundary probe) for 780nm and longer just fine, but the 780-798nm solutions differ substantially (~%70) from the initial solution.
It seems as though there is a residual effect, coming from the hours of calculations, and the only way I discovered it was due to the solver not converging at 800nm... I'm concerned the data from 500-800nm is flawed now too..
I'm using the same model you edited.
Any ideas? Any simple checks or settings within the solver that I can adjust to prohibit the long-term divergence of the solution?
Thanks again for your assistance
Devin
Please login with a confirmed email address before reporting spam
I never did any checks to see that the model I set-up was operating as you'd expect. Although, it seems to be working because the solver was converging for all parameter values. I would recommend still checking the results against the "manual" method that you are sure works.
It would be surprising to me if COMSOL is converging to different answers for the same problem definition. Are we sure that the problem definition is the same in both cases (i.e. same initial values of solution variables and values of variables not solved for)? I would be surprised if the discrepancy is due to some relaxed tolerance in the solver settings that is causing the solution to diverge. You could try tightening up the relative tolerance, but a 70% difference is pretty extreme. Even if you are looking at maximum or minimum values. The default tolerance is 0.1% for the non-linear solver and I believe also for the linear system solvers.
Hope that helps some.
Best,
Josh
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
Edit: yep, re-ran Study 1 after clearing all solutions. So you're right, I have some tracing to do..
Again, thanks very much for your help!
Devin
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.