UDF program for calculating the pressure
- 142 Views
- Last Post 29 August 2019
- Topic Is Solved
You need to use DEFINE_PROFILE to change the boundary value at your inlet. If the profile is only dependent on time you can use profile file. If you are using actual versions you can use Fluent Expression to change the value at the boundary.
The pressure difference is via Report so I guess you do not need to do anything. Only if you want to have that on demand via UDF. But is this really required.
All above is documented.
You don't need a UDF to calculate the pressure. If you use the reporting features (as you've done) for the pressure drop you then only need a profile or expression (or simple boundary UDF) to alter the velocity with time. The latter can be done using a couple of example UDFs in the manual: start with DEFINE_PROFILE
Thank you..will go through both the suggestions.
Please find the attachment below.
Fig 1 is the graph what i am getting now using Ansys fluent. Fig 2 is what i need to get.
I dont understand where to start with. Im litrally new to programming. Please help. I had gone through the Ansys UDF manual. Should i write a c code or TUI commands and journal files will do the trick??
Right, start off with what you need to know:
For a given velocity (that changes with time) you want the pressure loss.
So, input is the velocity profile. If you can ignore the higher frequency noise velocity = coefficient * time Now read the DEFINE_PROFILE example in the UDF manual, and look for examples where solution time has been used. If velocity is a stair-step you'll need to use an IF function and figure out the logic.
The output is the pressure loss or value. For a velocity inlet & pressure outlet, the pressure on the outlet is fixed, and varies on the inlet to force the flow into the domain. Using a Report you can plot & save this value to a file (read up on monitor points).
Plot the input you give the UDF and Pressure monitor (remember to add time into the export) to get what you're after.
As an aside: please use one thread per problem. Posting elsewhere won't get you a faster answer and will result in other topics being locked. As I have a finite amount of time it'll also mean I don't answer other threads.
Attached a image file of UDF, please comment if anything to be added into that. I am able to compile the program but not able to get the expected graph.
You can set a second report and then combine the files, or add in the data manually: you're setting the velocity. Check you can't add multiple reports to one file (can't remember if they need to have the same units).
Re the UDF, if time is greater than 1000s it's also greater than 900s (and 800s etc): what value should the solver use?
1. As written in UDF, as far as my understanding solver uses value in between the timestamp as mention. E.g : After 1000s and till 1100, v=1.5m/s and if >900 and less than 1000,v=1.35.
Please correct me if i am wrong.
2. I get some negative Delta p values,as velocity step increases. Any suggestions??
Velocity is lower at P1 and higher at P2 as expected but Pressure is not stable.
1/yes 2/ Perhaps it requires more iterations and or smaller time steps especially at transition.
Why not using transient profile or Expressions.
Why not using transient profile or Expressions..
Can you please elaborate..?
Transient Profile is another alternative instead of writing UDFs. The same is with Fluent Expressions. But now you are using UDF: that is okay.
Thank you. Will try increasing iterations(already done for 20 iterations) and also smaller time steps.
lately i have been doing this for every 100sec,increase v at steps of 0.05m/s.
is that okay?
That is your application: I don't know if this is okay as I do not know the application. If your application and reality require this ramp-up then you should try to do that.
smaller time steps especially at transition...
Do u mean..
a. Should I try calculating Delta P for every 0.25 sec rather than 1sec.
b. Should i try this for lesser duration time/change in velocity (lately i have been doing this for every 100sec,increase v at steps of 0.05m/s)
Just try and report. I was meaning using smaller time steps in general and more iteration during each time step (set it to 20 max and report interval to 5 to enforce 5 iterations every time step).
Can I know how Ansys calculates the pressure,velocity etc. (back end code on which equation/formula it uses). I have theoretically calculated Delta P which is not close to the value I got from Ansys. I need to know how does Ansys calculate those values.
The equations are all in the theory guide: we calculate values at each cell and iterate to a solution. Differences to theory can be due to limitations in the theory (eg assumptions in the equations), insufficient mesh/resolution, user error etc so there's no one reason for a discrepancy.
- All Categories
- Community Rules, Guidelines, and Tips
- News & Announcements
- Student Products
- Pre and Post Processing
- Physics Simulation
- Tutorials, Articles and Textbooks
- Installation and Licensing
- Student Competition Teams
- eMasters Degree from UPM
- Site Feedback