Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:23:54

0001 import sympy
0002 
0003 
0004 def get_matrix_D(dFdr, dGdr, dFdqop, dGdqop, dFdt, dGdt, dqopqop, gradient=True):
0005     D = sympy.eye(8)
0006 
0007     assert dFdr.shape == (3, 3)
0008     assert dGdr.shape == (3, 3)
0009     assert dFdt.shape == (3, 3)
0010     assert dGdt.shape == (3, 3)
0011     assert dFdqop.shape == (3, 1)
0012     assert dGdqop.shape == (3, 1)
0013     assert type(dqopqop) == sympy.Symbol
0014 
0015     if gradient:
0016         D[0:3, 0:3] = dFdr
0017         D[4:7, 0:3] = dGdr
0018 
0019     D[0:3, 7:8] = dFdqop
0020     D[4:7, 7:8] = dGdqop
0021     D[0:3, 4:7] = dFdt
0022     D[4:7, 4:7] = dGdt
0023     D[7, 7] = dqopqop
0024 
0025     return D
0026 
0027 
0028 def add_transport_jacobian_substructure(J, gradient=True):
0029     tmp = sympy.eye(8)
0030 
0031     if gradient:
0032         tmp[0:3, 0:3] = J[0:3, 0:3]
0033         tmp[4:7, 0:3] = J[4:7, 0:3]
0034 
0035     tmp[0:3, 7:8] = J[0:3, 7:8]
0036     tmp[4:7, 7:8] = J[4:7, 7:8]
0037     tmp[0:3, 4:7] = J[0:3, 4:7]
0038     tmp[4:7, 4:7] = J[4:7, 4:7]
0039     tmp[7, 7] = J[7, 7]
0040 
0041     return tmp
0042 
0043 
0044 def get_generic_matrix_D(gradient=True):
0045     D = sympy.MatrixSymbol("D", 8, 8).as_explicit().as_mutable()
0046     return add_transport_jacobian_substructure(D, gradient=gradient)