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

compiling a new solver using older one

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 7, 2021, 07:33
Default compiling a new solver using older one
  #1
New Member
 
kuldeep
Join Date: Jul 2021
Posts: 5
Rep Power: 4
kuldeep is on a distinguished road
i am new to this openfoam, i am trying to add extra term(T j in momentum equation and n^2 * V in energy equation) and trying to compile it but getting this error:
candidate expects 2 arguments, 1 provided
71 | +fvc::Sp(T));


form of equation which i want in to add in my solver
https://drive.google.com/file/d/1rzd...ew?usp=sharing

new_Icofoam3.C
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.

Application
new_icoFoam

Description
Transient solver for incompressible, laminar flow of Newtonian fluids.
Added the temperature solver

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "pisoControl.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"

pisoControl piso(mesh);

#include "createFields.H"
#include "initContinuityErrs.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

#include "CourantNo.H"

// Momentum predictor

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);

if (piso.momentumPredictor())
{
solve(UEqn == -fvc::grad((1/rho)*p)
+fvc::Sp(T));
}
// snGrad calculates the surface normal gradient for you. Since the surface normal
// is only one direction, you will get one component for every component of velocity.
// However if you input a scalar field, you will get only a scalar.

// --- PISO loop i.e correcting the velocity
while (piso.correct())
{
volScalarField rAU(1.0/UEqn.A());
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
);

adjustPhi(phiHbyA, U, p);

// Update the pressure BCs to ensure flux consistency
constrainPressure(p, U, phiHbyA, rAU);

// Non-orthogonal pressure corrector loop
while (piso.correctNonOrthogonal())
{
// Pressure corrector

fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);

pEqn.solve();

if (piso.finalNonOrthogonalIter())
{
phi = phiHbyA - pEqn.flux();
}
}

#include "continuityErrs.H"

U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();

/* here velocity is already calculated */

// now start the temperature equation part

// int N2;
// I = [0 1 0]

fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T) // DT for thermal diffusivity
+ N2*(U&I)); // & operator is for dot product
//);

//TEqn.relax()

TEqn.solve();

}

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return 0;
}


// ************************************************** *********************** //

createfields.H

Info<< "Reading transportProperties\n" << endl;

IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);

dimensionedScalar nu
(
"nu",
dimViscosity,
transportProperties.lookup("nu")
);

// Adding Line

dimensionedScalar DT
(
"DT",
// dimViscosity,
transportProperties.lookup("DT")
);

dimensionedScalar N2
(
"N2",
transportProperties.lookup("N2")
);

dimensionedScalar rho
(
"rho",
transportProperties.lookup("rho")
);

dimensionedVector I
(
"I",
vector (0, 1, 0)
);

// Done

Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);


Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

// Adding lines for temperature field

Info<< "Reading field T\n" << endl;
volScalarField T // T is also volume property
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

// Done

#include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
mesh.setFluxRequired(p.name());

please help me with this
thanks in advance
kuldeep 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
make: Clock skew detected. build may be incomplete. while compiling new solver. savee OpenFOAM Programming & Development 1 May 27, 2017 06:23
Hybrid discretisation - blend factor gcoopermax CFX 5 September 23, 2016 08:05
fluent divergence for no reason sufjanst FLUENT 2 March 23, 2016 16:08
Working directory via command line Luiz CFX 4 March 6, 2011 20:02
Compiling new Solver with wmake lin123 OpenFOAM 3 April 13, 2010 14:18


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