CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Write drag coefficient out from the drag model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 2, 2023, 01:44
Default Write drag coefficient out from the drag model
  #1
New Member
 
ZP zhao
Join Date: Oct 2023
Location: China
Posts: 7
Rep Power: 3
ZX-zha is on a distinguished road
Hello, everyone!
I wrote a drag model, and i want to write the calculated coefficient to the file like the velocity or pressure file does.
So I wrote down:
Code:
    volScalarField KD
    (
        IOobject
        (
            "KD",
            mesh.time().timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::MUST_WRITE
        ),
        mesh,
        dimensionedScalar("zero",dimDensity*dimLength*dimVelocity/dimArea,0.0),
        relativeHeight_.boundaryField().types()
    );
But it dsn't work, what should i do?
ZX-zha is offline   Reply With Quote

Old   November 3, 2023, 12:18
Default
  #2
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
Hi ZX-zha,

I think you should give us more information about your procedures!!!
Make it more clear.
saeed jamshidi is offline   Reply With Quote

Old   November 5, 2023, 05:53
Default
  #3
New Member
 
ZP zhao
Join Date: Oct 2023
Location: China
Posts: 7
Rep Power: 3
ZX-zha is on a distinguished road
Hello, saeed jamshidi:
More specifically, I want to export the drag coefficient to a file in each time step like the ordinary variables p or U.
But i don't know how to get the drag coefficient in the program. Can anyone help me?
ZX-zha is offline   Reply With Quote

Old   November 5, 2023, 06:12
Default
  #4
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 8
saeed jamshidi is on a distinguished road
simply add the attached file into your system folder, and call it in controlDict/function as below:

Code:
functions
{

    #include "forceCoeffs"

}
care about format of forceCoeffs.txt

next, adapt contents of the forceCoeffs based on your problem.

this will create postprocess folder, which contains drag and lift data.

If you have any further question, please let me know.

Best,
Saeed
Attached Files
File Type: txt forceCoeffs.txt (1.4 KB, 2 views)
saeed jamshidi is offline   Reply With Quote

Old   November 6, 2023, 01:43
Default
  #5
New Member
 
ZP zhao
Join Date: Oct 2023
Location: China
Posts: 7
Rep Power: 3
ZX-zha is on a distinguished road
Thank you very much for your advice. That helped a lot.
ZX-zha is offline   Reply With Quote

Reply

Tags
output


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
Simulation of a single bubble with a VOF-method Suzzn CFX 21 January 29, 2018 01:58
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 15:32
problem with saving drag coefficient colopolo FLUENT 5 April 12, 2013 11:59
Drag coefficient for parcels in dieselFoam sebastian_vogl OpenFOAM Running, Solving & CFD 5 December 31, 2008 13:19
Automotive test case vinz OpenFOAM Running, Solving & CFD 98 October 27, 2008 09:43


All times are GMT -4. The time now is 06:46.