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

Writing Solvers

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 11, 2008, 07:16
Default Hi, I am new to OpenFOAM an
  #1
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 565
Rep Power: 19
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi,

I am new to OpenFOAM and I have gone through quite a few of the tutorial, but I would like to know is there anywhere I can find out about how to write a solver.

Any suggestions would be appreciated.
bigphil is offline   Reply With Quote

Old   November 11, 2008, 08:44
Default Here's a good start: http:/
  #2
Member
 
Ville Tossavainen
Join Date: Mar 2009
Location: Helsinki, Finland
Posts: 60
Rep Power: 8
villet is on a distinguished road
Here's a good start:

http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam
villet is offline   Reply With Quote

Old   November 19, 2008, 13:16
Default Hi Ville, What about after
  #3
New Member
 
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 8
alex is on a distinguished road
Hi Ville,

What about after that? Looks like there are more questions than answers...
Any ideas?

Thanks,

Alex.
alex is offline   Reply With Quote

Old   November 19, 2008, 15:09
Default Hi Alex, depends what you w
  #4
Member
 
Ville Tossavainen
Join Date: Mar 2009
Location: Helsinki, Finland
Posts: 60
Rep Power: 8
villet is on a distinguished road
Hi Alex,

depends what you want to do For me the existing solvers and utilities are just examples. They use the OpenFOAM core libraries to read, solve and write stuff.

I know that getting deep into OpenFOAM takes time. Browse the existing code "examples", read the programmer's guide and make your own modifications

Ville
villet is offline   Reply With Quote

Old   November 19, 2008, 16:08
Default yeah, that's how I feel... it'
  #5
New Member
 
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 8
alex is on a distinguished road
yeah, that's how I feel... it's gonna be long and time consuming (but, hopefully, fun). I just wish there was a tutorial like "Let's make a solver for such and such problem using OpenFOAM libraries". But, since it's an open project, nobody wants to do it for free... arr

Alex
alex is offline   Reply With Quote

Old   November 25, 2008, 13:11
Default Hi Ville! I am not a CFD pe
  #6
New Member
 
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 8
alex is on a distinguished road
Hi Ville!

I am not a CFD person, but I have become interested in using OpenFOAM in my research work (I am in the field of electrochemistry). I have gone through some tutorials and I think I have a general understanding how the program works. To start with a simple problem, I would like to use OpenFOAM to solve Fick's second law of diffusion, which has the form dC/dt = D*laplacian(C) (where C is the concentration and D is the diffusion coefficient of the species). Is there a standard solver available for such type of a problem, or would I have to create my own? Would laplacianFoam be appropriate? I hope you could help me since nobody seems to answer my questions...

Thank you very much!

Alex.
alex is offline   Reply With Quote

Old   November 25, 2008, 14:35
Default Hi Alex, laplacianFoam solv
  #7
Member
 
Mathieu Olivier
Join Date: Mar 2009
Location: Quebec City, Canada
Posts: 76
Rep Power: 8
mathieu is on a distinguished road
Hi Alex,

laplacianFoam solves the following equation:

dT/dt = laplacian(DT,T)
= DT*laplacian(T) (when DT is constant)

To answer your question, I think laplacianFoam is VERY appropriate for your problem. If you use the solver directly, you'll have to make an analogy between the temperature T and the concentration C by doing some dimensional analysis (same thing for the diffusion coefficients...). Hope this helps,

Mathieu
mathieu is offline   Reply With Quote

Old   November 25, 2008, 17:59
Default Thank you Mathieu, I think thi
  #8
New Member
 
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 8
alex is on a distinguished road
Thank you Mathieu, I think this is the right direction. I appreciate it!
alex is offline   Reply With Quote

Old   November 28, 2008, 16:03
Default Hi, I managed to make OpenF
  #9
New Member
 
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 8
alex is on a distinguished road
Hi,

I managed to make OpenFoam solve a simple PDE dC/dt=laplacian(D, C) by modifying laplacianFoam. But now I am looking to solve a more difficult equation:

dC(x,y,t)/dt = laplacian(D, C)+(D/x)*(dC/dx).

Can someone give me a clue how could I modify laplacianFoam to incorporate this extra term?

Thank you,

Alex.
alex is offline   Reply With Quote

Old   November 28, 2008, 16:50
Default Hi, I am new to OpenFOAM a
  #10
New Member
 
Shahzad
Join Date: Mar 2009
Posts: 1
Rep Power: 0
shah is on a distinguished road
Hi,

I am new to OpenFOAM and I have gone through user guide, but I want to implement Matrix-Vector multiplication (I have c++ code) in OpenFOAM. I would be grateful if somebody can help me or If someone has already implemented some algorithms in OpenFoam then I would like to request that implementation.
Any suggestions would be appreciated.
Thanks,
Shah
shah is offline   Reply With Quote

Old   November 29, 2008, 02:03
Default Hi Alex, This is what I wou
  #11
Member
 
Mathieu Olivier
Join Date: Mar 2009
Location: Quebec City, Canada
Posts: 76
Rep Power: 8
mathieu is on a distinguished road
Hi Alex,

This is what I would try:

vector oneX(1,0,0);
volScalarField x = oneX & mesh.C();

do untill convergence
{
solve
(
fvm::ddt(C) = fvm::laplacian(D, C)+(D/x)*(oneX & fvc::grad(C))
)
}

Regards,

Mathieu
mathieu is offline   Reply With Quote

Old   December 1, 2008, 16:08
Default Sorry, I wrote "do until conve
  #12
Member
 
Mathieu Olivier
Join Date: Mar 2009
Location: Quebec City, Canada
Posts: 76
Rep Power: 8
mathieu is on a distinguished road
Sorry, I wrote "do until convergence" for simplicity (pseudo code). The "do while" is clearly what you need here. To be more specific:

int iCorr = 0;
scalar initialResidual = 0;

do
{
fvVectorMatrix Eqn
(
fvm::ddt(C) = fvm::laplacian(D, C)+(D/x)*(oneX & fvc::grad(C))
);

initialResidual = Eqn.solve().initialResidual();


}
while (initialResidual > convergenceTolerance && ++iCorr < nCorr);


This is very similar to the procedure in the solver solidDisplacementFoam... The "convergence" loop is used to update the explicit term (fvc::grad(C)) at each iteration. Good luck !

Mathieu
mathieu is offline   Reply With Quote

Old   December 1, 2008, 21:28
Default For the readSolidDisplacementF
  #13
Member
 
Mathieu Olivier
Join Date: Mar 2009
Location: Quebec City, Canada
Posts: 76
Rep Power: 8
mathieu is on a distinguished road
For the readSolidDisplacementFoamControls.H file, try the tutorial of solidDisplacementFoam and you should understand it (there are also some explanations in the user guide, in the tutorial section). The parameters are read in the fvSolution file. For the "void expression" error, try to isolate the problem by removing terms from the equation... it may have something to do with the (D/x)*(oneX & fvc::grad(C)) term but I can't say for sure... By the way, I think you should remove the "for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) " loop.

Mathieu
mathieu is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What are the solvers doing sega OpenFOAM Running, Solving & CFD 4 April 19, 2008 16:07
fem solvers dontknow Main CFD Forum 2 June 24, 2007 12:51
Linear Solvers Sachin Main CFD Forum 0 May 6, 2006 12:07
Solvers DB CD-adapco 3 December 6, 2005 09:26
cfx solvers -FVM? derrek CFX 5 February 10, 2003 12:50


All times are GMT -4. The time now is 14:05.