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

have considered using condition in SWAK functions?

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

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Display Modes
Old   July 7, 2013, 03:11
Default have considered using condition in SWAK functions?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,186
Rep Power: 16
immortality is on a distinguished road
i want to know applying conditions on time in SWAK function postProcessing is applicable or not?(in one time period have one expression to be calculated and another expression in another time period)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   July 7, 2013, 10:24
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi Ehsan,

How about giving an example of what you want to do, already in code?

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   July 20, 2013, 13:11
Default
  #3
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,186
Rep Power: 16
immortality is on a distinguished road
Hi Bruno
like this:
Code:
totalPressure_left
       {
        type swakExpression;
        valueType patch;
        patchName left;
        accumulations (
            average
        );
        variables (
            "gamma1=1.4;"
            "gamma2=1.35;"
            "R=287.14;"
        );
        expression "time()<.002 ? sum(p*(pow(1+(gamma1-1)/2*magSqr(U)/(gamma1*R*T),(gamma1/(gamma1-1))))*rho*area())/sum(rho*area()) : sum(p*(pow(1+(gamma2-1)/2*magSqr(U)/(gamma2*R*T),(gamma2/(gamma2-1))))*rho*area())/sum(rho*area())";
        verbose true;
        outputControlMode outputTime;
        outputInterval 1;
       }
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   July 21, 2013, 09:16
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi Ehsan,

Sorry, no time to test this myself. My guess is that if you can add 2 fields directly on the resulting expression, then you should be able to use a condition as well.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   July 22, 2013, 18:18
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
i want to know applying conditions on time in SWAK function postProcessing is applicable or not?(in one time period have one expression to be calculated and another expression in another time period)
That works. Two things:
- both expression have to give the same result type otherwise the parser will throw up (can't switch from vector to scalar)
- internally BOTH expressions are evaluated, but only the one that fits the condition is used (apart from taking a bit more time this can lead to problems if the expression that is not used with the current condition is mathematically invalid. "log(time()-0.002)" in your example for instance)

Quote:
Originally Posted by immortality View Post
Hi Bruno
like this:
Code:
totalPressure_left
       {
        type swakExpression;
        valueType patch;
        patchName left;
        accumulations (
            average
        );
        variables (
            "gamma1=1.4;"
            "gamma2=1.35;"
            "R=287.14;"
        );
        expression "time()<.002 ? sum(p*(pow(1+(gamma1-1)/2*magSqr(U)/(gamma1*R*T),(gamma1/(gamma1-1))))*rho*area())/sum(rho*area()) : sum(p*(pow(1+(gamma2-1)/2*magSqr(U)/(gamma2*R*T),(gamma2/(gamma2-1))))*rho*area())/sum(rho*area())";
        verbose true;
        outputControlMode outputTime;
        outputInterval 1;
       }
immortality 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

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time dependant pressure boundary condition yosuke1984 OpenFOAM Verification & Validation 3 May 6, 2015 06:16
Mathematical representation of fixedDisplacementZeroShear boundary condition Sargam05 OpenFOAM 10 May 25, 2013 17:50
Velocity profile boundary condition Tuca FLOW-3D 1 April 23, 2013 12:02
No-slip condition for non-resolved boundary layer in open channel banks AlbertoVe Main CFD Forum 1 January 17, 2013 04:11
CFL Condition Matt Umbel Main CFD Forum 14 January 12, 2001 15:34


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