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

fvOptions, non-uniform fixedValuesConstraint

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 15, 2021, 07:53
Default fvOptions, non-uniform fixedValuesConstraint
  #1
New Member
 
Join Date: Feb 2016
Posts: 13
Rep Power: 10
fanny is on a distinguished road
Hello everyone,

I would want to set non-uniform values to the temperature field to selected cells. I suppose I may use fixedFieldValueConstraint in the fvOptions, as

fixedTValues
{
type scalarFixedValueConstraint;
active yes;

selectionMode cellSet;
cellSet myCellsSet;

fieldValues
{
T 0.1;
}
}


Is it possible to replace the constant "1.0" by a function of the cell positions ?

Is it even possible to replace it by a time-dependent function ?


Than you for your help !
Fanny
fanny is offline   Reply With Quote

Old   September 15, 2021, 08:02
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Simply. Yesno. What you can do is:

  • Manipulate the matrix of the solver / field directly by applying a point list and the value - but here you would need to constrain the enthalpy equation (as there is no temperature one)
  • Use the scalarFixedValueConstraint and apply it to the enthalpy equation but again, the constraint values need to be "enthalpy data". Just apply all single points to a cellZone and you are done
  • Use the fixedTemperatureConstraint and directly set the temperature (its equal to the above one but setting the temperature values rather than enthalpy)
  • Use a coded fvOption and do it there (similar to option #1)

So probably you go with option #3. The only thing you need to do is to use setSet or topoSet to create the cellZone. The cellZone contains all cells you want to manipulate.
To the other questions: I cannot find any number named 1.0. In the latest Foundation version (v9) you can apply a «function1» to the values of the cells and make it "what-ever" dependent.

Code:
  fixedTemperature                                                            
    {                                                                           
        type            fixedTemperatureConstraint;                             
                                                                                
        selectionMode   all;                                                    
                                                                                
        phase           gas; // Optional phase name                             
                                                                                
        // Uniform temperature constraint                                       
        mode            uniform;                                                
        temperature     constant 500; // Uniform temperature << you can make it TIME dependent                   
                                                                                
        // // Looked-up field temperature constraint                            
        // T            T; // Temperature field name                            
    }
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   September 15, 2021, 09:00
Default
  #3
New Member
 
Join Date: Feb 2016
Posts: 13
Rep Power: 10
fanny is on a distinguished road
Hi Tobi, and thank you very much for your reply.



Actually my variable T is not the temperature, but a scalar field I want to transport. (I can be anything, it doesn't mind). So I have a T-equation (the transport one) but no energy equation. Thus, I suppose I can not use fixedTemperatureConstraint, but I should use scalarFixedValueConstraint, isn't it ?


I would want to write something like:


Code:
fixedTValues
{
    type                   scalarFixedValueConstraint;
    active                yes;
    selectionMode  cellSet;
    cellSet               myCellsSet;
    fieldValues
    {
        T    0.1 * t * x ;
    }
}
but it does not work, off course - the expression must be input differently but I don t know how..

Thanks
Fanny

Last edited by Tobi; September 15, 2021 at 09:13. Reason: Modified by Tobi: Added code tags
fanny is offline   Reply With Quote

Old   September 15, 2021, 09:19
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Ah okay, a passive scalar or any other field can be handled by using the other one. The special stuff about the temperature... guy is that it is directly applied to the enthalpy equation and you don't have to think about anything else.

I just checked the Foundation version v9 and the scalar... guy. It seems that you cannot use a time-dependency here as the entries are not of function1.

Code:
    porosityTurbulence                                                          
    {                                                                           
        type            fixedValueConstraint;                                   
                                                                                
        selectionMode   cellZone;                                               
        cellZone        porosity;                                               
                                                                                
        fieldValues                                                             
        {                                                                       
            k           1;                                                      
            epsilon     150;                                                    
        }                                                                       
    }
However, in the source code it states:
Code:
        //- Field values                                                        
        HashPtrTable<objectFunction1> fieldValues_;
Therefore, it should be a function1 possibility. Try it by using:
Code:
fixedTValues
{
    type                   scalarFixedValueConstraint;
    active                yes;
    selectionMode  cellSet;
    cellSet               myCellsSet;
    fieldValues
    {
        T     constan 34;   // write constant wrong such as constan ...
    }
}
If it will return an error with possible options, the value is of type «function1» and you have a lot of freedom.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   September 16, 2021, 02:17
Default
  #5
New Member
 
Join Date: Feb 2016
Posts: 13
Rep Power: 10
fanny is on a distinguished road
I am using the OF version v7.


Yes I had tried the "banana" method :



fixedTValues { type scalarFixedValueConstraint; active yes; selectionMode cellSet; cellSet myCellsSet; fieldValues { T banana 34; } }

returns
--> FOAM FATAL IO ERROR:
wrong token type - expected Scalar, found on line 28 the word 'banana'
It seems that there is no other option than to input a scalar number.
pre.cjk { font-family: "Nimbus Mono L", monospace } p { margin-bottom: 0.1in; line-height: 120% }
fanny is offline   Reply With Quote

Old   September 16, 2021, 02:51
Default
  #6
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Its related to the fact that in v7 its not implemented as <Function1>:


Code:
    // Private member data                                                      
                                                                                
        //- Field values                                                        
        List<Type> fieldValues_;

Hence, its not possible to use it. Two options:
  • Update the constrain class
  • Upgrade foam to v9 or v2106
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   September 16, 2021, 03:00
Default
  #7
New Member
 
Join Date: Feb 2016
Posts: 13
Rep Power: 10
fanny is on a distinguished road
OK. Thank you very much.
fanny is offline   Reply With Quote

Old   June 29, 2023, 14:48
Default FixedValueConstraint
  #8
New Member
 
Jarlath
Join Date: Apr 2018
Posts: 12
Rep Power: 7
JMcnetee is on a distinguished road
Is there a ScalarMaxValueConstraint option?

The ScalarFixedValueConstraint sets the scalar to a fixed, non-changing value, right?
JMcnetee is offline   Reply With Quote

Old   June 30, 2023, 19:12
Default
  #9
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Correct, yes.

The ESI-OpenCFD version v2306 (openfoam.com) does not have such an fvOption. But you can simply derive it from, e.g., this one: https://gitlab.com/openfoam/openfoam...tTemperature.H


If you use the cfd.direct version (openfoam.org), there is a function for that called limitMag: https://github.com/OpenFOAM/OpenFOAM...Mag/limitMag.H


In principle you can also use the limitMag and compile it against ESI-OpenCFD version while resolving potential compiling issues based on naming convention changes or so on.



Cheers, Tobi
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 9, 2023, 09:41
Default
  #10
New Member
 
Jarlath
Join Date: Apr 2018
Posts: 12
Rep Power: 7
JMcnetee is on a distinguished road
I think you had a typo!

The ESI-OpenCFD version v2306 (openfoam.com) does have such an fvOption

https://www.openfoam.com/news/main-n...rs-and-physics
JMcnetee is offline   Reply With Quote

Old   July 10, 2023, 03:30
Default
  #11
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
I don't get your statement, there does not exist a `scalarMinMax` fvOption for the ESI-OpenCFD version. The one you are referring to is only for the turbulent viscosity.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 11, 2023, 08:28
Default
  #12
New Member
 
Jarlath
Join Date: Apr 2018
Posts: 12
Rep Power: 7
JMcnetee is on a distinguished road
Ahhh....you are correct. I got ahead of myself

I was specifically looking for an nuT limiter, which is now available, but the thread is about Scalar Limiters in general

Thanks for the correction
JMcnetee 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
Openfoam Turbulent Car Simulation meganrw OpenFOAM Running, Solving & CFD 0 July 5, 2021 15:50
Film cooling problem arun1994 OpenFOAM 0 October 26, 2020 09:08
rSF: p divergence in combustor (wt negative value) zonda OpenFOAM Pre-Processing 4 April 10, 2018 06:59
[swak4Foam] Air Conditioned room groovyBC Sebaj OpenFOAM Community Contributions 7 October 31, 2012 14:16
Need help with boundary conditions: open to atmosphere Wolle OpenFOAM 2 April 11, 2011 07:32


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