|
[Sponsors] |
UDF to modify the value of a user defined scalar |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 11, 2000, 18:07 |
UDF to modify the value of a user defined scalar
|
#1 |
Guest
Posts: n/a
|
Hi, I have a two-phase flow between two parallel plates. I am using VOF model to simulate the flow. I have introduced a user defined scalar and trying to assign a value to the scalar at the interface. I am finding the interface by determining the cells which have the liquid volume fraction between 0 and 1. I am using DEFINE_ADJUST macro as I want it to be done every iteration. But it is not assigning the scalar value at the interface. I am provding here the code which I have written:
#include "udf.h" #include "sg_mphase.h" DEFINE_ADJUST(vol_frac_find, domain) { Thread *t=Lookup_Thread(domain,8); cell_t c; begin_c_loop(c,t) { if(C_VOF(c,t,1)>0. && C_VOF(c,t,1)<1.) C_UDSI(c,t,0)=0.0228; } end_c_loop(c,t); } I would appreciate, if someone can point out my mistake. The id that I have used in the Lookup_Thread function corresponds to the zone- default-interior in the boundary conditions dialog-box. Thanks Raja Banerjee |
|
December 11, 2000, 19:06 |
Re: UDF to modify the value of a user defined scal
|
#2 |
Guest
Posts: n/a
|
Try
DEFINE_ADJUST(find_vof, domain) { cell_t c; Thread *thread; thread_loop_c (thread, domain) { begin_c_loop (c, thread) { if(C_VOF(c,thread,1)>0. && C_VOF(c,thread,1)<1.) C_UDSI(c,thread,0)=0.0228; } end_c_loop (c, thread) } } |
|
December 12, 2000, 01:52 |
Re: UDF to modify the value of a user defined scal
|
#3 |
Guest
Posts: n/a
|
Thanks for your advice. But, the value that is being assigned is still not correct. The interface value seem to increase from zero to the maximum value as we go downstream. This should not happen because as can be seen from the code that the interface value is a constant and is not related to the distance in the downstream direction.
I would appreciate if have any suggestion for this behaviour. Raja |
|
December 12, 2000, 02:14 |
Re: UDF to modify the value of a user defined scal
|
#4 |
Guest
Posts: n/a
|
One point is - what are you doing with the scalar transport equation (0) which you use for assigning C_UDSI(c,t,0) = value ??
If you just want to use this as storage for this value you should turn off solution of the UDS from the GUI (see manual to deselect solving the eqn - I think its in solution - controls - etc.). Alternatively in Fluent 5.4 you can use a memory location C_UDMI(c,t,0) instead which is more efficient than using a scalar transport eqn as a storage location - see udf manual for 5.4. Greg |
|
December 12, 2000, 11:42 |
Re: UDF to modify the value of a user defined scal
|
#5 |
Guest
Posts: n/a
|
Well the idea of this whole excercise is that I am trying to determine the concentration of an evaporating liquid. As VOF does not support evaporation, I am introducing this scalar equation which is basically the species equation of the evaporating vapour. At the gas/liquid interface the mass fraction of the vapour corresponds to the saturated value, which is a function of vapour pressure. The diffusivity of the vapour inside the liquid is zero and a constant value in the gas phase.
Therefore the algorithm that I am trying to implement is: 1. Determine the interface i.e. 0<vol. frac <1 2. Assign saturated mass fraction at the interface, i.e C_UDSI(c,t,0) 3. Solve the scalar equation for the concentration profile over the liquid surface. Therefore, I need to solve the scalar equation. Thanks Raja |
|
March 5, 2019, 15:19 |
|
#6 | |
New Member
Join Date: Jul 2018
Posts: 29
Rep Power: 8 |
Quote:
I want to do same problem as you, i was wondering would you find the solution? Regards, Amin |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Change user defined scalar flux function | Kaazem_RA | Fluent UDF and Scheme Programming | 0 | February 15, 2019 09:01 |
Division by zero exception - loop over scalarField | Pat84 | OpenFOAM Programming & Development | 6 | February 18, 2017 06:57 |
User Defined Scalar Flux | SandilyaCFD | OpenFOAM Running, Solving & CFD | 0 | February 15, 2017 16:08 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 02:27 |
User Defined Scalar (UDS) question (units) | D | FLUENT | 0 | March 1, 2006 21:04 |