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

Save an evaluated inputs file on start #5192

Open
titoiride opened this issue Aug 29, 2024 · 3 comments
Open

Save an evaluated inputs file on start #5192

titoiride opened this issue Aug 29, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@titoiride
Copy link
Member

Hi all,
talking with @ax3l and @n01r we thought it would be cool and useful to have WarpX dump an "evaluated" version of the used inputs on start, particularly when using text files as input.
It currently returns the "used input" file, but that only lists the input as they were requested in the file.
If some of the parameters are expressed using constants or mathematical expressions, the file returns the expression as it is.
Perhaps in addition to the file already dumped it would be useful to have one where constants and mathematical expressions are return evaluated so that it's possible to catch bugs related to their definition.

@titoiride titoiride added the enhancement New feature or request label Aug 29, 2024
@ax3l ax3l changed the title Evaluate input file on start Print Evaluated input file on start Aug 29, 2024
@ax3l
Copy link
Member

ax3l commented Aug 29, 2024

@WeiqunZhang, do you think we could create a file similar to warpx_used_inputs that has amrex::ParmParse constants evaluated in it? Something like warpx_evaluated_inputs.

@ax3l ax3l changed the title Print Evaluated input file on start Save an evaluated inputs file on start Aug 29, 2024
@ax3l
Copy link
Member

ax3l commented Sep 4, 2024

Example:

#################################
############ CONSTANTS #############
#################################
my_constants.n0 = 1.e30 # plasma densirty, m^-3
my_constants.nz = 40 # number of grid cells
my_constants.Ti = 100. # ion temperature, eV
my_constants.Te = 100. # electron temperature, eV
my_constants.wpe = q_e*sqrt(n0/(m_e*epsilon0)) # electron plasma frequency, radians/s
my_constants.de0 = clight/wpe # skin depth, m
my_constants.nppcz = 100 # number of particles/cell in z
my_constants.dt = 0.1/wpe # time step size, s
#################################
####### GENERAL PARAMETERS ######
#################################
max_step = 100
amr.n_cell = nz
amr.max_level = 0
geometry.dims = 1
geometry.prob_lo = 0.0
geometry.prob_hi = 10.*de0

Regarding replaced for amr.n_cell and geometry.prob_hi.

@ax3l
Copy link
Member

ax3l commented Sep 4, 2024

@WeiqunZhang mentioned that currently we will see in warpx_used_inputs:

amr.n_cell = nz
amr.n_cell = 40
geometry.prob_hi = 10.*de0 
geometry.prob_hi = <single-number>

(related to AMReX-Codes/amrex#4087 ). We recently updated the sorting, before that the lines were a bit more apart from each other, this was pulled into development last week: AMReX-Codes/amrex#4101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants