|
[Sponsors] |
How to control the heat source according to the temperature of a point? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 13, 2022, 10:49 |
How to control the heat source according to the temperature of a point?
|
#1 |
New Member
chenfuqiang
Join Date: Nov 2022
Posts: 3
Rep Power: 4 |
Dear community,
I want to get the temperature ''Tpoint'' at a point in the geometry. When Tpoint ≥150℃, set the heat source to 0, and when Tpoint < 150℃, set the heat source to a value, like 100.Can I get the ''Tpoint'' using the probe? Can I add an if statement about Tpoint before the energy equation of the solver? Could you give me some tips to achieve this? Thank you in advance. |
|
December 19, 2022, 11:18 |
|
#2 |
Senior Member
Join Date: Dec 2019
Location: Cologne, Germany
Posts: 369
Rep Power: 8 |
fvOptions or fvModels should do the trick here.
|
|
January 3, 2023, 05:15 |
control the temperature every 0.5s
|
#3 |
New Member
chenfuqiang
Join Date: Nov 2022
Posts: 3
Rep Power: 4 |
Hi geth03,
Thank you very much for your reply. I modified chtMultiRegionFoam/solid/solveSolid.H. Please find it below: Code:
{ while (pimple.correctNonOrthogonal()) { //control point fvMesh& mesh = solidRegions[i]; point position = point(0.0425,0.021,0.135); label mycell = mesh.findCell(position); const Foam::volScalarField& T = mesh.lookupObject<Foam::volScalarField>("T"); scalar Tcell = T[mycell]; reduce(Tcell, maxOp<scalar>()); // if (Tcell < 340) { fvScalarMatrix hEqn ( fvm::ddt(betav*rho, h) - ( thermo.isotropic() ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)") : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)") ) + poy //poy is volScalarField. == fvOptions(rho, h) ); } else { fvScalarMatrix hEqn ( fvm::ddt(betav*rho, h) - ( thermo.isotropic() ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)") : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)") ) == fvOptions(rho, h) ); } } } hEqn.relax(); fvOptions.constrain(hEqn); hEqn.solve(); fvOptions.correct(h); thermo.correct(); Info<< "Min/max T:" << min(thermo.T()).value() << ' ' << max(thermo.T()).value() << endl; I use: Code:
if (runTime.value()==0 or fmod(runTime.value(), 0.5) ==0)//Multiple of 0.5 {the above code} I dont know how to judge every 0.5s instead of judge by the deltaT. Thank you in advance! |
|
January 3, 2023, 10:41 |
Has solved
|
#4 |
New Member
chenfuqiang
Join Date: Nov 2022
Posts: 3
Rep Power: 4 |
Has solved!Do you have a better solution? Please tell me!
Code:
fvMesh& mesh = solidRegions[i]; point position = point(0.0425,0.021,0.135); label mycell = mesh.findCell(position); const Foam::volScalarField& T = mesh.lookupObject<Foam::volScalarField>("T"); //scalar Tcell = VGREAT; //if (mycell != -1) //{ scalar Tcell = T[mycell]; //} reduce(Tcell, maxOp<scalar>()); bool flag ; for (double tt = 0;tt<100;tt=tt+0.5) { if (tt <= runTime.value() < tt+0.5) { if (Tcell > 310 and runTime.value() == tt) {flag = true;} if (Tcell <= 310 and runTime.value() == tt) {flag = false;} } } if (flag) { fvScalarMatrix hEqn ( fvm::ddt(betav*rho, h) - ( thermo.isotropic() ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)") : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)") ) == fvOptions(rho, h) ); hEqn.relax(); fvOptions.constrain(hEqn); hEqn.solve(); fvOptions.correct(h); } if (!flag) { fvScalarMatrix hEqn ( fvm::ddt(betav*rho, h) - ( thermo.isotropic() ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)") : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)") ) + poy_recv == fvOptions(rho, h) ); hEqn.relax(); fvOptions.constrain(hEqn); hEqn.solve(); fvOptions.correct(h); } |
|
Tags |
control point, control valve, heat equation, heat source term, value of interest |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swak4foam for OpenFOAM 4.0 | mnikku | OpenFOAM Community Contributions | 80 | May 17, 2022 09:06 |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 17:02 |
friction forces icoFoam | ofslcm | OpenFOAM | 3 | April 7, 2012 11:57 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |