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

programming new format writer for surface sampling

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By rama13

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2015, 15:49
Default programming new format writer for surface sampling
  #1
New Member
 
Kossivi's Avatar
 
Kossivi GOKPI
Join Date: Jun 2010
Location: France
Posts: 28
Rep Power: 15
Kossivi is on a distinguished road
Hi Foamers,

I'm trying to programm a new format writer for surface sampling. I explain my self:

To output the pressure and the face centers for example on a surface, one uses sampleDict and putting the surfaceFormat as raw or vtk....
So wanting to write a new format and output vaues as pressure, normal of the faces, en cellcenters...in a format which will be read in a homemade sofware. So a saw the the writers are in :
src/sampling/sampledsurface/.../writers.

So should a make a copy in my USER_DIR and modify one of the write format accordingly and how can I tell the SampleDict to tanke into account my new format writer; and to read the writeType.

If someone can help me I will very appreciate.

Thank very much.

Kossivi
Kossivi is offline   Reply With Quote

Old   April 4, 2015, 15:40
Default sampling surface format programming
  #2
New Member
 
Kossivi's Avatar
 
Kossivi GOKPI
Join Date: Jun 2010
Location: France
Posts: 28
Rep Power: 15
Kossivi is on a distinguished road
[QUOTE=Kossivi;539728]Hi Foamers,

I'm trying to programm a new format writer for surface sampling. I explain my self:

To output the pressure and the face centers for example on a surface, one uses sampleDict and putting the surfaceFormat as raw or vtk....
So wanting to write a new format such as nastran format writer, I saw the the writers are in :
src/sampling/sampledsurface/writers.

So should a make a copy in my USER_DIR and modify one of the write format accordingly and how can I tell the SampleDict to tanke into account my new format writer; and to read the writeType.

If someone can help me I will very appreciate.

Thank very much.

Kossivi
Kossivi is offline   Reply With Quote

Old   April 14, 2015, 03:17
Default
  #3
New Member
 
rama13's Avatar
 
Damiano Natali
Join Date: Mar 2013
Location: Genova, Italy
Posts: 17
Rep Power: 13
rama13 is on a distinguished road
Hi Kossivi,

you have to perform two different actions.

First thing is:

1) make a copy of the whole $FOAM_SRC/sampling folder into your own user space
2) take a look to $FOAM_SRC/sampling/Make. There you have "files" and "options"
3) you are mainly interested in $FOAM_SRC/sampling/Make/files. Here you find the list of files you want to be compiled into (see last line) the sampling library.
4) what you want is to compile your own library, let's say "libmySampling" to be added to your user library folder, $FOAM_USER_LIBBIN, so edit the last line to be

LIB = $(FOAM_USER_LIBBIN)/libmySampling

Second modification to be done regards the sampling utility ($FOAM_APP/applications/utilities/postProcessing/sampling/sample)

1) copy the folder to your user space
2) here you find the Make folder, which contains the same files.
3) Here "files" is lot easier than the previous in that you compile just one application, and you may want to customize it, let say

mySample.C // remember to edit the filename accordingly

EXE = $(FOAM_USER_APPBIN)/mySample

4) in the "options" file you have at line 14 the

-lsampling

which tell the application to use the standard sampling library. What you have to do is to replace it with your edited library

-L$(FOAM_USER_LIBBIN) \
-lmySampling \

where the "-L" flag informs the compiler on where to find your customized library.

Hope this helps,
Damiano
Kossivi likes this.
__________________
Damiano Natali Eng Phd | R&D and FEA Engineer
________________________________________
Cressall | Optimum Resistor Solutions
Evington Valley Road, Leicester, Leicestershire, LE5 5LZ, UK.
NERs | Load Banks | Marine & Offshore | DBRs | Renewables
rama13 is offline   Reply With Quote

Old   April 14, 2015, 17:14
Default
  #4
New Member
 
Kossivi's Avatar
 
Kossivi GOKPI
Join Date: Jun 2010
Location: France
Posts: 28
Rep Power: 15
Kossivi is on a distinguished road
Quote:
Originally Posted by rama13 View Post
Hi Kossivi,

you have to perform two different actions.

First thing is:

1) make a copy of the whole $FOAM_SRC/sampling folder into your own user space
2) take a look to $FOAM_SRC/sampling/Make. There you have "files" and "options"
3) you are mainly interested in $FOAM_SRC/sampling/Make/files. Here you find the list of files you want to be compiled into (see last line) the sampling library.
4) what you want is to compile your own library, let's say "libmySampling" to be added to your user library folder, $FOAM_USER_LIBBIN, so edit the last line to be


LIB = $(FOAM_USER_LIBBIN)/libmySampling

Second modification to be done regards the sampling utility ($FOAM_APP/applications/utilities/postProcessing/sampling/sample)

1) copy the folder to your user space
2) here you find the Make folder, which contains the same files.
3) Here "files" is lot easier than the previous in that you compile just one application, and you may want to customize it, let say

mySample.C // remember to edit the filename accordingly

EXE = $(FOAM_USER_APPBIN)/mySample

4) in the "options" file you have at line 14 the

-lsampling

which tell the application to use the standard sampling library. What you have to do is to replace it with your edited library

-L$(FOAM_USER_LIBBIN) \
-lmySampling \

where the "-L" flag informs the compiler on where to find your customized library.

Hope this helps,
Damiano
Hi Damiano,
Thanks for your help

I have done as you indicated, and every compile very well. I compile first the my sampling and the utility in the application.
So to see if it works, I write something in the raw writer to output but it doesn't work. It seems that mine is not taken into account. Here are the folders as modified according to your advice, if you can have a look

Thanks

Kossivi
Kossivi is offline   Reply With Quote

Old   April 16, 2015, 01:11
Default
  #5
New Member
 
Kossivi's Avatar
 
Kossivi GOKPI
Join Date: Jun 2010
Location: France
Posts: 28
Rep Power: 15
Kossivi is on a distinguished road
Any help to this post ?

Thanks

Kossivi
Kossivi is offline   Reply With Quote

Old   April 18, 2015, 16:28
Default
  #6
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
Quote:
Originally Posted by Kossivi View Post
Any help to this post ?
If you can provide a test case and the code you're testing, it would make it a lot easier for anyone to help you.
Otherwise, it will take a considerable amount of time to try and replicate the same structure you're using, which makes it less likely anyone will have enough free time to assist you in this.
wyldckat is offline   Reply With Quote

Old   April 21, 2015, 18:28
Default
  #7
New Member
 
Kossivi's Avatar
 
Kossivi GOKPI
Join Date: Jun 2010
Location: France
Posts: 28
Rep Power: 15
Kossivi is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
If you can provide a test case and the code you're testing, it would make it a lot easier for anyone to help you.
Otherwise, it will take a considerable amount of time to try and replicate the same structure you're using, which makes it less likely anyone will have enough free time to assist you in this.

Hi wyldckat,

Sorry for my late replying. My src/sampling folder even compressed is to heavy to load on the site. May be there is a way to not exceed 97.0 KB ? The same for my case file.

And thanks for your help

Best,

Kossivi
Attached Files
File Type: zip applications.zip (39.9 KB, 2 views)
Kossivi is offline   Reply With Quote

Old   October 24, 2015, 16:47
Default
  #8
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
Hi Kossivi,

Sorry for the really late reply. I had this post of yours on my to-do list and only today did I finally manage to take a quick look into this

The problem was that in the file "sample/Make/options" you were still using the original source code path for the sampling library:
Code:
-I$(LIB_SRC)/sampling/lnInclude
This means that the linker would automatically look for the respective "libsampling.so" library.

As for making it more compact, you should have run this command:
Code:
wclean all
inside the folder of the source code for your library and your application. This would have deleted the intermediate files that are occupying so much space in the package.

Best regards,
Bruno
wyldckat 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
sampling interval and sampling frequency beauty FLUENT 13 November 9, 2022 08:23
[Discretizer] Installing Discretizer umassche OpenFOAM Community Contributions 26 January 25, 2017 05:33
Best format for simulation data? cbisw Main CFD Forum 9 May 30, 2011 02:38


All times are GMT -4. The time now is 00:47.