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.
Variables
generate_stokes_twofluid_element Namespace Reference

Variables

bool do_simplifications = False
 
int dim = 3
 
string mode = "c"
 
int nnodes = 3
 
int strain_size = 3
 
int initial_tabs = 0
 
int max_index = 30
 
string optimizations = 'basic'
 
bool replace_indices = False
 
bool impose_partion_of_unity = False
 
 N
 
 DN
 
 v = DefineMatrix('v',nnodes,dim)
 
 vn = DefineMatrix('vn',nnodes,dim)
 
 vnn = DefineMatrix('vnn',nnodes,dim)
 
 p = DefineVector('p',nnodes)
 
 w = DefineMatrix('w',nnodes,dim)
 
 q = DefineVector('q',nnodes)
 
 f = DefineMatrix('f',nnodes,dim)
 
 C = DefineSymmetricMatrix('C',strain_size,strain_size)
 
 dt = sympy.Symbol('dt', positive=True)
 
 rho = sympy.Symbol('rho', positive=True)
 
 tau1 = sympy.Symbol('tau1', positive=True)
 
 tau2 = sympy.Symbol('tau2')
 
 bdf0 = sympy.Symbol('bdf0')
 
 bdf1 = sympy.Symbol('bdf1')
 
 bdf2 = sympy.Symbol('bdf2')
 
 fgauss = DefineVector('fgauss',dim)
 
 vgauss = DefineVector('vgauss',dim)
 
 acch = DefineVector('acch',dim)
 
 pgauss = sympy.Symbol('pgauss')
 
 wgauss = w.transpose()*N
 
 qgauss = q.transpose()*N
 
 grad_v = DN.transpose()*v
 
 grad_q = DN.transpose()*q
 
 grad_p = DefineVector('grad_p',dim)
 
 stress = DefineVector('stress',3)
 
 B = MatrixB(DN)
 
 grad_sym_f = grad_sym_voigtform(DN,f)
 
 div_v = div(DN,v)
 
 div_w = div(DN,w)
 
 grad_sym_w = grad_sym_voigtform(DN,w)
 
 a = bdf0*v+bdf1*vn+bdf2*vnn
 
 grad_sym_res = grad_sym_voigtform(DN,f-rho*a)
 
 rv_galerkin = wgauss.transpose()*(fgauss - rho*acch) + div_w*pgauss - grad_sym_w.transpose()*stress -qgauss*div_v
 
 rv_stab = rho*div_w*tau2*div_v + grad_q.transpose()*(rho*tau1*(fgauss - rho*acch - grad_p) )
 
 rv = rv_galerkin + rv_stab
 TODO: it might be better to remove this term - it is the symmetric_gradient of the subscale! More...
 
 dofs = sympy.zeros(nnodes*(dim+1), 1)
 
 testfunc = sympy.zeros(nnodes*(dim+1), 1)
 
 rhs = Compute_RHS(rv, testfunc, do_simplifications)
 
 strain = grad_sym_voigtform(DN,v)
 HERE WE MUST SUBSTITUTE EXPRESSIONS. More...
 
 rhs_to_derive = rhs.copy()
 
tuple pgauss_expanded = (p.transpose()*N)[0]
 
 lhs = Compute_LHS(rhs_to_derive, testfunc, dofs, do_simplifications)
 obtain LHS by symbolic derivation More...
 
 penr = DefineVector('penr',nnodes)
 define enrichment variables More...
 
 qenr = DefineVector('qenr',nnodes)
 
 Nenr = DefineVector('Nenr',nnodes)
 
 DNenr = DefineMatrix('DNenr',nnodes, dim)
 
 grad_qenr = DNenr.transpose()*qenr
 
 grad_penr = DNenr.transpose()*penr
 
tuple penr_gauss = (penr.transpose()*Nenr)[0]
 
tuple rv_enriched = div_w*penr_gauss + grad_qenr.transpose()*(rho*tau1*(fgauss - rho*acch - grad_p - grad_penr)) + grad_q.transpose()*(rho*tau1*(- grad_penr))
 
 dofs_enr = sympy.Matrix( [[penr[0,0]],[penr[1,0]],[penr[2,0]],[penr[3,0]]] )
 
 testfunc_enr = sympy.Matrix( [[qenr[0,0]],[qenr[1,0]],[qenr[2,0]],[qenr[3,0]]] )
 
 rhs_eV
 K V x = b + rhs_eV H Kee penr = rhs_ee. More...
 
 V
 
 rhs_ee
 
 H
 
 Kee
 
 mu_eq = C[2,2]
 simplified way of computing tau More...
 
int inv_h2 = 0
 
int tau_denom = 3*mu_eq*inv_h2
 
 tau_denom_out = OutputSymbolicVariable(tau_denom,mode)
 
 templatefile = open("stokes_twofluid_cpp_template_3D.cpp")
 
 outstring = templatefile.read()
 
 out = open("stokes_3D_twofluid.cpp",'w')
 

Variable Documentation

◆ a

generate_stokes_twofluid_element.a = bdf0*v+bdf1*vn+bdf2*vnn

◆ acch

generate_stokes_twofluid_element.acch = DefineVector('acch',dim)

◆ B

generate_stokes_twofluid_element.B = MatrixB(DN)

◆ bdf0

generate_stokes_twofluid_element.bdf0 = sympy.Symbol('bdf0')

◆ bdf1

generate_stokes_twofluid_element.bdf1 = sympy.Symbol('bdf1')

◆ bdf2

generate_stokes_twofluid_element.bdf2 = sympy.Symbol('bdf2')

◆ C

generate_stokes_twofluid_element.C = DefineSymmetricMatrix('C',strain_size,strain_size)

◆ dim

int generate_stokes_twofluid_element.dim = 3

◆ div_v

generate_stokes_twofluid_element.div_v = div(DN,v)

◆ div_w

generate_stokes_twofluid_element.div_w = div(DN,w)

◆ DN

generate_stokes_twofluid_element.DN

◆ DNenr

generate_stokes_twofluid_element.DNenr = DefineMatrix('DNenr',nnodes, dim)

◆ do_simplifications

bool generate_stokes_twofluid_element.do_simplifications = False

◆ dofs

generate_stokes_twofluid_element.dofs = sympy.zeros(nnodes*(dim+1), 1)

◆ dofs_enr

generate_stokes_twofluid_element.dofs_enr = sympy.Matrix( [[penr[0,0]],[penr[1,0]],[penr[2,0]],[penr[3,0]]] )

◆ dt

generate_stokes_twofluid_element.dt = sympy.Symbol('dt', positive=True)

◆ f

generate_stokes_twofluid_element.f = DefineMatrix('f',nnodes,dim)

◆ fgauss

generate_stokes_twofluid_element.fgauss = DefineVector('fgauss',dim)

◆ grad_p

generate_stokes_twofluid_element.grad_p = DefineVector('grad_p',dim)

◆ grad_penr

generate_stokes_twofluid_element.grad_penr = DNenr.transpose()*penr

◆ grad_q

generate_stokes_twofluid_element.grad_q = DN.transpose()*q

◆ grad_qenr

generate_stokes_twofluid_element.grad_qenr = DNenr.transpose()*qenr

◆ grad_sym_f

generate_stokes_twofluid_element.grad_sym_f = grad_sym_voigtform(DN,f)

◆ grad_sym_res

generate_stokes_twofluid_element.grad_sym_res = grad_sym_voigtform(DN,f-rho*a)

◆ grad_sym_w

generate_stokes_twofluid_element.grad_sym_w = grad_sym_voigtform(DN,w)

◆ grad_v

generate_stokes_twofluid_element.grad_v = DN.transpose()*v

◆ H

generate_stokes_twofluid_element.H

◆ impose_partion_of_unity

bool generate_stokes_twofluid_element.impose_partion_of_unity = False

◆ initial_tabs

int generate_stokes_twofluid_element.initial_tabs = 0

◆ inv_h2

int generate_stokes_twofluid_element.inv_h2 = 0

◆ Kee

generate_stokes_twofluid_element.Kee

◆ lhs

generate_stokes_twofluid_element.lhs = Compute_LHS(rhs_to_derive, testfunc, dofs, do_simplifications)

obtain LHS by symbolic derivation

◆ max_index

int generate_stokes_twofluid_element.max_index = 30

◆ mode

string generate_stokes_twofluid_element.mode = "c"

◆ mu_eq

tuple generate_stokes_twofluid_element.mu_eq = C[2,2]

simplified way of computing tau

◆ N

generate_stokes_twofluid_element.N

◆ Nenr

generate_stokes_twofluid_element.Nenr = DefineVector('Nenr',nnodes)

◆ nnodes

int generate_stokes_twofluid_element.nnodes = 3

◆ optimizations

string generate_stokes_twofluid_element.optimizations = 'basic'

◆ out

generate_stokes_twofluid_element.out = open("stokes_3D_twofluid.cpp",'w')

◆ outstring

generate_stokes_twofluid_element.outstring = templatefile.read()

◆ p

generate_stokes_twofluid_element.p = DefineVector('p',nnodes)

◆ penr

generate_stokes_twofluid_element.penr = DefineVector('penr',nnodes)

define enrichment variables

◆ penr_gauss

tuple generate_stokes_twofluid_element.penr_gauss = (penr.transpose()*Nenr)[0]

◆ pgauss

generate_stokes_twofluid_element.pgauss = sympy.Symbol('pgauss')

◆ pgauss_expanded

tuple generate_stokes_twofluid_element.pgauss_expanded = (p.transpose()*N)[0]

◆ q

generate_stokes_twofluid_element.q = DefineVector('q',nnodes)

◆ qenr

generate_stokes_twofluid_element.qenr = DefineVector('qenr',nnodes)

◆ qgauss

generate_stokes_twofluid_element.qgauss = q.transpose()*N

◆ replace_indices

bool generate_stokes_twofluid_element.replace_indices = False

◆ rho

generate_stokes_twofluid_element.rho = sympy.Symbol('rho', positive=True)

◆ rhs

generate_stokes_twofluid_element.rhs = Compute_RHS(rv, testfunc, do_simplifications)

◆ rhs_ee

generate_stokes_twofluid_element.rhs_ee

◆ rhs_eV

generate_stokes_twofluid_element.rhs_eV

K V x = b + rhs_eV H Kee penr = rhs_ee.

◆ rhs_to_derive

generate_stokes_twofluid_element.rhs_to_derive = rhs.copy()

◆ rv

generate_stokes_twofluid_element.rv = rv_galerkin + rv_stab

TODO: it might be better to remove this term - it is the symmetric_gradient of the subscale!

◆ rv_enriched

generate_stokes_twofluid_element.rv_enriched = div_w*penr_gauss + grad_qenr.transpose()*(rho*tau1*(fgauss - rho*acch - grad_p - grad_penr)) + grad_q.transpose()*(rho*tau1*(- grad_penr))

◆ rv_galerkin

generate_stokes_twofluid_element.rv_galerkin = wgauss.transpose()*(fgauss - rho*acch) + div_w*pgauss - grad_sym_w.transpose()*stress -qgauss*div_v

◆ rv_stab

generate_stokes_twofluid_element.rv_stab = rho*div_w*tau2*div_v + grad_q.transpose()*(rho*tau1*(fgauss - rho*acch - grad_p) )

◆ strain

generate_stokes_twofluid_element.strain = grad_sym_voigtform(DN,v)

HERE WE MUST SUBSTITUTE EXPRESSIONS.

◆ strain_size

int generate_stokes_twofluid_element.strain_size = 3

◆ stress

generate_stokes_twofluid_element.stress = DefineVector('stress',3)

◆ tau1

generate_stokes_twofluid_element.tau1 = sympy.Symbol('tau1', positive=True)

◆ tau2

generate_stokes_twofluid_element.tau2 = sympy.Symbol('tau2')

◆ tau_denom

int generate_stokes_twofluid_element.tau_denom = 3*mu_eq*inv_h2

◆ tau_denom_out

generate_stokes_twofluid_element.tau_denom_out = OutputSymbolicVariable(tau_denom,mode)

◆ templatefile

generate_stokes_twofluid_element.templatefile = open("stokes_twofluid_cpp_template_3D.cpp")

◆ testfunc

generate_stokes_twofluid_element.testfunc = sympy.zeros(nnodes*(dim+1), 1)

◆ testfunc_enr

generate_stokes_twofluid_element.testfunc_enr = sympy.Matrix( [[qenr[0,0]],[qenr[1,0]],[qenr[2,0]],[qenr[3,0]]] )

◆ v

generate_stokes_twofluid_element.v = DefineMatrix('v',nnodes,dim)

◆ V

generate_stokes_twofluid_element.V

◆ vgauss

generate_stokes_twofluid_element.vgauss = DefineVector('vgauss',dim)

◆ vn

generate_stokes_twofluid_element.vn = DefineMatrix('vn',nnodes,dim)

◆ vnn

generate_stokes_twofluid_element.vnn = DefineMatrix('vnn',nnodes,dim)

◆ w

generate_stokes_twofluid_element.w = DefineMatrix('w',nnodes,dim)

◆ wgauss

generate_stokes_twofluid_element.wgauss = w.transpose()*N