CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Multiphase UDF : How to specify velocities for different phases

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Kokemoor

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 28, 2015, 08:51
Post Multiphase UDF : How to specify velocities for different phases
  #1
New Member
 
Aditya
Join Date: May 2015
Posts: 7
Rep Power: 11
iamadz is on a distinguished road
Hello

I have a 3D 2-phase flow in a cylindrical column being simulated in FLUENT 14.0 . I want to specify different velocity inlets for both air and water. I figured that by making 2 different UDFs, I can specify the respective UDFs for the corresponding phase velocity boundary condition. However, whenever I interpret the 2nd UDF, the UDF interpreted earlier disappears i.e. I am unable to specify multiple velocity UDFs. Can someone please suggest how to tackle this problem?

I had thought of somehow using phase_domain_index but I cannot find the way of using it. I am attaching my codes for reference.

Thanks in advance

P.S. While interpreting codes, I don't get any error, but when I try to compile the codes I get the errors as shown in the jpeg file
Attached Images
File Type: jpg error.jpg (30.8 KB, 22 views)
Attached Files
File Type: c gas_vel.c (747 Bytes, 68 views)
File Type: c liq_vel.c (746 Bytes, 40 views)
iamadz is offline   Reply With Quote

Old   May 28, 2015, 12:07
Default
  #2
Senior Member
 
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14
Kokemoor is on a distinguished road
Try putting both macros in one file, i.e.

Code:
#include "udf.h"

DEFINE_PROFILE(gas_z_velocity, thread, nv)
{
   ...
}

DEFINE_PROFILE(liquid_z_velocity, thread, nv)
{
   ...
}
Then they should both appear as options for your profiles, and you can set each phase to its appropriate profile.
sircorp likes this.
Kokemoor is offline   Reply With Quote

Old   May 29, 2015, 02:15
Default
  #3
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Compiling your UDFs would be a more robust and reliable method compared with interpreting your UDFs.

Are there any other lines of errors reported before or after those shown in your screenshot? It appears the problem might be with data types: are you running your simulations in single or double precision? Use the 'real' data type to declare your variables because then Fluent will either use float or long data types accordingly for single and double precision modes, respectively.

Lastly, add a trailing period to your zeros and integers for example "0." instead of "0" to avoid incorrect assignments (again, be careful of data types).
`e` is offline   Reply With Quote

Old   May 29, 2015, 02:20
Default
  #4
New Member
 
Aditya
Join Date: May 2015
Posts: 7
Rep Power: 11
iamadz is on a distinguished road
Thank you Kokemoor, it worked like a charm.

Dear 'e', there are no other errors apart from those mentioned in the screenshot. I have defined the variable type as float (as mentioned in the code). and running the simulations on double precision. I interpreted the UDF and am currently running the simulation, will there be any difference if I define the data type as Real and then compile and run it? Thanks

UPDATE :

When I try to compile the file, I get the error as shown in the png file. The 'Done' statement is when I Build the file, the error afterwards is when I try to 'Load' it.
Attached Images
File Type: png error2.PNG (29.1 KB, 26 views)

Last edited by iamadz; May 29, 2015 at 02:35. Reason: Added compilation error
iamadz is offline   Reply With Quote

Old   May 29, 2015, 02:36
Default
  #5
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
If it's running successfully now then that's fine; but you could ensure the data types are assigned correctly and check that the results are equal. Sometimes code will compile (or "interpret") fine but not execute quite how you'd expect.
`e` is offline   Reply With Quote

Old   May 29, 2015, 02:39
Default
  #6
New Member
 
Aditya
Join Date: May 2015
Posts: 7
Rep Power: 11
iamadz is on a distinguished road
Okay, I'll run another case after compiling it. But as mentioned in my just-updated-previous-reply, I'm encountering an error. Please have a look. Thanks
iamadz is offline   Reply With Quote

Old   May 29, 2015, 07:26
Default
  #7
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Perhaps Fluent is getting caught up with the UDF version, try my compiling process for Fluent UDFs with an existing library loaded.
`e` is offline   Reply With Quote

Old   May 29, 2015, 07:36
Default
  #8
New Member
 
Aditya
Join Date: May 2015
Posts: 7
Rep Power: 11
iamadz is on a distinguished road
There are no existing libraries to unload.

Regarding the compilation error for libudf, I looked up on the forums and found the attached pdf for solving this error. However, after installing both Visual C++ Studio and Microsoft SDK 7.0, I am now getting the following error while Build :
"'nmake' is not recognized as an internal or external command, operable program or batch file"

I found on the internet that this error relates to registering environment variables, but having followed whatever tips I could find, the error still does not go. Can you please advise what I should do now?

Many thanks for your help again
iamadz is offline   Reply With Quote

Old   May 29, 2015, 07:56
Default
  #9
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The Fluent FAQ Wiki has a section on compiling issues here. I use Microsoft Visual Studio Express (freely available). Have you managed to compile any UDFs in the past?
`e` is offline   Reply With Quote

Old   May 29, 2015, 08:11
Default
  #10
New Member
 
Aditya
Join Date: May 2015
Posts: 7
Rep Power: 11
iamadz is on a distinguished road
No, I haven't compiled any UDFs in the past.

I have already read that wiki. They mention that I have to select the option for 'Setting environment variables' during installation. Unfortunately, I found no such option during the installation. I have reinstalled both Visual C++ Express 2010 and SDK but to no avail
iamadz is offline   Reply With Quote

Old   May 29, 2015, 08:26
Default
  #11
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Strange, I don't remember having these issues. Try uninstalling all of the software you've tried compiling with and reinstall Microsoft Visual Studio Express. If that still doesn't work, perhaps stay with interpreting UDFs for the meantime.
`e` is offline   Reply With Quote

Old   May 29, 2015, 09:25
Default
  #12
New Member
 
Aditya
Join Date: May 2015
Posts: 7
Rep Power: 11
iamadz is on a distinguished road
Its working now, I had not changed the values for Path environment variable

Thanks a lot 'e' for your help
iamadz is offline   Reply With Quote

Old   May 29, 2015, 11:19
Default
  #13
Senior Member
 
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14
Kokemoor is on a distinguished road
Quote:
Originally Posted by `e` View Post
The Fluent FAQ Wiki has a section on compiling issues here. I use Microsoft Visual Studio Express (freely available). Have you managed to compile any UDFs in the past?
What version of Visual Studio Express do you use, `e`? I use 2010 and the Windows SDK, but I'm told 2012 has a 64 bit compiler in the free version, so you don't need the SDK.
Kokemoor is offline   Reply With Quote

Old   May 29, 2015, 20:39
Default
  #14
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
I use Microsoft Visual Studio Express 2012 for Windows Desktop. That's right, I don't use an SDK or any other programs for compiling within Fluent and compiling works well in all cases I've come across.
`e` is offline   Reply With Quote

Old   June 4, 2015, 02:16
Default
  #15
Member
 
Shane
Join Date: Oct 2009
Posts: 52
Rep Power: 17
sircorp is on a distinguished road
Quote:
Originally Posted by Kokemoor View Post
Try putting both macros in one file, i.e.

Code:
#include "udf.h"

DEFINE_PROFILE(gas_z_velocity, thread, nv)
{
   ...
}

DEFINE_PROFILE(liquid_z_velocity, thread, nv)
{
   ...
}
Then they should both appear as options for your profiles, and you can set each phase to its appropriate profile.
Once interpreted or compiled, macro does not Disappear. If you have already loaded it. then don't worry. It is not visible, that's all. Loading new macro does not mean old disappear.

Best way as advised by Kokemoor. Put as many macro as possible in single file, compile or interpret, then and "variable" will be visible all the time. Make life easy.

Shane
sircorp is offline   Reply With Quote

Old   August 8, 2024, 09:58
Default How to specify two different velocity of two different fluid at same inlet multiphase
  #16
New Member
 
Kanak Raj
Join Date: May 2023
Posts: 3
Rep Power: 3
kanakraj is on a distinguished road
I am facing an issue with giving two different velocities at a single inlet (The problem is that it is flowing through a pipe with different liquids, i.e. water liquid and water vapour in a vertical pipe). For that, the velocity of liquid and vapour is different. I am doing it by splitting the inlet into two parts and giving the different velocities at each face of the inlet. But the results are not coming correct. Can anyone please suggest another method to do it? Thanking you.
kanakraj is offline   Reply With Quote

Reply

Tags
multiphase flow, udf and programming, udf compilation


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 08:26
Operating density (UDF?) multiphase problem GM_XIII Fluent Multiphase 1 July 10, 2014 08:11
Drawing velocities of phases separately K. Baker FLUENT 0 June 10, 2007 09:40
multiphase udf Rashmi FLUENT 1 March 7, 2006 03:17
UDF for multiphase flow ROOZBEH FLUENT 3 April 7, 2004 18:54


All times are GMT -4. The time now is 11:38.