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.
Implicit Equation Solution
Posted 2010年7月9日 GMT-4 01:33 Porous Media Flow, Materials, Parameters, Variables, & Functions Version 4.2a 14 Replies
Please login with a confirmed email address before reporting spam
I am trying to solve Butler Volmer equations for my boundary conditions and my equations have a circular dependency.
eta = V - U - i*R
i = i0*exp(eta*k)
COMSOL will detect an error. How do i set just an initial value to get the system going? I would like to set eta to U(t=0) and then start the equations.
Would it be possible to simply use a value from a previous time step for one equation (which would then solve the other in the current time step) ? Not accurate but atleast a solution!
Thanks!
Best Regards
raj
Please login with a confirmed email address before reporting spam
you would need V4 to easily use a "previous" step value (new feature), but that's something I havent tried yet, so I cannot help
Good luck
Ivar
Please login with a confirmed email address before reporting spam
I know that Matlab has an implicit solver (simply using fsolve). I was able to create a look up table of sorts but it isnt entirely accurate. Would it be possible to link fsolve with my equation in COMSOL ?
Thanks!
Best Regards
raj
Please login with a confirmed email address before reporting spam
The comment Ivar gave, to use the time discrete solver and use the "prev" command has not worked for me sofar. I suppose it still has to do with initialization of the problem, since I still get circular variable dependency...
What I would like to do specifically is to make a material property dependent on the heat flux for conducting materials. Also here a circular dependency arises. Although, if a heat flux throughout the geometry would be known beforehand, the material property can be calculated and the next iteration of heat flux too...
So has anyone figured out how to solve implicit equations like that?
Please login with a confirmed email address before reporting spam
for me you have: at(), with(), prev() and global variables (see the KB for adding time dependent variables) and this should allow to do about everything.
Have you tried to set up your physics in stationary, driven by an ODE in transient, and defining a global equation in the ODE section to get your derivative and your new variable at the "new step" ?
in V4.1 this is rather straigthforward. Far more complex via matlab in 3.5
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
At() and With() operators have the time variable as an argument.
If I want to evaluate an expression at a certain condition instead of time... for example: I want the solution of variable "u" when the Temperature "T" = 400 K ?
How could I get through this, is it by searching for the value of "t" at which T=400 K ?
Same question applies to Prev operator where I want to know the number of iteration at which T=400K.
Best Regards
--
Ali
(4.0a)
Please login with a confirmed email address before reporting spam
I tried the prev() separator in V4 version to get the previous value of i to calculate eta, however, there is the error information 'circular variable depending detected", It seems if I want to calculate i as a equation related to the value of i from the previous step, I can not do it in V4. Do you have any suggestion about this? Or will it be solved in the higher version like V4.2?
Thanks
Wei Wu
Please login with a confirmed email address before reporting spam
Try incorporating your variables into a system of PDE's (adequately i'd use a general form) where you put to zero all the coefficients ( or matrices) then use the source term (f) to implement your equations. There is a topic explaining this along with the prev() and bdf() operators.
I hope this answers your question
--
Regards
Please login with a confirmed email address before reporting spam
Thanks very much for your reply. Actually what I use in my model is PDE general form. And what I want to solve is very fundemental:
eta = V - U - i*R
i = i0*exp(eta*k)
considering the iteration, so I use the prev() function:
eta = V - U - i_prev*R
i = i0*exp(eta*k)
i_prev=if(t>10, prv(i,1),0)
So the previous step value of i need to be used to calculate the current i value.
However, it doesn't work.
I think bdf() is not appropriate at here, as it gives the value of deriviation at the previous time. What I want is only the value from the previous time step.
Do you have other idea about my situation?
Best
Wei Wu
Please login with a confirmed email address before reporting spam
What are the initial conditions you used ?
If u can send a copy of your model or a picture on how you implemented the system, it s more useful.
Please login with a confirmed email address before reporting spam
I need help with the circular dependency as well.
I want conductivity which is
Sigma=(1e10)*(1e8[A/m^2]/mf.normJ)^(-10)[S/m]
However, the equation for External current density is
Je=sigma*dA/dt+..
and clearly normJ depends on Je, so I get the circular dependency error.
how can I define it well? have you solved this problem before?
I have attached my model.
Thank you,
Shoval (I'm using 4.2a)
Attachments:
Please login with a confirmed email address before reporting spam
I hope that helps,
- Erwin
Please login with a confirmed email address before reporting spam
using a segregated solver is something I can do, but what do you mean by copt my equations? what do I do with them?
Can you tell me which example from 3.5 it is? If it is possible in 3.5 it must be in 4.2a...
Thank you,
Shoval
Please login with a confirmed email address before reporting spam
I do not recall exactly which example this was, this you will need to look up yourself. It has to do with exploiting the Maxwell equations fully and add an additional variable to avoid the circular dependency.
Maybe this helps you better:
Difficulty:
Voltage=Current*Resistance, but resistance is function of current density -> circular dependency
Solution:
Add a new equation (instead of copying your original one as I wrote before): help_variable=J with initial conditions equal to your homogeneous boundary condition for Je.
Make resistance (or rather conductivity) a function of this new variable: R(help_variable).
Since help_variable is a dependent variable, it has its own initial condition and thus can be inserted in the function for the resistivity. The voltage and current are now calculated by your original equation. This solution bypasses the circular dependency for some specific cases, this is a very blunt method... For superconductors the physics is more complicated, look for example for H-formulation to see how correct current distributions can be calculated effectively with COMSOL.
Cheers and good luck,
- Erwin
Please login with a confirmed email address before reporting spam
I have not managed to perform what you wrote with the help_variable. perhaps I misunderstood you.
I looked at the model library and found the Superconducting Wire model; it uses the general-form PDE mathematics. is this the one you meant? Even after reading it and attempting to understand and rebuild it, I do not understand how this can solve my problem.
Help?
Thank you,
Shoval
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.