Giter VIP home page Giter VIP logo

study-fpm's People

Contributors

liu-jincan avatar

Watchers

 avatar

study-fpm's Issues

9

1

4

1

Global mesh

First of all, thank you so much for developing this tool, it is very useful!

Is your feature request related to a problem? Please describe.

I want to create a globalized unstructured grid for WAVEWATCH3 to run, and the code to generate the grid is as follows (using the Example_7 program as a template):

min_el    = 20e3;  	             % pdf 3.1, minimum resolution in meters.
bbox      = [-180 180;-89 90];   % pdf 2.4, lon min lon max; lat min lat max
max_el    = 120e3; 		         % pdf 3.1, maximum resolution in meters. 
wl        = 30;                  % pdf 3.4, 30 elements resolve M2 wavelength.
dt        = 0;                   % pdf 4.2, Only reduces res away from coast
grade     = 0.35;                % pdf 4.1, mesh grade in decimal percent. 
R         = 3; 			         % pdf 3.3.2, Number of elements to resolve feature.
slp       = 10;                  % pdf 3.5, slope of 10
dem       = 'SRTM15+.nc';        % 
coastline = {'GSHHS_f_L1','GSHHS_f_L6'};
gdat1 = geodata('shp',coastline,'dem',dem,...
                    'bbox',bbox,'h0',min_el);           
fh1 = edgefx('geodata',gdat1,...
            'fs',R,'wl',wl,'max_el',max_el,...
            'slp',slp,'dt',dt,'g',grade); 
mshopts = meshgen('ef',fh1,'bou',gdat1,'nscreen',10,'plot_on',1,'proj','stereo');
mshopts = mshopts.build; 
m = mshopts.grd; % get out the msh object    
m = interp(m,gdat1,'nan','fill','mindepth',1);    

visualization of the m,

When I run write(m,'Global','ww3') , it shows an error in the function writeww3, this is because the variable opedat may be empty, so I modified part of the code of writeww3, (is this a bug?)

if(isempty(opedat))
    fprintf(fid,'%d\n', length(EToV(:,1)));
    m=0;
else
    fprintf(fid,'%d\n', length(EToV(:,1))+opedat.neta);
    m=0;
    for i=1:opedat.nope
        for j=1:opedat.nvdll(i)
            m=m+1;
            fprintf(fid,['%d %s %d %s %d %s %d %s %d %s %d\n'], m,'',15,'',2,'',0,'',0,'',opedat.nbdv(j,i));
        end
    end
end

I use the obtained mesh as input grid for WAVEWATCH3, the final output Netcdf file of WAVEWATCH3 shows the mesh is problematic,

This may be due to the fact that the generated grid surrounds the whole Earth. Steven R. Brus (https://gmd.copernicus.org/articles/14/2917/2021/) also points out the need to modify elements that straddle the −180–+180∘ boundary.

Describe the solution you'd like
Is it possible to remove the grid elements around -180 (or 180)?

Describe alternatives you've considered

  • When the grid range is determined as [-179.9,179.9;-89.9,89.9], a similar situation as above is encountered.
  • When the grid range is determined as [-179,179;-78,78], the final Netcdf shows the mesh is good.
  • when the grid range is determined as [-179,179;-89,89], the Mediterranean Sea is not taken into account.
  • Replace the projection from stereo to Robinson.
    Due to the following code in meshgen.m, you need to set h0 to very small for global meshes (stereo does not need to set h0 to very small to get global meshes).
% kjr Oct 2018 use outer coarsest box for
% multiscale meshing
lon_mi = obj.bbox{1}(1,1)-obj.h0(1)/1110;
lon_ma = obj.bbox{1}(1,2)+obj.h0(1)/1110;
lat_mi = obj.bbox{1}(2,1)-obj.h0(1)/1110;
lat_ma = obj.bbox{1}(2,2)+obj.h0(1)/1110;

Additional context
This is the first time I submit an issue on github, there may be problems with the format of the question, and I'm looking forward to getting a reply, thanks~~

2

First of all, thank you so much for developing this tool, it is very useful!

Is your feature request related to a problem? Please describe.

I want to create a globalized unstructured grid for WAVEWATCH3 to run, and the code to generate the grid is as follows (using the Example_7 program as a template):

min_el    = 20e3;  	             % pdf 3.1, minimum resolution in meters.
bbox      = [-180 180;-89 90];   % pdf 2.4, lon min lon max; lat min lat max
max_el    = 120e3; 		         % pdf 3.1, maximum resolution in meters. 
wl        = 30;                  % pdf 3.4, 30 elements resolve M2 wavelength.
dt        = 0;                   % pdf 4.2, Only reduces res away from coast
grade     = 0.35;                % pdf 4.1, mesh grade in decimal percent. 
R         = 3; 			         % pdf 3.3.2, Number of elements to resolve feature.
slp       = 10;                  % pdf 3.5, slope of 10
dem       = 'SRTM15+.nc';        % 
coastline = {'GSHHS_f_L1','GSHHS_f_L6'};
gdat1 = geodata('shp',coastline,'dem',dem,...
                    'bbox',bbox,'h0',min_el);           
fh1 = edgefx('geodata',gdat1,...
            'fs',R,'wl',wl,'max_el',max_el,...
            'slp',slp,'dt',dt,'g',grade); 
mshopts = meshgen('ef',fh1,'bou',gdat1,'nscreen',10,'plot_on',1,'proj','stereo');
mshopts = mshopts.build; 
m = mshopts.grd; % get out the msh object    
m = interp(m,gdat1,'nan','fill','mindepth',1);    

visualization of the m,

When I run write(m,'Global','ww3') , it shows an error in the function writeww3, this is because the variable opedat may be empty, so I modified part of the code of writeww3, (is this a bug?)

if(isempty(opedat))
    fprintf(fid,'%d\n', length(EToV(:,1)));
    m=0;
else
    fprintf(fid,'%d\n', length(EToV(:,1))+opedat.neta);
    m=0;
    for i=1:opedat.nope
        for j=1:opedat.nvdll(i)
            m=m+1;
            fprintf(fid,['%d %s %d %s %d %s %d %s %d %s %d\n'], m,'',15,'',2,'',0,'',0,'',opedat.nbdv(j,i));
        end
    end
end

I use the obtained mesh as input grid for WAVEWATCH3, the final output Netcdf file of WAVEWATCH3 shows the mesh is problematic,

This may be due to the fact that the generated grid surrounds the whole Earth. Steven R. Brus (https://gmd.copernicus.org/articles/14/2917/2021/) also points out the need to modify elements that straddle the −180–+180∘ boundary.

Describe the solution you'd like
Is it possible to remove the grid elements around -180 (or 180)?

Describe alternatives you've considered

  • When the grid range is determined as [-179.9,179.9;-89.9,89.9], a similar situation as above is encountered.
  • When the grid range is determined as [-179,179;-78,78], the final Netcdf shows the mesh is good.
  • when the grid range is determined as [-179,179;-89,89], the Mediterranean Sea is not taken into account.
  • Replace the projection from stereo to Robinson.
    Due to the following code in meshgen.m, you need to set h0 to very small for global meshes (stereo does not need to set h0 to very small to get global meshes).
% kjr Oct 2018 use outer coarsest box for
% multiscale meshing
lon_mi = obj.bbox{1}(1,1)-obj.h0(1)/1110;
lon_ma = obj.bbox{1}(1,2)+obj.h0(1)/1110;
lat_mi = obj.bbox{1}(2,1)-obj.h0(1)/1110;
lat_ma = obj.bbox{1}(2,2)+obj.h0(1)/1110;

Additional context
This is the first time I submit an issue on github, there may be problems with the format of the question, and I'm looking forward to getting a reply, thanks~~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.