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 | Functions | Variables
generate_convection_diffusion_explicit_element.py File Reference

Namespaces

 generate_convection_diffusion_explicit_element
 

Functions

def generate_convection_diffusion_explicit_element.DefineShapeFunctionsMatrix (dim, n_nodes, n_gauss)
 

Variables

bool generate_convection_diffusion_explicit_element.do_simplifications = False
 
string generate_convection_diffusion_explicit_element.dim_to_compute = "Both"
 
bool generate_convection_diffusion_explicit_element.stabilization = True
 
bool generate_convection_diffusion_explicit_element.OSS_stabilization = True
 
bool generate_convection_diffusion_explicit_element.dynamic_subscales = False
 
string generate_convection_diffusion_explicit_element.mode = "c"
 
list generate_convection_diffusion_explicit_element.dim_vector = [2]
 
string generate_convection_diffusion_explicit_element.template_filename = "d_convection_diffusion_explicit_cpp_template.cpp"
 
 generate_convection_diffusion_explicit_element.templatefile = open(template_filename)
 
 generate_convection_diffusion_explicit_element.outstring = templatefile.read()
 
string generate_convection_diffusion_explicit_element.output_filename = "d_convection_diffusion_explicit.cpp"
 
string generate_convection_diffusion_explicit_element.err_msg = "Wrong template_filename provided. Must be (template --> output):\n"
 
int generate_convection_diffusion_explicit_element.nnodes = 3
 
int generate_convection_diffusion_explicit_element.ngauss = 3
 
 generate_convection_diffusion_explicit_element.DN = DefineMatrix('DN', nnodes, dim)
 
def generate_convection_diffusion_explicit_element.mat_N = DefineShapeFunctionsMatrix(dim, nnodes, ngauss)
 
 generate_convection_diffusion_explicit_element.phi = DefineVector('phi',nnodes)
 
 generate_convection_diffusion_explicit_element.phi_old = DefineVector('phi_old',nnodes)
 
 generate_convection_diffusion_explicit_element.phi_subscale_gauss = DefineVector('phi_subscale_gauss',ngauss)
 
 generate_convection_diffusion_explicit_element.phi_acceleration_old = DefineVector('phi_acceleration_old',nnodes)
 
 generate_convection_diffusion_explicit_element.w = DefineMatrix('w',nnodes,dim)
 
 generate_convection_diffusion_explicit_element.q = DefineVector('q',nnodes)
 
 generate_convection_diffusion_explicit_element.f = DefineVector('f',nnodes)
 
 generate_convection_diffusion_explicit_element.alpha = Symbol('alpha',positive= True)
 
 generate_convection_diffusion_explicit_element.v = DefineMatrix('v',nnodes,dim)
 
 generate_convection_diffusion_explicit_element.tau = DefineVector('tau',ngauss)
 
 generate_convection_diffusion_explicit_element.delta_time = Symbol('delta_time',positive= True)
 
 generate_convection_diffusion_explicit_element.explicit_step_coefficient = Symbol('explicit_step_coefficient')
 
 generate_convection_diffusion_explicit_element.prj = DefineVector('prj',nnodes)
 
 generate_convection_diffusion_explicit_element.res_tot = Matrix(zeros(1,1))
 
 generate_convection_diffusion_explicit_element.res_OSS_tot = Matrix(zeros(1,1))
 
 generate_convection_diffusion_explicit_element.N = DefineVector('N', nnodes)
 
 generate_convection_diffusion_explicit_element.f_gauss = f.transpose()*N
 Estimate variables on gauss point ##########. More...
 
 generate_convection_diffusion_explicit_element.w_gauss = w.transpose()*N
 
 generate_convection_diffusion_explicit_element.q_gauss = q.transpose()*N
 
 generate_convection_diffusion_explicit_element.v_gauss = v.transpose()*N
 
 generate_convection_diffusion_explicit_element.phi_gauss = phi.transpose()*N
 
 generate_convection_diffusion_explicit_element.phi_old_gauss = phi_old.transpose()*N
 
 generate_convection_diffusion_explicit_element.phi_acceleration_old_gauss = phi_acceleration_old.transpose()*N
 
 generate_convection_diffusion_explicit_element.prj_gauss = prj.transpose()*N
 
 generate_convection_diffusion_explicit_element.grad_w = DfjDxi(DN,w)
 
 generate_convection_diffusion_explicit_element.grad_q = DfjDxi(DN,q)
 
 generate_convection_diffusion_explicit_element.grad_phi = DfjDxi(DN,phi)
 
 generate_convection_diffusion_explicit_element.grad_f = DfjDxi(DN,f)
 
 generate_convection_diffusion_explicit_element.div_w = ones(1,1)*sum([DN[i]*w[i] for i in range (0,len(DN))])
 
 generate_convection_diffusion_explicit_element.div_v = ones(1,1)*sum([DN[i]*v[i] for i in range (0,len(DN))])
 
 generate_convection_diffusion_explicit_element.rhs_forcing = q_gauss.transpose() * f_gauss
 Estimate residuals on gauss point ##########. More...
 
 generate_convection_diffusion_explicit_element.rhs_diffusion = - alpha * grad_phi.transpose() * grad_q
 
 generate_convection_diffusion_explicit_element.rhs_convective_1 = - q_gauss * (v_gauss.transpose() * grad_phi)
 
 generate_convection_diffusion_explicit_element.rhs_convective_2 = - q_gauss * phi_gauss * div_v
 
 generate_convection_diffusion_explicit_element.rhs_galerkin = rhs_forcing + rhs_diffusion + rhs_convective_1 + rhs_convective_2
 
 generate_convection_diffusion_explicit_element.rhs_stab_1_forcing = tau[i_gauss] * (v_gauss.transpose() * grad_q) * f_gauss
 Stabilization ASGS/OSS functional terms ##### ASGS/OSS Convective term. More...
 
 generate_convection_diffusion_explicit_element.rhs_stab_1_mass = - tau[i_gauss] * (grad_q.transpose() * v_gauss) * N.transpose() * (phi-phi_old)*explicit_step_coefficient
 
 generate_convection_diffusion_explicit_element.rhs_stab_1_convection_1 = - tau[i_gauss] * (v_gauss.transpose() * grad_q) * (v_gauss.transpose() * grad_phi)
 
 generate_convection_diffusion_explicit_element.rhs_stab_1_convection_2 = - tau[i_gauss] * (v_gauss.transpose() * grad_q) * phi_gauss * div_v
 
 generate_convection_diffusion_explicit_element.rhs_stab_1 = rhs_stab_1_forcing + rhs_stab_1_convection_1 + rhs_stab_1_convection_2 + rhs_stab_1_mass
 
 generate_convection_diffusion_explicit_element.rhs_stab_1_oss = tau[i_gauss] * (v_gauss.transpose() * grad_q) * prj_gauss
 
 generate_convection_diffusion_explicit_element.rhs_stab_1_dynamic = tau[i_gauss] * (v_gauss.transpose() * grad_q) * phi_subscale_gauss[i_gauss]/delta_time
 
 generate_convection_diffusion_explicit_element.rhs_stab_2_forcing = - tau[i_gauss] * q_gauss.transpose() * f_gauss
 
 generate_convection_diffusion_explicit_element.rhs_stab_2_mass = tau[i_gauss] * q_gauss.transpose() * N.transpose() * (phi-phi_old)*explicit_step_coefficient
 
 generate_convection_diffusion_explicit_element.rhs_stab_2_convection_1 = tau[i_gauss] * q_gauss * (v_gauss.transpose() * grad_phi)
 
 generate_convection_diffusion_explicit_element.rhs_stab_2_convection_2 = tau[i_gauss] * q_gauss * phi_gauss * div_v
 
 generate_convection_diffusion_explicit_element.rhs_stab_2_diffusion = tau[i_gauss] * alpha * grad_phi.transpose() * grad_q
 
 generate_convection_diffusion_explicit_element.rhs_stab_2_subgrid_old = - tau[i_gauss] * q_gauss.transpose() * phi_subscale_gauss[i_gauss]
 
 generate_convection_diffusion_explicit_element.rhs_stab_2_mass_subgrid_old = q_gauss.transpose() * phi_subscale_gauss[i_gauss] / delta_time
 
 generate_convection_diffusion_explicit_element.rhs_stab_2 = rhs_stab_2_forcing + rhs_stab_2_mass + rhs_stab_2_convection_1 + rhs_stab_2_convection_2 + rhs_stab_2_diffusion + rhs_stab_2_subgrid_old + rhs_stab_2_mass_subgrid_old
 
 generate_convection_diffusion_explicit_element.rhs_stab_2_oss = - tau[i_gauss] * q_gauss.transpose() * prj_gauss
 
 generate_convection_diffusion_explicit_element.rhs_stabilization = rhs_stab_1
 
 generate_convection_diffusion_explicit_element.lhs_OSS_forcing = - q_gauss.transpose() * f_gauss
 OSS step ##### with lhs we refer to the fact we take the strong equation on the left side. More...
 
 generate_convection_diffusion_explicit_element.lhs_OSS_mass = q_gauss.transpose() * (N.transpose() * (phi-phi_old)*explicit_step_coefficient)
 
 generate_convection_diffusion_explicit_element.lhs_OSS_mass_subscale = - q_gauss.transpose() * (phi_subscale_gauss[i_gauss]/delta_time)
 
 generate_convection_diffusion_explicit_element.lhs_OSS_diffusion = alpha * grad_phi.transpose() * grad_q
 
 generate_convection_diffusion_explicit_element.lhs_OSS_convective_1 = q_gauss * (v_gauss.transpose() * grad_phi)
 
 generate_convection_diffusion_explicit_element.lhs_OSS_convective_2 = q_gauss * phi_gauss * div_v
 
 generate_convection_diffusion_explicit_element.res_OSS = lhs_OSS_forcing + lhs_OSS_mass + lhs_OSS_diffusion + lhs_OSS_convective_1 + lhs_OSS_convective_2
 
 generate_convection_diffusion_explicit_element.res = rhs_galerkin + rhs_stabilization
 
 generate_convection_diffusion_explicit_element.dofs = Matrix( zeros(nnodes*(1), 1) )
 
 generate_convection_diffusion_explicit_element.testfunc = Matrix( zeros(nnodes*(1), 1) )
 
 generate_convection_diffusion_explicit_element.rhs = Compute_RHS(res_tot.copy(), testfunc, do_simplifications)
 
 generate_convection_diffusion_explicit_element.rhs_out = OutputVector_CollectingFactors(rhs, "rhs", mode)
 
string generate_convection_diffusion_explicit_element.to_substitute = 'DN(' + str(i_node) + ',' + str(j_dim) + ')'
 
string generate_convection_diffusion_explicit_element.substituted_value = 'DN_DX_' + str(i_node) + '_' + str(j_dim)
 
 generate_convection_diffusion_explicit_element.out = open(output_filename,'w')