CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

[swak4Foam] swakExpression on faceZone returns empty field for non-empty zone

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2018, 11:51
Default [swak4Foam] swakExpression on faceZone returns empty field for non-empty zone
  #1
Member
 
James Gross
Join Date: Nov 2017
Posts: 77
Rep Power: 8
jgross is on a distinguished road
Hi everybody,

I am trying to use swakExpression to calculate a desired quantity on a faceZone. Before I begin creating the faceZone for the actual region of interest, I thought I would test out the utility on an already defined faceZone that is being already defined from a patch. Ultimately, I would create the faceZone at the desired location, but I thought it would be good to test this out first.

However, every time I run the case, there is a FOAM warning about it being an empty field:

Code:
Expression cavImpeller1 : --> FOAM Warning : 
    From function Field<T> *SubsetValueExpressionDriver::getFieldInternalAndInterpolate(const word &name,const Subset &sub)
    in file SubsetValueExpressionDriverI.H at line 264
    Going to interpolate p
--> FOAM Warning : 
    From function gAverage(const UList<Type>&)
    in file /home/jg847/foam/foam-extend-4.0/src/foam/lnInclude/FieldFunctions.C at line 541
    empty field, returning zero.
 average=0
I am certain that the faceZone is not empty as when I check the constant/polymesh/faceZones, the required zone contains 169 faces:

Code:
GGI_EXT_ZONE
{
    type faceZone;
    faceLabels      List<label> 
169
The swakExpression is:

Code:
    cavImpeller1
    {
      type swakExpression;
      valueType faceZone;
      zoneName GGI_EXT_ZONE;
      outputControl timeStep;
      outputControlMode timeStep;
      outputInterval 1;
      enabled true;
      autoInterpolate true;
      expression "sum(phi*2*(p+101-3.169))/sum(phi)";
      verbose true;
      allowCoupled true;
      accumulations ( average );
    }
The faceZone in question acts as a mixing plane interface, so I'm wondering if that is the cause of the issue, but I don't think it should affect the calculation as those quantities are still available for calculation.

Anyone have any ideas as to why this might be the case?

James
jgross is offline   Reply With Quote

Old   July 7, 2022, 11:28
Default
  #2
Member
 
Julio Pieri
Join Date: Sep 2017
Posts: 96
Rep Power: 8
JulioPieri is on a distinguished road
I know this is an old thread, but just to help future foammers:

To write for a faceZone, you need to declare a "variables" entry before, where you specify the variable name with "{faceZone'facezonename}" indicating the faceZone. The syntax is something like this:
Code:
cavImpeller1
    {
      type swakExpression;
      valueType faceZone;
      zoneName GGI_EXT_ZONE;
      outputControl timeStep;
      outputControlMode timeStep;
      outputInterval 1;
      enabled true;
      autoInterpolate true;
      variables "dummyVariable{faceZone'zone_name}=sum(phi*2*(p+101-3.169))/sum(phi);"
      expression "dummyVariable";
      verbose true;
      allowCoupled true;
      accumulations ( average );
    }
JulioPieri is offline   Reply With Quote

Reply


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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 91 December 21, 2022 04:50
problems after decomposing for running alessio.nz OpenFOAM 7 March 5, 2021 04:49
Cht tutorial in 15 braennstroem OpenFOAM Running, Solving & CFD 197 June 10, 2015 03:02
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 06:51


All times are GMT -4. The time now is 21:03.