Comments (11)
Humph, that doesn't work I think, because the value in the dict holds a strong reference to the key and so it's never collected.
from thetis.
I agree, both of these dicts were implemented as temporary fixes to issues I had.
I use temporary functions essentially to save memory. I think storing them in the function space directly is a great idea. Why is restore_function
necessary?
from thetis.
As for the LinearProblemCache, I think instead of caching them, another solution would be to implement classes that hold the solver objects. For functions like computeVertVelocity
that certainly makes sense. So essentially all those functions in utility
would be implemented as objects that are stored in the solver class:
solverObj.uv_vert_integrator = ComputeVerticalIntegral(uv_3d, uv_dav_3d, average=True)
solverObj.uv_vert_integrator.apply(uv_3d, uv_dav_3d)
That should take care of the collection issue.
from thetis.
So I had thought the restore_function would be used like this:
tmp = V.get_function()
... do stuff with tmp
tmp2 = V.get_function()
... do stuff with tmp2
V.restore_function(tmp)
... do stuff
tmp3 = V.get_function()
# tmp3 doesn't allocate a new work vector, instead it gets the work vector
# that was previously tmp.
IOW, if I only ever need one temporary function on V
but I use it repeatedly in different places, I don't keep on allocating new functions (or allocating and deallocating). But rather V
has a (fixed size) number of work vectors that I can grab hold of and then release back to the pool when I'm done with them.
from thetis.
That approach to the linear problem cache also sounds sensible.
from thetis.
OK, I see. Yes, having a pool of temporary functions seems like a good approach.
I'll start implementing those changes in utility.py
so we can remove LinearProblemCache
.
from thetis.
linProblemCache is now removed in pull request #8 .
from thetis.
Please look at firedrake branch "work_functions" and see if that fits the bill for the temporary function cache.
from thetis.
OK, looks good, I'll give it a shot.
from thetis.
So I think it's possible to use the function space work functions. The only caveat is that during initialization we build Projector objects with the work functions and then re-use those Projectors at run time. This requires that you always get the same work function. I've worked around this by setting max_work_functions to 1, which is fine for now but might be too restrictive in some cases.
from thetis.
Both issues are now addressed in pull requests #8 and #21, closing.
from thetis.
Related Issues (20)
- forcing.py, name 'PETSc' is not defined HOT 5
- Better logging HOT 1
- grid_tpxo9.nc download link error HOT 2
- Create bathymetry mesh + refinement options HOT 16
- import fails without ipython_genutils HOT 2
- Error with Irksome when installing thetis
- Install fails on Mac M1 due to missing dependency on Proj HOT 2
- NameError: name 'RectangleMesh' is not defined HOT 9
- North Sea 2d model HOT 1
- Issue installing qmesh HOT 4
- tohoku bathymetry checkpoint needs updating HOT 1
- Error with new checkpointing HOT 1
- Southern hemisphere UTM zones unaccounted for? HOT 2
- Soft dependency on Goalie to avoid duplication
- Fix sizes of team photos on webpage HOT 1
- Firedrake outputs API has changed
- Allow Thetis to start from a non-zero time
- Remove unnecessary directory level in vtu output
- Using other than CAT1 to control HobbyPCB Amps Band Switching HOT 2
- Allow single timestep control over Thetis run HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thetis.