|
[Sponsors] |
February 20, 2018, 05:23 |
fvOption functionality
|
#1 |
Member
PATRICIA NAKANWAGI
Join Date: May 2017
Posts: 47
Rep Power: 9 |
Hello all,
I am having trouble with adding a heat source to my model using fvOptions. I am trying to model heat transfer in a solar pond, my main source of energy being the sun, which i need to add as a source term in my OpenFoam model. I am abit confused on how to enable the fvoptions file in my system folder. I am using buoyantBoussinesqSimpleFoam, OpenFoam 5.0. Thank you for your help PATRICIA |
|
February 20, 2018, 07:42 |
|
#2 |
New Member
Osman Mirza Demircan
Join Date: May 2017
Location: Ankara, Türkiye
Posts: 29
Rep Power: 9 |
Hi,
Simply placing the fvOptions file in the /system directory was sufficient for my case, OpenFOAM automatically reads the file when executing the selected solver. Check your log file to see if your solver reads your fvOptions file, if yes, it should write something like the following: Creating finite volume options from "system/fvOptions" Selecting finite volume options model type limitTemperature Source: limitTemperature - selecting all cells - selected 27300 cell(s) with volume 0.134187
__________________
Osman Mirza Demircan |
|
February 20, 2018, 08:40 |
|
#3 |
Member
PATRICIA NAKANWAGI
Join Date: May 2017
Posts: 47
Rep Power: 9 |
Thanks Omdemircan,
A quick one, how am I able to check my log file to see if fvOptions is supported? Any command for that. Am really sorry to over ask, but am abit confused in this. Do I have to add some thing somewhere to effect it in my sytem folder, or what. Thank you |
|
February 20, 2018, 08:47 |
|
#4 |
New Member
Osman Mirza Demircan
Join Date: May 2017
Location: Ankara, Türkiye
Posts: 29
Rep Power: 9 |
For instance, you can type the following in order to output a log file in real time when using sonicFoam:
sonicFoam > log &
__________________
Osman Mirza Demircan |
|
February 20, 2018, 09:06 |
|
#5 |
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12 |
Hello Patricia,
the fvOptions file has to be saved unter <your case>\constant\ . Adding a (heat) source to your simulation can be done by using the scalarSemiImplicitSource. Code:
scalarSource { type scalarSemiImplicitSource; active true; scalarSemiImplicitSourceCoeffs { volumeMode specific; selectionMode cellSet; cellSet c1; injectionRateSuSp { T (1 0); } } } Code:
selectionMode points; points ( (1.1 -1.01 -0.1) (1.1 -1.01 0) ); |
|
February 20, 2018, 09:40 |
|
#6 |
Member
PATRICIA NAKANWAGI
Join Date: May 2017
Posts: 47
Rep Power: 9 |
Thanks alot for your replies,
@RobertHB, saving the fvOptions file in my case is exactly my challenge. I have read some information in this line, and according to my understanding, my buoyantBoussinesqSimpleFoam in OpenFoam 5.0 fully supports this functionality. I just need to have this file either in my constant or system dictionary for my case to be able to add my source terms, which am failing to figure out how to do. Kindly through more light on how to save this file. Thank you once again. |
|
February 20, 2018, 09:54 |
|
#7 | |
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12 |
Quote:
Code:
fvScalarMatrix TEqn ( fvm::div(phi, T) - fvm::laplacian(alphaEff, T) == radiation->ST(rhoCpRef, T) + fvOptions(T) ); Here is a pretty detailed tutorial about implementing source terms: https://foamingtime2.wordpress.com/s...th-generation/ |
||
February 20, 2018, 10:05 |
|
#8 |
Member
PATRICIA NAKANWAGI
Join Date: May 2017
Posts: 47
Rep Power: 9 |
My problem is where to save this file, and how. because neither does my constant/system dictionaries have the fvOptions file detected.
|
|
February 20, 2018, 11:08 |
|
#9 | |
Member
Join Date: Dec 2017
Location: Germany
Posts: 48
Rep Power: 8 |
Quote:
I would have put the fvOptions into the system folder. I know (at least I think so) that for multiregion solvers it has to be in constant. Can you post your fvOptions file here? Full file with header please. |
||
February 21, 2018, 05:29 |
|
#10 | |
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12 |
I had another look at it and apparently (at least back in 2015, LINK) the fvOptions Dict could be placed in either constant or system.
Quote:
//edit: But the question of constant vs. system is easy to check, right? Place it in either, does it run? > No? > Try the other. Does it run? > No? You probably messed up or your solver doesn't support fvOptions. |
||
February 22, 2018, 04:52 |
|
#11 | |
Member
Join Date: Dec 2017
Location: Germany
Posts: 48
Rep Power: 8 |
Quote:
But I have another question regarding injectionRateSuSp. Code:
injectionRateSuSp { variable_name (Sc Sp); } I always see Sp=0 and Sc with a value. What would happen if I set Sc=0 and Sp gets the value. I am going to try it but wanted to ask you guys as well |
||
February 22, 2018, 06:07 |
|
#12 | ||
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12 |
Quote:
Quote:
|
|||
February 22, 2018, 08:51 |
|
#13 |
Member
PATRICIA NAKANWAGI
Join Date: May 2017
Posts: 47
Rep Power: 9 |
Greetings all,
I succeeded in creating an fvOption file for a test case I am trying out, however I am getting this error when I try to run the case /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.4.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.4.0-dcea1e13ff76 Exec : buoyantBoussinesqSimpleFoam Date : Feb 22 2018 Time : 18:50:41 Host : "tflows-PowerEdge-R410" PID : 5969 Case : /home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1 nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Reading g Reading thermophysical properties Reading field T Reading field p_rgh Reading field U Reading/calculating face flux field phi Selecting incompressible transport model Newtonian Creating turbulence model Selecting RAS turbulence model kEpsilon kEpsilonCoeffs { Cmu 0.09; C1 1.44; C2 1.92; sigmaEps 1.3; } Reading field alphat Calculating field g.h Creating finite volume options from "constant/fvOptions" Selecting finite volume options model type scalarCodedSource --> FOAM FATAL IO ERROR: keyword selectionMode is undefined in dictionary "/home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/constant/fvOptions.radiation" file: /home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/constant/fvOptions.radiation from line 21 to line 96. From function dictionary::lookupEntry(const word&, bool, bool) const in file db/dictionary/dictionary.C at line 442. FOAM exiting Kindly advise on how I can do away with this error Thank you |
|
February 22, 2018, 08:55 |
|
#14 |
Member
PATRICIA NAKANWAGI
Join Date: May 2017
Posts: 47
Rep Power: 9 |
The fvOption file is as follows
radiation { type scalarCodedSource; active yes; name radiativeHeatExchange; scalarCodedSourceCoeffs { selectionMode all; fields (T); codeInclude #{ // Need this for Stefan-Boltzmann constant #include "constants.H" #}; codeCorrect #{ #}; codeAddSup #{ using constant:hysicoChemical::sigma; if (not isActive()) return; // Looking up model parameters scalar Qsm = coeffs().lookupOrDefault<scalar>("Qsm", 164.0); scalar rhow = coeffs().lookupOrDefault<scalar>("rho", 1000); scalar Cp = coeffs().lookuoOrDefault<scalar>("Cp", 4200); scalar Rt = coeffs().lookupOrDefault<scalar>("Rt", 0.03); scalar ew = coeffs().lookupOrDefault<scalar>("ew", 0.97); // Getting source vector from equation matrix scalarField& src = eqn.source(); const volScalarField& T = eqn.psi(); // Iterating through patch word top_patch_name = coeffs().lookupOrDefault<word>("patch", "top"); const fvPatch& pp = mesh().boundary()[top_patch_name]; forAll(pp, i) { label cell_i = pp.faceCells()[i]; scalar Ai = pp.magSf()[i]; scalar Ts = T[cell_i]; // Heating src[cell_i] -= Qsm*(1-Rt)*Ai/rhow/Cp; // Cooling src[cell_i] -= -sigma.value()*ew*paw4(Ts)*Ai/rhow/Cp; } #}; codeSetValue #{ #}; code #{ $codeInclude; $codeCorrect; $codeAddSup; $codeSetValue; #}; } radiativeHeatExchangeCoeffs { selectionMode all; patch top; // Name of the top patch Qsm 163.0; // Solar radiative heat flux Rt 0.03; // Reflectivity of water ew 0.97; // Emissivity of water rho 1000.0; Cp 4200.0; } } // fvOption to describe evaporation heat losses evaporation { type scalarCodedSource; active yes; name evaporationHeatLosses; scalarCodedSourceCoeffs { selectionMode all; fields (T); codeInclude #{ #}; codeCorrect #{ #}; codeAddSup #{ if (not isActive()) return; // Looking up model parameters scalar A = coeffs().lookupOrDefault<scalar>("A", 2.7); scalar rhow = coeffs().lookupOrDefault<scalar>("rho", 1000); scalar Cp = coeffs().lookupOrDefault<scalar>("Cp", 4200); scalar Ta = coeffs().lookupOrDefault<scalar>("Ta", 25); scalar e2 = coeffs().lookupOrDefault<scalar>("e2", 31.69); scalar b0 = coeffs().lookupOrDefault<scalar>("b0", 3.2); scalar u2 = coeffs().lookupOrDefault<scalar>("u2", 0); // Getting source vector from equation matrix scalarField& src = eqn.source(); const volScalarField& T = eqn.psi(); // Iterating through patch word top_patch_name = coeffs().lookupOrDefault<word>("patch", "top"); const fvPatch& pp = mesh().boundary()[top_patch_name]; forAll(pp, i) { label cell_i = pp.faceCells()[i]; scalar Ai = pp.magSf()[i]; scalar Ts = T[cell_i] - 273.15; // Buck equation scalar es = 0.61121*exp((18.678 - Ts/234.5)*(Ts/(257.15 + Ts))); // Converting into mbar es *= 10; scalar Qe = -(A*cbrt(Ts - Ta) + b0*u2)*(es - e2); src[cell_i] -= Qe*Ai/rhow/Cp; } #}; codeSetValue #{ #}; code #{ $codeInclude; $codeCorrect; $codeAddSup; $codeSetValue; #}; } evaporationHeatLossesCoeffs { selectionMode all; patch top; // Name of the top patch A 2.7; // Empiric constant e2 31.69; // Assuming 25 C 2 meters above the surface b0 3.2; // Another empiric constant u2 0.0; // Wind velocity 2 meters above the surface Ta 25; // Ambient temperature in C rho 1000; Cp 4200; } } // vi: set ft=foam et sw=2 ts=2 sts=2; |
|
February 22, 2018, 08:58 |
|
#15 | |
Member
Join Date: Dec 2017
Location: Germany
Posts: 48
Rep Power: 8 |
Quote:
It seems like you're missing selectionMode. |
||
February 22, 2018, 09:00 |
|
#16 |
Member
PATRICIA NAKANWAGI
Join Date: May 2017
Posts: 47
Rep Power: 9 |
@ Eko, I have as well posted the fvOptions file.
Thank you |
|
February 22, 2018, 09:24 |
|
#17 | |
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12 |
Quote:
If i remember correctly if it wants it placed in scalarCodedSourceCoeffs it'll tell you |
||
February 22, 2018, 10:37 |
|
#18 |
Member
PATRICIA NAKANWAGI
Join Date: May 2017
Posts: 47
Rep Power: 9 |
Thank you so much RobertHB,
I was able to rectify that, though have a new error arising now Starting time loop Time = 1 DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 0.00990741, No Iterations 1 DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 0.00990413, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 0.0179848, Final residual = 0.0001954, No Iterations 1 Using dynamicCode for fvOption:: radiation at line 28 in "/home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/constant/fvOptions.radiation.scalarCodedSourceCoeffs" Creating new library in "dynamicCode/sourceTime/platforms/linux64GccDPOpt/lib/libsourceTime_2d9782ba70b4b08459f487659c5cba04e3b4 27ff.so" Invoking "wmake -s libso /home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/dynamicCode/sourceTime" wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file codedFvOptionTemplate.C /home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/constant/fvOptions.radiation.scalarCodedSourceCoeffs: In member function ‘virtual void Foam::fv::sourceTimeFvOptionscalarSource::addSup(F oam::fvMatrix<double>&, Foam::label)’: /home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/constant/fvOptions.radiation.scalarCodedSourceCoeffs:71:51: error: ‘paw4’ was not declared in this scope /home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/constant/fvOptions.radiation.scalarCodedSourceCoeffs: In member function ‘virtual void Foam::fv::sourceTimeFvOptionscalarSource::addSup(c onst volScalarField&, Foam::fvMatrix<double>&, Foam::label)’: /home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/constant/fvOptions.radiation.scalarCodedSourceCoeffs:71:51: error: ‘paw4’ was not declared in this scope codedFvOptionTemplate.dep:580: recipe for target 'Make/linux64GccDPOpt/codedFvOptionTemplate.o' failed make: *** [Make/linux64GccDPOpt/codedFvOptionTemplate.o] Error 1 --> FOAM FATAL IO ERROR: Failed wmake "dynamicCode/sourceTime/platforms/linux64GccDPOpt/lib/libsourceTime_2d9782ba70b4b08459f487659c5cba04e3b4 27ff.so" file: /home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/constant/fvOptions.radiation.scalarCodedSourceCoeffs from line 28 to line 80. From function codedBase::createLibrary(..) in file db/dynamicLibrary/codedBase/codedBase.C at line 213. FOAM exiting Kindly advise please. Thank you |
|
February 22, 2018, 15:39 |
|
#19 |
Senior Member
|
Hi,
This Code:
// Cooling src[cell_i] -= -sigma.value()*ew*paw4(Ts)*Ai/rhow/Cp; Code:
// Cooling src[cell_i] -= -sigma.value()*ew*pow4(Ts)*Ai/rhow/Cp; |
|
February 26, 2018, 04:37 |
|
#20 |
Member
PATRICIA NAKANWAGI
Join Date: May 2017
Posts: 47
Rep Power: 9 |
Thanks a lot @Alexeym for that correction, had sliiped off in typing. having a new error though which am failing to understand what it means
--> FOAM FATAL ERROR: Attempt to return primitive entry ITstream : /home/tflows/OpenFOAM/OpenFOAM-2.4.0/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/solarPond_1/constant/fvOptions.radiation.sourceTimeCoeffs, line 89, IOstream: Version 2.0, format ASCII, line 0, OPENED, GOOD primitiveEntry 'sourceTimeCoeffs' comprises on line 89 the verbatim string "\ " as a sub-dictionary From function const dictionary& primitiveEntry::dict() const in file db/dictionary/primitiveEntry/primitiveEntry.C at line 191. FOAM aborting #0 Foam::error:rintStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam:rimitiveEntry::dict() const at primitiveEntry.C:? #3 Foam::fv:ption:ption(Foam::word const&, Foam::word const&, Foam::dictionary const&, Foam::fvMesh const&, bool) at ??:? #4 Foam::fv::sourceTimeFvOptionscalarSource::sourceTi meFvOptionscalarSource(Foam::word const&, Foam::word const&, Foam::dictionary const&, Foam::fvMesh const&) at constant/fvOptions.radiation.scalarCodedSourceCoeffs:106 #5 Foam::fv:ption::addRemovabledictionaryConstructo rToTable<Foam::fv::sourceTimeFvOptionscalarSource> ::New(Foam::word const&, Foam::word const&, Foam::dictionary const&, Foam::fvMesh const&) at ~/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude/autoPtrI.H:34 #6 Foam::fv:ption::New(Foam::word const&, Foam::dictionary const&, Foam::fvMesh const&) at ??:? #7 Foam::fv::CodedSource<double>::redirectFvOption() const at ??:? #8 Foam::fv::CodedSource<double>::addSup(Foam::fvMatr ix<double>&, int) at ??:? #9 ? at ??:? #10 ? at ??:? #11 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #12 ? at ??:? Aborted (core dumped) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swak4foam for fe40: fvOption library don't compile? | jf_vt | OpenFOAM Community Contributions | 7 | August 10, 2023 04:00 |
[General] Paraview crashes using "Find Data" functionality | Turbine | ParaView | 3 | May 6, 2020 23:40 |
reactingFoam fvOption ignition | khalifa | OpenFOAM Programming & Development | 8 | January 6, 2019 19:45 |
fvOption interpolation scheme | aghsin | OpenFOAM Running, Solving & CFD | 0 | June 25, 2016 10:01 |
face functionality for a DynamicList | tomislav_maric | OpenFOAM Programming & Development | 2 | November 30, 2011 19:04 |