-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tfluct as input to solver, following rp #424
Conversation
! ========================================================= | ||
subroutine tfluct(maxmx,num_eqn,num_waves,num_ghost,mx,ql,qr,auxl,auxr, & | ||
s,adq) | ||
subroutine tfluct(ixyz,maxnx,meqn,mwaves,maux,mbc,mx,ql,qr,auxl,auxr,amdq2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this stub supposed to match the example above? The function signatures and name are different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mandli the tfluct stub example was left untouched for a long time, the API was never updated. This PR fixes that and provides a method to set tfluct following this standard, see for example euler_1d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I see what you are saying although now having different signatures for each dimension's implementation (which I think is fine) means you may want to have the stub mimic this (i.e. have stub for tfluct1
, tfluct2
, and tfluct3
which have the correct signatures). Often times users will copy these stub functions and use them so this could be dangerous otherwise even if you are passing them through to flux*
.
@mandli following your suggestion I have added dimension dependent stub functions for tfluct. |
@ketch any comments? |
! ========================================================= | ||
subroutine tfluct(maxmx,num_eqn,num_waves,num_ghost,mx,ql,qr,auxl,auxr, & | ||
s,adq) | ||
subroutine tfluct1(maxnx,meqn,mwaves,maux,mbc,mx,ql,qr,auxl,auxr,amdq2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mandli note that now the stub functions are different for 1d and 2d...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete these stubs and write some documentation of the interface instead.
At this point I defer approval to those that know more about SharpClaw. |
double precision, intent(in) :: ql(meqn,1-mbc:maxnx+mbc) | ||
double precision, intent(in) :: qr(meqn,1-mbc:maxnx+mbc) | ||
|
||
double precision, intent(out) :: amdq2(meqn,1-mbc:maxnx+mbc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct name for this variable here is adq, not amdq2. The function is supposed to compute the total fluctuation.
This PR is a model of good practice: it does one thing only, and what it does is explained clearly. |
Hi :) Agreed that this is a good PR. Comments:
|
Regarding the stub functions: I think you can get rid of them completely. Instead, just put the following near the top of sharpclaw/solver.py:
Then
|
I think that eventually it would make sense to keep tfluct solvers in the Riemann repository and handle them just like Riemann solvers. However, since we only have one tfluct solver at present, it doesn't seem worthwhile to disrupt the current layout of the Riemann repository. And it is useful to have an example showing how a user can employ their own tfluct solver. |
A couple of comments about what @ketch said:
|
Response to @mandli :
The functions don't get called from the fortran unless tfluct_solver is True. The code I wrote in my previous comment works fine (I tested it).
True. But if those functions are really just documentation of an API, then we should instead document the API (in the docs!) |
Response to @ketch (nested quoting works!):
Yeah, now that I think about it as long as it is being passed as a function argument it should be fine. It might be worthwhile checking on Linux whose ELF binary format is more sensitive to this than OS X's Mach-O format.
Heh, good point. I think I am too used to what we have needed to do in the past with Fortran. |
Just to be clear: this PR is waiting on @sanromd to clean it up following the comments above. |
@ketch The issues raised have been solved. I have left the stub functions tfluct on sharp claw for reference to the user, although they are not used anymore. Perhaps we could create a dummy folder on Riemann for the tfluct solvers as a separate PR. I think now this is ready to merge. |
@ketch corrections committed |
…efault tfluct function
tfluct as input to solver, following rp
This PR
solver.tfluct_solver=True
, a fortran python-wrapped routine can be given throughimport _name-of-tfluct-solver_
,solver.tfluct=_name-of-tfluct-solver_