How to read and change temperature results at each time step in buoyantPimpleFoam?
I am an inexperienced user of OpenFoam and C++. I am using buoyantPimpleFoam solver to simulate ventilation in a small building.
My aim is to change temperature of wall patches at each time step. The temperature of the internal surfaces of walls will be calculated by a small piece of C++ code implementing the finite difference method. I cannot use timeVaryingFixedValue boundary condition, because the wall temperature at a given time step will depend also on the temperature of air near the wall. It must be calculated each time.
At first, I wanted to create my own boundary condition to do this task, but the OpenFOAM's code intimidated me a little bit... Modifying the solver should be the easier way, so now I am trying to read the temperature at each time step directly in the solver and then modify it due to my finite difference calculations.
However, I am able to read and change velocity U, pressure p and enthalpy h at each time step, but the temperature cannot be accessed directly.
Should I change it indirectly by changing the enthalpy or there is a simpler solution?
Can anyone give me a clue, how to start?
I will appreciate any help.
I understand - let me specify my question :)
At each time step I want to change the temperature of a given boundary patch - let's say "myPatch".
I would like to do this directly in the solver buoyantPimpleFoam.
I figured out, that the probable procedure should look something like this:
1) find out the ID of "myPatch", what can be done by including the following code inside the solver code:
The problem is, that the temperature boundary condition type of myPatch is set to "fixedValue", what results in constant temperatures of myPatch even though I change its enthalpy at each time step.
How to force the solver to recalculate the temperature of this patch at each time step?
Do I have to modify the BC?
Ok, I have finally worked it out. The solution was easy, so I am sorry for cluttering up the forum.
The patch temperature can be changed directly by usint const_cast:
|All times are GMT -4. The time now is 02:55.|