
[Sponsors] 
November 11, 2008, 07:16 
Hi,
I am new to OpenFOAM an

#1 
Senior Member
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 599
Rep Power: 20 
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. 

November 11, 2008, 08:44 
Here's a good start:
http:/

#2 
Member
Ville Tossavainen
Join Date: Mar 2009
Location: Helsinki, Finland
Posts: 60
Rep Power: 9 

November 19, 2008, 13:16 
Hi Ville,
What about after

#3 
New Member
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 9 
Hi Ville,
What about after that? Looks like there are more questions than answers... Any ideas? Thanks, Alex. 

November 19, 2008, 15:09 
Hi Alex,
depends what you w

#4 
Member
Ville Tossavainen
Join Date: Mar 2009
Location: Helsinki, Finland
Posts: 60
Rep Power: 9 
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 

November 19, 2008, 16:08 
yeah, that's how I feel... it'

#5 
New Member
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 9 
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 

November 25, 2008, 13:11 
Hi Ville!
I am not a CFD pe

#6 
New Member
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 9 
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. 

November 25, 2008, 14:35 
Hi Alex,
laplacianFoam solv

#7 
Member
Mathieu Olivier
Join Date: Mar 2009
Location: Quebec City, Canada
Posts: 76
Rep Power: 9 
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 

November 25, 2008, 17:59 
Thank you Mathieu, I think thi

#8 
New Member
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 9 
Thank you Mathieu, I think this is the right direction. I appreciate it!


November 28, 2008, 16:03 
Hi,
I managed to make OpenF

#9 
New Member
Alex
Join Date: Mar 2009
Location: Canada
Posts: 9
Rep Power: 9 
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. 

November 28, 2008, 16:50 
Hi,
I am new to OpenFOAM a

#10 
New Member
Shahzad
Join Date: Mar 2009
Posts: 1
Rep Power: 0 
Hi,
I am new to OpenFOAM and I have gone through user guide, but I want to implement MatrixVector 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 

November 29, 2008, 02:03 
Hi Alex,
This is what I wou

#11 
Member
Mathieu Olivier
Join Date: Mar 2009
Location: Quebec City, Canada
Posts: 76
Rep Power: 9 
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 

December 1, 2008, 16:08 
Sorry, I wrote "do until conve

#12 
Member
Mathieu Olivier
Join Date: Mar 2009
Location: Quebec City, Canada
Posts: 76
Rep Power: 9 
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 

December 1, 2008, 21:28 
For the readSolidDisplacementF

#13 
Member
Mathieu Olivier
Join Date: Mar 2009
Location: Quebec City, Canada
Posts: 76
Rep Power: 9 
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 

Thread Tools  
Display Modes  


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  CDadapco  3  December 6, 2005 09:26 
cfx solvers FVM?  derrek  CFX  5  February 10, 2003 12:50 