-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEV] UFEM: Constant particle coagulation term
- Loading branch information
Showing
5 changed files
with
230 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
plugins/UFEM/test/particles/atest-ufem-particles-polydisperse-uniform.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import sys | ||
import coolfluid as cf | ||
import numpy as np | ||
import os | ||
from optparse import OptionParser | ||
import pylab as pl | ||
|
||
env = cf.Core.environment() | ||
|
||
# Global configuration | ||
env.assertion_throws = False | ||
env.assertion_backtrace = False | ||
env.exception_backtrace = False | ||
env.regist_signal_handlers = False | ||
env.log_level = 3 | ||
|
||
nu = 1./5000. | ||
|
||
segs = 32 | ||
D = 0.5 | ||
Vs = 1./(4.*np.pi) | ||
Ua = 0. | ||
Va = 0. | ||
|
||
tau = 0.25 | ||
beta = 3. | ||
|
||
dt = 0.001 | ||
|
||
numsteps = 200 | ||
write_interval = 50 | ||
|
||
|
||
# Create the model and solvers | ||
model = cf.Core.root().create_component('NavierStokes', 'cf3.solver.ModelUnsteady') | ||
domain = model.create_domain() | ||
physics = model.create_physics('cf3.UFEM.NavierStokesPhysics') | ||
physics.options.dimension = 2 | ||
solver = model.create_solver('cf3.UFEM.Solver') | ||
|
||
polydisp = solver.add_unsteady_solver('cf3.UFEM.particles.Polydisperse') | ||
polydisp.options.velocity_variable = 'Velocity' | ||
polydisp.options.velocity_tag = 'navier_stokes_u_solution' | ||
|
||
# Set up the physical constants | ||
physics.density = 1. | ||
physics.dynamic_viscosity = nu | ||
|
||
polydisp.initial_diameters = [(6./np.pi)**(1./3.), (12./np.pi)**(1./3.)] | ||
polydisp.initial_concentrations = [1., 0.0001] | ||
polydisp.nb_phases = 2 | ||
|
||
# Create the mesh | ||
mesh = domain.create_component('Mesh', 'cf3.mesh.Mesh') | ||
mesh_generator = domain.create_component("mesh_generator","cf3.mesh.SimpleMeshGenerator") | ||
mesh_generator.options().set("mesh",mesh.uri()) | ||
mesh_generator.options().set("nb_cells",[1, 1]) | ||
mesh_generator.options().set("lengths",[1.,1.]) | ||
mesh_generator.options().set("offsets",[0.,0.]) | ||
mesh_generator.execute() | ||
|
||
polydisp.regions = [mesh.topology.interior.uri()] | ||
|
||
polydisp.children.ConcentrationSolver.LSS.SolutionStrategy.Parameters.linear_solver_type = 'Amesos' | ||
|
||
series_writer = solver.TimeLoop.create_component('TimeWriter', 'cf3.solver.actions.TimeSeriesWriter') | ||
writer = series_writer.create_component('Writer', 'cf3.mesh.VTKXML.Writer') | ||
writer.file = cf.URI('polydisperse-uniform-{iteration}.pvtu') | ||
writer.mesh = mesh | ||
series_writer.interval = write_interval | ||
|
||
solver.create_fields() | ||
writer.fields = [mesh.geometry.particle_concentration_1.uri(), mesh.geometry.weighted_particle_volume_1.uri()] | ||
|
||
# Time setup | ||
time = model.create_time() | ||
time.time_step = dt | ||
time.end_time = numsteps*dt | ||
|
||
model.simulate() | ||
model.print_timing_tree() | ||
|
||
c0 = np.array(mesh.geometry.particle_concentration_0) | ||
c1 = np.array(mesh.geometry.particle_concentration_1) | ||
zeta0 = np.array(mesh.geometry.weighted_particle_volume_0) | ||
zeta1 = np.array(mesh.geometry.weighted_particle_volume_1) | ||
|
||
print 'zeta:', zeta0[0,0], zeta1[0,0] | ||
print 'c:', c0[0,0], c1[0,0] | ||
print 'v:', zeta0[0,0]/c0[0,0], zeta1[0,0]/c1[0,0] | ||
|
||
domain.write_mesh(cf.URI('polydisperse-uniform-end.pvtu')) |