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

udf gradients problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 14, 2015, 17:04
Default udf gradients problem
  #1
New Member
 
Andrej
Join Date: Mar 2015
Posts: 18
Rep Power: 11
perun333 is on a distinguished road
Hello guys,

I have problem when Im starting my computing with udf (fatal error). But compiling without problems. I have 2D axisymmetric model, where I want to keeping time and space temperature gradients only in some part of the 2D model. Here is my code:

#include "udf.h"

DEFINE_EXECUTE_AT_END(gradienty)
{
Domain *domain;
cell_t c;
Thread *ct;
face_t f;

FILE *fw1;
FILE *fw2;
int ID = 1;

real gradient_prostorovy;
real gradient_casovy;


gradient_prostorovy = 0.;
gradient_casovy = 0.;
domain = Get_Domain(1);


ct = Lookup_Thread(domain,ID);

begin_f_loop(f,ct){

{
gradient_prostorovy = MAX(gradient_prostorovy,C_UDMI(c,ct,0) = sqrt(C_T_G(c,ct)[1]*C_T_G(c,ct)[1]));


gradient_casovy = MAX(gradient_casovy,C_UDMI(c,ct,1) = 3600 * (C_T(c,ct) - C_T_M1(c,ct)) / CURRENT_TIMESTEP);

}
end_f_loop(f,ct)
}

fw1 = fopen("gradient_prostorovy.txt","w");
fprintf(fw1,"%lf ", CURRENT_TIME);
fprintf(fw1,"%lf\n", gradient_prostorovy);
fclose(fw1);

fw2 = fopen("gradient_casovy.txt","w");
fprintf(fw2,"%lf ", CURRENT_TIME);
fprintf(fw2,"%lf\n", gradient_casovy);
fclose(fw2);

}


PS: For next step I would like to make udf for changing heat flux on the wall. If will be gradient_casovy (time_gradient) more then 19 I would like to use heat flux - 10 else +10.

So I would like to do it by this way

DEFINE_PROFILE(muj_profil,t,i)
{
face_t f;

begin_f_loop(f,t)
{

if( gradient_casovy > 19. ) {
F_PROFILE(f,t,i)=.....-10.;
}

else {
F_PROFILE(f,t,i)=....+10.;
}

}
end_f_loop(f,t)
}

I would be happy for help
perun333 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
fatal error during initialization after udf compilation rik Fluent UDF and Scheme Programming 36 February 21, 2020 16:42
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 07:12
Simulation with UDF for species mass fraction and velocity profile virgy Fluent UDF and Scheme Programming 8 February 7, 2012 05:30
I need UDF help. S.Whitney FLUENT 0 October 15, 2007 12:29
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 22:12.