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/)
-   -   Time varying velocity inlet boundary conditions using TableFile.H (https://www.cfd-online.com/Forums/openfoam-solving/149213-time-varying-velocity-inlet-boundary-conditions-using-tablefile-h.html)

pruthvi1991 February 27, 2015 15:22

Time varying velocity inlet boundary conditions using TableFile.H
 
1 Attachment(s)
Hello everybody,

I want to give time varying velocity BC at the inlet, top and bottom as v = v*sin(w*t) for an accelerating frame of reference problem.

My topAndBottom BC looks like this:

Code:

topAndBottom
{
        type uniformFixedValue;
        uniformValue tableFile;
        tableFileCoeffs
        {
            dimensions          [0 1 -1 0 0]; // optional dimensions
            fileName          "/home/jujja/OpenFOAM/root-2.3.x/run/tutorials/incompressible/pimpleDyMFoam/onemeterplate/coarseMesh/pimpleFoam_heavingframe/data/dataFile";    // name of data file
            outOfBounds        repeat;      // optional out-of-bounds handling
            interpolationScheme linear;      // optional interpolation method
        };
}

My dataFile looks as follows

Quote:

(
0 (0.025 0.0 0)
0.1 (0.025 0.00313333083911 0)
0.2 (0.025 0.00621724717912 0)
0.3 (0.025 0.00920311381712 0)
. . . . .
);
Here is the description found on the OpenFOAM github. TableFile.H

Code:

    Templated table container data entry where data is read from file.
    \verbatim
        <entryName>  tableFile;
        tableFileCoeffs
        {
            dimensions          [0 0 1 0 0]; // optional dimensions
            fileName            dataFile;    // name of data file
            outOfBounds        clamp;      // optional out-of-bounds handling
            interpolationScheme linear;      // optional interpolation method
        }
    \endverbatim
    Items are stored in a list of Tuple2's. First column is always stored as
    scalar entries.  Data is read in the form, e.g. for an entry \<entryName\>
    that is (scalar, vector):
    \verbatim
        (
            0.0 (1 2 3)
            1.0 (4 5 6)
        );
    \endverbatim

When I ran the case I'm getting an error at the end of decomposePar. Full file is attached Attachment 37463

Quote:

--> FOAM FATAL IO ERROR:
Expected a '(' while reading Tuple2, found on line 2 the label 0

file: /home/jujja/OpenFOAM/root-2.3.x/run/tutorials/incompressible/pimpleDyMFoam/onemeterplate/coarseMesh/pimpleFoam_heavingframe/data/dataFile at line 2.

From function Istream::readBegin(const char*)
in file db/IOstreams/IOstreams/Istream.C at line 94.

FOAM exiting[
So I added parenthesis before the scalar entry. This is how my table looks like this now.

Quote:

(
( 0 ( 0.0378 0.0 0 ))
( 0.05 ( 0.0378 0.00012138386402 0 ))
( 0.1 ( 0.0378 0.000242766115999 0 ))
. . . . . .
);
log.decomposePar shows the following error

Quote:

--> FOAM FATAL IO ERROR:
wrong token type - expected Scalar, found on line 2 the punctuation token '('

file: /home/jujja/OpenFOAM/root-2.3.x/run/tutorials/incompressible/pimpleDyMFoam/onemeterplate/coarseMesh/pimpleFoam_heavingframe/data/dataFile at line 2.

From function operator>>(Istream&, Scalar&)
in file lnInclude/Scalar.C at line 93.

FOAM exiting
Does anyone know how to get past this? This seems like a cat and mouse game. Please help people.

Linse February 27, 2015 18:38

Well, according to that error message it would expect a scalar but you are giving a vector. On the quick run I see two things I would try (I had used flowrates only, which obviously are scalars only) :
1. Try, if it works when putting the vector values in quotation marks, e.g.
(
(0 "1 0 0")
);

2. Try if it works to use "uniformFixedVelocity" instead of "uniformFixedValue". I do not know if that BC exists or if it accepts the tableFile-format!

Please let us know if these trials work!

alexeym February 28, 2015 02:26

Hi,

Maybe you should provide example case, as this format of dataFile:

Code:

(
(0 (0.025 0.0 0))
(0.1 (0.025 0.00313333083911 0))
(0.2 (0.025 0.00621724717912 0))
(0.3 (0.025 0.00920311381712 0))
)

passes decomposePar without any errors. Though maybe it is a feature of 2.3.1, and in 2.3.x this functionality is somehow broken.

pruthvi1991 March 29, 2015 00:35

Solved
 
Hey guys!

Sorry for the late response. I was able to fix the problem by building the case from scratch. I think the issue was with using the same datafile for more than one boundary. The correct format for the values is this

Code:

(
( 0 ( 0.0378 0.0 0 ))
( 0.05 ( 0.0378 0.00012138386402 0 ))
( 0.1 ( 0.0378 0.000242766115999 0 ))
. . . . . .
);

I think this has to be changed in TableFile.H

Thanks,
Pruthvi.

meth November 4, 2015 00:22

Quote:

Originally Posted by pruthvi1991 (Post 538784)
Hey guys!

Sorry for the late response. I was able to fix the problem by building the case from scratch. I think the issue was with using the same datafile for more than one boundary. The correct format for the values is this

Code:

(
( 0 ( 0.0378 0.0 0 ))
( 0.05 ( 0.0378 0.00012138386402 0 ))
( 0.1 ( 0.0378 0.000242766115999 0 ))
. . . . . .
);

I think this has to be changed in TableFile.H

Thanks,
Pruthvi.

Hi Pruthvi,

I also want to impose a similar boundary condition (time varying fixed value taken from a table) on the inlet patch. Can you please tell me how your datafile looks like from head to tail. Do we need to put an openFoam header on top or else how should it begin? When I try to do it as you mentioned, got the following error massage when I run the decomposePar
Code:

--> FOAM FATAL IO ERROR:
Cannot open file.

file: /home/rajamunr/OpenFOAM/rajamunr-2.3.1/old/VIVBad/VIVtest-cylinder-2/cylinder-icoFoam/dataofsolid/distable at line 1.

    From function TableFile<Type>::TableFile(const word&, const dictionary&)
    in file lnInclude/TableFile.C at line 54.

FOAM exiting



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