|
[Sponsors] |
Adding a temperature dependent FvOptions in ChtMultiRegionFoam for an electric oven |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Arunkl
Join Date: Jun 2024
Posts: 7
Rep Power: 2 ![]() |
I am new to heat transfer solvers in openfoam and working to simulate an electric oven. in this there is four coils and air region. I am using chtMultiRegionFoam for this as it has multiple regions. I have came through Fvoptions which is time dependent but i need to model Temperature dependent so that if the mean temperature increases upto 250 C it should supply heat and turn off the heat source. Again if the temperature reduces it should on the heat source. I have attached the basic Coding i have done and thankyou in advance for your most thankful help... this is for natural convection to the air
Code:
options { energySource { type scalarSemiImplicitSource; selectionMode cellSet; cellSet ignition; volumeMode specific; sources { h (2e7 0); // kg/m/s^3 } // Temperature-dependent behavior code #{ // Get the mean temperature from the temperature field const scalar T_mean = T.mean(); // Assuming T is the temperature field variable // Check if T_mean exceeds 250 °C if (T_mean >= 250 + 273.15) // Convert 250 °C to Kelvin { return 0; // Turn off the heat source if T_mean is 250 °C or higher } else { // Return the source value only if the temperature is below 250 °C return h; // Return the defined source value } #}; } } thank you |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Lasse Brams Vinther
Join Date: Oct 2015
Posts: 119
Rep Power: 11 ![]() |
Hello Arunkl,
I'm not 100% certain in the best way to do this, however, one solution I could think of is to use scarcodedsource with the if statement inside the source equation or in the solver, further described below. Code:
energySource { type scalarCodedSource; //scalarSemiImplicitSource active true; name sourceTime; scalarCodedSourceCoeffs //scalarSemiImplicitSourceCoeffs S(x) = Su + Sp*x // q in [W]; or in [W/m³] if you use specific mode { selectionMode cellZone; cellZone porousity1; fields (h); fieldNames (h); name sourceTime; codeInclude #{ #}; codeCorrect #{ // Pout<< "**codeCorrect**" << endl; #}; codeAddSup #{ // const Time& time = mesh().time(); const scalarField& V = mesh_.V(); const vectorField& C = mesh_.C(); const volVectorField& U = mesh().lookupObject<volVectorField>("U"); const volScalarField z = U.mesh().C() & vector(0,0,1); scalarField& hSource = eqn.source(); forAll(C, i) { hSource[i] -= 6*((497530 - 530371*exp(-174.834*mag(0.311582803726196-z[i])))*V[i]); } // Pout << "***codeAddSup***" << endl; #}; codeSetValue #{ // Pout<< "**codeSetValue**" << endl; #}; // Dummy entry. Make dependent on above to trigger recompilation code #{ $codeInclude $codeCorrect $codeAddSup $codeSetValue #}; } sourceTimeCoeffs { // Dummy entry } } https://github.com/Swagga5aur/chtMultiRegionReactorFoam I sadly don't have much time privately, so hope this can help you along. Best regards, Lasse Brams Vinther |
|
![]() |
![]() |
![]() |
Tags |
cht modelling, chtmultiregion, chtmultiregionfoam, heat and mass transfer, openfoam |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 09:21 |
Averaging over iterations for steady-state simulation | CFD student | Fluent UDF and Scheme Programming | 8 | September 22, 2022 03:39 |
Help with chtMultiRegionFoam | jbvw96 | OpenFOAM Running, Solving & CFD | 2 | December 26, 2010 17:16 |
Adding a new temperature dependent viscositymodel? | dgadensg | OpenFOAM Programming & Development | 10 | May 22, 2010 05:47 |
flow simulation across a small fan | jane luo | Main CFD Forum | 15 | April 12, 2004 17:49 |