CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

how to implement fixedMean in groovyBC?

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

Like Tree1Likes
  • 1 Post By cosimobianchini

Reply
 
LinkBack Thread Tools Display Modes
Old   June 29, 2013, 14:33
Default how to implement fixedMean in groovyBC?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 16
immortality is on a distinguished road
there is a BC for outlet named fixedMean.
it seema its main code is this:
Code:
void fixedMeanFvPatchField<Type>::updateCoeffs()
{
    if (this->updated())
    {
        return;
    }

    Field<Type> newValues(this->patchInternalField());

    Type meanValuePsi =
        gSum(this->patch().magSf()*newValues)
       /gSum(this->patch().magSf());

    if (mag(meanValue_) > SMALL && mag(meanValuePsi)/mag(meanValue_) > 0.5)
    {
        newValues *= mag(meanValue_)/mag(meanValuePsi);
    }
    else
    {
        newValues += (meanValue_ - meanValuePsi);
    }

    this->operator==(newValues);

    fixedValueFvPatchField<Type>::updateCoeffs();
}
what does it do exactly?is it possible to implement it to groovyBC?
__________________
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 1, 2013, 06:37
Default
  #2
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 7
cosimobianchini is on a distinguished road
Send a message via Skype™ to cosimobianchini
Well, it reads patch internal values:

Field<Type> newValues(this->patchInternalField());

It calculates and area averaged value:
Type meanValuePsi = gSum(this->patch().magSf()*newValues)/gSum(this->patch().magSf());

Then, if the prescribed reference value (meanValue_) is not zero and the difference in magnitude between internal values and meanValue_ is higher than 50%, it scales the local imposed boundary value with the ratio between the desired and the obtained mean values otherwise the adjustment of boundary values is provided with a shift to correctly set the mean value. In both cases the newValues exactly fulfill the requirements of prescribed mean value.

if (mag(meanValue_) > SMALL && mag(meanValuePsi)/mag(meanValue_) > 0.5)
{
newValues *= mag(meanValue_)/mag(meanValuePsi);
}
else
{
newValues += (meanValue_ - meanValuePsi);
}

Concerning the implementation in groovyBC, even though I'm not expert, I'm pretty sure you can implement this using the valueExpression.
As I can see in fact, all the the required functions (sum,internalField,Sf and conditional operator) are implemented in groovyBC.
immortality likes this.
__________________
Cosimo Bianchini

Energy Engineering Department "S. Stecco"
University of Florence
Via di S.Marta, 3
50139 Florence - ITALY
Tel: +39 055 4796575
Fax: +39 055 4796342
Mob: +39 320 9460153
e-mail: cosimo.bianchini@htc.de.unifi.it
URL: www.htc.de.unifi.it
cosimobianchini is offline   Reply With Quote

Old   July 1, 2013, 10:30
Default
  #3
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 16
immortality is on a distinguished road
Hi
thanks.
newValues are replaced to the internalField,right?
I don't think such a function there is in groovyBC to change internalField values unless dear Bernhard say something else.
__________________
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 1, 2013, 11:10
Default
  #4
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 7
cosimobianchini is on a distinguished road
Send a message via Skype™ to cosimobianchini
No. newValues are imposed on the boundary as new fixedValue values.

this->operator==(newValues);
fixedValueFvPatchField<Type>::updateCoeffs();

and that is what valueExpression does in groovy BC (if I did correctly understand groovy BC wiki, never went inside the code for further details sorry)
__________________
Cosimo Bianchini

Energy Engineering Department "S. Stecco"
University of Florence
Via di S.Marta, 3
50139 Florence - ITALY
Tel: +39 055 4796575
Fax: +39 055 4796342
Mob: +39 320 9460153
e-mail: cosimo.bianchini@htc.de.unifi.it
URL: www.htc.de.unifi.it
cosimobianchini is offline   Reply With Quote

Old   July 1, 2013, 12:31
Default
  #5
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 16
immortality is on a distinguished road
OK.then it fluctuate around the specified value according to internal values.
its so: BC*(neighbor value)/(mean of neighbor values)
is it useful to use such a boundary in the case I've attached in the related topic?
its a closed area that a part of right wall is opened.it seems that the pressure doesn't decrease to the value I've set.I guess its a physical feature rather than numerical if you agree.
why fixedValue pressure makes neighbor cells incorrect values
I'll be thankful if you take a look into it.
__________________
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 1, 2013, 13:15
Default
  #6
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 7
cosimobianchini is on a distinguished road
Send a message via Skype™ to cosimobianchini
Rather than fluctuating (never used for transient cases) I would say it converges to a profile which is in equilibrium with the internal solution maintaining the specified mean value.
They case you posted in the other thread is barely understandable so I cannot give any suggestions.
__________________
Cosimo Bianchini

Energy Engineering Department "S. Stecco"
University of Florence
Via di S.Marta, 3
50139 Florence - ITALY
Tel: +39 055 4796575
Fax: +39 055 4796342
Mob: +39 320 9460153
e-mail: cosimo.bianchini@htc.de.unifi.it
URL: www.htc.de.unifi.it
cosimobianchini is offline   Reply With Quote

Old   July 1, 2013, 14:04
Default
  #7
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 16
immortality is on a distinguished road
they are simple.one is a tube full of a fluid at rest in 1800000 pa that its boundary opens completely to 800000 pa BC and another opening is smaller than previous case.but if you see vectors near the opening could see a unstable situation on neighbor cells of opening patch.
__________________
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 2, 2013, 04:32
Default
  #8
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 7
cosimobianchini is on a distinguished road
Send a message via Skype™ to cosimobianchini
With such a pressure ratio I don't think it is a good idea to put a fixed pressure BC at the discharge orifice. I believe your convergence problem are not related to the type of pressure boundary conditions but to the position of the outlet.
__________________
Cosimo Bianchini

Energy Engineering Department "S. Stecco"
University of Florence
Via di S.Marta, 3
50139 Florence - ITALY
Tel: +39 055 4796575
Fax: +39 055 4796342
Mob: +39 320 9460153
e-mail: cosimo.bianchini@htc.de.unifi.it
URL: www.htc.de.unifi.it
cosimobianchini is offline   Reply With Quote

Old   July 2, 2013, 04:41
Default
  #9
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 16
immortality is on a distinguished road
i want an outlet with minimum of pressure that can be reaced by the flow.
Then What BC you suggest other than fixed pressure BC?
I can't changeThe geometry of problem,its fixed.
Its a physical(maybe flow can't reach to a pressure lower than a limit that i don't know whats that limit) problem or numerical in your opinion?
Thanks for consideration.
__________________
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

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
Boundary Conditions with GroovyBC, Normal Gradient treima OpenFOAM Running, Solving & CFD 29 September 18, 2014 11:56
groovyBC issue - k and epsilon sagnikmazumdar OpenFOAM Running, Solving & CFD 23 February 23, 2014 09:47
parabolic velocity profile with fluctuations (groovyBC?) newOFuser OpenFOAM 17 July 15, 2013 18:27
Boundary Conditions with GroovyBC, Normal Gradient treima OpenFOAM Programming & Development 2 January 26, 2013 03:37
groovyBC and Eqn.setReference() benk OpenFOAM 3 June 2, 2011 09:49


All times are GMT -4. The time now is 22:18.