Add files using upload-large-folder tool
Browse files- SIDA_generator_script/default.xml +154 -0
- SIDA_generator_script/generater.py +195 -0
SIDA_generator_script/default.xml
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
| 2 |
+
<configuration>
|
| 3 |
+
<domain>
|
| 4 |
+
<nodeSize>0.375e-3</nodeSize>
|
| 5 |
+
<nodeRatio>16 ,64 , 1</nodeRatio>
|
| 6 |
+
<centeredAlignment>False, False, False</centeredAlignment>
|
| 7 |
+
<boundaryConditions>
|
| 8 |
+
<material>
|
| 9 |
+
<west>Symmetry</west>
|
| 10 |
+
<east>ZeroGradient</east>
|
| 11 |
+
<south>FixedValue</south>
|
| 12 |
+
<valuesSouth>
|
| 13 |
+
<density> 1.61 </density>
|
| 14 |
+
<velocityX> 0.0 </velocityX>
|
| 15 |
+
<velocityY> 106.07 </velocityY>
|
| 16 |
+
<velocityZ> 0.0 </velocityZ>
|
| 17 |
+
<pressure> 153338.5 </pressure>
|
| 18 |
+
<dominantPhase> 1 </dominantPhase> <!-- For DEM simulations, a dominant phase via the material index must be specified. 1 = MaterialOne, ... -->
|
| 19 |
+
</valuesSouth>
|
| 20 |
+
<north>ZeroGradient</north>
|
| 21 |
+
<bottom>ZeroGradient</bottom>
|
| 22 |
+
<top>ZeroGradient</top>
|
| 23 |
+
</material>
|
| 24 |
+
</boundaryConditions>
|
| 25 |
+
<initialConditions>
|
| 26 |
+
<treeInitializationType>LevelBased</treeInitializationType>
|
| 27 |
+
<topologyInitializationType>BottomUp</topologyInitializationType>
|
| 28 |
+
<material1>// air
|
| 29 |
+
if (y < 8.25e-3) {
|
| 30 |
+
density :=1.61;
|
| 31 |
+
velocityX :=0.0;
|
| 32 |
+
velocityY :=106.07;
|
| 33 |
+
velocityZ :=0.0;
|
| 34 |
+
pressure :=153338.5;
|
| 35 |
+
} else {
|
| 36 |
+
density :=1.20;
|
| 37 |
+
velocityX :=0.0;
|
| 38 |
+
velocityY :=0.0;
|
| 39 |
+
velocityZ :=0.0;
|
| 40 |
+
pressure :=101325.0;
|
| 41 |
+
}</material1>
|
| 42 |
+
<material2>// water
|
| 43 |
+
density :=1000;
|
| 44 |
+
velocityX :=0.0;
|
| 45 |
+
velocityY :=0.0;
|
| 46 |
+
velocityZ :=0.0;
|
| 47 |
+
pressure :=101325.0;</material2>
|
| 48 |
+
<interface1>
|
| 49 |
+
<levelset>
|
| 50 |
+
<type>precompiled</type>
|
| 51 |
+
<operator>or</operator>
|
| 52 |
+
<data>
|
| 53 |
+
<function>Sphere</function>
|
| 54 |
+
<center>0.0, 9e-3, 0.0</center>
|
| 55 |
+
<centerSign>-1</centerSign>
|
| 56 |
+
<innerRadius>0.0</innerRadius>
|
| 57 |
+
<outerRadius>0.5e-3</outerRadius>
|
| 58 |
+
</data>
|
| 59 |
+
</levelset>
|
| 60 |
+
</interface1>
|
| 61 |
+
</initialConditions>
|
| 62 |
+
</domain>
|
| 63 |
+
<materials>
|
| 64 |
+
<numberOfMaterials>2</numberOfMaterials>
|
| 65 |
+
<numberOfPositiveMaterials>2</numberOfPositiveMaterials>
|
| 66 |
+
<material1>
|
| 67 |
+
<type>Fluid</type>
|
| 68 |
+
<equationOfState>
|
| 69 |
+
<type>StiffenedGas</type>
|
| 70 |
+
<gamma>1.4</gamma>
|
| 71 |
+
<backgroundPressure>0.0</backgroundPressure>
|
| 72 |
+
</equationOfState>
|
| 73 |
+
<properties>
|
| 74 |
+
<specificHeatCapacity>0.0</specificHeatCapacity>
|
| 75 |
+
<thermalConductivity>0.0</thermalConductivity>
|
| 76 |
+
<shearViscosity>0.0</shearViscosity>
|
| 77 |
+
<bulkViscosity>0.0</bulkViscosity>
|
| 78 |
+
</properties>
|
| 79 |
+
</material1>
|
| 80 |
+
<material2>
|
| 81 |
+
<type>Fluid</type>
|
| 82 |
+
<equationOfState>
|
| 83 |
+
<type>StiffenedGas</type>
|
| 84 |
+
<gamma>6.12</gamma>
|
| 85 |
+
<backgroundPressure>3.43e8</backgroundPressure>
|
| 86 |
+
</equationOfState>
|
| 87 |
+
<properties>
|
| 88 |
+
<specificHeatCapacity>0.0</specificHeatCapacity>
|
| 89 |
+
<thermalConductivity>0.0</thermalConductivity>
|
| 90 |
+
<shearViscosity>0.0</shearViscosity>
|
| 91 |
+
<bulkViscosity>0.0</bulkViscosity>
|
| 92 |
+
</properties>
|
| 93 |
+
</material2>
|
| 94 |
+
</materials>
|
| 95 |
+
<materialPairings>
|
| 96 |
+
<material1_2>
|
| 97 |
+
<surfaceTensionCoefficient>0.036</surfaceTensionCoefficient>
|
| 98 |
+
</material1_2>
|
| 99 |
+
</materialPairings>
|
| 100 |
+
<sourceTerms>
|
| 101 |
+
<gravity>0, 0, 0</gravity>
|
| 102 |
+
</sourceTerms>
|
| 103 |
+
<multiResolution>
|
| 104 |
+
<maximumLevel>0</maximumLevel>
|
| 105 |
+
<refinementCriterion>
|
| 106 |
+
<epsilonReference>0.01</epsilonReference>
|
| 107 |
+
<levelOfEpsilonReference>0</levelOfEpsilonReference>
|
| 108 |
+
</refinementCriterion>
|
| 109 |
+
</multiResolution>
|
| 110 |
+
<timeControl>
|
| 111 |
+
<startTime>0.0</startTime>
|
| 112 |
+
<endTime>15e-6</endTime>
|
| 113 |
+
<CFLNumber>0.5</CFLNumber>
|
| 114 |
+
</timeControl>
|
| 115 |
+
<dimensionalization>
|
| 116 |
+
<lengthReference>1.0</lengthReference>
|
| 117 |
+
<velocityReference>1.0</velocityReference>
|
| 118 |
+
<densityReference>1.0</densityReference>
|
| 119 |
+
<temperatureReference>1.0</temperatureReference>
|
| 120 |
+
<amountOfSubstanceReference>1.0</amountOfSubstanceReference>
|
| 121 |
+
</dimensionalization>
|
| 122 |
+
<restart>
|
| 123 |
+
<restore>
|
| 124 |
+
<mode>Off</mode>
|
| 125 |
+
<fileName>./Alpaca/ALPACA_WORKSHOP/build/droplet_RDEMIC/restart/restart_.h5</fileName>
|
| 126 |
+
</restore>
|
| 127 |
+
<snapshots>
|
| 128 |
+
<mode>Macro</mode>
|
| 129 |
+
<type>Interval</type>
|
| 130 |
+
<interval>50e-9</interval>
|
| 131 |
+
<intervalsToKeep>2</intervalsToKeep>
|
| 132 |
+
<stamps></stamps>
|
| 133 |
+
</snapshots>
|
| 134 |
+
</restart>
|
| 135 |
+
<output>
|
| 136 |
+
<timeNamingFactor>1.0e3</timeNamingFactor>
|
| 137 |
+
<!-- <standard>
|
| 138 |
+
<type>Interval</type>
|
| 139 |
+
<interval>1e-6</interval>
|
| 140 |
+
<stamps></stamps>
|
| 141 |
+
<minimalLevel>0</minimalLevel>
|
| 142 |
+
</standard> -->
|
| 143 |
+
<subDomain>
|
| 144 |
+
<type> Interval </type>
|
| 145 |
+
<interval> 0.25e-6 </interval>
|
| 146 |
+
<!-- <stamps> 0.0004, 0.0006 </stamps> -->
|
| 147 |
+
<minimalLevel> 0 </minimalLevel>
|
| 148 |
+
<box> <!-- The box to be used for the subdomain. -->
|
| 149 |
+
<min> 0.0, 8.35e-3, 2.0 </min>
|
| 150 |
+
<max> 1.3e-3, 11.05e-3, 3.0 </max>
|
| 151 |
+
</box>
|
| 152 |
+
</subDomain>
|
| 153 |
+
</output>
|
| 154 |
+
</configuration>
|
SIDA_generator_script/generater.py
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This script generates input files for ALPACA simulations of LIDE by varying key parameters using a Sobol sequence for sampling.
|
| 3 |
+
Change the parameters in the 'param_bounds' array to modify the ranges for high pressure, low pressure, laser width, and droplet radii.
|
| 4 |
+
First creates a set of .xml input files using "create_alpaca_input" function, then runs ALPACA on each generated input file using "run_alpaca" function.
|
| 5 |
+
For this change the number of simualtions and paths at the end of the script.
|
| 6 |
+
Keep the default.xml file in the same directory as this script as the code overwrites it to create new input files.
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
This problem setup is based on Weber number, We=(rho_g_2 * u_g_2^2 * D0 / sigma) and
|
| 10 |
+
Shock Mach number, Ma_s = u_s / c1
|
| 11 |
+
By having these two at hand
|
| 12 |
+
1. we use Ma_s to calculate all the conditions on post-shock region
|
| 13 |
+
using normal shock relations; the results will be initial condition for air in post-shock part.
|
| 14 |
+
2. we use We to calculate corresponding sigma, surface tension coefficient.
|
| 15 |
+
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
import os
|
| 19 |
+
import subprocess
|
| 20 |
+
import logging
|
| 21 |
+
import time
|
| 22 |
+
import math
|
| 23 |
+
import html
|
| 24 |
+
import re
|
| 25 |
+
from scipy.stats.qmc import Sobol, scale
|
| 26 |
+
from scipy.stats import qmc
|
| 27 |
+
import xmltodict
|
| 28 |
+
import numpy as np
|
| 29 |
+
import warnings
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def run_alpaca(
|
| 35 |
+
xml_file,
|
| 36 |
+
output_dir: str = None,
|
| 37 |
+
mpiexec_path: str = None,
|
| 38 |
+
exec_file_path: str = None,
|
| 39 |
+
num_workers: int = 10,
|
| 40 |
+
):
|
| 41 |
+
"""
|
| 42 |
+
Runs ALPACA with different parameters in .xml file.
|
| 43 |
+
|
| 44 |
+
Args:
|
| 45 |
+
xml_file (str): Path to the input .xml file to be processed.
|
| 46 |
+
mpiexec_path (str): Path to the mpiexec executable. Find using command "which mpiexec" in terminal.
|
| 47 |
+
exec_file_path (str): Path to the ALPACA executable file. Default is "./build/ALPACA".
|
| 48 |
+
num_workers (int): Number of cpu workers for parallel processing.
|
| 49 |
+
output_dir (str): Directory where output files will be saved.
|
| 50 |
+
"""
|
| 51 |
+
|
| 52 |
+
# Setup logging
|
| 53 |
+
logging.basicConfig(
|
| 54 |
+
filename=os.path.join(str(output_dir), 'data_generator.log'),
|
| 55 |
+
level=logging.INFO,
|
| 56 |
+
format='%(asctime)s [%(levelname)s] %(message)s'
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
# Check for executable ALAPACA location in command
|
| 60 |
+
command = [str(mpiexec_path), "-n", str(num_workers), str(exec_file_path), str(xml_file), str(output_dir)]
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
logging.info(f"Starting: {' '.join(command)}")
|
| 64 |
+
start_time = time.time()
|
| 65 |
+
result = subprocess.run(command, capture_output=True, text=True)
|
| 66 |
+
end_time = time.time()
|
| 67 |
+
|
| 68 |
+
elapsed = end_time - start_time
|
| 69 |
+
length = math.ceil(elapsed / 60)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
if result.returncode == 0:
|
| 73 |
+
logging.info(f"Completed {xml_file} successfully in {length:.2f} minutes; [{elapsed:.2f} seconds.]")
|
| 74 |
+
logging.debug(f"Output:\n{result.stdout}")
|
| 75 |
+
else:
|
| 76 |
+
logging.error(f"ALPACA failed on {xml_file} with return code {result.returncode}")
|
| 77 |
+
logging.error(f"stderr:\n{result.stderr}")
|
| 78 |
+
|
| 79 |
+
def round_sig(x, sig=4):
|
| 80 |
+
return float(f"{x:.{sig}g}")
|
| 81 |
+
|
| 82 |
+
def create_alpaca_input(
|
| 83 |
+
count: int,
|
| 84 |
+
base_path: str ,
|
| 85 |
+
output_path: str
|
| 86 |
+
):
|
| 87 |
+
|
| 88 |
+
"""
|
| 89 |
+
Generates a set of ALPACA input files with varying parameters for high pressure, low pressure, laser width, and the two radii of the droplet.
|
| 90 |
+
|
| 91 |
+
Args:
|
| 92 |
+
count (int): Number of samples to generate.
|
| 93 |
+
base_path (str): Path to the base .xml file that will be modified.
|
| 94 |
+
output_path (str): Directory where the generated .xml files will be saved. Create the directory if it does not exist.
|
| 95 |
+
"""
|
| 96 |
+
warnings.warn(f"[WARNING] Make sure the default base_input file {base_path} exists and untouched !!!.")
|
| 97 |
+
|
| 98 |
+
### fixed IC ###
|
| 99 |
+
D0 = 2*1e-3 #for now; may change to 10e-6 later
|
| 100 |
+
rho_drop = 1000 # [kg/m^3]
|
| 101 |
+
rho_gas_1 = 1.20 # [kg/m^3]
|
| 102 |
+
gamma = 1.4
|
| 103 |
+
p_gas_1 = 101325 # [Pa]
|
| 104 |
+
p_drop = p_gas_1
|
| 105 |
+
Temp_1 = 300 # [Kelvin]
|
| 106 |
+
c_1 = np.sqrt(gamma * 287 * Temp_1) # Speed of sound at Tempearture in Region 1 [m/s]
|
| 107 |
+
|
| 108 |
+
### Main params range ###
|
| 109 |
+
param_bounds = np.array([
|
| 110 |
+
[3.5, 5], # Ma_s
|
| 111 |
+
[500, 4e4], # We
|
| 112 |
+
])
|
| 113 |
+
|
| 114 |
+
n_samples = count
|
| 115 |
+
n_dims = param_bounds.shape[0]
|
| 116 |
+
sampler = qmc.Sobol(d=n_dims, scramble=True, seed=50)
|
| 117 |
+
samples_unit = sampler.random(n=n_samples)
|
| 118 |
+
params = qmc.scale(samples_unit, param_bounds[:, 0], param_bounds[:, 1]) #[N, D] = [count, n_dims]
|
| 119 |
+
params = np.vectorize(round_sig)(params, sig=4) # round them to have only 4 float digits
|
| 120 |
+
|
| 121 |
+
Ma_2 = [] # add post-shock flow Mach number
|
| 122 |
+
|
| 123 |
+
### calculations for IC and Write the default input.xml###
|
| 124 |
+
for i in range(n_samples):
|
| 125 |
+
|
| 126 |
+
with open(base_path) as f:
|
| 127 |
+
data = xmltodict.parse(f.read())
|
| 128 |
+
|
| 129 |
+
# parama[:, 0] = Ma_s
|
| 130 |
+
# parama[:, 1] = We
|
| 131 |
+
# Ref. normal shock relations
|
| 132 |
+
|
| 133 |
+
u_s = params[i, 0] * c_1
|
| 134 |
+
u_1_rel = - u_s
|
| 135 |
+
u_gas_1 = u_1_rel + u_s
|
| 136 |
+
Temp_2 = Temp_1 * ( 1 + (2*gamma*(params[i, 0]*params[i, 0]-1)) / (gamma+1) ) * ( (2+(gamma-1)*params[i, 0]*params[i, 0]) / ((gamma+1)*params[i, 0]*params[i, 0]) )
|
| 137 |
+
c_2 = np.sqrt(gamma * 287 * Temp_2)
|
| 138 |
+
Ma_2_rel = np.sqrt( (1+((gamma-1)/2)*params[i, 0]*params[i, 0]) / (gamma*params[i, 0]*params[i, 0]-((gamma-1)/2)) )
|
| 139 |
+
u_2_rel = Ma_2_rel * c_2
|
| 140 |
+
u_gas_2 = u_s - u_2_rel # >>> needed
|
| 141 |
+
rho_gas_2 = rho_gas_1 * ((gamma+1)*params[i, 0]*params[i, 0]) / (2+(gamma-1)*params[i, 0]*params[i, 0]) # >>> needed
|
| 142 |
+
p_gas_2 = p_gas_1 * (1 + (2*gamma*(params[i, 0]*params[i, 0]-1))/(gamma+1)) # >>> needed
|
| 143 |
+
Ma_2.append(u_gas_2 / c_2)
|
| 144 |
+
sigma = rho_gas_2 * u_gas_2*u_gas_2 * D0 / params[i, 1] # >>> needed
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
# BC
|
| 148 |
+
data["configuration"]["domain"]["boundaryConditions"]["material"]["valuesSouth"]["density"] = rho_gas_2
|
| 149 |
+
data["configuration"]["domain"]["boundaryConditions"]["material"]["valuesSouth"]["pressure"] = p_gas_2
|
| 150 |
+
data["configuration"]["domain"]["boundaryConditions"]["material"]["valuesSouth"]["velocityY"] = u_gas_2
|
| 151 |
+
|
| 152 |
+
# IC - Air
|
| 153 |
+
air_0 = data["configuration"]["domain"]["initialConditions"]["material1"]
|
| 154 |
+
air_1 = air_0.replace("density :=1.61;", f"density := {rho_gas_2};")
|
| 155 |
+
air_2 = air_1.replace("pressure :=153338.5;", f"pressure := {p_gas_2};")
|
| 156 |
+
air_3 = air_2.replace("velocityY :=106.07;", f"velocityY := {u_gas_2};")
|
| 157 |
+
data["configuration"]["domain"]["initialConditions"]["material1"] = air_3
|
| 158 |
+
|
| 159 |
+
# IC - Water drop is fixed
|
| 160 |
+
|
| 161 |
+
# Surface Tension
|
| 162 |
+
data["configuration"]["materialPairings"]["material1_2"]["surfaceTensionCoefficient"] = sigma
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
with open(output_path+ f"/Mas{"{:.4f}".format(params[i, 0])}_We{"{:.4f}".format(params[i, 1])}_Maf{"{:.4f}".format(Ma_2[i])}.xml", 'w') as f:
|
| 166 |
+
f.write(xmltodict.unparse(data, pretty=True))
|
| 167 |
+
|
| 168 |
+
Ma_2 = np.array(Ma_2).reshape(-1, 1)
|
| 169 |
+
params = np.hstack((params, Ma_2)) #turns into [N, D] = [count, 3]
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
count = 2 # Number of samples to generate. keep it multiple of 2 for Sobol sequence
|
| 176 |
+
inputs_output_path = "."
|
| 177 |
+
data_output_path = "."
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
create_alpaca_input(count=count,
|
| 181 |
+
base_path="./default.xml",
|
| 182 |
+
output_path=inputs_output_path)
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
inputs = []
|
| 186 |
+
for file in os.listdir(inputs_output_path):
|
| 187 |
+
if file.endswith(".xml"):
|
| 188 |
+
inputs.append(os.path.join(".", file))
|
| 189 |
+
run_alpaca(xml_file=os.path.join(str(inputs_output_path), str(inputs[-1])),
|
| 190 |
+
output_dir=str(data_output_path),
|
| 191 |
+
mpiexec_path="mpiexec",
|
| 192 |
+
exec_file_path="./build/ALPACA",
|
| 193 |
+
num_workers=10)
|
| 194 |
+
|
| 195 |
+
|