|
[Sponsors] |
June 13, 2016, 11:57 |
|
#21 | |
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
Quote:
I do have another question that I was not able to find a satisfactory answer to online. How do I view how the porosity changed with time? I've looked into setting up a monitor with the field variable of UDMI_0 selected, but I'm not sure which report type to choose. |
||
June 13, 2016, 19:08 |
|
#22 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
You can save UDM values at each time step as you would with the velocities via File > Data File Quantities and select "User Memory 0". Then this data is available alongside your other variables in CFD-Post or other external postprocessing software. Note: transient data can accumulate significantly; perhaps write every 5-10 time steps instead.
Alternatively, you could write the UDM to a data file. This approach is more manual, but you could choose to save only the overall average or local average values instead (say, split your domain into blocks). |
|
June 15, 2016, 18:26 |
|
#23 | |
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
Quote:
I do have a slightly different question though. How do I model a reaction between the fluid and the solid present in a porous zone? In my case, I have a porous rock with acid flowing through it, so how do I model this? I was looking into species transport, but it appears you can only model reactions within the mixture with it. I'm thinking that all I need to do is write some UDF for the consumption of acid but I'm not sure what macro I would use or where the hook would be. I've seen some stuff using DEFINE_VR_RATE, but I'm not sure if that is what I need for my application. |
||
June 17, 2016, 14:24 |
|
#24 |
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
After speaking with a grad student, I've come to the conclusion that I just need to modify the S term in the following equation to account for the consumption of acid due to reaction with the rock. The grad student referred to this as an "acid sink term".
From reading the manual, it appears that I can define this source term as either a constant value or a UDF. My questions are as follows:
Last edited by Baden; June 17, 2016 at 19:10. |
|
June 17, 2016, 20:04 |
|
#25 | ||
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Quote:
Quote:
|
|||
June 17, 2016, 20:43 |
Porosity Variation with Time
|
#26 | ||
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
Quote:
Sorry for the repeat question, but I just want to make sure I understand what I'm doing. Quote:
|
|||
June 18, 2016, 07:53 |
|
#27 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
I couldn't say whether or not your method is valid (it's outside my field). It sounds about right, perhaps another user will respond. Have you checked what the standard modelling approach is from literature?
|
|
June 18, 2016, 08:19 |
|
#28 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
I am simulating fuel cell and the product of the reaction is liquid water. Thus, this occupy the void of the porosity. What I do is:
porosity = constant * (1 - s) where 's' is the amount of liquid water. You can probably going to use similar approach. |
|
June 20, 2016, 12:33 |
|
#29 | |||
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
Quote:
Quote:
In my original post, I stated that my formula for porosity is as follows: Quote:
Last edited by Baden; June 20, 2016 at 15:01. |
||||
June 21, 2016, 06:52 |
|
#30 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
The reaction rate probably has a relation with the porosity. Use that to implement the variation of the porosity in your code. |
||
June 21, 2016, 11:19 |
|
#31 | |
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
Quote:
Also, would I disable the "Reaction" option in the above images since the reaction is modeled by the sink? In my case, the porosity has a relation with reaction rate, which I have added in my actual, unsimplified code. |
||
June 21, 2016, 12:22 |
|
#32 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
|
||
June 21, 2016, 17:07 |
|
#33 | ||
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
Quote:
Below I've included a simplified version of my current species source code: Code:
#include "udf.h" #define i_HCl 0 #define X 1.0 DEFINE_SOURCE(HCl_source,c,t,dS,eqn) { real C = C_YI(c,t,i_HCl) * C_R(c,t); /* mass concentration of HCl */ real source = -X * C; /* negative value = sink */ dS[eqn] = 0.; return source; }
|
|||
June 21, 2016, 17:16 |
|
#34 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
2) The list of your species you can check in the material properties. Go to the mixture tab and in name you can define the order of them. If you need source term to all the species you have, add an extra species with meaningless properties, so it won't affect you results. |
||
June 29, 2016, 20:00 |
|
#35 | |
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
Quote:
I am currently in the process of adding the sink term for the acid species. The code is as follows: Code:
#include "udf.h" #define i_HCl 0 /* species index of HCl */ #define Sh_infinity 3. /* asymptotic Sherwood number for the pore */ #define D_m 3.6e-9 /* molecular diffusivity */ #define r_p 1.e-6 /* pore radius */ #define v 2. /* stoichiometric coefficient of the chemical reaction */ #define k_s 2.e-3 /* surface reaction rate constant */ #define a_0 5280. /* initial superficial area */ #define rho_s 2.71e+3 /* density of the solid phase */ real k_c = (Sh_infinity * D_m) / (2. * r_p); /* local mass transfer coefficient */ DEFINE_SOURCE(HCl_source,c,t,dS,eqn) { real a_v = a_0 * (1 - C_UDMI(c,t,1)) / (1 - C_UDMI(c,t,0)); superficial area */ real k_eff = a_v * (k_c * k_s) / (k_c + k_s); /* effective dissolution rate constant */ real C = C_YI(c,t,i_HCl) * C_R(c,t); /* mass concentration of HCl */ real source = -k_eff * C; /* negative value = sink */ dS[eqn] = 0.; return source; } |
||
June 30, 2016, 07:24 |
|
#36 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
You can reduce the chances of it happening by adding the back flow values in your outlet boundary. It can also be something caused by the mesh quality. Depending on the nature of your problem (high pressure/velocity), it also has some influence on it. Did you check the values of your porosity and are they as you expect? |
||
July 1, 2016, 11:18 |
|
#37 | |
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
Quote:
|
||
July 5, 2016, 18:47 |
|
#38 |
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
I've been working on implementing the porosity variation code with the species transport enabled (WITHOUT the acid sink UDF implemented yet). I am getting reasonable porosity values, however, the graph of residuals looks nothing like it did prior to enabling a porous zone. Is this normal or is there an error in my setup of a porous zone?
Both simulations were run using the transient solver setting. |
|
July 6, 2016, 04:55 |
|
#39 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
|
||
July 6, 2016, 16:39 |
|
#40 | |
Member
Join Date: Jun 2016
Posts: 64
Rep Power: 10 |
Quote:
The solver doesn't seem to converge unless my time step is around 0.01 seconds. However, with such a small time step the simulation real life run-time is very high just to simulate 10 minutes of flow. I am trying to figure out if the acid sink code is working properly, but the results of a short simulation are inconclusive. These are the results from a time step of 0.01 seconds for 100 time steps: My questions are as follows:
|
||
Tags |
acid, porosity, time, transient, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
decomposePar problem: Cell 0contains face labels out of range | vaina74 | OpenFOAM Pre-Processing | 37 | July 20, 2020 06:38 |
simpleFoam error - "Floating point exception" | mbcx4jc2 | OpenFOAM Running, Solving & CFD | 12 | August 4, 2015 03:20 |
Help for the small implementation in turbulence model | shipman | OpenFOAM Programming & Development | 25 | March 19, 2014 11:08 |
pisoFoam with k-epsilon turb blows up - Some questions | Heroic | OpenFOAM Running, Solving & CFD | 26 | December 17, 2012 04:34 |
Orifice Plate with a fully developed flow - Problems with convergence | jonmec | OpenFOAM Running, Solving & CFD | 3 | July 28, 2011 06:24 |