CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

how to create tapered cylinder with topoSet

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 19, 2019, 21:48
Default how to create tapered cylinder with topoSet
  #1
New Member
 
Honey
Join Date: Mar 2011
Location: Dmg
Posts: 23
Rep Power: 15
Honey is on a distinguished road
Hi,

I am willing to create a tapered cylinder in middle of a box with using topoSetDict. I know that is not implemented in OpenFOAM and requires some modification into cylinderToCell.C code located at .../src/meshTools/sets/cellSources/cylinderToCell. Nevertheless, I tried to modify the main function written in cylinderToCell.C from:
void Foam::cylinderToCell::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const scalar rad2 = sqr(radius_);
const scalar magAxis2 = magSqr(axis);
const pointField& ctrs = mesh_.cellCentres();

forAll(ctrs, cellI)
{
vector d = ctrs[cellI] - p1_;
scalar magD = d & axis;

if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
if (d2 < rad2)
{
addOrDelete(set, cellI, add);
}}}}

to:

void Foam::taperedCylinderToCell::combine(topoSet& set, const bool add) const
{
const vector axis = p2_ - p1_;
const scalar radBase2 = sqr(radiusBase_); //**modified
const scalar radTop2 = sqr(radiusTop_); //**added
const scalar magAxis2 = magSqr(axis);
const pointField& ctrs = mesh_.cellCentres();

forAll(ctrs, cellI)
{
vector d = ctrs[cellI] - p1_;
scalar magD = d & axis;

if ((magD > 0) && (magD < magAxis2))
{
scalar d2 = (d & d) - sqr(magD)/magAxis2;
if ((d2 < radBase2) && (d2 > radTop2)) //**modified
{
addOrDelete(set, cellI, add);
}}}}

Obviously, it generated a hollow cylinder instead of a tapered cylinder I would highly appreciate if anyone here could help me to successfully modify this piece of code!

Thank you in advance
Honey is offline   Reply With Quote

Reply

Tags
taperedcylindertocell


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
[blockMesh] Creating a tapered cylinder tanveerfathima OpenFOAM Meshing & Mesh Conversion 1 December 4, 2018 06:22
Flow through small cylinder recirculated inside larger cylinder. Keesie FLUENT 1 July 28, 2016 04:30
Forces Acting on a Rotating Cylinder (Moving Mesh) dreamchaser CFX 5 April 25, 2015 06:01
[snappyHexMesh] Create cylinder around snappyHexMesh for MRF/rotating linnemann OpenFOAM Meshing & Mesh Conversion 6 October 19, 2014 23:19
[snappyHexMesh] How to create an open cylinder using FreeCAD meng9019 OpenFOAM Meshing & Mesh Conversion 3 March 14, 2014 08:24


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