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] and OF-2.2.1 (https://www.cfd-online.com/Forums/openfoam-community-contributions/123264-2-2-1-a.html)

mayank.dce2k7 September 8, 2013 15:02

and OF-2.2.1
 
Hi Foamers,

I recently switched from OF-2.1.1 to OF-2.2.1. I installed swak4Foam it compiled fine which was checked by re-running ./Allwmake command which returned the list of libraries. Now I ran a simple steady state simulation using swak Data entry and encountered errors which were not there in OF-2.1.1.

Below is 0/U file: where I implemented swakDataEntry.

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.1                                |
|  \\  /    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
{
    INLET
    {

      type            groovyBC;
      variables "r2=(pow(pos().x,2)+pow(pos().y,2));R2=sum(area())/pi;para=-((R2-r2)/R2)*normal();";
      valueExpression "2*0.0852*para"; //where 0.351 is the average velocity
      value        uniform (0 0 0);     
   
    }

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

    OUTLET1
    {

        type            flowRateInletVelocity;
        volumetricFlowRateExpression "0";
        volumetricFlowRate swak {
            variables "phi1{INLET}=-0.502*sum(area())*0.0852;";
            expression "phi1"; // volume flow going out of domain from outlet 1 which 0.52 times that at inlet
            valueType patch;
            patchName OUTLET1;};

    value          uniform ( 0 0 0 );
    }

    OUTLET2
    {

      type            zeroGradient;
       
    }


}

Error message:

Create mesh for time = 0

Reading field p

Reading field U



--> FOAM FATAL IO ERROR:
keyword independentVariableName is undefined in dictionary ""

file: from line 47 to line 50.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 402.

FOAM exiting

gschaider September 8, 2013 18:03

Quote:

Originally Posted by mayank.dce2k7 (Post 450520)
Hi Foamers,

I recently switched from OF-2.1.1 to OF-2.2.1. I installed swak4Foam it compiled fine which was checked by re-running ./Allwmake command which returned the list of libraries. Now I ran a simple steady state simulation using swak Data entry and encountered errors which were not there in OF-2.1.1.

Below is 0/U file: where I implemented swakDataEntry.

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.1                                |
|  \\  /    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
{
    INLET
    {

      type            groovyBC;
      variables "r2=(pow(pos().x,2)+pow(pos().y,2));R2=sum(area())/pi;para=-((R2-r2)/R2)*normal();";
      valueExpression "2*0.0852*para"; //where 0.351 is the average velocity
      value        uniform (0 0 0);     
   
    }

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

    OUTLET1
    {

        type            flowRateInletVelocity;
        volumetricFlowRateExpression "0";
        volumetricFlowRate swak {
            variables "phi1{INLET}=-0.502*sum(area())*0.0852;";
            expression "phi1"; // volume flow going out of domain from outlet 1 which 0.52 times that at inlet
            valueType patch;
            patchName OUTLET1;};

    value          uniform ( 0 0 0 );
    }

    OUTLET2
    {

      type            zeroGradient;
       
    }


}

Error message:

Create mesh for time = 0

Reading field p

Reading field U



--> FOAM FATAL IO ERROR:
keyword independentVariableName is undefined in dictionary ""

file: from line 47 to line 50.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 402.

FOAM exiting

You probably also upgraded from an old swak to 0.2.4. To quote from the README there
Code:

**** =swakDataEntry= improved
    Two enhancements
    - the name of the independent variable  no can be
      specified. This variable holds the value that is passed to the
      data entry as a uniform value
    - data entry can now be integrated. This allows using it for
      instance for the injection rate in lagrangian models

the reference guide in the Documentation folder explains it
Code:

** Data entry
  The main library introduces a subtype of =DataEntry= that is
  selected under the name =swak= wherever data entries lie
  =constant=, =polynomial= etc are used. After that a dictionary with
  additional parameters is required. An example entry would look
  like this:
: flowRateProfile swak {
:    expression "exp(-t)";
:    independentVariableName t;
:    valueType patch;
:    patchName top;
:    integrationIntervalls 100;
: };
  Required entries in the dictionary are
  - expression :: the expression to be evaluated
  - independentVariableName :: the name of the independent variable
        that was passed during evaluation (usually this is the time)
  - valueType :: this determines the type of parser that is
                  used. Additional parameters for the initialization
                  may be needed and the usual entries like
                  =variables= are of course possible
  Only for integrations an additional parameter is needed
  - integrationIntervalls :: number of intervals the integration
        range is divided into.

The day when people start reading these file ...


All times are GMT -4. The time now is 16:10.