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

Drag coefficient at each time interval for different obstacles

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 12, 2022, 10:49
Default Drag coefficient at each time interval for different obstacles
  #1
VVN
New Member
 
Vijay
Join Date: Feb 2020
Posts: 7
Rep Power: 6
VVN is on a distinguished road
Hello All,

I want to calculate drag coefficient at each time step on front face of each obstacle (here 6 buildings). Here is my blockMesh file

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
    (0 0 0)
    (200 0 0)
    (200 150 0)
    (0 150 0)
    (0 0 250)
    (200 0 250)
    (200 150 250)
    (0 150 250)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (50 50 50) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    atmosphere
    {
        type patch;
        faces
        (
            (4 5 6 7)
        );
    }
    bottom
    {
        type wall;
        faces
        (
            (0 3 2 1)
        );
    }
    left
    {
        type cyclic;
        neighbourPatch    right;
        faces
        (
            (0 4 7 3)
        );
    }
    right
    {
        type cyclic;
        neighbourPatch    left;
        faces
        (
            (2 6 5 1)
        );
    }
    entry
    {
        type wall;
        faces
        (
            (1 5 4 0)
        );
    }
    exit
    {
        type patch;
        faces
        (
            
            (3 7 6 2)
        );
    }
    building
    {
        type wall;
        faces
        (
        );
    }
);

mergePatchPairs
(
);

// ************************************************************************* //

I am able to remove solid domain (buildings) using toposet. Here is toposet file -

Code:
 /*--------------------------------*- C++ -*----------------------------------*\
    =========                 |
    \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
     \\    /   O peration     | Website:  https://openfoam.org
      \\  /    A nd           | Version:  7
       \\/     M anipulation  |
  \*---------------------------------------------------------------------------*/
  FoamFile
  {
      version     2.0;
      format      ascii;
      class       dictionary;
      object      topoSetDict;
  }
  
  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  
  actions
  (
      {
          name    c0;
          type    cellSet;
          action  clear;
      }
      {
          name    c0;
          type    cellSet;
          action  invert;
      }
 
      {
          name    c0;
          type    cellSet;
          action  delete;
          source  boxToCell;
          sourceInfo
          {
          boxes
          (			( 35 50 0 ) ( 65 70 80 )
 			( 85 50 0 ) ( 115 70 80 )
 			( 135 50 0 ) ( 165 70 80 )
 			( 35 100 0 ) ( 65 120 80 )
 			( 85 100 0 ) ( 115 120 80 )
 			( 135 100 0 ) ( 165 120 80 )
         );
         }
     }
     
);

// ************************************************************************* //
But could you please tell me how to proceed further? I have simulated the results and now want to extract drag coefficient.

To try out, I added forcecoeff function in controldict file.

Code:
functions
{
forceCoeffs1
{
    // Mandatory entries
    type            forceCoeffs;
    libs            ("libforces.so");
    patches         (building);


    // Optional entries

    // Field names
    p               p;
    U               U;
    rho             rho;
    rho         rhoInf;
    rhoInf      1000;

    // Reference pressure [Pa]
    pRef            0;

    // Include porosity effects?
    porosity        no;

    // Store and write volume field representations of forces and moments
    writeFields     yes;

    // Centre of rotation for moment calculations
    CofR            (0 0 0);

    // Lift direction
    liftDir         (0 0 1);

    // Drag direction
    dragDir         (0 1 0);

    // Pitch axis
    pitchAxis       (1 0 0);

    // Freestream velocity magnitude [m/s]
    magUInf         30;

    // Reference length [m]
    lRef            80;

    // Reference area [m2]
    Aref            2400;

    // Spatial data binning
    // - extents given by the bounds of the input geometry
    binData
    {
        nBin        20;
        direction   (0 1 0);
        cumulative  yes;
    }
}
}

// ************************************************************************* //
But here for patching I used 'building' patch which contains all my 6 buildings and this gives wrong results. I want to have drag coefficient for each building. So I will be require to have 6 different patches, if I am correct.

Could anyone tell me how can I create patch for front face of each building which was deleted from topoSet? How can I use createPatch here? And if anyone has different approach, let me know.

Thank you in advance : )
VVN is offline   Reply With Quote

Reply

Tags
createpatchdict, forcecoeffs, interfoam, toposetdict


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
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 08:09
Problem with an old Simulation FrankW CFX 3 February 8, 2016 05:28
same geometry,structured and unstructured mesh,different behaviour. sharonyue OpenFOAM Running, Solving & CFD 13 January 2, 2013 23:40
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 05:03
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


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