CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

define source udf for multiphase

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 30, 2020, 10:12
Post define source udf for multiphase
  #1
New Member
 
mohammad
Join Date: Dec 2019
Posts: 15
Rep Power: 6
movaffagh is on a distinguished road
i want to simulate motions by adding forces to momentum eq. my two phase model is eulerian chf model. but when i compiled UDF to ansys fluent 19.2 and after initialize, when i want to clculate i recived a sigsev error. what should i do to solve this erorr?
can any one said my udf is true???

my udf is as below:
#include "udf.h"
#define period 6
#define omega 2*M_PI/period
#define teta_max 10*M_PI/180

DEFINE_SOURCE(gz_lic_source,c,t,dS,eqn)
{
real x[ND_ND];
real s_vof_liq, dens_liq, velo_z_liq, velo_y_liq;
real source,time,a_tangential_z,a_centrifugal_z,a_corio lis_z,gravity,x_new,y_new,z_new,teta_x,teta_y,teta _z;
Thread **pt=THREAD_SUB_THREADS(t);
C_CENTROID(x,c,pt[0]);
velo_y_liq=C_V(c,pt[0]);
s_vof_liq=C_VOF(c,pt[0]);
dens_liq=C_R(c,pt[0]);
time=CURRENT_TIME;
teta_x=0;
teta_y=(M_PI/2)-teta_max*sin(omega*time);
teta_z=teta_max*sin(omega*time);
x_new=(cos(teta_y)*cos(teta_z)*x[0])+(cos(teta_y)*sin(teta_z)*x[1])-(sin(teta_y)*x[2]);
y_new=((sin(teta_x)*sin(teta_y)*cos(teta_z))-(sin(teta_z)*cos(teta_x))*x[0])+((sin(teta_x)*sin(teta_y)*sin(teta_z))+(cos(teta _z)*cos(teta_x))*x[1])+(sin(teta_x)*cos(teta_y)*x[2]);
z_new=((cos(teta_x)*sin(teta_y)*cos(teta_z))+(sin( teta_z)*sin(teta_x))*x[0])+((cos(teta_x)*sin(teta_y)*sin(teta_z))-(cos(teta_z)*sin(teta_x))*x[1])+(cos(teta_x)*cos(teta_y)*x[2]);
a_tangential_z=(-teta_max*omega*omega*sin(omega*time))*y_new;
a_centrifugal_z=(teta_max*teta_max*omega*omega*cos (omega*time)*cos(omega*time))*z_new;
a_coriolis_z=(2*teta_max*omega*cos(omega*time))*ve lo_y_liq;
gravity=-9.81*cos(teta_max*sin(omega*time));
source=(gravity+(a_tangential_z+a_centrifugal_z+a_ coriolis_z))*dens_liq*s_vof_liq;
dS[eqn] =2*teta_max*omega*cos(omega*time)*dens_liq*s_vof_l iq;
return source;
}

DEFINE_SOURCE(gz_vap_source,c,t,dS,eqn)
{
real x[ND_ND];
real s_vof_vap, dens_vap, velo_z_vap, velo_y_vap;
real source,time,a_tangential_z,a_centrifugal_z,a_corio lis_z,gravity,x_new,y_new,z_new,teta_x,teta_y,teta _z;
Thread **pt=THREAD_SUB_THREADS(t);
C_CENTROID(x,c,pt[1]);
velo_y_vap=C_V(c,pt[1]);
s_vof_vap=C_VOF(c,pt[1]);
dens_vap=C_R(c,pt[1]);
time=CURRENT_TIME;
teta_x=0;
teta_y=(M_PI/2)-teta_max*sin(omega*time);
teta_z=teta_max*sin(omega*time);
x_new=(cos(teta_y)*cos(teta_z)*x[0])+(cos(teta_y)*sin(teta_z)*x[1])-(sin(teta_y)*x[2]);
y_new=((sin(teta_x)*sin(teta_y)*cos(teta_z))-(sin(teta_z)*cos(teta_x))*x[0])+((sin(teta_x)*sin(teta_y)*sin(teta_z))+(cos(teta _z)*cos(teta_x))*x[1])+(sin(teta_x)*cos(teta_y)*x[2]);
z_new=((cos(teta_x)*sin(teta_y)*cos(teta_z))+(sin( teta_z)*sin(teta_x))*x[0])+((cos(teta_x)*sin(teta_y)*sin(teta_z))-(cos(teta_z)*sin(teta_x))*x[1])+(cos(teta_x)*cos(teta_y)*x[2]);
a_tangential_z=(-teta_max*omega*omega*sin(omega*time))*y_new;
a_centrifugal_z=(teta_max*teta_max*omega*omega*cos (omega*time)*cos(omega*time))*z_new;
a_coriolis_z=(2*teta_max*omega*cos(omega*time))*ve lo_y_vap;
gravity=-9.81*cos(teta_max*sin(omega*time));
source=(gravity+(a_tangential_z+a_centrifugal_z+a_ coriolis_z))*dens_vap*s_vof_vap;
dS[eqn] =2*teta_max*omega*cos(omega*time)*dens_vap*s_vof_v ap;
return source;
}
movaffagh is offline   Reply With Quote

Reply

Tags
fluent - udf, multhiphase, udf code


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
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 36 July 16, 2024 04:52
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 07:42
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 06:18


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