Note that the YAML parser simply reads the yaml file, converts it into a petsc 
option string which is later parsed by your code. Some of the advanced features 
of YAML, which do not translate easily into petsc options (sequences, tags, and 
anchors, for instance) are not implemented. Still, I think that an option file 
of the form

disp:
    snes:
        type: ls
        linesearch:
            type: basic
            damping: 1.0
        lag:
            preconditioner: 1
        atol: 1.0e-7
        rtol: 1.0e-5
    ksp:
        type: cg
        atol: 1.e-7
        rtol: 1.e-5
    pc:
        type: ml

is a major improvement over the petsc options equivalent 

-disp_snes_type ls
-disp_snes_linesearch_type basic
-disp_snes_linesearch_damping 1.0
-disp_snes_lag_preconditioner 1
-disp_snes_atol 1.0e-7
-disp_snes_rtol 1.0e-5
-disp_ksp_type cg
-disp_ksp_atol 1.e-7
-disp_ksp_rtol 1.e-5
-disp_pc_type ml

and is much easier to parse from other codes.

Regards,
Blaise



> On Aug 21, 2020, at 12:17 AM, Jed Brown <j...@jedbrown.org> wrote:
> 
> Alex Fleeter <luis.satur...@gmail.com> writes:
> 
>> Thanks, we will try that. I have never used YAML before.
> 
> It's meant to be more human-readable than XML, and is widely used these days.
> 
>> Anyway, we feel using command line arguments is a bit old fashioned. It can
>> be quite desirable to set parameters from a human-readable file.
> 
> My usual workflow is to build up comprehensive options by experimenting on 
> the command line, then put them in a file (either using the basic format that 
> Barry mentioned or YAML).

-- 
A.K. & Shirley Barton Professor of  Mathematics
Adjunct Professor of Mechanical Engineering
Adjunct of the Center for Computation & Technology
Louisiana State University, Lockett Hall Room 344, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 Web 
http://www.math.lsu.edu/~bourdin

Reply via email to