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

mapFields functionObjects between two different cases

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 2, 2020, 05:51
Post mapFields functionObjects between two different cases
  #1
New Member
 
Thomas
Join Date: Jul 2018
Posts: 16
Rep Power: 8
Roxxor91 is on a distinguished road
Hello Foamers.

I am running pimpleFoam on a domain composed of an unmeshed box (called box) surrounded by 6 patches (namely inlet, outlet, top, bottom, emptyFaces). I have access to the pressure field on the patch as a surfaceScalarField on the box patch.

I am also running an in-house OpenFOAM solid solver on a box domain (also called box) that has the same cartesian coordinates than the box in the first case. I want to map the pressure field from the first case to that second case.

As a first attempt, I wrote a coded functionObject that writes the pressure values on the box patch of the first case (it is a surfaceScalarField even if it is saved as a simple scalarField). The problem is the box patch from the first case has a different number of points than the box patch from the second case, and most likely the points are organised in a different way.

Code:
                                label patchID = mesh().boundaryMesh().findPatchID("box");

                                IOField<scalar> pOut
                                (
                                        IOobject
                                        (
                                                "pBox",
                                                mesh().time().timeName(),
                                                mesh(),
                                                IOobject::NO_READ,
                                                IOobject::NO_WRITE
                                        ),
                                        p.boundaryField()[ patchID ]
                                );
So my second idea is to use mapFields to perform a non-consistent mapping. The dictionnary system/mapFieldsDict looks like this
Code:
/*--------------------------------*- C++ -*----------------------------------*\
=========                 |
\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 \\    /   O peration     | Website:  https://openfoam.org
  \\  /    A nd           | Version:  7
   \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
version     2.0;
format      ascii;
class       dictionary;
location    "system";
object      mapFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

patchMap        ( box box);

cuttingPatches  ();


// ************************************************************************* //
and I use the command

Code:
mapFields ../Fluid -case . -sourceTime 0.1
The log file is

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Source: "/mnt/datasim/OpenFOAM/solvers/test" "Fluid"
Target: "/mnt/datasim/OpenFOAM/solvers/test" "Solid"

Create databases as time

Source time: 0.1
Target time: 0.25
Create meshes

Source mesh size: 2400  Target mesh size: 300


Mapping fields for time 0.1

    interpolating p

End
and when I look at the directory 0.1/ I can see that no new p field has been created. Moreover I noticed that the source time is not the target time.

HTML Code:
Note: For testing purpose, I made both cases run until 0.25 which is probably my target is 0.25. It is not my main concern at the moment because eventually, I want to perform this mapping at every (written) timestep.
Do you have an idea on how to properly use mapFields ?

EDIT: I use OpenFOAM-6 on Debian.
Roxxor91 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
running mapFields in parallel mkhm OpenFOAM Pre-Processing 10 September 16, 2021 14:12
Personalization of mapFields and libsampling - Compilation issues saimat OpenFOAM Programming & Development 3 June 29, 2016 09:56
Strange random behaviour of mapFields blaise OpenFOAM Pre-Processing 0 November 3, 2014 10:37
How to speed up the simulation of a large amount of similar steady state cases tss Main CFD Forum 4 November 5, 2010 15:36
Variable deltaT and functionObjects henrik OpenFOAM Bugs 8 July 22, 2009 05:11


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