|
[Sponsors] |
UDF for capillary driven flow in porous media |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 4, 2020, 14:38 |
UDF for capillary driven flow in porous media
|
#1 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
Hello Everyone,
I am trying to simulate the capillary driven flow in porous media using VOF model. I have considered an upward wicking case where the capillary force acts in the opposite direction to the gravitational force. This capillary force is the only force that pulls liquid up. The inlet and outlet boundary conditions are atmospheric pressure conditions. I have developed the following code to add capillary force to the secondary phase-only but I not getting satisfactory results. any suggestions will be very helpful. The code interprets with no errors. I don't see any changes in liquid volume fractions #include "udf.h" #define AIR_PHASE_ID 2 /*primary phase*/ #define LIQUID_PHASE_ID 3 /*secondary phase*/ #define POROUS_CELL_ZONE_ID 2 /*cell zone ID*/ #define C_CAPILLARY_MOM_SOURCE_X(C,T) C_UDMI(C,T,0) #define C_CAPILLARY_MOM_SOURCE_Y(C,T) C_UDMI(C,T,1) #define C_CAPILLARY_MOM_SOURCE_Z(C,T) C_UDMI(C,T,2) #define CAPILLARY_PRESSURE 12.35 /* 2.gamma.cos(theta)/R */ real area_factor(real volume, real vof) { real factor; factor = pow(volume, 2.0 / 3.0); factor *= 1.0 - 4.0*(vof - 0.5)*(vof - 0.5); /* = 1.0 at VOF=0.5, 0.0 at VOF = 0.0 or 1.0 */ return factor; } void set_capillary_pressure_sources(Thread *lct, real *direction) { cell_t c; real vol; real capillary_force; begin_c_loop(c, lct) { vol = C_VOLUME(c, lct); capillary_force = CAPILLARY_PRESSURE * area_factor(vol, C_VOF(c, lct)) / vol; /*source term with unit N/m3*/ ND_VS(C_CAPILLARY_MOM_SOURCE_X(c, lct), C_CAPILLARY_MOM_SOURCE_Y(c, lct), C_CAPILLARY_MOM_SOURCE_Z(c, lct), =, direction, *, capillary_force); } end_c_loop(c, lct) } DEFINE_ADJUST(capillary_sources, mixture_domain) { Domain *liquid_domain; Domain *air_domain; Thread *lct; Thread *act; real capillary_direction[ND_ND]; liquid_domain = Get_Domain(LIQUID_PHASE_ID); air_domain = Get_Domain(AIR_PHASE_ID); printf("Setting sources in the domain"); lct = Lookup_Thread(liquid_domain, POROUS_CELL_ZONE_ID); act = Lookup_Thread(air_domain, POROUS_CELL_ZONE_ID); NV_D(capillary_direction, =, 1.0, 1.0, 0.0); set_capillary_pressure_sources(lct, capillary_direction); printf("Done.\n"); } DEFINE_SOURCE(caplillary_mom_x_source, c, ct, ds, eqn) { return C_CAPILLARY_MOM_SOURCE_X(c, ct); } DEFINE_SOURCE(caplillary_mom_y_source, c, ct, ds, eqn) { return C_CAPILLARY_MOM_SOURCE_Y(c, ct); } DEFINE_SOURCE(caplillary_mom_z_source, c, ct, ds, eqn) { return C_CAPILLARY_MOM_SOURCE_Z(c, ct); } |
|
June 4, 2020, 17:06 |
Udm
|
#2 |
Senior Member
|
You are defining sources using UDMs but what is contained in those memories? No where in the code are any values being assigned to UDMs. So, the sources are 0.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 5, 2020, 08:19 |
|
#3 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
Yes, I did not realize this before. Could you suggest some corrections in the code? I created this code by modifying the previous codes available.
Thanks Shivam |
|
June 5, 2020, 09:38 |
Code
|
#4 |
Senior Member
|
To help you, I need to know what is it that you want to do, what is the objective of the code. As of now, there are redundancies in the code. UDMs may not even be required. Two functions have been written outside DEFINE_ macros, however, only called once. That makes it difficult instead of being easier to read.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 5, 2020, 10:09 |
|
#5 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
I am trying to simulate the upward wicking flow in porous media. To do so, I am using the VOF method. The inlet and outlet both have atmospheric pressure conditions. The action of gravity is in negative y-direction. So the main mechanism for flow is the capillary action. The main objective of this code is to add a positive momentum source to the secondary phase which is based on the capillary force.
Hope this helps |
|
June 5, 2020, 10:19 |
UDMs
|
#6 |
Senior Member
|
Replace all components of C_CAPILLARY_MOM_SOURCE_X(c, lct) in ND_VS function with three C_UDMIs.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 5, 2020, 10:29 |
|
#7 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
line 35 - ND_VS(C_UDMI(C,T,0), C_UDMI(C,T,1), C_UDMI(C,T,2), =, direction, *, capillary_force);
I replaced it but fluent shows following error, line 35: T: undeclared variable. So I changed, t with lct everywhere. The code does not show any errors related to syntax. When I hook UDF as follows - Define adjust- capillary_sources user defined memory locations - 5 y momentum source in cell zone conditions - caplillary_mom_y_source. I dont see any variation in liquid volume fraction. |
|
June 5, 2020, 11:54 |
Source Terms
|
#8 |
Senior Member
|
If you are hooking these as momentum sources, then there won't be any effect on the volume fraction. The sources will only affect the flow.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 5, 2020, 12:05 |
|
#9 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
Okay. Can you suggest any method so that I get it working?
|
|
June 5, 2020, 12:07 |
Flow and Volume Fraction
|
#10 |
Senior Member
|
As per your objective, you need to add momentum so that the liquid moves. That part is being done by your code. However, the issue you are reporting is related to volume fraction. The UDF you have will not affect the volume fraction.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 5, 2020, 12:16 |
|
#11 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
Okay. Yeah, that right. Do you have any suggestions on which logic should I be using that causes the secondary liquid to pump up according to capillary pressure?
It will be helpful to have your comments on this? Thanks Shivam |
|
June 5, 2020, 16:56 |
Capillary Force
|
#12 |
Senior Member
|
The code that you have should work after the modifications suggested, provided you hook it at right place. All the source UDFs must be hooked in the Cell Zones to the corresponding fields, i.e., momentum fields. If the source values are non-zero, then you should see its effects. To check, you can plot UDMs and see if the values are non-zero. For z-momentum, the values would be 0.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 8, 2020, 11:12 |
|
#13 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
Ok thanks, I will try to run simulation to see why it is happening.
|
|
June 8, 2020, 14:06 |
|
#14 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
Hello, I did a simulation by specifying the smaller amount for the initial liquid volume fraction with the modified UDF. Now I can see the change in liquid volume fraction. Thanks for the suggestion that you provided.
I even tried simulating the case using original UDF that also worked fine but the variation in liquid volume fraction w.r.t time is very fast than modified UDF (modified UDF results are logically correct). I am curious about, how should I make sure that the momentum source is being attached to the secondary phase (liquid) only.? When I plot UDM in XY plot, I only see 0 value. Thanks. Shivam |
|
June 15, 2020, 05:26 |
Momentum Source
|
#15 |
Senior Member
|
Since you are using VOF, there is only one momentum equation; not two separate equations for two phases. To ensure that the momentum is added only within the liquid phase, just multiply the source with the volume fraction of liquid phase.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 16, 2020, 13:48 |
|
#16 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
Thanks for the reply. Yes, only a single set of momentum equations is solved for the VOF model. However, I did not get why I need to multiply source term with volume fraction. could explain it in few words??
Best, Shivam |
|
June 16, 2020, 14:07 |
|
#17 |
New Member
Join Date: Apr 2020
Posts: 3
Rep Power: 6 |
||
June 16, 2020, 14:51 |
|
#18 |
New Member
Shivam Salokhe
Join Date: Jun 2020
Posts: 10
Rep Power: 6 |
can you explain the problem that you are trying to simulate?
|
|
June 16, 2020, 15:32 |
Weightage
|
#19 |
Senior Member
|
Volume fraction is being used as weight. Source will have a non-zero value only if volume fraction is greater than 0, otherwise, it will be 0.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
October 4, 2020, 04:27 |
|
#20 |
New Member
李正
Join Date: Apr 2020
Posts: 7
Rep Power: 6 |
I like this post very much, I hope the host can share more, thank you
Last edited by Wyj; October 5, 2020 at 22:57. |
|
Tags |
fluent - udf, multiphase flows, porous media model, udf capillary force |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A solver for two-phase flow with a porous media | enoch | OpenFOAM Programming & Development | 6 | October 10, 2022 10:11 |
Capillary driven flow through porous media | alexlpn | Fluent Multiphase | 1 | October 8, 2019 08:18 |
Flow through two combined porous media with diffrent permeability | Sandee | Main CFD Forum | 0 | March 28, 2015 11:35 |
Flow through porous media near well-borne | I_Fedorov | FLUENT | 0 | October 29, 2014 16:05 |
How to model granular flow through porous media | Axius | FLUENT | 2 | August 7, 2014 11:34 |