
[Sponsors] 
Is it possible to use gradient adaption for two different parameters? 

LinkBack  Thread Tools  Search this Thread  Display Modes 
January 17, 2017, 20:20 
Is it possible to use gradient adaption for two different parameters?

#1 
Member
Join Date: Jun 2015
Posts: 46
Rep Power: 10 
I am using 'dynamic gradient adaption' for mesh refinement. However, I'd like to be able to apply refinement not only based on phase gradient but also wherever there is a velocity gradient as well.
Please let me know whether it is possible and how. Thanks 

April 19, 2018, 06:00 
answer

#2 
New Member
Join Date: Apr 2018
Posts: 8
Rep Power: 7 
Hi,
It is possible, but its a bit of work. Specify a UDS and use a DEFINE_AT_END udf to fill it with VOF. This gives you access to the VOF gradient via the UDSI_G macro. Use this to make another UDF that takes UDSI_G and whatever other scalar you wish to adapt with, and flag a user defined memory (UDM) such that it either adaps or coarsens. e.g. If UDSI_G>0.1  dv/dx>0.1 UDM=1 else UDM=0 then just set the adaption to be depending on the UDM (adapt if UDM>0.5 coarsen if UDM<0.5). I hope this makes somewhat sence, else i will be happy to elaborate. BR. Torjo 

April 29, 2020, 10:35 

#3  
Senior Member
Lolita
Join Date: Aug 2016
Posts: 115
Rep Power: 9 
Quote:
This is a similar problem you described above. I wish to find gradients of alpha variables in the VOF model. I already checked the expert activation and tried C_VOF_G, it still gives the error. One of the papers, I read they used UDS to define the alpha and then UDSI_G to find the gradient of alpha. Above you have written "Specify a UDS and use a DEFINE_AT_END udf to fill it with VOF" what do you mean by this statement? What I did was, I defined a UDS in the fluent, choosing alpha as the new variable, then I used UDSI_G to find the gradient of the alpha variable but it still gives the error. Any help would be highly appreciated. regards 

April 29, 2020, 11:55 
VF Gradient

#4 
Senior Member

If using C_VOF_G gives segmentation violation, then the memory has not been assigned. However, if the value is 0, then the arguments passed to C_VOF_G could be wrong.
__________________
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. 

April 30, 2020, 03:25 
VF gradient

#5  
Senior Member
Lolita
Join Date: Aug 2016
Posts: 115
Rep Power: 9 
Quote:
Code:
#include "udf.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "metric.h" #include "mem.h" #define CON 1 DEFINE_ADJUST(store_gradient, domain) { Thread *t; Thread **pt; cell_t c; int phase_domain_index = 0.; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain, phase_domain_index); { Alloc_Storage_Vars(pDomain, SV_VOF_RG, SV_VOF_G, SV_NULL); Scalar_Reconstruction(pDomain, SV_VOF, 1, SV_VOF_RG, NULL); Scalar_Derivatives(pDomain, SV_VOF, 1, SV_VOF_G, SV_VOF_RG,Vof_Deriv_Accumulate); } mp_thread_loop_c(t, domain, pt) if (FLUID_THREAD_P(t)) { Thread *ppt = pt[phase_domain_index]; begin_c_loop(c, t) { C_UDMI(c, t, 0) = C_VOF_G(c, ppt)[0]; Message("UDMI0: %g\n", C_UDMI(c, t, 0)); } end_c_loop(c, t) } Free_Storage_Vars(pDomain, SV_VOF_RG, SV_VOF_G, SV_NULL); } Code:
UDMI0: 0 UDMI0: 0 UDMI0: 0 UDMI0: 0 UDMI0: 0 UDMI0: 0 UDMI0: 1.95115e41 UDMI0: 0 UDMI0: 0 UDMI0: 0 UDMI0: 0 Now, I tried to use the expert option and set keep memory "yes". Code:
#include "udf.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "metric.h" #include "mem.h" #define CON 1 /************************************************** *******************/ /* Finding dot product of gradT and gradalpha(liq) */ /************************************************** *******************/ DEFINE_ADJUST(store_gradient, domain) { Thread *t; Thread **pt; cell_t c; int phase_domain_index = 0.; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain, phase_domain_index); mp_thread_loop_c(t, domain, pt) if (FLUID_THREAD_P(t)) { Thread *ppt = pt[phase_domain_index]; begin_c_loop(c, t) { C_UDMI(c, t, 0) = NV_DOT(C_VOF_G(c, ppt), C_T_G(c,t)); Message("UDMI0: %g\n", C_UDMI(c, t, 0)); } end_c_loop(c, t) } } Last edited by rupak504; April 30, 2020 at 04:05. Reason: update 

April 30, 2020, 05:20 
Values

#6 
Senior Member

You appear to be getting correct values based on your first code with allocation of storage. Do note that most of these values would be 0 since most of the cells either have phase1 or phase2. Only at the interface the values would be positive or negative. So, run this UDF, go to Contour Plots and then plot the value for UDM. You should observe nonzero values at the interface.
__________________
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. 

April 30, 2020, 18:33 

#7  
Senior Member
Lolita
Join Date: Aug 2016
Posts: 115
Rep Power: 9 
Quote:
regards 

May 1, 2020, 15:37 
Mass Transfer Mechanism

#8 
Senior Member

Mass transfer by evaporation is always due to vapor pressure being different from saturation pressure. Evaporation temperature is a function of pressure above the water. E.g., water boils at 373 K at sea level but same water boils at 345 K at the top of Mount Everest. The reason being low pressure. For the same reason, water in a pond is colder than atmosphere, due to same phenomenon fruit or vegetable or wet clothes dry even if not kept in the sun and without any wind; the vapor pressure in the atmosphere decides at what temperature the water should evaporate. There is a corresponding saturation temperature for each vapor pressure. If temperature of liquid is greater than the saturation temperature for a given pressure, then water evaporates. So, if we are talking about evaporation, mass transfer from liquid to vapor is possible only if liquid temperature is greater than the saturation temperature.
__________________
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. 

Tags 
gradient adaption, mesh refinement, twophase flow, vof 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
question regarding LES of pipe flow  pimpleFoam  Dan1788  OpenFOAM Running, Solving & CFD  37  December 26, 2017 14:42 
Gradient Computation: finite differences and adjoint method  doan.nak  SU2  3  November 22, 2017 05:37 
Temperature gradient for the internal Field.  Philipp Dietrich  OpenFOAM Programming & Development  0  July 2, 2014 03:15 
can I use static enthalpy gradient to describe dT  Jay  CFX  0  August 6, 2008 23:01 
Editing of adaption parameters CFX5.5  Sergei  CFX  2  July 11, 2002 02:11 