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

Adding a Power Source Term (UDF) to a closed Domain

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 7, 2020, 04:31
Default Adding a Power Source Term (UDF) to a closed Domain
  #1
New Member
 
Julius
Join Date: Mar 2020
Location: Aachen
Posts: 10
Rep Power: 6
julius93 is on a distinguished road
Hi there,
I'm trying to calculate the pressure rise in a closed compartment. Let's say I have a cube as a domain which is closed. Now I have a .csv file where the time and the Power in [W] is stored in two columns. I want this power input to emerge from a smaller cube inside the outer cube. The result should be a pressure distribution.
Can anyone help me with that problem? How do I import such a file, I've read that it is possible with a UDF but I dont' know how to proceed.
Thanks a lot!
Best regards
Julius
julius93 is offline   Reply With Quote

Old   March 7, 2020, 05:14
Default Source
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
To read such a file, you do not require a UDF. It can be directly read in. However, this has to be in a required format; csv is not recommended for any work related to Fluent. The file is called profile file in Fluent and there are two formats for transient profile. You can use one column format

((profileName transient 3 0)
(time
0
0.1
0.14
)
(var
128.3
892.3
342.23
))

You may use any name for the variables, profileName and var. transient must be written as it is. 3 specifies the number of data points. 0 specifies whether the data is time-periodic or not. Parentheses must be used as it is. Read this file via File > Read > Profile.

Then, you can apply it as source term or as any condition that needs to vary with time, such as, velocity or pressure or mass fraction at a boundary. Do note that all the data is in SI units. Fluent does not know whether this is mass source, or momentum source, or energy source or pressure. So, you can hook it for anything. Values under the var are in per unit volume (for source), i.e., if these are mass source then values are taken as kg/cu.m.

For pressure increase, it could be mass source or momentum source or energy source.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 7, 2020, 10:40
Default
  #3
New Member
 
Julius
Join Date: Mar 2020
Location: Aachen
Posts: 10
Rep Power: 6
julius93 is on a distinguished road
Thanks for your answer!

The information that i cant' use .csv is helpful!


You said: "I can hook it for anything" but how do i hook it at all? I pretty new to ansys so I dont' really understand what you mean.


I did a Geometry in ICEM (one big cube and on smaller cube inside the bigger one, so the bigger one is a closed compartment) I don't know if I need the small cube, but Ithought I need some kind of Geometry to release the energy from the .profile file.

Then I meshed the Geometry and opened it in Fluent. How do I say Fluent that there is a loaded Energy file and that it shpuld be released inside the small cube and emerge in the bigger cube.



Thank you!
julius93 is offline   Reply With Quote

Old   March 7, 2020, 11:06
Default Energy
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
What is the type of energy that you want to release from the smaller cube? Is it thermal energy or pressure or momentum? Smaller cube is not must but useful. Do note that you should have conformal mesh between the smaller and the larger cube.

Once you load the profile file in Fluent, you can go to cell zone conditions, select smaller cell zone, enable source, and then apply the profile.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 7, 2020, 11:18
Default
  #5
New Member
 
Julius
Join Date: Mar 2020
Location: Aachen
Posts: 10
Rep Power: 6
julius93 is on a distinguished road
It is thermal energy, it comes from an electric arc, so its a file where the arc power is written over time. The originally problem is a electric arc ignition between two electrodes inside a closed compartment. This electric power is transformed into heat and then into pressure rise inside the closed compartment. And as a result of my simulation i want a pressure distribution on each wall of the outer compartment.



And I just wanted to start simple, so i didnt want to simulate the two electrodes, so the small cube is intended to describe the gap between the two electrodes between which the arc is ignited.


Do you think its a good way to simulate such a scenario?


Best regards
Julius
julius93 is offline   Reply With Quote

Old   March 7, 2020, 11:25
Default Approach
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Yes, this is a correct approach. Do ensure that the fluid is modeled as compressible. If it's gas, you may use Ideal gas law.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 8, 2020, 08:37
Default
  #7
New Member
 
Julius
Join Date: Mar 2020
Location: Aachen
Posts: 10
Rep Power: 6
julius93 is on a distinguished road
Hi,


i proceeded as you recommended but I get an error ("floeting point exception") and it won't work.



I can't see the inner cube and how do I define that the energy is released in the inner cube? Did I do something wrong?



Thanks a lot!
Attached Images
File Type: jpg Fluent_error.jpg (95.5 KB, 9 views)
julius93 is offline   Reply With Quote

Old   March 8, 2020, 08:43
Default
  #8
New Member
 
Julius
Join Date: Mar 2020
Location: Aachen
Posts: 10
Rep Power: 6
julius93 is on a distinguished road
And the model looks like this now:


I think the inner smaller cube is part of the fluid. Thats ok, but I couldn't define the energy to emerge from there..
Attached Images
File Type: jpg Fluent_2.jpg (115.3 KB, 8 views)
julius93 is offline   Reply With Quote

Old   March 8, 2020, 08:45
Default
  #9
New Member
 
Julius
Join Date: Mar 2020
Location: Aachen
Posts: 10
Rep Power: 6
julius93 is on a distinguished road
And how do I ensure that the Gas is compressible?
julius93 is offline   Reply With Quote

Old   March 8, 2020, 09:56
Default
  #10
New Member
 
Julius
Join Date: Mar 2020
Location: Aachen
Posts: 10
Rep Power: 6
julius93 is on a distinguished road
I think i fixed it at least there were no more errors when started the calculation.



But I think nothing happend, I cant' see the pressure distribution. (Iattached two screenshots, maybe you can tell me what I've done wrong)



Do you have an idea which setting I've set wrong?


Best regards
Julius
Attached Images
File Type: jpg Fluent_3.jpg (100.1 KB, 8 views)
File Type: jpg Fluent_4.jpg (114.5 KB, 8 views)
julius93 is offline   Reply With Quote

Old   March 8, 2020, 12:18
Default Setup
  #11
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Assuming you have two bodies at the CAD level, two bodies at the meshing level, you should have two cell zones in Fluent. If you do not have those, I'd suggest go back to CAD model and ensure that there are two bodies, one representing the smaller cube and the other one representing the larger cube excluding the inner cube region since inner cube is supposed to be fully enclosed by the outer cube.

At the meshing level, in the Geometry branch, there should only be one part and both bodies should belong to that part. This will ensure conformal mesh. Also give names to both bodies, you can give whatever names you want. Do not use capital letters or spaces between words.

To model compressible flow, you need to use ideal gas for density.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Reply

Tags
energy input, power, pressure, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 35 April 29, 2022 15:35
multiRegionHeater error ordinary OpenFOAM Running, Solving & CFD 2 June 9, 2020 17:43
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 05:18
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24


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