Order of Solver Execution for Coupled Solvers

Numerical methods and mathematical models of Elmer
annier
Posts: 1169
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Order of Solver Execution for Coupled Solvers

Post by annier »

Hi,
Let me present my Question through the following example:

Code: Select all

Solver 1 
A >>Advection-Diffusion Solver
...
End

Solver 2
B>>MeshSolver
...
End
.
.
.
Equation 1
Active Solvers (2) = 1 2

Boundary Condition 1
!BC related to Solver 1
BC A >>Concentration Variable related

!BC related to Solver 2
BC B >>Related to MeshUpdate

Let me now highlight that i am interested in the boundary phenomena. That is solver 1 and solver 2 are coupled with each other in boundary. Numerically, Solver 1 imposes a change in the boundary variable (here Mesh Update) for solver 2. In turn the change in variable 2 again gives an impulse to change in the boundary variable (concentration) of solver 1.
The Question is :
  • 1. What is the order of execution of these solvers {Implied by Active Solvers(2) = 1,2}. Is it like this:
    -The ElmerSolver first enters through the Advection -Diffusion Solver (Solver 1).
    -It goes along it as described in the src file. When it reaches the boundary condition, finds the Mesh Update variable and is directed towards it by a suitable UDF (UDF 1).
    -Finally it gives out the desired solution for the concentration variable throughout the whole mesh including boundary.
    -Now, the ElmerSolver goes through the Mesh-Solver (Solver 2).
    -When it reaches the boundary condition, it gets directed to the suitable UDF (UDF 2).
    -There when it needs to find the value of concentration, it sees the changed concentration of the solver. It uses that value to evaluate the mesh update.
    -Now it again goes to second iteration: first to solver 1 and then to solver 2.
    -The process goes on till the simulation timestep size is fulfilled
  • 2. Is my above hypothesis in accordance to the way the Elmer Solver works? If this is the way, then I should give a default value of Mesh Update in UDF 1 for the concentration variable to use it for the first time.
  • 3. Or, is my hypothesis wrong: That is : Active Solvers (2) = 1 2 is same as Active Solvers (2) = 2 1? That means the order of execution is simply governed by

    Code: Select all

    Exec Solver = ... !Always, After Simulation , After Saving, Before.
  • 4. If the Exec Solver definition governs the execution pattern, then what is the procedure for making two coupled solvers to interact with each other by feedback?
yours
annier
Last edited by annier on 12 Dec 2013, 15:15, edited 2 times in total.
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Order of Solver Execution for Coupled Solvers

Post by mzenker »

Hi Annier,

I think your statement under 1. is correct, but I may be wrong.
To find out, I would put print statements into both UDFs so that you can follow the course of things in the solver log.

HTH,

Matthias
annier
Posts: 1169
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Order of Solver Execution for Coupled Solvers

Post by annier »

Hi Matthias,
As i am quite a beginner to try out several things at once, could you please help me by verifying with your own solvers ? It does not have to necessarily be coupled at the boundary. i would just want to be sure that Active Solvers (2) = 1 2 sets the order of execution i.e. 1 followed by 2. In other words, i request you to guide me by conducting the "print statements" experiment to verify the solver execution pattern.
yours
annier
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Order of Solver Execution for Coupled Solvers

Post by mzenker »

Hi Annier,

I don't have the time to run simulations for you at the moment, sorry.
You can easily do that yourself. Just take any simulation with two solvers being executed "always", change the "Active Solvers" line, run and watch the solver log. Each solver prints out a message when it is started.

Matthias
Last edited by mzenker on 12 Dec 2013, 15:32, edited 1 time in total.
annier
Posts: 1169
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Order of Solver Execution for Coupled Solvers

Post by annier »

Hi Matthias,
Now you could realize well that i am really a beginner.
Matthias wrote:You can easily do that yourself. Just take any simulation with two solvers being executed "always", change the "Active Solvers" line, run and watch the solver log. Each solver prints out a message when it is started.
This explanation of yours has helped me understand the things well.
I will conduct the experiment of "print statements" under your guidance.
Moreover, i will increase the "Maximum Output Level " to increase the verbosity (and see things in detail).
yours
annier
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
annier
Posts: 1169
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Order of Solver Execution for Coupled Solvers

Post by annier »

Hi Matthias,
How can we generate the solver log file in text format? When i run solver with ElmerSolver command, I cannot see all content in the terminal i.e. i cannot see the beginning part.
yours
annier
Last edited by annier on 13 Dec 2013, 08:12, edited 2 times in total.
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Order of Solver Execution for Coupled Solvers

Post by mzenker »

Hi Annier,

either you use ElmerGUI or, from a terminal, issue the following command (DOS syntax, similar in Linux):

Code: Select all

ElmerSolver > case.log 2>&1
Then you have your output in a file.

HTH,

Matthias
annier
Posts: 1169
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Order of Solver Execution for Coupled Solvers

Post by annier »

Hi Matthias,
Thank you very much for your valuable reply. I learnt a new thing today.

Yours
Annier
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
annier
Posts: 1169
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Order of Solver Execution for Coupled Solvers

Post by annier »

Findings of "Print Statements" Experiment
Procedure/Conditions
Group P
  • 1. Solver A >> Solver 1 ; Solver B >> Solver 2 --------- Active Solvers (2) = 1 2 ---------- Run Command >> ElmerSolver > myfile.log 2>&1
  • 2.Solver A >> Solver 1 ; Solver B >> Solver 2 --------- Active Solvers (2) = 2 1 ---------- Run Command >> ElmerSolver > case.log 2>&1
Group Q
  • 3.Solver A >> Solver 2 ; Solver B >> Solver 1 --------- Active Solvers (2) = 1 2 ---------- Run Command >> ElmerSolver > abcd.log 2>&1
  • 4.Solver A >> Solver 2 ; Solver B >> Solver 1 --------- Active Solvers (2) = 2 1 ---------- Run Command >> ElmerSolver > wxyz.log 2>&1
Results
Condition 1 and Condition 2 gave the exactly same result. The log files with name myfile.log and case.log were identical.
Condition 3 and Condition 4 gave the exactly same result. The log files with name abcd.log and wxyz.log were identical.
The solver execution as demonstrated by the two log files in Group P showed that first solver A is executed and is followed by solver B for each iterations.
The solver execution as demonstrated by the two log files in Group Q showed that first solver Bis executed and is followed by solverA for each iterations.

Inferences/Conclusion
  • -The number following the solver (Solver n) in the Solver section of SIF is the setting criteria for order of execution of coupled solvers.
  • -For a given Solver 1 and Solver 2, the order of solver numbers arranged in the RHS of active solvers in Equation section does not alter the execution order. That is {Active Solvers (2) = 1 2} is same as {Active Solvers (2) = 2 1} for given Solver 1 and Solver 2. This active solvers setting is the binding action(coupling) between the two solvers with "solver 1" solver always having an earlier execution priority than "solver 2 " solver .
Yours
Annier
Last edited by annier on 11 Oct 2014, 21:58, edited 1 time in total.
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Order of Solver Execution for Coupled Solvers

Post by mzenker »

Hi Annier,

thank you for these clarifying tests!

Matthias
Post Reply