Fluids

Fluids

Parse error in “config.h” line 118

    • lorenzolaporta96
      Subscriber
      Hi! I wrote this UDF, which I think is correct, but interpreting it I got this error:nError:C:\\PROGRA~1\\ANSYSI~1\\v202\\fluent\\fluent20.2.0/src/main/config.h:line 118:parse error.nHow can I solve it? nHere is the UDF:n#include dpm.hnDEFINE_DPM_LAW(bubbled,tp,Ci)n{ncell_t c = TP_CELL(tp);nThread *t = TP_CELL_THREAD(tp);nreal temp, P, Dco2, Sc, d, ki, kh, Ci, Cinf, massrate;ntemp = 288;nd = TP_DIAM(tp);nDco2 = (1.38*pow(10.0,-23.0)*temp)/(6.0*M_PI*0.001003*pow(10.0,-10.0));nSc=0.001003/(TP_RHO(tp)*Dco2);nif (d<0.0035)n{ki=(2+0.6*pow(Re,1./2.)*pow(Sc,1./3.))*Dco2/d;nelse if(d<=0.0045 && d>0.0035)nki=0.2838*d-0.0009121;nelsenki=2/pow(M_PI, 1./2.)*pow(Re*Sc,1./2.)*Dco2/dn}nkh=44*1000/101325*pow(2.7183,2119.05/temp-17.4141);nP = C_P(c, t);nCi=P*kh;nCinf=0;nmassrate=M_PI*d*d*ki*(Ci-Cinf);nTP_MASS(tp)=TP_MASS(tp)-massrate*TP_DT(tp);nTP_DIAM(tp)=pow((6.0*TP_MASS(tp))/(M_PI*44*P/temp/8314),1./3.);nTP_RHO(tp)= (44*P)/(8314*temp);n}n
    • DrAmine
      Ansys Employee
      Please compile it using built-in compiler.n
    • lorenzolaporta96
      Subscriber
      Hi, if I compile it, Fluent can't read the nmake file.n
    • DrAmine
      Ansys Employee
      A lot of issues with your UDF: from just looking into it...nnRe not defined, Ci is formal parameter used elsewhere by Fluent better to use something like MyCi or anything else, Syntax errors using if else condition, please add indenting to see the code better.. A lot of things.... n
    • DrAmine
      Ansys Employee
      Header missing.. n
    • lorenzolaporta96
      Subscriber
      hi! I fixed the syntax errors.nI can compile and load the UDF but when I run calculations the following message appears:nnDPM Iteration ....nn================================================== ============================nnNode 1: Process 3188: Received signal SIGSEGV.nn================================================== ============================nThe fl process could not be started.nnHere is my UDF:nn#include dpm.hn#include dpm_types.hn#include dpm_laws.hn#include udf.h nnDEFINE_DPM_SOURCE(dissolution, c, t, S, strenght, tp) n{nnreal temp, P, Dco2, Sc, d, ki, kh, Cs, Cinf, massrate,mp_dot, Re, rel_vel;nint co2_index = 0;ntemp = 288;nd = TP_DIAM(tp);nP = C_P(c, t);nrel_vel = sqrt(pow((TP_VEL(tp)[0] - C_U(c,t)),2.0) + pow((TP_VEL(tp)[1] - C_V(c,t)), 2.0) + pow((TP_VEL(tp)[2] - C_W(c,t)), 2.0));nRe = TP_RHO(tp) * rel_vel * d/0.001003;nDco2 = (1.38*pow(10.0,-23.0)*temp)/(6.0*M_PI*0.001003*pow(10.0,-10.0));nSc=0.001003/(TP_RHO(tp)*Dco2);nif (d<0.0035)n{n ki=(2+0.6*pow(Re,1./2.)*pow(Sc,1./3.))*Dco2/d;n }nif(d<=0.0045 && d>0.0035)n{n  ki=0.2838*d-0.0009121;n }nif (d>=0.0035){n ki=2/pow(M_PI, 1./2.)*pow(Re*Sc,1./2.)*Dco2/d;n}nkh=44*1000/101325*pow(2.7183,2119.05/temp-17.4141);nCs=P*kh;nCinf=C_YI(c, t, co2_index);nmassrate=M_PI*d*d*ki*(Cs-Cinf);nmp_dot=massrate*TP_DT(tp)*strenght;nS->species[co2_index] += mp_dot;n}n
    • DrAmine
      Ansys Employee
      Do not expect that an Ansys employee will debug the UDF.nRelative velocity is wrong, I do not understand your massrate.n
    • lorenzolaporta96
      Subscriber
      How can I write the relative velocity between bubbles and the continuous phase in a 3 D domain?nThe mass rate is the bubble area times the mass exchange coefficient ki times concentration difference.nThankyou nn
    • DrAmine
      Ansys Employee
      relative velocity magnitude is magnitude of (vel of particle - vel of gas) and it seems that you corrected it now.nmdot is using the particle time integration step: is this what you want?n
    • lorenzolaporta96
      Subscriber
      Ok I think that I found the problem. If I don't use Cinf=C_YI(c, t, co2_index); and I use Cinf=0; Fluent doesn't crash, and gives some reasonable results.nAnyway the reason why I'm using TP_DT(tp) is because the mass rate is in kg/s and at each time step I'm computing the mass added to the continuous phase. I assume that the UDF is solved at each time step, so the mass rate computed in the time step is multiplied by the time step extension, is it correct?nDespite I get some results I see a particle diameter and mass reduction lower than expected and I don't understand why.nHere is the code:nn#include dpm.hn#include dpm_types.hn#include dpm_laws.hn#include udf.h nnDEFINE_DPM_SOURCE(dissolution, c, t, S, strenght, tp) n{nnreal temp, P, Dco2, Sc, d, ki, kh, Csol, Cinf, massrate,mp_dot, Re, rel_vel;ntemp = 288;nd = TP_DIAM(tp);nP = C_P(c, t);nrel_vel = sqrt(pow((TP_VEL(tp)[0] - C_U(c,t)),2.0) + pow((TP_VEL(tp)[1] - C_V(c,t)), 2.0) + pow((TP_VEL(tp)[2] - C_W(c,t)), 2.0));nRe = (TP_RHO(tp) * rel_vel * d)/0.001003;nDco2 = (1.38e-23*temp)/(1.8868e-12);nSc=0.001003/(TP_RHO(tp)*Dco2);nif (d<0.0035)n{n ki=(2+0.6*pow(Re,1./2.)*pow(Sc,1./3.))*Dco2/d;n }nif(d<=0.0045 && d>0.0035)n{n  ki=0.2838*d-0.0009121;n }nif (d>=0.0035){n ki=2/pow(3.14, 1./2.)*pow(Re*Sc,1./2.)*Dco2/d;n}nkh=(0.4342)*exp(2119.05/temp-17.4141);nCsol=P*kh;nCinf=0;nmassrate=3.14*d*d*ki*(Csol-Cinf);nTP_MASS(tp) = TP_MASS(tp) - massrate * TP_DT(tp);nmp_dot=massrate*TP_DT(tp)*strenght;nS->species[0] += mp_dot;n}n
    • DrAmine
      Ansys Employee
      No that is incorrect: the time scale you are using is the last time size used to integrate along the particle path.nnIf Cinf=C_YI(c, t, co2_index) is causing an issue then please double check index and whether species are defined at all.nFor mass transfer with DPM actually a Mass Transfer Law, a switch and a source term udf are required. Look into the manual for really detailed and good explained example!n
    • lorenzolaporta96
      Subscriber
      well.. I didn't understand, what time should I use? let me assume that a time step is equal to 0.01 s, which is also the DPM time step, are you saying that I should use 0.01 instead of DP_DT(tp) ? nThankyou for your advice, I saw on the guide the example about evaporation but it's hard to reuse it cause my case is gas dissolution in water, but I will look at it again:)
    • lorenzolaporta96
      Subscriber
      In my case I only have gas dissolution of bubble in the water where they are raising, no condensation!! I don't think I need the switch!?nI can't use the pure Euler-Euler model, I have very high gas rates ( like a methane underwater blowout but with co2) and fluent would not converge....n
    • DrAmine
      Ansys Employee
      DPM law is required. Time step might br accessed elsehow. The p_dt is the time integration scale and not the time step size. You can mimic Henry s law or evaporation law. The example in the documentation even if not dissolution is still worth starting from it. By the way your ki is already reflecting the xx/s. So do not multiply with any time step. Good luck.n
    • lorenzolaporta96
      Subscriber
      Ok, I'm starting to understand... thankyoun
Viewing 14 reply threads
  • You must be logged in to reply to this topic.