|
[Sponsors] |
January 9, 2008, 16:21 |
Hi,
I would like to output
|
#1 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
Hi,
I would like to output fields that will serve as inputs for a timeVaryingMappedFixedValue patch. I will have to write all the files in the constant/boundaryData/inlet folder (points and speed) using the field of cyclic patch. I would have liked to know if someone already did this (and can give some direction on how to retrieve fields at boundaries), and if the numbering will be consistent between all files (i.e. are the faces automatically crawled with the same order across the patch for all field and the position). Thanks, J.D. |
|
January 10, 2008, 05:53 |
Get patchfield of e.g. p goes
|
#2 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
Get patchfield of e.g. p goes something like
label patchI = mesh.boundaryMesh().findPatchID("myCyclicPatch"); Info<< "patchField is " << p.boundaryField()[patchI] << endl; The timeVaryingMappedFixedValue does a triangulation of the points and interpolation so ordering does not matter. Search for boundaryField on this forum or the Wiki and you'll find more info. |
|
January 10, 2008, 06:28 |
It is not the order during rea
|
#3 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
It is not the order during reading that worried me, but the order when writing the boundaryData files. I wanted to know if 14th value of U would always be assigned to the 14th point in "points" for example.
|
|
January 10, 2008, 17:39 |
Yes. The interpolation factors
|
#4 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
Yes. The interpolation factors (nearestVertex_, nearestVertexWeight_) are calculated once and then the interpolation always proceeds in the same order.
timeVaryingMappedFixedValueFvPatchField.C line 630. |
|
January 14, 2008, 06:44 |
Hi,
I tried to use an IOobj
|
#5 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
Hi,
I tried to use an IOobject to store the velocity field contained in one of my periodic boundary condition to create the field at each timestep, as future input fields for another calculation, which will use a timeVaryingMappedFixedValue patch as the rest of this thread suggests. Based on the way the lambda2 field is written at each timestep in lambda2.c, I added the following code to my solver (a modification of icoFoam) : word inletPatchName = "cyclic"; vectorField UBoundField ( IOobject ( "UBoundField", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), U.boundaryField()[patchID] ); The compilation gave me the following error : sandFoam.C:159: error: no matching function for call to 'Foam::Field<foam::vector<double> >::Field(Foam::IOobject, Foam::fvPatchField<foam::vector<double> >&)' /home/vinz/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/Field.C:197: note: candidates are: Foam::Field<type>::Field(const Foam::word&, const Foam::dictionary&, Foam::label) [with Type = Foam::Vector<double>] ... and a list of other constructors I understand that I am not calling the vectorField constructor using the good types. U being of type volVectorField, U.boundaryField is of type "reference to GeometricBoundaryField". In the original IOobject in lambda2.c, one can read : volScalarField Lambda2 ( IOobject ( "Lambda2", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), -eigenValues(SSplusWW)().component(vector::Y) ); A look at the Doxygen documentation teaches that: eigenValues() is of type dimensionedVector and as such -eigenValues(SSplusWW)().component(vector::Y) is of type dimensionedScalar. My question is, how can I write the my IOobject for the velocity at the boundary to fill the IOobject with a dimensionedVector instead of U.boundaryField()[patchID] ? I hint that a local value as to be given (a vector or a scalar) which will be crawled on the domain specified to create a field (in the lambda2 example the domain would be 'mesh', which is of type FOAM::fvMesh). If this is the case, how can I create a domain (in the form of a mesh) that just contains my boundary condition, so as to call something which would look like word inletPatchName = "cyclic"; vectorField UBoundField ( IOobject ( "UBoundField", runTime.timeName(), !!! boundarycondition domain !!!, IOobject::NO_READ, IOobject::NO_WRITE ), !!! local value of U !!! ); Thank you for you help, J.D. |
|
January 14, 2008, 06:51 |
"I hint that a local value as
|
#6 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
"I hint that a local value as to be given (a vector or a scalar) which will be crawled on the domain specified to create a field (in the lambda2 example the domain would be 'mesh', which is of type FOAM::fvMesh)."
This makes no sense... It is a field which is provided. |
|
January 15, 2008, 09:05 |
I looked into timeVaryingMappe
|
#7 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
I looked into timeVaryingMappedFixedValueFvPatchField.C to understand how the patch reads its input fields to mimic its behaviour and be able to write those fields.
For the points, a pointIOField is created: pointIOField samplePoints ( IOobject ( "points", this->db().time().constant(), "boundaryData"/this->patch().name(), this->db(), IOobject::MUST_READ, IOobject::AUTO_WRITE, false ) ); There, this->db() refers to the objectRegistry of the timeVaryingMappedFixedValueFvPatchField that is instanciated, right ? Given the name of a patch with inletPatchName = "cyclic" , how can I get its objectRegistry, to create an IOobject and output the values at boundary ? Any help appreciated, even if just to point on how objectRegistry works... I am getting stuck on this problem... Thanks, J.D. |
|
January 15, 2008, 13:57 |
The objectRegistry (this->db()
|
#8 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
The objectRegistry (this->db()) is the polyMesh i.e. 'mesh' in your top-level application.
db.time() is the Time object, i.e. 'runTime' in your top-level application. Create a pointIOField (in two steps for clarity reasons), fill it and write it. IOobject io ( "points", runTime.constant(), "boundaryData"/"cyclic", mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ); pointIOField samplePoints(io, 100); samplePoints[0] = 0.0; .. samplePoints[99] = 0.0; samplePoints.write(); This is the simplistic use of ioobject. With different settings it allow you to - register the object on the polyMesh - so as to have automatic writing Have a look at how e.g. volXXXfields are created. |
|
January 16, 2008, 09:24 |
I rewrote your example as :
|
#9 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
I rewrote your example as :
IOobject io ( "points", runTime.constant()/"boundaryData"/"cyclic", mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ); pointIOField samplePoints(io, 2); samplePoints[0] = 0.0; samplePoints[1] = 0.0; samplePoints.write(); and get the following error: sandFoam.C:174: error: no match for 'operator=' in 'samplePoints.Foam::IOField<foam::vector<double> >::<anonymous>.Foam::Field<foam::vector<double> >::<anonymous>.Foam::List<foam::vector<double> >::<anonymous>.Foam::UList<t>::operator[] [with T = Foam::Vector<double>](0) = 0.0' /home/vinz/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/Vector.H:62: note: candidates are: Foam::Vector<double>& Foam::Vector<double>::operator=(const Foam::Vector<double>&) I also do not understand how to create fields that exist on a subpart of the mesh and with wich I would like to use IOobject (my boundaries). My problem is very similar to this one: http://www.cfd-online.com/OpenFOAM_D...tml?1113927929 in the sense that I would not like to code loops and generate boundaryData files myself, but use the OF librairies. I do not know if I am really clear in what I want to do |
|
January 17, 2008, 16:45 |
My example was incorrect - jus
|
#10 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
My example was incorrect - just typed it in. samplePoints is an array of points so you can't assign e.g 0.0 to it. Instead
samplePoints[0] = point(0,0,0); |
|
January 18, 2008, 05:48 |
Hi all,
I wrote a simple sc
|
#11 |
New Member
Lourens Aanen
Join Date: Mar 2009
Posts: 16
Rep Power: 17 |
Hi all,
I wrote a simple script (using awk) to convert time series resulting from probes as defined in controlDict to the input for the TimeVaryingMappedFixedValue function. For the moment I hardcoded the variables to convert in the script. It creates a directory BoundaryData, in which the directories for the different times are located. It reads the data from the directory "starttime" in "probes" where starttime has to be specified inthe commandline (probesToTimes root case starttime). I hope it is usefull for somebody. ProbesToTimes Regards, Lourens |
|
May 22, 2008, 12:02 |
Hi, if I create an AverageIOFi
|
#12 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
Hi, if I create an AverageIOField this way:
AverageIOField<vector> writeU ( IOobject ( "values", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), vector(0.1,0,0), // dummy vector for average value U.boundaryField()[outletName] ); I get the following compilation error: /home/flurec/commun/OpenFOAM/1.4.1-dev/OpenFOAM-1.4.1-dev/src/finiteVolume/lnInc lude/AverageIOField.C: In constructor 'Foam::AverageIOField<type>::AverageIOField(const Foam::IOobject&, const Type&, const Foam::Field<type>&) [with Type = Foam::Vector<double>]': dpIcoFoamAdimWrite.C:84: instantiated from here /home/flurec/commun/OpenFOAM/1.4.1-dev/OpenFOAM-1.4.1-dev/src/finiteVolume/lnInc lude/AverageIOField.C:73: error: no matching function for call to 'Foam::pTraits<foam::vector<double> >::pTraits(const Foam::Vector<double>&)' /home/flurec/commun/OpenFOAM/1.4.1-dev/OpenFOAM-1.4.1-dev/src/OpenFOAM/lnInclude /pTraits.H:56: note: candidates are: Foam::pTraits<primitive>::pTraits(Foam::Istream&) [with primitive = Foam::Vector<double>] /home/flurec/commun/OpenFOAM/1.4.1-dev/OpenFOAM-1.4.1-dev/src/OpenFOAM/lnInclude /pTraits.H:52: note: Foam::pTraits<foam::vector<double> >::pTraits(const Foam::pTraits<foam::vector<double> >&) make: *** [Make/linuxGccDPOpt/dpIcoFoamAdimWrite.o] Erreur 1 I am not quit sure how to modify this to get it to work with vectors. |
|
May 28, 2008, 10:34 |
And, if I use
AverageIOFiel
|
#13 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
And, if I use
AverageIOField writeFlds ( IOobject ( "cutPlaneU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), vector(0.66666666,0,0), vectorFlds[i].internalField() ); I get this error : icoFoamWrite.C:149: error: missing template arguments before 'writeFlds' |
|
May 28, 2008, 10:50 |
AverageIOField
|
#14 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
AverageIOField<vector>
... |
|
May 28, 2008, 10:52 |
... Which gives me the error m
|
#15 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
... Which gives me the error mentioned one post above
|
|
May 28, 2008, 11:39 |
looking the the pTraits.H file
|
#16 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
looking the the pTraits.H file I only
see an Istream constructor pTraits(Istream& is) : primitive(is) {} so I think that's why it wont work with vector(0.6.....) I dont know how to solve this, but looking at the various constructors this worked (although I dont know if thats an acceptable solution) AverageIOField<vector> writeU ( IOobject ( "values", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ) ); |
|
May 29, 2008, 07:45 |
I modified it, and tried to wm
|
#18 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
I modified it, and tried to wmake src/OpenFOAM. There are no problem related to pTraits. All the intermediary .o are correctly built. However, when it comes to linking everything, I get:
g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -DWM_PROJECT_VERSION='"'1.4.1'"' -I/home/vinz/OpenFOAM/OpenFOAM-1.4.1/src/zlib-1.2.1 -IlnInclude -I. -I/home/vinz/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread Make/linuxGccDPOpt/sigFpe.o Make/linuxGccDPOpt/sigSegv.o Make/linuxGccDPOpt/sigInt.o [...] Make/linuxGccDPOpt/MeshWaveName.o Make/linuxGccDPOpt/FaceCellWaveName.o Make/linuxGccDPOpt/curve.o Make/linuxGccDPOpt/graph.o Make/linuxGccDPOpt/rawGraph.o Make/linuxGccDPOpt/gnuplotGraph.o Make/linuxGccDPOpt/xmgrGraph.o Make/linuxGccDPOpt/jplotGraph.o -L/home/vinz/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt \ -lOpenFOAM -ldl -lm -o OpenFOAM.out /usr/lib/crt1.o: In function `_start': (.text+0x18): undefined reference to `main' collect2: ld returned 1 exit status make: *** [OpenFOAM.out] Error 1 Sorry if I abuse readers time, but I am completely lost at this point... JD |
|
May 29, 2008, 08:03 |
wmake is for compiling applica
|
#19 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
wmake is for compiling applications.
use wmake libso |
|
May 29, 2008, 08:11 |
thank you
|
#20 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
thank you
|
|
|
|
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 |