CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] GroovyBC (https://www.cfd-online.com/Forums/openfoam-community-contributions/179294-groovybc.html)

FlyBob91 October 27, 2016 05:00

GroovyBC
 
Hi to all,
which is the correct file format to set a boundary condition with GroovyBC starting from an external file? Which extension typare allowed?

Thanks for help!

FlyBob91 October 27, 2016 06:07

1 Attachment(s)
ok i found it accepts the .csv and the openFoam-format. I have to work with .csv format but it seems not to work. Maybe i made some mistake in the file boundary

Code:

    inlet1
    {
        type groovyBC ;

        fields
        (
        U
        );
        outOfBounds clamp;
        readerType csv
        fileName "$FOAM_CASE/tab.csv";
        hasHeaderLine 1;
        valueColumns 3;
    }

can someone control me the code?
Thanks!

FlyBob91 October 27, 2016 13:01

Ok i changed road and i decided to insertthe li directly in U file in ti manner:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  4.x                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField  uniform (0 0 0);

boundaryField
{
    inlet1
    {
        type            fixedValue
        value nonuniform List<vector>
        36
(
(-0.00053044        0.20173        0.002039)
(-0.0023134        0.28452        0.0037276)
(-0.0020482        0.38684        0.0054303)
(0.0020481        0.38684        0.0054303)
(0.0023134        0.28452        0.0037276)
(0.00053044        0.20173        0.002039)
(-0.0011778        0.2555        0.0033889)
(-0.0037739        0.3664        0.0060664)
(-0.003185        0.50186        0.0089382)
(0.003185        0.50186        0.0089382)
(0.0037739        0.3664        0.0060664)
(0.0011778        0.2555        0.0033889)
(-0.0013859        0.31758        0.0023695)
(-0.0047678        0.45854        0.0042026)
(-0.0040748        0.62904        0.006223)
(0.0040748        0.62904        0.006223)
(0.0047678        0.45854        0.0042026)
(0.0013859        0.31758        0.0023695)
(-0.0013859        0.31758        -0.0023695)
(-0.0047678        0.45854        -0.0042026)
(-0.0040748        0.62904        -0.006223)
(0.0040748        0.62904        -0.006223)
(0.0047678        0.45854        -0.0042026)
(0.0013859        0.31758        -0.0023695)
(-0.0011778        0.2555        -0.0033889)
(-0.0037739        0.3664        -0.0060664)
(-0.003185        0.50186        -0.0089382)
(0.003185        0.50186        -0.0089382)
(0.0037739        0.3664        -0.0060664)
(0.0011778        0.2555        -0.0033889)
(-0.00053044        0.20173        -0.002039)
(-0.0023134        0.28452        -0.0037276)
(-0.0020482        0.38684        -0.0054303)
(0.0020481        0.38684        -0.0054303)
(0.0023134        0.28452        -0.0037276)
(0.00053044        0.20173        -0.002039)
)
    }


    inlet2
    {
        type            fixedValue;
        value          uniform (0 -0.42 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    walls
    {
        type          fixedValue;
        value          uniform (0 0 0);     
    }
}

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


however this error appear

Code:

--> FOAM FATAL IO ERROR:
Essential entry 'value' missing

file: /home/roby/Scrivania/Tmixer_100/0/U.boundaryField.inlet1 from line 25 to line 26.

    From function Foam::fvPatchField<Type>::fvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&, bool) [with Type = Foam::Vector<double>]
    in file lnInclude/fvPatchField.C at line 133.

FOAM exiting

any suggestion

Dipsomaniac October 28, 2016 03:34

Looks like you are missing a semi colon after your bracket which containers the list of vectors.

FlyBob91 October 28, 2016 05:04

Quote:

Originally Posted by Dipsomaniac (Post 623279)
Looks like you are missing a semi colon after your bracket which containers the list of vectors.

Hi Brian,
thank you for your reply (you are saving my life in these days). I also forgotthe semi colon after "fixedValue"

here the code corected

Code:

boundaryField
{
    inlet1
    {
        type            fixedValue;
        value                  nonuniform List<vector>
        36
(
(-0.00053044        0.20173        0.002039)
(-0.0023134        0.28452        0.0037276)
(-0.0020482        0.38684        0.0054303)
(0.0020481        0.38684        0.0054303)
(0.0023134        0.28452        0.0037276)
(0.00053044        0.20173        0.002039)
(-0.0011778        0.2555        0.0033889)
(-0.0037739        0.3664        0.0060664)
(-0.003185        0.50186        0.0089382)
(0.003185        0.50186        0.0089382)
(0.0037739        0.3664        0.0060664)
(0.0011778        0.2555        0.0033889)
(-0.0013859        0.31758        0.0023695)
(-0.0047678        0.45854        0.0042026)
(-0.0040748        0.62904        0.006223)
(0.0040748        0.62904        0.006223)
(0.0047678        0.45854        0.0042026)
(0.0013859        0.31758        0.0023695)
(-0.0013859        0.31758        -0.0023695)
(-0.0047678        0.45854        -0.0042026)
(-0.0040748        0.62904        -0.006223)
(0.0040748        0.62904        -0.006223)
(0.0047678        0.45854        -0.0042026)
(0.0013859        0.31758        -0.0023695)
(-0.0011778        0.2555        -0.0033889)
);
    }
.............


Best Regards,
Roberto

FlyBob91 October 29, 2016 11:17

1 Attachment(s)
Sorry for the bump.
The list vector works good but, because i have to work with a large number of vectors, i would like to load them directly starting from my csv file. The condition is not timevarying but fixed.
Any suggestion?


this is what i write till now

Code:

      inlet1
    {
      type            fixedValue;
      uniformValue    csvFile;
   
      csvFileCoeffs
      {
            fileName        "$FOAM_CASE/tab"
            outOfBounds      clamp;
            hasHeaderLine    true;
            // refColumn        0; i don't hav refColumn because it's not time Varying
            componentColumns (0 1 2);
      }
    }


here the error

Code:

--> FOAM FATAL IO ERROR:
Essential entry 'value' missing

file: /home/roby/Scrivania/ciao/0/U.boundaryField.inlet1 from line 26 to line 35.

    From function Foam::fvPatchField<Type>::fvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&, bool) [with Type = Foam::Vector<double>]
    in file lnInclude/fvPatchField.C at line 133.

FOAM exiting

this is strange because i followed the instructions in http://openfoam.org/release/2-1-0/bo...ime-dependent/
the guide is for timedipendent BC but i think it can ru also for fixedValue.

i link also the file

Dipsomaniac October 29, 2016 11:42

Hi Roberto

Looks like you need to still add
Code:

value uniform (0 0 0);
after you have read in your CSV file. I am assuming it won't be used in the calculation and is just a place holder, but is required for the boundary condition to still be read correctly.

Regards,
Brian

Like this.
Code:

      inlet1
    {
      type            fixedValue;
      uniformValue    csvFile;
   
      csvFileCoeffs
      {
            fileName        "$FOAM_CASE/tab"
            outOfBounds      clamp;
            hasHeaderLine    true;
            // refColumn        0; i don't hav refColumn because it's not time Varying
            componentColumns (0 1 2);
      }

      value uniform (0 0 0);
    }


FlyBob91 October 29, 2016 12:16

Quote:

Originally Posted by Dipsomaniac (Post 623412)
Hi Roberto
after you have read in your CSV file. I am assuming it won't be used in the calculation and is just a place holder, but is required for the boundary condition to still be read correctly.

Hi Brian,
Thanks for your fast reply but, unfortunately, with this modification it works but it takes a null velocity boundary condition :confused:

Best Regards,
Roberto

Dipsomaniac October 29, 2016 14:29

I am thinking that the fixedValue boundary condition can't be directly used with a CSV (external) file unfortunately. I am looking at other boundary conditions which may work for your purpose.

gschaider October 30, 2016 12:56

Quote:

Originally Posted by FlyBob91 (Post 623415)
Hi Brian,
Thanks for your fast reply but, unfortunately, with this modification it works but it takes a null velocity boundary condition :confused:

Best Regards,
Roberto

In the second post you were not tthat far off: The lookuptable would work like this (adapt for your own need)
Code:

inlet {
  type groovyBC;
  valueExpression "profile(pos().y)*normal()";
  lookuptables (
    {
          name profile;
          readerType csv;
          fileName "$FOAM_CASE/profile.csv";
          outOfBounds clamp;
          timeColumn 0;
          valueColumns (1);
      }
  );
}

Have a look at the Examples/groovyBC/wobbler/0/D-file and the Documentation/swak4FoamReference.org in the swak4Foam-sources

FlyBob91 November 3, 2016 11:06

hi Bernhard, Thank you for you reply and contribution.
You were very clear, but i have only a last doubt about how setting the time column if i have a non time varying input field.


Best Regards,
Roberto

gschaider November 3, 2016 14:05

Quote:

Originally Posted by FlyBob91 (Post 624004)
hi Bernhard, Thank you for you reply and contribution.
You were very clear, but i have only a last doubt about how setting the time column if i have a non time varying input field.


Best Regards,
Roberto

"timeColumn" is just a name for the number of the column with the independent variable. It is named like this for historical reasons


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