CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 13, 2013, 17:46
Default Solving a system of equations to calculate boundary conditions
  #1
New Member
 
Eng. Emmanuel LujŠn
Join Date: Mar 2013
Posts: 5
Rep Power: 3
elujan is on a distinguished road
Hi,
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?
Thanks!
Emmanuel
elujan is offline   Reply With Quote

Old   December 15, 2013, 04:24
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 773
Rep Power: 11
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, 13:41
Default
  #3
New Member
 
Eng. Emmanuel LujŠn
Join Date: Mar 2013
Posts: 5
Rep Power: 3
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.

Emmanuel

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

Old   December 16, 2013, 14:39
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,470
Rep Power: 23
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,

Niels
__________________
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

Reply

Tags
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 04: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 13:46.