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

Calling volume fraction in a viscosity udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2019, 11:47
Post Calling volume fraction in a viscosity udf
  #1
New Member
 
Cristian Schwatz
Join Date: Mar 2019
Posts: 8
Rep Power: 7
Cschwatz is on a distinguished road
Hello Fluent Wizards,

I'm trying to simulate a multiphase flow in which one of the phases has a non-Newtonian viscosity. Additionally, this viscosity is a function of that phase volume fraction. I had a read in the Fluent UDF manual, as well as some other posts in this forum to come up with something. In this UDF I'm using C_VOF to define volume fraction, but I'm not using the VOF model in my multiphase simulation (I'm using Euler-Euler). Can I still use this macro, despite not using the VOF model?

So far, this is what the UDF is looking like:

---

#include "udf.h"
#include "sg_mphase.h"

DEFINE_PROPERTY(cell_viscosity,c, t)
{
/*Input parameters for the Quemada rheological model*/
real mu_quem, rrbc, k_inf, k0, shear_crit, q, mu_p, exponent, stress,
stress_div, sum_s_crit, sum_s_bracket, sum_b_bracket, e;

Thread *t_rbc = THREAD_SUB_THREAD(t, 1); /* Defining the solid phase*/

rrbc = C_VOF(c, t_rbc);
mu_p = 1020.0;
e = 2.71828;
exponent = -6.0 * rrbc;
sum_s_crit = rrbc + 0.05;
k_inf = 1.0;
k0 = (5.0*pow(rrbc, 0.7)*pow(e, exponent)) + 1.9;
shear_crit = 1.65*pow(sum_s_crit, -0.3);
q = 0.5;
stress = C_STRAIN_RATE_MAG(c, t);
stress_div = stress / shear_crit;
sum_s_bracket = k_inf + ((k0 - k_inf) / (1.0 + pow(stress_div, q)));
sum_b_bracket = 1.0 - (0.5*rrbc*sum_s_bracket);

mu_quem = mu_p * pow(sum_b_bracket, -2.0);

return mu_quem;

}

-----

When I build this UDF in fluent, no errors appear in the console. However, when I try to initialize my simulation the following error appears:

================================================== ============================

Node 0: Process 10896: Received signal SIGSEGV.

================================================== ============================
MPI Application rank 0 exited before MPI_Finalize() with status 2
The fl process could not be started.

What could be causing it?

https://imgur.com/a/nvGNwPw

PS: I've attached a link to an image of the equation used to write the UDF, so it makes easier to follow how I tried to write it in #C.
Cschwatz is offline   Reply With Quote

Old   June 14, 2019, 01:46
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
try this
Code:
#include "udf.h"
#include "sg_mphase.h"

DEFINE_PROPERTY(cell_viscosity,c, t)
{
/*Input parameters for the Quemada rheological model*/
real mu_quem, rrbc, k_inf, k0, shear_crit, q, mu_p, exponent, stress,
stress_div, sum_s_crit, sum_s_bracket, sum_b_bracket, e;
Thread *t_rbc = THREAD_SUB_THREAD(t, 1); /* Defining the solid phase*/

rrbc = C_VOF(c, t_rbc);

return 1e7;

}
best regards
AlexanderZ is offline   Reply With Quote

Old   June 14, 2019, 13:30
Default
  #3
New Member
 
Cristian Schwatz
Join Date: Mar 2019
Posts: 8
Rep Power: 7
Cschwatz is on a distinguished road
Hello Alexander,

Thanks for the reply! Even though I compiled the code as you have written, it still gave me the same error outcome. By the way, why did you erase the viscosity calculation and asked the code to return a constant value? I think I'm missing something here.

Thanks again!
Cschwatz 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
How to call volume fraction in UDF anubhavd FLUENT 0 November 16, 2017 08:14
Free surface issues with interDyMFoam for hydroturbine oumnion OpenFOAM Running, Solving & CFD 0 October 6, 2017 15:05
multiphaseEulerFoam (OF2.3.0) : Courant number explodes when running in parallel Mehrez OpenFOAM Running, Solving & CFD 10 May 18, 2016 12:44
Particle Volume Fraction UDF AP3181 Fluent UDF and Scheme Programming 4 August 26, 2015 07:53
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 22:14


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