Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Calculate Drag Coefficient

Please login with a confirmed email address before reporting spam

Background: simulate the drag coefficient for a truck model

I have read the following post
www.comsol.de/blogs/how-do-i-compute-lift-and-drag/
and looked at the flow over an Ahmed body example
which shows that the total drag force in the Y direction is: spf.T_stressy

To calculate c_d i need to calculate
(en.wikipedia.org/wiki/Drag_coefficient)

where (please correct if wrong):
= spf.T_stressy
= spf.rho
u = spf.u

Is the above correct? How do I calculate Area? The area should only be the surface exposed in the Y direction (spf.nymesh?)?

thanks in advance!
Jess

9 Replies Last Post Apr 25, 2016, 8:32 a.m. EDT
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Apr 19, 2016, 10:42 a.m. EDT
The Discussion Forum supports LaTeX formulae, as long as you follow the syntax mentioned in this thread: www.comsol.com/community/forums/general/thread/33025
Best regards,
Jeff
The Discussion Forum supports LaTeX formulae, as long as you follow the syntax mentioned in this thread: https://www.comsol.com/community/forums/general/thread/33025 Best regards, Jeff

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Apr 20, 2016, 4:55 a.m. EDT
Thanks Jeff,
I have updated my post
Thanks Jeff, I have updated my post

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Apr 20, 2016, 8:15 a.m. EDT
Hi Jesse,

is the drag force, i.e. the integral over the surfaces of the vehicle of the y component of the forces applied by the air flow onto the vehicle. You can compute it using Derived Values > Integration > Surface Integration, as explained in the blog you referenced.
You will be able to compute by integrating ny*(ny>0) over the same surfaces. ny is the y component of the outward-pointing normal vector on surfaces (Here I am assuming that you removed the volume occupied by the vehicle from the computational domain, so that ny points into the vehicle. You can always do an arrow plot of the (nx,ny,nz) vector if in doubt ). The *(ny>0) part is needed to capture only the parts of the surface of the vehicle that face forward.
Finally, in the formula, is the velocity of the vehicle, i.e. for you the velocity of the air at the inlet, whereas spf.u is the x-direction component of the velocity of the air, a field that varies from point to point in the computational domain.

I hope this helps,
Jeff
Hi Jesse, [math]F_d[/math] is the drag force, i.e. the integral over the surfaces of the vehicle of the y component of the forces applied by the air flow onto the vehicle. You can compute it using Derived Values > Integration > Surface Integration, as explained in the blog you referenced. You will be able to compute [math]A[/math] by integrating ny*(ny>0) over the same surfaces. ny is the y component of the outward-pointing normal vector on surfaces (Here I am assuming that you removed the volume occupied by the vehicle from the computational domain, so that ny points into the vehicle. You can always do an arrow plot of the (nx,ny,nz) vector if in doubt ). The *(ny>0) part is needed to capture only the parts of the surface of the vehicle that face forward. Finally, in the formula, [math]u[/math] is the velocity of the vehicle, i.e. for you the velocity of the air at the inlet, whereas spf.u is the x-direction component of the velocity of the air, a field that varies from point to point in the computational domain. I hope this helps, Jeff

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Apr 21, 2016, 3:35 a.m. EDT
Hi Jeff,
Thank you very much for your clear explanation.
The following is what I am using for the Surface Integration


Is this what you described?

thank you
Jesse

Hi Jeff, Thank you very much for your clear explanation. The following is what I am using for the Surface Integration [math] \frac{2*spf.T\_stressz}{spf.rho*nz*(nz>0)*V\_inf*V\_inf} [/math] Is this what you described? thank you Jesse

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Apr 21, 2016, 8:58 a.m. EDT
2, and are constants that don't need to be integrated. The rests of the numerator and denominator need to be computed as separate integrals.
Best,
Jeff
2, [math]rho[/math] and [math]u^2[/math] are constants that don't need to be integrated. The rests of the numerator and denominator need to be computed as separate integrals. Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Apr 22, 2016, 10:55 a.m. EDT
Thank you again for the helpful reply.
I have two remaining questions,
I have two line integrations (I am first computing the drag in 2D), one computing the integral of spf2.T_stressx, and the other nx*(nx>0).
I have been looking for a way to read the result of the two out of the table and do some further postprocessing on the values. Is this possible within Comsol, or is exporting/copying the values out of Comsol the only option? (ie. Can I include a calculated drag coefficient in my Report )
Also, the simulation is set to use the in built air as the fluid, where rho is
How do I obtain this value?

thank you
Jesse
Thank you again for the helpful reply. I have two remaining questions, I have two line integrations (I am first computing the drag in 2D), one computing the integral of spf2.T_stressx, and the other nx*(nx>0). I have been looking for a way to read the result of the two out of the table and do some further postprocessing on the values. Is this possible within Comsol, or is exporting/copying the values out of Comsol the only option? (ie. Can I include a calculated drag coefficient in my Report ) Also, the simulation is set to use the in built air as the fluid, where rho is [math]rho(pA[1/Pa],T[1/K])[kg/m^3][/math] How do I obtain this value? thank you Jesse

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Apr 22, 2016, 11:51 a.m. EDT
If you want to not only compute those integrals but also give them names so you can then perform operations on those integrals, such as including them in expressions (like the one for Cd, you'll need to use Definitions>Component Couplings>Integration instead of Derived Values>Integration. This will allow you to define an operator that performs the integration. By default, the first such operator will be called intop1, and you can then compute the integral of spf2.T_stressx with intop1(spf2.T_stressx) ; same for nx*(nx>0) .
If you've never used Component Couplings before, you may want to read the section on them in the Reference Manual first (Although Integration component couplings are pretty intuitive to use - I would not necessarily say the same of all types of component couplings).

You can see the function used for rho by browsing through to the appropriate node in the Materials branch of the Model Builder: this will let you see the mathematical expression used for that function. If you just want to know its value at its value at a particular temperature and pressure, you can just plot it in the Results branch, like you would any other quantity.

Best,
Jeff
If you want to not only compute those integrals but also give them names so you can then perform operations on those integrals, such as including them in expressions (like the one for Cd, you'll need to use Definitions>Component Couplings>Integration instead of Derived Values>Integration. This will allow you to define an operator that performs the integration. By default, the first such operator will be called intop1, and you can then compute the integral of spf2.T_stressx with intop1(spf2.T_stressx) ; same for nx*(nx>0) . If you've never used Component Couplings before, you may want to read the section on them in the Reference Manual first (Although Integration component couplings are pretty intuitive to use - I would not necessarily say the same of all types of component couplings). You can see the function used for rho by browsing through to the appropriate node in the Materials branch of the Model Builder: this will let you see the mathematical expression used for that function. If you just want to know its value at its value at a particular temperature and pressure, you can just plot it in the Results branch, like you would any other quantity. Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Apr 25, 2016, 5:22 a.m. EDT
Hi Jeff,
thank you for pointing out Component couplings.
I am using a global evaluation to try to evaluate

However, its not able to evaluate spf2.rho. Is this because temperature and pressure are locally different throughout the simulation? Can I use then another coupling to calculate the average density as follows?



The error is:
Variable: comp2.spf2.rho
- Global scope:
Failed to evaluate expression.
- Expression: real((comp2.intop1(comp2.spf2.T_stressx)*(-2))/(comp2.spf2.rho*(comp2.intop1(nx*(nx>0))*(V_inf^2))))

thank you
Jesse
Hi Jeff, thank you for pointing out Component couplings. I am using a global evaluation to try to evaluate [math]-2*intop1(spf2.T\_stressx)/(intop1(nx*(nx>0))*V\_inf*V\_inf*spf2.rho)[/math] However, its not able to evaluate spf2.rho. Is this because temperature and pressure are locally different throughout the simulation? Can I use then another coupling to calculate the average density as follows? [math]-2*intop1(spf2.T\_stressx)/(intop1(nx*(nx>0))*V\_inf*V\_inf*aveop1(spf2.rho))[/math] The error is: Variable: comp2.spf2.rho - Global scope: Failed to evaluate expression. - Expression: real((comp2.intop1(comp2.spf2.T_stressx)*(-2))/(comp2.spf2.rho*(comp2.intop1(nx*(nx>0))*(V_inf^2)))) thank you Jesse

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Apr 25, 2016, 8:32 a.m. EDT
Hello Jesse,

You are getting this error message because your expression for the global expression involves a quantity (rho) whose scope is not global: rho is a field, possibly taking on different values at different locations. As you noted earlier (in your post of 4/22), the density of air in your model is a function of pressure and temperature, which themselves may vary from point to point.

My interpretation of the formula in the Wikipedia link you provided at the start of the thread is that it involves the density of the incoming air, i.e. rho computed at ambient temperature and atmospheric pressure.

You could make COMSOL compute it for you by using an additional Component Coupling of the Integration type defined at a point where air is at those conditions. An Integration Component Coupling defined at a point returns the value of its argument at that point. Using for that Point Integration Component Coupling a point on your inlet should be suitable. Alternatively, you could simply plug into your expression an approximate value for the density of air at standard conditions, i.e. ~1.2[kg/m^3]. Yet another way of getting that number would be to, in your expression for Cd, call the underlying function with the proper arguments "manually fed in", i.e. something like comp1.mat1.def.rho(1[atm],293.15[K]) .

Best,
Jeff
Hello Jesse, You are getting this error message because your expression for the global expression involves a quantity (rho) whose scope is not global: rho is a field, possibly taking on different values at different locations. As you noted earlier (in your post of 4/22), the density of air in your model is a function of pressure and temperature, which themselves may vary from point to point. My interpretation of the formula in the Wikipedia link you provided at the start of the thread is that it involves the density of the incoming air, i.e. rho computed at ambient temperature and atmospheric pressure. You could make COMSOL compute it for you by using an additional Component Coupling of the Integration type defined at a point where air is at those conditions. An Integration Component Coupling defined at a point returns the value of its argument at that point. Using for that Point Integration Component Coupling a point on your inlet should be suitable. Alternatively, you could simply plug into your expression an approximate value for the density of air at standard conditions, i.e. ~1.2[kg/m^3]. Yet another way of getting that number would be to, in your expression for Cd, call the underlying function with the proper arguments "manually fed in", i.e. something like comp1.mat1.def.rho(1[atm],293.15[K]) . Best, Jeff

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.