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

Adjusting UDM to UDS

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 20, 2013, 01:50
Default Adjusting UDM to UDS
  #1
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17
mvee is on a distinguished road
Hi

I have define adjusted UDM to UDS and for this UDS I am not solving any transport equation, hence default BC i.e flux zero and solution UDS equation in off mode.

Now in the contours of UDM and UDS, there is mismatch at on the boundaries. Because I have used, C_UDMI() = C_UDSI(). This assigns the cell centroid values only. Now in order to assign face centroid values I followed below mentioned ways but it did not work.

(1) define_profile condition on boundaries.
(2) similar to cell centroid adjustment, face centroid adjustment

If any one have tried on this issue. According to you which option should work.

Thanks in advance for your reply
Mvee
mvee is offline   Reply With Quote

Old   May 21, 2013, 01:29
Default
  #2
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17
mvee is on a distinguished road
any response?
mvee is offline   Reply With Quote

Old   May 21, 2013, 23:48
Default
  #3
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
Have you tried to loop all the face threads and cell threads?
The UDM is not associated with certain type of boundaries.
blackmask is offline   Reply With Quote

Old   May 22, 2013, 05:27
Default
  #4
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17
mvee is on a distinguished road
I opted the second the way i.e adjusted the face centroid values also. This is only possible by Lookup_Thread on defined face thread.
mvee is offline   Reply With Quote

Old   May 22, 2013, 06:18
Default
  #5
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
I speculate that the difference appeared in the contour is due to different interpolation schemes for UDM and UDS. Is the mismatch most apparent at the edge of your b.c.? For two-faced b.c. like interface, the UDM is not defined but I think UDS would be defined there.
blackmask is offline   Reply With Quote

Old   May 22, 2013, 08:51
Default
  #6
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17
mvee is on a distinguished road
I got the solution.
As I told you that for C_UDMI to C_UDSI , the cell centroid values are transfered; while it is considering the BC values on the face which is not the actual physics. Values of the algebraic expression that is stored in memory should transferred everywhere which in turn overwrite the BC. To achieve this in addition to cell centroid values, face centroid values are also incorporated through additional face loop.
mvee is offline   Reply With Quote

Old   May 22, 2013, 09:37
Default
  #7
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
So what is the difference between you final solution and your first post in this thread?
blackmask is offline   Reply With Quote

Old   May 23, 2013, 03:02
Default
  #8
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17
mvee is on a distinguished road
Both the ways are correct. First option you can utilize on the face for which transport equation is required to be solved while second option can be utilized when there is no need of solution of scalar transport equation. Second option requires proper looping macros where I was doing mistake.
mvee is offline   Reply With Quote

Old   January 26, 2016, 13:06
Default
  #9
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
Hi mvee,
I assigned C_T to UDS however values are not equall at the boundary.
So I did face looping as you suggested. But it still does not work.
Can you tell me where I do mistake:

Code:
# include "udf.h"
# define domain_ID 1

DEFINE_ADJUST(adjust_gradient, domain)
{
  Thread *t;
  Thread *tf;
  cell_t c;
  face_t f;

  domain = Get_Domain(domain_ID);

  /* Fill UDS with the variable. */
  thread_loop_c (t,domain)
    {
       begin_c_loop (c,t)
         {
           C_UDSI(c,t,0) = C_T(c,t);
         }
       end_c_loop (c,t)
    }
  tf = Lookup_Thread(domain,11);
  thread_loop_f (tf,domain)
    {
       if (THREAD_STORAGE(tf,SV_UDS_I(0))!=NULL)
       begin_f_loop (f,tf)
         {
           F_UDSI(f,tf,0) = F_T(f,tf);
         }
       end_f_loop (f,tf)
    }
}

DEFINE_ON_DEMAND(store_gradient)
{
  Domain *domain;
  cell_t c;
  face_t f;
  Thread *t;
  Thread *tf;

  domain=Get_Domain(1);

  /* Fill the UDM with magnitude of gradient. */
  thread_loop_c (t,domain)
    {
       begin_c_loop (c,t)
         {
           //C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0));
           C_UDMI(c,t,0) = C_UDSI(c,t,0);
         }
       end_c_loop (c,t)
    }

    tf = Lookup_Thread(domain,11);
  thread_loop_f (tf,domain)
    {
       if (THREAD_STORAGE(tf,SV_UDS_I(0))!=NULL)
       begin_f_loop (f,tf)
         {
           F_UDMI(f,tf,0) = F_UDSI(f,tf,0);
         }
       end_f_loop (f,tf)
    }
  
 }
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   January 26, 2016, 21:35
Default
  #10
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17
mvee is on a distinguished road
I do not see any mistake in UDF. You plot the face centered value of C-T and C-UDS and check its consistency. Keep in mind that node values will differ.
mvee is offline   Reply With Quote

Old   January 27, 2016, 03:32
Default
  #11
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
Quote:
Originally Posted by mvee View Post
I do not see any mistake in UDF. You plot the face centered value of C-T and C-UDS and check its consistency. Keep in mind that node values will differ.
Hi mvee,

I used this code (the previous one I posted where you did not find any mistake):
Code:
# include "udf.h"
# define domain_ID 1

DEFINE_ADJUST(adjust_gradient, domain)
{
  Thread *t;
  Thread *tf;
  cell_t c;
  face_t f;

  domain = Get_Domain(domain_ID);

  /* Fill UDS with the variable. */
  thread_loop_c (t,domain)
    {
       begin_c_loop (c,t)
         {
           C_UDSI(c,t,0) = C_T(c,t);
         }
       end_c_loop (c,t)
    }
  tf = Lookup_Thread(domain,11);
  thread_loop_f (tf,domain)
    {
       if (THREAD_STORAGE(tf,SV_UDS_I(0))!=NULL)
       begin_f_loop (f,tf)
         {
           F_UDSI(f,tf,0) = F_T(f,tf);
         }
       end_f_loop (f,tf)
    }
}

DEFINE_ON_DEMAND(store_gradient)
{
  Domain *domain;
  cell_t c;
  face_t f;
  Thread *t;
  Thread *tf;

  domain=Get_Domain(1);

  /* Fill the UDM with magnitude of gradient. */
  thread_loop_c (t,domain)
    {
       begin_c_loop (c,t)
         {
           //C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0));
           C_UDMI(c,t,0) = C_UDSI(c,t,0);
         }
       end_c_loop (c,t)
    }

    tf = Lookup_Thread(domain,11);
  thread_loop_f (tf,domain)
    {
       if (THREAD_STORAGE(tf,SV_UDS_I(0))!=NULL)
       begin_f_loop (f,tf)
         {
           F_UDMI(f,tf,0) = F_UDSI(f,tf,0);
         }
       end_f_loop (f,tf)
    }
  
 }
In the attachment there is a file with comparison of static temperature (C_T), UDS and UDM values (both cell values and node values).

It is very strange because I only assigned the values and in the file one can see
a lot of differences in resulting values???

Does anybody know how to do it correctly?
Attached Files
File Type: xlsx T_vs_UDS_vs_UDM.xlsx (11.9 KB, 19 views)
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   January 27, 2016, 05:14
Default
  #12
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17
mvee is on a distinguished road
thats true!

Values would differ. I donot know reason. You check %age error and if it allowable according to you physics you go ahead with it. You only compare cell values not node values because it follows different method to calculate node value of UDS/UDM and T.
mvee is offline   Reply With Quote

Old   January 27, 2016, 06:51
Default
  #13
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
Yes but my really purpose is to calculate gradient on the wall so it can influence on the results. I cannot find any piece of code how to properly assign UDS to UDM. I found only how to assign C_T to UDS:

http://aerojet.engr.ucdavis.edu/flue...df/node235.htm
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   January 27, 2016, 06:55
Default
  #14
Senior Member
 
Vaze
Join Date: Jun 2009
Posts: 172
Rep Power: 17
mvee is on a distinguished road
use first order scheme on wall to calculate grad T and assign it to F-UDS/F-UDM.
mvee is offline   Reply With Quote

Old   January 27, 2016, 07:39
Default
  #15
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
it does not work
I think that macro for UDM works strange or I coded it in a wrong way??
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   June 26, 2018, 05:03
Default copy UDS to UDM
  #16
New Member
 
sadik
Join Date: Feb 2018
Posts: 7
Rep Power: 8
sumagaji is on a distinguished road
Hello, I have a problem to copy uds to udm using the following code.

Code:
#include "udf.h"
#include"sg.h"
DEFINE_ON_DEMAND(copy_uds_to_udm)
{
Domain*d=Get_Domain(1);
Thread*t;
cell_t c;
thread_loop_c(t,d)
  {
  begin_c_loop(c,t)
   {
   C_UDMI(c,t,0)=C_UDSI(c,t,0);
   }
   end_c_loop(c,t)
   }
   return;
   }
the data was successfully interpolated to uds in Ansys fluent. But the data was not copy to udm. after using the code above.
please anyone help me with this.
Thanks
Umar Sadik
sumagaji is offline   Reply With Quote

Old   June 26, 2018, 05:30
Default
  #17
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
delete
Code:
return;
best regards
AlexanderZ 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
Segmentation violation louiza FLUENT 16 June 27, 2017 16:41
UDS Unsteady with UDM shashank312 FLUENT 3 May 15, 2013 16:35
UDS stored to UDM do not show the same values swati_mohanty FLUENT 0 December 3, 2010 04:46
UDS & UDM fluent_usr FLUENT 1 June 18, 2008 04:28
usage of UDS & UDM Tong FLUENT 2 February 15, 2006 11:32


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