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

Wrong UDM contour plot

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2014, 06:32
Default Wrong UDM contour plot
  #1
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
Hi!
I'm working on coding a new cavitational model for transient cases and I don't understand one thing..In the udf I need to access variables of the previous time step, so I'm using UDMI to store density, vapor volume fraction and some other calculated variables in the udf itself.

The udf compiles successfully.
At the end of each time step I'm using a DEFINE_EXECUTE_AT_END macro to move the current value of densities from C_UDMI(c,t,2) to C_UDMI(c,t,4) and values of volume fractions from C_UDMI(c,t,3) to C_UDMI(c,t,5).
C_UDMI(c,t,4) and C_UDMI(c,t,5) are used inside udf to access values of previous time step.
The problem is that I don't undestand why the contour plots of C_UDMI(c,t,3) and secondary phase volume fraction are not the same (even if vofM is restricted to a minimum and maximum value the contour plots are totally different)...

Can somebody explain why? I can't find the error in udf..

Thanks!

Code:
#include "udf.h"
#define min_vofV 1.e-5
#define max_vofV 0.99999

DEFINE_CAVITATION_RATE(Rayleigh, c, t, p, rhoV, rhoL, mafV, p_v, cigma, f_gas, m_dot)
{
  real p_vapor = *p_v;
  real dp, vofV, vofM, timestep;
  [some code here]

  dp = p_vapor-ABS_P(p[c],op_pres);
  vofM = MIN(MAX(min_vofV, mafV[c]*C_R(c, t)/rhoV[c]), max_vofV);
  vofV = mafV[c]*C_R(c, t)/rhoV[c];
  timestep = CURRENT_TIMESTEP;

  if (dp > 0.0)
  {
    [some code here]
    C_UDMI(c,t,2) = rhoV[c];
    C_UDMI(c,t,3) = vofM;
  }
  else
  {
    [some code here]
    C_UDMI(c,t,2) = rhoV[c];
    C_UDMI(c,t,3) = vofM;

    if (vofV < min_vofV)
    {
      [some code here]
      C_UDMI(c,t,2) = rhoV[c];
      C_UDMI(c,t,3) = vofM;
    }
  }
  *m_dot = [some code here]
}

DEFINE_EXECUTE_AT_END(execute_at_end)
{
  Domain *d;
  Thread *t;
  cell_t c;
  d = Get_Domain(1);

  thread_loop_c(t,d)
  {
    begin_c_loop(c,t)
    {
      C_UDMI(c,t,0) = C_UDMI(c,t,1);
      C_UDMI(c,t,4) = C_UDMI(c,t,2);
      C_UDMI(c,t,5) = C_UDMI(c,t,3);
    }
    end_c_loop(c,t)
  }
}
I'm attaching a first image of the contour plot of vapor volume fraction and a second image of UDMI 3 (which contains vofM values).
I don't think the problem is that I'm saving UDMI values at the mixture thread level.
Attached Images
File Type: jpg volume-fraction.jpg (43.7 KB, 26 views)
File Type: jpg udmi3.jpg (43.3 KB, 25 views)

Last edited by ghost82; October 13, 2014 at 13:26.
ghost82 is offline   Reply With Quote

Old   October 14, 2014, 06:53
Default
  #2
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
It seems another bug in the post processing...
When I open the dat file in cfd post and plot the phase-2 volume fraction I obtain near the same (due to vofM limits) contour plot as udm-3.

Daniele
ghost82 is offline   Reply With Quote

Old   November 18, 2014, 08:52
Default
  #3
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
[Solution]
See here why udmi and vapor volume fraction values are different:
http://www.cfd-online.com/Forums/flu...ation-udf.html
__________________
Google is your friend and the same for the search button!
ghost82 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
[General] plot the iso-level contour in Paraview hz283 ParaView 1 May 15, 2013 20:45
Matlab PP: Generating X-vel Contour Error Plot Bennp2000 FLUENT 5 March 4, 2011 16:58
Contour plot with negative velocity J CFX 11 November 3, 2008 17:46
Contour plot in Star-CD Yasir Siemens 0 August 22, 2004 09:01
contour plot of stream function liu FLUENT 6 August 19, 2003 23:30


All times are GMT -4. The time now is 17:22.