|
[Sponsors] |
March 23, 2019, 10:45 |
Making proper UDF for 3D task
|
#1 |
New Member
The_Immortal
Join Date: Nov 2016
Posts: 13
Rep Power: 10 |
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) } |
|
April 13, 2019, 14:28 |
|
#2 |
New Member
The_Immortal
Join Date: Nov 2016
Posts: 13
Rep Power: 10 |
Hello!
Any ideas guys please? Still haven't solver the problem... Thank you! |
|
April 15, 2019, 02:36 |
|
#3 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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. { 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) { |
|
April 15, 2019, 02:55 |
|
#4 |
New Member
The_Immortal
Join Date: Nov 2016
Posts: 13
Rep Power: 10 |
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. |
|
April 15, 2019, 03:18 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
z = x[2]; Or from your equation best regards |
|
|
|
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 |