|
[Sponsors] |
Reaction rate depending on the temperature field |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 9, 2014, 05:48 |
Reaction rate depending on the temperature field
|
#1 |
Member
Thamali
Join Date: Jul 2013
Posts: 67
Rep Power: 12 |
Hi all,
I am trying to apply a reaction rate depending on the temperature of the solid phase for my new solver. After runnig "wmake" it shows some errors.Can someone help me on finding the error. my code is to calculate the "dryingRate" depending on the temperature.
my code is as follows, forAll(ts,celli) //ts is a volScalarField { if(ts[celli]<hunderdCel.value()) //this is 373K {dimensionedScalar dryingRate[celli]=scalar(6)*massTransCoeff[celli]*(Ymoist[celli]*rhos[celli]-YH2O[celli]*rho)/F; //return dryingRate[celli]; } else if(ts[celli]=(hunderdCel.value())) { dimensionedScalar dryingRate[celli]=scalar(6)*(convectiveHeatTransCoeff[celli] *(tg[celli] -ts[celli] )+scalar(0.9)*stephBoltz*(pow(298.15,4)-pow(ts[celli] ,4)))/(F*VapHeat); //return dryingRate[celli]; } //else(ts[celli]>hunderdCel.value()); else {dimensionedScalar dryingRate=Zero;} //return dryingRate[celli];} } please see whether can someone find the error.The error is as follows, createFields.H:1046:115: error: variable-sized object ‘dryingRate’ may not be initialized {dimensionedScalar dryingRate[celli]=scalar(6)*massTransCoeff[celli]*(Ymoist[celli]*rhos[celli]-YH2O[celli]*rho)/F; ^ createFields.H:1046:21: warning: unused variable ‘dryingRate’ [-Wunused-variable] {dimensionedScalar dryingRate[celli]=scalar(6)*massTransCoeff[celli]*(Ymoist[celli]*rhos[celli]-YH2O[celli]*rho)/F; ^ createFields.H:1049:40: warning: suggest parentheses around assignment used as truth value [-Wparentheses] else if(ts[celli]=(hunderdCel.value())) ^ createFields.H:1052:174: error: variable-sized object ‘dryingRate’ may not be initialized dimensionedScalar dryingRate[celli]=scalar(6)*(convectiveHeatTransCoeff[celli] *(tg[celli] -ts[celli] )+scalar(0.9)*stephBoltz*(pow(298.15,4)-pow(ts[celli] ,4)))/(F*VapHeat); ^ createFields.H:1052:20: warning: unused variable ‘dryingRate’ [-Wunused-variable] dimensionedScalar dryingRate[celli]=scalar(6)*(convectiveHeatTransCoeff[celli] *(tg[celli] -ts[celli] )+scalar(0.9)*stephBoltz*(pow(298.15,4)-pow(ts[celli] ,4)))/(F*VapHeat); ^ Thanks in advance. |
|
January 11, 2014, 05:37 |
|
#2 |
Member
Thamali
Join Date: Jul 2013
Posts: 67
Rep Power: 12 |
still trying to do the above but not working,I did some amendments to the coding which seemed to me errorneous.
added following internalFields. scalarField& tgCells =tg.internalField(); //scalarField& dryingRateCells =dryingRate.internalField(); scalarField& massTransCoeffCells =massTransCoeff.internalField(); scalarField& YmoistCells =Ymoist.internalField(); scalarField& rhosCells =rhos.internalField(); scalarField& convectiveHeatTransCoeffCells=convectiveHeatTransC oeff.internalField(); scalarField& tsCells =ts.internalField(); scalarField& YH2OCells=YH2O.internalField(); forAll(tgCells,celli) { if (mag(tgCells[celli])<373.15) { dimensionedScalar dryingRateCells[celli]=scalar(6)*massTransCoeffCells[celli]*(YmoistCells[celli]*rhosCells[celli]-YH2OCells[celli]*rho)/F; } else { if (mag(tgCells[celli])==373.15) dimensionedScalar dryingRateCells[celli]=scalar(6)*(convectiveHeatTransCoeffCells[celli] *(tgCells[celli] -tsCells[celli] )+scalar(0.9)*stephBoltz*(pow(298.15,4)-pow(tsCells[celli] ,4)))/(F*VapHeat); else dimensionedScalar dryingRateCells[celli]=Zero; } } But this does not work.Following are the errors.I am struggling to get over with it. createFields.H:1019:139: error: variable-sized object ‘dryingRateCells’ may not be initialized dimensionedScalar dryingRateCells[celli]=scalar(6)*massTransCoeffCells[celli]*(YmoistCells[celli]*rhosCells[celli]-YH2OCells[celli]*rho)/F; ^ createFields.H:1019:20: warning: unused variable ‘dryingRateCells’ [-Wunused-variable] dimensionedScalar dryingRateCells[celli]=scalar(6)*massTransCoeffCells[celli]*(YmoistCells[celli]*rhosCells[celli]-YH2OCells[celli]*rho)/F; ^ createFields.H:1025:201: error: variable-sized object ‘dryingRateCells’ may not be initialized dimensionedScalar dryingRateCells[celli]=scalar(6)*(convectiveHeatTransCoeffCells[celli] *(tgCells[celli] -tsCells[celli] )+scalar(0.9)*stephBoltz*(pow(298.15,4)-pow(tsCells[celli] ,4)))/(F*VapHeat); ^ createFields.H:1025:22: warning: unused variable ‘dryingRateCells’ [-Wunused-variable] dimensionedScalar dryingRateCells[celli]=scalar(6)*(convectiveHeatTransCoeffCells[celli] *(tgCells[celli] -tsCells[celli] )+scalar(0.9)*stephBoltz*(pow(298.15,4)-pow(tsCells[celli] ,4)))/(F*VapHeat); ^ createFields.H:1029:45: error: variable-sized object ‘dryingRateCells’ may not be initialized dimensionedScalar dryingRateCells[celli]=Zero; ^ createFields.H:1029:22: warning: unused variable ‘dryingRateCells’ [-Wunused-variable] dimensionedScalar dryingRateCells[celli]=Zero; ^ createFields.H:1013:19: warning: unused variable ‘dryingRateCells’ [-Wunused-variable] dimensionedScalar dryingRateCells[mesh.nCells()]; ^ If anyone can see where are the errors come from,I am grateful. Thanks. Last edited by Thamali; January 12, 2014 at 00:44. Reason: errors |
|
January 13, 2014, 06:14 |
Answer
|
#3 |
Member
Thamali
Join Date: Jul 2013
Posts: 67
Rep Power: 12 |
Even I did not receive any reply.I would like to mention,how I solved this.(I hope this method is correct)
Instead of declaring 373.15 or it as a dimensionedScalar,I declared that too as a volScalarField.And directly compared it with ts, volScalarField dryingRate =volScalarField::null(); volScalarField dryingRate1=-scalar(6)*massTransCoeff*(Ymoist*rhos-YH2O*rho)/F; volScalarField dryingRate2=-scalar(6)*(convectiveHeatTransCoeff *(tg -ts)+scalar(0.9)*stephBoltz*(pow(298.15,4)-pow(ts,4)))/(F*VapHeat); //volScalarField dryingRate3=0; const volScalarField hundredCel ( IOobject ( "hundredCel", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh //dimensionedScalar("zero", dimTemperature, 0.0), //zeroGradientFvPatchScalarField::typeName ); if(ts<hundredCel) dryingRate=dryingRate1; else { if(ts<hundredCel) dryingRate=dryingRate2; else dryingRate=volScalarField::null(); } If there is any thing wrong in the coding please let me know. Thamali |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 10:21 |
field function for reaction rate | Mr.Hack | STAR-CCM+ | 3 | June 3, 2016 04:29 |
Mass Flow Rate Custom Field Function | AJoubert | FLUENT | 2 | March 23, 2013 09:50 |
write forward, reverse reaction coefficient, reaction rate in ChemFoam | hismother | OpenFOAM Running, Solving & CFD | 3 | November 7, 2012 04:33 |
surface reaction rate plot at diffusiion limit cas | Jason | FLUENT | 1 | August 22, 2003 05:54 |