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

Separate phase data in DPM_SCALAR_UPDATE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 12, 2021, 11:40
Default Separate phase data in DPM_SCALAR_UPDATE
  #1
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
I have an eulerian multiphase model with 2 phases, and am using a DPM to track particles in the flow. I want to lookup variables about the cell a particle is in, but cannot return any involving the second phase, only the primary. I need both but can't access them and it feel like it should be obvious. I use the following code:

PHP Code:
DEFINE_DPM_SCALAR_UPDATE(activation_potential,cell,thread,initialize,p)
{
    
int n_cphases 2/* Both phases interact with DPM */
    
cphase_state_t= &(p->cphase[0]); /* Gets the cell the particle is in - I thought [0] specified primary phase but not sure */
   
if (initialize)
    {
      
/* this is the initialization call, set:
     * P_USER_REAL(p,0) contains the activation potential, initialize to 0.
     * Variables 1-3 Contain the Viscosity, Strain and Volume fraction of the Primary (Continuous) Phase*/
      
P_USER_REAL(p,0) = 0.;
      
P_USER_REAL(p,1) = c->mu;
      
P_USER_REAL(p,2) = c->strain_rate_mag;
      
P_USER_REAL(p,3) = c->cont_phase_vof;
     }
  else
    {
      
/* Activation potential is: Exposure time * Strain rate * Viscosity * Volume Fraction */
      
P_USER_REAL(p,0) += P_DT(p) * P_USER_REAL(p,1) * P_USER_REAL(p,2) * P_USER_REAL(p,3);
     
/* save current values for start of next step */
      
P_USER_REAL(p,1) = c->mu;
      
P_USER_REAL(p,2) = c->strain_rate_mag;
      
P_USER_REAL(p,3) = c->cont_phase_vof;
     }

Which I then write using DPM_OUTPUT and works fine for giving values of viscoisty,strain etc for the primary phase but nothing I try gives these values for the secondary phase! I've tried:

PHP Code:
cphase_state_t= &(p->cphase[1]); 
And about every other number there and it outputs 0 for everything. I've looked through the "cphase_state_struct" in "dpm_types.h" and can't find anything on how to ask for this for other phases.

Any tips?
bloodflow is offline   Reply With Quote

Old   January 12, 2021, 17:53
Default
  #2
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
Found out how to get the variables I wanted in the less dodgy way with the code below. Ensure you tell it to allocate 6 scalars when you hook the Scalar_DPM UDF otherwise you'll get a SIGESV bullshit error.

PHP Code:
DEFINE_DPM_SCALAR_UPDATE(scalar_calc,cell,thread,initialize,p)
{
    
cell_t c P_CELL(p); /* Define cell particle is in */
    
Thread *P_CELL_THREAD(p); /* Thread particle is in (General thread - not a phase thread!) */
    
Thread** pt
    
pt THREAD_SUB_THREADS(t); /* Pointer to the phase thread within general thread - [0] - Primary and [1] - Secondary*/
  
if (initialize)
    {
      
P_USER_REAL(p,0) = C_MU_EFF_MIXTURE(c,t,pt,0); /* Plasma Viscosity */
      
P_USER_REAL(p,1) = C_MU_EFF_MIXTURE(c,t,pt,1); /* RBC Viscosity*/
      
P_USER_REAL(p,2) = C_VOF(c,pt[0]); /* PLASMA VOF */
      
P_USER_REAL(p,3) = C_VOF(c,pt[1]); /* RBC VOF */
      
P_USER_REAL(p,4) = C_STRAIN_RATE_MAG(c,pt[0]); /* Plasma Strain */
      
P_USER_REAL(p,5) = C_STRAIN_RATE_MAG(c,pt[1]);  /* RBC Strain */
      
P_USER_REAL(p,6) = 0;  /* Initial Variable for Activation Potential */
    
}
  else
    {
      
P_USER_REAL(p,0) = C_MU_EFF_MIXTURE(c,t,pt,0);
      
P_USER_REAL(p,1) = C_MU_EFF_MIXTURE(c,t,pt,1);
      
P_USER_REAL(p,2) = C_VOF(c,pt[0]);
      
P_USER_REAL(p,3) = C_VOF(c,pt[1]);
      
P_USER_REAL(p,4) = C_STRAIN_RATE_MAG(c,pt[0]);
      
P_USER_REAL(p,5) = C_STRAIN_RATE_MAG(c,pt[1]);
      
/* Calculation of Activation Potential at each particle step */
      
P_USER_REAL(p,6) = P_DT(p) * (P_USER_REAL(p,0) * P_USER_REAL(p,2) * P_USER_REAL(p,4) + P_USER_REAL(p,1) * P_USER_REAL(p,3) * P_USER_REAL(p,5));
    }

bloodflow is offline   Reply With Quote

Reply

Tags
cell, dpm, multiphase, phase, 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
Sharing links for two phase solver packages developed by openfoam community swap_9068 OpenFOAM Programming & Development 1 April 2, 2017 06:43
Request for NREL Phase VI data for method validation mohammad Main CFD Forum 0 March 24, 2013 10:06
Request for NREL Phase VI data for method validation mohammad CFX 0 March 24, 2013 10:04
Request for NREL Phase VI data for method validation mohammad FLUENT 0 March 24, 2013 09:59
compressible two phase flow in CFX4.4 youngan CFX 0 July 2, 2003 00:32


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