"Timestep Scale" does not accept array

Numerical methods and mathematical models of Elmer
Post Reply
andrewdnolan
Posts: 16
Joined: 26 Oct 2020, 18:33
Antispam: Yes

"Timestep Scale" does not accept array

Post by andrewdnolan »

I'm using "Exec Interval" to execute certain solvers at different intervals.

I'm also using variably sized timesteps by passing arrays to the "Timestep Intervals" and "Timestep Sizes" keywords in the solver section. Per the ElmerSolver manual definition of "Exec Interval":
This keyword gives an interval at which the solver is active. At other intervals the solver is not used.
This should have the same length as Timestep Intervals in the Simulation section.
That's all fine and good, but "Timestep Scale" only accepts constants. The "Timestep Scale" should require an array of the same length as the "Timestep Intervals", just like the "Exec Interval". Right? Otherwise the as the "Exec Interval" changes but "Timestep Scale" is constant the timestep will be incorrectly scaled throughout the simulation.

Here is the error message I get:

Code: Select all

ERROR:: ListGetConstReal: Invalid list type for: Timestep Scale
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DENORMAL
STOP 1
Don't know if this would be better on the "Bug Reports" forum, or maybe as issue on GitHub?
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: "Timestep Scale" does not accept array

Post by kevinarden »

Invalid list type is sometimes resolved by declaring variable type

Timestep Scale(3) = Real 1 1 2
Rich_B
Posts: 421
Joined: 24 Aug 2009, 20:18

Re: "Timestep Scale" does not accept array

Post by Rich_B »

Hello,

Posting a small example, with sif, geometry, and a solver log, is usually helpful.

Rich.
andrewdnolan
Posts: 16
Joined: 26 Oct 2020, 18:33
Antispam: Yes

Re: "Timestep Scale" does not accept array

Post by andrewdnolan »

Hi all,

Thanks for the feedback!

Kevin: I have explicitly declared the variable type as you suggested, but unfortunately this doesn't seem to fix the problem.

Rich: I've attached a minimum working example. All that you should need to do is execute

Code: Select all

./run.sh
The bash script will compile all the user functions/solvers and run two different sif files from the "sifs" folder.

The first sif file "sifs/with_timestepscale.sif" has an Real array passed to the "Timestep Scale" keyword. This fails and the log file can be found in "log/with_timestepscale.log", but for convenience here's the output:

Code: Select all

ELMER SOLVER (v 9.0) STARTED AT: 2022/11/05 19:17:51
ParCommInit:  Initialize #PEs:            1
MAIN: OMP_NUM_THREADS not set. Using only 1 thread per task.
MAIN: 
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 9.0 (Rev: cf291b69, Compiled: 2021-11-03)
MAIN:  Running one task without MPI parallelization.
MAIN:  Running with just one thread per task.
MAIN:  MUMPS library linked in.
MAIN:  Lua interpreter linked in.
MAIN: =============================================================
LoadInputFile: Trying to read "Run Control" section only
OpenIncludeFile: Trying to include file: "./params/ref_params.sif"
MAIN: 
MAIN: 
MAIN: -------------------------------------
MAIN: Reading Model: sifs/with_timestepscale.sif
 Caught LUA error:[string " assert(loadfile('../../src/elmer_src/lua_f..."]:1: cannot open ../../src/elmer_src/lua_functions.lua: No such file or directory
LoadInputFile: Scanning input file: sifs/with_timestepscale.sif
LoadInputFile: Scanning only size info
LoadInputFile: First time visiting
LoadInputFile: Reading base load of sif file
OpenIncludeFile: Trying to include file: "./params/ref_params.sif"
OpenIncludeFile: Trying to include file:  "./input_data/topography/crmpt12_surf.dat"
OpenIncludeFile: Trying to include file: "./input_data/topography/crmpt12_bed.dat"
OpenIncludeFile: Trying to include file: "./input_data/topography/crmpt12_bed.dat"
LoadInputFile: Loading input file: sifs/with_timestepscale.sif
LoadInputFile: Reading base load of sif file
OpenIncludeFile: Trying to include file: "./params/ref_params.sif"
CheckKeyword:  Unlisted keyword: [rho_i] in section: [constants]
CheckKeyword:  Unlisted keyword: [rho_s] in section: [constants]
CheckKeyword:  Unlisted keyword: [rho_w] in section: [constants]
CheckKeyword:  Unlisted keyword: [t_ref_enthalpy] in section: [constants]
CheckKeyword:  Unlisted keyword: [p_surf] in section: [constants]
CheckKeyword:  Unlisted keyword: [p_triple] in section: [constants]
CheckKeyword:  Unlisted keyword: [t_triple] in section: [constants]
CheckKeyword:  Unlisted keyword: [beta_clapeyron] in section: [constants]
CheckKeyword:  Unlisted keyword: [l_heat] in section: [constants]
CheckKeyword:  Unlisted keyword: [enthalpy heat capacity a] in section: [constants]
CheckKeyword:  Unlisted keyword: [enthalpy heat capacity b] in section: [constants]
CheckKeyword:  Unlisted keyword: [rho_f] in section: [constants]
CheckKeyword:  Unlisted keyword: [c_firn] in section: [constants]
CheckKeyword:  Unlisted keyword: [w_max_en] in section: [constants]
CheckKeyword:  Unlisted keyword: [w_max_aq] in section: [constants]
CheckKeyword:  Unlisted keyword: [z_ref] in section: [constants]
CheckKeyword:  Unlisted keyword: [t_mean] in section: [constants]
CheckKeyword:  Unlisted keyword: [t_peak] in section: [constants]
CheckKeyword:  Unlisted keyword: [dtdz] in section: [constants]
CheckKeyword:  Unlisted keyword: [alpha] in section: [constants]
CheckKeyword:  Unlisted keyword: [std_c0] in section: [constants]
CheckKeyword:  Unlisted keyword: [std_c1] in section: [constants]
CheckKeyword:  Unlisted keyword: [std_c2] in section: [constants]
CheckKeyword:  Unlisted keyword: [t_melt] in section: [constants]
CheckKeyword:  Unlisted keyword: [h_aq] in section: [constants]
CheckKeyword:  Unlisted keyword: [f_dd] in section: [constants]
CheckKeyword:  Unlisted keyword: [r_frac] in section: [constants]
CheckKeyword:  Unlisted keyword: [seasonality] in section: [constants]
CheckKeyword:  Unlisted keyword: [mass balance offset] in section: [constants]
CheckKeyword:  Unlisted keyword: [t_mean] in section: [constants]
CheckKeyword:  Unlisted keyword: [pressure variable] in section: [constants]
CheckKeyword:  Unlisted keyword: [mesh velocity 1] in section: [initial condition 1]
CheckKeyword:  Unlisted keyword: [mesh velocity 2] in section: [initial condition 1]
CheckKeyword:  Unlisted keyword: [refzs] in section: [initial condition 2]
OpenIncludeFile: Trying to include file:  "./input_data/topography/crmpt12_surf.dat"
CheckKeyword:  Unlisted keyword: [limit temperature] in section: [material 1]
Loading user function library: [./bin/Thermodynamics]...[Lliboutry_and_Duval_Enhancment]
CheckKeyword:  Unlisted keyword: [enthalpy water diffusivity] in section: [material 1]
CheckKeyword:  Unlisted keyword: [enthalpy heat diffusivity] in section: [material 1]
Loading user function library: [./bin/Thermodynamics]...[Diffusivity]
CheckKeyword:  Unlisted keyword: [min zs] in section: [material 1]
CheckKeyword:  Unlisted keyword: [max zs] in section: [material 1]
CheckKeyword:  Unlisted keyword: [min zs] in section: [material 2]
CheckKeyword:  Unlisted keyword: [max zs] in section: [material 2]
CheckKeyword:  Unlisted keyword: [latent heat source] in section: [solver 5]
CheckKeyword:  Unlisted keyword: [source at surface] in section: [solver 5]
CheckKeyword:  Unlisted keyword: [correct surface] in section: [solver 8]
CheckKeyword:  Unlisted keyword: [minimum height] in section: [solver 8]
CheckKeyword:  Unlisted keyword: [flow solver name] in section: [solver 9]
CheckKeyword:  Unlisted keyword: [flow loads name] in section: [solver 9]
CheckKeyword:  Unlisted keyword: [flow solver name] in section: [solver 10]
CheckKeyword:  Unlisted keyword: [flow loads name] in section: [solver 10]
CheckKeyword:  Unlisted keyword: [pressure variable] in section: [solver 10]
CheckKeyword:  Unlisted keyword: [computeall] in section: [solver 11]
CheckKeyword:  Unlisted keyword: [flow solution passive] in section: [body force 1]
CheckKeyword:  Unlisted keyword: [enthalpy_h upper limit] in section: [body force 1]
Loading user function library: [./bin/Thermodynamics]...[Limit_Enthalpy_rho]
CheckKeyword:  Unlisted keyword: [enthalpy_h lower limit] in section: [body force 1]
CheckKeyword:  Unlisted keyword: [zs accumulation flux 1] in section: [body force 2]
CheckKeyword:  Unlisted keyword: [zs accumulation flux 2] in section: [body force 2]
Loading user function library: [./bin/mass_balance]...[spline]
CheckKeyword:  Unlisted keyword: [computenormal] in section: [boundary condition 1]
Loading user function library: [./bin/SlipCoefficent]...[periodic_surge]
OpenIncludeFile: Trying to include file: "./input_data/topography/crmpt12_bed.dat"
CheckKeyword:  Unlisted keyword: [zbed] in section: [boundary condition 1]
OpenIncludeFile: Trying to include file: "./input_data/topography/crmpt12_bed.dat"
CheckKeyword:  Unlisted keyword: [enthalpy heat flux bc] in section: [boundary condition 1]
CheckKeyword:  Unlisted keyword: [enthalpy heat flux] in section: [boundary condition 1]
CheckKeyword:  Unlisted keyword: [enthalpy_h load] in section: [boundary condition 1]
Loading user function library: [ElmerIceUSF]...[getFrictionLoads]
CheckKeyword:  Unlisted keyword: [depth] in section: [boundary condition 2]
LoadInputFile: Number of BCs: 4
LoadInputFile: Number of Body Forces: 2
LoadInputFile: Number of Initial Conditions: 2
LoadInputFile: Number of Materials: 2
LoadInputFile: Number of Equations: 2
LoadInputFile: Number of Solvers: 11
LoadInputFile: Number of Bodies: 2
ExportVertically: Memory allocation done.
ComputeChange: NS (ITER=1) (NRM,RELC): (  2037.1718      2.0000000     ) :: exportvertically
ComputeNormalSolver: Computing Normal Vector for Nodes
ComputeNormalSolver: End
MAIN: 
MAIN: -------------------------------------
MAIN: Time: 1/2450:   5.000E-02
MAIN: -------------------------------------
MAIN: 
SolveEquations: -------------------------------------
SolveEquations:  Coupled system iteration:            1
SolveEquations: -------------------------------------
ERROR:: ListGetConstReal: Invalid list type for: Timestep Scale
The second sif file "sifs/without_timestepscale.sif" is exactly the same, expect the "Timestep Scale" keyword is commented out in all places. There's no need to run the entire simulation, this is included just to demonstrate "Timestep Scale" keyword is the culprit for the failure above. If you are interested it's output can be found in "log/without_timestepscale.log", although I would manually interrupt the simulation after the first timestep since it will take a while to run.

Thanks for the help,

Andrew
Attachments
Timestep_scale.tar.gz
(225.89 KiB) Downloaded 38 times
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: "Timestep Scale" does not accept array

Post by kevinarden »

Perhaps Timestep Scale is not defined in the code as an array. Maybe only one Timestep Scale can be used.

Timestep Scale = Real .5
Rich_B
Posts: 421
Joined: 24 Aug 2009, 20:18

Re: "Timestep Scale" does not accept array

Post by Rich_B »

Hello,

If you open elmerfem/fem/src/MainUtils.F90 and search for 'Timestep Scale', you will find this code section:
IF(.NOT. ListGetLogical( Params,'Auxiliary Solver',Found)) THEN
DTScal = ListGetConstReal( Params, 'Timestep Scale', Found )
IF ( .NOT. Found ) DTScal = 1.0_dp
......
Solver % dt = DtScal * dt
Rich.
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: "Timestep Scale" does not accept array

Post by raback »

Hi,

Yes, "timestep scale" is a rather rarely needed keyword. Initially it was created for a case when we have different solvers that could have different timescales. With this keyword we may play with timestepping strategies. Indeed, it could be used in combination of "exec intervals" such that if this is say N then one could scale time accordingly such that total time remains.

I see the issue. Probably I have sometimes coded a remedy for that. There seems to be an undocumented keyword for Solver section:

Code: Select all

  Timestep Over Intervals = Logical True
This multiplies the timestep with the exec interval.

-Peter
andrewdnolan
Posts: 16
Joined: 26 Oct 2020, 18:33
Antispam: Yes

Re: "Timestep Scale" does not accept array

Post by andrewdnolan »

Hi,

Perfect, this is exactly what I was looking for!

I'm going to run some tests right now to confirm everything looks good and will report back.

Thank you!

Andrew
andrewdnolan
Posts: 16
Joined: 26 Oct 2020, 18:33
Antispam: Yes

Re: "Timestep Scale" does not accept array

Post by andrewdnolan »

Everything seems to work as expected.

Thanks for the heads up about this Keyword!

Thanks,
Andrew
Post Reply