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

Combining dynamicInkjetFvmesh with layeradditionremoval

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 13, 2020, 00:00
Default Combining dynamicInkjetFvmesh with layeradditionremoval
  #1
heo
New Member
 
heo
Join Date: Oct 2019
Posts: 3
Rep Power: 6
heo is on a distinguished road
hello everyone.

I am modifying the source code of dynamicInkejetFvmesh to implement piston motion.

One problem occurred during code development, which is that the top first grid in the domain area is loosened very long.

In order to solve this problem, I thought it would be desirable to add layers in the expanded grid, and I'm looking for ways to add layers using layeradditionremoval.c and movingconetopoFvMesh.c.

What I want is to add layers as the grid relaxes, although the domain shape is fixed.

The attached code is an update part of movingconetopoFvMesh.c. As far as I know, <mapPolyMesh> is a function that implements grid movement. I wonder if there is a way to create layers without changing the grid geometry.


Code:
bool Foam::movingConeTopoFvMesh::update()
  317 {
  318     // Do mesh changes (use inflation - put new points in topoChangeMap)
  319     autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(true);
  320 
  321     // Calculate the new point positions depending on whether the
  322     // topological change has happened or not
  323     pointField newPoints;
  324 
  325     vector curMotionVel_ =
  326         motionVelAmplitude_*
  327         Foam::sin(time().value()*M_PI/motionVelPeriod_);
  328 
  329     Pout<< "time:" << time().value() << " curMotionVel_:" << curMotionVel_
  330         << " curLeft:" << curLeft_ << " curRight:" << curRight_
  331         << endl;
  332 
  333     if (topoChangeMap.valid())
  334     {
  335         Info<< "Topology change. Calculating motion points" << endl;
  336 
  337         if (topoChangeMap().hasMotionPoints())
  338         {
  339             Info<< "Topology change. Has premotion points" << endl;
  340 
  341             motionMask_ =
  342                 vertexMarkup
  343                 (
  344                     topoChangeMap().preMotionPoints(),
  345                     curLeft_,
  346                     curRight_
  347                 );
  348 
  349             // Move points inside the motionMask
  350             newPoints =
  351                 topoChangeMap().preMotionPoints()
  352               + (
  353                     pos(0.5 - mag(motionMask_)) // cells above the body
  354                 )*curMotionVel_*time().deltaT().value();
  355         }
  356         else
  357         {
  358             Info<< "Topology change. Already set mesh points" << endl;
  359 
  360             motionMask_ =
  361                 vertexMarkup
  362                 (
  363                     points(),
  364                     curLeft_,
  365                     curRight_
  366                 );
  367 
  368             // Move points inside the motionMask
  369             newPoints =
  370                 points()
  371               + (
  372                     pos(0.5 - mag(motionMask_)) // cells above the body
  373                 )*curMotionVel_*time().deltaT().value();
  374         }
  375     }
  376     else
  377     {
  378         Info<< "No topology change" << endl;
  379         // Set the mesh motion
  380         newPoints =
  381             points()
  382           + (
  383                 pos(0.5 - mag(motionMask_)) // cells above the body
  384            )*curMotionVel_*time().deltaT().value();
  385     }
  386 
  387     // The mesh now contains the cells with zero volume
  388     Info << "Executing mesh motion" << endl;
  389     movePoints(newPoints);
  390     //  The mesh now has got non-zero volume cells
  391 
  392     curLeft_ = average
  393     (
  394         faceZones()
  395         [
  396             faceZones().findZoneID("leftExtrusionFaces")
  397         ]().localPoints()
  398     ).x() - SMALL;
  399 
  400     curRight_ = average
  401     (
  402         faceZones()
  403         [
  404             faceZones().findZoneID("rightExtrusionFaces")
  405         ]().localPoints()
  406     ).x() + SMALL;
  407 
  408 
  409     return true;
  410 }
Attached Images
File Type: jpg dynamicmesh.jpg (53.7 KB, 26 views)
heo is offline   Reply With Quote

Reply

Tags
dynamicfvmesh, movingconetopofvmesh

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[mesh manipulation] My layerAdditionRemoval demo Ilya Sivkov OpenFOAM Meshing & Mesh Conversion 9 October 8, 2019 09:53
dynamicInkJetFvMesh for motion in Y direction Thangam OpenFOAM Programming & Development 3 July 8, 2018 21:02
[mesh manipulation] how to set layerAdditionRemoval cctv OpenFOAM Meshing & Mesh Conversion 5 April 23, 2015 03:01
Error when combining mesh re-distribution with refinemt rribeiro OpenFOAM Programming & Development 0 March 24, 2015 14:47
[blockMesh] A script for combining two blockMeshDict yingfeng OpenFOAM Meshing & Mesh Conversion 0 August 26, 2009 16:05


All times are GMT -4. The time now is 05:48.