Skip to content
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

switch problem parameters to a script #234

Closed
zingale opened this issue Oct 20, 2017 · 6 comments
Closed

switch problem parameters to a script #234

zingale opened this issue Oct 20, 2017 · 6 comments

Comments

@zingale
Copy link
Member

zingale commented Oct 20, 2017

We should list the problem-specific parameters in a file like we do with the extern parameters (like _parameters), and then parse this at compile time to build the probin module and the namelist read mechanism called from probinit().

This will be cleaner and easier to generalize to the GPUs. We should switch all problems to this system. This is similar to what Maestro currently does. We can build from the infrastructure that exists for extern already.

@zingale
Copy link
Member Author

zingale commented Dec 10, 2017

this is a little more complicated than how we do extern parameters right now, since sometimes we have arrays as problem parameters. So we need to specify the size and how to initialize the array. For arrays
where the size is only known at runtime, we will need to have a mechanism to initialize however many elements exist.

correction: this is not true -- all parameters are scalars.

@zingale
Copy link
Member Author

zingale commented Dec 10, 2017

we should reuse write_probin.py for this. This is currently used by Maestro and for extern problems.

To extend it to the use case for Castro we can either:

  • require that parameters are all scalars, and if problems need to initialize multiple values, require that that be done with more parameters

  • extend the format of the _parameters file to accept a length and allow for a tuple of values to be specificed as the default.

The other design consideration is whether we want this to be something separate from now we deal with extern, or if they can all be in the same module?

@zingale
Copy link
Member Author

zingale commented Dec 10, 2017

It turns out that there are not array parameters, but rather, the probdata module sometimes has array members simply to allow passing of information betweeb probinit and initdata, and perhaps a few other places. So we need a solution that allows us to automate runtime parameters while also allowing us to maintain a module for passing information between routines. Perhaps the solution to this is to have 2 separate modules?

@maximumcats
Copy link
Member

I would have this script create a new module called problem_data, say, and have the existing probdata modules do an unrestricted use of the problem_data module.

@zingale
Copy link
Member Author

zingale commented May 15, 2018

as part of this, we should consider eliminating the probin files completely in favor of AMReX's ability to embed namelists in the inputs file

from Weiqun:

in inputs, you would do:

foo = 3.4

&flst1
   nitems = 5,
   s_factors(1,1:2,1) = 2, 3
/

bar = 4

then to read it as a string that Fortran can deal with:

    use amrex_parmparse_module, only : amrex_namelist

    integer :: nitems
    integer :: s_factors(3,3,3)
    !
    real(amrex_real) :: ff2
    !
    character(len=10) :: ff3
    !
    real(amrex_real) :: center

    namelist /flst1/ nitems, s_factors
    namelist /flst2/ ff2
    namelist /flst3/ ff3
    namelist /probin/ center

    s_factors = 0
    read(amrex_namelist, flst1)
    read(amrex_namelist, flst2)
    read(amrex_namelist, flst3)
    read(amrex_namelist, probin)

@zingale
Copy link
Member Author

zingale commented Aug 9, 2018

actually... we don't need to do anything new. We could just have the problems have a _parameters file and then anything defined there gets added to extern_probin_module automagically.

zingale added a commit that referenced this issue Sep 24, 2019
The automates the creation of the probdata variables, the namelist for reading them, setting them as managed for CUDA, and adds the ability to output the values to a file (like job_info)

This feature is opt-in. You need to set USE_PROB_PARAMS in your GNUmakefile and then
define the problem parameters in a file _prob_params in the problem directory.

For problems that opt-in, the values of the problem parameters are now output into the job_info file.

closes #234
closed #619
@zingale zingale closed this as completed Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants