# https://github.com/flnt/Flower.jl/tree/electrolysis

git clone -b electrolysis  https://github.com/flnt/Flower.jl  

# dans le dossier /usr/local/var/test
julia --project=../Flower.jl -e 'using Pkg; Pkg.instantiate()'

LD_LIBRARY_PATH :/usr/lib/x86_64-linux-gnu 

python3 ../../../Flower.jl/examples/flower_post_proc.py ../../../Flower.jl/examples/convergence_diffusion_constant_conductivity_bubble_wall_Newton.yml --func plot_all_fig_func --h5 flower_00000001.h5 --name current_lines


julia +1.10.5 --project=../Flower.jl --threads=1 ../Flower.jl/examples/convergence.jl ../Flower.jl/examples/convergence_diffusion_constant_conductivity_bubble_wall_Newton.yml


Pour le Makefile

# Initialise les dépendances Julia (à lancer une fois au démarrage du conteneur)
init:
	xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24 -nolisten tcp" julia --project=../Flower.jl -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'

# Votre commande de run existante
run-convergence:
	xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24 -nolisten tcp" julia --project=../Flower.jl --threads=1 ../Flower.jl/examples/convergence.jl ../Flower.jl/examples/convergence_diffusion_constant_conductivity_bubble_wall_Newton.yml
	
	



coder@651071fc97ae:/usr/local/var/test$ xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24 -nolisten tcp" julia --project=../Flower.jl --threads=1 ../Flower.jl/examples/convergence.jl ../Flower.jl/examples/convergence_diffusion_constant_conductivity_bubble_wall_Newton.yml

 YAML file ../Flower.jl/examples/convergence_diffusion_constant_conductivity_bubble_wall_Newton.yml

 number of points [32, 64, 128]

 Print parameters from yml file 

 elec_cond : 1.36e+02 

 Re : 1.00e-01 1.49e+06 1.26e+03 8.43e-04

 'Re' i.e. rho/mu : 1.49e+06 1.49e+06 1.26e+03 8.43e-04

 WARNING no scalar transport

nb_transported_scalars:     0

 diffusion time [1.7241379310344829, 3.125, 3.125]

 end Print parameters from yml file 
[20:00:09][Decl'HDF5] *** info: Plugin loaded successfully
[20:00:09][PDI] *** info: Initialization successful

 PDI INIT status 0
 Timestep 0.0001
 mesh ratio 1
 nx 32 ny 32
 ns_advection trueERROR: LoadError: UndefVarError: `safefill_with_aliases_and_extra_already_init` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
 [1] top-level scope
   @ /usr/local/var/Flower.jl/examples/convergence.jl:341
 [2] include(mod::Module, _path::String)
   @ Base ./Base.jl:306
 [3] exec_options(opts::Base.JLOptions)
   @ Base ./client.jl:317
 [4] _start()
   @ Base ./client.jl:550
in expression starting at /usr/local/var/Flower.jl/examples/convergence.jl:228
[20:00:19][PDI] *** info: Finalization
[20:00:19][Decl'HDF5] *** info: Closing plugin

coder@651071fc97ae:/usr/local/var/test$ xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24 -nolisten tcp" julia --project=../Flower.jl --threads=1 ../Flower.jl/examples/convergence.jl ../Flower.jl/examples/convergence_diffusion_constant_conductivity_bubble_wall_Newton.yml

 YAML file ../Flower.jl/examples/convergence_diffusion_constant_conductivity_bubble_wall_Newton.yml

 number of points [32, 64, 128]

 Print parameters from yml file 

 elec_cond : 1.36e+02 

 Re : 1.00e-01 1.49e+06 1.26e+03 8.43e-04

 'Re' i.e. rho/mu : 1.49e+06 1.49e+06 1.26e+03 8.43e-04

 WARNING no scalar transport

nb_transported_scalars:     0

 diffusion time [1.7241379310344829, 3.125, 3.125]

 end Print parameters from yml file 
[17:29:11][Decl'HDF5] *** info: Plugin loaded successfully
[17:29:11][PDI] *** info: Initialization successful

 PDI INIT status 0
 Timestep 0.0001
 mesh ratio 1
 nx 32 ny 32ERROR: LoadError: KeyError: key :bulk_velocity not found
Stacktrace:
 [1] getindex(h::Dict{Symbol, Any}, key::Symbol)
   @ Base ./dict.jl:477
 [2] getindex
   @ ~/.julia/packages/PropertyDicts/Y5nQe/src/PropertyDicts.jl:205 [inlined]
 [3] getproperty(pd::PropertyDict{Symbol, Any, Dict{Symbol, Any}}, k::Symbol)
   @ PropertyDicts ~/.julia/packages/PropertyDicts/Y5nQe/src/PropertyDicts.jl:238
 [4] top-level scope
   @ /usr/local/var/Flower.jl/examples/convergence.jl:323
 [5] include(mod::Module, _path::String)
   @ Base ./Base.jl:306
 [6] exec_options(opts::Base.JLOptions)
   @ Base ./client.jl:317
 [7] _start()
   @ Base ./client.jl:550
in expression starting at /usr/local/var/Flower.jl/examples/convergence.jl:228
[17:29:24][PDI] *** info: Finalization
[17:29:24][Decl'HDF5] *** info: Closing plugin

include("navier_stokes_coupled_pressure_velocity.jl")
include("navier_stokes_coupled.jl")
include("electrolysis_2.jl")


include("electrolysis_tests.jl")
include("electrolysis_print.jl")

include("run_profile.jl") #for profiling
include("solve_one_fluid.jl")
include("compute_mass_transfer_rate.jl")
include("test_functions.jl")

include("post_processing.jl")

[06:59:48][PDI] *** error: Error while triggering event `write_initialization': ModuleNotFoundError: No module named 'pdi'

ENV PYTHONPATH=/usr/local/lib/python3/dist-packages

ERROR: LoadError: UndefVarError: `BC_uL` not defined in `Main`
The binding may be too new: running in world age 38879, while current world is 38905.
Stacktrace:
 [1] top-level scope
   @ /usr/local/var/Flower.jl/examples/convergence.jl:766
 [2] include(mod::Module, _path::String)
   @ Base ./Base.jl:306
 [3] exec_options(opts::Base.JLOptions)
   @ Base ./client.jl:317
 [4] _start()
   @ Base ./client.jl:550
in expression starting at /usr/local/var/Flower.jl/examples/convergence.jl:228

erreur ligne 766 convergence.jl
dans le run forward

# CORRECTION WORLD AGE :
        # On utilise getfield(Main, :NomVariable) pour forcer la récupération dynamique
        # des variables créées par eval() dans la boucle courante.
        run_forward!(
            num, gp, gu, gv, op, phS, phL;
            periodic_x = (sim.periodic_x == 1),
            periodic_y = (sim.periodic_y == 1),
            # --- CORRECTION DES LIENS DYNAMIQUES ICI ---
            BC_uL = getfield(Main, :BC_uL),
            BC_uS = getfield(Main, :BC_uS),
            BC_vL = getfield(Main, :BC_vL),
            BC_vS = getfield(Main, :BC_vS),
            BC_pL = getfield(Main, :BC_pL),
            BC_pS = getfield(Main, :BC_pS),
            BC_u  = getfield(Main, :BC_u),
            BC_int = getfield(Main, :BC_int),
            BC_trans_scal = getfield(Main, :BC_trans_scal),
            BC_phi_ele = getfield(Main, :BC_phi_ele),
            # -------------------------------------------
            auto_reinit = sim.auto_reinit,
            time_scheme = time_scheme,
            electrolysis = true,
            navier_stokes = true,
            ns_advection = (sim.ns_advection ==1),
            ns_liquid_phase = (sim.solve_Navier_Stokes_liquid_phase == 1),
            verbose = true,
            show_every = sim.show_every,
            electrolysis_convection = (sim.electrolysis_convection ==1),  
            electrolysis_liquid_phase = true,
            electrolysis_phase_change_case = sim.electrolysis_phase_change_case,
            imposed_velocity = sim.imposed_velocity,
            adapt_timestep_mode = sim.adapt_timestep_mode,
            non_dimensionalize=sim.non_dimensionalize,
            mode_2d = sim.mode_2d,
            breakup = sim.breakup,    
        ) breakup = sim.breakup,    
        )