|
[Sponsors] |
Homogeneous reaction works fine alone but not with diffusion and/or convection |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 28, 2019, 18:52 |
Homogeneous reaction works fine alone but not with diffusion and/or convection
|
#1 |
New Member
Anderson
Join Date: Sep 2019
Posts: 3
Rep Power: 7 |
Hi,
I've been working on a 2D transient simulation that includes convection, diffusion, and homogeneous reaction. I assume a parabolic velocity profile, so I don't have to solve for velocity and pressure. My Python code using finite volume method is finished, and I've been working on code verification by applying the method of manufactured solutions. I solve the system for a final time of 10 seconds with an explicit time discretization, and then compare the numerical solution to the exact one (that is, the manufactured one). It goes well until around 8s when the numerical solution deviates from the exact one. Intending to find the problem, I did the following: 1) removed only diffusion term and ran the code. There were the same errors as for the original system, but close to one of the walls (at x = L) the error was smaller; 2) removed only convection term and ran the code. There were errors only close to the wall (at x = L) and they were exactly the same as for the original system; 3) removed only homogeneous reaction term and ran the code. There were no errors. I got a perfect match between numerical and manufactured solutions. 4) removed both diffusion and convection terms, and ran the code. There were no errors. Again, a perfect match between numerical and exact solution. Based on these tests, I've concluded the following: a) the boundary condition at x = L is not a problem, or none of the tests would present a perfect match between numerical and exact solutions. b) I thought at first that the problem was located in the homogeneous reaction, but when diffusion and convection were removed and only reaction was left (test 4), there were no errors. c) I assume that all three phenomena were properly discretized since they work as expected when the reaction term is not present. The reaction itself also works fine when alone (test 4). c) My final conclusion is: the problem occurs when reaction is present along with one or two of the other phenomena (convection and diffusion). I've read that some chemical reactions make the system stiff (very fast and very slow reactions taking place), and that that requires special attention. Two possible approaches are the following: a stabilized explicit method or an implict method. I have a working fully implicit version of the code with the exact same errors, and it didn't solve the problem when using the same time step as for the explicit code. I'll try it with a smaller time step to see if it solves the problem (in case the problem is the system being stiff). I'm not sure that stiffness is the problem, but I consider it to be one reasonable explanation since the largest reaction rate constant is 5000 and the smallest 8.4E-9. Remember that when only the reaction is simulated, even the explicit solver is able to get the right result, and explicit methods usually require very small time steps to solve stiff problems (I used dt = 3/3500, which is not that small). After all this explanation, my question is: besides stiffness, what could be the reason for this behavior, in which homogeneous reaction works fine separately but fails when another phenomenon is present? I'll be able to run the implicit code with smaller time step only on Monday, and till there I'd like to hear other opinions, since I could think only of stiffness as a possible cause but there might be others. I've searched on Google, but couldn't find anything useful (maybe my choice of words for the search wasn't good). Edit: My code solves this equation (more than one species): dC/dt = D*d²C/dx² - v*dC/dy + Reaction Thanks in advance for any help! Last edited by Anderson2019; September 28, 2019 at 19:15. Reason: Stating the equation being solved |
|
October 5, 2019, 10:12 |
Problem solved!
|
#2 |
New Member
Anderson
Join Date: Sep 2019
Posts: 3
Rep Power: 7 |
Hi,
I solved the problem. I'll post here what I did in case anyone goes through a similar problem in the future. The problem was that my manufactured solutions were generating a huge homogenous reaction term compared to the diffusion and convection terms (200,000 times larger). According to this text 'DOI: 10.1007/978-3-319-70766-2_12', one should choose manufactured solutions in a way "that the different solution terms in the governing equations be very roughly the same size". So, I've just multiplied all the reaction terms (the original ones, not the 'source terms' generated by the method of manufactured solutions itself) by a small constant. Now all my terms (diffusion, convection, and homogeneous reaction) are "very roughly the same size" and my numerical solution matches the exact one. |
|
Tags |
source terms, species tranport, stiffness |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Porosity model not found for pisoFoam; works fine for simpleFoam | aerogt3 | OpenFOAM | 2 | September 13, 2014 17:39 |
How to stop diffusion and advection in a zone for selected species. | hda | FLUENT | 0 | March 19, 2012 00:59 |
Parallel runs with sonicDyMFoam crashes (works fine with sonicFoam) | jnilsson | OpenFOAM Running, Solving & CFD | 0 | March 9, 2012 07:45 |
Problem on multiple processors..works fine on single processor! | skabilan | OpenFOAM Running, Solving & CFD | 2 | December 5, 2009 13:19 |
interpret works fine but compile doesn't | Jan Balemans | FLUENT | 0 | March 14, 2008 10:41 |