[gerris-users] [Gfs-users] Spatial integrals of GfsVariable-s

31 views
Skip to first unread message

Kristjan Gudmundsson

unread,
May 19, 2010, 12:53:39 PM5/19/10
to GFS users discussion list
Hi all,

I'm using a source term in the momentum equations which is proportional to the spatial average of a GfsVariable.

To this end I did something along the lines of

Source U {
MyData data;
data.ave = 0.0;
gfs_domain_cell_traverse (.....(FttCellTraverseFunc) add_it, &data);
return data.ave*U;
}

where add_it() is defined globally along with MyData.

This is running exceedingly slowly. I think I've figured out that this is because the GfsFunction in Source is called once for each cell, so I'm actually traversing the tree and re-computing the average ~N^3 (3D) times at each fixed time-step.

How can I do this so I only traverse the tree once per call to RHS? I also have similar source terms on V and W so optimally I would compute all three averages in the same traverse.

Thanks,
Kristjan



------------------------------------------------------------------------------

_______________________________________________
Gfs-users mailing list
Gfs-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gfs-users

--
You received this message because you are subscribed to the Google Groups "gerris-users" group.
To post to this group, send an email to gerris...@googlegroups.com.
To unsubscribe from this group, send email to gerris-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gerris-users?hl=en-GB.

Stephane Popinet

unread,
May 19, 2010, 5:30:16 PM5/19/10
to GFS users discussion list
Hi Kristjan,

> This is running exceedingly slowly. I think I've figured out that this is because the GfsFunction in Source is
> called once for each cell, so I'm actually traversing the tree and re-computing the average ~N^3 (3D)
> times at each fixed time-step.

Yes, this the correct explanation.

> How can I do this so I only traverse the tree once per call to RHS? I also have similar source terms on V
> and W so optimally I would compute all three averages in the same traverse.

At the moment there is no mechanism to define "spatially-constant
variables" in parameter files which is what you would need. It would
be a useful option to have. I have added this to the wishlist:

http://gfs.sourceforge.net/wiki/index.php/Wishlist#Future

I think the only way to do this at the moment is to write your own
GfsSource class module. GfsSourceControl would be a good starting
point.

cheers

Stephane
Reply all
Reply to author
Forward
0 new messages