|
[Sponsors] |
July 9, 2014, 16:46 |
Accessing boundaryField temperature
|
#1 |
Member
Clint Bedick
Join Date: May 2011
Posts: 43
Rep Power: 15 |
I am working on modifying LocalInteraction.C so that I can implement a new type of impact model (in addition to rebound, escape, and stick). It will be based on experimental data and will determine the restitution velocity (or stick) based on some properties and conditions.
I want to access the wall temperature at the impact site. This existing code is saving the accumulated mass for a given impact location for the "stick" condition: label pI = pp.index(); label fI = pp.whichFace(p.face()); massStick().boundaryField()[pI][fI] += dm; I figured I could similarly use the following bit of code to extract the temperature at the impact point: label pI = pp.index(); label fI = pp.whichFace(p.face()); scalar Twall = T.boundaryField()[pI][fI]; A few lines up for both, pp and p are set with: this->owner().patchData(p, pp, trackFraction, tetIs, nw, Up); Is there a fundamental problem with what I want to do here? Or am I maybe not including the required libraries or defining Twall incorrectly? The error I'm getting is something like: Foam::T does not have class type. Thanks! -Clint |
|
July 11, 2014, 15:59 |
|
#2 |
Member
Clint Bedick
Join Date: May 2011
Posts: 43
Rep Power: 15 |
I'm bumping this up because I'm still struggling here. From all the threads I've read, I was almost sure using T.boundaryField() would get me the boundary temperature. I checked the patch index and face index, [pI] and [fI]. They both appear to be correct, and change for each new location where a particle impacts.
Do I need to include some other library or define T.boundaryField() differently somehow since I am doing it within the particle interaction classes? (compared to one of the classes related to the fluid equations) And similarly, I am having trouble extracting particle temperature. I can get velocity easily using p.U(). Is the kinematic data for the particles stored separately from the thermo data? I cannot get Cp, etc either from the "p." methods. Thanks so much! |
|
July 13, 2014, 11:20 |
|
#3 |
Member
Clint Bedick
Join Date: May 2011
Posts: 43
Rep Power: 15 |
OK I keep making little bits of progress of this. I figured out how to get all of the particle info at impact. In fact, "p" has it all stored in some sort of string or list format (I have only output it to a text file so far), but there isn't a method for grabbing out the temperature entry. I'm hoping I can just save it as a list and specify the index for temperature to extract it.
But the wall temperature is still causing me problems. I've been looking through the polyPatch source code and there a few methods defined that get me closer. I can use p.boundaryMesh()[pI][fI] to get information related to the impact location on the patch (returns cell indices, centers, etc). But I'm not sure how to actually get a boundary temperature. Does anybody know if you are able to get the temperature of a polyPatch somehow? Or is that only tied to the mesh itself and not any boundary field quantities? |
|
July 15, 2014, 16:41 |
|
#4 |
Member
Clint Bedick
Join Date: May 2011
Posts: 43
Rep Power: 15 |
Bumping this up because I still need help with it. I cannot figure out why I cannot access volScalarFields like T, U, and subsequently the boundaryFields from within LocalInteraction.C
This is in: src/lagrangian/intermediate/submodels/Kinematic/PatchInteraction/LocalInteraction Thanks everyone! |
|
July 16, 2014, 15:22 |
|
#5 |
Member
Clint Bedick
Join Date: May 2011
Posts: 43
Rep Power: 15 |
AHA!! Success!
I just want to post back here in case anyone tries to do something similar in the future. In the src/lagrangian/intermediate/submodels/Kinematic/PatchInteraction/LocalInteraction/LocalInteraction.C file, there is a method called "correct". This is what modifies the particle velocity so it rebounds if it is determined the particle hits a wall. I wanted to access the wall temp within this method. That doesn't work. Apparently the mesh isn't directly accessible there. So on a whim, I created a new method in the LocalInteraction class called "Tw", which was almost an exact copy of some other methods that crate some volScalarFields to save the mass accumulated from "stick" and "escape" impacts. My method looked like this: template<class CloudType> Foam::scalar Foam::LocalInteraction<CloudType>::Tw ( const label pI, const label fI ) { const fvMesh& mesh = this->owner().mesh(); const volScalarField Tfield = mesh.lookupObject<volScalarField>("T"); return Tfield.boundaryField()[pI][fI]; } Basically, it takes the patch and cell index as arguments, grabs the mesh, accesses the temp field with the objectRegistry and then returns the boundaryField value at that location. I actually can't believe how clean of a solution this ended up being, but it works perfectly. I can call this method from within the "correct" method to spit out the wall temp at the impact location. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 07:15 |
Static Temperature / Opening Temperature | JulianP | CFX | 12 | April 10, 2019 18:00 |
UDF Macros for accessing radiation temperature | Tomb | FLUENT | 2 | June 4, 2015 22:15 |
Calculation of the Governing Equations | Mihail | CFX | 7 | September 7, 2014 06:27 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 01:27 |