|
[Sponsors] |
May 2, 2016, 18:20 |
Solving PDE
|
#1 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Hi,
I would like to solve a PDE equation (see attached picture). Can any one explain, how to write this equation in openfoam format? I have seen some equations in user guide but not similar to this. Is there any test case in tutorial that I can use to solve this equation. Thanks |
|
May 4, 2016, 08:21 |
|
#2 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Does anyone has any comment on my problem?
|
|
May 4, 2016, 09:32 |
|
#3 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
For what does the D() stand? div? But isn't X scalar?
|
|
May 4, 2016, 09:59 |
|
#4 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
D is a function of X where X is a scalar quantity.
|
|
May 4, 2016, 11:47 |
|
#5 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
I haven't tried it, but it sould be something like:
Code:
for (some loop) { volScalarField DX("DX", D(X)); solve(fvm::ddt(X) == fvm::laplacian(DX, X) + k*X); } This also might help: https://openfoamwiki.net/index.php/Contrib_potentialWaveFoam https://www.openacoustics.org/svn-re...ntialWaveFoam/ (even though, you have a first time derivative and not a second one) |
|
May 4, 2016, 12:47 |
|
#6 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Thanks for the reply.
I am new in openfoam and will take time to understand and implement as you suggested. If I define D(X) = X^2, can I rewrite the code as: for (some loop) { solve(fvm::ddt(X) == fvm::laplacian(X^2, X) + k*X); } If you can also explain volScalarField, would be easy to understand. I was searching but did not find any explanation. |
|
May 4, 2016, 15:10 |
|
#7 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
If you are new to OpenFOAM then you should better read some (/a lot) of documentation/tutorials. I am afraid but you wont be able to program your own solver without a least some understanding about how OpenFOAM works (e.g. definition of fields, implicit/explicit discretization etc.). Here are some links to start with:
http://www.tfd.chalmers.se/~hani/kur...ngTutorial.pdf http://www.sourceflux.de/blog/101-th...ting-openfoam/ http://www.openfoam.org/features/creating-solvers.php |
|
May 4, 2016, 16:14 |
|
#8 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
You are right. I am reading all these for one month and have some understanding but sometime it is difficult to find explanation. I have gone through many documentations and have gone through the links you provided. I go over these documentation whenever I need too and still many of the things are unexplained.
Thanks for your suggestion. I will let you know, if I get stuck. |
|
May 6, 2016, 23:21 |
|
#9 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
I tried the code as suggested above
for (some loop) { volScalarField DX("DX", X*X); solve(fvm::ddt(X) == fvm::laplacian(DX, X) + k*X); } I am getting Fatal error: keyword laplacian(DX, X) is undefined in dictionary ......./fvSchemes.laplacianSchemes. How to fix this error? |
|
May 6, 2016, 23:38 |
|
#10 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
PLEASE READ MY PREVIOUS POST THEN RED THIS ONE.
I added laplacian(DX,T) Gauss linear corrected; in fvSchemes then I am getting the following errors: --> FOAM FATAL ERROR: [X[3 -11 0 0 0 0 0] ] + [X[1 -3 0 0 0 0 0] ] From function void Foam::checkMethod(const Foam::fvMatrix<Type>&, const Foam:: DimensionedField<Type, Foam::volMesh>&, const char*) [with Type = double] in file /opt/OpenFOAM/OpenFOAM-v3.0+/src/finiteVolume/lnInclude/fvMatrix.C at line 1298. FOAM aborting #0 Foam::error:: printStack(Foam::Ostream&) in "/opt/OpenFOAM/OpenFOAM-v3.0+/platforms/linux64Gcc48DPInt32Opt/lib/libOpenFOAM.so" #1 Foam::error::abort() in "/opt/OpenFOAM/OpenFOAM-v3.0+/platforms/linux64Gcc48DPInt32Opt/lib/libOpenFOAM.so" #2 void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam:: DimensionedField<double, Foam::volMesh> const&, char const*) in "/home/nasim/OpenFOAM/nasim-v3.0+/platforms/linux64Gcc48DPInt32Opt/bin/diffusionFoam" #3 ? in "/home/nasim/OpenFOAM/nasim-v3.0+/platforms/linux64Gcc48DPInt32Opt/bin/diffusionFoam" #4 ? in "/home/nasim/OpenFOAM/nasim-v3.0+/platforms/linux64Gcc48DPInt32Opt/bin/diffusionFoam" #5 __libc_start_main in "/lib64/libc.so.6" #6 ? in "/home/nasim/OpenFOAM/nasim-v3.0+/platforms/linux64Gcc48DPInt32Opt/bin/diffusionFoam" Aborted (core dumped) |
|
May 7, 2016, 17:48 |
|
#11 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
Have a look in createFields.H of the solver(s) of OpenFOAM. There you can see how a field with a dimension is created. Then assign the correct dimension to the field DX (so that the both terms on the right hand side of your equation have the same dimensions). What is the dimension of X?
|
|
May 7, 2016, 18:04 |
|
#12 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Thanks jHerb, There was a problem with dimension and has been corrected. Now my simulations are running.
Thanks for all the help. If I encounter other problems, I will post here. I have one more question. I am solving a simple system whose exact solution does exit. Is there any facility/tool that I could verify my simulations with exact solution. For example, can I integrate my PDE in openfoam and visualize the solution in paraFoam? |
|
May 7, 2016, 18:47 |
|
#13 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
Can't you just load your case with paraview/paraFoam? It should offer you the fields of your solution (so probably) X and DX to view on your grid.
Also there are probes, to write the results of the fields for selected points in a directory call postprocessing. Another idea: You can create an addition field and use it to store the exact solution of the equation. Then you can also view this field in paraview. Either there with a filter or directly in your solver you can create yet another field to store the differences between your numerical and the exact solutions. Just for curiosity: Can you post some screenshots of paraview, if you succeeded. |
|
May 8, 2016, 05:57 |
|
#14 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
I can use paraFoam to view the fields and there is no problem. But how can I calculate the results for exact solution.
For example, if I have a function that represent exact solution as W=X(t, x,y) where t is time and x, y are spatial coordinates. How can I store the functional values for various time in their respective directories using t as simulation timestep and x and y as grid points? |
|
May 9, 2016, 17:34 |
|
#15 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
In paraview there are filters which can do what you want: Try the the calculator filter to do calculate the theoretical result: https://itk.org/Wiki/ParaView/Users_...ers#Calculator
http://www.paraview.org/Wiki/Beginni...culator_filter or perhaps also the python calculator: http://www.vtk.org/Wiki/Python_Calculator see also http://scicomp.stackexchange.com/que...red-in-two-dif |
|
May 9, 2016, 18:08 |
|
#16 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Thanks alot and really appreciate your help. I will try this very soon.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
simpleFoam error - "Floating point exception" | mbcx4jc2 | OpenFOAM Running, Solving & CFD | 12 | August 4, 2015 02:20 |
Unstabil Simulation with chtMultiRegionFoam | mbay101 | OpenFOAM Running, Solving & CFD | 13 | December 28, 2013 13:12 |
calculation stops after few time steps | sivakumar | OpenFOAM Running, Solving & CFD | 7 | March 17, 2013 06:37 |
Differences between serial and parallel runs | carsten | OpenFOAM Bugs | 11 | September 12, 2008 11:16 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 18:07 |