# udf for compute pressure drag force

 Register Blogs Members List Search Today's Posts Mark Forums Read January 24, 2018, 05:10 udf for compute pressure drag force #1 New Member   hashem Join Date: Dec 2015 Posts: 6 Rep Power: 9 i want to separate the viscous and pressure drag force in an unsteady simulation which means i want every time step fluent write pressure drag force in a file . i calculate this formula for pressure drag : Fp=p(pressure) *mag(area)* nx(unit normal in x direcyion and the flow is in x direction) i write a udf and use F_P (f, t) to obtain pressure and F_AREA(A,f,t) for unit vector i understand that A=A i + A j that A is mag(A)*nx here is my udf: #include "udf.h" DEFINE_EXECUTE_AT_END(execute_at_end) { Domain *d; face_t f; real nx; real ny; real force; real force2; real force3; real force4; real force5; real avgP; int ii; real NV_VEC (A); cell_t c; Thread *t ; if (!Data_Valid_P()) { return; } force=0.0; force2=0.0; force3=0.0; force4=0.0; force5=0.0; avgP=0.0; ii=1; d = Get_Domain(1); /*Get the domain ID*/ /* int wallId=8; Modify the ID of surface on which you want to calculate the species gradient*/ t=Lookup_Thread(d,5); /* Get the thread id of that surface*/ /* Loop over all surface faces*/ begin_f_loop(f,t) { F_AREA(A,f,t); /*Get the area vector*/ nx=(A)/NV_MAG (A); ny=(A)/NV_MAG (A); force = force + ((F_P (f, t)+10174.63) * NV_MAG (A)*(1.0*nx)); force2 = force2 +( (F_P (f, t) +10174.63)* NV_MAG (A)); force3 = force3 +(( F_P (f, t)-10174.63) * NV_MAG (A)); force4 = force4 + ( (F_P (f, t)-10174.63) * (A) ); force5 = force5 +( F_P (f, t) * (A) ); avgP= avgP + F_P (f, t); /* printf("mag is = %8.4f\n", NV_MAG (A) ); printf("pressure is = %8.4f\n", F_P (f, t) ); printf("A0 is = %8.4f\n", A ); printf("A1 is = %8.4f\n", A ); printf("nx is = %8.4f\n", nx ); printf("ny is = %8.4f\n", ny ); */ ii =ii+1; } end_f_loop(f, t) Message0("Pressuredrag -nx is = %8.4f\n", force ); Message0("Pressuredrag2 -ny is = %8.4f\n", force2 ); Message0("Pressuredrag3 A is = %8.4f\n", force3 ); Message0("Pressuredrag4 A0 is = %8.4f\n", force4 ); Message0("Pressuredrag5 A1is = %8.4f\n", force5); Message0("avgP A1is = %8.4f\n", avgP/ii); /*printf("Volume integral of turbulent dissipation: %g\n", sum_diss);*/ } problem is that the computed pressure drag force do not match with i report from fluent in reports> forces in x=1 , y=0 direction i check my unit normal with a case that is true i wonder if F_P (f, t) return static pressure or not help me force = force + ((F_P (f, t)+10174.63) * NV_MAG (A)*(1.0*nx)); here 10174.63 is Pref i test it without Pref again it doesnt match   January 26, 2018, 14:27 #2 Senior Member   Join Date: Sep 2017 Posts: 232 Rep Power: 10 As far as I recall, "F_P(f,t)" returns the static pressure relative to the reference pressure. Are you sure that your reference pressure is approximately 1.01e4 Pa? -- because a much more common value would be approximately 1.01e5 Pa. In any case, it should not matter for calculating pressure force, as the pressure acts on equal areas on the left side and the right side of an object (assuming that object is completely represented in the model). "ii" should be initialized to 0 here, I think. If the pressure reports from Fluent are sufficient, I would advise you to use those instead of a UDF -- for example, by making Fluent report the force at every iteration or timestep (in Calculation Activities, or Monitors); save a transcript file and then edit it in a powerful text-editor. Ed  Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules Similar Threads Thread Thread Starter Forum Replies Last Post rsarma Fluent UDF and Scheme Programming 3 May 24, 2021 12:35 ali hemmati Fluent UDF and Scheme Programming 2 March 28, 2019 14:08 rsarma Fluent UDF and Scheme Programming 4 January 24, 2018 05:59 siw CFX 3 October 22, 2010 07:07 mkrao FLUENT 2 February 8, 2009 06:51

All times are GMT -4. The time now is 23:57.