|
[Sponsors] |
Questions about the object registry and radiation models |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 12, 2021, 17:43 |
Questions about the object registry and radiation models
|
#1 |
Member
Fabian Friberg
Join Date: Dec 2020
Posts: 31
Rep Power: 5 |
Am I understanding the object registry right, in it being an inter-class database that can be accessed from any class with access to the mesh?
I'm trying to figure out how the viewFactor radiation model works. 1. viewFactor.C's Ru() and Rp() functions return IOobjects with value zero, meaning it gives no contribution to the energy equation radiation term. From what I understand, it instead calculates the boundary heat flux, qr_, for which it creates an IOobject "qr" for boundary condition equations to read. But in viewFactor.calculate() it never changes qr_ (only relaxes it). Instead it changes the q and qrp fields, but these are not connected to any IOObject. So what does viewFactor actually do? How does it send the flux to the solvers? 2. In openfoam v2012, there's a library for modelling sunlight called solarLoad. It works as a standalone radiation model, but also, FvDOM and viewFactor radiation models are able to include it in their own modeling. They create an instance of the solarLoad class called solarLoad_, and then call solarLoad.calculate() like so: Code:
void Foam::radiation::viewFactor::calculate() { // Store previous iteration qr_.storePrevIter(); if (useSolarLoad_) { solarLoad_->calculate(); } ... } Code:
Ru_[cellI] += ( reflectedFaces_->qreflective(bandI). boundaryField()[patchID][i] * sf[i] )/V[cellI]; solarLoad_.Ru() is never called from viewFactor. Does solarLoad_.calculate() store it in the "Ru" IOObject in the object registry? But when viewFactor.Ru() is called, it returns a new "Ru" IOObject with value zero. Won't that overwrite the old value? 3. If I have a variable T_, assigned by T_(IOObject("T", ...)) and then change T_ (for example, by adding 5 to it), will that change automatically register in the Object registry? Because that seems to be the only way solarLoad_ calculate (called from viewFactor.C or FvDOM.C) could have any effect on the radiation term. Thanks! Edit: Looking further into solarLoad.C, I see more examples of variables that are only ever assigned values, but never read. For example, qrBf. It's modified in solarLoad.C multiple times, but never read. It isn't read in ratiationModel.C either, however it is read in viewFactor.C. But they should still be in different scopes, no? Since viewFactor.C creates a pointer to a solarLoad object instead of including the file directly. Last edited by lumpor; January 12, 2021 at 18:47. |
|
January 13, 2021, 11:10 |
|
#2 |
New Member
Morteza Mousavi
Join Date: Jul 2019
Location: Lund, Sweden
Posts: 15
Rep Power: 7 |
Hi Fabian,
1- I think you are right about the object registry. About your first question, you are right Ru() and Rp() are zero in viewFactor model, so the source term in EEqn will be zero. It makes sense, because in veiw factor model, we are not solving any equation inside the domain, but we can only estimate the radiative heat flux at the boundaries. In the veiwFactor.C file, the qrBf is defined as a reference to the boundary field of qr_ with the following code: Code:
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef(); Code:
"bottomAir_to_.*" { type compressible::turbulentTemperatureRadCoupledMixed; value $internalField; Tnbr T; kappaMethod fluidThermo; qrNbr none; qr qr; } 2- You can take a look at the radiationModel.C and radiationModel.H to find your answer. The solvers (e.g. chtMultiRegionFoam) use radiationModel::Sh() in the EEqn.H. viewFactor class is derived from radiationModel class and inherits all of its functions, including Sh() function. The Ru() and Rp() are used in the Sh() function to calculate the source term. 3- I think if you change the volScalarField T, it automatically updates its value in object registry. But I believe none of the radiation models would directly change the T field! They can only affect the solution either through the source term in EEqn or through the boundary conditions as mentioned above. I hope this answers your questions. Best regards, Morteza |
|
January 13, 2021, 12:18 |
|
#3 |
Member
Fabian Friberg
Join Date: Dec 2020
Posts: 31
Rep Power: 5 |
Hi Morteza,
Thanks for your answers, I understand the object registry and viewFactor better now, I didn't realize what boundaryFieldRef() did. There is however something unclear to me regarding question 2. Like you said, the solver calls the radiationModel::Sh() function, which viewFactor inherited from radiationModel. The Sh() function then calls on the Ru() function (and the Rp() function), which should refer to its own functions (since there is no solarLoad:: before the call or anything like that). Since viewFactor::Ru() looks like this: Code:
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::radiation::viewFactor::Ru() const { return tmp<DimensionedField<scalar, volMesh>>::New ( IOobject ( "Ru", mesh_.time().timeName(), mesh_, IOobject::NO_READ, IOobject::NO_WRITE, false ), mesh_, dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) ); } Edit: Nevermind, I think I connected the dots. solarLoad has the branch Code:
if (includeMappedPatchBasePatches[patchID]) |
|
|
|