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/)
-   -   mapFields issue with slight change in geometry (https://www.cfd-online.com/Forums/openfoam-solving/160877-mapfields-issue-slight-change-geometry.html)

alexflage October 14, 2015 16:42

mapFields issue with slight change in geometry
 
Hi everyone, I'm pretty new to OF but have really enjoyed learning it. This forum has been an excellent resource! I'm stuck with an issue trying to map one solution to another case. Each case takes me a week or two of run time, so it would be fantastic if I could figure out how to map the solution to speed things up.

For starters, here's a picture of a dummy geometry that I'm working with. If we can answer the question on this geometry, I should be able to figure out the issue with my real geometry.

I want to go from this:

https://www.dropbox.com/s/7mmt392mvm...igned.png?dl=0

to this:

https://www.dropbox.com/s/rapn4u851m...ffset.png?dl=0

I have a patch called MAIN_INLET coming in from the left, and two additional inlets named TOP_INLET and BOTTOM_INLET. I initially ran the simulation with the top and bottom inlets turned off, and now I'd like to be able to map that solution to different cases where I shift the top and bottom inlets downstream (and turn them on).

My mapFieldsDict file looks like this:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.4.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      MapFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// List of pairs of source/target patches for mapping
patchMap
(
    SYM1 SYM1
    SYM2 SYM2
    MAIN_INLET MAIN_INLET
    OUTLET OUTLET
    WALL WALL
);

// List of target patches cutting the source domain (these need to be
// handled specially e.g. interpolated from internal values)
cuttingPatches
(
);

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

My command to execute mapFieldsDict is:

Code:

mapFields ../aligned -sourceTime latestTime
I've tried several combinations of patches in the patchMap and cuttingPatches sections, but I'm getting a similar error for each combination:

Code:

alex@alex-ubuntu15:~/Documents/air/offset$ mapFields ../aligned -sourceTime latestTime
/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.4.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.4.0-f0842aea0e77
Exec  : mapFields ../aligned -sourceTime latestTime
Date  : Oct 14 2015
Time  : 15:14:09
Host  : "alex-ubuntu15"
PID    : 30787
Case  : /home/alex/Documents/air/offset
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Source: ".." "aligned"
Target: "/home/alex/Documents/air" "offset"

Create databases as time
Case  : ../aligned
nProcs : 1

Source time: 0.11
Target time: 0.11

Create meshes

Source mesh size: 718334    Target mesh size: 296624


Creating and mapping fields for time 0.11

Creating mesh-to-mesh addressing for region0 and region0 regions using cellVolumeWeight
    Overlap volume: 50.247978
Creating AMI between source patch SYM1 and target patch SYM1 using faceAreaWeightAMI
    AMI: Creating addressing and weights between 14115 source faces and 14185 target faces


--> FOAM FATAL ERROR:
Unable to set source and target faces

    From function void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces(label&, label&, label&, const boolList&, labelList&, const DynamicList<label>&, bool) const
    in file lnInclude/faceAreaWeightAMI.C at line 300.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::faceAreaWeightAMI<Foam::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> >, Foam::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> > >::calcAddressing(Foam::List<Foam::DynamicList<int, 0u, 2u, 1u> >&, Foam::List<Foam::DynamicList<double, 0u, 2u, 1u> >&, Foam::List<Foam::DynamicList<int, 0u, 2u, 1u> >&, Foam::List<Foam::DynamicList<double, 0u, 2u, 1u> >&, int, int) at ??:?
#3  Foam::faceAreaWeightAMI<Foam::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> >, Foam::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> > >::calculate(Foam::List<Foam::List<int> >&, Foam::List<Foam::List<double> >&, Foam::List<Foam::List<int> >&, Foam::List<Foam::List<double> >&, int, int) at ??:?
#4  Foam::AMIInterpolation<Foam::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> >, Foam::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> > >::update(Foam::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> > const&, Foam::PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> > const&) at ??:?
#5  Foam::meshToMesh::calculatePatchAMIs(Foam::word const&) at ??:?
#6  Foam::meshToMesh::constructFromCuttingPatches(Foam::word const&, Foam::word const&, Foam::HashTable<Foam::word, Foam::word, Foam::string::hash> const&, Foam::List<Foam::word> const&) at ??:?
#7  Foam::meshToMesh::meshToMesh(Foam::polyMesh const&, Foam::polyMesh const&, Foam::meshToMesh::interpolationMethod const&, Foam::HashTable<Foam::word, Foam::word, Foam::string::hash> const&, Foam::List<Foam::word> const&) at ??:?
#8  ? at ??:?
#9  ? at ??:?
#10  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#11  ? at ??:?
Aborted (core dumped)

Sorry for the long post, but if anyone has any suggestions I would greatly appreciate it!

p.s. I realize my target mesh is significantly coarser than the source mesh. I'm not sure if this is an issue--I just made a very quick dummy mesh in a few seconds to get a test case going. In my "real" case, the target mesh is slightly finer than the source mesh, but yields the same result.

Thanks!

alexflage October 14, 2015 19:44

Well, after a lot of trial and error I seem to have fixed the issue. I changed the mapFieldsDict file to be the following:

Code:

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

// List of pairs of source/target patches for mapping
patchMap
(
    OUTLET OUTLET
    MAIN_INLET MAIN_INLET
);

// List of target patches cutting the source domain (these need to be
// handled specially e.g. interpolated from internal values)
cuttingPatches
(
);

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

I didn't think it would interpolate the entire field with only those two patches, but then again I don't have a great understanding of what's really going on. Anyway, the issue is fixed for me at this point. :)

alexflage October 15, 2015 21:23

Well, unfortunately, my issue is not solved. mapFields executes without errors, and when I open up paraview I see a pretty good mapping of my solution onto the new geometry. However, when I try to run the solver, I get the following error:

Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.4.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.4.0-f0842aea0e77
Exec  : compressibleInterFoam
Date  : Oct 15 2015
Time  : 20:07:39
Host  : "alex-ubuntu15"
PID    : 9104
Case  : /home/alex/Documents/air/offset
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0.11


Reading g

PIMPLE: Operating solver in PISO mode

Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Constructing twoPhaseMixtureThermo

Selecting thermodynamics package
{
    type            heRhoThermo;
    mixture        pureMixture;
    transport      const;
    thermo          hConst;
    equationOfState perfectFluid;
    specie          specie;
    energy          sensibleInternalEnergy;
}

Selecting thermodynamics package
{
    type            heRhoThermo;
    mixture        pureMixture;
    transport      const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleInternalEnergy;
}

Reading thermophysical properties

Calculating field g.h

Selecting turbulence model type LESModel
Selecting LES turbulence model Smagorinsky
Selecting LES delta type smooth
Selecting LES delta type cubeRootVol
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::compressible::mutkWallFunctionFvPatchScalarField::calcMut() const at ??:?
#4  Foam::compressible::mutWallFunctionFvPatchScalarField::updateCoeffs() at ??:?
#5  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::evaluate() at ??:?
#6  Foam::compressible::LESModels::Smagorinsky::updateSubGridScaleFields(Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#7  Foam::compressible::LESModels::Smagorinsky::Smagorinsky(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::fluidThermo const&, Foam::word const&, Foam::word const&) at ??:?
#8  Foam::compressible::LESModel::adddictionaryConstructorToTable<Foam::compressible::LESModels::Smagorinsky>::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::fluidThermo const&, Foam::word const&) at ??:?
#9  Foam::compressible::LESModel::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::fluidThermo const&, Foam::word const&) at ??:?
#10  Foam::compressible::turbulenceModel::addturbulenceModelConstructorToTable<Foam::compressible::LESModel>::NewturbulenceModel(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::fluidThermo const&, Foam::word const&) at ??:?
#11  Foam::compressible::turbulenceModel::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::fluidThermo const&, Foam::word const&) at ??:?
#12  ? at ??:?
#13  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#14  ? at ??:?
Floating point exception (core dumped)

If anyone has any insight it would be very much appreciated. I'm very new to this, and it would be awesome if I could get mapFields going with my geometry.

Thanks!

Roal-Yr November 29, 2015 17:18

The point is that your wall cuts the domain where inlet was, thus not all of your patches are described in patchMap, but some of them must be defined in cuttingPatches.


All times are GMT -4. The time now is 20:01.