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

Solving PDE

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By jherb

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 2, 2016, 18:20
Default Solving PDE
  #1
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
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
Attached Images
File Type: gif PDE.gif (4.2 KB, 79 views)
cute is offline   Reply With Quote

Old   May 4, 2016, 08:21
Default
  #2
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Does anyone has any comment on my problem?
cute is offline   Reply With Quote

Old   May 4, 2016, 09:32
Default
  #3
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
For what does the D() stand? div? But isn't X scalar?
jherb is offline   Reply With Quote

Old   May 4, 2016, 09:59
Default
  #4
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
D is a function of X where X is a scalar quantity.
cute is offline   Reply With Quote

Old   May 4, 2016, 11:47
Default
  #5
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
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);
}
You have to somehow determine, if X converges, because for the calculation of DX the values of X from the previous iteration are used. Perhaps you also have to add some kind of underrelaxation.

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)
erinsam likes this.
jherb is offline   Reply With Quote

Old   May 4, 2016, 12:47
Default
  #6
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
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.
cute is offline   Reply With Quote

Old   May 4, 2016, 15:10
Default
  #7
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
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
jherb is offline   Reply With Quote

Old   May 4, 2016, 16:14
Default
  #8
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
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.
cute is offline   Reply With Quote

Old   May 6, 2016, 23:21
Default
  #9
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
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?
cute is offline   Reply With Quote

Old   May 6, 2016, 23:38
Default
  #10
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
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)
cute is offline   Reply With Quote

Old   May 7, 2016, 17:48
Default
  #11
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
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?
jherb is offline   Reply With Quote

Old   May 7, 2016, 18:04
Default
  #12
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
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?
cute is offline   Reply With Quote

Old   May 7, 2016, 18:47
Default
  #13
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
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.
jherb is offline   Reply With Quote

Old   May 8, 2016, 05:57
Default
  #14
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
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?
cute is offline   Reply With Quote

Old   May 9, 2016, 17:34
Default
  #15
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
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
jherb is offline   Reply With Quote

Old   May 9, 2016, 18:08
Default
  #16
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Thanks alot and really appreciate your help. I will try this very soon.
cute 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
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


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