How to solve two coupled equations? #1084
Replies: 2 comments 4 replies
-
I have rearranged the equation-solving part of the code and seems like it works this way (the unable to converge problem did not show up):
In this code, But I still very much appreciate if you could give me any suggestions. |
Beta Was this translation helpful? Give feedback.
-
Can you please post the math for the equations and boundary conditions you are trying to solve? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I need to solve two coupled equations at steady state:
eq1 is a thermal equation with solution variable 'temperature'; eq2 is an electrical equation with solution variable 'voltage'. The equations are:
The temperature affects the
Conductivity
of eq1, the electrical equation (I also useCond
to test different cases of thisConductivity
variable); the voltage gradient and the resistivity affect the heatsource
of eq2, the thermal equation.I was trying to test if the coupled equation can be solved by having a for loop (50 iterations) with a while loop inside. The inner while loop is only for sweeping eq1 and eq2 and the outer for loop is mainly for updating the resistivity, conductivity, and heat source. (And I plan to use a while loop to replace the outer for loop with the stop condition that resistivity and heat source values converge.)
The problem I am having right now is that if I have
Cond = 1/Resistivity
to be the coefficient in eq1, the values of 'Cond' will change with the values ofResistivity
, and eq1 cannot converge after 1 or 2 for loop iterations. Similar problems exist no matter if I useResistivity
as CellVariable or FaceVariable.But if I have this conductivity be a constant (by setting
Conductivity
as a CellVariable or FaceVariable the first time I defineConductivity
and its values will not update unlesssetValue()
being used), eq1 will have solutions converge.It is kind of weird that eq1 cannot have solutions converged if its coefficient changes as eq1 is a very simple equation, steady state with only an implicit diffusion term and the coefficient is not updated during sweeping.
Would really appreciate it if you could let me know which part I did wrong or any suggestions for how to solve this type of coupled equations.
The full code is here:
example12_08_24.zip
Beta Was this translation helpful? Give feedback.
All reactions