CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Creating a new OpenFOAM case

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2009, 21:44
Default Creating a new OpenFOAM case
  #1
New Member
 
Wesley T.
Join Date: Apr 2009
Posts: 28
Rep Power: 17
Wesley is on a distinguished road
Is there an example of how to create a new case with copying from an existing case? If you know of one, could you provide a link to it? I am not a programmer, I need a "cookbook" approach, such as:
At the prompt, type: XXXXXXXXXX
then type: XXXXXX
ideally with some screenshots.

The suggestions I have found and read to date all suggest starting with an existing case then modifying the various files. I can't help but think that OpenFOAM should be able to generate the various files which you can then edit.

I will most likely try to create the file I need by hacking. I need to have the transportProperties file. Alternately, if somebody has a transportProperties file for a powerLaw problem, posting that would be great.

Thank you for any help you can give to this OpenFOAM newb,

Wesley
Wesley is offline   Reply With Quote

Old   June 6, 2009, 22:29
Default
  #2
New Member
 
Wesley T.
Join Date: Apr 2009
Posts: 28
Rep Power: 17
Wesley is on a distinguished road
Crud. I meant to put this in the Running/Solving/CFD. Arg.

Wesley
Wesley is offline   Reply With Quote

Old   June 7, 2009, 09:28
Default
  #3
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Munich, Germany
Posts: 105
Rep Power: 18
psosnows is on a distinguished road
Hi Wesley,

the lack of those 'cookbooks' is a bit of a problem just at the beginning. In the end, all the info you need is in UsersGuide (if you want just to run) or in ProgrammersGuide (if you like to modify something).

Here is my swift "recipe" (once again- all this is in UGiude):
lest assume you want to run simple case, one region,
first of all you need to know what solver are you going to use (the one that fits your physical problem, has the right set of equations and solves them using right algorithm)
then you create the case folder.
The easiest way is to copy a tutorial case for your solver. If there is none, copy
icoFoam tutorial.
in folder constatn/polyMesh you have to put your mesh in OF format (files: boundary, pionts, faces, owner and neighbour). You can also gnerate the mesh using for example "blockMesh"
then you go through files:
system/fvSchemes- check if the schemes for the solver are the ones you want,
system/fvSolution- check if the parameters fit you,
system/controlDict- set the control parameters
and now the iterative procedure begins:

1) run the solver
2) read the error output
3) add the things that are needed- there is always specified what is missing (for example you get that there is no "U" file in "0" folder, copy one from any tutorial and modify it)
4) go to 1)
5) if no errors occure- go througth all files in "0" and "constant" folder to check if all values are like the ones you want to
6) run the ready simulation

And thats all
hope it helps a bit,

Pawel
psosnows is offline   Reply With Quote

Old   June 8, 2009, 08:04
Default Going slow and steady
  #4
New Member
 
Wesley T.
Join Date: Apr 2009
Posts: 28
Rep Power: 17
Wesley is on a distinguished road
Pawel,

Unfortunately, there is no tutorial case for a power law fluid. Lacking a direct tutorial or a "cookbook", I am hammering through a problem on my own.

I am not currently on the computer with my case on it. I did get the problem to execute with a powerLaw set of properties. However, to get that to run, I had to specify the units for k as being the same as for viscosity. Strictly speaking, this is not really the case: the apparent viscosity (same units as viscosity) is k*(shearrate^n). As shear rate has units of 1/sec, and taking that to some power with mean that the units for the items in the parentheses will be sec^(-n). I suspect that this is just a matter of the real units being dropped during the calculations, but can't confirm that yet.

I will try to post my powerlaw properties later today.

Wesley
Wesley is offline   Reply With Quote

Old   June 8, 2009, 08:32
Default example of powerlaw properties
  #5
New Member
 
Wesley T.
Join Date: Apr 2009
Posts: 28
Rep Power: 17
Wesley is on a distinguished road
Here are the powerlaw properties from the transportProperties file:
transportModel powerLaw;

nu nu [0 2 -1 0 0 0 0] 1e-05;

powerLawCoeffs
{
k k [0 2 -1 0 0 0 0] 2500;
n n [0 0 0 0 0 0 0] 0.4;
nuMin nuMin [0 2 -1 0 0 0 0] 0;
nuMax nuMax [0 2 -1 0 0 0 0] 100;
}
I changed from my real properties to a known values for extruded corn flour. This appears to run, but units for k area not right.

Wesley
Wesley is offline   Reply With Quote

Old   June 8, 2009, 09:45
Default
  #6
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Munich, Germany
Posts: 105
Rep Power: 18
psosnows is on a distinguished road
Hello Wesley,

could you tell which solver are you using? It would be quite easier to find some hints for you

from what I`ve seen in powerLaw model code http://foam.sourceforge.net/doc/Doxy...ce.html#l00050 it seems that the dimension of the nu given out by the model is the same as the k coeff.
the power part is dimless- it`s true that the stainRate is 1/s but it is multiplied by constant value of 1s and then put to n power. so you have:
Code:
nu = k*( ( 1s* strainRate)^n )
so in the end you will get a value which is in k dimnesion.

Pawel
psosnows is offline   Reply With Quote

Old   June 8, 2009, 11:07
Default
  #7
New Member
 
Wesley T.
Join Date: Apr 2009
Posts: 28
Rep Power: 17
Wesley is on a distinguished road
The solver I am using is simpleFoam. Based on what else I have read, it is probably the most suitable for a powerLaw fluid. That may or may not be true, I am not as comfortable/knowledgable with the program as I would like to be.

The model code you are looking at is the correct model code. I was just looking up that again. I need to sit down with the manual and confirm what the code doing mathematically. I suspected it was stripping the units (1/s) from the shear rate, but could not confirm that myself yet.

I tend to be very oriented toward checking out that the units work out in any problem I work with. In this case, the units I had to put in for k (m^2/sec) did not match what it should be. Knowing that the units are essentially stripped from shear rate then attached to k helps me confirm the math appears to be correct.

Thank you for going to the trouble of looking this up and confirming the math.

When I get a full case done, I will try to post the files. I would anticipate that would be no earlier than June 13.

Again, thank you for the information, it is VERY helpful,

Wesley
Wesley is offline   Reply With Quote

Old   October 18, 2010, 06:06
Default Hi
  #8
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 17
T.D. is on a distinguished road
Hi,
Any Ideas how to use two different transportModels in the same solver, and how to call back their viscosities?
thanks
T.D. is offline   Reply With Quote

Old   October 18, 2010, 08:26
Default
  #9
New Member
 
Wesley T.
Join Date: Apr 2009
Posts: 28
Rep Power: 17
Wesley is on a distinguished road
T.D.,

If you are talking about a problem with 2 distinct phases in the model, then I would suggest trying the multiphase solvers, such as interFoam. The dam break tutorial is one tutorial you can look at.

If you are talking about a problem with a single phase, but a change in viscosity at set times, then maybe you could run the solver until you reach the time you want the viscosity change. At that time, you could change the viscosity to the value you wish and continue to the solver.

As for how to call back their viscosities - I am not cure what you are asking here. I am dabbling in OpenFOAM, I really can't say I know much about cfd in general.

I hope this helps.

Wesley
Wesley is offline   Reply With Quote

Old   October 18, 2010, 08:47
Default Hi
  #10
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 17
T.D. is on a distinguished road
Hi,
I am talking about a single phase problem where i need inside the same solver to use two different viscosityModels lets say nu1 and nu2, where each of nu1 and nu2 is to be defined as two models seperatly?
let's say in another words, i need transportModel1 powerLaw, and transportModel2 CrossPowerLaw, you see, and then how to use their nu value inside the solver.

I can't use interFoam since it combines with a certain factor epsilon, nu1 and nu2 in one muEff something like that muff=epsilon*nu1 + (1-epsilon)*nu2 .
but me , i need them seperately two laws for nu1 and nu2.

I hope you understand me better now

help pleaase

thanks a lot

yours,
T.D.

Quote:
Originally Posted by Wesley View Post
T.D.,

If you are talking about a problem with 2 distinct phases in the model, then I would suggest trying the multiphase solvers, such as interFoam. The dam break tutorial is one tutorial you can look at.

If you are talking about a problem with a single phase, but a change in viscosity at set times, then maybe you could run the solver until you reach the time you want the viscosity change. At that time, you could change the viscosity to the value you wish and continue to the solver.

As for how to call back their viscosities - I am not cure what you are asking here. I am dabbling in OpenFOAM, I really can't say I know much about cfd in general.

I hope this helps.

Wesley
T.D. is offline   Reply With Quote

Old   October 19, 2010, 08:30
Default
  #11
New Member
 
Wesley T.
Join Date: Apr 2009
Posts: 28
Rep Power: 17
Wesley is on a distinguished road
The epsilon used is the fractional composition in the cell to allow for the fact that some cells may be a mix of the two fluids (as I understand the system).

If you want to keep the flow volumes separated, they you may want to look into dynamicMesh. This is listed as "For solving systems with moving meshes". This is beyond where I have gotten to in my explorations so far.

The set of problems I am now looking at is the flow of material coming out of a die. As a rough example, think of toothpaste coming out of a tube - I want to see the diameter of the toothpaste relative to the size of the hole it came out of.

Wesley

PS - this is reaching or going beyond the limits of what I have explored or understand. If dynamicMesh is what you need, it may be worth posting a new thread and asking for some help in the forums. If you do that, please let me know - dynamicMesh is something I will ultimately need to use, so a "head start" would be helpful for me as well.

Last edited by Wesley; October 19, 2010 at 08:33. Reason: adding the PS
Wesley is offline   Reply With Quote

Old   October 19, 2010, 09:04
Default Hi
  #12
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 17
T.D. is on a distinguished road
Hi,
thanks a lot
I solved the problem finally by defining two volScalarFields nu1 and nu2 in the Header file, and i gave them the formula there, then i re-update them using the same formulas inside the piso loop.

any way thanks a lot

yours,
T.D.
T.D. is offline   Reply With Quote

Old   April 21, 2011, 03:26
Default
  #13
Member
 
Maryam Mousazadeh
Join Date: Oct 2010
Posts: 47
Rep Power: 16
anijdon is on a distinguished road
hello dear T.D.
I have a similar problem and my question is that is there any need to determine the dimension of nu1 and nu2 in the code? can you post your modified cod to me? I attach you my fluid's formulas dnd I hope you help me.
my another problem is that does the ghenge of properties effect in momentom and energy equation? I use simpleFoam and added energy equation to it.

formulas.zip

thanks

Last edited by anijdon; April 21, 2011 at 04:11.
anijdon is offline   Reply With Quote

Old   April 21, 2011, 04:41
Default
  #14
Senior Member
 
Join Date: Sep 2010
Posts: 226
Rep Power: 17
T.D. is on a distinguished road
hello Dear Maryam,

I guess from nuEff=nuF(1+2.5Fi), you are trying to simulate einsten viscosity of suspension to the dilute limit.
For that you can simply define your fluid kinematic viscosity "nuF" with dimensions in CreateFields.H file to be read from transportProperties in the constant folder, like that:
Quote:
dimensionedScalar nuF
(
transportProperties.lookup("nuF")
);
then in the CreateFields.H also you need to define volScalarFields "Fi" and "nuEff" like that:

Quote:

Info<< "Reading field Fi\n" << endl;
volScalarField Fi
(
IOobject
(
"Fi",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

volScalarField nuEff
(
IOobject
(
"nuEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
nuF * ( 1 + (2.5*Fi) )
);
then you also need write inside the solver the code for nuEff to assure update during iterations, so you simply put a line with:

nuEff=nuF*( 1 + (2.5*Fi) );


Good Luck

yours,
T.D.
T.D. is offline   Reply With Quote

Old   April 22, 2011, 02:43
Default
  #15
Member
 
Maryam Mousazadeh
Join Date: Oct 2010
Posts: 47
Rep Power: 16
anijdon is on a distinguished road
hello T.D.
thank you for reply; I'll do it and and ask you if I face other problem.

best regards;
anijdon is offline   Reply With Quote

Old   April 29, 2011, 04:09
Default
  #16
Member
 
Maryam Mousazadeh
Join Date: Oct 2010
Posts: 47
Rep Power: 16
anijdon is on a distinguished road
hello T.D
excuse me; I add some lines in creatField ana .C files of my solver which is here:

nanoalaki.zip

but there is some errors which is in the error file of last zipped file;
I don't underastand what's the problem ; would you tell the mistakes?
my another quastion is that should I alter the momentom equation on base of effective properties of nanofluid?if I put for example nu instead of nuEff,Is it need to ghange?
I thank you previously;
best regards
anijdon is offline   Reply With Quote

Old   April 29, 2011, 06:17
Default
  #17
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
Hi Maryam,

there are several problems in your createFields.H, here are some fixes and hints:
Code:
IOdictionary transportProperties
 (
 IOobject
 (
  "transportProperties",
  runTime.constant(),
  mesh,
  IOobject::MUST_READ,
  IOobject::NO_WRITE
  )
 );

 dimensionedScalar nuF(transportProperties.lookup("nuF"));
 dimensionedScalar kF(transportProperties.lookup("kF"));
 dimensionedScalar CpF(transportProperties.lookup("CpF"));
 dimensionedScalar rhoF(transportProperties.lookup("rhoF"));
 dimensionedScalar muF(transportProperties.lookup("muF"));

dimensionedScalar kP(transportProperties.lookup("kP"));
 dimensionedScalar CpP(transportProperties.lookup("CpP"));
 dimensionedScalar rhoP(transportProperties.lookup("rhoP"));
 dimensionedScalar muP(transportProperties.lookup("muP"));


volScalarField Fi
(
IOobject
(
"Fi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
 mesh,
0.001 
); 


volScalarField nuEff
(
IOobject
(
"nuEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
nuF * ( 1 + (2.5*Fi) ) 
); 

volScalarField CpEff
(
IOobject
(
"CpEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
CpF*(1-Fi)+CpP*Fi 
);


volScalarField rhoEff
(
IOobject
(
"rhoEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
rhoF*(1-Fi)+rhoP*Fi 
);


Info<< "Reading field kEff\n" << endl;
volScalarField kEff
(
IOobject
(
"keff",
runTime.timeName(),
mesh,
IOobject::NO_READ, // <--- "NO_READ" here
IOobject::AUTO_WRITE
),
mesh,
kF
);

kEff +=
 (3.7e4 * 2 * 1.381e-23
 //* T               // <--- there is no T defined so far!!!
 * kF)
 /(3.14 * Foam::sqr(100e-9) * kP *(1-Fi));

volScalarField alpaEff
(
IOobject
(
"alpaEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
kEff/(rhoEff*CpEff) // <--- no "," here
);



    Info << "Reading field p\n" << endl;
    volScalarField p
    (
        IOobject
        (
            "p",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

    Info << "Reading field U\n" << endl;
    volVectorField U
    (
        IOobject
        (
            "U",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

     Info << "Reading field T\n" << endl;
    volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );


#   include "createPhi.H"


    label pRefCell = 0;
    scalar pRefValue = 0.0;
    setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);


    singlePhaseTransportModel laminarTransport(U, phi);

    autoPtr<incompressible::RASModel> turbulence
    (
        incompressible::RASModel::New(U, phi, laminarTransport)
    );
It compiles with OpenFOAM-1.6.ext, I did not compile it against any other OpenFOAM version. Further more I did not test it, so there will be plenty of runtime errors, I suppose (because there are so many dimensioned scalars, I can't image, that all dimensions fit immediately...).

Have a careful look at the missing field or constant "T", the position is marked in the source code.

Good luck

Martin
MartinB is offline   Reply With Quote

Old   April 29, 2011, 13:28
Default
  #18
Member
 
Maryam Mousazadeh
Join Date: Oct 2010
Posts: 47
Rep Power: 16
anijdon is on a distinguished road
hello Martin;
thanks a lot for your reply; I do some correction on the createFields file but there is an error yet and it seems to be a fundamental error ;also T is temperature field; could you tell me the new mistakes?

nano2.zip

thanks;

Last edited by anijdon; April 29, 2011 at 14:07.
anijdon is offline   Reply With Quote

Old   April 29, 2011, 14:34
Default
  #19
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22
MartinB will become famous soon enough
Hi,

let's take the definition of volScalarField Fi (error for line 36): you must define the size of this field, for example by adding "mesh" to the creation:
Code:
volScalarField Fi
(
IOobject
(
"Fi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh, // <---- from this entry OpenFOAM knows about the size of the field
0.001  // <---- a scalar value alone is not enough to derive the size...
);
After changing this, some errors will disappear, but here comes the next one:
You changed the definition of "kEff" in line 128 from volScalarField to volTensorField now. But you try to initialize it with a scalar value "kF". You must read a tensor for "kF" in the lookup part, or construct a tensor from the scalar in the definition of "kEff".

Martin
MartinB is offline   Reply With Quote

Old   April 29, 2011, 16:16
Default
  #20
Member
 
Maryam Mousazadeh
Join Date: Oct 2010
Posts: 47
Rep Power: 16
anijdon is on a distinguished road
hello martin;
yes I'm in mistake,kEff is a temperature dependent property so it's volScalarField;I hope it was the last error;
I am so sorry for bothering your time;
best regards
anijdon is offline   Reply With Quote

Reply

Tags
case creation, openfoam


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a new case from command line gregh OpenFOAM Pre-Processing 25 November 14, 2013 08:38
OpenFOAM Install problem masb OpenFOAM 3 May 25, 2009 12:32
Critical errors during OpenFoam installation in OpenSuse 11.0 amscosta OpenFOAM 5 May 1, 2009 15:06
Summer School on Numerical Modelling and OpenFOAM hjasak OpenFOAM 5 October 12, 2008 14:14
Creating new case for new user wersoe OpenFOAM Pre-Processing 0 April 20, 2008 14:03


All times are GMT -4. The time now is 04:59.