Quote:
Quote:
|
No I'm not simulating a nuclear power plant! :D But also u profile is good, i think that I'll use 1e-3 tolerance convergence. I know the importance of tolerance i made structural simulation for a wing with nastran and I know the its importance
|
Hi
Do you know a way to interface my openfoam simulation with a matlab script that use OpenFoam results? |
The best interface is interaction via files, I think...
I found this thread where you had problems starting OpenFOAM from Matlab: http://www.cfd-online.com/Forums/ope...de-matlab.html Do you still have problems in doing so? If so, try Code:
unix('foamExec simpleFoam') Otherwise Code:
unix('source path/to/OpenFOAMs/bashrc; simpleFoam') For the data you need in Matlab: Do you only need values for shear stress on the wall? Is it enough to have coordinates for each shear stress value, or do you need the full mesh structure? Do you use a more sophisticated transport model than newtonian flow? Are you using OpenFOAM in parallel? I have some code snippets here that would write a simple ";"-separated .csv file which you can parse in Matlab. |
If I use your command I have this:
unix('foamExec blockMesh') /bin/bash: foamExec: command not found I only need values for shear stress on the wall, and it is enough to have coordinates for each shear stress value; "Do you use a more sophisticated transport model than newtonian flow?" ->> No Are you using OpenFOAM in parallel? ->> No (maybe later) Thanks Daniele |
What about the other command: unix('source path/to/OpenFOAMs/bashrc; simpleFoam') ?
"path/to/OpenFOAMs" must be replaced with the full path to your OpenFOAM's installation directory, than the "bashrc" file follows, which includes the environment for OpenFOAM. Than there is a ";", followed by another command (simpleFoam) to be executed in the just set environment... What's the name of the patch, you need the shear stress values for? Is it "bottom"? |
I do:
unix('/home/acconcia/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc; blockMesh') and /bin/bash: /home/acconcia/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc: permission denied /bin/bash: blockMesh: command not found Patch name is "bottom" How long do you work with OpenFoam? Do you use it for university or work? I'm star to use is one month ago, and I like it, it's very flexible. |
unix('/home/acconcia/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc; blockMesh')
Now It works, I changed matlab permission Thanks |
Hi Daniele,
here we go: Go to the simpleFoam source directory: "~/OpenFOAM/OpenFOAM-1.6.x/applications/solvers/incompressible/simpleFoam/" The version number might be different for your system. Create a new file there with name "write.H". Paste this code in there: Code:
// write matlab file Code:
#include "OFstream.H" Code:
... Code:
wclean number; coordX; coordY; coordZ; wallShearStressX; wallShearStressY; wallShearStressZ; magnitude(wallShearStress) I haven't tested this code, so use it with care! Check and double check, if the wall shear stress is calculated really correctly!!! Have a look a line 62, where the wall shear stress is calculated: Code:
turbulence->nuEff() * wallGradU Have fun :-) Martin p.s.: I'm using OpenFOAM for seven month now... but I'm still learning, of course ;-) And I'm using it for work. |
Dear Martin
Thanks for your code, is a gold mining! There are many things I want to learn to. I'll change the computation of wallShearStress, I think that i'll use the openfoam code for this and I add it to write.h. Daniele |
MRF simple foam linear upwind: convergence troubles
1 Attachment(s)
Hi,
I'm trying to set a linearUpwind MRF simpleFoam simulation of a cooling fan. The mesh has been imported from GAMBIT (8.5 e+6 cells, not bad quality) and the simulation diverges.Here attached: log, fvSchemes,fvSolution. Could you please have a look in order to give me advices about settings? thanks Aldo |
But if I want extract also k with code? How can i modify the code post previously?
|
Hi Daniele,
what about adding Code:
<< k.boundaryField()[patchID][i] << "; " Martin |
Hi Martin
It is that I do...I did a syntax error probably. Thanks! Daniele |
Hi
Now I try to use a cluster to increase my speed, and so i'm traying tu use OpenFoam parallel utility. But when i run decomposePar i have this error: FOAM FATAL IO ERROR: Cannot find 'value' entry on patch bottom of field epsilon in file "/u/acconcia/OpenFOAM/acconcia-1.6/run/blayer4/0/epsilon" which is required to set the values of the generic patch field. (Actual type epsilonWallFunction) Please add the 'value' entry to the write function of the user-defined boundary-condition or link the boundary-condition into libfoamUtil.so file: /u/acconcia/OpenFOAM/acconcia-1.6/run/blayer4/0/epsilon::boundaryField::bottom from line 49 to line 52. From function genericFvPatchField<Type>::genericFvPatchField(con st fvPatch&, const Field<Type>&, const dictionary&) in file genericFvPatchField/genericFvPatchField.C at line 71. My boundary condition are the same of the case that I use not in parallel and they haven't give me problem. |
The best think you can do is to follow what the error message clearly says so (especially when it does say it so clearly). On patch "bottom" you have not prescribed value of epsilon. What is the BC for epsilon on bottom? It is probably some which needs a value.
Now why you do not need it in single but need it in parallel? My guess is that you do not use k-eps but k-omega where BC for epsilon is not needed. The decompose utility does not know what you will use for the run so it does decompose everything and checks for you BCs which is very kind of it. But it's only my guess. good luck matej |
1 Attachment(s)
These are my BC. And I'm sure that I'm using k-eps model, this BC have never been a problem.
Thanks |
OK. then you have 2 possibilities:
(1) add the value uniform number; line to your bottom BC for the decomposer to be happy (end remove it afterwards as the value is not needed by the wall functions (you can check it in doxygen) (2) remove the need of it from the decomposer, recompile it and if it works report it matej |
Hi
I solved my problem, paralle is happy with a value! To calculate wall shear stress with single processor I used Martin's code of post 29, but in parallel I can't use it: is possible a similar code to have a output at simulation stop? A tau.dat like output then i'll manipulate with matlab. |
Hi Daniele,
not fully tested, but it should be a point to start from: Code:
// write matlab file |
All times are GMT -4. The time now is 01:47. |