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

UDF not working for initialising volume fraction inside the domain

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 16, 2024, 16:28
Default UDF not working for initialising volume fraction inside the domain
  #1
New Member
 
S VIVEK
Join Date: Aug 2024
Posts: 2
Rep Power: 0
vivek_sankuru is on a distinguished road
Respected viewers,
I am running a 2D multiphase transient simulation(VOF Fluent) in which vapor bubbles are generated at the bottom surface of a rectangular domain that is initially full of water with heat flux given at the bottom wall. I was trying to patch a single vapor bubble by creating a hemispherical region. I can see my volume fraction contour with the bubble after patching a hemispherical region at the bottom of the liquid. The simulation is also running perfectly when I click on "Run Calculation".
When I do this same bubble patch operation through a DEFINE_INIT UDF, I can see the bubble getting patched in the vapor phase contour, but the calculation is not running. It is giving the following error in the 1st iteration itself.
Divergence detected in AMG solver: vof-1
Divergence detected in AMG solver: x-momentum
Divergence detected in AMG solver: y-momentum
Divergence detected in AMG solver: pressure correction
Divergence detected in AMG solver: pressure correction
Divergence detected in AMG solver: temperature

UDF code
#include "udf.h"

DEFINE_INIT (init2, domain1)
{
Message("solution initialised");


cell_t cell;
Thread *cell_thread;
Domain *subdomain;

int phase_domain_index;
//Initialisation of heater layer

sub_domain_loop(subdomain, domain1, phase_domain_index)
{

if(DOMAIN_ID(subdomain) == 2)
{
thread_loop_c (cell_thread,subdomain)
{

begin_c_loop_all (cell,cell_thread)
{
real arr[ND_ND];
C_CENTROID(arr,cell,cell_thread);
if (sqrt(ND_SUM(pow(arr[0],2),pow(arr[1],2), pow(arr[2],2)))<=0.00000002)
{

C_VOF (cell, cell_thread) = 0. ;
C_P(cell, cell_thread)= 5846400;
}

else
{

C_VOF (cell, cell_thread) = 1. ;
}

}
end_c_loop_all (cell,cell_thread);

}

}



}
}

Attached photo of contour after clicking initialize
Screenshot_20240817_002551.jpg

When I am running the calculation I am getting this error, but there is no error when I am patching it without udf by creating a region.
I want this patching operation to be done via udf, so I can generate new bubbles after every time step in a specific pattern. (I will be using EXECUTE_AT_END for that ).
I would be grateful if someone can help me.
vivek_sankuru is offline   Reply With Quote

Old   August 19, 2024, 06:12
Default
  #2
New Member
 
S VIVEK
Join Date: Aug 2024
Posts: 2
Rep Power: 0
vivek_sankuru is on a distinguished road
This photo gives a closer look of edge of a bubble initialised through udf.Screenshot 2024-08-19 143448.png

This photo is the same contour but patched without udf (by creating a region)
Screenshot 2024-08-19 143917.png
vivek_sankuru 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
Simulation crashes when turbulence is on (reactingMultiphaseEulerFoam) remidemol OpenFOAM Running, Solving & CFD 3 May 26, 2020 06:47
SU2-7.0.1 on ubuntu 18.04 hyunko SU2 Installation 7 March 16, 2020 05:37
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 07:20
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 15:11


All times are GMT -4. The time now is 11:57.