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

Calculating gradient of ln(C)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 7, 2022, 07:23
Post Calculating gradient of ln(C)
  #1
New Member
 
Jeroen de Graaff
Join Date: Feb 2022
Posts: 9
Rep Power: 4
jps115 is on a distinguished road
Hey everyone!

In a user-defined source term, I need access to the ln(mass_concentration) gradient. I tried to define a UDSI as the ln(density*massfrac). And then access the gradient of UDSI with C_UDSI_G(c,t,0). However, this seems to yield an error when iterating. I defined the UDSI as a define_adjust function and hooked it into fluent. Then I am trying to call the gradient of the UDSI in the defined_source function. Also good to note is that both functions compile without error and to make sure that I do not get the ln(x->0) = -inf, I add + 1e*-12 inside the ln function.

My question is if someone can help me obtain this gradient, I am not quite sure if my approach is the correct one and if so where it goes wrong. All help will be deeply appreciated.
jps115 is offline   Reply With Quote

Old   April 7, 2022, 09:01
Default
  #2
New Member
 
Jeroen de Graaff
Join Date: Feb 2022
Posts: 9
Rep Power: 4
jps115 is on a distinguished road
It seems that the define_adjust function is the problem. To make sure I have access to the gradient I do use the text command /solve/set/expert and answer yes to “Keep temporary solver memory from being freed?”. I am not quite sure what seems to be the problem. Just as a reference I include the code below.
Code:
DEFINE_ADJUST(adjust_gradient, domain)
{
	Thread* t;
	cell_t c;
	face_t f;
	/* Fill UDS with the variable. */
	thread_loop_c(t, domain)
	{
		begin_c_loop(c, t)
		{
			C_UDSI(c, t, 0) = log(C_YI(c, t, 0) * C_R(c, t) + 1e-12);
		}
		end_c_loop(c, t)
	}
	thread_loop_f(t, domain)
	{
		if (THREAD_STORAGE(t, SV_UDS_I(0)) != NULL)
			begin_f_loop(f, t)
		{
			F_UDSI(f, t, 0) = log(F_YI(f, t, 0) * F_R(f, t) + 1e-12);
		}
		end_f_loop(f, t)
	}
}
jps115 is offline   Reply With Quote

Reply

Tags
gradient calculation, uds gradient of scalar, udsi


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
pisoFOAM (LES) - internal pipe flow - convergence gu1 OpenFOAM Running, Solving & CFD 0 January 11, 2018 17:39
question regarding LES of pipe flow - pimpleFoam Dan1788 OpenFOAM Running, Solving & CFD 37 December 26, 2017 15:42
Periodic flow using Cyclic - comparison with Fluent nusivares OpenFOAM Running, Solving & CFD 30 December 12, 2017 06:35
[General] Problem in calculating Gradient masaaki ParaView 0 March 16, 2015 07:38
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 18:27


All times are GMT -4. The time now is 03:43.