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

How to write a solver beginner

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 8, 2008, 14:00
Default Hi to evryone! I'm a complete
  #1
Senior Member
 
Ivan Flaminio Cozza
Join Date: Mar 2009
Location: Torino, Piemonte, Italia
Posts: 210
Rep Power: 18
ivan_cozza is on a distinguished road
Send a message via MSN to ivan_cozza
Hi to evryone!
I'm a complete beginner in openFOAM (I began readin the manuals since yesterday!!), and I'm intrested to build a model that, given a value of a passive scalar, transports it downstream with a convection speed that I have to read from a CFD simulation done before. The particularity is that I need to modify the transported scalar at each timestep and use this new value to calculate the new transported value.
It is possible in openFOAM??
ivan_cozza is offline   Reply With Quote

Old   January 22, 2008, 23:01
Default Ivan, start by studying some o
  #2
Member
 
David P. Schmidt
Join Date: Mar 2009
Posts: 72
Rep Power: 17
schmidt_d is on a distinguished road
Ivan, start by studying some of the utilities that loop over all existing output and calculation something from them (such as magU). You can use this as a starting point in your new code.

If memory serves, there is a wiki fragment floating about that gives some help about adding a transport equation.
-David
schmidt_d is offline   Reply With Quote

Old   January 23, 2008, 13:54
Default Dear Ivan, what you need to
  #3
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Dear Ivan,

what you need to do is easily doable in OpenFOAM, supposing you can convert the velocity field you have into the openFOAM format.

About the solver, give a look to scalarTransportFoam, in OpenFOAM/OpenFOAM-1.4.1/applications/solvers/basic

With a little change, you can adapt it to your case.

With kind regards,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   January 24, 2008, 16:10
Default Hi, I'm a complete beginner t
  #4
New Member
 
Manuel Larenas Aravena
Join Date: Mar 2009
Location: Santiago, Chile
Posts: 15
Rep Power: 17
mlarenas is on a distinguished road
Hi,
I'm a complete beginner too. Today, I started modeling dust particles in presence of a velocity field, I think they are similar problems!

Alberto, when you say "give a look" to that solver... what do you mean? I understand the basics of the code... but I dont know exactly how to use it (I just completed the UserGuide cases, but you don't have too much work here... :P)

I have already calculated (using simpleFoam) the velocity field, so... now comes the dust part.

Please, we need help!

Best regards,
Manuel
mlarenas is offline   Reply With Quote

Old   January 25, 2008, 06:34
Default Hello Make a copy of the si
  #5
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 215
Rep Power: 18
santos is on a distinguished road
Send a message via Skype™ to santos
Hello

Make a copy of the simpleFoam solver (e.g. simpleFoam2), then edit simpleFoam2.C and add the scalar transport equation from scalarTransportFoam.C.

Search the forum for this particular problem, I think it has been addressed a few times.

Regards,
José Santos
santos is offline   Reply With Quote

Old   January 27, 2008, 13:05
Default Hello Manuel, what I meant
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Hello Manuel,

what I meant is that scalarTransportFoam calculates the evolution in time of a passive scalar in a frozen velocity field.

If you already calculated the velocity field with simpleFoam and you simply want to trace a passive scalar using that velocity field, you can do as follows:

- Clone the scalarTransportFoam tutorial.
- Copy the mesh of your case in it (blockMeshDict if you use blockMesh) and generate the grid.
- Copy the velocity field (U) you calculated in the case directory.
- Adapt the boundary conditions for T to your case.
- Run the case.

Of course, if you want to couple the calculation of the velocity field with the solution of the scalar transport equation you should do what José suggested above.

Regards,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   January 28, 2008, 09:59
Default Hi Alberto, thank you very mu
  #7
New Member
 
Manuel Larenas Aravena
Join Date: Mar 2009
Location: Santiago, Chile
Posts: 15
Rep Power: 17
mlarenas is on a distinguished road
Hi Alberto,
thank you very much for your reply. I did what you said, I gave a look to the tutorial case (pitzDaily) in scalarTransportFoam and copied the velocity field I calculated before to a cloned case. Unfortunately, it seems that T does not diffuse from the boundary... I tried everything... but with no results. Can you give a look to my case please? I could send it to your email (~10 mb), it shouldn't take more than 5 minutes to you

Best regards,
Manuel
mlarenas is offline   Reply With Quote

Old   January 29, 2008, 12:05
Default Read your e-mail :-) Regard
  #8
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Read your e-mail :-)

Regards,
A.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   January 30, 2008, 07:25
Default Hi all. I have similar prob
  #9
New Member
 
Hyunchang Lee
Join Date: Mar 2009
Location: Daejeon, Korea
Posts: 11
Rep Power: 17
asteria is on a distinguished road
Hi all.

I have similar problem you guys. I'm trying to solve some scalar transport equations,

But there is some difference in my problem with what is mentioned above. It is that the flux is influenced by the transported scalar. so I added this line after solving U eqn.


------------------------------------------------
surfaceScalarField coeffiC4 = rhoa/rhob/18./nub*fvc::interpolate(m6);
surfaceScalarField coeffi4 = (coeffiA - coeffiB)*coeffiC4;

fvScalarMatrix m4Eqn
(
fvm::ddt(m4)
+ fvm::div(phib + coeffi4/(fvc::interpolate(m4)), m4, "div(phib,m0)")
);

m4Eqn.relax();
m4Eqn.solve();
--------------------------------------------

So I want the flux(phib + coeffi4/(fvc::interpolate(m4))) be changed as m4 is changed during iteration.

Do you think I am going right way?
I'm not sure that it reads flux each iteration inside of solver.

Any advices will be appreciated
Thanks.

Hyunchang.
asteria is offline   Reply With Quote

Old   January 30, 2008, 07:31
Default And anybody knows what 'm4Eqn.
  #10
New Member
 
Hyunchang Lee
Join Date: Mar 2009
Location: Daejeon, Korea
Posts: 11
Rep Power: 17
asteria is on a distinguished road
And anybody knows what 'm4Eqn.relax()' means?

I know this question could be foolish, but I did.
asteria is offline   Reply With Quote

Old   January 30, 2008, 17:25
Default Hi all: I need modelling a
  #11
New Member
 
Antonieta Silva
Join Date: Mar 2009
Location: Concepcion, Chile
Posts: 15
Rep Power: 17
antopnieta is on a distinguished road
Hi all:

I need modelling a heat transfer in a steel ball with his surface a constant temperature, the temperature of the surface is more less than of the interior. All this in transient.

My mesh is a semicircle....

I begin do this with buoyantFoam.... but... i have a question... where put h, cp, rho???... and... the thermophysical properties i suppose that are of the ball... or not??

I hope you can help me....

Antonieta...
antopnieta is offline   Reply With Quote

Old   January 31, 2008, 04:07
Default Hi Antonieta, If the surface
  #12
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Hi Antonieta,
If the surface temperature of the ball is constant, and you are interested only in the temperature inside the ball, why don't you use directly the laplacianFoam? Why do you need the buoyanFoam solver?

Dragos
dmoroian is offline   Reply With Quote

Old   January 31, 2008, 08:42
Default Hola compatriota! same thing.
  #13
New Member
 
Manuel Larenas Aravena
Join Date: Mar 2009
Location: Santiago, Chile
Posts: 15
Rep Power: 17
mlarenas is on a distinguished road
Hola compatriota!
same thing... buoyantFoam is a transient solver for turbulent fluids, so I don't understand why you're using it for the steel ball. Maybe you could explain your model better

Saludos,
Manuel
mlarenas is offline   Reply With Quote

Old   January 31, 2008, 08:58
Default Dear Dragos My problem is
  #14
New Member
 
Antonieta Silva
Join Date: Mar 2009
Location: Concepcion, Chile
Posts: 15
Rep Power: 17
antopnieta is on a distinguished road
Dear Dragos


My problem is a hot steel ball that cold with water... but for simplicity (and because first I have to do in this form) I suposse that the surface temperature is less than of the interior....

And I use BuoyantFoam because i think that is the best solver fot heat transfer in transient... and because the temperature in the sphere change with the properties that have (k, rho, Cp,...).... or not??

Now I use laplacianFoam to probe... but I don't know if I can add the properties of the sphere... :S

What is the best solver to this??? laplacian??? buoyant??? other???

Antonieta
antopnieta is offline   Reply With Quote

Old   January 31, 2008, 09:20
Default Ok, a little more light came h
  #15
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Ok, a little more light came .
If you want to compute the whole domain (including water and steel) then you have a so called conjugate heat transfer problem. In this case you have two different sets of equations to solve on two different domains:
1. Navier-Stokes or other simpler model for the fluid region.
2. Heat equation for the solid region.
As I understood, Hrv developed a new coupled block mesh library which is able to solve such a problem: Integrated conjugate heat transfer solver in OpenFOAM
Some time ago, Daniele wrote also a conjugate heat transfer solver: conjugate heat transfer.
So you may try those examples above.
But if you have constant temperature at the surface of the ball, I don't see the need to compute the fluid flow. Consequently, you should solve only the heat equation inside the solid domain. That you can do by using the laplacianFoam solver. The properties you mention (k, rho, Cp), are included in the heat diffusivity coefficient (DT = k/rho/Cp) in constant/transportProperties dictionary.

I hope this will help you!
Dragos
dmoroian is offline   Reply With Quote

Old   January 31, 2008, 09:20
Default Hi Manuel... I am really n
  #16
New Member
 
Antonieta Silva
Join Date: Mar 2009
Location: Concepcion, Chile
Posts: 15
Rep Power: 17
antopnieta is on a distinguished road
Hi Manuel...

I am really new in this... and anybody of my partners know something about OF... can you give me your mail for explain better my problem... because it's more easy to me explain all in spanish....

I wait your answer...

Thank!
antopnieta is offline   Reply With Quote

Old   January 31, 2008, 09:24
Default Hi, all. Are there anybody wh
  #17
New Member
 
Hyunchang Lee
Join Date: Mar 2009
Location: Daejeon, Korea
Posts: 11
Rep Power: 17
asteria is on a distinguished road
Hi, all.
Are there anybody who can help? :-)
maybe I need to clarify my question to make myself understood. Here I go.
I'm solving a scalar transport equation like
ddt(psi) + div(phi, psi) = 0

but here phi is a function of psi. So it should be changed in the iteration. So I write a code like this.

fvScalarMatrix m4Eqn
(
fvm::ddt(m4)
+ fvm::div(phib + coeffi4/(fvc::interpolate(m4)), m4, "div(phib,m0)")
);

m4Eqn.relax();
m4Eqn.solve();

Here, m4 is scalar what I want to solve and we already know phib and coeffi4 which don't change in this iteration.

I have solved my cases by this code but it seems once it read flux then it doesn't read flux again, so the flux doesn't change and it is not what I want. T.T

I'm not sure that myself is understood.
any question or comments are welcomed!!

Hyunchang
asteria is offline   Reply With Quote

Old   January 31, 2008, 09:28
Default Thank Dragos! I had not rea
  #18
New Member
 
Antonieta Silva
Join Date: Mar 2009
Location: Concepcion, Chile
Posts: 15
Rep Power: 17
antopnieta is on a distinguished road
Thank Dragos!

I had not realized of the diffusivity.... really... I was looking for DT in user's guide... because I know diffusivity like alpha...

Thank again... I run now with laplacian...

Antonieta
antopnieta is offline   Reply With Quote

Old   January 31, 2008, 11:14
Default No problem Antonieta! You can
  #19
New Member
 
Manuel Larenas Aravena
Join Date: Mar 2009
Location: Santiago, Chile
Posts: 15
Rep Power: 17
mlarenas is on a distinguished road
No problem Antonieta!
You can see my email address in my profile, just clicking on my name
I'm a beginner too, but we can help each other using email.

Saludos,
Manuel
mlarenas is offline   Reply With Quote

Old   January 31, 2008, 11:24
Default Hi Hyunchang, if I'm not wron
  #20
New Member
 
Manuel Larenas Aravena
Join Date: Mar 2009
Location: Santiago, Chile
Posts: 15
Rep Power: 17
mlarenas is on a distinguished road
Hi Hyunchang,
if I'm not wrong, you need to solve the coupled equations... in that case I recommend you to email Alberto Passalacqua (he posted above). He sent me a very useful solver coded by himself, he is a very nice guy ;)
I'm just a beginner, so... it's all the help I can give you by now.

Kind regards,
Manuel
mlarenas 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
i am beginner for cfd robbin CFX 1 December 31, 2005 12:54
Beginner question OddEven Decoupling in SIMPLE Solver brooksmoses OpenFOAM Running, Solving & CFD 2 November 9, 2005 20:38
beginner tzari Phoenics 0 December 2, 2003 04:39
Beginner Subash Main CFD Forum 1 September 16, 2003 01:35
UDF Beginner M. A. Rakib FLUENT 1 June 6, 2000 12:23


All times are GMT -4. The time now is 00:09.