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

UDf current density integration

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 23, 2019, 10:41
Default UDf current density integration
  #1
New Member
 
Domagoj
Join Date: Oct 2019
Posts: 10
Rep Power: 7
Domagoj is on a distinguished road
Hello,

i need to integrate current density in my axisymmetric Fluent model in order to obtain self-induced azimuthal magnetic field (Ampere circuital law) - see attached picture.

Z is symmetry axis, r is radial distance.

How to write UDF for this problem?

Is it possible to loop cells for various z=const from r=0 to the right boundary while replacing integral with sum of finite values calculated in cell center?

Any suggestions?

Thanks.
Attached Images
File Type: jpg fluent_B_field.jpg (103.4 KB, 55 views)
Domagoj is offline   Reply With Quote

Old   October 23, 2019, 22:25
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
there is build in electric potential model in fluent
did you try to use it?
__________________
best regards


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

Old   October 24, 2019, 02:38
Default
  #3
New Member
 
Domagoj
Join Date: Oct 2019
Posts: 10
Rep Power: 7
Domagoj is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
there is build in electric potential model in fluent
did you try to use it?
Current density values are obtained using electric potential model, but it does not solve magnetic field values.

Also, there is advanced add-on module called MHD but it solves problems with externally-imposed magnetic field. In my case magnetic field is self-induced and I do not see how to apply it?

My final goal is to obtain Lorentz force from current density and magnetic field and use it as momentum source. Than I could solve fluid stirring problem.

Last edited by Domagoj; October 24, 2019 at 09:25. Reason: t
Domagoj is offline   Reply With Quote

Old   October 25, 2019, 01:07
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I'm not sure how to do it step by step.
But it seems you should use user-defined scalar to define your magnetic field

read Ansys Fluent Customization manual for more information regarding UDS
__________________
best regards


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

Old   October 25, 2019, 01:10
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
does current field pre-defined? or you should solve some equation to get current distribution?
__________________
best regards


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

Old   October 25, 2019, 02:26
Default
  #6
New Member
 
Domagoj
Join Date: Oct 2019
Posts: 10
Rep Power: 7
Domagoj is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
does current field pre-defined? or you should solve some equation to get current distribution?
Current field is solved using Electric potential model with appropriate boundary conditions at the external walls. I have saved all necessary cell data in UDM's and should solve Ampere equation to obtain azimuthal magnetic field.

It should be relatively simple numerical integration but I am not sure how to locate and loop cells from some constant z-coordinate (and r=0) to the right boundary end perform summation instead of integral.
Domagoj is offline   Reply With Quote

Old   October 25, 2019, 03:24
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
inside cell loop you may check if the cell is inside region (z-> your_boundary_coord) and make summation if True.
using C_CENTROID macro you can get coordinate of cell

detail information in Ansys Customization Manual
__________________
best regards


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

Old   October 25, 2019, 06:45
Default
  #8
New Member
 
Domagoj
Join Date: Oct 2019
Posts: 10
Rep Power: 7
Domagoj is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
inside cell loop you may check if the cell is inside region (z-> your_boundary_coord) and make summation if True.
using C_CENTROID macro you can get coordinate of cell

detail information in Ansys Customization Manual
Thanks, I will try to write some code and post it here.
I thought that someone already has something similar that could be modified for my case.
Domagoj is offline   Reply With Quote

Old   August 25, 2022, 18:52
Default
  #9
New Member
 
Rodrigo Villarreal
Join Date: Nov 2016
Posts: 29
Rep Power: 10
rodrigovime is on a distinguished road
I have the very same problem but in ANSYS CFX. It seems that I cannot integrate using the NLOC array. Is there a way to perform numerical integration using User Fortran?
rodrigovime is offline   Reply With Quote

Old   September 30, 2022, 08:22
Default
  #10
New Member
 
Domagoj
Join Date: Oct 2019
Posts: 10
Rep Power: 7
Domagoj is on a distinguished road
Hello,

In the end I obtained Lorentz force using magnetic vector potential method.

I can't remember the implementation details (UDS were used), it was long time ago, but read this paper carefully.

https://iopscience.iop.org/article/1...-3727/37/6/013
Domagoj 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
UDF for modifying density of mixture phase during the calculating process sola86 Fluent UDF and Scheme Programming 2 May 28, 2019 10:24
Density UDF Divergence Baden Fluent UDF and Scheme Programming 0 January 11, 2017 16:25
Interpret-Real Gas UDF ndabir Fluent UDF and Scheme Programming 3 November 18, 2015 08:29
How to get the current density using TUI in Fluent PEMFC module? Prince Abraham FLUENT 1 November 2, 2015 12:57
Warning 097- AB Siemens 6 November 15, 2004 05:41


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