Transient energy conservation
Hello Foamers, I have been breaking my head over this for the past 2 days, so I would really appreciate it if I could get some feedback on this.
I'm simulating flow through a pipe using a modified version of rhoPimpleFoam with cyclic boundaries at the in- and outlet of my domain while the flow is heated with a constant temperature gradient imposed on the tube wall. The problem however is that when I impose a gradient that is twice as big, the rate at which my gas is heating is only slightly higher and takes a considerable amount of time (~1s) to reach the double value of my initial deltaT/time with half the gradient imposed. I understand that it takes a while to develop a temperature profile but still energy should be conserved, right? Performing additional subiterations offers a slight improvement but still doesn't balance out the energy equation. I thought a good way to monitor the heat going into the volume would be this function: Code:
const fvPatchField<scalar>& heatFluxPatchField = T.boundaryField()[patchI]; The energy equation is standard I'd say: Code:
volScalarField& he = thermo.he(); Anyway, thanks to anyone that might be able to shed some light on this! Best regards, David |
Ok, I isolated the problem to the term "fvm::div(phi, he)", which according to my limited experience with OpenFOAM uses the face values of he. The lack of energy conservation then stems from my inlet patch automatically being converted to a fixedEnergy bc with values that are not being updated according to the changing temperature field.
By running the simulation 10 timesteps at a time and then restarting, the inlet patch is updated each time but obviously that's not an option so I need some way to change the enthalpy values on this patch. I tried all of the stuff below but nothing seems to work, please let me know if there's something else that might! Code:
label patchID = mesh.boundaryMesh().findPatchID("in"); Best regards, David |
All times are GMT -4. The time now is 13:11. |