Skip to content

Commit

Permalink
Merge pull request #2866 from class4kayaker/fix_composition_init
Browse files Browse the repository at this point in the history
Adjust location of imposing bounds on vol fractions in composition init
  • Loading branch information
gassmoeller authored Apr 5, 2019
2 parents d789c6b + 262308c commit 95a55e9
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/volume_of_fluid/setup_initial_conditions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ namespace aspect
cell_vol += fe_init.JxW(i);
}

volume_of_fluid_val /= cell_vol;

volume_of_fluid_val = std::min(volume_of_fluid_val, 1.0);
volume_of_fluid_val = std::max(volume_of_fluid_val, 0.0);

initial_solution (local_dof_indices[volume_of_fluid_ind]) = volume_of_fluid_val/cell_vol;
initial_solution (local_dof_indices[volume_of_fluid_ind]) = volume_of_fluid_val;
}

initial_solution.compress(VectorOperation::insert);
Expand Down
83 changes: 83 additions & 0 deletions tests/vof_composition_init.prm
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Test for linear interface under constant velocity
# Error should be at machine precision

set Dimension = 2
set Start time = 0
set End time = 0
set Use years in output instead of seconds = false
set CFL number = 0.5
set Output directory = output

subsection Volume of Fluid
set Number initialization samples = 3
end

subsection Compositional fields
set Number of fields = 1
set Names of fields = F_1
set Compositional field methods = volume of fluid
end

subsection Mesh refinement
set Initial adaptive refinement = 0
set Initial global refinement = 2
set Time steps between mesh refinement = 0
end

subsection Geometry model
set Model name = box

subsection Box
set X extent = 100
set Y extent = 100
end
end

subsection Material model
set Model name = simple
end

subsection Gravity model
set Model name = vertical
end

subsection Initial temperature model
set Model name = function
end

subsection Initial composition model
set List of model names = function
set Volume of fluid intialization type = F_1:composition

subsection Function
set Variable names = x,y,t
set Function expression = 50-y
end
end

subsection Prescribed Stokes solution
set Model name = function
subsection Velocity function
set Variable names = x,y,t

set Function constants = init=1.25, x0=1.0, y0=0.0, xv=-0.25, yv=-0.25
set Function expression = xv;yv
end
end

set Nonlinear solver scheme = Advection only

subsection Postprocess
set List of postprocessors = volume of fluid statistics, composition statistics

subsection Visualization
set Interpolate output = false
set Time between graphical output = 1.0

set List of output variables = volume of fluid values

subsection Volume of Fluid
set Output interface reconstruction contour = true
end
end
end
20 changes: 20 additions & 0 deletions tests/vof_composition_init/screen-output
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Number of active cells: 16 (on 3 levels)
Number of degrees of freedom: 477 (162+25+81+81+16+48+64)

*** Timestep 0: t=0 seconds
Skipping temperature solve because RHS is zero.
Solving volume of fluid system... 0 iterations.
Solving volume of fluid system... 0 iterations.

Postprocessing:
Global volume of fluid volumes (m^3): 5e+03
Compositions min/max/mass: 0/1/4583

Termination requested by criterion: end time


+---------------------------------------------+------------+------------+
+---------------------------------+-----------+------------+------------+
+---------------------------------+-----------+------------+------------+

13 changes: 13 additions & 0 deletions tests/vof_composition_init/statistics
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 1: Time step number
# 2: Time (seconds)
# 3: Time step size (seconds)
# 4: Number of mesh cells
# 5: Number of Stokes degrees of freedom
# 6: Number of temperature degrees of freedom
# 7: Number of degrees of freedom for all compositions
# 8: Iterations for temperature solver
# 9: Global volume of fluid volumes for F_1
# 10: Minimal value for composition F_1
# 11: Maximal value for composition F_1
# 12: Global mass for composition F_1
0 0.000000000000e+00 0.000000000000e+00 16 187 81 81 0 5.00000000e+03 0.00000000e+00 1.00000000e+00 4.58333333e+03

0 comments on commit 95a55e9

Please sign in to comment.