Give the file the proper header for being used as TimeVaryingMappedFixedValue input
Hi Foamers,
In the file foamFileSurfaceWriter.C in "src/sampling/sampledSurface/writers/foamFile" , I can see the following line Code:
// values I want to feed these time series into another simulation as boundary condition using TimeVaryingMappedFixedValue BC. But this BC demands for input files with headers. Unfortunately, it is not possible to add header to each file manually, because the number is huge! I have tried something like the following code to add the proper header, but without success: Code:
vectorAverageField values Code:
SOURCE=sampledSurface/writers/foamFile/foamFileSurfaceWriter.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/meshTools/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/surfMesh/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/fileFormats/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/triSurface/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/conversion/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OpenFOAM/lnInclude -I/home/syavash/OpenFOAM/OpenFOAM-2.3.1/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/foamFileSurfaceWriter.o Thanks, Syavash |
Anyone who might be interested?? This is a real problem for me since I need inlet velocity at each time step to be saved and used as boundary condition for another LES simulation!
I also checked sample utility but it similarly only saves values and generates no header! TimeVaryingMappedFixedValue demands a header for velocity like this: Code:
/*--------------------------------*- C++ -*----------------------------------*\ Thanks, Syavash |
Anyone who might be interested?? This is a real problem for me since I need inlet velocity at each time step to be saved and used as boundary condition for another LES simulation!
I also checked sample utility but it similarly only saves values and generates no header! TimeVaryingMappedFixedValue demands a header for velocity like this: [CODE] Code:
/*--------------------------------*- C++ -*----------------------------------*\ Thanks, Syavash |
No one can help me??!:(
I am really stuck in this! |
Dear Syavash,
I also met similar problem before, and I have written a matlab script to add the head to the sampled file. Suppose your sampleDict reads like this: Code:
/*--------------------------------*- C++ -*----------------------------------*\ Here is the matlab script that I used to add the header and to move the required files directly under the timestep folder. Code:
num_time = 9; % Total number of timestep folders Hope this helps. Best, Likun |
Quote:
Dear Likun, Thank you for sharing your solution. :) Unfortunately, Matlab could not recognize 'cp' and 'rm' commands in your scrip! But I am aware that this is an issue with the version installed on my PC! I could find a workaround. I could make the solver (pimpleFoam) to write the sampled plane (inlet bc) at each time steps. In this way, OpenFoam automatically generates a header with class vectorField just like the following: Code:
/*--------------------------------*- C++ -*----------------------------------*\ Code:
find ./ -type f -readable -writable -exec sed -i '0,/vectorField/s/vectorField/vectorAverageField/' {} \; Code:
find ./ -type f -readable -writable -exec sed -i '0,/960/s/960/(0 0 0) 960/' {} \; Regards, Syavash |
Quote:
If you got this to work, do you think it would be possible to run both simulations simultaneously? So the 'inlet' BC reads the 'outlet' BC while the solver is running? |
The IOobject class has the member functions writeHeader and readHeader that write the appropriate headers to streams. Since files are abstracted as streams in C++, we can use the IOobject class to write a header to a file. Here is how the application looks like:
Code:
#include "fvCFD.H" If you want to change the parameters of the header, change the IOobject constructor arguments. |
Quote:
I am not really sure. The above-mentioned solution makes me able to perform a precursor simulation before doing the primary simulation.Adding that my computational resource does not allow me to have two simultaneous simulations! Besides, I think it is the most appropriate solution for me to save data on a plane in advance, since I would be able to implement the data for as many simulations as I want to perform. Regards |
Thanks Syavash
I'm planning on trying something like that, but it looks like it's going to be difficult! regards |
All times are GMT -4. The time now is 01:51. |