CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   SetFieldsDict file problem with 3D multiphase flow (http://www.cfd-online.com/Forums/openfoam-pre-processing/116349-setfieldsdict-file-problem-3d-multiphase-flow.html)

jeff_87 April 17, 2013 12:20

SetFieldsDict file problem with 3D multiphase flow
 
Hello,

I have the following problem using interFoam for a multiphase problem:

I want to simulate a 3D water droplet impact on a thin water layer.
The domain is a parallelepiped.
The thin layer has not a definite form (so I can't use for example BoxToCell to set the layer data on the domain), but I have all the data of alpha1 in the entire domain calculated in a previous simulation.

Alpha1 has all the values between 0 and 1.

My question is:

is there a way to write the data of alpha1 in the setFieldDict file?

Thanks

gschaider April 22, 2013 16:18

Quote:

Originally Posted by jeff_87 (Post 421264)
Hello,

I have the following problem using interFoam for a multiphase problem:

I want to simulate a 3D water droplet impact on a thin water layer.
The domain is a parallelepiped.
The thin layer has not a definite form (so I can't use for example BoxToCell to set the layer data on the domain), but I have all the data of alpha1 in the entire domain calculated in a previous simulation.

Alpha1 has all the values between 0 and 1.

My question is:

is there a way to write the data of alpha1 in the setFieldDict file?

If I understand you correctly: No. But there are two ways to get the solution from one case into another:
- if both simulations use the same mesh then you only need to copy over the alpha1-file into the 0-directory of the new case and you're done
- if they have different meshes you can use the mapFields-utility to map the old solution onto the new grid.

jeff_87 April 29, 2013 07:30

Thank you so much for the reply Mr. Gschaider

The mesh-grid is the same for both the simulations.

I had just done the step you suggested to do ("if both simulations use the same mesh then you only need to copy over the alpha1-file into the 0-directory of the new case and you're done"), but unfortunately in this case I want to add water droplets to the domain composed by the only liquid thin layer. To add the droplets I have to give the command setFields that reads the setFieldsDict-file in which I created the droplets and in such file I can't write the alpha1 water layer existing domain because it has not a definite form.

So the only way to write exactly this file is to modify the existing alpha1-file but I think it is impossible.

Thank you so much for your reply

Mahdi2010 April 29, 2013 08:45

Quote:

Originally Posted by jeff_87 (Post 423823)
Thank you so much for the reply Mr. Gschaider

The mesh-grid is the same for both the simulations.

I had just done the step you suggested to do ("if both simulations use the same mesh then you only need to copy over the alpha1-file into the 0-directory of the new case and you're done"), but unfortunately in this case I want to add water droplets to the domain composed by the only liquid thin layer. To add the droplets I have to give the command setFields that reads the setFieldsDict-file in which I created the droplets and in such file I can't write the alpha1 water layer existing domain because it has not a definite form.

So the only way to write exactly this file is to modify the existing alpha1-file but I think it is impossible.

Thank you so much for your reply

I am not sure if I really understand what you mean. I think you are looking for a command to help you define the location of alpha=1 elements inside the alpha=0 domain, without using BoxToCell. am I right?

jeff_87 April 29, 2013 09:35

Exactly.

My initial domain is a cubic biphase domain in which there are only air (alpha=0), a water layer (alpha=1) and the interface between air and water (0<alpha<1).

This domain is the ending domain of a previous simulation.
At the starting of the previous simulation the water layer was exactly a box, so I used BoxToCell.
Now, at the end of the previous simulation the water layer is similar to but not exactly a box and so I can't use BoxToCell.

Moreover, In this condition I have to add one droplet with the command SphereToCell, but it is not a problem.

Mahdi2010 April 29, 2013 09:57

I have more or less the same problem, what if we use "zoneToCell"?
I mean what would happen if we define the non-cubic area as a region in the blockmeshDict
and in the setFielddict use zoneToCell to mention this area?

gschaider April 29, 2013 12:22

Quote:

Originally Posted by jeff_87 (Post 423823)
Thank you so much for the reply Mr. Gschaider

The mesh-grid is the same for both the simulations.

I had just done the step you suggested to do ("if both simulations use the same mesh then you only need to copy over the alpha1-file into the 0-directory of the new case and you're done"), but unfortunately in this case I want to add water droplets to the domain composed by the only liquid thin layer. To add the droplets I have to give the command setFields that reads the setFieldsDict-file in which I created the droplets and in such file I can't write the alpha1 water layer existing domain because it has not a definite form.

So the only way to write exactly this file is to modify the existing alpha1-file but I think it is impossible.

Thank you so much for your reply

Don't know if I missunderstand you, but why not copy over and then ADD the droplet/sphere with setFields. If setFields can't do that then I'd suggest funkySetFields. That CAN do that

mgdenno April 29, 2013 13:42

I just read through this thread quick, but I think one thing that hasn't been mentioned is that, I think you would have to make sure you remove the entry:
Code:

defaultFieldValues
(
    volScalarFieldValue alpha1 0
);

So that you don't remove the results from the previous model run. I haven't done this but it would seem to be the case.

jeff_87 April 30, 2013 05:40

@ gschaider:

I tried to do this, but when I add the droplet with setFields, it deletes the existing alpha1 field and sets just the droplet.

@ mgdenno:

Yes, in fact I tried to delete defaultFieldValues in the setFieldsDict-file but it gives me an error when I use setFields.
I think there should be a voice, something like MappedFieldValues or something similar with which I can give the existing alpha1 field in the setFieldsDict-file and then, in the same file, I can add the droplet with SphereToCell, but unfortunately I can't find this term.

gschaider April 30, 2013 07:21

Quote:

Originally Posted by jeff_87 (Post 424103)
@ gschaider:

I tried to do this, but when I add the droplet with setFields, it deletes the existing alpha1 field and sets just the droplet.

@ mgdenno:

Yes, in fact I tried to delete defaultFieldValues in the setFieldsDict-file but it gives me an error when I use setFields.
I think there should be a voice, something like MappedFieldValues or something similar with which I can give the existing alpha1 field in the setFieldsDict-file and then, in the same file, I can add the droplet with SphereToCell, but unfortunately I can't find this term.

I'm rather inflexible and add the droplet with
Code:

funkySetFields -time 0 -field alpha1 -keepPatches -condition "mag(pos()-vector(0,0,1))<0.1" -expression "1"
to an existing alpha1-file (that'd be a droplet with radius 0.1 and center (0,0,1) ). But I acknowledge that just because it is easier for me it is not necessarily so for everyone (especially as every machine I touch gets soiled with swak4Foam anyway)

mgdenno April 30, 2013 21:39

1 Attachment(s)
For completeness, commenting out just what is inside the brackets:
Code:

defaultFieldValues
(
    //volScalarFieldValue alpha1 0
);

seems to do what you were looking for.

The attached picture is running setFields on the damBreak case after 0.5 seconds.

jeff_87 May 3, 2013 07:20

@ mgdenno

YES!!!! That's the solution!!! So easy!!!

Thank you so much!!

@ gshaider

Thank you very much for the precious advices.
funkySetFields is a good way to solve these kind of problems but I never used it. Now is the time to learn this function.

Thank you


All times are GMT -4. The time now is 21:41.