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

[swak4Foam] have considered using condition in SWAK functions?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread 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,208
Rep Power: 26
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
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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,208
Rep Power: 26
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
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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: 4,225
Rep Power: 51
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


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
Time dependant pressure boundary condition yosuke1984 OpenFOAM Verification & Validation 3 May 6, 2015 06:16
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 Lupocci Main CFD Forum 1 January 17, 2013 03:11
about the implemention of periodic boundary condition harbinyg Main CFD Forum 5 July 12, 2012 04:30
Boundary condition clarification shaswat CFX 1 April 8, 2012 04:06


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