Sub Project_14_EN(ByVal VecType, m, n, m1, n1 As Integer) ' 14_Spherical Symmetry_EN ' Updated: 27/03/24 ' Created by: Ariel R. Becerra (21/11/23) ' Modified by: _________________ ' This is the code of your new project. ' Steps to embed the code to ScienSolar: ' Note 1: The number 14 in the name of this function must match the one in the list of the CONFIG sheet for this project. If not, please correct it. ' Note 2: This code will be integrated into the main code to automate the download of the project. ' Note 3: The formulas and cell values generated here correspond only to the first 30 columns from INICIO to the right in the sheet. All your formulas and values are recommended to be written in these columns. ' Step 1. Go to the CONFIG sheet and add a short name and the number of your new project to the last row in the projects list. ' Step 2. Make sure that the list of projects in CONFIG sheet has the correct ascending numbering. ' Step 4. Open the VBA editor (Alt + F11 in Windows or Fn + Option + F11 in macOS). To avoid mistakes, make sure you only have one workbook open. ' Step 5. On the left, in the project explorer, select a non full module (or add a new one). ' Step 6. Select all the code in this file, copy and paste it at the end of the existing code in the module (or in the new one). ' Step 7. To load the project and to check it in a new sheet, go to the CONFIG sheet and click the New Sheet button, then select the project from the list and click the +Vector button. ' Step 8. Click any XYZ button to get the project in the coordinate system. Enjoy it! ' Visit www.sciensolar.com for news and updates of ? ScienSolar. Cells(m1 - 1, n1 + 2).FormulaR1C1 = "2" Cells(m1 + 0, n1 + 2).FormulaR1C1 = "=CONFIG!R3C4" Cells(m1 + 0, n1 + 3).FormulaR1C1 = "850" Cells(m1 + 0, n1 + 6).FormulaR1C1 = "=CONFIG!R3C8" Cells(m1 + 0, n1 + 7).FormulaR1C1 = "=CONFIG!R3C9" Cells(m1 + 0, n1 + 8).FormulaR1C1 = "Ariel R. Becerra (21/11/23)" Cells(m1 + 1, n1 + 2).FormulaR1C1 = "=CONFIG!R4C4" Cells(m1 + 1, n1 + 3).FormulaR1C1 = "400" Cells(m1 + 1, n1 + 4).FormulaR1C1 = "=CONFIG!R4C6" Cells(m1 + 1, n1 + 5).FormulaR1C1 = "0" Cells(m1 + 1, n1 + 6).FormulaR1C1 = "=CONFIG!R4C8" Cells(m1 + 1, n1 + 7).FormulaR1C1 = "=CONFIG!R4C9" Cells(m1 + 2, n1 + 2).FormulaR1C1 = "=CONFIG!R5C4" Cells(m1 + 2, n1 + 3).FormulaR1C1 = "1" Cells(m1 + 2, n1 + 4).FormulaR1C1 = "=CONFIG!R5C6" Cells(m1 + 2, n1 + 5).FormulaR1C1 = "15" Cells(m1 + 2, n1 + 6).FormulaR1C1 = "=CONFIG!R5C8" Cells(m1 + 2, n1 + 7).FormulaR1C1 = "=CONFIG!R5C9" Cells(m1 + 3, n1 + 0).FormulaR1C1 = "A" Cells(m1 + 3, n1 + 2).FormulaR1C1 = "=CONFIG!R6C4" Cells(m1 + 3, n1 + 3).FormulaR1C1 = "=CONFIG!R6C5" Cells(m1 + 3, n1 + 4).FormulaR1C1 = "=CONFIG!R6C6" Cells(m1 + 3, n1 + 5).FormulaR1C1 = "15" Cells(m1, n1 + 9).FormulaR1C1 = "HELP" Dim HELPtxt As String HELPtxt = "CAMPO DE SIMETR" & ChrW(205) & "A ESF" & ChrW(201) & "RICA" & Chr(10) & _ " (See english version at the end)" & Chr(10) & _ " El modelo muestra la distribuci" & ChrW(243) & "n en el espacio de un campo de simetr" & ChrW(237) & "a esf" & ChrW(233) & "rica, espec" & ChrW(237) & "ficamente el campo A = 1/r^2 = A/(raiz((Ax)^2 + (Ay)^2+(Az)^2 ))^3 que puede ser el campo de una carga puntual. A continuaci" & ChrW(243) & "n vemos las componentes del vector A en coordenadas esf" & ChrW(233) & "ricas:" & Chr(10) & _ " A12 = k Ax/(raiz((Ax)^2 + (Ay)^2) + (Az)^2)^3 " & Chr(10) & _ " B12 = k Ay/(raiz((Ax)^2 + (Ay)^2) + (Az)^2 )^3 " & Chr(10) & _ " C12 = k Az/(raiz((Ax)^2 + (Ay)^2) + (Az)^2 )^3," & Chr(10) & _ " en donde k es una constante que en este caso es negativa simulando el campo de una carga puntual negativa localizada en el centro de la esfera. En la celda C7 los par" & ChrW(225) & "metros de este campo pueden ser modificados de la siguiente manera: " & Chr(10) & _ " El primer par" & ChrW(233) & "ntesis cuadrado s[ ] indica el paso de incremento de la coordenada r, y el segundo, es decir r=[ ; ], el rango de visualizaci" & ChrW(243) & "n de r. " & Chr(10) & _ " El tercer par" & ChrW(233) & "ntesis cuadrado s2[ ] indica el paso de incremento de la coordenada phi, y el cuarto, es decir phi=[ ; ], el rango de visualizaci" & ChrW(243) & "n de phi. " & Chr(10) & _ " El quinto par" & ChrW(233) & "ntesis cuadrado s3[ ] indica el paso de incremento de la coordenada theta, y el sexto, es decir theta=[ ; ], el rango de visualizaci" & ChrW(243) & "n de theta. " & Chr(10) & _ " El par" & ChrW(225) & "metro color se utiliza para colorear el vector seg" & ChrW(250) & "n su longitud, el n" & ChrW(250) & "mero indica aproximadamente la longitud del vector m" & ChrW(225) & "s grande, el color se distribuye entre rojo (vector m" & ChrW(225) & "s peque" & ChrW(233) & "o) y violeta (vector m" & ChrW(225) & "s grande). El " & ChrW(250) & "ltimo par" & ChrW(233) & "ntesis [ ] indica el origen de las coordenadas, donde comienzan las distribuciones vectoriales. Encierre solo valores num" & ChrW(233) & "ricos entre punto y coma, no modifique la estructura de esta cadena, excepto si es un experto en MS Excel." & Chr(10) & _ " Puede modificar los valores entre los par" & ChrW(233) & "ntesis cuadrados y verificar los resultados, por eejmplo para un radio de la esfera igual a 10 y un recorrido de phi desde 90 a 180 en pasos de 5 modifique de la siguiente manera: s[5]r=[5;5]s2[5]phi=[90;180]s3[5]theta=[0;180]" & Chr(10) & _ " (ENGLISH)" & Chr(10) & _ " FIELD OF SPHERICAL SYMMETRY" & Chr(10) & _ " The model shows the distribution in space of a field of spherical symmetry, specifically the field A = 1/r^2 = A/(root((Ax)^2 + (Ay)^2+(Az)^2 ) ) ^ 3 which can be the field of a point charge. Next we see the components of vector A in spherical coordinates:" & Chr(10) & _ " A12 = k Ax/(root((Ax)^2 + (Ay)^2) + (Az)^2)^3" & Chr(10) & _ " B12 = k Ay/(root ((Ax)^2 + (Ay)^2) + (Az)^2 )^3" & Chr(10) & _ " C12 = k Az/(root((Ax)^2 + (Ay)^2) + (Az)^2 )^3," & Chr(10) & _ " where k is a constant that in this case is negative simulating the field of a negative point charge located in the center of the sphere. In cell C7 you can modify the parameters of this field as follows:" & Chr(10) & _ " The first bracket s[ ] indicates the increment step of the coordinate r, and the second, that is, r=[ ; ], the display range of r." & Chr(10) & _ " The third bracket s2[ ] indicates the increment step of the phi coordinate, and the fourth, that is, phi=[ ; ], the display range of phi." & Chr(10) & _ " The fifth bracket s3[ ] indicates the increment step of the theta coordinate, and the sixth, that is, theta=[ ; ], the display range of theta." & Chr(10) & _ " The color parameter is used to color the vector according to its length, the number indicates approximately the length of the largest vector, the color is distributed between red (smallest vector) and purple (largest vector). The last parenthesis [ ] indicates the origin of the coordinates, where vector distributions begin. Enclose only numeric values " & ChrW(233) & "" & ChrW(233) & "between semicolons, do not modify the structure of this string, except if you are an expert in MS Excel." & Chr(10) & _ " You can modify the values " & ChrW(233) & "" & ChrW(233) & "between square brackets and check the results, for example for a radius of the sphere equal to 10 and a range of phi from 90 to 180 in steps of 5 modify as follows: s[5]r= [ 5; 5]s2[5]phi=[90;180]s3[5]theta=[0;180]" Cells(m1, n1 + 9).Comment.Text Text:=HELPtxt If m = m1 + 0 Then ' vector 1 Cells(m + 3, n + -1).FormulaR1C1 = "1" Cells(m + 3, n + 0).FormulaR1C1 = "A" Cells(m + 3, n + 2).FormulaR1C1 = "=CONFIG!R6C4" Cells(m + 3, n + 3).FormulaR1C1 = "=CONFIG!R6C5" Cells(m + 3, n + 4).FormulaR1C1 = "=CONFIG!R6C6" Cells(m + 3, n + 5).FormulaR1C1 = "15" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 4, n + 1).FormulaR1C1 = "=""s[""&R[3]C[4]&""]r=[""&R[4]C[4]&"";""&R[5]C[4]&""]s2[""&R[8]C[4]&""]phi=[""&R[9]C[4]&"";""&R[10]C[4]&""]s3[""&R[13]C[4]&""]theta=[""&R[14]C[4]&"";""&R[15]C[4]&""]color=[50]origin[cart.]=[""&R[19]C[4]&"";""&R[20]C[4]&"";""&R[21]C[4]&""]tfactor=0,002543928s""" Cells(m + 4, n + 2).FormulaR1C1 = "Spherical Symmetry Field" Cells(m + 4, n + 12).FormulaR1C1 = "SPHERICAL SYMMETRY FIELD" Cells(m + 4, n + 24).FormulaR1C1 = "INSTRUCTIONS" Cells(m + 5, n + -1).FormulaR1C1 = "562" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0.3" Cells(m + 5, n + 4).FormulaR1C1 = "k =" Cells(m + 5, n + 5).FormulaR1C1 = "-800000" Cells(m + 6, n + 4).FormulaR1C1 = "r:" Cells(m + 7, n + -1).FormulaR1C1 = "=R[1]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[1]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[1]C" Cells(m + 7, n + 4).FormulaR1C1 = "Step:" Cells(m + 7, n + 5).FormulaR1C1 = "80" Cells(m + 7, n + 21).FormulaR1C1 = "The simulation shows the distribution of vectors in a certain region of space of avector field of spherical " Cells(m + 8, n + -1).FormulaR1C1 = "9.67086519515441" Cells(m + 8, n + 0).FormulaR1C1 = "-1.35915146682131" Cells(m + 8, n + 1).FormulaR1C1 = "-139.658967036375" Cells(m + 8, n + 2).FormulaR1C1 = " <-- Variable coordinates" Cells(m + 8, n + 4).FormulaR1C1 = "r_initial:" Cells(m + 8, n + 5).FormulaR1C1 = "140" Cells(m + 8, n + 21).FormulaR1C1 = "symmetry." Cells(m + 9, n + -1).FormulaR1C1 = "=R[-1]C*R[-4]C[6]/POWER(R[-1]C^2+R[-1]C[1]^2+R[-1]C[2]^2,3/2)" Cells(m + 9, n + 0).FormulaR1C1 = "=R[-1]C*R[-4]C[5]/POWER(R[-1]C[-1]^2+R[-1]C^2+R[-1]C[1]^2,3/2)" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-1]C*R[-4]C[4]/POWER(R[-1]C[-2]^2+R[-1]C[-1]^2+R[-1]C^2,3/2)" Cells(m + 9, n + 2).FormulaR1C1 = "<< ---FIELD FORMULA" Cells(m + 9, n + 4).FormulaR1C1 = "r_final" Cells(m + 9, n + 5).FormulaR1C1 = "140" Cells(m + 9, n + 21).FormulaR1C1 = "1. Modify the field display parameters in column G." Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 21).FormulaR1C1 = "2. The field shown in the simulation is E(r) = k/r^2 = (kx/r^3, ky/r^3,kz/r^3). The field formula is found" Cells(m + 11, n + -1).FormulaR1C1 = "4" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "Phi:" Cells(m + 11, n + 21).FormulaR1C1 = " in cells A12=E_x, B12=E_y, and C12=E_z." Cells(m + 3, n + 1).Interior.Color = "16777075" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Cells(m1 + 2, n1 - 1).Value = 1 End If ' vector ends If m = m1 + 0 Then Cells(m + 12, n + 4).FormulaR1C1 = "Step:" Cells(m + 12, n + 5).FormulaR1C1 = "10" Cells(m + 12, n + 21).FormulaR1C1 = "3. The minus sign of the constant k indicates the direction of the field towards the center." Cells(m + 13, n + 4).FormulaR1C1 = "initial_phi:" Cells(m + 13, n + 5).FormulaR1C1 = "0" Cells(m + 13, n + 21).FormulaR1C1 = "4. In cells G26, G27 and G28 the origin of the spherical coordinate system can be moved, however this " Cells(m + 14, n + 4).FormulaR1C1 = "phi_final" Cells(m + 14, n + 5).FormulaR1C1 = "360" Cells(m + 14, n + 22).FormulaR1C1 = "does not move the origin of the field source, which is located at the coordinate origin " Cells(m + 15, n + 22).FormulaR1C1 = "(for example a negative point charge )." Cells(m + 16, n + 4).FormulaR1C1 = "theta:" Cells(m + 16, n + 21).FormulaR1C1 = "5. Try moving the origin of the spherical coordinate system to the right, for example by setting G27=100. " Cells(m + 17, n + 4).FormulaR1C1 = "Step:" Cells(m + 17, n + 5).FormulaR1C1 = "10" Cells(m + 17, n + 22).FormulaR1C1 = "In this case it can be noted that although the field will continue to have spherical symmetry " Cells(m + 18, n + 4).FormulaR1C1 = "initial_theta:" Cells(m + 18, n + 5).FormulaR1C1 = "0" Cells(m + 18, n + 22).FormulaR1C1 = "with respect to the Cartesian origin, this symmetry cannot be observed if the origin " Cells(m + 19, n + 4).FormulaR1C1 = "theta_final" Cells(m + 19, n + 5).FormulaR1C1 = "180" Cells(m + 19, n + 22).FormulaR1C1 = "of spherical coordinates does not coincide with the position of the field source. " Cells(m + 20, n + 22).FormulaR1C1 = "The position of the field source is modified in the field formula itself, that is, in " Cells(m + 21, n + 4).FormulaR1C1 = "DISPLACEMENT OF THE" Cells(m + 21, n + 22).FormulaR1C1 = "cells A12, B12 and C12. Try to guess what the formula would be so that the point charge " Cells(m + 22, n + 4).FormulaR1C1 = "ORIGIN:" Cells(m + 22, n + 22).FormulaR1C1 = "also moves 100 units to the right and modify the formula accordingly. Remember to update" Cells(m + 23, n + 4).FormulaR1C1 = "x_0" Cells(m + 23, n + 5).FormulaR1C1 = "0" Cells(m + 23, n + 22).FormulaR1C1 = " your changes you must press XYZ or another update button." Cells(m + 24, n + 4).FormulaR1C1 = "y_0" Cells(m + 24, n + 5).FormulaR1C1 = "0" Cells(m + 25, n + 4).FormulaR1C1 = "z_0" Cells(m + 25, n + 5).FormulaR1C1 = "0" Cells(m + 26, n + 21).FormulaR1C1 = "Note: When exporting code using the Code button, some operating systems have problems when you indicate " Cells(m + 27, n + 21).FormulaR1C1 = "the file name with special characters (such as accent marks or others)." Cells(m + 28, n + 21).FormulaR1C1 = "To avoid these problems, indicate the file name without accents or special characters." Call BlackWhiteDesk Call PutEqBut End If ' actualizar hoja End Sub