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

UDF Surface Reaction Basics

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By FreeFall79

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 12, 2015, 09:48
Default UDF Surface Reaction Basics
  #1
Member
 
Matthew Rich
Join Date: Jul 2013
Posts: 33
Rep Power: 12
FreeFall79 is on a distinguished road
Hi all

I am attempting to create a UDF file to have product species produced at the surface of a tube wall. I have been reviewing the manual and I sort of have an but I need someone to help me connect the dots. My understanding is it requires two steps.

1) Identify the involved cells

Code:
#define zone_id 7 /* REPLACE THIS WITH APPROPRIATE BOUNDARY ID */

DEFINE_ON_DEMAND(my_reaction_cells)
{
  Domain *d = Get_Domain(1); /* POINTER FOR THE DOMAIN */
  Thread *t, *t0;
  cell_t c0;
  face_t f;
  
  t = Lookup_Thread(d, zone_id); /* POINTER FOR THE SPECIFIED BOUNDARY */
  t0 = THREAD_T0(t); /* POINTER FOR THE FLUID ADJACENT TO SPECIFIED BOUNDARY */
  
  begin_f_loop(f,t) /* LOOP OVER FACES OF THE SPECIFIED BOUNDARY */
    {
      c0 = F_C0(f,t);
      C_UDMI(c0,t0, 0) = 1;
    }
  
  end_f_loop(f,t);
}
So this was largely borrowed from others but I think it is correct. My hope is that I would enable this with initialization function hook. I will have surface cells based on the BC I pass through Zone_ID. Now where I get slightly confused is on the C_UDMI and how I can link that with step 2.

2) Implement the Source term on the species balance equations
Code:
DEFINE_SOURCE(my_species_source,c,t,dS,eqn)
{
  real k, source;
  k = 0.5; /* 1/s */
  source = C_R(c,t)* k * C_YI(c,t,0); /* source is a function of k times mass fraction of first species times density */
  dS[eqn] = 0.0;
  
  return source; /*Unit should be kg/(m3-s)*/
}
I would implement this by going to the species tab and the balance equations of my species. I am running on R16.1 and the UDF is interpreted and not compiled. Now here is where my problems start. My DEFINE_ON_DEMAND equations fails and crashes out FLUENT. I am running the problem as a Local MPI job with 4 processors. When I hybrid initialize i get the following error.

iter scalar-0

1 1.000000e+00
2 2.503153e-04
3 3.350463e-05
4 1.917379e-05
5 3.410960e-06
6 9.846552e-07
7 2.790700e-07
8 9.536242e-08
9 3.064283e-08
10 1.126697e-08
hybrid initialization is done.

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

Node 0: Process 5300: Received signal SIGSEGV.

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

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

Node 2: Process 8916: Received signal SIGSEGV.

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

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

Node 3: Process 8584: Received signal SIGSEGV.

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

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

Node 1: Process 3420: Received signal SIGSEGV.

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

===============Message from the Cortex Process================================

Fatal error in one of the compute processes.

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

Error: Cortex received a fatal signal (unrecognized signal).
Error Object: ()

Error: There is no active application.
Error Object: (rp-var-value 'vof/oc/n-waves)

Not sure what I need to do to resolve that. I have no errors implementing the DEFINE_SOURCE by itself but I get zero production of the species in question. Any assistance or recommendation of resources would be much appreciated in getting this working. Also I am not sure how the species function knows how to hook into the Cells identified to participate in the surface reaction.

Thanks in advance.
souza.emer likes this.
FreeFall79 is offline   Reply With Quote

Old   July 14, 2015, 19:24
Default
  #2
Member
 
Matthew Rich
Join Date: Jul 2013
Posts: 33
Rep Power: 12
FreeFall79 is on a distinguished road
Anyone have comments on this. I know there is a similar thread but the solution applied is not clear.

Any help is much much appreciated.
FreeFall79 is offline   Reply With Quote

Old   January 15, 2019, 11:09
Default
  #3
Member
 
Emerson
Join Date: May 2018
Posts: 35
Rep Power: 7
souza.emer is on a distinguished road
I have the same error, but in my case, the macro DEFINE_SOURCE is doing the trouble. =/
souza.emer 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
Defining reaction rate with multiple surface reaction Fred Marias FLUENT 1 September 12, 2013 04:56
Unit of rate in udf of a surface reaction borhan_sd@yahoo.com Fluent UDF and Scheme Programming 0 June 11, 2013 03:28
question about udf for "particle surface reaction rate" lili Fluent UDF and Scheme Programming 0 January 9, 2013 03:37
udf for partical surface reaction blaid FLUENT 0 April 25, 2011 07:24
UDF changing the rate exponent of a reaction Stefan H Fluent UDF and Scheme Programming 0 September 16, 2009 13:20


All times are GMT -4. The time now is 00:44.