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

Adding a user application class

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 24, 2004, 09:41
Default I have problems with adding a
  #1
Rasmus Gjesing (Gjesing)
Guest
 
Posts: n/a
I have problems with adding a user application class, so it is visible in FoamX. The application class is running fine, but I would like to use FoamX for preprocessing.
It must be something with placing some files and folders in $FOAMX_USER_CONFIG, but how should the structure be, so FoamX discovers the new application class???
  Reply With Quote

Old   May 24, 2004, 10:31
Default The FOAMX_USER_CONFIG is trea
  #2
Mattijs Janssens (Mattijs)
Guest
 
Posts: n/a
The FOAMX_USER_CONFIG is treated in the same way as the FOAMX_SYSTEM_CONFIG. Have a look at the files in $FOAMX_SYSTEM_CONFIG/applications (setup for Foam applications).

Take one of the application directories from under there, rename it and put it in a similar tree under $FOAMX_USER_CONFIG.

Mattijs
  Reply With Quote

Old   May 26, 2004, 05:18
Default Thanks for the help! My appli
  #3
Rasmus Gjesing (Gjesing)
Guest
 
Posts: n/a
Thanks for the help! My application class is now visible in FoamX.

By the way, are you editing your source code in a simple text-editor or in Kdevelop. I miss a little overview over Foam even though the Doxygen documentation are provided.

Rasmus Gjesing
  Reply With Quote

Old   May 26, 2004, 06:39
Default We use text editors and a lot
  #4
Mattijs Janssens (Mattijs)
Guest
 
Posts: n/a
We use text editors and a lot of 'grep'ing through header files in $FOAM_SRC/foam/lnInclude. (I have an environment variable called 'I' set to that directory to save typing ;-)

Also all the other libraries in $FOAM_SRC (sampling, turbulenceModels, ...) can be searched in their lnInclude/ directory which contains links to all the source files.

Thirdly I tend to program by example. Especially the utilities directory ($FOAM_UTILITIES) contains a lot of interesting code (for my purpose).

Last but not least there is the documentation on the website (programmers guide) which can be terse but quite useful.

Mattijs
  Reply With Quote

Old   October 26, 2005, 11:38
Default How to do this with version 1.
  #5
Member
 
VVqf
Join Date: Mar 2009
Location: Braunschweig
Posts: 66
Rep Power: 17
vvqf is on a distinguished road
How to do this with version 1.2 ?
I did as Release Notes-1.2 tells, but can't make my own application visible in FoamX. ie. I can't creat a case with the user solver, because it is not in the application list.
vvqf is offline   Reply With Quote

Old   February 28, 2006, 07:04
Default Hi, I want to make the appl
  #6
newbee
Guest
 
Posts: n/a
Hi,

I want to make the application rhoSimpleFoam visible in FaomX. I Guess I can do somthing similar to what is stated in previus discusion under this topic but I dont know where the pathes $FOAMX_USER_CONFIG and FOAMX_SYSTEM_CONFIG points to.

The big question is:

How do I add this solver or alternativly create a case and modify it without the help of GUI.

regards
Erik
  Reply With Quote

Old   February 28, 2006, 08:03
Default There is a tutorial case for r
  #7
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
There is a tutorial case for rhoTurbFoam the equivalent transient solver. Copy the config files and initial fields from there, modify as necessary, change the time scheme to steadyState (fvSchemes) and add a SIMLPE entry and relaxation factors to fvSolutions (check the simpleFoam tutorial case to see what kind of stuff is needed).

Then you just run "rhoSimpleFoam <root> <case>", and it should work.
eugene is offline   Reply With Quote

Old   February 28, 2006, 08:10
Default Hello Erik! One simple way
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hello Erik!

One simple way to find out about the paths:
echo $FOAMX_USER_CONFIG
on the shell shows you were it points to.

Modifying cases is "easy" once you have understood chapter 4 of the user guide
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   February 28, 2006, 08:31
Default ok, thanks for the pointers fr
  #9
newbee
Guest
 
Posts: n/a
ok, thanks for the pointers from both of you. I will try do these modifications.

When typing "echo $FOAM_USER_CONFIG" I just receive a empty line as answer....?

I will digg further down in problem.
/Erik
  Reply With Quote

Old   February 28, 2006, 09:34
Default I have tried to copy the whole
  #10
newbee
Guest
 
Posts: n/a
I have tried to copy the whole turbFoam tutorial case "cavity" and I have done the modifications mentionded above. When trying to run the case I got the following error:

erik@compadre:~/OpenFOAM/erik-1.2/run/tutorials/rhoSimpleFoam$ rhoSimpleFoam . cavity
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.2 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : rhoSimpleFoam . cavity
Date : Feb 28 2006
Time : 14:17:17
Host : compadre
PID : 9361
Root : /home/erik/OpenFOAM/erik-1.2/run/tutorials/rhoSimpleFoam
Case : cavity
Nprocs : 1
Create time

Create mesh for time = 0

Reading thermophysical properties

Selecting thermodynamics package hThermo<puremixture<consttransport<speciethermo<hc onstthermo<perfectgas>>>>>
Reading field U

Reading/calculating face flux field phi



--> FOAM FATAL IO ERROR : keyword pRefCell is undefined in dictionary "/home/erik/OpenFOAM/erik-1.2/run/tutorials/rhoSimpleFoam/cavity/system/fvSoluti on::SIMPLE"

file: /home/erik/OpenFOAM/erik-1.2/run/tutorials/rhoSimpleFoam/cavity/system/fvSolutio n::SIMPLE from line 47 to line 47.

From function dictionary::lookupEntry(const word& keyword) const
in file db/dictionary/dictionary.C at line 152.

FOAM exiting



please tell me what I have done wrong or if there are more modifications that needs to be done.

It would be nice to get it visible in FoamX but that might be to much to hope for with my limitations in OpenFAOM.

Thanks /Erik
  Reply With Quote

Old   February 28, 2006, 09:41
Default never mind, I got the "pref" &
  #11
newbee
Guest
 
Posts: n/a
never mind, I got the "pref" & "pvalue" problem
  Reply With Quote

Old   March 9, 2006, 05:08
Default Hello! sorry for my frequen
  #12
newbee
Guest
 
Posts: n/a
Hello!

sorry for my frequent messaging, but im stuck!!

I've managed to combine turbfoam and simplefoam tutorials cases to run rhosimplefoam.

Now I need to go a step further and modify the code in rhosimplefoam (application) to handle incompressibe flow.

Could anyone please give me a pointer of how or perhaps which files in rhosimplefoam that needs to be changed?

kind regards
  Reply With Quote

Old   March 9, 2006, 07:19
Default Look in pEqn.H near the end. Y
  #13
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
Look in pEqn.H near the end. You will find rho being updated. Remove this line. Remember to fix rho to your constant value during initialization.

If you want to solve incompressible flow, why arent you just using simpleFoam? If you want the heat transfer capabilities of rhoSimpleFoam, a much better (and less costly) option would be to add a temperature or enthalpy transport equation to simpleFoam.
eugene is offline   Reply With Quote

Old   March 9, 2006, 07:45
Default Hi Eugene! Thanks alot for
  #14
newbee
Guest
 
Posts: n/a
Hi Eugene!

Thanks alot for your quick respons!

I have thought of both alternatives, but since I doent have much experiance with this software I might have made a bad decision in this subject.

Im happy to hear you say that altering simpleFoam in the following way is easier because it has produced a seemingly correct flow description of what im trieng to modell. Which is modelling of flows inside a nuclear reactor.

I will now try to edit the simpleFoam application insted.

Thank you
Erik
  Reply With Quote

Old   March 9, 2006, 08:04
Default This code I wrote for a temper
  #15
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
This code I wrote for a temperature transport equation might be useful. Just replace the rho field with a constant rho and remove the ddt(T) term for a steady solution.

//lookup Prt, k, R, p0
dimensionedScalar Prt = transportProperties.lookup("Prt");
dimensionedScalar p0 = transportProperties.lookup("p0");
dimensionedScalar R = transportProperties.lookup("R");
dimensionedScalar k = transportProperties.lookup("k");
dimensionedScalar Cp = transportProperties.lookup("Cp");

volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
p0/(T*R)
);


Info << "Creating alphaEff." << endl;
volScalarField alphaEff
(
IOobject
(
"alphaEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
turbulence().nut()()/Prt + k/(Cp*rho)
);

for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
solve
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(alphaEff, T)
);
}
eugene is offline   Reply With Quote

Old   March 10, 2006, 10:24
Default Thanks for your code and advic
  #16
newbee
Guest
 
Posts: n/a
Thanks for your code and advice!

I have modefied the code in the following way and included it in the end of my main code of my application:


IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
//lookup Prt, k, R, p0
dimensionedScalar Prt = transportProperties.lookup("Prt");
dimensionedScalar p0 = transportProperties.lookup("p0");
dimensionedScalar R = transportProperties.lookup("R");
dimensionedScalar k = transportProperties.lookup("k");
dimensionedScalar Cp = transportProperties.lookup("Cp");

volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
/*
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
p0/(T*R)
);
*/
double rho = 1000;

Info << "Creating alphaEff." << endl;
volScalarField alphaEff
(
IOobject
(
"alphaEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
turbulence().nut()()/Prt + k/(Cp*rho)
);



for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
solve
(
fvm::div(phi, T)
- fvm::laplacian(alphaEff, T)
);
}
------------------------------------------------

It compiles whithout anyproblems but when I try to run my case with it I get the following error message:

/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.2 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : hSimpleFoam . PD112
Date : Mar 10 2006
Time : 14:45:27
Host : compadre
PID : 9547
Root : /home/erik/OpenFOAM/erik-1.2/run/tutorials/hSimpleFoam
Case : PD112
Nprocs : 1
Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model kEpsilon

Starting time loop

Time = 0.1

BICCG: Solving for Ux, Initial residual = 0.99814, Final residual = 0.0339303, No Iterations 1
BICCG: Solving for Uy, Initial residual = 0.999487, Final residual = 0.0253859, No Iterations 1
BICCG: Solving for Uz, Initial residual = 1, Final residual = 0.0529838, No Iterations 1
ICCG: Solving for p, Initial residual = 1, Final residual = 0.00570935, No Iterations 183
time step continuity errors : sum local = 1.35731e-05, global = 8.6597e-10, cumulative = 8.6597e-10


--> FOAM FATAL IO ERROR : keyword Prt is undefined in dictionary "/home/erik/OpenFOAM/erik-1.2/run/tutorials/hSimpleFoam/PD112/constant/transport Properties"

file: /home/erik/OpenFOAM/erik-1.2/run/tutorials/hSimpleFoam/PD112/constant/transportP roperties from line 27 to line 44.

From function dictionary::lookupEntry(const word& keyword) const
in file db/dictionary/dictionary.C at line 152.

FOAM exiting

------------------------------------------------

I dont know what Ptr is or how to correctly add it to the transportProperties file.

could anyone please give me a hint on what to do.

Once again I apolegize for for insufficient programming knowlege.

kind regards
/Erik
  Reply With Quote

Old   March 13, 2006, 05:33
Default God morning! Im experementi
  #17
newbee
Guest
 
Posts: n/a
God morning!

Im experementing with the code above and ran into a problem.

when calculating "alphaeff" the dimensions doesnt match up in the following row:

turbulence().nut()()/Prt + k/(Cp*rho)

This calculation gives the following error message when running a case:

--> FOAM FATAL ERROR : LHS and RHS of + have different dimensions
dimensions : [0 2 -1 0 0 0 0] + [0 0 0 1 0 0 0]


From function operator+(const dimensionSet& ds1, const dimensionSet& ds2)
in file dimensionSet/dimensionSet.C at line 359.

FOAM aborting

I would be vary thankful for some help concerning how to modify alphaeff.

regards
/erik
  Reply With Quote

Old   March 13, 2006, 07:53
Default nut -> m^2/s Prt -> dimension
  #18
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29
niklas will become famous soon enoughniklas will become famous soon enough
nut -> m^2/s
Prt -> dimensionless
nut/Prt = m^2/s = 0 2 -1 0 0

just make sure your input parameters k and Cp
dimensions match and all will be well.

as you can see now the dimensions of the RHS is Kelvin = 0 0 0 1 0 0

and if you dont know what the order of the dimensions are, its
mass length time temperature ...

N
niklas is offline   Reply With Quote

Old   March 13, 2006, 11:03
Default Hi Niklas Thank U for the t
  #19
newbee
Guest
 
Posts: n/a
Hi Niklas

Thank U for the tip!

Your recomendation worked well and now I can run my case.

Im only confused about the dimension I had to set the Cp to.

Because "turbulence().nut()()/Prt" has the dimension
[0 2 -1 0 0 0 0]

and k = [0 2 -2 0 0 0 0]
and rho = [1 -3 0 0 0 0 0]

which gives Cp = [-1 3 -1 0 0 0 0] =m³/(kg*s)
for the equation to work.

But some searching on the internet tells me that the dimension rather should be [0 2 -2 -1 0 0 0] = J/(kg*K) according to the homepage:
http://physics.nist.gov/Pubs/SP811/sec04.html

Do you know were my misstake lies?

regards
Erik
  Reply With Quote

Old   March 13, 2006, 11:15
Default Well, what if k is really kapp
  #20
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29
niklas will become famous soon enoughniklas will become famous soon enough
Well, what if k is really kappa (Watt/(mK)) = m kg / ( s^3 K)?

I've never seen k (turbulent kinetic energy) before.
cp is usually used with kappa/lambda
niklas is offline   Reply With Quote

Reply


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
Tmp class maka OpenFOAM Bugs 2 August 20, 2008 15:53
Class Project Tiger Main CFD Forum 5 March 13, 2006 16:58
OpenFoam 12 Adding a user application class vvqf OpenFOAM Pre-Processing 3 October 27, 2005 14:18
Adding new class in version 12 billy OpenFOAM Pre-Processing 1 October 10, 2005 05:47
Expanding a class fabianpk OpenFOAM 0 October 3, 2005 05:26


All times are GMT -4. The time now is 10:57.