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 | |
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') | |
generate_stokes_twofluid_element.acch = DefineVector('acch',dim) |
generate_stokes_twofluid_element.B = MatrixB(DN) |
generate_stokes_twofluid_element.bdf0 = sympy.Symbol('bdf0') |
generate_stokes_twofluid_element.bdf1 = sympy.Symbol('bdf1') |
generate_stokes_twofluid_element.bdf2 = sympy.Symbol('bdf2') |
generate_stokes_twofluid_element.C = DefineSymmetricMatrix('C',strain_size,strain_size) |
int generate_stokes_twofluid_element.dim = 3 |
generate_stokes_twofluid_element.DN |
bool generate_stokes_twofluid_element.do_simplifications = False |
generate_stokes_twofluid_element.dofs_enr = sympy.Matrix( [[penr[0,0]],[penr[1,0]],[penr[2,0]],[penr[3,0]]] ) |
generate_stokes_twofluid_element.dt = sympy.Symbol('dt', positive=True) |
generate_stokes_twofluid_element.fgauss = DefineVector('fgauss',dim) |
generate_stokes_twofluid_element.grad_p = DefineVector('grad_p',dim) |
generate_stokes_twofluid_element.grad_penr = DNenr.transpose()*penr |
generate_stokes_twofluid_element.grad_q = DN.transpose()*q |
generate_stokes_twofluid_element.grad_qenr = DNenr.transpose()*qenr |
generate_stokes_twofluid_element.grad_v = DN.transpose()*v |
generate_stokes_twofluid_element.H |
bool generate_stokes_twofluid_element.impose_partion_of_unity = False |
int generate_stokes_twofluid_element.initial_tabs = 0 |
int generate_stokes_twofluid_element.inv_h2 = 0 |
generate_stokes_twofluid_element.Kee |
generate_stokes_twofluid_element.lhs = Compute_LHS(rhs_to_derive, testfunc, dofs, do_simplifications) |
obtain LHS by symbolic derivation
int generate_stokes_twofluid_element.max_index = 30 |
string generate_stokes_twofluid_element.mode = "c" |
tuple generate_stokes_twofluid_element.mu_eq = C[2,2] |
simplified way of computing tau
generate_stokes_twofluid_element.N |
generate_stokes_twofluid_element.Nenr = DefineVector('Nenr',nnodes) |
int generate_stokes_twofluid_element.nnodes = 3 |
string generate_stokes_twofluid_element.optimizations = 'basic' |
generate_stokes_twofluid_element.out = open("stokes_3D_twofluid.cpp",'w') |
generate_stokes_twofluid_element.outstring = templatefile.read() |
generate_stokes_twofluid_element.p = DefineVector('p',nnodes) |
generate_stokes_twofluid_element.penr = DefineVector('penr',nnodes) |
define enrichment variables
tuple generate_stokes_twofluid_element.penr_gauss = (penr.transpose()*Nenr)[0] |
generate_stokes_twofluid_element.pgauss = sympy.Symbol('pgauss') |
tuple generate_stokes_twofluid_element.pgauss_expanded = (p.transpose()*N)[0] |
generate_stokes_twofluid_element.q = DefineVector('q',nnodes) |
generate_stokes_twofluid_element.qenr = DefineVector('qenr',nnodes) |
generate_stokes_twofluid_element.qgauss = q.transpose()*N |
bool generate_stokes_twofluid_element.replace_indices = False |
generate_stokes_twofluid_element.rho = sympy.Symbol('rho', positive=True) |
generate_stokes_twofluid_element.rhs = Compute_RHS(rv, testfunc, do_simplifications) |
generate_stokes_twofluid_element.rhs_ee |
generate_stokes_twofluid_element.rhs_eV |
K V x = b + rhs_eV H Kee penr = rhs_ee.
generate_stokes_twofluid_element.rhs_to_derive = rhs.copy() |
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!
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)) |
generate_stokes_twofluid_element.rv_galerkin = wgauss.transpose()*(fgauss - rho*acch) + div_w*pgauss - grad_sym_w.transpose()*stress -qgauss*div_v |
generate_stokes_twofluid_element.rv_stab = rho*div_w*tau2*div_v + grad_q.transpose()*(rho*tau1*(fgauss - rho*acch - grad_p) ) |
HERE WE MUST SUBSTITUTE EXPRESSIONS.
int generate_stokes_twofluid_element.strain_size = 3 |
generate_stokes_twofluid_element.stress = DefineVector('stress',3) |
generate_stokes_twofluid_element.tau1 = sympy.Symbol('tau1', positive=True) |
generate_stokes_twofluid_element.tau2 = sympy.Symbol('tau2') |
generate_stokes_twofluid_element.templatefile = open("stokes_twofluid_cpp_template_3D.cpp") |
generate_stokes_twofluid_element.testfunc_enr = sympy.Matrix( [[qenr[0,0]],[qenr[1,0]],[qenr[2,0]],[qenr[3,0]]] ) |
generate_stokes_twofluid_element.V |
generate_stokes_twofluid_element.vgauss = DefineVector('vgauss',dim) |
generate_stokes_twofluid_element.wgauss = w.transpose()*N |