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/)
-   -   How to cell field values to cells in setFields (https://www.cfd-online.com/Forums/openfoam-solving/182947-how-cell-field-values-cells-setfields.html)

upuli January 23, 2017 02:22

How to cell field values to cells in setFields
 
Dear members

I want to know how to set the field values to cells using setFields. I used cellToCell in setFields. but it gives me errors.


Thanking You

rgds

Upuli

floquation January 23, 2017 03:55

I do not understand what you want to achieve / you specify to little information. It always helps to post what exactly you tried to clarify your problem.

This is an example of a setFieldDict that I am using to initiate a spherical bubble in interFoam:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  4.0                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues
(
    volScalarFieldValue alpha.water 1
);

regions
(
    sphereToCell
    {
        centre (0.0025 0.0025 0.001);
        radius 0.0005;
        fieldValues
        (
            volScalarFieldValue alpha.water 0
        );
    }
 );


// ************************************************************************* //


upuli January 23, 2017 10:04

Thank you very much for your prompt reply. I want to define some field values for one cell in my geometry(box). I think cellToCell in setFields will do that. But I do not how to use it(which parameters are required in defining the cell)

Thanks

floquation January 23, 2017 10:32

And how do you wish to select that one cell? The answer will depend on that.

Some other ideas:
1) Use boxToCell with a tiny box around the cell you wish to select.
2) Create a set based on the cell indices and then use cellToCell***
3) funkySetFields can use an arbitrary expression to select cells.


***cellToCell says (${FOAM_SRC}/meshTools/sets/cellSources/cellToCell):
Code:

27 Description
 28    A topoSetSource to select the cells from another cellSet.

And needs the dictionary entry "set":
Code:

76    setName_(dict.lookup("set"))


All times are GMT -4. The time now is 09:13.