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

Modifying TEqn.H to access and use the U field

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 19, 2021, 14:14
Default Modifying TEqn.H to access and use the U field
  #1
Member
 
J.D. Wilson
Join Date: Nov 2020
Location: Edmonton, Canada
Posts: 34
Rep Power: 6
JayDeeUU is on a distinguished road
I'm creating a slightly modified solver based on buoyantBoussinesqPimpleFoam. What I want to do is modify TEqn.H by adding a term that (implicitly) represents vertical advection of a background temperature gradient, say, - w dT0/dz. The idea is to look at the effect of stratification on a weak, buoyancy-driven flow. I have been guided by, and tried to follow along with, these helpful forum entries:

https://openfoamwiki.net/index.php/HowTo_Add_a_Coriolis_Force_And_Make_a_Tornado

http://https://www.cfd-online.com/Fo...-equation.html


In transportProperties I define the background temperature gradient, e.g.

Code:
gradT0 [0 -1 0 1 0 0 0] (0.0 0.0 0.1)
and in readTransportProperties I added an entry

Code:
dimensionedVector gradT0
(
    "gradT0",
    dimensionSet(0,-1,0,1,0,0,0),
    laminarTransport
);
The modified solver compiles just fine, if I don't add my new term in TEqn.H. However so soon as I add the new term, viz. the last term shown below

Code:
fvScalarMatrix TEqn
    (
        fvm::ddt(T)
      + fvm::div(phi, T)
      - fvm::laplacian(alphaEff, T)
     ==
        radiation->ST(rhoCpRef, T)
      + fvOptions(T)      
      - U & gradT0
   );
the solver no longer compiles, and wmake produces many messages, the most easily comprehensible of which is:

Code:
TEqn.H:28:9: note:   mismatched types ‘Foam::DimensionedField<Type, Foam::volMesh>’ and ‘Foam::fvMatrix<double>’
       - U & gradT0
I understand that my gradT0, unlike U, is not a time-varying vector field, and that this may be related to the problem. I'm not an experienced C++ programmer so this is liable to be an elementary mistake on my part. Any suggestions as to how to fix the problem will be greatly appreciated. Thanks, John. (Note: I'm using OpenFOAM 2006.)

Last edited by JayDeeUU; January 19, 2021 at 14:25. Reason: Clarification
JayDeeUU 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



All times are GMT -4. The time now is 21:14.