Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.

Ansys Learning Forum Forums Discuss Simulation Photonics HEAT: Sweeping over geometry gives wrong/same results Reply To: HEAT: Sweeping over geometry gives wrong/same results

leon.neymeyer
Subscriber

Hi Amrita,

Thanks for your quick feedback. I have already written a script that sweeps the parameter manually, but I want to have a single data set so that I can use the results in MODE. So I would be very grateful if you could write me a sample script for the first option. Perhaps the code I have already written will help me understand the problem better.

 

 

deleteall;

deletesweep("spacing_sweep");

clear; clc;

# Material erstellen ########################

# Silizium

addmodelmaterial;

set("name","Silicon");

set("color",[0.5;0.5;0.5;1]);

addhtmaterialproperty("Solid");

set("name","Silicon");

select("::model::materials::Silicon::Silicon");

set("mass density.constant", 2330);

set("specific heat.constant", 711);

set("thermal conductivity.constant", 148);

 

# Gold  

addmodelmaterial;  

set("name","Gold");

set("color",[1;1;0;1]);

addhtmaterialproperty("Solid");

set("name","Gold");

select("::model::materials::Gold::Gold");

set("mass density.constant", 19300);

set("specific heat.constant", 129);

set("thermal conductivity.constant", 0.317);

 

# Polymer  

addmodelmaterial;

set("name","Polymer");

set("color",[0.5;1;1;0.33]);

addhtmaterialproperty("Solid");

set("name","Polymer");

select("::model::materials::Polymer::Polymer");

set("mass density.constant", 1200);

set("specific heat.constant", 1300);

set("thermal conductivity.constant", 0.2);

 

# Luft

addmodelmaterial;  

set("name","Air");

set("color",[0.5;0.5;1;0.2]);

addhtmaterialproperty("Fluid");

set("name","Air");

select("::model::materials::Air::Air");

set("mass density.constant", 1.17659);

set("specific heat.constant", 1006.43);

set("thermal conductivity.constant", 0.0263);

set("dynamic viscosity.constant", 1.85e-05);

set("thermal expansivity.constant", 1/300);

set("thermal expansivity.active model","Ideal Gas");

set("thermal expansivity.ideal gas.alpha", 1);

 

# Geometrie erstellen ########################

# Substrat

addrect;

set("name","substrate");

set("material","Silicon");

set("x span", 260e-6);

set("y span", 20e-6);

set("y", -30e-6);

set("z span", 1e-6);

set("mesh order", 2);

 

# Polymer

addrect;

set("name","polymer");

set("material","Polymer");

set("x span", 260e-6);

set("y span", 60e-6);

set("y", 10e-6);

set("z span", 1e-6);

set("mesh order", 4);

 

# Gas

addrect;

set("name","gas");

set("material","Air");

set("x span", 260e-6);

set("y span", 20e-6);

set("y", 50e-6);

set("z span", 1e-6);

set("mesh order", 2);

 

# Waveguide

for(i=0:11){

    x_position = -90e-6 + (i-1) * 20e-6;

    waveguide_name = "WG" + num2str(i);

    addrect;

    set("name", waveguide_name);

    set("material", "Polymer");

    set("x", x_position);

    set("y", 20e-6);

    set("x span", 3.2e-6);

    set("y span", 3.2e-6);

    set("y", 20e-6);

    set("z span", 1e-6);

    set("mesh order", 2);

}

    

# Simulations-Setup ########################

# Simulationsregion festlegen

select("simulation region");

set("dimension", "2D Z-Normal");

set("x span", 250e-6);

set("y span", 40e-6);

set("y", 15e-6);

 

# Solver hinzufügen

addheatsolver;

set("norm length", 200e-6);

set("max refine steps", 800000);

 

# Monitore setzen  

addtemperaturemonitor("HEAT");

set("name", "wg_monitor");

set("monitor type", "2D z-normal");

set("x span", 5e-6);

set("x", 30e-6);

set("y span", 5e-6);

set("y", 20e-6);

 

# Randbedingungen setzen

addtemperaturebc("HEAT");

set("surface type","solid");

set("temperature", 300);

set("surface type", "simulation region");

set("y min", true);

 

addconvectionbc("HEAT");

set("convection model", "constant");

set("ambient temperature", 300);

set("h convection", 10);

set("surface type", "material:material");

set("material 1", "Polymer");

set("material 2", "Air");

 

length_electrodes = linspace(5e-6, 40e-6, 7);

for(j=1:length(length_electrodes)){

    switchtolayout;

    # Daten Speichern

    file_name = "01_T_" + num2str(j);

    select("HEAT::wg_monitor");

    set("save data", true);

    set("filename", file_name);

    for(i=0:5){

        # Elektroden

        x_position = -60e-6 + (i-1) * 40e-6;

        electrode_name = "EL" + num2str(i);

        addrect;

        set("name", electrode_name);

        set("material", "Gold");

        set("x", x_position);

        set("y", 20e-6);

        set("x span", length_electrodes(j));

        set("y span", 0.2e-6);

        set("y", 30e-6);

        set("z span", 2e-6);

        set("mesh order", 2);

        if (j == 1){        

            # Heizquelle

            adduniformheat;

            name = "uniform_heat_EL" + num2str(i);

            set("name", name);

            set("geometry type", "volume");

            set("volume solid", electrode_name);

            set("total power", 0.00421);

            set("use solver norm length", true);

        }

    }

    run;

}

[bingo_chatbox]