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

[swak4Foam] how to implement fixedMean in groovyBC?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By cosimobianchini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 29, 2013, 13:33
Default how to implement fixedMean in groovyBC?
  #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
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, 05:37
Default
  #2
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 17
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

Ergon Research s.r.l.
Via Panciatichi, 92
50127 Florence - ITALY
Tel: +39 055 0763716
Mob: +39 320 9460153
e-mail: cosimo.bianchini@ergonresearch.it
URL: www.ergonresearch.it
cosimobianchini is offline   Reply With Quote

Old   July 1, 2013, 09:30
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
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, 10:10
Default
  #4
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 17
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

Ergon Research s.r.l.
Via Panciatichi, 92
50127 Florence - ITALY
Tel: +39 055 0763716
Mob: +39 320 9460153
e-mail: cosimo.bianchini@ergonresearch.it
URL: www.ergonresearch.it
cosimobianchini is offline   Reply With Quote

Old   July 1, 2013, 11:31
Default
  #5
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
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.
http://www.cfd-online.com/Forums/ope...tml#post436854
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, 12:15
Default
  #6
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 17
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

Ergon Research s.r.l.
Via Panciatichi, 92
50127 Florence - ITALY
Tel: +39 055 0763716
Mob: +39 320 9460153
e-mail: cosimo.bianchini@ergonresearch.it
URL: www.ergonresearch.it
cosimobianchini is offline   Reply With Quote

Old   July 1, 2013, 13:04
Default
  #7
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
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, 03:32
Default
  #8
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 17
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

Ergon Research s.r.l.
Via Panciatichi, 92
50127 Florence - ITALY
Tel: +39 055 0763716
Mob: +39 320 9460153
e-mail: cosimo.bianchini@ergonresearch.it
URL: www.ergonresearch.it
cosimobianchini is offline   Reply With Quote

Old   July 2, 2013, 03:41
Default
  #9
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 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


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
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC zanilu70 OpenFOAM Community Contributions 4 December 13, 2016 06:46
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam dani2702 OpenFOAM Community Contributions 0 November 17, 2016 03:30
[swak4Foam] groovyBC issue - k and epsilon sagnikmazumdar OpenFOAM Community Contributions 24 March 1, 2015 07:16
[swak4Foam] parabolic velocity profile with fluctuations (groovyBC?) newOFuser OpenFOAM Community Contributions 17 July 15, 2013 17:27
[swak4Foam] how to implement second order derivative with groovyBC like the formula? immortality OpenFOAM Community Contributions 0 July 9, 2013 08:32


All times are GMT -4. The time now is 19:17.