CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Solving Poisson's equation in OpenFoam (https://www.cfd-online.com/Forums/openfoam-solving/141032-solving-poissons-equation-openfoam.html)

Shakil Masum August 28, 2014 12:13

Solving Poisson's equation in OpenFoam
 
Dear All,

I want to solve the Poisson Equation:

solve(fvm::laplacian(H) == Constant)

I am using laplacianFoam solver. The problem is I am getting errors during compilation. The problem is the Constant value. The equation statement does not recognise any constant value.

I have tried to do it according the Section 2.4 of Programmers Guide of OpenFOAM but to do that I need to create a volScalarField for Constant which is not sensible as I have to give input for Constant in "0" folder as well which is irrelevant.

Can anyone please help me regarding this issue.

Many thanks in advance.

Henning86 August 29, 2014 04:56

you need to create a volScalarField with a constant value:

volScalarField Constant
(
IOobject
(
"Constant",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimensionSet(0, 2, 0, 0, 0, 0, 0), 0),
"zeroGradient"
);

or

volScalarField p_rgh
(
IOobject
(
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);

the last on requires an input in the 0 Dictionary

Shakil Masum August 29, 2014 10:22

Thanks Henning
 
Hi Henning,

Thanks a lot for your reply. I have tried with the 1st approach and it worked !!! Thanks again.

As this is new to me, I have some questions to clarify the statements/ syntax of programming:

A)
dimensionedScalar("0", dimensionSet(0, 2, 0, 0, 0, 0, 0), 0), - I have modified it as:

dimensionedScalar("constant", dimensionSet(0, 2, 0, 0, 0, 0, 0), -6.5), - because, I have defined the variable as "constant" which has a value of -6.5. is this correct?

B)
"zeroGradient" - I am not sure about it. Is it a boundary condition of the constant scalar Field?

Much appreciated.
Shakil


All times are GMT -4. The time now is 07:21.