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/)
-   -   Dynamic Mesh Refinement + twoLiquidMixingFoam (https://www.cfd-online.com/Forums/openfoam-solving/187661-dynamic-mesh-refinement-twoliquidmixingfoam.html)

ashama May 12, 2017 02:43

Dynamic Mesh Refinement + twoLiquidMixingFoam
 
Good morning

I am working with a model for microfluidic mixing using the twoLiquidMixingFoam solver. I am curious to know if there is a way to implement the dynamicMesh with this solver. I need to improve the quality of my soultion without having to use a very fine and unreasonable mesh. Is there some tutorials around about this?

Thanks :)

floquation May 12, 2017 02:50

I do not know of any tutorials on how to do that.

However, if you simply open both interFoam and interDyMFoam and your "twoLiquidMixingDyMFoam" solver, then by direct comparison between interFoam and interDyMFoam you should be able to implement it into your "twoLiquidMixingDyMFoam".

(The only difference between interFoam and interDyMFoam is the "DyM" part: dynamic mesh.)

ashama May 15, 2017 09:27

Quote:

Originally Posted by floquation (Post 648566)
I do not know of any tutorials on how to do that.

However, if you simply open both interFoam and interDyMFoam and your "twoLiquidMixingDyMFoam" solver, then by direct comparison between interFoam and interDyMFoam you should be able to implement it into your "twoLiquidMixingDyMFoam".

(The only difference between interFoam and interDyMFoam is the "DyM" part: dynamic mesh.)

Thanks for this info, I will try to do it and if I managed I will back to posted it here.

I need yr help in another question.

Do you know a way to do dynamicMeshRefinement and solidBodyMotionFvMesh at the same time, I mean I want to move a part of the Mesh plus refining the mesh for alpha field at the same time, if you know a tutorial or a previous post about this since I am drowned in searching w/o a useful result.

Thanks, have a nice day :)

floquation May 16, 2017 03:06

Quote:

Originally Posted by ashama (Post 648928)
I need yr help in another question.

Do you know a way to do dynamicMeshRefinement and solidBodyMotionFvMesh at the same time, I mean I want to move a part of the Mesh plus refining the mesh for alpha field at the same time, if you know a tutorial or a previous post about this since I am drowned in searching w/o a useful result.

I'm sorry, but no, I have not seen such a thing before.
Evidently, that does not mean it does not exist, as I simply have never used/searched for solidBodyMotionFvMesh.

When I quickly look at interDyMFoam, I see that the following mesh methods are called:
Code:

mesh.update() // calculate mesh motion in the child (so dynamicRefineFvMesh or solidBodyMotionFvMesh)
mesh.changing() // implemented by polyMesh, returns "true" if the mesh changed

// And just some getters:
mesh.C()
mesh.Cf()
mesh.Sf()

In other words, it's all about mesh.update().

Now, if you wish to combine them, there is one hurdle to overcome: your simulation uses only one mesh.
You could create a wrapper class like:
Code:

class wrapperFvMesh : public dynamicFvMesh
{

private :
    dynamicRefineFvMesh refineMesh;
    solidBodyMotionFvMesh motionMesh;

public:
    bool update(){
        motionMesh.update()
        refineMesh.update()
    }

    // And a constructor and whatever you need ...

}

to simply pass the update() call to both meshes.
However, the problem is that those will be two different meshes, which are also different than your wrapperFvMesh.
Therefore, this will not work...
After all, your simulation will use wrapperFvMesh, which will never be updated!

In other words, the only way to combine them, is to break them down first.
I'd take all methods of dynamicRefineFvMesh to myDynamicRefineFvMeshMethods which is a new class that does not inherit from dynamicFvMesh. That is, it should not be a mesh object.
Rather, all methods should take the actual mesh (which would be your wrapperFvMesh) as an argument; or set a pointer in the constructor of the my...Methods class.
Now, if you do the same for solidBodyMotionFvMesh, you will end up with two calculator classes that can apply the calculations to the same mesh: your wrapperFvMesh.

In the end, all you have to change then is all references to "*this" should become "*mesh"..., because "*this" is no longer the mesh, but your mesh-pointer will be.
Then, any calls to mesh methods, should be forwarded to your mesh pointer.
It will be a challenge, but that way it should be quite feasible.
I strongly recommend using an IDE (e.g.: [1] [2]) for making such changes, as it will be able to tell you immediately which are the "mesh methods" that you should forward etc.

Bodo1993 March 1, 2020 18:28

Dear ashama,

Greetings. I am wondering if you managed to add dynamic mesh to the twoLiquidMixingFoam solver.

Looking forward to hearing from you. Thanks.

Bodo1993 March 17, 2020 18:10

Quote:

Originally Posted by Bodo1993 (Post 760065)
Dear ashama,

Greetings. I am wondering if you managed to add dynamic mesh to the twoLiquidMixingFoam solver.

Looking forward to hearing from you. Thanks.

Hi,
I am wondering if any got the chance to compile a dynamic mesh to twoLiquidMixingFoam.
Thanks

Bodo1993 September 14, 2020 08:02

Hi, I am wondering if you managed to integrate dynamic meshing to twoLiquidMixingFoam. I want to study the effect of dragging a solid wall from a fluid domain. Thanks.


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