CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Moving obstacle (translation) in a channel (https://www.cfd-online.com/Forums/openfoam-solving/109913-moving-obstacle-translation-channel.html)

Gloq November 29, 2012 12:18

Moving obstacle (translation) in a channel
 
Hi guys,

I would like to model the "simple" case of an obstacle (a parallelepiped) translating along a channel.

As the channel is quite long, I would like to change the topology of the mesh during the computation.

How would you do that ? Which dynamic class to call in dynamicMeshDict ?

I searched a little bit and it seems that the only way is to use movingConeTopoFvMesh class and to modify it deeply, according to my needs.
Nevertheless, I found documents on Internet mentioning other classes such as LinearValveLayersFvMesh and LinearValveFvMesh which seem to rely on sliding interface between a master and a slave mesh. Using this kind of class appears easier, but they look like desactivated in version 2.1.1. of openFOAM.

Did some of you manage to use these classes recently ?
If yes, what do you think about them ?

Thanks in advance for your support.

danvica December 24, 2012 09:20

I'm facing the same problem. Did you find something ?

danvica December 24, 2012 11:48

2 Attachment(s)
Some more information regarding my case.

Gloq, tell me if your meshing problem is different, I'll move this post in a new thread.

Simple configuration:
A sphere inside a pipe. Mesh obtained by SHM.

In few words: I want to see the sphere pushed away by the flow.


Here are the setup.

ControlDict:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pimpleDyMFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 50;
deltaT 0.001;
writeControl adjustableRunTime;
writeInterval 0.02;
purgeWrite 0;
writeFormat ascii;
writePrecision 10;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 5;
maxDeltaT 0.01;
libs
(
"libOpenFOAM.so"
"libincompressibleRASModels.so"
"libfvMotionSolvers.so"
"libforces.so"
);
functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so");
outputControl timeStep;
outputInterval 10;
patches (oggetto);
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1000;
CofR (0 0 0);
}
}
// ************************************************************************* //

dynamicMeshDict
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object motionProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ("libfvMotionSolvers.so");
solver displacementLaplacian;
diffusivity inverseDistance (oggetto);
 
// ************************************************************************* //

pointDisplacement
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class pointVectorField;
location "0.01";
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 0 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
wall
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type fixedValue;
value uniform (0 0 0);
}
outlet
{
type fixedValue;
value uniform (0 0 0);
}
oggetto
{
type sixDoFRigidBodyDisplacement;
centreOfMass (0 0 0.2);
momentOfInertia (0.000001 0.000001 0.000001);
mass 0.01;
rhoName rhoInf;
rhoInf 1000;
report on;
value uniform (0 0 0);
}
}
 
// ************************************************************************* //


Everything is fine within the limit of dynamicMotionSolverFvMesh approximation (small mesh movements).

Enclosed you can find some pictures.

I hoped to solve the problem just replacing "dynamicMotionSolverFvMesh" with another solver name... it's christmas, tell me I'm right :).

Thanks !

wyldckat December 24, 2012 12:46

Greetings to all!

@Daniele: I'm unable to help much on this, but the following details might help you:
  • From http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2007/:
    Quote:

    A tutorial on how to use Dynamic Mesh solver IcoDyMFoam, by Pirooz Moradnia:
    Report, Presentation, Case
    The report gives a very good review of the types of dynamic meshes that are possible to use, although some might be related to 1.4.1-dev.
  • The tutorial "multiphase/interDyMFoam/ras/damBreakWithObstacle" might be of greater help on this! It additionally refines the mesh where the interface between air and water, which is rather awesome to see!
Best regards and Merry Xmas!
Bruno

deepsterblue December 25, 2012 21:31

If you can stick to tetrahedral meshes, the dynamicTopoFvMesh class should be able to do it. Here's a remeshing example:

IC Engine re-meshing

You can find the repository here:
https://github.com/smenon/dynamicTopoFvMesh

danvica December 26, 2012 03:50

Thanks to all.

@deepsterblue: I started to dream of that movie several days ago...:) Even if I'm used to SHM hex mesh I'll try it, many thanks !

@Bruno: I had already read the document you suggested but togheter with many other. Thanks for focus me on this. I'll go deep into topoChangerFvMesh class.

The damBreakWithObstacle case is really interesting but I don't think it's what I need. Do I ?

I also found a very good step by step guide regarding moving (rotating in this case) an object: http://www.cfd-online.com/Forums/ope...gear-pump.html.

I still don't know if a similar approach can be used to generalize moving mesh cases, even in problems where the motion of an object is caused by the fluid.

For example, applied to my above simple case:
- Use dynamicMotionSolverFvMesh to solve the case until the quality of the mesh is degrading too much (Q: how much & how ?)
- Fix the above mesh (Q: how to remesh it ?) remapping the previous solution.
- Repeat the cycle.

For sure it won't be an efficient way to solve a particular problem because of the calculation cost of remeshing everything every few iterations but at least it would be general. Can this be done ?

Thanks,
Daniele

danvica December 26, 2012 04:46

BTW what is rawTopoChangerFvMesh ?

I'm looking at the code but... well any help would be really appreciated.

Thanks.

danvica December 27, 2012 03:19

@deepsterblue:
Can I install it even if I use OF 2.1 ? Or should I use an extended release ?

Thanks.

deepsterblue December 27, 2012 08:40

It should work with OpenFOAM-2.1.x - take a look at the Port-2.1.x branch of the repository.

Once you have the repository checked out, do this:

git checkout Port-2.1.x

There are install instructions posted for the compile process with 2.1.x in the Install.txt for that branch

danvica December 27, 2012 11:31

Many thanks. It will ll be a little more complicated because I'm working with a Windows porting of OF but it'll be done.

I just want to point out this good paper:
DYNAMIC MESH HANDLING IN OPENFOAM APPLIED TO
FLUID-STRUCTURE INTERACTION SIMULATIONS

(http://www.google.it/url?sa=t&rct=j&...55534169,d.bGE)

It clarifies different dynamic mesh approaches in a clear way.

BTW: Compliment to Mr. Menon !

Now I just have to re-evaluate tet-meshes vs. hex-meshes performances.

Regards,

danvica December 31, 2012 05:38

Ops, this is the right link:

http://www.google.it/url?sa=t&rct=j&...55534169,d.ZG4

mturcios777 December 31, 2012 10:59

In response to the original poster, moving a parallelopiped can be done by using the layerAdditionRemoval polyTopoChanger. I've tried using rawTopoChangerFvMesh, but I think that is a generic class you can copy and use to implement topology changes. When making a new topoChanger class, I like to proceed like this:

1. Identify what operations need to be done to change the mesh (cell/face/point addition or removal etc)

2. See what polyTopoChanger (in dynamicMeshDict) will perform the operation most efficiently (granted the documentation for these isn't stellar, you may have to do some digging. A quick summary of two
- layerAdditionRemoval: creates or destroys a layer of cells adjacent to a specifies faceZone based on the minimum/maximum thickness of that layer. Only works with simply connected surfaces with minimal warping (fairly consistent face normal). Can be used when a surface is translating and we don't want the cell aspect ratio to change
- attachDetach: switches a set of internal faces to a pair of boundary patches to created internal walls. Can be used to make valves which can be actuated according to times or to other criteria
- hexRef8: refinement of hexahedral meshes; see dynamicRefineFvMesh

3. If possible, find an existing fvMesh class that implements the polyTopoChanger and modify

Otherwise, take rawTopochangerFvMesh and get to work.

Good luck!

ziemowitzima January 28, 2013 17:24

Hi,
I am currently trying to solve problem with solution dependent mesh.
In short, I have to change shape of one boundary of the mesh every time step by using information from previous time step.
So I dont know how the mesh (boundary of the mesh) is going to behave a priori.

Do you know how should I attack this problem ?

Thanks
ZMM

mturcios777 January 28, 2013 17:59

This sounds like (or is at least related to) fluid structure interaction. Do a search for FSI and you should be able to find useful links.

jcab July 2, 2013 10:47

Hello everyone,

I tried to follow the advice of Marco: I modified solidBodyMotionFvMesh file in order to call rawTopoChangerFvMesh. The modification are:

In solidBodyMotionFvMesh.H, in private data: rawTopoChangerFvMesh topoChanger_

In solidBodyMotionFvMesh.C:
In constructor: topoChanger_(io),
In members functions: topoChanger_.update();

When I Run moveDynamicMesh, I see the mesh moving, and cells at the entry and the exit of the channel are stretching and squeezing, but no layer is created. After some iterations, moving cell are even overlapping the others. It gives me the feeling that layer addition/removal is not taken into account. Nevertheless, when I modify the file constant/meshModifiers by giving negative value for thickness, for example, I have an error message. So that is in contradiction with my first feeling !

Did someone know what I am doing wrong ?

Thanks !

mturcios777 July 2, 2013 11:23

How do you initialize the polyTopoChange? I'm just wondering if the layerAdditionRemoval was created, and if the request to update is sent every time.

jcab July 3, 2013 03:27

Hi Marco, thanks for your reply !

I didn't change anything about the poyTopoChange: rawTopoChangerFvMesh calls topoChangerFvMesh, which calls polyTopoChanger, which calls polyTopoChange (correct me if I'm wrong). I only specify in the meshModifiers file that I want layerAdditionRemoval, and the parameters needed (thickness...)

mturcios777 July 3, 2013 11:30

Have you specified the faceZones where you want layers added/removed? I'm curious if rawTopoChangerFvMesh can create the appropriate given a properly defined meshModifiers file.

jcab July 3, 2013 11:42

Yes, I have created 2 faceZones that I specify in the meshModifiers.

mturcios777 July 3, 2013 11:45

What happens if you define one of the layerAdditionRemoval modifiers incorrectly? Please post the error message from your solver.

jcab July 3, 2013 11:51

If I make a mistake in the name of a faceZone, I have this message:

--> FOAM FATAL ERROR:
Master face zone named layerPoss cannot be found.

From function void Foam::layerAdditionRemoval::checkDefinition()
in file layerAdditionRemoval/layerAdditionRemoval.C at line 64.

FOAM aborting

mturcios777 July 3, 2013 12:19

Hmm, interesting. I didn't know rawTopoChangerFvMesh created the required. Though I wonder if updateMesh is being called correctly since the constructor isn't explicit. Can you run the properly formatted case with the global debug flag for layerAdditionRemoval and post the log? Thanks.

kclement1993 April 9, 2019 08:32

Quote:

Originally Posted by mturcios777 (Post 399541)
In response to the original poster, moving a parallelopiped can be done by using the layerAdditionRemoval polyTopoChanger. I've tried using rawTopoChangerFvMesh, but I think that is a generic class you can copy and use to implement topology changes. When making a new topoChanger class, I like to proceed like this:

1. Identify what operations need to be done to change the mesh (cell/face/point addition or removal etc)

2. See what polyTopoChanger (in dynamicMeshDict) will perform the operation most efficiently (granted the documentation for these isn't stellar, you may have to do some digging. A quick summary of two
- layerAdditionRemoval: creates or destroys a layer of cells adjacent to a specifies faceZone based on the minimum/maximum thickness of that layer. Only works with simply connected surfaces with minimal warping (fairly consistent face normal). Can be used when a surface is translating and we don't want the cell aspect ratio to change
- attachDetach: switches a set of internal faces to a pair of boundary patches to created internal walls. Can be used to make valves which can be actuated according to times or to other criteria
- hexRef8: refinement of hexahedral meshes; see dynamicRefineFvMesh

3. If possible, find an existing fvMesh class that implements the polyTopoChanger and modify

Otherwise, take rawTopochangerFvMesh and get to work.

Good luck!


Can you demostrate a simple case that using the utility of rawTopochangerFvmesh calss??


Thanks a lot!

regards,

James.


All times are GMT -4. The time now is 01:35.