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

timeVaryingMappedFixedValue not working without headers!

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 12, 2018, 11:38
Smile timeVaryingMappedFixedValue not working without headers!
  #1
New Member
 
Peter Ladefoged
Join Date: Jun 2018
Posts: 2
Rep Power: 0
PeterL89 is on a distinguished road
Dear all foamers,


I am trying to surface sample the seabed pressure beneath regular progressive waves and imposing this pressure data to a new domain where a constitutive soil model is solving Biots equations for pore pressure development.

I use the surface sampling utility to map the seabed pressures in the wave model as such:

Code:
functions
{
    surfaces1
    {
        type                    surfaces;
        functionObjectLibs              ("libsampling.so");
        writeControl            adjustableRunTime;
        writeInterval           1;
    enabled             true;
        surfaceFormat           boundaryData;
        fields
        (
               p_rgh
           p
        );
        interpolationScheme cellPointFace;
        surfaces
        (
            inlet
            {
                type        patch;
                patches     (bottom);
                triangulate false;
            }
        );
    }
}
And that seems to be working fine. I copy my files to my soil folder into /constant/boundaryData/top/... When I try to run OpenFOAM complains that no header is given in the boundaryData files:

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM Extend Project: Open source CFD        |
|  \\    /   O peration     | Version:  1.6-ext                               |
|   \\  /    A nd           | Web:      www.extend-project.de                 |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 1.6-ext-f3027b3161e4
Exec   : twoSurfacePlastBiotFoam
Date   : Oct 12 2018
Time   : 17:35:49
Host   : n-62-27-21
PID    : 1191
Case   : /work3/s123098/soil_waveFlume_test_2
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

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

Create mesh for time = 0

Reading soil properties

Reading pore pressure field

--> FOAM Serious Error : 
    From function IOobject::readHeader(Istream&)
    in file db/IOobject/IOobjectReadHeader.C at line 90
    Reading "/work3/s123098/soil_waveFlume_test_2/constant/boundaryData/top/0/p" at line 2
    First token could not be read or is not the keyword 'FoamFile'

Check header is of the form:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM Extend Project: Open source CFD        |
|  \\    /   O peration     | Version:  1.6-ext                               |
|   \\  /    A nd           | Web:      www.extend-project.de                 |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       scalarAverageField;
    location    "constant/boundaryData/top/0";
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //



--> FOAM FATAL IO ERROR: 
problem while reading header for object p

file: /work3/s123098/soil_waveFlume_test_2/constant/boundaryData/top/0/p at line 2.

    From function regIOobject::readStream()
    in file db/regIOobject/regIOobjectRead.C at line 70.

FOAM exiting
Now I am using OpenFOAM v1712 with waves2foam for the generating waves, while using OpenFOAM-1.6-ext for the soil model (as it was developed for this), but untill now I haven't had any problems with compatibility.

Anybody has any idea how to generate output files from surface sampling with appropriate headers, without having to do this manually or set up a script?

Best Regards
Peter

Last edited by wyldckat; October 14, 2018 at 08:35. Reason: Added [CODE][/CODE] markers
PeterL89 is offline   Reply With Quote

Old   October 14, 2018, 08:42
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: I haven't checked, but perhaps this is already fixed in foam-extend 4.0, so if perhaps the code you have in 1.6-ext were to build with foam-extend 4.0, it may solve this issue.


If not, then a possible workaround is that you rely on file inclusion instead:
  1. Rename the file you have with the actual data, e.g.:
    Code:
    mv constant/boundaryData/top/0/p constant/boundaryData/top/0/p.data
  2. Then create the file that will act as the wrapper, for example, place the following inside a new file "constant/boundaryData/top/0/p":
    Code:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM Extend Project: Open Source CFD        |
    |  \\    /   O peration     | Version:  1.6-ext                               |
    |   \\  /    A nd           | Web:      www.extend-project.de                 |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       scalarAverageField;
        object      values;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    #include "p.data"
  3. The header is generic enough, and the last line will include the complete content of the original file that is now named "p.data". Therefore, you can copy-paste-adapt this file "p" for any other files, such as "p_rgh", but don't forget to first rename the data files first.
__________________
wyldckat is offline   Reply With Quote

Old   August 1, 2021, 07:27
Default
  #3
Senior Member
 
kimy
Join Date: Mar 2019
Location: https://t.me/pump_upp
Posts: 164
Rep Power: 7
qi.yang@polimi.it is on a distinguished road
Send a message via ICQ to qi.yang@polimi.it Send a message via AIM to qi.yang@polimi.it Send a message via Yahoo to qi.yang@polimi.it
Quote:
Originally Posted by wyldckat View Post
Quick answer: I haven't checked, but perhaps this is already fixed in foam-extend 4.0, so if perhaps the code you have in 1.6-ext were to build with foam-extend 4.0, it may solve this issue.


If not, then a possible workaround is that you rely on file inclusion instead:
  1. Rename the file you have with the actual data, e.g.:
    Code:
    mv constant/boundaryData/top/0/p constant/boundaryData/top/0/p.data
  2. Then create the file that will act as the wrapper, for example, place the following inside a new file "constant/boundaryData/top/0/p":
    Code:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM Extend Project: Open Source CFD        |
    |  \\    /   O peration     | Version:  1.6-ext                               |
    |   \\  /    A nd           | Web:      www.extend-project.de                 |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       scalarAverageField;
        object      values;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    #include "p.data"
  3. The header is generic enough, and the last line will include the complete content of the original file that is now named "p.data". Therefore, you can copy-paste-adapt this file "p" for any other files, such as "p_rgh", but don't forget to first rename the data files first.

Hi, I met the following error
Code:
--> FOAM FATAL IO ERROR:
incorrect first token, expected <int> or '(', found on line 21 the word '#include'

file: /gpfs/work1/pMI21_CivGh/kimy/solids4Foam/poroelasticity/Jengseabed/constant/boundaryData/top/40/p at line 21.

    From function Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::List<T>&) [with T = double]
    in file /cineca/prod/build/applications/openfoam-ext/4.1/openmpi--1.10.7--gnu--4.9.2/BA_WORK/foam/foam-4.1/src/foam/lnInclude/ListIO.C at line 148.
, according to your suggestion.
qi.yang@polimi.it is offline   Reply With Quote

Old   September 8, 2021, 06:55
Default
  #4
New Member
 
Justyna Salachna
Join Date: Dec 2019
Posts: 10
Rep Power: 6
salachnaj is on a distinguished road
Quote:
Originally Posted by qi.yang@polimi.it View Post
Hi, I met the following error
Code:
--> FOAM FATAL IO ERROR:
incorrect first token, expected <int> or '(', found on line 21 the word '#include'

file: /gpfs/work1/pMI21_CivGh/kimy/solids4Foam/poroelasticity/Jengseabed/constant/boundaryData/top/40/p at line 21.

    From function Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::List<T>&) [with T = double]
    in file /cineca/prod/build/applications/openfoam-ext/4.1/openmpi--1.10.7--gnu--4.9.2/BA_WORK/foam/foam-4.1/src/foam/lnInclude/ListIO.C at line 148.
, according to your suggestion.
Hi. Same problem here. Did you solve the problem?
salachnaj is offline   Reply With Quote

Old   September 9, 2021, 03:11
Default
  #5
Senior Member
 
kimy
Join Date: Mar 2019
Location: https://t.me/pump_upp
Posts: 164
Rep Power: 7
qi.yang@polimi.it is on a distinguished road
Send a message via ICQ to qi.yang@polimi.it Send a message via AIM to qi.yang@polimi.it Send a message via Yahoo to qi.yang@polimi.it
Quote:
Originally Posted by salachnaj View Post
Hi. Same problem here. Did you solve the problem?
Hi, I solved the problem but there is no way to simplify the procedure. You can only add the header one by one through Matlab or another programming.
qi.yang@polimi.it is offline   Reply With Quote

Old   September 15, 2021, 05:45
Default
  #6
Senior Member
 
kimy
Join Date: Mar 2019
Location: https://t.me/pump_upp
Posts: 164
Rep Power: 7
qi.yang@polimi.it is on a distinguished road
Send a message via ICQ to qi.yang@polimi.it Send a message via AIM to qi.yang@polimi.it Send a message via Yahoo to qi.yang@polimi.it
Quote:
Originally Posted by salachnaj View Post
Hi. Same problem here. Did you solve the problem?
Hi, I found there is a way to solve this problem by executing the following script directly. But what I need is p_rgh-constant. Can I simply add something here?
Code:
patchname='ground'
newpatchname='top'
variableFoldername=patch_$patchname
variablename='p_rgh'
variaWriteName='p'

for d in ./postProcessing/toppressuredata/surface/* 
do

mkdir -p ./constant/boundaryData/$newpatchname/$d/
#Write the default headline contents into the files
echo 'FoamFile
{
    version     2.0;
    format      ascii;
    class       scalarAverageField;
    object      values;
}
// **********************************************************************//
0.0' > ./constant/boundaryData/$newpatchname/$d/$variaWriteName

#copy values from /surface folder to /boundaryData folder
cat  ./postProcessing/toppressuredata/surface/$d/$variableFoldername/scalarField/$variablename >> ./constant/boundaryData/$newpatchname/$d/$variaWriteName

done


#Transfer the format of the corresponding 'points' file
echo 'FoamFile
{
    version 2.0;
    format  ascii;
    class   vectorField;
    object  points;
}
// ******************************************************************************************//
'  > ./constant/boundaryData/$patchname/points
cat  ./postProcessing/toppressuredata/surface/$d/$variableFoldername/points >> ./constant/boundaryData/$newpatchname/points

#Transfer the format of the corresponding 'faces' file
echo 'FoamFile
{
    version 2.0;
    format  ascii;
    class   faceList;
    object  faces;
}
// ******************************************************************************************//
' > ./constant/boundaryData/$patchname/faces
cat  ./postProcessing/toppressuredata/surface/$d/$variableFoldername/faces >> ./constant/boundaryData/$newpatchname/faces
qi.yang@polimi.it is offline   Reply With Quote

Reply

Tags
coupling 2 solvers, headers, surface sampling, timevaryingmappedfixedval


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
findCell() in parallel: not working if location is outside the domain TobiWol OpenFOAM 0 January 10, 2018 14:33
Processor 0 not working vishwesh OpenFOAM Running, Solving & CFD 0 November 17, 2017 03:35
corrupt headers in sampled data output KTG OpenFOAM Post-Processing 1 July 29, 2017 17:01
DPM parallel is not working but serial is working johnwinter FLUENT 1 March 27, 2012 02:01
Working directory mgonzalo FLUENT 1 November 11, 2011 10:05


All times are GMT -4. The time now is 05:18.