CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

TernaryMixture solving two MassTransport equation coupled

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 26, 2017, 14:29
Default TernaryMixture solving two MassTransport equation coupled
  #1
New Member
 
Rafael Jurado's Avatar
 
Rafael Jurado Cruz
Join Date: Sep 2014
Location: Córdoba (Spain)
Posts: 9
Rep Power: 4
Rafael Jurado is on a distinguished road
Hello everyone,

I would like to modify the IcoFoam solver to solve two MassTransport equation which are coupled like this:

1.- ∂C1/∂t + ∂Ui·C1/∂xj = D11 · ∂^2 C1/∂^2xj + D12 · ∂^2 C2/∂^2xj
2.- ∂C2/∂t + ∂Ui·C2/∂xj = D22 · ∂^2 C2/∂^2xj + D21 · ∂^2 C1/∂^2xj

I would like to do this time discretization:

(C1^(n+1) - C1^(n))/dt = 0.5*[DiffC1 + DiffC2]^(n+1)
+ 0.5*[DiffC1 + DiffC2]^(n)
+ 1.5*ConvC1^(n) - 0.5*ConvC1^(n-1)


(C2^(n+1) - C2^(n))/dt = 0.5*[DiffC2 + DiffC1]^(n+1)
+ 0.5*[DiffC2 + DiffC1]^(n)
+ 1.5*ConvC2^(n) - 0.5*ConvC2^(n-1)

So, I have tried this in OpenFOAM:

1.-
solve
(
fvm::ddt(C1)
+ 0.5*(fvm::div(phi, C1) + fvc::div(phi, C1))
- 0.5*(fvm::laplacian(D11, C1) + fvc::laplacian(D11, C1))
- 0.5*(fvm::laplacian(D12, C2) + fvc::laplacian(D12, C2))
);

2.-
solve
(
fvm::ddt(C2)
+ 0.5*(fvm::div(phi, C2) + fvc::div(phi, C2))
- 0.5*(fvm::laplacian(D22, C2) + fvc::laplacian(D22, C2))
- 0.5*(fvm::laplacian(D21, C1) + fvc::laplacian(D21, C1))
);

and I have putted this into a loop to iterate until C1 and C2 is converged.

The problem comes from the term [fvm::laplacian(D12, C2)] in the first equation and [fvm::laplacian(D21, C1)] in the second one. I think that this is because, you can not use an implicit term of a variable while solving the other one. Let say the term [fvm::laplacian(D12, C2)] (i.e. DiffC2^(n+1)) in the first equation.

So I have two question, the first one and the most important is:
1.- How can I managed to introduce the other Concentration explicitly in each equation in OpenFOAM?

And the second one is;

2.- How can I take the concentration variable of two previous timesteps for using an Adam-Bashforth time discretization in the convection terms, i.e. [-0.5*ConvCi^(n-1)]?

Thank you in advance...

Kind regards,
Rafael Jurado is offline   Reply With Quote

Old   March 27, 2017, 07:12
Default
  #2
New Member
 
Rafael Jurado's Avatar
 
Rafael Jurado Cruz
Join Date: Sep 2014
Location: Córdoba (Spain)
Posts: 9
Rep Power: 4
Rafael Jurado is on a distinguished road
Anyone can help me please?

Thank's in advance
Rafael Jurado is offline   Reply With Quote

Old   March 27, 2017, 11:09
Default
  #3
Senior Member
 
Join Date: Oct 2013
Posts: 380
Rep Power: 7
chriss85 is on a distinguished road
If you use fvc instead of fvm you can calculate the laplacian explicitly. The fvm operators all concern the variable for which you solve the equation, so using the fvc operators uses the fields from the last time that variable was solved for (or modified otherwise).
chriss85 is offline   Reply With Quote

Old   March 27, 2017, 11:16
Default
  #4
New Member
 
Rafael Jurado's Avatar
 
Rafael Jurado Cruz
Join Date: Sep 2014
Location: Córdoba (Spain)
Posts: 9
Rep Power: 4
Rafael Jurado is on a distinguished road
Thanks for your reply chriss85,

But the problem is that I want to if it is possible to use the "current" timestep value of the component, let say C2 in C1 equation, in order to use a second order scheme such as Crank-Nicolson. So for doing it I need the (n+1) time of C2... I don't know if I have explain it porperly...

Thanks you again.
Rafael Jurado is offline   Reply With Quote

Old   March 27, 2017, 11:23
Default
  #5
Senior Member
 
Join Date: Oct 2013
Posts: 380
Rep Power: 7
chriss85 is on a distinguished road
I think you can use field.oldTime() and possibly field.oldTime().oldTime() to access the old fields from previous time steps, but I'm not too sure about this. If this doesn't work you'll have to copy your old fields somewhere appropriate. If you need a different time derivative discretization you'll have to write a class for this. In this case you should look up the implementation of the existing time derivative operator implementations for reference.
chriss85 is offline   Reply With Quote

Old   March 27, 2017, 11:31
Default
  #6
New Member
 
Rafael Jurado's Avatar
 
Rafael Jurado Cruz
Join Date: Sep 2014
Location: Córdoba (Spain)
Posts: 9
Rep Power: 4
Rafael Jurado is on a distinguished road
I have try this already, but it doesn't work with the field.oldTime(). So, in simple words:

- Is there any way to update the value of C1 and C2 within the same timestep?

If I could do this, I think that it would be enough with put the two equations into a loop...

Thanks for your quick reply.
Rafael Jurado is offline   Reply With Quote

Reply

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
Maximum number of iterations exceeded chtmultiregionsimpleFoam Moncef OpenFOAM Running, Solving & CFD 10 May 31, 2017 18:04
pimpleDyMFoam computation randomly stops babapeti OpenFOAM Running, Solving & CFD 4 February 1, 2017 18:55
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 07:37
Orifice Plate with a fully developed flow - Problems with convergence jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 05:24
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 16:54.