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

Time varying surfaceNormalFixedValue BC with codeStream

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 28, 2013, 11:31
Default Time varying surfaceNormalFixedValue BC with codeStream
  #1
Senior Member
 
Francois Beaubert
Join Date: Mar 2009
Location: Lille, France
Posts: 147
Rep Power: 17
francois is on a distinguished road
Dear Foamers,

I would like to change the value of the surfaceNormalFixedValue inlet velocity according to the current time step.

I want to build a simple ramped inlet condition using the surfaceNormalFixedValue BC
.

But I got stuck when I want to access the current time step using codeStream.

My code is as follows:

Code:
"Inlet"
    {
        type surfaceNormalFixedValue;
        uBegin   -0.0011968512;
        uEnd   -0.023937024;
        it0  50;
        iter #calc "runTime.time().value()";
        refValue uniform  #calc "max($uEnd,$uBegin + (($uEnd-$uBegin)/$it0)*$iter)";
    }
I got the following error message:

Code:
: In function ‘void Foam::codeStream_511e83c811264e2205bc04185da775a50640cef3(Foam::Ostream&, const Foam::dictionary&)’:
:0:8: error: ‘runTime’ was not declared in this scope
make: *** [Make/linux64GccDPOpt/codeStreamTemplate.o] Error 1
Any idea to obtain the current time step with #CodeStream ?

Thank you very much
Regards
Francois
francois is offline   Reply With Quote

Old   March 29, 2013, 04:55
Default
  #2
Senior Member
 
Francois Beaubert
Join Date: Mar 2009
Location: Lille, France
Posts: 147
Rep Power: 17
francois is on a distinguished road
I've tried with

Code:
this->db().time().value()
without more luck
francois is offline   Reply With Quote

Old   April 5, 2013, 15:19
Default
  #3
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 francois View Post
I've tried with

Code:
this->db().time().value()
without more luck
"this" is a patchField. So my guess is that you have to get the patch first. Something like
Code:
this->patch().mesh().time().value()
but my memory is notoriously bad with that kind of things and I'll have to look it up in Doxygen anytime. That's why I wrote me groovyBC and write something like
Code:
type groovyBC;
variables (
        "uBegin=-0.0011968512;"
        "uEnd=-0.023937024;"
        "it0=50;"
);
valueExpression "normal()*max(uEnd,uBegin+((uEnd-uBegin)/it0)*time())";
(I like to keep my cases and my coding separate)

One note: getting the time seems like quite a common task to me. I'd suggest that you guys do a collection of this and similar snipplets (possibly on the Wiki) for the coded-way. This way I will stop bothering anyone with "come to the dark side, Luke"-postings
kkpal 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
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 05:13
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 12:08
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 10:34
Problem with FloatingObject Leech OpenFOAM Running, Solving & CFD 10 March 29, 2012 16:24
Modeling in micron scale using icoFoam m9819348 OpenFOAM Running, Solving & CFD 7 October 27, 2007 01:36


All times are GMT -4. The time now is 04:05.