CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   mapFields question (https://www.cfd-online.com/Forums/openfoam-pre-processing/141196-mapfields-question.html)

RodriguezFatz September 2, 2014 03:31

mapFields question
 
Hi all,

I have problems with mapFields. What I want is a fully developed profile at the inlet of my pipe. So in the first case, I run a piece of pipe with cyclic b.c. whose outlet ("PER_PIPE_OUTLET") lies exactly at the inlet ("PIPE_INLET") of my second case.
I created all meshes with ICEM.

Now, the first case runs, everything is fine.
I created a mapFieldsDict in the system directory of my second case that says
Code:

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

patchMap        ( PER_PIPE_OUTLET PIPE_INLET);

cuttingPatches  ( );


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

as proposed here:
http://www.cfd-online.com/Forums/ope...tml#post264825

i run
Code:

mapFields -sourceTime 20630 ../../pipe/k_omega_sst_lowRe/
in the second case directory

and get the error:
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.x                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.3.x-c4208369017e
Exec  : mapFields -sourceTime 20630 ../../pipe/k_omega_sst_lowRe/
Date  : Sep 02 2014
Time  : 09:25:43
Host  : "OptiPlex-990"
PID    : 10141
Case  : /home/mertmann/paddel/ohne_paddel/k_omega_sst_lowRe
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Source: "../../pipe/k_omega_sst_lowRe" ""
Target: "/home/mertmann/paddel/ohne_paddel" "k_omega_sst_lowRe"

Create databases as time
Case  : ../../pipe/k_omega_sst_lowRe
nProcs : 1

Source time: 20630
Target time: 0

Create meshes

Source mesh size: 100320    Target mesh size: 1704096


Creating and mapping fields for time 20630



--> FOAM FATAL ERROR:
Patch named PIPE_INLET not found.
Available patch names:
3
(
PER_PIPE_INLET
PER_PIPE_OUTLET
PER_PIPE_WALL
)



    From function polyBoundaryMesh::operator[](const word&) const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 1193.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::polyBoundaryMesh::operator[](Foam::word const&) const at ??:?
#3  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 ??:?
#4 
 at ??:?
#5 
 at ??:?
#6  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 
 at ??:?

Now I thought maybe the inlet and outlet have to be switched at patchMap to
Code:

patchMap        ( PIPE_INLET  PER_PIPE_OUTLET);
Is that true?
Anyway, mapFields runs, but ends with like thousands of errors of

Code:

--> FOAM Warning :
    From function void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea(const label, const label) const
    in file lnInclude/faceAreaWeightAMI.C at line 359
    Invalid normal for source face 4095 points 4((-0.12 0.0063269595 0.0071177674) (-0.12 0.006181312 0.0069427994) (-0.12 0.0066685889 0.0066685869) (-0.12 0.006821461 0.0068214589)) target face 3340 points 4((-0.12 0.0057598517 0.0072441288) (-0.12 0.0062788071 0.0070141595) (-0.12 0.0061003521 0.0067947793) (-0.12 0.0055910177 0.0069954464))
--> FOAM Warning :
    From function void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea(const label, const label) const
    in file lnInclude/faceAreaWeightAMI.C at line 359
    Invalid normal for source face 4095 points 4((-0.12 0.0063269595 0.0071177674) (-0.12 0.006181312 0.0069427994) (-0.12 0.0066685889 0.0066685869) (-0.12 0.006821461 0.0068214589)) target face 3379 points 4((-0.12 0.0062788071 0.0070141595) (-0.12 0.0067880424 0.0067880426) (-0.12 0.0066026062 0.0066026065) (-0.12 0.0061003521 0.0067947793))
    AMI: Patch source sum(weights) min/max/average = 0, 4.5175445, 0.76139568
    AMI: Patch target sum(weights) min/max/average = 0, 4.5097782, 0.71904745
    interpolating k


--> FOAM FATAL ERROR:
Attempt to cast type patch to type lduInterface

    From function refCast<To>(From&)
    in file /home/mertmann/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/typeInfo.H at line 114.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::lduInterface const& Foam::refCast<Foam::lduInterface const, Foam::fvPatch const>(Foam::fvPatch const&) at ??:?
#3  Foam::cyclicFvPatchField<double>::cyclicFvPatchField(Foam::cyclicFvPatchField<double> const&, Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&, Foam::fvPatchFieldMapper const&) at ??:?
#4  Foam::fvPatchField<double>::addpatchMapperConstructorToTable<Foam::cyclicFvPatchField<double> >::New(Foam::fvPatchField<double> const&, Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&, Foam::fvPatchFieldMapper const&) at ??:?
#5  Foam::fvPatchField<double>::New(Foam::fvPatchField<double> const&, Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&, Foam::fvPatchFieldMapper const&) at ??:?
#6 
 at ??:?
#7 
 at ??:?
#8 
 at ??:?
#9 
 at ??:?
#10 
 at ??:?
#11  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#12 
 at ??:?

Can anyone help me?

RodriguezFatz September 2, 2014 04:25

1 Attachment(s)
Ok, finally I could get it running, it was some mistake in the /0 folder of the target case. I don't get the final "FOAM FATAL ERROR" any longer, but the warnings remain:

Code:

--> FOAM Warning :
    From function void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea(const label, const label) const
    in file lnInclude/faceAreaWeightAMI.C at line 359
    Invalid normal for source face 4095 points 4((-0.12 0.0063269595 0.0071177674) (-0.12 0.006181312 0.0069427994) (-0.12 0.0066685889 0.0066685869) (-0.12 0.006821461 0.0068214589)) target face 3378 points 4((-0.12 0.0064409587 0.0072134975) (-0.12 0.0069565374 0.0069565377) (-0.12 0.0067880424 0.0067880426) (-0.12 0.0062788071 0.0070141595))
--> FOAM Warning :
    From function void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea(const label, const label) const
    in file lnInclude/faceAreaWeightAMI.C at line 359
    Invalid normal for source face 4095 points 4((-0.12 0.0063269595 0.0071177674) (-0.12 0.006181312 0.0069427994) (-0.12 0.0066685889 0.0066685869) (-0.12 0.006821461 0.0068214589)) target face 3340 points 4((-0.12 0.0057598517 0.0072441288) (-0.12 0.0062788071 0.0070141595) (-0.12 0.0061003521 0.0067947793) (-0.12 0.0055910177 0.0069954464))
--> FOAM Warning :
    From function void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea(const label, const label) const
    in file lnInclude/faceAreaWeightAMI.C at line 359
    Invalid normal for source face 4095 points 4((-0.12 0.0063269595 0.0071177674) (-0.12 0.006181312 0.0069427994) (-0.12 0.0066685889 0.0066685869) (-0.12 0.006821461 0.0068214589)) target face 3379 points 4((-0.12 0.0062788071 0.0070141595) (-0.12 0.0067880424 0.0067880426) (-0.12 0.0066026062 0.0066026065) (-0.12 0.0061003521 0.0067947793))
    AMI: Patch source sum(weights) min/max/average = 0, 4.5175445, 0.76139568
    AMI: Patch target sum(weights) min/max/average = 0, 4.5097782, 0.71904745
    interpolating k
    interpolating omega
    interpolating U

End

Having a look at the result in paraFOam shows the mess:
Attachment 33487

Does anyone know, what all these "--->FOAM Warning" with "Invalid normal for source face..." means?

RodriguezFatz September 2, 2014 10:19

1 Attachment(s)
Attachment 33494

I made a sketch of the setup. Maybe that helps.

RodriguezFatz September 3, 2014 05:10

Ok, to anyone who get's problems with mapFields: Check whether you installed openFoam 2.3.x. It has a new implementation of mapFields with tons of bugs. I installed 2.2.2 just for mapping. Now it works.

sharonyue November 20, 2014 13:07

Quote:

Originally Posted by RodriguezFatz (Post 508909)
Ok, to anyone who get's problems with mapFields: Check whether you installed openFoam 2.3.x. It has a new implementation of mapFields with tons of bugs. I installed 2.2.2 just for mapping. Now it works.

Hello,

I ues ICEM to generate the mesh, and I got the same error with yours. Then I tried with 22x, error again.

Im sure this is not about the field, its about the mesh. Then I tried neglect "-consistent", it works. I dont know why.~

Best,

allett02015 March 24, 2015 12:17

Hello Rodrigez. I try the same thing as you: first I run a simulation with cyclic boundary condiitons and than I want to map the solution to a new simultion. I got the error:

--> FOAM FATAL ERROR:
Attempt to cast type patch to type lduInterface

What did you do to solve your problem?

RodriguezFatz March 25, 2015 04:52

Michael, you probably forgot to change the cyclic face in the boundary file of from wall to patch after converting the mesh to openFoam...

allett02015 March 27, 2015 09:29

Hello Phillpp

ok. now I got it almost running if I change the boundary conditions in the cyclic case to e.g. zero gradient. but in the mapped case the zeroGradient bounardy conditions still rimains. Instead I want a noniniform List.

Have you a hint to achieve this?

RodriguezFatz March 30, 2015 02:29

Quote:

Originally Posted by allett02015 (Post 538564)
but in the mapped case the zeroGradient bounardy conditions still rimains. Instead I want a noniniform List.

Actually I don't understand what you are trying to do.

allett02015 March 30, 2015 05:41

Actually, I have a 2D channel where I impose a constant pressure gradient as source term. In order to get the homogeous solution, I have cyclic boundary conditions in streamwise direction.

After i get a converged solution for this problem, I have a second channel with the same inlet mesh as my periodic problem. For the second channel I want to apply a zero Gradient boundary condition at the outlet.

Now I try the map somehow the solution of the periodic problem to the inlet of my channel where I want to apply the zeroGradient condition at the outlet.

I think it is quite the same problem as you had.

RodriguezFatz March 30, 2015 06:11

Ok, now I got it.
Did you do what I wrote in the first posts?
What goes wrong?

allett02015 March 31, 2015 03:53

I don't know exactly what is going wrong.

I had to change the cyclic condition in the blockMeshdict to type patch and also the boundary conditions in the fields (U, p, T etc. ) of my periodic simulation from cyclic to somethion to for example to zeroGradient.

Then the mapField application worked. But unfortunately the application did not write a nonuniform list in my inflow condition.

Now I solved it by using the results of the sample application as inflow condition

RodriguezFatz March 31, 2015 04:10

If mappedField run successfully, it overwrites the files in the \0 folder. If you want, you can post the terminal output of your commands and we can try to find the error.

allett02015 March 31, 2015 05:04

Create databases as time
Case : ../kepsilon_periodic_q10_map
nProcs : 1
Source time: 200000
Target time: 200000
Create meshes
Source mesh size: 120 Target mesh size: 1200

Creating and mapping fields for time 200000
Creating mesh-to-mesh addressing for region0 and region0 regions using cellVolumeWeight
Overlap volume: 400000
Creating AMI between source patch IN and target patch IN using faceAreaWeightAMI
AMI: Creating addressing and weights between 40 source faces and 40 target faces
AMI: Patch source sum(weights) min/max/average = 1, 1, 1
AMI: Patch target sum(weights) min/max/average = 1, 1, 1
interpolating alphat
interpolating nut
interpolating Pk
interpolating p_rgh
interpolating p
interpolating T
interpolating k
interpolating epsilon
interpolating B
interpolating U
interpolating GradT
End

RodriguezFatz March 31, 2015 05:12

So this did non change the boundary values in your 200000 folder? How did you check that?
What kind of boundary is this inlet? Interpolating both pressure and velocity makes mostly no sense... you need to delete all files from the source folder except the ones you want to interpolate...

FerdiFuchs May 20, 2015 12:17

I had similar problems.

using mapFields of 2.2.2 instead of 2.3.x works wonderfull!!!

Scram_1 July 13, 2019 20:42

Hi Phillip,
I'm facing a similar problem with trying to get the outlet of the first part as my inlet for the second part. The mapFields utility works. The problem is that the pressure field remains 0 because the bc for pressure is uniform zero at the outlet of the first part. This creates a problem while running the second part as I don't get a smooth transition of flow from the first to the second part. What Bcs for u and p did you use at the outlet of the first part?

Thanks!

Best,
Scram


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