CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Problems creating a volScalarField with expressionField function-object

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 18, 2014, 12:12
Default Problems creating a volScalarField with expressionField function-object
  #1
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Hi all,

Recently I have been trying to develop a boundary condition for convective heat transfer using swak4foam. For more information you can go to my last post regarding this problem (externalwallheatfluxtemperature-bc-h-function-twall). I'm still a bit lost about this matter, but, as a start, I tried to create a field named "hExtV" to define the convective heat transfer at the external wall (patch). To do so I have been reading all the documentation I have found about swak4foam.

Firstly, I tried to create the new field with funkySetFields. After it was executed a new file with the mentioned name was created in the coresponding region directory, as expected. After that, I tried to modify its value with the manipulatePachField function object, but an error appeared and I wasn't allowed to do that. Now I don't remember the error message, but I googled it and I found that executing the following function object it may be seen if the field was created successfully.

Code:
     listFields 
     {
         type listRegisteredObjects;
         region nameRegion;
     }
Obviously, the output of this FO in the log file didn't show the field created before with funkySetFields.

My second attempt was to create the field with the expressionField FO instead of funkySetFields. The field creation was successful as it can be seen in the output:
Code:
Creating expression field hExtV ... type:volScalarField
--> FOAM Warning : 
    From function simpleFunctionObject::simpleFunctionObject
    in file simpleFunctionObject/simpleFunctionObject.C at line 109
    'outputControlMode' not found in listFields
Assuming: timeStep
--> FOAM Warning : 
    From function simpleFunctionObject::simpleFunctionObject
    in file simpleFunctionObject/simpleFunctionObject.C at line 117
    'outputInterval' not found in listFields
Assuming: 1
Content of object registry <regionName> at start
                    Name             Type Autowrite
======================== ================ =========
                       T   volScalarField Yes
              betavSolid         IOobject No
                boundary polyBoundaryMesh No
               cellZones      regIOobject No
                    data         IOobject No
               faceZones      regIOobject No
                   faces         faceList No
               fvOptions         IOobject No
               fvSchemes       dictionary No
              fvSolution       dictionary No
                       h         IOobject No
                   hExtV         IOobject Yes
               neighbour        labelList No
                   owner        labelList No
                       p   volScalarField Yes
              pointZones      regIOobject No
                  points      vectorField No
     radiationProperties       dictionary No
            thermo:alpha         IOobject No
              thermo:rho         IOobject No
thermophysicalProperties       dictionary No
However, no field file is created in the corresponding region directory, so I cannot see the field values.

At this stage, I would like to know what I am doing wrong. What should I do in order to create the file in the region directory?

I attach the functions subdictionary specification so that you can see how I did it and the funkySetFields call I used.

Code:
functions
{

    hExtVExpression
    {
        type expressionField;
        outputControl timeStep;
        outputInterval 1;
        region <regionName>;
        fieldName hExtV;
        expression "0";
        dimension [1 0 -3 -1 0 0 0];
        autowrite true;
    }
     listFields 
     {
         type listRegisteredObjects;
         region <regionName>;;
     }
     hExtV_FO
     {
         type manipulatePatchField;
         outputControl timeStep;
         outputInterval 1;
         fieldName hExtV;
         region <regionName>;
         patchName conveccio_ext;
         expression "0.25*T";
         mask "true";
         writeManipulated true;
     }
Code:
funkySetFields -create -field hExtV -time 0 -expression '0'  -dimension '[1 0 -3 -1 0 0 0]'

Many thanks in advance!

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   December 21, 2014, 13:13
Default
  #2
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Well, after some trials I found out why expressionField function object didn't create the field file in the directory <time>/<region>/h_extV. The point is that when I opened this thread I had only checked the 0/<region> directory and, for some reason I can't figure out, the FO is not creating the field in the time 0 but it does for the following time steps. On the other hand, funkySetFields creates the field in the time 0 due to the -time 0 flag I used.

Besides that, I still have problems with the manipulatePatchField FO. As stated in the previous post, this FO cannot manipulate the field created with funkySetFields utility since it says that the field doesn't exist (the field file is created in the 0 time folder but it's not listed when listRegisteredObjects FO is applied). However, when the field is created by means of the use of manipulatePatchField FO it seems that it does manipulate the field according to what it shows the output of the solver (see below), but no <time>/<region>/h-extV file shows any value.

·extract of the solver's log file
Code:
Creating expression field h_ExtV ... type:volScalarField
Content of object registry <region> at start
                    Name             Type Autowrite
======================== ================ =========
                       T   volScalarField Yes
                                  (...)
                       h         IOobject No
                  h_ExtV         IOobject Yes
                                  (...)

swak4Foam: Setting default mesh
swak4Foam: Allocating new repository for sampledGlobalVariables
Manipulated field h_ExtV on patch conveccio_ext on 1224 faces with the expression "h_ext"
Time = 200


Solving for solid region (...)

Content of object registry <region>
                    Name             Type Autowrite
======================== ================ =========
                       T   volScalarField Yes     
                                 (...)

--> FOAM Warning : 
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 332
    The minimum value 10.882353 and the maximum 10.882353 differ. I will use the average 10.882353
Manipulated field h_ExtV on patch conveccio_ext on 1224 faces with the expression "h_ext"
Rewriting manipulated field h_ExtV

                     (...)

Time = 1000


Solving for solid region <region>


Content of object registry <region>
                    Name             Type Autowrite
======================== ================ =========
                       T   volScalarField Yes
                                (...)
--> FOAM Warning : 
    From function ExpressionResult::getUniformInternal(const label size,bool noWarn)
    in file ExpressionResult/ExpressionResultI.H at line 332
    The minimum value 8.6192246 and the maximum 9.2404733 differ. I will use the average 9.2120186
Manipulated field h_ExtV on patch conveccio_ext on 1224 faces with the expression "h_ext"
Rewriting manipulated field h_ExtV
End
·extract of the 1000/<region>/h_extV file
Code:
dimensions      [1 0 -3 -1 0 0 0];

internalField   uniform 0;

boundaryField
{
    sim_lat1
    {
        type            symmetry;
    }
    sim_lat2
    {
        type            symmetry;
    }
    sim_sup
    {
        type            symmetry;
    }
    sim_inf
    {
        type            symmetry;
    }
    conveccio_ext //patch that should be modified with manipulatePatchField FO
    {
        type            zeroGradient;
    }
(...)
}
·extract of the controlDict file
Code:
functions
{

    hExtVExpression
    {
        type expressionField;
        outputControl none;//timeStep;
        outputInterval no;//1;
        region <region>;
        fieldName h_ExtV;
        expression "0";
        dimension [1 0 -3 -1 0 0 0];
        autowrite true;
    }
    listFields 
    {
        type listRegisteredObjects;
        outputControlMode timeStep;
        outputInterval 1;
        region fasana;     
    }
    hExtV_FO
    {
        type manipulatePatchField;
        outputControl timeStep;
        outputInterval 1;
        fieldName h_ExtV;
        region <region>;
        patchName conveccio_ext;
        variables ("h_ext{conveccio_ext/<region>}= T;");
        expression "h_ext";
        mask "true";
        writeManipulated true;
    }
}
At this stage I have a few questions:

1. Why does expressionField not create the field at the first time (time 0)? What should I do to make it create it?

2. Why is manipulatePatchField supposedly manipulating (and (re)writing) the field but no value is writen in the field file and it remains untouched with the same value time after time?

In the case I am testing h_extV takes (or at least that's what I want to) the same value than T field at the patch as you can see above in the controlDict code attached. Of course this is meaningless, it's just for testing and trying to understand how to use these FO's. Then I don't understand why the output says
Code:
    The minimum value 8.6192246 and the maximum 9.2404733 differ. I will use the average 9.2120186
3. Does it mean that it is using the average value of the field in all the patch faces? I would like that each patch face had its own value based on its own T value.


I will appreciate any hint you can give me in regards of these FO's usage. If you need more info, just let me know!

Many thanks in advance,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   January 12, 2015, 08:49
Default
  #3
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Can anyone, please, give me some hint about my problems with creating and manipulating new fields?

Many thanks in advance.


Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Reply

Tags
expressionfield, function object, funkysetfields, groovybc, swak4foam


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[blockMesh] Errors during blockMesh meshing Madeleine P. Vincent OpenFOAM Meshing & Mesh Conversion 51 May 30, 2016 11:51
using chemkin JMDag2004 OpenFOAM Pre-Processing 2 March 8, 2016 23:38
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 10:31
Problems with Meshing: Collapsed Cells Emmanuel Resch Siemens 1 July 30, 2007 04:02
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


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