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

reading in a string

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 3 Post By l_r_mcglashan

Reply
 
LinkBack Thread Tools Display Modes
Old   August 3, 2009, 18:06
Default reading in a string
  #1
Member
 
Scott Ripplinger
Join Date: Mar 2009
Posts: 30
Rep Power: 8
sripplinger is on a distinguished road
I'm in the middle of writing some code for colloidal particle transport based on the solidParticle class. I would like to be able to read in the name of the model I want to use. For instance, in the particleProperties file I am trying to add a vdwModel variable which is read in as a string ("Gregory" or "SchenkelKitchener"). This would then be used later in the code to specify which force model I want to use.

My question is exactly how do I read in a string? Something along the lines of readScalar is what I'm looking for, but if I need to rethink how I'm doing this, then I'll listen to any suggestions you have.
sripplinger is offline   Reply With Quote

Old   August 4, 2009, 05:36
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
l_r_mcglashan will become famous soon enough
I assume you're familiar with something like this:

scalar variable = readScalar(dictionary.lookup("variableName"));

Well you can have:

word variable = word(dictionary.lookup("variableName"));
__________________
Laurence R. McGlashan :: Website

Last edited by l_r_mcglashan; August 4, 2009 at 06:14.
l_r_mcglashan is offline   Reply With Quote

Old   August 4, 2009, 11:28
Default
  #3
Member
 
Scott Ripplinger
Join Date: Mar 2009
Posts: 30
Rep Power: 8
sripplinger is on a distinguished road
Yes! I think that is exactly what I am looking for. I'll give it a go and see if it works for me.
sripplinger is offline   Reply With Quote

Reply

Tags
i/o, input, read string

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem converting fluent mesh vinz OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 20 November 17, 2012 11:54
Fluent3DMeshToFoam simvun OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 48 May 14, 2012 05:20
Converting a mesh with splitted cells using fluentMeshToFoam jlpelerin OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 4 April 25, 2011 16:56
TGridFluent mesh with internal by prism layer and internal face for diagnostic sponiar OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 March 30, 2009 15:02
FluentMesh conversion problemwaiting for help waynezw0618 OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 12 December 1, 2006 00:12


All times are GMT -4. The time now is 08:27.