How to output other properties?
Hi,
I am using the OpenFOAM-210 and I Know that with foamCalc utility I can get the components of velocity and I also know how to get mach number and vorticity, but does anybody know how to output other variables such as viscosity, Reynolds number and etc? thanks, Wagner |
Viscosity will be written to the time directories if it's not constant, and you can plot it with paraview. You can also use paraview to calculate the Reynolds number. If you want a command line utility, you'll have to get your hands dirty.
|
Thank you for your reply. I'm ready to get my hands dirty. Even though my viscosity is constant, I would still like to know how to output it at each time-step. I would like to verify that I am getting the correct value for my viscosity. I'm using the rhoCentralFoam solver. This is the output of the "createFields.H" file:
13--> const volScalarField& mu = thermo.mu(); So what I did was change this file to something like this: 13--> volScalarField mu 14--> ( 15--> IOobject 16--> ( 17--> "mu", 18--> runTime.timeName(), 19--> mesh, 20--> IOobject::MUST_READ, 21--> IOobject::AUTO_WRITE 22--> ), 23--> mesh 24--> ); Then I recompiled and created a "mu" file at my "/0/" directory. But after I running, the other time directories do not have the mu property. It's not autowriting as ordered. For the Reynolds number I'm still having problems. Do you know of any documentation about the command line utility for this? thanks, Wagner |
sutherland viscosity
Hi Akidess,
I followed your suggestion and set the viscosity to sutherland. Now that the viscosity is not constant, I would have expected it to write to the time directories like you suggested. Unfortunately, viscosity does not appear in any of the time directories. Have I missed something? Here is the output of my thermophysical properties Code:
FoamFile |
createfields.H
This is what I've specified in the createfields.H file
Code:
const volScalarField& psi = thermo.psi(); |
Which solver are you using? I'll try it out and see if I can get it to work.
|
I'm using the rhoCentralFoam.
Thanks, Wagner |
I figure it out.
Thank you, Wagner Galuppo |
Sorry I couldn't help much, I got busy with other things. Can you add a post on how you solved the problem? It might help others in the future.
|
Actually I partly figured it out. I found the file "basicThermo.C" in (/opt/openfoam210/src/thermophysicalModels/basic/basicThermo/)
If you have look from the 201st until 213th line you will find this: Code:
mu_ in terminal: Code:
$ cd /opt/openfoam210 Code:
IOobject::NO_WRITE Code:
IOobject::AUTO_WRITE Then I changed the 27th line in the file myBasic/Make/files from: Code:
LIB = $(FOAM_LIBBIN)/libbasicThermophysicalModels Code:
LIB = $(FOAM_USER_LIBBIN)/libbasicThermophysicalModels Next I compiled the code: Code:
$ cd ~/OpenFOAM/USER-2.1.0/src/thermophysicalModels/myBasic/ The Problem is that I'm overwriting the main library basicThermophysicalModels instead of creating a new one. |
I changed the last modifications for mu on line 209 (in myBasic/basicThermo/basicThermo.C) back to
Code:
IOobject::NO_WRITE Now OpenFoam is using the original configuration, and so I try to make a new basic thermoPhysical model. First, I reset mu to AUTO_WRITE (since I want to output mu). Next, I changed line 27 in the file myBasic/Make/files from Code:
LIB = $(FOAM_USER_LIBBIN)/libbasicThermophysicalModels Code:
LIB = $(FOAM_USER_LIBBIN)/libmubasicThermophysicalModels Then I copied rhoCentralFoam solver to my workplace and renamed the directory from /rhoCentralFoam/ to /muRhoCentralFoam/, and after that in the new /muRhoCentralFoam/ directory I changed the file from rhoCentralFoam.C to muRhoCentralFoam.C. Code:
$ cd /opt/opefoam210/ Code:
rhoCentralFoam.C Code:
muRhoCentralFoam.C Code:
EXE_INC = \ Code:
EXE_INC = \ Copilation error message: Code:
Making dependency list for source file muRhoCentralFoam.C Code:
-lmubasicThermophysicalModels \ Code:
-lbasicThermophysicalModels \ Do you have any suggestions or ideas about how can I create this new basic thermophysicalModel and load it in my new solver, or what I am doing wrong? Thanks, Wagner Galuppo |
Figured out?
Quote:
did you figure out your issue? It would be good if you write what you have done then other people could make use of this knowledge as well. I am trying to make a very similar implementation and I am getting similar errors.. Regards, Lisandro |
Hello,
You don't need to do this to output viscosity, just use the functions objects "writeRegisteredObject". ex: Code:
{ regards, olivier |
Thanks for your tip Olivier, it seems much more straightforward and ease to get this value.
However, I am not able to find it working. I put transportProperties instead of bananas but it does not write the nu field in any step.. (by the way,I think I am doing the basic things right. I put the "functions" subdict in the controlDict file, etc..) Lisandro |
hello,
Yes, function object should be in controlDict. First, run your solver with bananas => you will get an error message with the full list of possible object, and there is no bananas. Then, pick up the good one (name here can be something::nu instead of nu) regards, olivier |
Hi Olivier,
Does it work even if my viscosity has a constant value in all points? Because it seems not to be working.. The maximum I got was having a nu file in the time directories when I created it as a volScalarField in the createFields.H file in the solver directory.. Regards, Lisandro |
I solved it a couple of days ago, here is what I have done in order to make it:
I wanted to write the viscosity and Cp values any written time in the case folder. 1. In the createFields.H file: Code:
Code:
volScalarField cp_output Code:
while (runTime.run()) Regards, Lisandro |
and Reynold's number
I want to plot Reynold's number. Not, Reynold's number is dependent on velocity. So, all I should do is provide a formula to calculate Re in the code. Also, I am going to calculate Re with mag(U). Please suggest how to incorporate these features in the code. I will appreciate if replies are relevant to icoFoam solver.
|
Hi olivier,
your approach using function objects seems quite comfortable and I can reproduce some results for the thermo:... properties. But when I put thermophysicalProperties for function object names, there is no result at all. It says writing thermophysicalProperties object in the log-file but there is no output. Ok there seems to be a bug in this function since it manipulates the header of the thermophysicalProperties-Dict adding the thermoType{...} entries into the FoamFile-header. Could you help me to figure this one out? |
hello,
function object work only with registered object. So there is 2 solution: 1) the properties you want is an object => just use the fuctionObject 2) you need some coding, and create a custom solver the part 2) is easy, so don"t be scare. regards, olivier |
Ok it works for mu, rho, alpha and psi using function objects and chtMRSF.
I am trying to implement the output of Cp for chtMultiRegionSimpleFoam. I tried to do it in analogy to rho adding the following to createFluidFields.H Code:
PtrList<volScalarField> CpFluid(fluidRegions.size()); Code:
volScalarField& Cp = CpFluid[i]; When compiling I get the error message Code:
In file included from chtMultiRegionSimpleFoamMuCp.C:71:0: Could you help me with that one? |
If I want to use writeObjects functions , but some properties are not available, such as kappa Cp. Should I build volScalarField kappa/Cp in creatFields.H then use writeObjects?
Or are there other methods to present kappa Cp in post-processing? I want to see the relationship between T and Cp/kappa. Thank you. |
All times are GMT -4. The time now is 00:55. |