UDF:Extracting velocity 'C_V(c,t)' at interior cells crashes ANSYS but works at wall boundary

  • 58 Views
  • Last Post 04 March 2019
  • Topic Is Solved
jtj1 posted this 01 March 2019

Hi,

I am trying to use user defined functions to set dynamic contact angle at a wall boundary condition for a droplet impingement problem. It is a Volume of Fluid, multiphase model with air as the primary fluid and water as the secondary fluid. The model is a 2D axi-symmetric model which is basically modeled using a rectangular meshed surface. The rectangular interior surface is surrounded by wall  boundary condition, but the wall at which the droplet impingement happens is set to have dynamic contact angle using DEFINE_PROFILE. I need to calculate the Y-velocity at cells one cell layer away from this wall boundary. I use DEFINE_ADJUST to do this. I mark a region (in the setup, using mark/adapt cells) and note the zone ID for the interior for this zone. Then I use the code below to extract the Y velocity in each cells. This code works fine if I try to extract density from the mixture domain or the volume fraction of the secondary phase (from the secondary phase domain). I use two different threads, 'thread' for mixture domain and 'subthread' for secondary phase domain. 

When I use 'C_V(c,t)' to extract the Y velocity, the program crashes with the following errors:

 ('Node 0: Process 47752: Received signal SIGSEGV.'
'999999: mpt_accept: error: accept failed: No such file')

I tried to extract the velocity using both the mixture level domain and secondary phase domain threads but both results in crashing the program with the same errors.

I use DEFINE_PROFILE at the wall boundary and it gives the Y velocity in the mixture domain without any errors. I cant seem to figure out why it is giving an error at the interior cells (using define adjust) trying to extract velocity but works fine for density, volume fraction etc..   I would greatly appreciate if you could let me know any suggestions you have.   Thanks   The code is as follows:  

#include "udf.h"

DEFINE_ADJUST(drop_radv,d)

{  

int counter = 0;  

double vclmsr[199];  

int zone_ID = 13;  

cell_t c;  

int phase_domain_index = 1;  

Thread *thread = Lookup_Thread(d,zone_ID);  

Thread *subthread = THREAD_SUB_THREAD(thread,phase_domain_index);  

begin_c_loop(c, subthread)  

{    

vclmsr[counter]=C_VOF(c,subthread);    

printf("V[%i]=%f ",counter,vclmsr[counter]);    

counter++;  

}  

end_c_loop(c, subthread)

}  

Order By: Standard | Newest | Votes
abenhadj posted this 01 March 2019

Paste the UDF and the lines causing the crash

Best regards,

Amine

jtj1 posted this 03 March 2019

Many thanks. Please find the UDF below. I have highlighted the line causing the crash (in bold and italics). I have tried both the mixture level and secondary phase domains ('thread' and 'subthread' in the UDF) to extract the Y velocity but both results in program crashing.. Thank you very much

 

#include "udf.h"

DEFINE_ADJUST(drop_radv,d)

{  

int counter = 0;  

double vclmsr[199];  

int zone_ID = 13;  

cell_t c;  

int phase_domain_index = 1;  

Thread *thread = Lookup_Thread(d,zone_ID);  

Thread *subthread = THREAD_SUB_THREAD(thread,phase_domain_index);  

begin_c_loop(c, subthread)  

{    

vclmsr[counter]=C_V(c,subthread);    

printf("V[%i]=%f ",counter,vclmsr[counter]);    

counter++;  

}  

end_c_loop(c, subthread)

}

abenhadj posted this 03 March 2019

If it is a cell zone ID define a udm and assign it the velocity value first.

Best regards,

Amine

  • Liked by
  • jtj1
abenhadj posted this 03 March 2019

For VOF model use the mixture thread  for accessing velocity 

Best regards,

Amine

  • Liked by
  • jtj1
jtj1 posted this 03 March 2019

Thank you so much. I will give it a try

jtj1 posted this 04 March 2019

It works, thank you very much for your help.

I was using the zone ID (for the interior zone separated to a cell zone using mark region) from the boundary conditions but when you suggested 'cell zone ID' to define a udm, I just used used the cell zone ID and it worked.

abenhadj posted this 04 March 2019

Mark my answer as the solution so that others might take benefit of it.

Best regards,

Amine

Close