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

TernaryMixture solving two MassTransport equation coupled

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread 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: 11
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: 11
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: 397
Rep Power: 18
chriss85 will become famous soon enough
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: 11
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: 397
Rep Power: 18
chriss85 will become famous soon enough
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: 11
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


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 Off
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 28 July 13, 2020 14:26
pimpleDyMFoam computation randomly stops babapeti OpenFOAM Running, Solving & CFD 5 January 24, 2018 05:28
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 06: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 18:07


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