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

Species diffusion through a wall

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 26, 2022, 11:52
Default Species diffusion through a wall
  #1
New Member
 
Joe
Join Date: Jan 2022
Posts: 13
Rep Power: 4
CFD27 is on a distinguished road
Hello all,
I want to simulate the diffusion flow of a species through a wall to the other side of the wall. For this purpose, I have already determined the cells adjacent to the wall using a UDF and thus built in source terms from both sides. To make the sources now dependent on the concentration of the species, I want to determine the gradient of the species. For this I found in pressure-based solver after entering the command "(rpsetvar 'species/save-gradients? #t)" into the TUI. As a first step, I tried to determine the gradient and save it in a UDM so that I can use it later for computation. When compiling the UDF the following error occurs: error C2440: '=': 'real *' cannot be converted to 'real. When modifying the UDF to save the mass fraction, no error occurs. Can anyone give me a hint where my error is?

This is my Code for Saving Gradient:
Code:
#include "udf.h"
#include "mem.h"
DEFINE_EXECUTE_AT_END(Grad_calc)
{
	Domain* d;
	Thread* t;
	cell_t c;
	d = Get_Domain(1);
	thread_loop_c(t, d)
	{
		begin_c_loop(c, t)
		{
			C_UDMI(c, t, 1) = C_YI_G(c, t, 0);
		}
		end_c_loop(c,t)
	}
}
Thanks in advance.
Many Greetings
Joe
CFD27 is offline   Reply With Quote

Old   February 2, 2022, 19:21
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
gradient is a vector so you have 3 scalar values for 3D problem
to be
Code:
C_UDMI(c, t, 1) = C_YI_G(c, t, 0)[0];
C_UDMI(c, t, 2) = C_YI_G(c, t, 0)[1];
C_UDMI(c, t, 3) = C_YI_G(c, t, 0)[2];
CFD27 likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   February 3, 2022, 04:10
Default
  #3
New Member
 
Joe
Join Date: Jan 2022
Posts: 13
Rep Power: 4
CFD27 is on a distinguished road
Dear Alexander,
Thank you for your reply. I have already been able to fix the problem myself. Your hint that the gradient is a vector was part of it. I converted the gradient to a scalar using the Magnitude macro. After this error was fixed, a memory error occurred, which I fixed by having the solver access the gradient only after checking to see if it was in memory. In addition, I have replaced Execute at End macro with a Define Adjust macro. Thanks for your help.
Many greetings
Joe
CFD27 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
how to define diffusion coefficients for every species in the system? Weiqiang Liu FLUENT 7 June 23, 2021 10:03
Table bounds warnings at: END OF TIME STEP CFXer CFX 4 July 16, 2020 23:44
Centrifugal fan j0hnny CFX 13 October 1, 2019 13:55
Diffusion flux calculation in the wall boundary face of the wall function approach randolph OpenFOAM 1 August 27, 2018 22:02
Anisotropic Species Diffusion Baden FLUENT 6 January 17, 2017 04:06


All times are GMT -4. The time now is 05:02.