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

Building a solver with fixedTemperatureConstraint using fvOptions

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes
  • 2 Post By andre.weiner
  • 1 Post By andre.weiner
  • 5 Post By Fluido

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 29, 2013, 11:41
Default Building a solver with fixedTemperatureConstraint using fvOptions
  #1
New Member
 
Join Date: Jul 2013
Posts: 6
Rep Power: 12
Fluido is on a distinguished road
Dear Foamers,

I have been using OpenFOAM for several months for a student project. Everything has been working quite well. But at the moment I am a bit stuck at a problem. Maybe someone can help…

For version 2.2.0 OpenFOAM seems to have introduced a very nice new feature of fvOptions called ‘fixedTemperatureConstraint’, to ‘to fix the temperature to a given value’ (see http://www.openfoam.org/version2.2.0/fvOptions.php). I would like to use this feature to set the temperature of air flowing through a heater to a fixed temperature instead of having to model the heater as a heat source.

My input for the fvOptions file would look like this

Code:
 fixedTemperaure1
  {
      type                      fixedTemperatureConstraint;
      active                    true;
      selectionMode         cellZone;
      cellZone                 heater;
   
      fixedTemperatureConstraintCoeffs
      {
          mode              uniform;
          temperature     350;
      }
  }
I would like to include the fixedTemperatureConstraint to a self-built solver for a decoupled, steady state, incompressible temperature equation. The solver is working already. It is just missing the handling of sources. So, here is what I did:

  • add fvOptions(T) to the temperature equation
  • add fvOptions.constrain(TEqn) to TEqn.H
  • #include "fvIOoptionList.H" to solver .C file
  • #include "createFvOptions.H" to solver .C file
The code of the TEqn file looks like this now (not showing the definition of the coefficient alphaEff):

Code:
      fvScalarMatrix TEqn
      (
          fvm::div(phi, T)
        - fvm::laplacian(alphaEff, T)
        ==
        fvOptions(T)
      );
   
      TEqn.relax();
   
      fvOptions.constrain(TEqn);
   
      TEqn.solve();


Compiling of the solver works fine. But when trying to run a case, I get the following error massage.


Code:
  --> FOAM FATAL ERROR: 
   
      request for basicThermo thermophysicalProperties from objectRegistry region0 failed
      available objects of type basicThermo are
   
  0
  (
  )
From my understanding of this error message, OpenFOAM is missing a thermophysical model. So I am wondering:


Is there a thermophysical model necessary for the implementation of the fixedTemperatureConstraint?

If not, do you have any hints where the error messages might come from?

Thank you very much for your help!
- Fluido -

Last edited by Fluido; August 1, 2013 at 04:37.
Fluido is offline   Reply With Quote

Old   July 30, 2013, 08:08
Default
  #2
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 17
olivierG is on a distinguished road
Hello,

My guess is you forget the "-I$(LIB_SRC)/fvOptions/lnInclude" in your Make/options file.

regards,
olivier
olivierG is offline   Reply With Quote

Old   July 30, 2013, 21:36
Default
  #3
New Member
 
Andre Weiner
Join Date: Aug 2012
Posts: 29
Rep Power: 13
andre.weiner is on a distinguished road
Hey!

You have a simple transport equation for a scalar T, so you have to use the explicitSetValue fvOption. The fixedTemperatureConstraint is for energy equations.
Check also the post of olivier about the wmake options.

regards,
Andre
apple-tree and Fluido like this.
andre.weiner is offline   Reply With Quote

Old   August 1, 2013, 04:20
Default
  #4
New Member
 
Join Date: Jul 2013
Posts: 6
Rep Power: 12
Fluido is on a distinguished road
Quote:
Originally Posted by olivierG View Post
Hello,

My guess is you forget the "-I$(LIB_SRC)/fvOptions/lnInclude" in your Make/options file.

regards,
olivier
Hello Olivier,

thank you for your idea!
I checked the options file once again. The fvOptions entry is there. So, that's not the problem...

Regards
- Fluido -
Fluido is offline   Reply With Quote

Old   August 1, 2013, 04:36
Default
  #5
New Member
 
Join Date: Jul 2013
Posts: 6
Rep Power: 12
Fluido is on a distinguished road
Quote:
Originally Posted by andre.weiner View Post
Hey!

You have a simple transport equation for a scalar T, so you have to use the explicitSetValue fvOption. The fixedTemperatureConstraint is for energy equations.
Check also the post of olivier about the wmake options.

regards,
Andre
Hello Andre,

thank you for the info!

If the fixedTemperatureConstraint is made for energy equations, the call for a thermophysical model makes sense somehow. Can I find this information somewhere inside OpenFOAM (without having to dig deep into the code) or somewhere else?

I will try the explicitSetValue option now...

Regards
- Fluido -
Fluido is offline   Reply With Quote

Old   August 1, 2013, 04:41
Default
  #6
New Member
 
Join Date: Jul 2013
Posts: 6
Rep Power: 12
Fluido is on a distinguished road
There was a little error in my original post. The error message does not appear when compiling, but when running a case with the compiled solver. So, compiling of the solver works, without any errors.
Fluido is offline   Reply With Quote

Old   August 1, 2013, 05:21
Default
  #7
New Member
 
Andre Weiner
Join Date: Aug 2012
Posts: 29
Rep Power: 13
andre.weiner is on a distinguished road
Quote:
Originally Posted by Fluido View Post
Hello Andre,

thank you for the info!

If the fixedTemperatureConstraint is made for energy equations, the call for a thermophysical model makes sense somehow. Can I find this information somewhere inside OpenFOAM (without having to dig deep into the code) or somewhere else?

I will try the explicitSetValue option now...

Regards
- Fluido -
You don't have to dig that deep :-)

Code:
void Foam::fv::fixedTemperatureConstraint::setValue
(
    fvMatrix<scalar>& eqn,
    const label
)
{
    const basicThermo& thermo =
        mesh_.lookupObject<basicThermo>("thermophysicalProperties");

    if (eqn.psi().name() == thermo.he().name())
    {...
This is a part of the member function that sets the value. As you see it looks for some thermophysicalProperties and then it checks your equation for a part called psi and so on. So this fixedTemperatureConstraint is a little more complicated than what you need.

Regards, Andre
Fluido likes this.
andre.weiner is offline   Reply With Quote

Old   August 1, 2013, 10:23
Default
  #8
New Member
 
Join Date: Jul 2013
Posts: 6
Rep Power: 12
Fluido is on a distinguished road
Quote:
Originally Posted by andre.weiner View Post
You don't have to dig that deep :-)

Code:
void Foam::fv::fixedTemperatureConstraint::setValue
(
    fvMatrix<scalar>& eqn,
    const label
)
{
    const basicThermo& thermo =
        mesh_.lookupObject<basicThermo>("thermophysicalProperties");

    if (eqn.psi().name() == thermo.he().name())
    {...
This is a part of the member function that sets the value. As you see it looks for some thermophysicalProperties and then it checks your equation for a part called psi and so on. So this fixedTemperatureConstraint is a little more complicated than what you need.

Regards, Andre
Ok. I had not looked at the .C file yet (or not close enough). But it is quite obvious from code you posted that OpenFOAM would look for a thermophysical model. Thanks!

Meanwhile I tried the explicitSetValue option. I just changed the input in the fvOptions file to:
Code:
source1
{
    type            scalarExplicitSetValue;
    active          true;
    selectionMode   cellZone;
    cellZone         fluid-porous;

    scalarExplicitSetValueCoeffs
    {
        volumeMode      absolute;
        injectionRate
        {
            T              323;
        }
    }
}
And...it works perfectly! :-)

So, thank you again!

- Fluido -
Fluido is offline   Reply With Quote

Old   February 14, 2014, 06:25
Default
  #9
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18
samiam1000 is on a distinguished road
Dear All,

I am trying to do something like what you did, but instead of temperatures, I wanna add in a certain cellSet a constant bodyForce.

Do you have an idea about I can do this?

Thanks a lot,
Samuele
samiam1000 is offline   Reply With Quote

Old   February 15, 2018, 00:30
Default
  #10
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 8
svramana is on a distinguished road
Quote:
Originally Posted by Fluido View Post
Ok. I had not looked at the .C file yet (or not close enough). But it is quite obvious from code you posted that OpenFOAM would look for a thermophysical model. Thanks!

Meanwhile I tried the explicitSetValue option. I just changed the input in the fvOptions file to:
Code:
source1
{
    type            scalarExplicitSetValue;
    active          true;
    selectionMode   cellZone;
    cellZone         fluid-porous;

    scalarExplicitSetValueCoeffs
    {
        volumeMode      absolute;
        injectionRate
        {
            T              323;
        }
    }
}
And...it works perfectly! :-)

So, thank you again!

- Fluido -
Hi,i know i am digging into old thread but i am not able to set "scalarExplicitSetValue" in my fvOptions.

any help is appreciated.

Regards,
s.v.Ramana
svramana is offline   Reply With Quote

Reply

Tags
constraint, fixed temperature, fvoptions, sources, temperature source


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
thobois class engineTopoChangerMesh error Peter_600 OpenFOAM 4 August 2, 2014 09:52
How do I install a custom solver? NJG OpenFOAM Programming & Development 5 January 30, 2013 19:03
Interfoam blows on parallel run danvica OpenFOAM Running, Solving & CFD 16 December 22, 2012 02:09
Unexplained Error during Solver Runs cfb CFX 6 November 9, 2012 15:42
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 14:08


All times are GMT -4. The time now is 06:25.