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

Why leads UDS_FLUX Example from User Guide to wrong results?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 11, 2020, 19:49
Default Why leads UDS_FLUX Example from User Guide to wrong results?
  #1
Member
 
Deutschland
Join Date: Jun 2020
Location: https://t.me/pump_upp
Posts: 43
Rep Power: 6
schwaral is on a distinguished road
Send a message via ICQ to schwaral Send a message via AIM to schwaral Send a message via Yahoo to schwaral
Hi all,

Instead of using the default flux term I want to use my own flux term now. I want to modify the velocity later and so on...

Now I started testing the DEFINE_UDS_FLUX example and I noticed, that for velocity =0 at the beginning of my Inlet-Velocity-SIgnal the example ends in wrong results.

I use a simple 1D case with 10 cells. left-side is UDS-Inlet with UDS-specified-Value=0.02939, right side is UDS-Outlet with Flux=0. in The middle of Domain I have 2 Cells with a source for UDS. I notice weird behavior on the left side at Inlet for velocity in my domain =0. The UDS Value is becoming too large then. I do not know how to avoid this, but I cannot negelect this behavior.

The code from User Guide:
Code:
DEFINE_UDS_FLUX(my_uds2_flux, f, t, i) //RETURNS MASS FLOW RATE THROUGH A GIVEN FACES
{
	cell_t  c0, c1 = -1; //the cell thread index
	Thread* t0, * t1 = NULL;
	real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;

	c0 = F_C0(f, t);
	t0 = F_C0_THREAD(f, t);
	F_AREA(A, f, t);

	/* If face lies at domain boundary, use face values; */
	/* If face lies IN the domain, use average of adjacent cells. */

	if (BOUNDARY_FACE_THREAD_P(t)) /*Most face values will be available*/
	{
		real dens;

		/* Depending on its BC, density may not be set on face thread*/
		if (NNULLP(THREAD_STORAGE(t, SV_DENSITY)))
			dens = F_R(f, t);   /* Set dens to face value if available */
		else
			dens = C_R(c0, t0); /* else, set dens to cell value */


		NV_DS(psi_vec, =, F_U(f, t), F_V(f, t), F_W(f, t), *, dens); // F_U(f, t) = u_velocity at face

		flux = NV_DOT(psi_vec, A); /* flux through Face */
		Message0("1: %g\n", flux);
	}
	else
	{
		c1 = F_C1(f, t);       /* Get cell on other side of face */
		t1 = F_C1_THREAD(f, t);

		NV_DS(psi_vec, =, C_U(c0, t0), C_V(c0, t0), C_W(c0, t0), *, C_R(c0, t0));
		NV_DS(psi_vec, +=, C_U(c1, t1), C_V(c1, t1), C_W(c1, t1), *, C_R(c1, t1));

		flux = NV_DOT(psi_vec, A) / 2.0; /* Average flux through face */
		Message0("2: %g\n", flux);
	}

	/* ANSYS FLUENT will multiply the returned value by phi_f (the scalar's
	   value at the face) to get the "complete'' advective term.  */

	return flux;
}

Last edited by schwaral; November 12, 2020 at 06:35.
schwaral is offline   Reply With Quote

Old   November 13, 2020, 09:35
Default
  #2
Member
 
Deutschland
Join Date: Jun 2020
Location: https://t.me/pump_upp
Posts: 43
Rep Power: 6
schwaral is on a distinguished road
Send a message via ICQ to schwaral Send a message via AIM to schwaral Send a message via Yahoo to schwaral
It seems like the 3D case works just fine but 1D is not correct after initialization. It has to be something with the code or missing information from initialization. But I initialize in the same way I do with 3d.
schwaral is offline   Reply With Quote

Old   April 10, 2023, 04:49
Default
  #3
New Member
 
Santiago Cespedes
Join Date: Apr 2023
Location: Saudi Arabia
Posts: 1
Rep Power: 0
sacespedeszu is on a distinguished road
Hi schwaral. I am facing the same problem in 3D. The UDS_FLUX Example gives me wrong results. Have you managed to solve that problem?
sacespedeszu 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
BuoyantBoussinesqSimpleFoam and axial-symmetric results wrong mass flow Thomas Baumann OpenFOAM 6 December 21, 2009 11:31
why dynamic mesh method give wrong results? weiyang1980 Main CFD Forum 0 September 22, 2009 22:06
Re: FLUENT 6.2 User Guide Ahmad Hussain FLUENT 8 August 16, 2005 16:21
User guide 6.1 Geremi FLUENT 2 March 28, 2005 09:33
Fluent 6.1 user guide dingdong FLUENT 6 May 17, 2004 12:17


All times are GMT -4. The time now is 14:31.