CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Solving a system of equations to calculate boundary conditions

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   December 13, 2013, 18:46
Default Solving a system of equations to calculate boundary conditions
New Member
Eng. Emmanuel LujŠn
Join Date: Mar 2013
Posts: 5
Rep Power: 6
elujan is on a distinguished road
I have a simulation where the boundary conditions are calculated solving, each time step, a non-linear, inhomogeneous, partial differential system of equations. Is there an easy way to do that? How do you solve this problem?
elujan is offline   Reply With Quote

Old   December 15, 2013, 05:24
Senior Member
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 15
Bernhard is on a distinguished road
Is it a differential equation that you can solve on a "per face" basis, or do you need to calculate it based on integrated quantities? You might want to check how it is implemented in the "advective" boundary condition.
Bernhard is offline   Reply With Quote

Old   December 16, 2013, 14:41
New Member
Eng. Emmanuel LujŠn
Join Date: Mar 2013
Posts: 5
Rep Power: 6
elujan is on a distinguished road
Dear Bernhard,
thanks for your time. Currently the domain of my problem is a box. One of the faces of this box represents an anode. I need to calculate some scalar fields (C_1, C_2, C_3, C_4 y V) on this face, solving this equation system:

- D_1 * grad(C_1) - s_1 * u_1 * C_1 * grad(V) = I_1 / F
- D_2 * grad(C_2) - s_2 * u_2 * C_2 * grad(V) = 0
- D_3 * grad(C_3) - s_3 * u_3 * C_3 * grad(V) = I_2 / F
- D_4 * grad(C_4) - s_4 * u_4 * C_4 * grad(V) = 0
C_4 = (s_1 * C_1 + s_2 * C_2 + s_3 * C_3)/s4
I_1_exp = (F/(2*R*T)) * (V + E0eq_I );
I_2_exp = (F/(2*R*T)) * (V + E0eq_II );
I_1 = I_0I * ( exp (-I_1_exp) - (C_1 / C_1_0) * exp (I_1_exp)) ;
I_2 = I_0II * ( (C_2 / C_2_0) * exp (-I_2_exp) - exp (I_2_exp)) ;

Where C_1, C_2, C_3, C_4 and V are the fields I want to calculate, and the others are known constants.

Thanks again.


Last edited by elujan; December 16, 2013 at 16:29.
elujan is offline   Reply With Quote

Old   December 16, 2013, 15:39
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,759
Rep Power: 29
ngj will become famous soon enoughngj will become famous soon enough
Hi Emmanuel,

As I see it, you can approach this in a couple of ways:

1. You can linearise the system and solve it on an faMesh (available in OF1.6-ext), and then loop around the linearised, segregated system of equations until you have reach an given tolerance.

2. You can simply write your own non-segregated approach for this. If the equation only come in this form, it should be relatively easy, however, you need to be very careful in terms of correct coupling across potential processor boundaries in the case of parallel computing.

3. More recent versions of OF from ESI also support the solution of equations on boundary patches. I do not know, how these works, but it could be an option, if you work in one of those releases. Again, this will most probably lead to a linearised, segregated system, which requires a number of outer loops for convergence.

The outer loops obviously comes into play via the coupling between the C_i fields and V (their products) and also because V is inside the exponential. I am thinking whether a simple Taylor expansion with only 2 or 3 terms around the old value of V would be a good way of approaching this? It would mean that you could have part of the source term implicitly represented in your linear system of equations.

Good luck,

Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   November 18, 2015, 12:01
New Member
Join Date: Jul 2014
Posts: 26
Rep Power: 5
Minisasi is on a distinguished road
I know this is an old post, but I was wondering if you managed to solve the problem.
I am facing the same BC problem, where everything is coupling!
Minisasi is offline   Reply With Quote

Old   July 19, 2017, 06:24
Colli, Alejandro
Join Date: Jan 2014
Posts: 53
Rep Power: 5
ancolli is on a distinguished road
did u try groovyBC?
ancolli is offline   Reply With Quote


boundary conditions, equations, non-linear, partial, system

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 14:58
Extremely slow simulation with interDyMFoam jrrygg OpenFOAM Running, Solving & CFD 9 April 23, 2013 10:14
SLTS+rhoPisoFoam: what is rDeltaT??? nileshjrane OpenFOAM Running, Solving & CFD 4 February 25, 2013 05:13
Computational time sunnysun OpenFOAM Running, Solving & CFD 5 March 16, 2009 04:32
Differences between serial and parallel runs carsten OpenFOAM Bugs 11 September 12, 2008 11:16

All times are GMT -4. The time now is 10:58.