CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > ANSYS Meshing & Geometry

[GAMBIT] Looping in journal file

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 2, 2009, 08:13
Default Looping in journal file
  #1
New Member
 
Luuk Thielen
Join Date: Oct 2009
Posts: 5
Rep Power: 7
luuk.thielen is on a distinguished road
Hello all,

is it possible to loop over parts of a group in the DO loop functionality of the Gambit journal file?

My goal is to loop over all volumes in a group and create a separate physics for each group. So the loop should look something like:

DO i = 1, volume_in_groups of <groupname>
physics create <physicsname> ctype "FLUID" volume i
END DO

When reading the manuals I have the feeling this is not possible, but I want to make sure.

Thanks in advance, Luuk
luuk.thielen is offline   Reply With Quote

Old   October 3, 2009, 17:15
Default
  #2
New Member
 
HP Kritzinger
Join Date: May 2009
Location: South Africa
Posts: 25
Rep Power: 8
mystic_cfd is on a distinguished road
Hi Luuk,

Your mail is a bit confusing. It might require some discussion to resolve your issues.

It is possible in Gambit to loop over all the volumes in a group. You need to look at the LISTENTITY command in the manual.

The bit that confuses me is your stated goal: "My goal is to loop over all volumes in a group and create a separate physics for each group." Why loop over the volumes if you want to define a region for the group?

If you already have groups of volumes defined and need to assign continuum types to each group, you can simply assign the the continuum type directly to the group - either in the GUI, or with a command like:
physics create "cell-zone-name" ctype "FLUID" group "name-of-group"

i.e. you do not need to loop over all volumes in a group to assign a continuum type to the group. if you have a lot of groups that require naming, you can, with some effort, construct a gambit macro to do the naming by looping over the groups. if you are lazy like me, you can also use linux to do this. the method goes something like this (only in Linux!):
- you start with all your regions (continuums) defined as separate groups of volumes
- in gambit, go to the group menu and summarize all groups (press "i", select all groups and enter)
- the listing with the summary of all groups now scroll by in the output window, but is also available in the GAMBIT.nnnn/trn file in your work directory
- cut out all the text output from the group summary and paste into a dummy file e.g. dummy.txt.
- the command 'grep "Group:" dummy.txt' will now give a list of all the groups in your database (the output is "Group: groupname".
- pipe the output through awk to create a journal file that generates continuums from the groups.
- e.g.
grep "Group:" dummy.txt | awk '{print "physics create \"fluid-"$2"\" ctype \"FLUID\" group \""$2"\""}' > make-continuums.jou
- you need to edit the journal file to assign FLUID and SOLID states as required, but that is usually quite fast.
- read the journal file into the gambit session and you are done.

if zone creation fails, it is often because you have used the same volume in more than one group - gambit will not assign a continuum type if the volume is already part of a continuum.

that was a bit longer than i intended...
bye4now
mystic_cfd is offline   Reply With Quote

Old   October 5, 2009, 09:49
Default
  #3
New Member
 
Luuk Thielen
Join Date: Oct 2009
Posts: 5
Rep Power: 7
luuk.thielen is on a distinguished road
Hello,

thanx for the answer. I understand the confusion.

The problem is that I want each volume in a group to have a different "cell-zone name" (as you mention it). So suppose I have a geometry of 1000 volumes. Then I create a group (p.e. D_FLUID) containing all the volumes. Next I would like each volume of the group to get a separate physics id, consisting of a concatenation of the name of the group and the number of the volume (so D_FLUID_VOLUME_1, D_FLUID_VOLUME_2 etc). I understand this can be done by a script that "works" on a journal (as you describe).

However, I was curious if an other option would be to use the "script-language" available in the gambit journal file itself. So using the DO loop functionality available in the journal file, loop over all volumes in the group and giving them a (unique) "cell-zone" name. In other words: can you use groups/volumes as counter in the DO loop expression of the GAMBIT journal file.

I hope my question is a bit clearer now.
luuk.thielen is offline   Reply With Quote

Old   October 6, 2009, 11:39
Default
  #4
New Member
 
HP Kritzinger
Join Date: May 2009
Location: South Africa
Posts: 25
Rep Power: 8
mystic_cfd is on a distinguished road
OK, I think I understand. I used the following on a sample database with one group called "D_FLUID" which contains 4 volumes. It should give you the idea...

$n = 0
$grpname = "D_FLUID"
$grpvol_list = LISTENTITY(t_vo,t_gr,$grpname)
$nv = PARAMSIZE("grpvol_list")
DO PARA "n" COND ($n .le. $nv)
$zone_name = $grpname + "_VOLUME_" + ntos($n)
physics create $zone_name ctype "FLUID" volume $grpvol_list[$n]
ENDDO

let me know if you need more of an explanation. if you have multiple groups, you can wrap this code in another DO loop that loops over all the groups in your model.

regards
hp
mystic_cfd is offline   Reply With Quote

Old   October 7, 2009, 11:07
Default
  #5
New Member
 
Luuk Thielen
Join Date: Oct 2009
Posts: 5
Rep Power: 7
luuk.thielen is on a distinguished road
Hello,

thank you for the answer and example. Using your example I was able to "solve the problem".

Thanx again,

Luuk
luuk.thielen is offline   Reply With Quote

Reply

Tags
gambit, journal, loop

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
OpenFOAM Install Script ljsh OpenFOAM Installation 82 October 12, 2009 11:47
Problem with Boundary Conditions using a journal file T.S. FLUENT 3 July 27, 2009 08:31
Compiling OpenFOAM13 on AMD64 with Redhat Enterprise mbeaudoin OpenFOAM Installation 20 June 17, 2008 06:43
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00
Gambit Journal File Scripts, Public Database Needed? Jonas Larsson Main CFD Forum 13 March 2, 1999 08:25


All times are GMT -4. The time now is 06:45.