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

Making proper UDF for 3D task

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By AlexanderZ
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 23, 2019, 10:45
Default Making proper UDF for 3D task
  #1
New Member
 
The_Immortal
Join Date: Nov 2016
Posts: 13
Rep Power: 10
The_Immortal is on a distinguished road
Hi there!

Could you please help me to make the correct UDF-file for 3D task. There is a formula (in attachment). I need to get the profile of velocity distribution Z in the direction Y.


While trying to make calculation with mine UDF I get the message "Error: Divergence detected in AMG solver: x-momentum".


Can you tell me please how to fix it?


Thank you!


P.S. UDF:
Code:
#include "udf.h"
#include "math.h"
DEFINE_PROFILE(inlet_y_velocity, thread, index)

#define v_mean 4
#define z_max 750.53
#define z_min -249.47
#define B 1./7.

{
    real x[ND_ND]; /* this will hold the position vector */
    real y;
    real z;
    real u;
    face_t f;

    begin_f_loop(f, thread) /*loops over all faces in the thread passed in the DEFINE macro argument*/
    {
        F_CENTROID(x,f,thread);
        z = x[1];
        y = x[1];
        u = v_mean*(B+1);;
        F_PROFILE(f, thread, index) = u*pow((z-249.47)/10,B);
    }
    end_f_loop(f, thread)
}
Attached Images
File Type: jpg 1.jpg (43.8 KB, 6 views)
File Type: jpg 2.jpg (153.5 KB, 5 views)
File Type: png 3.PNG (3.2 KB, 4 views)
The_Immortal is offline   Reply With Quote

Old   April 13, 2019, 14:28
Default
  #2
New Member
 
The_Immortal
Join Date: Nov 2016
Posts: 13
Rep Power: 10
The_Immortal is on a distinguished road
Hello!


Any ideas guys please? Still haven't solver the problem...


Thank you!
The_Immortal is offline   Reply With Quote

Old   April 15, 2019, 02:36
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
what is it?
Code:
DEFINE_PROFILE(inlet_y_velocity, thread, index)

#define v_mean 4
#define z_max 750.53
#define z_min -249.47
#define B 1./7.

{
where did you see this kind of code?

MAY BE THIS???

Code:
#define v_mean 4
#define z_max 750.53
#define z_min -249.47
#define B 1./7.
DEFINE_PROFILE(inlet_y_velocity, thread, index)
{
best regards
The_Immortal likes this.
AlexanderZ is offline   Reply With Quote

Old   April 15, 2019, 02:55
Default
  #4
New Member
 
The_Immortal
Join Date: Nov 2016
Posts: 13
Rep Power: 10
The_Immortal is on a distinguished road
AlexanderZ, oh, I wish it would so simple to solve this but that is not the problem

It was just incorrect copy-past actually. So the full code is

Code:
#include "udf.h"
#include "math.h"
#define v_mean 4
#define z_max 750.53
#define z_min -249.47
#define B 1./7.

DEFINE_PROFILE(inlet_y_velocity, thread, index)
{
    real x[ND_ND]; /* this will hold the position vector */
    real y;
    real z;
    real u;
    face_t f;

    begin_f_loop(f, thread) /*loops over all faces in the thread passed in the DEFINE macro argument*/
    {
        F_CENTROID(x,f,thread);
        z = x[1];
        y = x[1];
        u = v_mean*(B+1);;
        F_PROFILE(f, thread, index) = u*pow((z-249.47)/10,B);
    }
    end_f_loop(f, thread)
}

Last edited by The_Immortal; April 20, 2019 at 12:25.
The_Immortal is offline   Reply With Quote

Old   April 15, 2019, 03:18
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
z = x[2];
other parts of code seems correct, problem may comes from other conditions, mesh, and so on.
Or from your equation

best regards
The_Immortal likes this.
AlexanderZ is offline   Reply With Quote

Reply


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
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
[swak4Foam] Installation Problem with OF 6 version Aurel OpenFOAM Community Contributions 14 November 18, 2020 17:18
[blockMesh] blockMesh with double grading. spwater OpenFOAM Meshing & Mesh Conversion 92 January 12, 2019 10:00
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 12:32
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 15:50.