CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   error: no matching function for call to (https://www.cfd-online.com/Forums/openfoam-programming-development/202620-error-no-matching-function-call.html)

kk415 June 6, 2018 01:32

error: no matching function for call to
 
Hi

I am trying to make a dual grid icoFoam solver in which Navier-Stokes is solved in one grid and temperature is solved in another grid.

I am defining my two regions similar to the concept of chtmultiRegionFoam. Now the solver need an interpolation function between two grids.

The solver.c I am showing below:

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 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
icoFoam

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

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

#include "fvCFD.H"
#include "regionProperties.H"
#include "pisoControl.H"
#include "meshToMesh0.H"
//#include "MapMeshes.H"
#include "IOobjectList.H"
#include "MapConsistentVolFields.H"
#include "UnMapped.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<template<class> class CombineOp>
void MapConsistentMesh
(
const Foam::IOobjectList& objects,
const fvMesh& meshSource,
const fvMesh& meshTarget,
const meshToMesh0::order& mapOrder
)
{
// Create the interpolation scheme
meshToMesh0 meshToMesh0Interp(meshSource, meshTarget);

{
// Map volFields
// ~~~~~~~~~~~~~
MapConsistentVolFields<scalar>
(
objects,
meshToMesh0Interp,
mapOrder,
CombineOp<scalar>()
);
MapConsistentVolFields<vector>
(
objects,
meshToMesh0Interp,
mapOrder,
CombineOp<vector>()
);
}

{
// Search for list of target objects for this time
// IOobjectList objects(meshTarget, meshTarget.time().timeName());
//objects.add(U);
//objects.add(p);
//objects.add(T);
// Mark surfaceFields as unmapped
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UnMapped<surfaceScalarField>(objects);
UnMapped<surfaceVectorField>(objects);
UnMapped<surfaceSphericalTensorField>(objects);
UnMapped<surfaceSymmTensorField>(objects);
UnMapped<surfaceTensorField>(objects);

// Mark pointFields as unmapped
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UnMapped<pointScalarField>(objects);
UnMapped<pointVectorField>(objects);
UnMapped<pointSphericalTensorField>(objects);
UnMapped<pointSymmTensorField>(objects);
UnMapped<pointTensorField>(objects);
}

//mapLagrangiannew(meshToMesh0Interp);
}

int main(int argc, char *argv[])
{
#define NO_CONTROL
#define CREATE_MESH createMeshesPostProcess.H
#include "postProcess.H"

#include "setRootCase.H"
#include "createTime.H"
#include "createMeshes.H"
#include "createFields.H"
#include "initContinuityErrs.H"
#include "createTimeControls.H"
#include "readSolidTimeControls.H"
#include "setInitialMultiRegionDeltaT.H"

meshToMesh0::order mapOrder = meshToMesh0::INTERPOLATE;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

while (runTime.loop())
{
#include "readTimeControls.H"
#include "readSolidTimeControls.H"
#include "setMultiRegionDeltaT.H"
Info<< "Time = " << runTime.timeName() << nl << endl;

//#include "CourantNo.H" //?

forAll(fluidRegions, i)
{
Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl;
pisoControl piso(fluidRegions[i]);
#include "setRegionFluidFields.H"

// Momentum predictor

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

if (piso.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
}

// --- PISO loop
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(fluidRegions[i].solver(p.select(piso.finalInnerIter())));

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

// #include "continuityErrs.H"

U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();
}
//Interpolation from coarser to finer mesh
//MapConsistentMesh(fluidRegions[i], solidRegions[i], mapOrder);
// Create the interpolation scheme
meshToMesh0 meshToMesh0Interp(fluidRegions[i], solidRegions[i]);

Info<< nl
<< "Consistently creating and mapping fields for time "
<< fluidRegions[i].time().timeName() << nl << endl;

// Search for list of objects for this time
Foam::IOobjectList objects(fluidRegions[i], fluidRegions[i].time().timeName());
objects.add(U);
objects.add(p);
objects.add(T);
Info<< "object size" << objects.size()
<< endl;

MapConsistentMesh(objects, fluidRegions[i], solidRegions[i], mapOrder);

} //all fluid regions
//subtract= false;

forAll(solidRegions, i)
{
Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl;
#include "setRegionSolidFields.H"
//add these lines...
fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T)
);

TEqn.solve();
//done adding lines...

//Interpolation from finer to coarser mesh
//MapConsistentMesh(solidRegions[i], fluidRegions[i], mapOrder);
} //all solid regions


runTime.write();

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

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

return 0;
}


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

I have highlighted the point where I am facing the problem. The error I am getting is error: no matching function for call to ‘MapConsistentMesh(Foam::IOobjectList&, Foam::fvMesh&, Foam::fvMesh&, Foam::meshToMesh0::order&)’.

I am not getting what could be the reason for the error.

Can any one suggest something. It will be deeply appreciated.

Thanks

simrego June 6, 2018 07:07

Hi!
The reason for that is simply you don't have this function. At least not with these arguments.
I only found in doxygen this:
MapConsistentMesh (const fvMesh &meshSource, const fvMesh &meshTarget, const meshToMesh0::order &mapOrder)
( https://cpp.openfoam.org/v5/MapMeshes_8H_source.html )

So there is no IOobjectList for the first argument. Only (mesh source, target, mapOrder).

kk415 June 7, 2018 00:43

Quote:

Originally Posted by simrego (Post 694806)
Hi!
The reason for that is simply you don't have this function. At least not with these arguments.
I only found in doxygen this:
MapConsistentMesh (const fvMesh &meshSource, const fvMesh &meshTarget, const meshToMesh0::order &mapOrder)
( https://cpp.openfoam.org/v5/MapMeshes_8H_source.html )

So there is no IOobjectList for the first argument. Only (mesh source, target, mapOrder).

Yes but I want to modify that function for my requirement and I defined this new function before the main function in the code shown before. So what is wrong in that definition[emoji58]

kk415 June 7, 2018 03:31

It is because the template line above the MapConsistentMesh function.

template<template<class> class CombineOp>

How does it works ? Any tutorials to understand that?


All times are GMT -4. The time now is 00:03.