Commit d9236aae authored by William F Godoy's avatar William F Godoy
Browse files

Adding test for DustGravity

parent f965f380
plots_cells,plots_size,plots_size_L0,plots_size_L1,plots_size_L2,caseID,caseDir
4096,472612.0,461951.0,0.0,0.0,case12,plt_3d_00000
8192,945273.0,923914.0,0.0,0.0,case12,plt_3d_00002
12288,1.417935e6,1.385877e6,0.0,0.0,case12,plt_3d_00004
16384,1.890595e6,1.84784e6,0.0,0.0,case12,plt_3d_00006
20480,2.363255e6,2.309803e6,0.0,0.0,case12,plt_3d_00008
24576,2.835917e6,2.771766e6,0.0,0.0,case12,plt_3d_00010
This diff is collapsed.
...@@ -116,8 +116,8 @@ function _get_independent_variables(extractor::AbstractAmrex, parameters)::Dict{ ...@@ -116,8 +116,8 @@ function _get_independent_variables(extractor::AbstractAmrex, parameters)::Dict{
maxLevel = get(parameters, "amr.max_level", "") maxLevel = get(parameters, "amr.max_level", "")
independentVariables["amr.max_level"] = maxLevel == "" ? 1 : parse(Int32, maxLevel) independentVariables["amr.max_level"] = maxLevel == "" ? 1 : parse(Int32, maxLevel)
regrid = prod(parse.(Int64, split(get(parameters, "amr.regrid_int", ["0"])))) regrid = prod(parse.(Int64, split(get(parameters, "amr.regrid_int", ["0"]))))
independentVariables["amr.regrid_int"] = regrid == "" ? 1 : parse(Int64, regrid) independentVariables["amr.regrid_int"] = regrid
return independentVariables return independentVariables
......
...@@ -92,7 +92,7 @@ function _get_linear_model_X(extractor::AmrexCastro)::DataFrames.DataFrame ...@@ -92,7 +92,7 @@ function _get_linear_model_X(extractor::AmrexCastro)::DataFrames.DataFrame
# get outputDir name # get outputDir name
independentVariables["caseID"] = helper_get_relative_path(outputDir) independentVariables["caseID"] = helper_get_relative_path(outputDir)
if !isXInit if isXInit == false
X = DataFrames.DataFrame(independentVariables) X = DataFrames.DataFrame(independentVariables)
isXInit = true isXInit = true
else else
...@@ -141,7 +141,7 @@ function _run_linear_models_plots_size_step(extractor::AmrexCastro, X::DataFrame ...@@ -141,7 +141,7 @@ function _run_linear_models_plots_size_step(extractor::AmrexCastro, X::DataFrame
counter::Int32 = 1 counter::Int32 = 1
# extract ncells # extract ncells
ncells = X["amr.ncells"][index] ncells = X[!,"amr.ncells"][index]
# caseID # caseID
caseID = helper_get_relative_path(outputDir) caseID = helper_get_relative_path(outputDir)
...@@ -199,63 +199,3 @@ function _run_linear_models_plots_size_step(extractor::AmrexCastro, X::DataFrame ...@@ -199,63 +199,3 @@ function _run_linear_models_plots_size_step(extractor::AmrexCastro, X::DataFrame
#readline() #readline()
end end
# dead function
function _run_linear_model_plots_size(extractor::AmrexCastro, X::DataFrames.DataFrame)
outputDirs = helper_get_prefix_directories(extractor.outputPrefix)
# single column DataFrame Y in the linear model
plotsSizesData = DataFrames.DataFrame(plots_sizes = Int64[])
for outputDir in outputDirs
# TODO refactor this later
inputFile::String = _get_input_file(extractor, outputDir)
parameters = _input_parser(extractor, inputFile)
rootPlotName = get(parameters, "amr.plot_file", "")
# find all directories with rootPlotName and get its size
plotFileDirs = helper_get_prefix_directories(string(outputDir, "/", rootPlotName))
plotsSize::Int64 = 0
for plotFileDir in plotFileDirs
sizeDir::Int64 = helper_get_directory_size(plotFileDir)
plotsSize += sizeDir
end
push!(plotsSizesData, [plotsSize])
end
println(plotsSizesData)
# Prepare the X independent variables in the linear model
XNames::Array{String} = extractor.outputs["plots_size"]
col1 = Symbol("amr.nplot_files")
col2 = Symbol("amr.ncells")
insert!(plotsSizesData, 2, X[!, col1] .* X[!, col2], :new_data)
#plotsSizesData[!,col1] =
#for XName in XNames
#columnName = Symbol(XName)
# this syntax [!, symbol] does not make a copy, use [:, symbol] for copies
#plotsSizesData[!, columnName] = X[!, columnName]
#end
# formula from https://discourse.julialang.org/t/glm-jl-with-unknown-column-names/20692/5
response = Symbol(names(plotsSizesData)[1])
predictors = Symbol.(names(plotsSizesData)[2:end])
println(plotsSizesData)
f = @eval(GLM.@formula($response ~ (+)($(predictors...))))
ols = GLM.lm(f, plotsSizesData)
println("I/O linear model formula:")
println(ols)
#import Plots
#display(Plots.plot(X, Y))
end
CheckPointVersion_1.0
3
0
0
0
(0 (0,0,0)(93750000,93750000,93750000) 1)
(RealBox 0 1500000000 0 1500000000 0 1500000000 )((0,0,0) (15,15,15) (0,0,0))P(0,0,0)
0.00036333937718578777
0.00036333937718578777
1
0
0
0
(0 (0,0,0)(93750000,93750000,93750000) 1)
(RealBox 0 1500000000 0 1500000000 0 1500000000 )((0,0,0) (15,15,15) (0,0,0))P(0,0,0)
(4 0
((0,0,0) (15,7,7) (0,0,0))
((0,0,8) (15,7,15) (0,0,0))
((0,8,0) (15,15,7) (0,0,0))
((0,8,8) (15,15,15) (0,0,0))
)4
((0,0,0) (15,15,15) (0,0,0))
(4 0
((0,0,0) (15,7,7) (0,0,0))
((0,0,8) (15,7,15) (0,0,0))
((0,8,0) (15,15,7) (0,0,0))
((0,8,8) (15,15,15) (0,0,0))
)-0.00036333937718578777
-0.00036333937718578777
0
0
1
Level_0/SD_0_New_MF
((0,0,0) (15,15,15) (0,0,0))
(4 0
((0,0,0) (15,7,7) (0,0,0))
((0,0,8) (15,7,15) (0,0,0))
((0,8,0) (15,15,7) (0,0,0))
((0,8,8) (15,15,15) (0,0,0))
)-0.00036333937718578777
-0.00036333937718578777
0
0
1
Level_0/SD_1_New_MF
((0,0,0) (15,15,15) (0,0,0))
(4 0
((0,0,0) (15,7,7) (0,0,0))
((0,0,8) (15,7,15) (0,0,0))
((0,8,0) (15,15,7) (0,0,0))
((0,8,8) (15,15,15) (0,0,0))
)-0.00036333937718578777
-0.00036333937718578777
0
0
0
((0,0,0) (15,15,15) (0,0,0))
(4 0
((0,0,0) (15,7,7) (0,0,0))
((0,0,8) (15,7,15) (0,0,0))
((0,8,0) (15,15,7) (0,0,0))
((0,8,8) (15,15,15) (0,0,0))
)-0.00036333937718578777
-0.00036333937718578777
0
0
1
Level_0/SD_3_New_MF
1
1
10
0
(4 0
((0,0,0) (15,7,7) (0,0,0))
((0,0,8) (15,7,15) (0,0,0))
((0,8,0) (15,15,7) (0,0,0))
((0,8,8) (15,15,15) (0,0,0))
)
4
FabOnDisk: SD_0_New_MF_D_00000 0
FabOnDisk: SD_0_New_MF_D_00002 0
FabOnDisk: SD_0_New_MF_D_00001 0
FabOnDisk: SD_0_New_MF_D_00003 0
4,10
1.0013580322265625e-05,0.0000000000000000e+00,0.0000000000000000e+00,0.0000000000000000e+00,1.5000150001500012e+15,1.5000150001500012e+15,1.4432683425637485e-01,1.0013580322265625e-05,1.0013580322265626e-35,1.0013580322265626e-35,
1.0013580322265625e-05,0.0000000000000000e+00,0.0000000000000000e+00,0.0000000000000000e+00,1.5000150001500012e+15,1.5000150001500012e+15,1.4432683425637485e-01,1.0013580322265625e-05,1.0013580322265626e-35,1.0013580322265626e-35,
1.0013580322265625e-05,0.0000000000000000e+00,0.0000000000000000e+00,0.0000000000000000e+00,1.5000150001500012e+15,1.5000150001500012e+15,1.4432683425637485e-01,1.0013580322265625e-05,1.0013580322265626e-35,1.0013580322265626e-35,
1.0013580322265625e-05,0.0000000000000000e+00,0.0000000000000000e+00,0.0000000000000000e+00,1.5000150001500012e+15,1.5000150001500012e+15,1.4432683425637485e-01,1.0013580322265625e-05,1.0013580322265626e-35,1.0013580322265626e-35,
4,10
1.0000000000000000e+09,0.0000000000000000e+00,0.0000000000000000e+00,0.0000000000000000e+00,1.5000150001500018e+15,1.5000150001500018e+15,1.4413109957829760e+13,1.0000000000000000e+09,1.0000000000000001e-21,1.0000000000000001e-21,
1.0000000000000000e+09,0.0000000000000000e+00,0.0000000000000000e+00,0.0000000000000000e+00,1.5000150001500018e+15,1.5000150001500018e+15,1.4413109957829760e+13,1.0000000000000000e+09,1.0000000000000001e-21,1.0000000000000001e-21,
1.0000000000000000e+09,0.0000000000000000e+00,0.0000000000000000e+00,0.0000000000000000e+00,1.5000150001500018e+15,1.5000150001500018e+15,1.4413109957829760e+13,1.0000000000000000e+09,1.0000000000000001e-21,1.0000000000000001e-21,
1.0000000000000000e+09,0.0000000000000000e+00,0.0000000000000000e+00,0.0000000000000000e+00,1.5000150001500018e+15,1.5000150001500018e+15,1.4413109957829760e+13,1.0000000000000000e+09,1.0000000000000001e-21,1.0000000000000001e-21,
1
1
1
1
(4 0
((0,0,0) (15,7,7) (0,0,0))
((0,0,8) (15,7,15) (0,0,0))
((0,8,0) (15,15,7) (0,0,0))
((0,8,8) (15,15,15) (0,0,0))
)
4
FabOnDisk: SD_1_New_MF_D_00000 0
FabOnDisk: SD_1_New_MF_D_00002 0
FabOnDisk: SD_1_New_MF_D_00001 0
FabOnDisk: SD_1_New_MF_D_00003 0
4,1
0.0000000000000000e+00,
0.0000000000000000e+00,
0.0000000000000000e+00,
0.0000000000000000e+00,
4,1
0.0000000000000000e+00,
0.0000000000000000e+00,
0.0000000000000000e+00,
0.0000000000000000e+00,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment