KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Namespaces | Variables
generate_axisymmetric_navier_stokes_element.py File Reference

Namespaces

 generate_axisymmetric_navier_stokes_element
 

Variables

string generate_axisymmetric_navier_stokes_element.mode = "c"
 Symbolic generation settings. More...
 
bool generate_axisymmetric_navier_stokes_element.divide_by_rho = True
 
bool generate_axisymmetric_navier_stokes_element.ASGS_stabilization = True
 
bool generate_axisymmetric_navier_stokes_element.add_incompressibility_error = False
 
bool generate_axisymmetric_navier_stokes_element.do_simplifications = False
 
string generate_axisymmetric_navier_stokes_element.output_filename = "axisymmetric_navier_stokes.cpp"
 
string generate_axisymmetric_navier_stokes_element.template_filename = "axisymmetric_navier_stokes_cpp_template.cpp"
 
string generate_axisymmetric_navier_stokes_element.info_msg = f"\n"
 
list generate_axisymmetric_navier_stokes_element.dim_vector = [2, 2]
 
list generate_axisymmetric_navier_stokes_element.n_nodes_vector = [3, 4]
 
 generate_axisymmetric_navier_stokes_element.templatefile = open(template_filename)
 Initialize the outstring to be filled with the template .cpp file. More...
 
 generate_axisymmetric_navier_stokes_element.outstring = templatefile.read()
 Replace the computed RHS and LHS in the template outstring. More...
 
bool generate_axisymmetric_navier_stokes_element.impose_partion_of_unity = False
 Define shape functions, shape function gradients and integration weight. More...
 
 generate_axisymmetric_navier_stokes_element.gauss_weight = sympy.Symbol('w_gauss', positive = True)
 
 generate_axisymmetric_navier_stokes_element.N
 
 generate_axisymmetric_navier_stokes_element.DN
 
 generate_axisymmetric_navier_stokes_element.v = DefineMatrix('v',n_nodes,dim)
 Unknown fields definition. More...
 
 generate_axisymmetric_navier_stokes_element.v_n = DefineMatrix('v_n',n_nodes,dim)
 
 generate_axisymmetric_navier_stokes_element.v_nn = DefineMatrix('v_nn',n_nodes,dim)
 
 generate_axisymmetric_navier_stokes_element.p = DefineVector('p',n_nodes)
 
 generate_axisymmetric_navier_stokes_element.mu = sympy.Symbol('mu', positive = True)
 Fluid properties. More...
 
 generate_axisymmetric_navier_stokes_element.rho = sympy.Symbol('rho', positive = True)
 
 generate_axisymmetric_navier_stokes_element.w = DefineMatrix('w',n_nodes,dim)
 Test functions definition. More...
 
 generate_axisymmetric_navier_stokes_element.q = DefineVector('q',n_nodes)
 
 generate_axisymmetric_navier_stokes_element.f = DefineMatrix('f',n_nodes,dim)
 Other data definitions. More...
 
 generate_axisymmetric_navier_stokes_element.y = sympy.Symbol('y', positive = True)
 Other simbols definition. More...
 
 generate_axisymmetric_navier_stokes_element.h = sympy.Symbol('h', positive = True)
 
 generate_axisymmetric_navier_stokes_element.dt = sympy.Symbol('dt', positive = True)
 
 generate_axisymmetric_navier_stokes_element.dyn_tau = sympy.Symbol('dyn_tau', positive = True)
 
 generate_axisymmetric_navier_stokes_element.stab_c1 = sympy.Symbol('stab_c1', positive = True)
 
 generate_axisymmetric_navier_stokes_element.stab_c2 = sympy.Symbol('stab_c2', positive = True)
 
 generate_axisymmetric_navier_stokes_element.bdf0 = sympy.Symbol('bdf0')
 Backward differences coefficients. More...
 
 generate_axisymmetric_navier_stokes_element.bdf1 = sympy.Symbol('bdf1')
 
 generate_axisymmetric_navier_stokes_element.bdf2 = sympy.Symbol('bdf2')
 
 generate_axisymmetric_navier_stokes_element.f_gauss = f.transpose()*N
 Data interpolation to the Gauss points. More...
 
 generate_axisymmetric_navier_stokes_element.v_gauss = v.transpose()*N
 
 generate_axisymmetric_navier_stokes_element.p_gauss = p.transpose()*N
 
 generate_axisymmetric_navier_stokes_element.w_gauss = w.transpose()*N
 
 generate_axisymmetric_navier_stokes_element.q_gauss = q.transpose()*N
 
 generate_axisymmetric_navier_stokes_element.v_conv = DefineMatrix('v_conv', n_nodes, dim)
 Convective velocity definition. More...
 
 generate_axisymmetric_navier_stokes_element.v_conv_gauss = v_conv.transpose()*N
 
float generate_axisymmetric_navier_stokes_element.stab_norm_a = 0.0
 Compute the stabilization parameters. More...
 
float generate_axisymmetric_navier_stokes_element.tau1 = 1.0/((rho*dyn_tau)/dt + (stab_c2*rho*stab_norm_a)/h + (stab_c1*mu)/(h*h))
 
 generate_axisymmetric_navier_stokes_element.tau2 = mu + (stab_c2*rho*stab_norm_a*h)/stab_c1
 
tuple generate_axisymmetric_navier_stokes_element.accel_gauss = (bdf0*v + bdf1*v_n + bdf2*v_nn).transpose()*N
 Compute the rest of magnitudes at the Gauss points. More...
 
 generate_axisymmetric_navier_stokes_element.grad_w = DfjDxi(DN,w)
 Gradients computation (fluid dynamics gradient) More...
 
 generate_axisymmetric_navier_stokes_element.grad_q = DfjDxi(DN,q)
 
 generate_axisymmetric_navier_stokes_element.grad_p = DfjDxi(DN,p)
 
 generate_axisymmetric_navier_stokes_element.grad_v = DfjDxi(DN,v)
 
 generate_axisymmetric_navier_stokes_element.grad_v_conv = DfjDxi(DN,v_conv)
 
tuple generate_axisymmetric_navier_stokes_element.galerkin_functional = rho*w_gauss[0]*f_gauss[0] - rho*w_gauss[0]*accel_gauss[0] - rho*w_gauss[0]*v_conv_gauss[1]*grad_v[1,0] - rho*w_gauss[0]*v_conv_gauss[0]*grad_v[0,0] + grad_w[0,0]*p_gauss[0] - mu*grad_w[1,0]*grad_v[1,0] - mu*grad_w[0,0]*grad_v[0,0]
 Compute galerkin functional Navier-Stokes functional. More...
 
tuple generate_axisymmetric_navier_stokes_element.vel_residual_x = rho*f_gauss[0] - rho*accel_gauss[0] - rho*v_conv_gauss[1]*grad_v[1,0] - rho*v_conv_gauss[0]*grad_v[0,0] - grad_p[0] + (mu/y)*grad_v[1,0]
 Stabilization functional terms Momentum conservation residual Note that the second order viscous stress terms are dropped since linear elements are used. More...
 
tuple generate_axisymmetric_navier_stokes_element.vel_residual_y = rho*f_gauss[1] - rho*accel_gauss[1] - rho*v_conv_gauss[1]*grad_v[1,1] - rho*v_conv_gauss[0]*grad_v[0,1] - grad_p[1] - mu*v_gauss[1]/y**2 + (mu/y)*grad_v[1,1]
 
 generate_axisymmetric_navier_stokes_element.mas_residual = - v_gauss[1]/y - grad_v[1,1] - grad_v[0,0]
 
float generate_axisymmetric_navier_stokes_element.vel_subscale_x = tau1*vel_residual_x
 
float generate_axisymmetric_navier_stokes_element.vel_subscale_y = tau1*vel_residual_y
 
 generate_axisymmetric_navier_stokes_element.pres_subscale = tau2*mas_residual
 
float generate_axisymmetric_navier_stokes_element.stabilization_functional = - q_gauss[0]*vel_subscale_y/y + grad_q[1]*vel_subscale_y + grad_q[0]*vel_subscale_x
 
tuple generate_axisymmetric_navier_stokes_element.functional = galerkin_functional
 Add the stabilization terms to the original residual terms. More...
 
 generate_axisymmetric_navier_stokes_element.dofs = sympy.zeros(n_nodes*(dim+1), 1)
 Define DOFs and test function vectors. More...
 
 generate_axisymmetric_navier_stokes_element.test_func = sympy.zeros(n_nodes*(dim+1), 1)
 
 generate_axisymmetric_navier_stokes_element.aux_functional = sympy.Matrix([[functional]])
 Compute LHS and RHS. More...
 
 generate_axisymmetric_navier_stokes_element.rhs = Compute_RHS(aux_functional.copy(), test_func, do_simplifications)
 
 generate_axisymmetric_navier_stokes_element.rhs_out = OutputVector_CollectingFactors(gauss_weight * rhs, "rRHS", mode, assignment_op='+=')
 
 generate_axisymmetric_navier_stokes_element.lhs = Compute_LHS(rhs, test_func, dofs, do_simplifications)
 
 generate_axisymmetric_navier_stokes_element.lhs_out = OutputMatrix_CollectingFactors(gauss_weight * lhs, "rLHS", mode, assignment_op='+=')
 
 generate_axisymmetric_navier_stokes_element.out = open(output_filename,'w')
 Write the modified template. More...