Fluids

Fluids

Multiphase non-Newtonian flow UDF Parse Error

    • michelletramper
      Subscriber
      Hello everyone!nI am trying to interpret two UDFs to describe the non-Newtonian behaviour of blood in a multiphase simulation. I have written two DEFINE_PROPERTY functions, included in the text below. However, if I want to interpret them, FLUENT keeps giving me the 'parse error' after starting at the 'Domain *plasma_domain' line.nI have tried numerous things, and also tried to delete the Get_Domain and Lookup_Thread sections in my code. But if I did that, the initialization gave me a mtp_9999 error and the whole simulation immediately quit.nI have no idea what to do next, so maybe someone here has an idea? I know that my mesh is correct, since I used it for a range of other simulations as well. I am using ANSYS version 19.1 and have to run simulations via an external hpc cluster (using max 16 nodes). Maybe that has an influence as well, but I cannot even get the simulation working on my own computer (because I keep getting the parse error / mtp_9999 error).nThanks in advance!nn#include udf.hnDEFINE_PROPERTY(granular_viscosity_rbc, cell, thread)n{nint phase_domain_index, ID = 2;nDomain *mixture_domain;nmixture_domain = Get_Domain(1);nDomain *plasma_domain;nplasma_domain = Get_Domain(2);nDomain *rbc_domain;nrbc_domain = Get_Domain(3);nnThread* mixture_thread;nmixture_thread = Lookup_Thread(mixture_domain,ID);real muplasma = 0.006;nreal murbc = 0.01;nreal mumix = 0.0037;nreal eps_rbc = 0.45;nreal lambda = 0.110;nreal m = 9.106;nreal n = 0.749;nreal sr = 500;nnThread* mixture_thread;nThread* subthread;nnsub_thread_loop(subthread, mixture_thread, phase_domain_index)n{nif(subthread == Lookup_Thread(plasma_domain,ID))n{nmuplasma=C_MU_L(cell,subthread);n}nelse if(subthread == Lookup_Thread(rbc_domain,ID))n{nsr = C_STRAIN_RATE_MAG(cell,subthread);neps_rbc = C_VOF(cell,subthread);n}n} = 0.8092*pow(eps_rbc ,3.) - 0.8246*pow(eps_rbc ,2.) - 0.3503*eps_rbc + 1.;nm = 122.28*pow(eps_rbc ,3.) - 51.213*pow(eps_rbc ,2.) + 16.305*eps_rbc + 1.;nmumix = m* pow( (1.+ pow((lambda*sr) ,2.) ),((n-1.)/2.) );nmurbc = (mumix*muplasma -(1.-eps_rbc)*muplasma)/eps_rbc;nreturn murbc;n}nn#include udf.hnDEFINE_PROPERTY(density_rbc,cell,thread)n{nint phase_domain_index;nint ID=2;nnDomain *mixture_domain;nDomain *plasma_domain;nDomain *rbc_domain;nnThread *mixture_thread;nThread *subthread;nnreal rhoplasma = 10;nreal rhorbc = 10;nreal vof = 0.45;nreal rhomix = 1080;nnsub_thread_loop(subthread, mixture_thread, phase_domain_index)n{nif(subthread == plasma_domain)n{nrhoplasma = C_R(cell,subthread);n}nelse if(subthread == rbc_domain)n{nvof = C_VOF(cell,subthread);n}nrhorbc = (rhomix - (rhoplasma*(1-vof)))/(vof+1e-4);n}nreturn rhorbc;n}n
    • DrAmine
      Ansys Employee
      I recommend compiling the UDFs: with 20R2 on Windows you have an in.built compiler.nI guess you can just the properties right away you do not require to get any domains here as it is hooked for the right phase domain,nnPlease share the equations you want to get in and not only the code..n
    • michelletramper
      Subscriber
      Dear DrAmine,nnThanks for your quick reply! I indeed am trying to compile the functions (running from the cluster). If I do this, I do not get the syntax error, however, if the simulation starts I get the 'floating point exception' error:nError at Node 0: floating point exceptionnError at Node 3: floating point exceptionnError at Node 1: floating point exceptionnError at Node 5: floating point exceptionnError at Node 6: floating point exceptionnError at Node 4: floating point exceptionnError at Node 7: floating point exceptionnError at Node 2: floating point exceptionnnSo what I would like to achieve is the following: nDescribe the blood-flow in a bended tube using a two-phase model: red blood cells (rbc's) suspended in plasma. nTo get a proper description of the non-Newtonian behaviour, use a UDF that implies an adjusted version of the Carreau-Yasuda model. This model returns the granular viscosity and density of the red blood cells according to the following relationships:nThus, the red blood cell volume fraction (epsilon_rbc) should be extracted from the cell in order to calculate n and m. These parameters can then in their turn compute the viscosity of the mixture using the shear rate. This shear rate should, on its turn, also be extracted from the cell.I hope that you understand what I am trying to achieve haha! thanks for your effort.nnKind regards,nMichellen
    • DrAmine
      Ansys Employee
      First of all do you require to model blood as multiphase flow? If yes: okay...nnRegarding the viscosity model: which multiphase model you want to use? is the first mu_mix rather a mu_rbc?.For the density you do not require an UDF. Only for the viscosity to prescribe that non-newtonian behavior of (I think) rbc.
    • michelletramper
      Subscriber
      Dear Dr. Amine,nnYes it is my thesis subject to investigate the influence of the multiphase model I am using the Eulerian-Eulerian approach!nThe first mu_mix is the viscosity of the mixture according to the carreau-yasuda model. However, since you cannot enter a mixture viscosity in the two-phase model, I compute the viscosity of the rbc's in order to implement it in fluent.nDo you mean you do not require an UDF for rbc density since it is not taken into account in the model? I wanted to include it for completeness and since the previous researcher also did so.nnThanks!nnMichellen
    • DrAmine
      Ansys Employee
      It does not make a sense to enter a mixture viscosity for Eulerian Multiphase. Here better to enter the same viscosity for both phases which will do the trick. Or you enter for mu_rbc the expression required so that the mixture viscosity is the same as you wrote for your formula something like nmur_rbc=mu_plasma(Function-(1-alpha_rbc))/(alpha_rbc)nnImagine you want to enter the expression for RBC via DEFINE_PROPERTY you do not need to access any other threads: everything is provided to you right away. Be aware here that variables like strain rate are phase specific. The return value will be used laminar viscosity.nnIn Eulerian the momentum equations are solved for each phase: so mixture properties are not used for solving!
    • michelletramper
      Subscriber
      Thank you your input has been very useful already so far! I am busy editing and updating and will let you know the progress! Thanks a lot already n
    • Rob
      Ansys Employee
      Some bedtime reading too - nGijsen F.J.H., van de Vosse F.N., Janssen J.D.; 1999; The Influence of the non-Newtonian properties of blood on the flow in large arteries: steady flow in a carotid bifurcation model; Jou of Biomechanics, Vol 32, pp601n
Viewing 7 reply threads
  • You must be logged in to reply to this topic.