|
[Sponsors] |
December 4, 2008, 11:50 |
Hi,
I still got problems re
|
#21 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
Hi,
I still got problems related to pTraits : I tried to modify my code in order to export other variables than U (k and p for instance). This expression will compile: AverageIOField<vector> writeSampleU ( IOobject ( "U", mesh.time().constant(), "boundaryData/entree"/runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), U[0], combinedVecU ); But, as soon as I want to insert this one: AverageIOField<scalar> writeSampleP ( IOobject ( "p", mesh.time().constant(), "boundaryData/entree"/runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), p[0], combinedScaP ); I get a nice: /home/flurec/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude/AverageIOField.C: In constructor 'Foam::AverageIOField<type>::AverageIOField(const Foam::IOobject&, const Type&, const Foam::Field<type>&) [with Type = double]': writeSampleP.H:39: instantiated from here /home/flurec/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude/AverageIOField.C:7 3: error: no matching function for call to 'Foam::pTraits<double>::pTraits(const double&)' /home/flurec/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Scalar.H:68: note: candidates are: Foam::pTraits<double>::pTraits(Foam::Istream&) /home/flurec/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Scalar.H:41: note: Foam::pTraits<double>::pTraits(const Foam::pTraits<double>&) writeSampleP.H:39: instantiated from here /home/flurec/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude/AverageIOField.C:7 7: error: invalid static_cast from type 'Foam::AverageIOField<double>' to type 'double&' From my understanding of template specialization, in Scalar.H:68, when the template pTraits is specialized for scalars, its only constructor is pTraits(Istream& is) Therefore, the general constructor from primitive: pTraits(const primitive& p) : primitive(p) {} which has been added in this forum thread is not available. Should I modify Scalar.H and Scalar.C to get my code to compile ? adding to Scalar.H : pTraits(const primitive& p); adding to Scalar.C : pTraits<scalar>::pTraits(const primitive& p) { p_ = p; } |
|
April 2, 2010, 13:07 |
|
#22 |
Senior Member
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 17 |
Dear Mattijs and John Deas,
Do you have some common on how to use TimeVaryingMappedFixedValue boundary condition ? I have two questions: 1.what's the meaning of Average in its input data ? FoamFile { version 2.0; format ascii; class vectorAverageField; object values; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Average ( 0 0 0 ) // // Data on points 70 ( //minz (5.74803 0 0) (5.74803 0 0) 2. Because the most useful things of this boundary condition is to read a large series of data from file as inlet condition. But its request data is a little strange, how we can generate this kind of data ? Maybe I can get these data from functionObject surface sampling using pre-simulation. But the sampling data is a little difference from TimeVaryingMappedFixedValue data format, and the sampling result have more folders, so how can do this ? If we have utility to convert sample data to request data format ? Thank you very much. |
|
April 2, 2010, 13:10 |
|
#23 |
Senior Member
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 17 |
This is request data format for timeVaryingMappedFixedValue :
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | | \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class vectorAverageField; object values; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Average ( 0 0 0 ) // // Data on points 70 ( //minz (5.74803 0 0) (5.74803 0 0) (11.3009 0 0) (13.4518 0 0) .,................. ) This is sampling data format : 15408 ( (0.0239436 -6.28249e-05 0.000567144) (0.0239436 -6.28249e-05 0.000567144) (0.0712944 -0.00019323 -0.00045317) (0.0712944 -0.00019323 -0.00045317) (0.122301 -0.000335644 -0.00117908) (0.122301 -0.000335644 -0.00117908) (0.178985 -0.000485735 -0.000847965) (0.178985 -0.000485735 -0.000847965) .................................................. .... ) |
|
October 13, 2015, 07:33 |
|
#24 | |
Senior Member
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18 |
Quote:
I have encountered a very similar problem. I have included the following code within pimpleFoam to write U field at inlet, at each time step to be used later through TimeVaryingMappedFixedValue bc. Code:
AverageIOField<vector> U2 ( IOobject ( "U", mesh.time().timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), U.boundaryField()[ patchID ] ); U2.write(); Code:
MypimpleFoam.C: In function ‘int main(int, char**)’: MypimpleFoam.C:97:4: error: ‘AverageIOField’ was not declared in this scope AverageIOField<vector> U2 ^ MypimpleFoam.C:97:25: error: expected primary-expression before ‘>’ token AverageIOField<vector> U2 ^ MypimpleFoam.C:108:1: error: ‘U2’ was not declared in this scope ); ^ make: *** [Make/linux64GccDPOpt/MypimpleFoam.o] Error 1 Thanks, Syavash |
||
June 14, 2021, 15:56 |
Problem with TimeVaryingMappedFixedValue
|
#25 |
New Member
Pilar
Join Date: Jan 2021
Posts: 4
Rep Power: 5 |
I am using a boundary condition for the displacement U called TimeVaryingMappedFixedValue. The definition of this BC is:
"This is a derived traction boundary which reads the time and spatial varying force data (from pressure p and/or stresses S) and computes the traction load and compatible displacement gradient boundary. This boundary condition is derived from tractionDisplacement + timeVary-ingMappedFixedValue in OpenFOAM. (Li et al. 2020)" When I get the results for each time, this boundary condition does not do like other boundary conditions that store the list of data in the defined patch. In fact, when I look at one of the files and search for the patch where I have imposed that B.C there is no data (it is at the top). The thing is that in Paraview if it represents them to me and it represents them just in that patch. My doubts are: 1) why does this happen and why Paraview allows to draw it? 2) When I make the sampleDict (and execute sample) none of the interpolation options let me get the data of U, since it looks for the patch and does not find it. Any idea what I can extract those data from Thank you very much in advance for your help. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
TimeVaryingMappedFixedValue | irishdave | OpenFOAM Running, Solving & CFD | 32 | June 16, 2021 07:55 |
TimeVaryingMappedFixedValue best practice to extract subset points and fields | podallaire | OpenFOAM Running, Solving & CFD | 6 | May 21, 2014 11:25 |
TimeVaryingMappedFixedValue | sunnysun | OpenFOAM Running, Solving & CFD | 12 | October 30, 2013 16:22 |
Possible bug with timeVaryingMappedFixedValue | jerome | OpenFOAM Bugs | 2 | October 9, 2007 10:38 |
Putting submesh field values into field on parent mesh | helmut | OpenFOAM Running, Solving & CFD | 2 | June 20, 2006 08:31 |