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

C_UDSI(c,t,...) causing crashes

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By vinerm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 4, 2020, 10:08
Default C_UDSI(c,t,...) causing crashes
  #1
Member
 
Join Date: Feb 2019
Posts: 69
Rep Power: 7
cfdnewb123 is on a distinguished road
I have no idea why but when using this code, FLuent keep crashing while the command just show "999999: mpt_accept: error: accept failed: No error".
I have narrow down the issue to C_UDSI(c,t,...) as it works when I remove C_UDSI(c,t,...) and C_UDMI(c,t,...).

I also try initializing before using this however it still doesnt work.

Here is my code,

#include "udf.h"
#include "math.h"

const real C_1=-0.2;
const real C_2=0.4;
const real C_5=0.0;
const real CE_1=1.44;
const real CE_2=1.92;
const real SIG_K=1.0;
const real SIG_E=1.3;
const real C_MU_ke=0.09;
const real kappa=0.42;
const real E_log=9.793;

enum { UU, VV, UV};

DEFINE_ADJUST(rsm_adjust,domain)
{
Thread *t;
cell_t c;
real T;
real mu_t, c_mu;
real S11, S12, S21, S22;
real W11, W12, W21, W22;
real S, W, Sij, Wij;
real C_3, C_4, C_6, C_7;
real P11, P22, P33, Pkk;
real tau_w, u_tauw, u_star, y_star, Gk, u_mag;

thread_loop_c(t,domain)
if (FLUID_THREAD_P(t)) {
begin_c_loop(c,t)
{
S11 = 0.5*( C_DUDX(c,t)+C_DUDX(c,t) );
S12 = 0.5*( C_DUDY(c,t)+C_DVDX(c,t) );
S21 = 0.5*( C_DVDX(c,t)+C_DUDY(c,t) );
S22 = 0.5*( C_DVDY(c,t)+C_DVDY(c,t) );

W11 = 0.5*( C_DUDX(c,t)-C_DUDX(c,t) );
W12 = 0.5*( C_DUDY(c,t)-C_DVDX(c,t) );
W21 = 0.5*( C_DVDX(c,t)-C_DUDY(c,t) );
W22 = 0.5*( C_DVDY(c,t)-C_DVDY(c,t) );

T=C_K(c,t)/C_D(c,t);

S=T*sqrt( 2*(S11*S11+S12*S12+S21*S21+S22*S22) );
W=T*sqrt( 2*(W11*W11+W12*W12+W21*W21+W22*W22) );

Sij=S11*S11+S12*S12+S21*S21+S22*S22;
Wij=W11*W11+W12*W12+W21*W21+W22*W22;

c_mu=0.055;
C_3=2.0-exp(-SQR(S-W));
C_4=-32.0*SQR(c_mu);
C_6=-16.0*SQR(c_mu);
C_7=16.0*SQR(c_mu);

mu_t=c_mu*T*C_K(c,t);

C_UDSI(c,t,UU)= C_1*mu_t*T*(S11*S11+S12*S12-1./3.*Sij) + 2.*C_2*mu_t*T*(W12*S12) + C_3*mu_t*T*(W12*W12-1./3.*Wij) - 2.*C_4*mu_t*T*T *(W12*(S11*S12+S12*S22)) + C_6*mu_t*T*T*(S11*Sij) + C_7*mu_t*T*T*(S11*Wij);

C_UDSI(c,t,VV)= C_1*mu_t*T* (S12*S12+S22*S22-1./3.*Sij) + 2.*C_2*mu_t*T*(-W12*S12) + C_3*mu_t*T*(W12*W12-1./3.*Wij) + 2.*C_4*mu_t*T*T * (W12*(S11*S12+S12*S22)) + C_6*mu_t*T*T* (S22*Sij) + C_7*mu_t*T*T* (S22*Wij);

C_UDSI(c,t,UV)= C_1*mu_t*T* (S11*S12+S12*S22) + C_2*mu_t*T*(W12*(S22-S11)) + C_3*mu_t*T*(0) + C_4*mu_t*T*T*(W12*(S11*S11-S22*S22)) + C_6*mu_t*T*T* (S12*Sij) + C_7*mu_t*T*T* (S12*Wij);

C_UDMI(c,t,0)= -2.*mu_t*S11 + 2./3.*C_K(c,t) + C_UDSI(c,t,UU);
C_UDMI(c,t,1)= -2.*mu_t*S22 + 2./3.*C_K(c,t) + C_UDSI(c,t,VV);
C_UDMI(c,t,2)= -2.*mu_t*S12 + C_UDSI(c,t,UV);
}
end_c_loop(c,t)
}
}
cfdnewb123 is offline   Reply With Quote

Old   June 4, 2020, 10:54
Default Uds
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
The purpose of the UDS is not what you are using it for. You only need UDMs. UDS are required if you want conservation equations to be solved. And for UDM and UDS, there are two pre-requisites.

1. Assign the required number of UDM (and UDS, if required)
2. Initialize or patch all UDMs (and UDS) throughout the domain
cfdnewb123 likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 4, 2020, 11:20
Default
  #3
Member
 
Join Date: Feb 2019
Posts: 69
Rep Power: 7
cfdnewb123 is on a distinguished road
Thanks for the response but may I ask how do I assign the number of UDM?

Additionally, is just using UDM sufficient for my case as isn't it just storing memory?
Honestly, I have no idea what I am doing on udf but what I am trying to do is modify the Reynolds stress to be used by the solver. I based the above code from a sample code online I found online though I am not sure whether is it correct or not.
cfdnewb123 is offline   Reply With Quote

Old   June 4, 2020, 11:30
Default Reynolds Stress Modification
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Fluent solves for primitive fields, such as, velocities and pressure, not for stresses until you use RSM. Only when stress field is being solved, you can modify it, otherwise their modification will not affect the flow. As far as the UDF is concerned, it is doing nothing but saving results of some expressions in UDMs.

To enable UDMs, use User-Defined > Memory.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 4, 2020, 11:35
Default
  #5
Member
 
Join Date: Feb 2019
Posts: 69
Rep Power: 7
cfdnewb123 is on a distinguished road
Thanks for the clarification. Does this mean that Fluent is unable to solve for nonlinear k-epsilon model where the Reynolds stress is modified?

Additionally, may I ask what cause C_UDSI() to be unusable here? Did I implement it wrongly?
cfdnewb123 is offline   Reply With Quote

Old   June 4, 2020, 11:46
Default Turbulence Modification
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
User can modify the turbulence model, however, the UDF is not doing that. All that the UDF is doing is calculating some functions and storing those in UDMs (or in UDS). But these are not being used to modify the flow in any manner. Hence, these are just passive expressions that can be used for post-processing but not for affecting the flow. If you want to affect the flow, then you have to modify parameters in the flow equations, such as, eddy viscosity.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 4, 2020, 11:55
Default
  #7
Member
 
Join Date: Feb 2019
Posts: 69
Rep Power: 7
cfdnewb123 is on a distinguished road
Thanks I managed to get UDM to work well based on your suggestion. However, UDS still doesn't seems to work and you are right that I do not really need it here. But it may be good to know as I may need it next time. I actually try using the sample code giving by Fluent too but it encountered an error related to "signal".
https://www.afs.enea.it/project/nept...df/node103.htm
cfdnewb123 is offline   Reply With Quote

Old   June 4, 2020, 11:58
Default
  #8
Member
 
Join Date: Feb 2019
Posts: 69
Rep Power: 7
cfdnewb123 is on a distinguished road
Oh wait never mind, I resolved this thanks so much!
cfdnewb123 is offline   Reply With Quote

Old   June 4, 2020, 12:00
Default Uds
  #9
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Just like UDM, you need to enable scalar under User-Defined > Scalar
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Reply

Tags
error, fluent, udf


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
potentialFoam & simpleFoam crashes after snappyhexmesh [parallel execution] pilot320 OpenFOAM Running, Solving & CFD 10 November 12, 2015 17:56
reactingFoam crashes mysteriously jose_rodrig OpenFOAM Running, Solving & CFD 9 August 4, 2015 11:18
Simulation crashes early, crashes hard... MtnRunBeachBum OpenFOAM Running, Solving & CFD 6 April 22, 2015 10:27
[blockMesh] mesh causing problems with convergence Tetragramm OpenFOAM Meshing & Mesh Conversion 0 September 22, 2012 17:00
flo-efd v11.0.0 crashes YoavF FloEFD, FloWorks & FloTHERM 3 June 21, 2012 13:37


All times are GMT -4. The time now is 17:23.