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

[swak4Foam] Using calculated swak expressions in another functions

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2016, 08:06
Default Using calculated swak expressions in another functions
  #1
Member
 
Arsalan
Join Date: Jul 2014
Posts: 74
Rep Power: 8
arsalan.dryi is on a distinguished road
Dear Foamers,

How could I use the calculated swak expressions at other functions for example like below:
Code:
    createInterface
    {
        type createSampledSurface;
        outputControl timeStep;
        outputInterval 1;
        surfaceName interface;
        surface {
            type isoSurface;
            isoField alpha.water;
            isoValue 0.5;
            interpolate true;
      		 }
    }

 surface
    {
	ignore_unimplemented_simpleFunctionObject::movePoints true;
        type swakExpression;
        valueType surface;
        surfaceName interface;
        verbose true;
        expression "sum(area())";
        accumulations (
            min
                   );
	autowrite true;
    }

    k
    {
	aliases {
 		alphawater alpha.water;
		}
	ignore_unimplemented_simpleFunctionObject::movePoints true;
        type swakExpression;
        valueType internalField;
	variables (
	"thres=0.5;"//which cells to keep
	"VolC= sum (alphawater < thres ? C*vol() : 0);"
	);        
	expression "VolC/surface";
        accumulations (
		average		
        );
    }
Here I want to use calculated area() from surface function in the k function, what kind of method should be implemented in this situation?
Moreover, we couldn't calculate area() in the k function separately because this function has an internalField valueType while using area() needs a surface valueType!

The second question is how could we use the runTime() value in the functions? I think it has a keyword but I don't remember that.

Any help and comment will be appreciated.
Regards,
Arsalan.
arsalan.dryi is offline   Reply With Quote

Old   October 22, 2016, 07:20
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,146
Rep Power: 46
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by arsalan.dryi View Post
Dear Foamers,

How could I use the calculated swak expressions at other functions for example like below:
Code:
    createInterface
    {
        type createSampledSurface;
        outputControl timeStep;
        outputInterval 1;
        surfaceName interface;
        surface {
            type isoSurface;
            isoField alpha.water;
            isoValue 0.5;
            interpolate true;
               }
    }

 surface
    {
    ignore_unimplemented_simpleFunctionObject::movePoints true;
        type swakExpression;
        valueType surface;
        surfaceName interface;
        verbose true;
        expression "sum(area())";
        accumulations (
            min
                   );
    autowrite true;
    }

    k
    {
    aliases {
         alphawater alpha.water;
        }
    ignore_unimplemented_simpleFunctionObject::movePoints true;
        type swakExpression;
        valueType internalField;
    variables (
    "thres=0.5;"//which cells to keep
    "VolC= sum (alphawater < thres ? C*vol() : 0);"
    );        
    expression "VolC/surface";
        accumulations (
        average        
        );
    }
Here I want to use calculated area() from surface function in the k function, what kind of method should be implemented in this situation?
Moreover, we couldn't calculate area() in the k function separately because this function has an internalField valueType while using area() needs a surface valueType!
An external expression (in the variables list of k)
Code:
"surface{surface'interface}=sum(area());"
should do what you want (the surface-functionObject can go unless you need the value for postProcessing afterwards)

Quote:
Originally Posted by arsalan.dryi View Post
The second question is how could we use the runTime() value in the functions? I think it has a keyword but I don't remember that.
The function you're looking for is called time()

Quote:
Originally Posted by arsalan.dryi View Post
Any help and comment will be appreciated.
Regards,
Arsalan.
Both questions are answered in the (incomplete) Reference Guide in the Documentation folder. Especially the external expressions (with your nomenclature it can be a bit confusing which "surface" means what)
arsalan.dryi likes this.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   October 22, 2016, 11:07
Default
  #3
Member
 
Arsalan
Join Date: Jul 2014
Posts: 74
Rep Power: 8
arsalan.dryi is on a distinguished road
Dear Bernhard,
Thanks for your straightforward answer, works like a charm.

Quote:
Originally Posted by gschaider View Post
Both questions are answered in the (incomplete) Reference Guide in the Documentation folder. Especially the external expressions (with your nomenclature it can be a bit confusing which "surface" means what)
I'm sorry for that, that's my fault because I'd forgotten this reference completely.
You are right and the first question is explained in detail at page "24" of the reference pdf and the time() keyword is defined at the 14th page. So I should read this reference as soon as possible.

For now, do you have any idea about post-processing (or could be programming) problem that asked in below thread?!

http://www.cfd-online.com/Forums/ope...hase-flow.html

I'm very grateful to you for your helps.
Best regards,
Arsalan.
arsalan.dryi is offline   Reply With Quote

Reply

Tags
internalfield, surface, swak4foam, swakexpression

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
One more time: wall functions - SST CellZone OpenFOAM Pre-Processing 18 September 21, 2020 07:25
Wall functions - questions about implementation AlmostSurelyRob OpenFOAM Programming & Development 44 May 6, 2020 10:11
Wall functions vs. boundary layers kandelabr OpenFOAM Running, Solving & CFD 3 June 12, 2017 07:05
When I use the wall functions....! maximus Main CFD Forum 7 January 20, 2003 09:35
N-S equations:divergence free functions? D. Puigjaner Main CFD Forum 1 July 27, 2000 12:43


All times are GMT -4. The time now is 15:58.