


{"id":362336,"date":"2024-04-15T21:44:14","date_gmt":"2024-04-15T21:44:14","guid":{"rendered":"\/forum\/forums\/topic\/finding-lift-force-in-cg-motion-udf\/"},"modified":"2024-04-15T22:40:55","modified_gmt":"2024-04-15T22:40:55","slug":"finding-lift-force-in-cg-motion-udf","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/finding-lift-force-in-cg-motion-udf\/","title":{"rendered":"Finding Lift force in CG motion UDF"},"content":{"rendered":"<p>Is there any way to find the lift force in CG motion udf? I need to to use in the vertical velocity. Here is the code I have written so far. The 2D airfoil is flapping, so I described a flapping motion. The airfoil has boundary ID of 7. now I use Compute_Force_and_Moment macro to find lift force and use it in the vertical velocity.&nbsp;<br \/>The problem is, it says floating point error after 2 or 3 time steps ( residuals goes super high and simulation stops), but if i dont use the compute force and moment macro, the flapping only works well. I need to find the lift force anyhow to get the transational velocity. can anyone help me please?<\/p>\n<div>#include &#8220;udf.h&#8221;<\/div>\n<div>DEFINE_CG_MOTION(paperfreq,dt,vel,omega,time,dtime)<\/div>\n<div>{<\/div>\n<div>Thread *t;&nbsp;<\/div>\n<div>face_t f;<\/div>\n<div>\/* get moment or force *\/<\/div>\n<div>Domain *d = Get_Domain(1); \/* for single phase flow*\/<\/div>\n<div>&nbsp;<\/div>\n<div>Thread *t_object = Lookup_Thread(d, 7); \/* you get Boundary_ID from the boundary condition panel in Fluent*\/<\/div>\n<div>real force[ND_ND], moment[ND_ND], cg[ND_ND]; \/*initialise*\/<\/div>\n<div>&nbsp;<\/div>\n<div>Compute_Force_And_Moment (d,t_object,cg,force,moment,TRUE);<\/div>\n<div>&nbsp;<\/div>\n<div>&nbsp;\/* force components of surface &#8220;Boundary_ID&#8221; real force_y = force[1];*\/<\/div>\n<div>&nbsp;<\/div>\n<div>real w,a, pi;&nbsp;<\/div>\n<div>pi = 3.14159265;&nbsp;<\/div>\n<div>a = (pi*15)\/180; \/*pitch amplitude*\/&nbsp;<\/div>\n<div>w = 0.62832; \/*angular velocity*\/&nbsp;&nbsp;<\/div>\n<div>\/*defining the flapping motion*\/&nbsp;<\/div>\n<div>omega[2]=-a*2*pi*2.97*cos(2*pi*2.97*time); \/*pitching motion*\/<\/div>\n<div>vel[1]= force[1]*dtime\/0.0116;<\/div>\n<div>&nbsp;<\/div>\n<div>}<\/p>\n<p>The code above shows the error with very high residuals. But the bottom code works just fine,<\/p>\n<div>#include &#8220;udf.h&#8221;<\/div>\n<div>DEFINE_CG_MOTION(paperfreq,dt,vel,omega,time,dtime)<\/div>\n<div>{<\/div>\n<div>Thread *t;&nbsp;<\/div>\n<div>face_t f;<\/div>\n<div>real w,a, pi;&nbsp;<\/div>\n<div>pi = 3.14159265;&nbsp;<\/div>\n<div>a = (pi*15)\/180; \/*pitch amplitude*\/&nbsp;<\/div>\n<div>w = 0.62832; \/*angular velocity*\/&nbsp;&nbsp;<\/div>\n<div>\/*defining the flapping motion*\/&nbsp;<\/div>\n<div>omega[2]=-a*2*pi*2.97*cos(2*pi*2.97*time); \/*pitching motion*\/<\/div>\n<div>&nbsp;<\/div>\n<div>}<\/p>\n<p>UPDATE:<br \/>I found the possible reason of the error (not sure yet)<\/p>\n<p>Thread *t_object = Lookup_Thread(d, 7); \/* Boundary_ID from the boundary condition panel in Fluent*\/<\/p>\n<p>In this line the ID of my airfoil is 7. It is a wall. If I use this, the error occurs. but if I use other ID, the problem does not occur. But I need to use the airfoil in order to find the lift force on it.<\/p>\n<\/div>\n<\/div>\n","protected":false},"template":"","class_list":["post-362336","topic","type-topic","status-closed","hentry","topic-tag-2d-airfoil","topic-tag-ansys-fluent","topic-tag-dynamic-mesh","topic-tag-flappingwing-1","topic-tag-lift-force-1","topic-tag-udf"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["25604","199"],"_bbp_author_ip":["23.52.43.88"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["1120"],"_bbp_topic_status":["unanswered"],"_edit_lock":["1713220706:230282"],"_bbp_topic_id":["362336"],"_bbp_forum_id":["27792"],"_bbp_engagement":["199","25604"],"_bbp_voice_count":["2"],"_bbp_reply_count":["9"],"_bbp_last_reply_id":["362452"],"_bbp_last_active_id":["362452"],"_bbp_last_active_time":["2024-04-16 10:59:09"]},"test":"nahian-masudwsu-edu"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/362336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":2,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/362336\/revisions"}],"predecessor-version":[{"id":362343,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/362336\/revisions\/362343"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=362336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}