CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   how to extract value from the previous node (https://www.cfd-online.com/Forums/openfoam-programming-development/237003-how-extract-value-previous-node.html)

Kummi June 25, 2021 07:44

how to extract value from the previous node
 
Hello Foamers,
In my source file (.C), the following segment of code is introduced for 1D problem.
Quote:

if ((T_[cellI] == scalar(100.0)) && (alpha_[cellI] > scalar(0.0)))
{
const Foam::List<int> neigbhorcellI = regionMesh().cellCells(cellI);
forAll(neigbhorcellI, I)
{
if (regionMesh().cellCentres()[I][0] < regionMesh().cellCentres()[cellI][0])
{
QB_[cellI] = K_[I]* ((T_[I] - 100) /0.002); -- > (1)
break ;
}
}
}
In Equ (1), the values of K and T are extracted from previous node and its works fine.

For some reason, I need to implement the above set of code once again in my customized thermo package file (similar location below).
https://github.com/OpenFOAM/OpenFOAM...s/solid/thermo
Here in my thermo package file, I have no idea as how to implement Equ (1) by accessing values from previous node because, there are no arguments to ‘regionMesh’ that depend on a template parameter.

Kindly someone guide me out here.
Thank you


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